Completed
Push — work-fleets ( d1f99e...fc0000 )
by SuperNova.WS
06:40
created
classes/FleetValidator.php 1 patch
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 
821 821
 
822 822
   /**
823
-   * @return int
823
+   * @return boolean
824 824
    */
825 825
   protected function checkExpeditionsMax() {
826 826
     return get_player_max_expeditons($this->fleet->dbOwnerRow) > 0;
@@ -920,6 +920,10 @@  discard block
 block discarded – undo
920 920
       $this->checkMissionExact($missionType);
921 921
   }
922 922
 
923
+  /**
924
+   * @param integer $missionType
925
+   * @param boolean $result
926
+   */
923 927
   protected function checkMissionResultAndUnset($missionType, $result, $forceMission = false) {
924 928
     $this->unsetMission($missionType, $result, $forceMission);
925 929
 
Please login to merge, or discard this patch.
classes/Common/GlobalContainer.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -48,74 +48,74 @@
 block discarded – undo
48 48
     $gc = $this;
49 49
 
50 50
     // Default db
51
-    $gc->db = function ($c) {
51
+    $gc->db = function($c) {
52 52
       classSupernova::$db = $db = new \db_mysql($c);
53 53
 
54 54
       return $db;
55 55
     };
56 56
 
57
-    $gc->debug = function ($c) {
57
+    $gc->debug = function($c) {
58 58
       return new \debug();
59 59
     };
60 60
 
61
-    $gc->types = function ($c) {
61
+    $gc->types = function($c) {
62 62
       return new \Common\Types();
63 63
     };
64 64
 
65
-    $gc->cache = function ($c) {
65
+    $gc->cache = function($c) {
66 66
       return new \classCache(classSupernova::$cache_prefix);
67 67
     };
68 68
 
69
-    $gc->config = function ($c) {
69
+    $gc->config = function($c) {
70 70
       return new \classConfig(classSupernova::$cache_prefix);
71 71
     };
72 72
 
73
-    $gc->localePlayer = function (GlobalContainer $c) {
73
+    $gc->localePlayer = function(GlobalContainer $c) {
74 74
       return new \classLocale($c->config->server_locale_log_usage);
75 75
     };
76 76
 
77
-    $gc->dbGlobalRowOperator = function (GlobalContainer $c) {
77
+    $gc->dbGlobalRowOperator = function(GlobalContainer $c) {
78 78
       return new \DbRowDirectOperator($c->db);
79 79
     };
80 80
 
81
-    $gc->query = $gc->factory(function (GlobalContainer $c) {
81
+    $gc->query = $gc->factory(function(GlobalContainer $c) {
82 82
       return new \DbQueryConstructor($c->db);
83 83
     });
84 84
 
85
-    $gc->cacheOperator = function (GlobalContainer $gc) {
85
+    $gc->cacheOperator = function(GlobalContainer $gc) {
86 86
       return new \SnDbCachedOperator($gc);
87 87
     };
88 88
 
89 89
     $gc->snCacheClass = 'SnCache';
90
-    $gc->snCache = function (GlobalContainer $gc) {
90
+    $gc->snCache = function(GlobalContainer $gc) {
91 91
       return $gc->db->snCache;
92 92
     };
93 93
 
94 94
     $gc->buddyClass = 'Buddy\BuddyModel';
95
-    $gc->buddyModel = function (GlobalContainer $c) {
95
+    $gc->buddyModel = function(GlobalContainer $c) {
96 96
       return new $c->buddyClass($c);
97 97
     };
98 98
 
99
-    $gc->unitModel = function (GlobalContainer $c) {
99
+    $gc->unitModel = function(GlobalContainer $c) {
100 100
       return new \V2Unit\V2UnitModel($c);
101 101
     };
102
-    $gc->unitList = $this->factory(function (GlobalContainer $c) {
102
+    $gc->unitList = $this->factory(function(GlobalContainer $c) {
103 103
       return new \V2Unit\V2UnitList($c);
104 104
     });
105 105
 
106
-    $gc->fleetModel = function (GlobalContainer $c) {
106
+    $gc->fleetModel = function(GlobalContainer $c) {
107 107
       return new V2FleetModel($c);
108 108
     };
109 109
 
110
-    $gc->groupFleet = function (GlobalContainer $c) {
110
+    $gc->groupFleet = function(GlobalContainer $c) {
111 111
       return sn_get_groups('fleet');
112 112
     };
113 113
 
114
-    $gc->groupFleetAndMissiles = function (GlobalContainer $c) {
114
+    $gc->groupFleetAndMissiles = function(GlobalContainer $c) {
115 115
       return sn_get_groups(array('fleet', GROUP_STR_MISSILES));
116 116
     };
117 117
 
118
-    $gc->groupRecyclers = function (GlobalContainer $c) {
118
+    $gc->groupRecyclers = function(GlobalContainer $c) {
119 119
       return sn_get_groups('flt_recyclers');
120 120
     };
121 121
 
Please login to merge, or discard this patch.
overview.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 use DBStatic\DBStaticPlanet;
34 34
 use DBStatic\DBStaticUser;
35 35
 
36
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
36
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
37 37
 
38 38
 //$ccc = 0;
39 39
 //foreach(DBStatic\DBStaticUser::db_user_list_non_bots() as $ip) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 $result = array();
54 54
 
55
-switch($mode = sys_get_param_str('mode')) {
55
+switch ($mode = sys_get_param_str('mode')) {
56 56
   case 'manage':
57 57
     sn_sys_sector_buy('overview.php?mode=manage');
58 58
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     $template  = gettemplate('planet_manage', true);
63 63
     $planet_id = sys_get_param_id('planet_id');
64 64
 
65
-    if(sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) {
65
+    if (sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) {
66 66
       $planetrow['name'] = $new_name_unsafe;
67 67
       DBStaticPlanet::db_planet_update_set_by_id(
68 68
         $planetrow['id'],
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
           'name' => $new_name_unsafe,
71 71
         )
72 72
       );
73
-    } elseif(sys_get_param_str('action') == 'make_capital') {
73
+    } elseif (sys_get_param_str('action') == 'make_capital') {
74 74
       try {
75 75
         sn_db_transaction_start();
76 76
         $user = DBStaticUser::db_user_by_id($user['id'], true, '*');
77 77
         $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true, '*');
78 78
 
79
-        if($planetrow['planet_type'] != PT_PLANET) {
79
+        if ($planetrow['planet_type'] != PT_PLANET) {
80 80
           throw new exception(classLocale::$lang['ov_capital_err_not_a_planet'], ERR_ERROR);
81 81
         }
82 82
 
83
-        if($planetrow['id'] == $user['id_planet']) {
83
+        if ($planetrow['id'] == $user['id_planet']) {
84 84
           throw new exception(classLocale::$lang['ov_capital_err_capital_already'], ERR_ERROR);
85 85
         }
86 86
 
87
-        if($user_dark_matter < classSupernova::$config->planet_capital_cost) {
87
+        if ($user_dark_matter < classSupernova::$config->planet_capital_cost) {
88 88
           throw new exception(classLocale::$lang['ov_capital_err_no_dark_matter'], ERR_ERROR);
89 89
         }
90 90
 
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
         );
110 110
         sn_db_transaction_commit();
111 111
         sys_redirect('overview.php?mode=manage');
112
-      } catch(exception $e) {
112
+      } catch (exception $e) {
113 113
         sn_db_transaction_rollback();
114 114
         $result[] = array(
115 115
           'STATUS'  => $e->getCode(),
116 116
           'MESSAGE' => $e->getMessage(),
117 117
         );
118 118
       }
119
-    } elseif(sys_get_param_str('action') == 'planet_teleport') {
119
+    } elseif (sys_get_param_str('action') == 'planet_teleport') {
120 120
       try {
121
-        if(!uni_coordinates_valid($new_coordinates = array(
121
+        if (!uni_coordinates_valid($new_coordinates = array(
122 122
           'galaxy' => sys_get_param_int('new_galaxy'),
123 123
           'system' => sys_get_param_int('new_system'),
124 124
           'planet' => sys_get_param_int('new_planet')))
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 //        $planetrow = $global_data['planet'];
136 136
 
137 137
         $can_teleport = uni_planet_teleport_check($user, $planetrow, $new_coordinates);
138
-        if($can_teleport['result'] != ERR_NONE) {
138
+        if ($can_teleport['result'] != ERR_NONE) {
139 139
           throw new exception($can_teleport['message'], $can_teleport['result']);
140 140
         }
141 141
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
           array()
155 155
         );
156 156
 
157
-        if($planetrow['id'] == $user['id_planet']) {
157
+        if ($planetrow['id'] == $user['id_planet']) {
158 158
           DBStaticUser::db_user_set_by_id(
159 159
             $user['id'],
160 160
             array(
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
           'MESSAGE' => classLocale::$lang['ov_teleport_err_none'],
175 175
         );
176 176
         sys_redirect('overview.php?mode=manage');
177
-      } catch(exception $e) {
177
+      } catch (exception $e) {
178 178
         sn_db_transaction_rollback();
179 179
         $result[] = array(
180 180
           'STATUS'  => $e->getCode(),
181 181
           'MESSAGE' => $e->getMessage(),
182 182
         );
183 183
       }
184
-    } elseif(sys_get_param_str('action') == 'planet_abandon') {
184
+    } elseif (sys_get_param_str('action') == 'planet_abandon') {
185 185
       // if(sec_password_check($user['id'], sys_get_param('abandon_confirm'))) {
186
-      if(classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) {
187
-        if($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) {
186
+      if (classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) {
187
+        if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) {
188 188
           $destroyed = SN_TIME_NOW + 60 * 60 * 24;
189 189
           DBStaticPlanet::db_planet_update_set_by_id(
190 190
             $user['current_planet'],
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
           message(classLocale::$lang['ov_delete_wrong_planet'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage');
211 211
         }
212 212
       } else {
213
-        message(classLocale::$lang['ov_delete_wrong_pass'] , classLocale::$lang['colony_abandon'], 'overview.php?mode=manage');
213
+        message(classLocale::$lang['ov_delete_wrong_pass'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage');
214 214
       }
215
-    } elseif(
215
+    } elseif (
216 216
       ($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors'))
217 217
       && (
218 218
         !get_unit_param($hire, P_MAX_STACK) ||
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
       $user = DBStaticUser::db_user_by_id($user['id'], true);
228 228
       $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
229 229
       $build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0);
230
-      if($build_data['CAN'][BUILD_CREATE]) {
231
-        if($planetrow['PLANET_GOVERNOR_ID'] == $hire) {
230
+      if ($build_data['CAN'][BUILD_CREATE]) {
231
+        if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) {
232 232
           $planetrow['PLANET_GOVERNOR_LEVEL']++;
233 233
         } else {
234 234
           $planetrow['PLANET_GOVERNOR_LEVEL'] = 1;
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 
261 261
     lng_include('mrc_mercenary');
262 262
     int_planet_pretemplate($planetrow, $template);
263
-    foreach(sn_get_groups('governors') as $governor_id) {
264
-      if($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) {
263
+    foreach (sn_get_groups('governors') as $governor_id) {
264
+      if ($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) {
265 265
         continue;
266 266
       }
267 267
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
       'PAGE_HINT'   => classLocale::$lang['ov_manage_page_hint'],
314 314
     ));
315 315
 
316
-    foreach($result as &$a_result) {
316
+    foreach ($result as &$a_result) {
317 317
       $template->assign_block_vars('result', $a_result);
318 318
     }
319 319
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
   default:
324 324
     sn_sys_sector_buy();
325 325
 
326
-    if(sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) {
326
+    if (sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) {
327 327
       $planetrow['name'] = $new_name_unsafe;
328 328
       DBStaticPlanet::db_planet_update_set_by_id(
329 329
         $planetrow['id'],
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
     $planet_count = 0;
360 360
     $planets_query = DBStaticPlanet::db_planet_list_sorted($user, false, '*');
361
-    foreach($planets_query as $an_id => $UserPlanet) {
361
+    foreach ($planets_query as $an_id => $UserPlanet) {
362 362
       sn_db_transaction_start();
363 363
       $UserPlanet = sys_o_get_updated($user, $UserPlanet['id'], SN_TIME_NOW, false, true);
364 364
       sn_db_transaction_commit();
@@ -369,16 +369,16 @@  discard block
 block discarded – undo
369 369
 
370 370
       $planet_fleet_id = 0;
371 371
       $fleet_list = $template_planet['fleet_list'];
372
-      if($fleet_list['own']['count']) {
372
+      if ($fleet_list['own']['count']) {
373 373
         $planet_fleet_id = "p{$UserPlanet['id']}";
374 374
         $fleets_to_planet[$UserPlanet['id']] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id);
375 375
 //        $fleet_id++;tpl_parse_fleet_sn
376 376
       }
377
-      if($UserPlanet['planet_type'] == PT_MOON) {
377
+      if ($UserPlanet['planet_type'] == PT_MOON) {
378 378
         continue;
379 379
       }
380 380
       $moon = DBStaticPlanet::db_planet_by_parent($UserPlanet['id']);
381
-      if($moon) {
381
+      if ($moon) {
382 382
         $moon_fill = min(100, floor($moon['field_current'] / eco_planet_fields_max($moon) * 100));
383 383
       } else {
384 384
         $moon_fill = 0;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
     tpl_assign_fleet($template, $fleets);
419 419
 
420 420
     $lune = $planetrow['planet_type'] == PT_PLANET ? DBStaticPlanet::db_planet_by_parent($planetrow['id']) : DBStaticPlanet::db_planet_by_id($planetrow['parent_planet']);
421
-    if($lune) {
421
+    if ($lune) {
422 422
       $template->assign_vars(array(
423 423
         'MOON_ID' => $lune['id'],
424 424
         'MOON_IMG' => $lune['image'],
@@ -430,15 +430,15 @@  discard block
 block discarded – undo
430 430
     $planet_fill = $planet_fill > 100 ? 100 : $planet_fill;
431 431
 
432 432
     $planet_recyclers_orbiting = 0;
433
-    foreach(classSupernova::$gc->groupRecyclers as $recycler_id) {
433
+    foreach (classSupernova::$gc->groupRecyclers as $recycler_id) {
434 434
       $planet_recyclers_orbiting += mrc_get_level($user, $planetrow, $recycler_id);
435 435
     }
436 436
 
437 437
     int_planet_pretemplate($planetrow, $template);
438 438
 
439 439
     $sn_group_ques = sn_get_groups('ques');
440
-    if(!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) {
441
-      foreach(array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) {
440
+    if (!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) {
441
+      foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) {
442 442
         $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']];
443 443
         $template->assign_block_vars('ques', array(
444 444
           'ID'     => $que_id,
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
           'LENGTH' => empty($this_que) ? 0 : count($this_que),
447 447
         ));
448 448
 
449
-        if(!empty($this_que)) {
450
-          foreach($this_que as $que_item) {
449
+        if (!empty($this_que)) {
450
+          foreach ($this_que as $que_item) {
451 451
             $template->assign_block_vars('que', que_tpl_parse_element($que_item));
452 452
           }
453 453
         }
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
       'LENGTH' => $que_hangar_length,
462 462
     ));
463 463
 
464
-    if(!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) {
464
+    if (!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) {
465 465
       $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE);
466 466
       $template->assign_block_vars('ques', array(
467 467
         'ID'     => SUBQUE_DEFENSE,
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
     $overview_planet_rows = $user['opt_int_overview_planet_rows'];
474 474
     $overview_planet_columns = $user['opt_int_overview_planet_columns'];
475 475
 
476
-    if($overview_planet_rows <= 0 && $overview_planet_columns <= 0) {
476
+    if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) {
477 477
       $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows'];
478 478
       $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns'];
479 479
     }
480 480
 
481
-    if($overview_planet_rows > 0 && $overview_planet_columns <= 0) {
481
+    if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) {
482 482
       $overview_planet_columns = ceil($planet_count / $overview_planet_rows);
483 483
     }
484 484
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     ));
536 536
     tpl_set_resource_info($template, $planetrow, $fleets_to_planet, 2);
537 537
 
538
-    foreach($result as &$a_result) {
538
+    foreach ($result as &$a_result) {
539 539
       $template->assign_block_vars('result', $a_result);
540 540
     }
541 541
 
Please login to merge, or discard this patch.
galaxy.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 use DBStatic\DBStaticUser;
12 12
 use Vector\Vector;
13 13
 
14
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
14
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
15 15
 
16 16
 lng_include('universe');
17 17
 lng_include('stat');
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $uni_system = sys_get_param_int('system', $planetrow['system']);
22 22
 $planet = sys_get_param_int('planet', $planetrow['planet']);
23 23
 
24
-if($mode == 'name') {
24
+if ($mode == 'name') {
25 25
   require_once('includes/includes/uni_rename.php');
26 26
 }
27 27
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
 $flying_fleet_count = FleetList::fleet_count_flying($user['id']);
44 44
 
45
-if($mode == 1) {
46
-} elseif($mode == 2 || $mode == 3) {
45
+if ($mode == 1) {
46
+} elseif ($mode == 2 || $mode == 3) {
47 47
   $planet = $planetrow['planet'];
48 48
 } else {
49 49
   $uni_galaxy = $planetrow['galaxy'];
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
   $planet = $planetrow['planet'];
52 52
 }
53 53
 
54
-$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies? Vector::$knownGalaxies: $uni_galaxy);
54
+$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies ? Vector::$knownGalaxies : $uni_galaxy);
55 55
 $uni_system = $uni_system < 1 ? 1 : ($uni_system > Vector::$knownSystems ? Vector::$knownSystems : $uni_system);
56 56
 $planet = $planet < 1 ? 1 : ($planet > Vector::$knownPlanets + 1 ? Vector::$knownPlanets + 1 : $planet);
57 57
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 $PhalanxRange = GetPhalanxRange($HavePhalanx);
70 70
 
71 71
 $planet_precache_query = DBStaticPlanet::db_planet_list_in_system($uni_galaxy, $uni_system);
72
-if(!empty($planet_precache_query)) {
73
-  foreach($planet_precache_query as $planet_row) {
72
+if (!empty($planet_precache_query)) {
73
+  foreach ($planet_precache_query as $planet_row) {
74 74
     $planet_list[$planet_row['planet']][$planet_row['planet_type']] = $planet_row;
75 75
   }
76 76
 }
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
  * @var Fleet[][][] $fleet_list
89 89
  */
90 90
 $fleet_list = array();
91
-foreach($system_fleet_list->_container as $objFleetSystem) {
92
-  if(!$objFleetSystem->isReturning()) {
91
+foreach ($system_fleet_list->_container as $objFleetSystem) {
92
+  if (!$objFleetSystem->isReturning()) {
93 93
     $fleet_planet = $objFleetSystem->fleet_end_planet;
94 94
     $fleet_type = $objFleetSystem->fleet_end_type;
95 95
   } else {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 $recycler_info = array();
105 105
 $planet_recyclers_orbiting = 0;
106 106
 $recyclers_fleet = array();
107
-foreach(classSupernova::$gc->groupRecyclers as $recycler_id) {
107
+foreach (classSupernova::$gc->groupRecyclers as $recycler_id) {
108 108
   $recycler_info[$recycler_id] = get_ship_data($recycler_id, $user);
109 109
   $recyclers_fleet[$recycler_id] = mrc_get_level($user, $planetrow, $recycler_id);
110 110
   $planet_recyclers_orbiting += $recyclers_fleet[$recycler_id];
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 $fleet_id = 1;
115 115
 $fleets = array();
116 116
 $config_game_max_planet = Vector::$knownPlanets + 1;
117
-for($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
117
+for ($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
118 118
   unset($uni_galaxyRowPlanet);
119 119
   unset($uni_galaxyRowMoon);
120 120
   unset($uni_galaxyRowUser);
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
   $uni_galaxyRowPlanet = $planet_list[$Planet][PT_PLANET];
125 125
 
126 126
   $planet_fleet_id = 0;
127
-  if($uni_galaxyRowPlanet['destruyed']) {
127
+  if ($uni_galaxyRowPlanet['destruyed']) {
128 128
     CheckAbandonPlanetState($uni_galaxyRowPlanet);
129
-  } elseif($uni_galaxyRowPlanet['id']) {
130
-    if($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
129
+  } elseif ($uni_galaxyRowPlanet['id']) {
130
+    if ($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
131 131
       $uni_galaxyRowUser = $cached['users'][$uni_galaxyRowPlanet['id_owner']];
132 132
     } else {
133 133
       $uni_galaxyRowUser = DBStaticUser::db_user_by_id($uni_galaxyRowPlanet['id_owner']);
134 134
       $cached['users'][$uni_galaxyRowUser['id']] = $uni_galaxyRowUser;
135 135
     }
136 136
 
137
-    if(!$uni_galaxyRowUser['id']) {
137
+    if (!$uni_galaxyRowUser['id']) {
138 138
       classSupernova::$debug->warning("Planet '{$uni_galaxyRowPlanet['name']}' [{$uni_galaxy}:{$uni_system}:{$Planet}] has no owner!", 'Userless planet', 503);
139 139
       $uni_galaxyRowPlanet['destruyed'] = SN_TIME_NOW + 60 * 60 * 24;
140 140
       $uni_galaxyRowPlanet['id_owner'] = 0;
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
       );
148 148
     }
149 149
 
150
-    if($uni_galaxyRowUser['id']) {
150
+    if ($uni_galaxyRowUser['id']) {
151 151
       $planetcount++;
152
-      if($uni_galaxyRowUser['ally_id']) {
153
-        if($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
152
+      if ($uni_galaxyRowUser['ally_id']) {
153
+        if ($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
154 154
           $allyquery = $cached['allies'][$uni_galaxyRowUser['ally_id']];
155 155
         } else {
156 156
           $allyquery = DBStaticAlly::db_ally_get_by_id($uni_galaxyRowUser['ally_id']);
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
       }
160 160
 
161 161
       $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_PLANET]);
162
-      if(!empty($fleets_to_planet['own']['count'])) {
162
+      if (!empty($fleets_to_planet['own']['count'])) {
163 163
         $planet_fleet_id = $fleet_id;
164 164
         $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
165 165
         $fleet_id++;
166 166
       }
167 167
 
168 168
       $uni_galaxyRowMoon = $planet_list[$Planet][PT_MOON];
169
-      if($uni_galaxyRowMoon['destruyed']) {
169
+      if ($uni_galaxyRowMoon['destruyed']) {
170 170
         CheckAbandonPlanetState($uni_galaxyRowMoon);
171 171
       } else {
172 172
         $moon_fleet_id = 0;
173 173
         $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_MOON]);
174
-        if(!empty($fleets_to_planet['own']['count'])) {
174
+        if (!empty($fleets_to_planet['own']['count'])) {
175 175
           $moon_fleet_id = $fleet_id;
176 176
           $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
177 177
           $fleet_id++;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
   $recyclers_incoming_capacity = 0;
184 184
   $uni_galaxyRowPlanet['debris'] = $uni_galaxyRowPlanet['debris_metal'] + $uni_galaxyRowPlanet['debris_crystal'];
185
-  if($uni_galaxyRowPlanet['debris']) {
186
-    if(!empty($fleet_list[$Planet][PT_DEBRIS])) {
187
-      foreach($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
188
-        if($objFleetToDebris->playerOwnerId == $user['id']) {
185
+  if ($uni_galaxyRowPlanet['debris']) {
186
+    if (!empty($fleet_list[$Planet][PT_DEBRIS])) {
187
+      foreach ($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
188
+        if ($objFleetToDebris->playerOwnerId == $user['id']) {
189 189
           $recyclers_incoming_capacity += $objFleetToDebris->shipsGetCapacityRecyclers($recycler_info);
190 190
         }
191 191
       }
@@ -262,21 +262,21 @@  discard block
 block discarded – undo
262 262
 
263 263
 tpl_assign_fleet($template, $fleets);
264 264
 
265
-foreach(sn_get_groups('defense_active') as $unit_id) {
265
+foreach (sn_get_groups('defense_active') as $unit_id) {
266 266
   $template->assign_block_vars('defense_active', array(
267 267
     'ID'   => $unit_id,
268 268
     'NAME' => classLocale::$lang['tech'][$unit_id],
269 269
   ));
270 270
 }
271 271
 
272
-foreach($cached['users'] as $PlanetUser) {
273
-  if(!$PlanetUser) {
272
+foreach ($cached['users'] as $PlanetUser) {
273
+  if (!$PlanetUser) {
274 274
     continue;
275 275
   }
276 276
 
277 277
   $user_ally = $cached['allies'][$PlanetUser['ally_id']];
278
-  if(isset($user_ally)) {
279
-    if($PlanetUser['id'] == $user_ally['ally_owner']) {
278
+  if (isset($user_ally)) {
279
+    if ($PlanetUser['id'] == $user_ally['ally_owner']) {
280 280
       $user_rank_title = $user_ally['ally_owner_range'];
281 281
     } else {
282 282
       $ally_ranks = explode(';', $user_ally['ranklist']);
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
   ));
300 300
 }
301 301
 
302
-foreach($cached['allies'] as $PlanetAlly) {
303
-  if($PlanetAlly) {
302
+foreach ($cached['allies'] as $PlanetAlly) {
303
+  if ($PlanetAlly) {
304 304
     $template->assign_block_vars('alliances', array(
305 305
       'ID'      => $PlanetAlly['id'],
306 306
       'NAME_JS' => js_safe_string($PlanetAlly['ally_name']),
Please login to merge, or discard this patch.
includes/functions/tpl_helpers.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 use DBStatic\DBStaticFleetACS;
5 5
 
6 6
 function tpl_assign_fleet_compare($a, $b) {
7
-  if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) {
8
-    if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) {
7
+  if ($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) {
8
+    if ($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) {
9 9
       return 0;
10 10
     }
11 11
 
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
  * @param string   $js_name
22 22
  */
23 23
 function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') {
24
-  if(!$fleets) {
24
+  if (!$fleets) {
25 25
     return;
26 26
   }
27 27
 
28 28
   usort($fleets, 'tpl_assign_fleet_compare');
29 29
 
30
-  foreach($fleets as $fleet_data) {
30
+  foreach ($fleets as $fleet_data) {
31 31
     $template->assign_block_vars($js_name, $fleet_data['fleet']);
32 32
 
33
-    if($fleet_data['ships']) {
34
-      foreach($fleet_data['ships'] as $ship_data) {
33
+    if ($fleet_data['ships']) {
34
+      foreach ($fleet_data['ships'] as $ship_data) {
35 35
         $template->assign_block_vars("{$js_name}.ships", $ship_data);
36 36
       }
37 37
     }
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     'DEUTERIUM' => $fleet[RES_DEUTERIUM],
53 53
   );
54 54
 
55
-  foreach($fleet as $ship_id => $ship_amount) {
56
-    if(in_array($ship_id, classSupernova::$gc->groupFleet)) {
55
+  foreach ($fleet as $ship_id => $ship_amount) {
56
+    if (in_array($ship_id, classSupernova::$gc->groupFleet)) {
57 57
       $single_ship_data = get_ship_data($ship_id, $user_data);
58 58
       $return['ships'][$ship_id] = array(
59 59
         'ID'          => $ship_id,
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 
93 93
   $result = array();
94 94
 
95
-  if(!$user_data) {
95
+  if (!$user_data) {
96 96
     $user_data = $user;
97 97
   }
98 98
 
99
-  if(!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) {
99
+  if (!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) {
100 100
     $aks = DBStaticFleetACS::db_acs_get_by_group_id($objFleet->group_id);
101 101
   }
102 102
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     'MISSION'      => $objFleet->mission_type,
116 116
     'MISSION_NAME' => classLocale::$lang['type_mission'][$objFleet->mission_type],
117 117
     'ACS'          => !empty($aks['name']) ? $aks['name'] : (!empty($objFleet->group_id) ? $objFleet->group_id : ''),
118
-    'AMOUNT'       => $spy_level >= 4 ? (pretty_number($objFleet->shipsGetTotal()) . (array_sum($fleet_resources) ? '+' : '')) : '?',
118
+    'AMOUNT'       => $spy_level >= 4 ? (pretty_number($objFleet->shipsGetTotal()).(array_sum($fleet_resources) ? '+' : '')) : '?',
119 119
 
120 120
     'METAL'     => $spy_level >= 8 ? $fleet_resources[RES_METAL] : 0,
121 121
     'CRYSTAL'   => $spy_level >= 8 ? $fleet_resources[RES_CRYSTAL] : 0,
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
     'STAY_LEFT' => floor($objFleet->time_mission_job_complete + 1 - SN_TIME_NOW),
138 138
   );
139 139
 
140
-  if(property_exists($objFleet, 'fleet_start_name')) {
140
+  if (property_exists($objFleet, 'fleet_start_name')) {
141 141
     $result['START_NAME'] = $objFleet->fleet_start_name;
142 142
   }
143
-  if(property_exists($objFleet, 'fleet_end_name')) {
143
+  if (property_exists($objFleet, 'fleet_end_name')) {
144 144
     $result['END_NAME'] = $objFleet->fleet_end_name;
145 145
   }
146 146
 
147
-  if(property_exists($objFleet, 'event_time')) {
147
+  if (property_exists($objFleet, 'event_time')) {
148 148
     $result['fleet'] = array_merge($result['fleet'], array(
149 149
       'OV_LABEL'        => $objFleet->ov_label,
150 150
       'EVENT_TIME_TEXT' => property_exists($objFleet, 'event_time') ? date(FMT_DATE_TIME, $objFleet->event_time + SN_CLIENT_TIME_DIFF) : '',
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 
156 156
   $ship_id = 0;
157 157
   $result['ships'] = array();
158
-  if($spy_level >= 6) {
159
-    foreach($objFleet->shipsIterator() as $ship_sn_id => $ship) {
160
-      if($spy_level >= 10) {
158
+  if ($spy_level >= 6) {
159
+    foreach ($objFleet->shipsIterator() as $ship_sn_id => $ship) {
160
+      if ($spy_level >= 10) {
161 161
         $single_ship_data = get_ship_data($ship_sn_id, $user_data);
162 162
         $result['ships'][$ship_sn_id] = array(
163 163
           'ID'          => $ship_sn_id,
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 function tpl_parse_planet_que($que, $planet, $que_id) {
191 191
   $hangar_que = array();
192 192
   $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']];
193
-  if(!empty($que_hangar)) {
194
-    foreach($que_hangar as $que_item) {
193
+  if (!empty($que_hangar)) {
194
+    foreach ($que_hangar as $que_item) {
195 195
       $hangar_que['que'][] = array('id' => $que_item['que_unit_id'], 'count' => $que_item['que_unit_amount']);
196 196
       $hangar_que[$que_item['que_unit_id']] += $que_item['que_unit_amount'];
197 197
     }
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
     'PLANET_GOVERNOR_LEVEL_MAX' => get_unit_param($planet['PLANET_GOVERNOR_ID'], P_MAX_STACK),
252 252
   );
253 253
 
254
-  if(!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) {
254
+  if (!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) {
255 255
     $result['building_que'] = array();
256 256
     $building_que = &$que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']];
257
-    foreach($building_que as $que_element) {
257
+    foreach ($building_que as $que_element) {
258 258
       $result['building_que'][] = que_tpl_parse_element($que_element);
259 259
     }
260 260
   }
@@ -273,19 +273,19 @@  discard block
 block discarded – undo
273 273
   static $snGroupFleet;
274 274
   !$snGroupFleet ? $snGroupFleet = classSupernova::$gc->groupFleet : false;
275 275
 
276
-  if(empty($array_of_Fleet)) {
276
+  if (empty($array_of_Fleet)) {
277 277
     return false;
278 278
   }
279 279
 
280 280
   $fleet_list = array();
281
-  foreach($array_of_Fleet as $fleet) {
282
-    if($fleet->playerOwnerId == $user['id']) {
283
-      if($fleet->mission_type == MT_MISSILE) {
281
+  foreach ($array_of_Fleet as $fleet) {
282
+    if ($fleet->playerOwnerId == $user['id']) {
283
+      if ($fleet->mission_type == MT_MISSILE) {
284 284
         continue;
285 285
       }
286 286
       $fleet_ownage = 'own';
287 287
     } else {
288
-      switch($fleet->mission_type) {
288
+      switch ($fleet->mission_type) {
289 289
         case MT_ATTACK:
290 290
         case MT_ACS:
291 291
         case MT_DESTROY:
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 
303 303
     $fleet_list[$fleet_ownage]['fleets'][$fleet->dbId] = $fleet;
304 304
 
305
-    if($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) {
306
-      foreach($fleet->shipsIterator() as $ship_id => $ship) {
307
-        if(!empty($snGroupFleet[$ship_id])) {
305
+    if ($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) {
306
+      foreach ($fleet->shipsIterator() as $ship_id => $ship) {
307
+        if (!empty($snGroupFleet[$ship_id])) {
308 308
           $fleet_list[$fleet_ownage]['total'][$ship_id] += $ship->count;
309 309
         }
310 310
       }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
   return $fleet_list;
322 322
 }
323 323
 
324
-function tpl_set_resource_info(template &$template, $planet_row, $fleets_to_planet = array(), $round = 0) {
324
+function tpl_set_resource_info(template & $template, $planet_row, $fleets_to_planet = array(), $round = 0) {
325 325
   $template->assign_vars(array(
326 326
     'RESOURCE_ROUNDING' => $round,
327 327
 
Please login to merge, or discard this patch.
includes/includes/market_fleeter.inc 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
 
6 6
 $classLocale = classLocale::$lang;
7 7
 
8
-if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
8
+if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
9 9
   classSupernova::$debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
10 10
 }
11 11
 
12
-$page_title .= ' - ' . classLocale::$lang["eco_mrk_{$submode}"];
12
+$page_title .= ' - '.classLocale::$lang["eco_mrk_{$submode}"];
13 13
 
14 14
 $template = gettemplate('market_fleet', true);
15 15
 $template->assign_vars(array(
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
   'rpg_cost' => $rpg_cost,
18 18
 ));
19 19
 
20
-if(is_array($shipList)) {
21
-  if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
20
+if (is_array($shipList)) {
21
+  if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
22 22
     $intError = MARKET_NO_DM;
23 23
   }
24 24
 
@@ -31,32 +31,32 @@  discard block
 block discarded – undo
31 31
   // Блокируем запись о запасах кораблей у трейдера
32 32
   db_config_get_stockman_fleet();
33 33
 
34
-  $message .= classLocale::$lang["eco_mrk_{$submode}_ships"] . '<ul>';
34
+  $message .= classLocale::$lang["eco_mrk_{$submode}_ships"].'<ul>';
35 35
   $total = array();
36
-  foreach($shipList as $shipID => &$shipCount) {
36
+  foreach ($shipList as $shipID => &$shipCount) {
37 37
     $shipCount = ceil(floatval($shipCount));
38
-    if(!$shipCount) {
38
+    if (!$shipCount) {
39 39
       continue;
40 40
     }
41 41
 
42
-    if($shipCount < 0) {
42
+    if ($shipCount < 0) {
43 43
       classSupernova::$debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307);
44 44
       $intError = MARKET_NEGATIVE_SHIPS;
45 45
       break;
46 46
     }
47 47
 
48
-    if($mode == MARKET_SCRAPPER) {
48
+    if ($mode == MARKET_SCRAPPER) {
49 49
       $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)];
50
-    } elseif($mode == MARKET_STOCKMAN) {
50
+    } elseif ($mode == MARKET_STOCKMAN) {
51 51
       $amount = $stock[$shipID];
52 52
     }
53 53
 
54
-    if($amount < $shipCount) {
54
+    if ($amount < $shipCount) {
55 55
       $intError = $error_no_stock;
56 56
       break;
57 57
     }
58 58
 
59
-    if(!in_array($shipID, classSupernova::$gc->groupFleet)) {
59
+    if (!in_array($shipID, classSupernova::$gc->groupFleet)) {
60 60
       classSupernova::$debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306);
61 61
       $intError = MARKET_NOT_A_SHIP;
62 62
       break;
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
     $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier));
73 73
     $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier));
74 74
 
75
-    foreach($resTemp as $resID => $resCount) {
75
+    foreach ($resTemp as $resID => $resCount) {
76 76
       $total[$resID] += $resCount;
77 77
     }
78 78
 
79
-    $message .= "<li>{$classLocale['tech'][$shipID]}: " . pretty_number($shipCount);
79
+    $message .= "<li>{$classLocale['tech'][$shipID]}: ".pretty_number($shipCount);
80 80
   }
81 81
 
82
-  if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
83
-    foreach($total as $resID => $resCount) {
84
-      if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
82
+  if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
83
+    foreach ($total as $resID => $resCount) {
84
+      if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
85 85
         $intError = MARKET_NO_RESOURCES;
86 86
         classSupernova::$debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301);
87 87
         break;
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
   $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError;
93 93
 
94 94
   $qry = array();
95
-  if($intError == MARKET_DEAL) {
96
-    $message .= '</ul>' . classLocale::$lang["eco_mrk_{$submode}_res"] . '<ul>';
97
-    foreach($total as $resID => $resCount) {
98
-      if(!$resCount) {
95
+  if ($intError == MARKET_DEAL) {
96
+    $message .= '</ul>'.classLocale::$lang["eco_mrk_{$submode}_res"].'<ul>';
97
+    foreach ($total as $resID => $resCount) {
98
+      if (!$resCount) {
99 99
         continue;
100 100
       }
101 101
 
102 102
       $qry[pname_resource_name($resID)] = $resCount;
103
-      $message .= "<li>" . classLocale::$lang['sys_' . pname_resource_name($resID)] . ": " . pretty_number(abs($resCount));
103
+      $message .= "<li>".classLocale::$lang['sys_'.pname_resource_name($resID)].": ".pretty_number(abs($resCount));
104 104
     }
105 105
     $message .= "</ul>";
106 106
 
@@ -128,38 +128,38 @@  discard block
 block discarded – undo
128 128
       'MESSAGE' => classLocale::$lang['eco_mrk_errors'][$intError],
129 129
     ));
130 130
 
131
-    foreach($shipList as $shipID => $shipCount) {
131
+    foreach ($shipList as $shipID => $shipCount) {
132 132
       $data['ships'][$shipID] = max(0, intval($shipCount));
133 133
     }
134 134
   }
135 135
 }
136 136
 $message = '';
137 137
 
138
-if(!classSupernova::$config->eco_stockman_fleet && classSupernova::$config->eco_stockman_fleet_populate) {
139
-  classSupernova::$config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, classSupernova::$gc->groupFleet)));
138
+if (!classSupernova::$config->eco_stockman_fleet && classSupernova::$config->eco_stockman_fleet_populate) {
139
+  classSupernova::$config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, classSupernova::$gc->groupFleet)));
140 140
 }
141 141
 
142 142
 tpl_set_resource_info($template, $planetrow, array());
143 143
 
144
-if(!$array) {
144
+if (!$array) {
145 145
   $array = array();
146 146
 }
147 147
 
148 148
 $group_fleet = classSupernova::$gc->groupFleet;
149
-foreach($array as $key => $value) {
150
-  if($mode == MARKET_SCRAPPER) {
149
+foreach ($array as $key => $value) {
150
+  if ($mode == MARKET_SCRAPPER) {
151 151
     $shipID = $value;
152 152
     $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)];
153
-  } elseif($mode == MARKET_STOCKMAN) {
153
+  } elseif ($mode == MARKET_STOCKMAN) {
154 154
     $shipID = $key;
155 155
     $amount = $value;
156 156
   }
157 157
 
158
-  if(!in_array($shipID, $group_fleet)) {
158
+  if (!in_array($shipID, $group_fleet)) {
159 159
     continue;
160 160
   }
161 161
 
162
-  if($amount > 0) {
162
+  if ($amount > 0) {
163 163
     $build_data = eco_get_build_data($user, $planetrow, $shipID);
164 164
     $template->assign_block_vars('ships', array(
165 165
       'ID'        => $shipID,
Please login to merge, or discard this patch.
includes/includes/flt_mission_spy.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  */
16 16
 // ----------------------------------------------------------------------------------------------------------------
17 17
 function coe_compress_add_units($unit_group, $target_planet, &$compress_data, $target_user = array()) {
18
-  foreach($unit_group as $unit_id) {
19
-    if(($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) {
18
+  foreach ($unit_group as $unit_id) {
19
+    if (($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) {
20 20
       $compress_data[$unit_id] = $unit_count;
21 21
     }
22 22
   }
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
   $classLocale = classLocale::$lang;
27 27
 
28 28
   $result = "<tr><td class=\"c\" colspan=\"4\">{$section_title}</td></tr>";
29
-  foreach(sn_get_groups($group_name) as $unit_id) {
30
-    if(($unit_amount = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) {
29
+  foreach (sn_get_groups($group_name) as $unit_id) {
30
+    if (($unit_amount = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) {
31 31
       $result .= "<tr><td align=\"left\" colspan=\"3\">{$classLocale['tech'][$unit_id]}</td><td align=\"right\">{$unit_amount}</td></tr>";
32 32
     }
33 33
 
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 
57 57
   $objFleet = $mission_data->fleet;
58 58
 
59
-  if(empty($target_user_row['id']) || empty($spying_user_row['id'])) {
59
+  if (empty($target_user_row['id']) || empty($spying_user_row['id'])) {
60 60
     $objFleet->markReturnedAndSave();
61 61
 
62 62
     return;
63 63
   }
64 64
 
65 65
   $spy_probes = $objFleet->shipsGetTotalById(SHIP_SPY);
66
-  if($spy_probes > 0) {
66
+  if ($spy_probes > 0) {
67 67
     $TargetSpyLvl = GetSpyLevel($target_user_row);
68 68
     $CurrentSpyLvl = GetSpyLevel($spying_user_row);
69 69
     $spy_diff_empire = $CurrentSpyLvl - $TargetSpyLvl;
@@ -81,26 +81,26 @@  discard block
 block discarded – undo
81 81
     $spy_message .= " ({$classLocale['Player_']} '{$target_user_row['username']}') {$classLocale['On_']} ";
82 82
     $spy_message .= date(FMT_DATE_TIME, $objFleet->time_arrive_to_target);
83 83
     $spy_message .= "</td></tr><tr>";
84
-    $spy_message .= "<td width=220>{$classLocale['sys_metal']}</td><td width=220 align=right>" . pretty_number($target_planet_row['metal']) . "</td>";
85
-    $spy_message .= "<td width=220>{$classLocale['sys_crystal']}</td></td><td width=220 align=right>" . pretty_number($target_planet_row['crystal']) . "</td>";
84
+    $spy_message .= "<td width=220>{$classLocale['sys_metal']}</td><td width=220 align=right>".pretty_number($target_planet_row['metal'])."</td>";
85
+    $spy_message .= "<td width=220>{$classLocale['sys_crystal']}</td></td><td width=220 align=right>".pretty_number($target_planet_row['crystal'])."</td>";
86 86
     $spy_message .= "</tr><tr>";
87
-    $spy_message .= "<td width=220>{$classLocale['sys_deuterium']}</td><td width=220 align=right>" . pretty_number($target_planet_row['deuterium']) . "</td>";
88
-    $spy_message .= "<td width=220>{$classLocale['sys_energy']}</td><td width=220 align=right>" . pretty_number($target_planet_row['energy_max']) . "</td>";
87
+    $spy_message .= "<td width=220>{$classLocale['sys_deuterium']}</td><td width=220 align=right>".pretty_number($target_planet_row['deuterium'])."</td>";
88
+    $spy_message .= "<td width=220>{$classLocale['sys_energy']}</td><td width=220 align=right>".pretty_number($target_planet_row['energy_max'])."</td>";
89 89
     $spy_message .= "</tr>";
90
-    if($spy_diff >= 2) {
91
-      $spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'fleet', classLocale::$lang['tech'][UNIT_SHIPS], $target_user_row) . "</div>";
90
+    if ($spy_diff >= 2) {
91
+      $spy_message .= "<div class='spy_medium'>".flt_spy_scan($target_planet_row, 'fleet', classLocale::$lang['tech'][UNIT_SHIPS], $target_user_row)."</div>";
92 92
       coe_compress_add_units(classSupernova::$gc->groupFleet, $target_planet_row, $combat_pack[0]);
93 93
     }
94
-    if($spy_diff >= 3) {
95
-      $spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'defense', classLocale::$lang['tech'][UNIT_DEFENCE], $target_user_row) . "</div>";
94
+    if ($spy_diff >= 3) {
95
+      $spy_message .= "<div class='spy_medium'>".flt_spy_scan($target_planet_row, 'defense', classLocale::$lang['tech'][UNIT_DEFENCE], $target_user_row)."</div>";
96 96
       coe_compress_add_units(sn_get_groups('defense_active'), $target_planet_row, $combat_pack[0]);
97 97
     }
98
-    if($spy_diff >= 5) {
99
-      $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'structures', classLocale::$lang['tech'][UNIT_STRUCTURES], $target_user_row) . "</div>";
98
+    if ($spy_diff >= 5) {
99
+      $spy_message .= "<div class='spy_long'>".flt_spy_scan($target_planet_row, 'structures', classLocale::$lang['tech'][UNIT_STRUCTURES], $target_user_row)."</div>";
100 100
     }
101 101
 
102
-    if($spy_diff_empire >= 0) {
103
-      $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'tech', classLocale::$lang['tech'][UNIT_TECHNOLOGIES], $target_user_row) . "</div>";
102
+    if ($spy_diff_empire >= 0) {
103
+      $spy_message .= "<div class='spy_long'>".flt_spy_scan($target_planet_row, 'tech', classLocale::$lang['tech'][UNIT_TECHNOLOGIES], $target_user_row)."</div>";
104 104
       coe_compress_add_units(array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR), $target_planet_row, $combat_pack[0], $target_user_row);
105 105
     }
106 106
     // TODO: Наемники, губернаторы, артефакты и прочее имперское
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
     $simulator_link = sn_ube_simulator_encode_replay($combat_pack, 'D');
109 109
 
110 110
     $target_unit_list = 0;
111
-    foreach(classSupernova::$gc->groupFleet as $unit_id) {
111
+    foreach (classSupernova::$gc->groupFleet as $unit_id) {
112 112
       $target_unit_list += max(0, mrc_get_level($target_user_row, $target_planet_row, $unit_id, false, true));
113 113
     }
114 114
 
115 115
     $spy_detected = $spy_probes * $target_unit_list / 4 * pow(2, $TargetSpyLvl - $CurrentSpyLvl);
116 116
 
117
-    if(mt_rand(0, 99) > $spy_detected) {
117
+    if (mt_rand(0, 99) > $spy_detected) {
118 118
       $spy_outcome_str = sprintf(classLocale::$lang['sys_mess_spy_detect_chance'], $spy_detected);
119 119
       $spy_detected = false;
120 120
     } else {
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
 
132 132
     DBStaticMessages::msg_send_simple_message($spying_user_row['id'], '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, classLocale::$lang['sys_mess_qg'], classLocale::$lang['sys_mess_spy_report'], $spy_message);
133 133
 
134
-    $target_message = "{$classLocale['sys_mess_spy_ennemyfleet']} {$spying_planet_row['name']} " . uni_render_coordinates_href($spying_planet_row, '', 3);
135
-    $target_message .= " {$classLocale['sys_mess_spy_seen_at']} {$target_planet_row['name']} " . uni_render_coordinates($target_planet_row);
134
+    $target_message = "{$classLocale['sys_mess_spy_ennemyfleet']} {$spying_planet_row['name']} ".uni_render_coordinates_href($spying_planet_row, '', 3);
135
+    $target_message .= " {$classLocale['sys_mess_spy_seen_at']} {$target_planet_row['name']} ".uni_render_coordinates($target_planet_row);
136 136
 
137
-    if($spy_detected) {
137
+    if ($spy_detected) {
138 138
       $debris_planet_id = $target_planet_row['planet_type'] == PT_PLANET ? $target_planet_row['id'] : $target_planet_row['parent_planet'];
139 139
 
140 140
       $spy_cost = get_unit_param(SHIP_SPY, P_COST);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     DBStaticMessages::msg_send_simple_message($objFleet->target_owner_id, '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, classLocale::$lang['sys_mess_spy_control'], classLocale::$lang['sys_mess_spy_activity'], $target_message);
157 157
   }
158 158
 
159
-  if($spy_detected) {
159
+  if ($spy_detected) {
160 160
     $objFleet->dbDelete();
161 161
   } else {
162 162
     $objFleet->markReturnedAndSave();
Please login to merge, or discard this patch.
includes/includes/flt_mission_explore.php 1 patch
Spacing   +33 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
   // TODO - Currently $ship_data is one for all players
24 24
   static $shipCostInMetalPerPiece, $rates;
25 25
 
26
-  if(empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) {
26
+  if (empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) {
27 27
     return;
28 28
   }
29 29
 
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
   $outcome_value = &$result['$outcome_value'];
49 49
   $outcome_list = &$result['$outcome_list'];
50 50
 
51
-  if(!$shipCostInMetalPerPiece) {
51
+  if (!$shipCostInMetalPerPiece) {
52 52
     $rates = get_resource_exchange();
53 53
 
54
-    foreach(classSupernova::$gc->groupFleet as $unit_id) {
54
+    foreach (classSupernova::$gc->groupFleet as $unit_id) {
55 55
       $unit_info = get_unit_param($unit_id);
56
-      if($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) {
56
+      if ($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) {
57 57
         continue;
58 58
       }
59 59
       $shipCostInMetalPerPiece[$unit_id] = get_unit_cost_in($unit_info[P_COST], RES_METAL);
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
   $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1 / 1.7));
74 74
 
75 75
   $chance_max = 0;
76
-  foreach($outcome_list as $key => &$value) {
77
-    if(!$value['chance']) {
76
+  foreach ($outcome_list as $key => &$value) {
77
+    if (!$value['chance']) {
78 78
       unset($outcome_list[$key]);
79 79
       continue;
80 80
     }
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
   }
83 83
   $outcome_value = mt_rand(0, $chance_max);
84 84
   $outcome_description = &$outcome_list[$mission_outcome = FLT_EXPEDITION_OUTCOME_NONE];
85
-  foreach($outcome_list as $key => &$value) {
86
-    if(!$value['chance']) {
85
+  foreach ($outcome_list as $key => &$value) {
86
+    if (!$value['chance']) {
87 87
       continue;
88 88
     }
89 89
     $mission_outcome = $key;
90 90
     $outcome_description = $value;
91
-    if($outcome_value <= $outcome_description['value']) {
91
+    if ($outcome_value <= $outcome_description['value']) {
92 92
       break;
93 93
     }
94 94
   }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 //  $outcome_mission_sub = -1;
106 106
 
107 107
   $fleet_found = array();
108
-  switch($mission_outcome) {
108
+  switch ($mission_outcome) {
109 109
     case FLT_EXPEDITION_OUTCOME_LOST_FLEET:
110 110
       $objFleet->shipsCountApplyLossMultiplier(mt_rand(1, 3) * mt_rand(200000, 300000) / 1000000);
111 111
     break;
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
       // Ограничиваем корабли только теми, чья стоимость в металле меньше или равно стоимости самого дорогого корабля
128 128
       $can_be_found = array();
129
-      foreach($shipCostInMetalPerPiece as $ship_id => $shipMetalCost) {
130
-        if($shipMetalCost < $max_metal_cost) {
129
+      foreach ($shipCostInMetalPerPiece as $ship_id => $shipMetalCost) {
130
+        if ($shipMetalCost < $max_metal_cost) {
131 131
           $can_be_found[$ship_id] = $shipMetalCost;
132 132
         }
133 133
       }
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
       unset($can_be_found[SHIP_COLONIZER]);
136 136
       unset($can_be_found[SHIP_SPY]);
137 137
 
138
-      while(count($can_be_found) && $found_in_metal >= max($can_be_found)) {
138
+      while (count($can_be_found) && $found_in_metal >= max($can_be_found)) {
139 139
         $found_index = mt_rand(1, count($can_be_found)) - 1;
140 140
         $found_ship = array_slice($can_be_found, $found_index, 1, true);
141 141
         $found_ship_cost = reset($found_ship);
142 142
         $found_ship_id = key($found_ship);
143 143
 
144
-        if($found_ship_cost > $found_in_metal) {
144
+        if ($found_ship_cost > $found_in_metal) {
145 145
           unset($can_be_found[$found_ship_id]);
146 146
         } else {
147 147
           $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost));
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
         }
151 151
       }
152 152
 
153
-      if(empty($fleet_found)) {
153
+      if (empty($fleet_found)) {
154 154
         $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
155 155
       } else {
156
-        foreach($fleet_found as $unit_id => $unit_amount) {
156
+        foreach ($fleet_found as $unit_id => $unit_amount) {
157 157
           $objFleet->shipAdjustCount($unit_id, $unit_amount);
158 158
         }
159 159
       }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
       $objFleet->resourcesAdjust($resources_found);
179 179
 
180
-      if(array_sum($resources_found) == 0) {
180
+      if (array_sum($resources_found) == 0) {
181 181
         $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
182 182
       }
183 183
     break;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
       // Рассчитываем количество найденной ТМ
189 189
       $found_dark_matter = floor(min($outcome_percent * $result['$fleet_metal_points'] / $rates[RES_DARK_MATTER], 10000) * mt_rand(750000, 1000000) / 1000000);
190 190
 
191
-      if(!$found_dark_matter) {
191
+      if (!$found_dark_matter) {
192 192
         $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
193 193
       }
194 194
     break;
@@ -202,46 +202,45 @@  discard block
 block discarded – undo
202 202
 
203 203
   mission_expedition_result_adjust($result);
204 204
 
205
-  if($found_dark_matter) {
205
+  if ($found_dark_matter) {
206 206
     rpg_points_change($objFleet->playerOwnerId, RPG_EXPEDITION, $found_dark_matter, 'Expedition Bonus');
207 207
     $msg_text_addon = sprintf(classLocale::$lang['flt_mission_expedition']['found_dark_matter'], $found_dark_matter);
208 208
   }
209 209
 
210
-  if(!empty($fleet_lost)) {
210
+  if (!empty($fleet_lost)) {
211 211
     $msg_text_addon = classLocale::$lang['flt_mission_expedition']['lost_fleet'];
212
-    foreach($fleet_lost as $ship_id => $ship_amount) {
213
-      $msg_text_addon .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n";
212
+    foreach ($fleet_lost as $ship_id => $ship_amount) {
213
+      $msg_text_addon .= classLocale::$lang['tech'][$ship_id].' - '.$ship_amount."\r\n";
214 214
     }
215 215
   }
216 216
 
217
-  if(!empty($fleet_found)) {
217
+  if (!empty($fleet_found)) {
218 218
     $msg_text_addon = classLocale::$lang['flt_mission_expedition']['found_fleet'];
219
-    foreach($fleet_found as $ship_id => $ship_amount) {
220
-      $msg_text_addon .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n";
219
+    foreach ($fleet_found as $ship_id => $ship_amount) {
220
+      $msg_text_addon .= classLocale::$lang['tech'][$ship_id].' - '.$ship_amount."\r\n";
221 221
     }
222 222
   }
223 223
 
224
-  if(!empty($resources_found) && array_sum($resources_found) > 0) {
224
+  if (!empty($resources_found) && array_sum($resources_found) > 0) {
225 225
     $msg_text_addon = classLocale::$lang['flt_mission_expedition']['found_resources'];
226
-    foreach($resources_found as $resource_id => $resource_amount) {
227
-      $msg_text_addon .= classLocale::$lang['tech'][$resource_id] . ' - ' . $resource_amount . "\r\n";
226
+    foreach ($resources_found as $resource_id => $resource_amount) {
227
+      $msg_text_addon .= classLocale::$lang['tech'][$resource_id].' - '.$resource_amount."\r\n";
228 228
     }
229 229
   }
230 230
 
231
-  if(!$msg_text) {
231
+  if (!$msg_text) {
232 232
     $messages = &classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['messages'];
233
-    if($outcome_mission_sub >= 0 && is_array($messages)) {
233
+    if ($outcome_mission_sub >= 0 && is_array($messages)) {
234 234
       $messages = &$messages[$outcome_mission_sub];
235 235
     }
236 236
 
237
-    $msg_text = is_string($messages) ? $messages :
238
-      (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : '');
237
+    $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : '');
239 238
   }
240 239
 
241 240
   $fleet_row_end_coordinates_without_type = $objFleet->target_coordinates_without_type();
242 241
 
243
-  $msg_text = sprintf($msg_text, $objFleet->dbId, uni_render_coordinates($fleet_row_end_coordinates_without_type)) .
244
-    ($msg_text_addon ? "\r\n" . $msg_text_addon : '');
242
+  $msg_text = sprintf($msg_text, $objFleet->dbId, uni_render_coordinates($fleet_row_end_coordinates_without_type)).
243
+    ($msg_text_addon ? "\r\n".$msg_text_addon : '');
245 244
 
246 245
   DBStaticMessages::msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_mission_job_complete, MSG_TYPE_EXPLORE, $msg_sender, $msg_title, $msg_text);
247 246
 
Please login to merge, or discard this patch.
includes/includes/flt_mission_recycle.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
   $RecyclerCapacity = 0;
17 17
   $OtherFleetCapacity = 0;
18 18
 
19
-  foreach($objFleet->shipsIterator() as $unit_id => $unit) {
20
-    if(in_array($unit_id, classSupernova::$gc->groupFleet)) {
19
+  foreach ($objFleet->shipsIterator() as $unit_id => $unit) {
20
+    if (in_array($unit_id, classSupernova::$gc->groupFleet)) {
21 21
       $capacity = get_unit_param($unit_id, P_CAPACITY) * $unit->count;
22
-      if(in_array($unit_id, classSupernova::$gc->groupRecyclers)) {
22
+      if (in_array($unit_id, classSupernova::$gc->groupRecyclers)) {
23 23
         $RecyclerCapacity += $capacity;
24 24
       } else {
25 25
         $OtherFleetCapacity += $capacity;
@@ -28,33 +28,33 @@  discard block
 block discarded – undo
28 28
   }
29 29
 
30 30
   $fleet_resources_amount = $objFleet->resourcesGetTotal();
31
-  if($fleet_resources_amount > $OtherFleetCapacity) {
31
+  if ($fleet_resources_amount > $OtherFleetCapacity) {
32 32
     // Если во флоте есть другие корабли И количество ресурсов больше, чем их ёмкость трюмов - значит часть этих ресурсов лежит в трюмах переработчиков
33 33
     // Уменьшаем ёмкость переработчиков на указанную величину
34 34
     $RecyclerCapacity -= ($fleet_resources_amount - $OtherFleetCapacity);
35 35
   }
36 36
 
37 37
   $resources_recycled = array();
38
-  if(($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) {
38
+  if (($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) {
39 39
     $resources_recycled[RES_METAL] = $destination_planet["debris_metal"];
40 40
     $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"];
41 41
   } else {
42
-    if(($destination_planet["debris_metal"] > $RecyclerCapacity / 2) &&
42
+    if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) &&
43 43
       ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)
44 44
     ) {
45 45
       $resources_recycled[RES_METAL] = $RecyclerCapacity / 2;
46 46
       $resources_recycled[RES_CRYSTAL] = $RecyclerCapacity / 2;
47 47
     } else {
48
-      if($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) {
48
+      if ($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) {
49 49
         $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"];
50
-        if($destination_planet["debris_metal"] > ($RecyclerCapacity - $resources_recycled[RES_CRYSTAL])) {
50
+        if ($destination_planet["debris_metal"] > ($RecyclerCapacity - $resources_recycled[RES_CRYSTAL])) {
51 51
           $resources_recycled[RES_METAL] = $RecyclerCapacity - $resources_recycled[RES_CRYSTAL];
52 52
         } else {
53 53
           $resources_recycled[RES_METAL] = $destination_planet["debris_metal"];
54 54
         }
55 55
       } else {
56 56
         $resources_recycled[RES_METAL] = $destination_planet["debris_metal"];
57
-        if($destination_planet["debris_crystal"] > ($RecyclerCapacity - $resources_recycled[RES_METAL])) {
57
+        if ($destination_planet["debris_crystal"] > ($RecyclerCapacity - $resources_recycled[RES_METAL])) {
58 58
           $resources_recycled[RES_CRYSTAL] = $RecyclerCapacity - $resources_recycled[RES_METAL];
59 59
         } else {
60 60
           $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"];
Please login to merge, or discard this patch.