Completed
Push — work-fleets ( abbbcf...8b8b7f )
by SuperNova.WS
05:13
created
includes/functions/int_fleet_events.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@  discard block
 block discarded – undo
6 6
   $fleet_events = array();
7 7
   $fleet_number = 0;
8 8
 
9
-  if($objFleetList->count() <= 0) {
9
+  if ($objFleetList->count() <= 0) {
10 10
     return;
11 11
   }
12 12
 
13
-  foreach($objFleetList->_container as $objFleet) {
13
+  foreach ($objFleetList->_container as $objFleet) {
14 14
     $planet_start_type = $objFleet->fleet_start_type == PT_MOON ? PT_MOON : PT_PLANET;
15 15
     $planet_start = db_planet_by_gspt($objFleet->fleet_start_galaxy, $objFleet->fleet_start_system, $objFleet->fleet_start_planet, $planet_start_type, false, 'name');
16 16
     $objFleet->fleet_start_name = $planet_start['name'];
17 17
 
18 18
     $planet_end_type = $objFleet->fleet_end_type == PT_MOON ? PT_MOON : PT_PLANET;
19
-    if($objFleet->fleet_end_planet > $config->game_maxPlanet) {
19
+    if ($objFleet->fleet_end_planet > $config->game_maxPlanet) {
20 20
       $objFleet->fleet_end_name = $lang['ov_fleet_exploration'];
21
-    } elseif($objFleet->mission_type == MT_COLONIZE) {
21
+    } elseif ($objFleet->mission_type == MT_COLONIZE) {
22 22
       $objFleet->fleet_end_name = $lang['ov_fleet_colonization'];
23 23
     } else {
24 24
       $planet_end = db_planet_by_gspt($objFleet->fleet_end_galaxy, $objFleet->fleet_end_system, $objFleet->fleet_end_planet, $planet_end_type, false, 'name');
25 25
       $objFleet->fleet_end_name = $planet_end['name'];
26 26
     }
27 27
 
28
-    if($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE &&
28
+    if ($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE &&
29 29
       ($planet_scanned === false
30 30
         ||
31 31
         (
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
       $fleet_events[] = flt_register_event_objFleet($objFleet, 0, $planet_end_type);
40 40
     }
41 41
 
42
-    if($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) {
42
+    if ($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) {
43 43
       $fleet_events[] = flt_register_event_objFleet($objFleet, 1, $planet_end_type);
44 44
     }
45 45
 
46
-    if(
46
+    if (
47 47
       $objFleet->time_return_to_source > SN_TIME_NOW && $objFleet->mission_type != MT_MISSILE && ($objFleet->isReturning() || ($objFleet->mission_type != MT_RELOCATE && $objFleet->mission_type != MT_COLONIZE)) &&
48 48
       (
49 49
         ($planet_scanned === false && $objFleet->playerOwnerId == $user['id'])
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
       $fleet_events[] = flt_register_event_objFleet($objFleet, 2, $planet_end_type);
60 60
     }
61 61
 
62
-    if($objFleet->mission_type == MT_MISSILE) {
62
+    if ($objFleet->mission_type == MT_MISSILE) {
63 63
       $fleet_events[] = flt_register_event_objFleet($objFleet, 3, $planet_end_type);
64 64
     }
65 65
   }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
   $is_this_planet = false;
81 81
 
82
-  switch($objFleet->ov_label = $ov_label) {
82
+  switch ($objFleet->ov_label = $ov_label) {
83 83
     case 0:
84 84
       $objFleet->event_time = $objFleet->time_arrive_to_target;
85 85
       $is_this_planet = (
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 
111 111
   }
112 112
 
113
-  $objFleet->ov_this_planet = $is_this_planet;// || $planet_scanned != false;
113
+  $objFleet->ov_this_planet = $is_this_planet; // || $planet_scanned != false;
114 114
 
115
-  if($objFleet->playerOwnerId == $user['id']) {
115
+  if ($objFleet->playerOwnerId == $user['id']) {
116 116
     $user_data = $user;
117 117
   } else {
118 118
     $user_data = db_user_by_id($objFleet->playerOwnerId);
Please login to merge, or discard this patch.
galaxy.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 $uni_system = sys_get_param_int('system', $planetrow['system']);
19 19
 $planet = sys_get_param_int('planet', $planetrow['planet']);
20 20
 
21
-if($mode == 'name') {
21
+if ($mode == 'name') {
22 22
   require_once('includes/includes/uni_rename.php');
23 23
 }
24 24
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 $flying_fleet_count = FleetList::fleet_count_flying($user['id']);
41 41
 
42
-if($mode == 1) {
43
-} elseif($mode == 2 || $mode == 3) {
42
+if ($mode == 1) {
43
+} elseif ($mode == 2 || $mode == 3) {
44 44
   $planet = $planetrow['planet'];
45 45
 } else {
46 46
   $uni_galaxy = $planetrow['galaxy'];
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 $PhalanxRange = GetPhalanxRange($HavePhalanx);
67 67
 
68 68
 $planet_precache_query = db_planet_list_in_system($uni_galaxy, $uni_system);
69
-if(!empty($planet_precache_query)) {
70
-  foreach($planet_precache_query as $planet_row) {
69
+if (!empty($planet_precache_query)) {
70
+  foreach ($planet_precache_query as $planet_row) {
71 71
     $planet_list[$planet_row['planet']][$planet_row['planet_type']] = $planet_row;
72 72
   }
73 73
 }
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
  * @var Fleet[][][] $fleet_list
86 86
  */
87 87
 $fleet_list = array();
88
-foreach($system_fleet_list->_container as $objFleetSystem) {
89
-  if(!$objFleetSystem->isReturning()) {
88
+foreach ($system_fleet_list->_container as $objFleetSystem) {
89
+  if (!$objFleetSystem->isReturning()) {
90 90
     $fleet_planet = $objFleetSystem->fleet_end_planet;
91 91
     $fleet_type = $objFleetSystem->fleet_end_type;
92 92
   } else {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 $recycler_info = array();
102 102
 $planet_recyclers_orbiting = 0;
103 103
 $recyclers_fleet = array();
104
-foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
104
+foreach (sn_get_groups('flt_recyclers') as $recycler_id) {
105 105
   $recycler_info[$recycler_id] = get_ship_data($recycler_id, $user);
106 106
   $recyclers_fleet[$recycler_id] = mrc_get_level($user, $planetrow, $recycler_id);
107 107
   $planet_recyclers_orbiting += $recyclers_fleet[$recycler_id];
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 $fleet_id = 1;
112 112
 $fleets = array();
113 113
 $config_game_max_planet = $config->game_maxPlanet + 1;
114
-for($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
114
+for ($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
115 115
   unset($uni_galaxyRowPlanet);
116 116
   unset($uni_galaxyRowMoon);
117 117
   unset($uni_galaxyRowUser);
@@ -121,27 +121,27 @@  discard block
 block discarded – undo
121 121
   $uni_galaxyRowPlanet = $planet_list[$Planet][PT_PLANET];
122 122
 
123 123
   $planet_fleet_id = 0;
124
-  if($uni_galaxyRowPlanet['destruyed']) {
124
+  if ($uni_galaxyRowPlanet['destruyed']) {
125 125
     CheckAbandonPlanetState($uni_galaxyRowPlanet);
126
-  } elseif($uni_galaxyRowPlanet['id']) {
127
-    if($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
126
+  } elseif ($uni_galaxyRowPlanet['id']) {
127
+    if ($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
128 128
       $uni_galaxyRowUser = $cached['users'][$uni_galaxyRowPlanet['id_owner']];
129 129
     } else {
130 130
       $uni_galaxyRowUser = db_user_by_id($uni_galaxyRowPlanet['id_owner']);
131 131
       $cached['users'][$uni_galaxyRowUser['id']] = $uni_galaxyRowUser;
132 132
     }
133 133
 
134
-    if(!$uni_galaxyRowUser['id']) {
134
+    if (!$uni_galaxyRowUser['id']) {
135 135
       $debug->warning("Planet '{$uni_galaxyRowPlanet['name']}' [{$uni_galaxy}:{$uni_system}:{$Planet}] has no owner!", 'Userless planet', 503);
136 136
       $uni_galaxyRowPlanet['destruyed'] = SN_TIME_NOW + 60 * 60 * 24;
137 137
       $uni_galaxyRowPlanet['id_owner'] = 0;
138 138
       db_planet_set_by_id($uni_galaxyRowPlanet['id'], "id_owner = 0, destruyed = {$uni_galaxyRowPlanet['destruyed']}");
139 139
     }
140 140
 
141
-    if($uni_galaxyRowUser['id']) {
141
+    if ($uni_galaxyRowUser['id']) {
142 142
       $planetcount++;
143
-      if($uni_galaxyRowUser['ally_id']) {
144
-        if($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
143
+      if ($uni_galaxyRowUser['ally_id']) {
144
+        if ($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
145 145
           $allyquery = $cached['allies'][$uni_galaxyRowUser['ally_id']];
146 146
         } else {
147 147
           $allyquery = db_ally_get_by_id($uni_galaxyRowUser['ally_id']);
@@ -150,19 +150,19 @@  discard block
 block discarded – undo
150 150
       }
151 151
 
152 152
       $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_PLANET]);
153
-      if(!empty($fleets_to_planet['own']['count'])) {
153
+      if (!empty($fleets_to_planet['own']['count'])) {
154 154
         $planet_fleet_id = $fleet_id;
155 155
         $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
156 156
         $fleet_id++;
157 157
       }
158 158
 
159 159
       $uni_galaxyRowMoon = $planet_list[$Planet][PT_MOON];
160
-      if($uni_galaxyRowMoon['destruyed']) {
160
+      if ($uni_galaxyRowMoon['destruyed']) {
161 161
         CheckAbandonPlanetState($uni_galaxyRowMoon);
162 162
       } else {
163 163
         $moon_fleet_id = 0;
164 164
         $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_MOON]);
165
-        if(!empty($fleets_to_planet['own']['count'])) {
165
+        if (!empty($fleets_to_planet['own']['count'])) {
166 166
           $moon_fleet_id = $fleet_id;
167 167
           $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
168 168
           $fleet_id++;
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 
174 174
   $recyclers_incoming_capacity = 0;
175 175
   $uni_galaxyRowPlanet['debris'] = $uni_galaxyRowPlanet['debris_metal'] + $uni_galaxyRowPlanet['debris_crystal'];
176
-  if($uni_galaxyRowPlanet['debris']) {
177
-    if(!empty($fleet_list[$Planet][PT_DEBRIS])) {
178
-      foreach($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
179
-        if($objFleetToDebris->playerOwnerId == $user['id']) {
176
+  if ($uni_galaxyRowPlanet['debris']) {
177
+    if (!empty($fleet_list[$Planet][PT_DEBRIS])) {
178
+      foreach ($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
179
+        if ($objFleetToDebris->playerOwnerId == $user['id']) {
180 180
           $recyclers_incoming_capacity += $objFleetToDebris->shipsGetCapacityRecyclers($recycler_info);
181 181
         }
182 182
       }
@@ -253,21 +253,21 @@  discard block
 block discarded – undo
253 253
 
254 254
 tpl_assign_fleet($template, $fleets);
255 255
 
256
-foreach(sn_get_groups('defense_active') as $unit_id) {
256
+foreach (sn_get_groups('defense_active') as $unit_id) {
257 257
   $template->assign_block_vars('defense_active', array(
258 258
     'ID'   => $unit_id,
259 259
     'NAME' => $lang['tech'][$unit_id],
260 260
   ));
261 261
 }
262 262
 
263
-foreach($cached['users'] as $PlanetUser) {
264
-  if(!$PlanetUser) {
263
+foreach ($cached['users'] as $PlanetUser) {
264
+  if (!$PlanetUser) {
265 265
     continue;
266 266
   }
267 267
 
268 268
   $user_ally = $cached['allies'][$PlanetUser['ally_id']];
269
-  if(isset($user_ally)) {
270
-    if($PlanetUser['id'] == $user_ally['ally_owner']) {
269
+  if (isset($user_ally)) {
270
+    if ($PlanetUser['id'] == $user_ally['ally_owner']) {
271 271
       $user_rank_title = $user_ally['ally_owner_range'];
272 272
     } else {
273 273
       $ally_ranks = explode(';', $user_ally['ranklist']);
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
   ));
291 291
 }
292 292
 
293
-foreach($cached['allies'] as $PlanetAlly) {
294
-  if($PlanetAlly) {
293
+foreach ($cached['allies'] as $PlanetAlly) {
294
+  if ($PlanetAlly) {
295 295
     $template->assign_block_vars('alliances', array(
296 296
       'ID'      => $PlanetAlly['id'],
297 297
       'NAME_JS' => js_safe_string($PlanetAlly['ally_name']),
Please login to merge, or discard this patch.