Completed
Push — trunk ( 34029c...0f5c9b )
by SuperNova.WS
03:54
created
classes/Ube/Ube4_1/Ube4_1Calc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
         // Для не-симулятора - рандомизируем каждый раунд значения атаки и щитов
73 73
         $fleet_data[UBE_ATTACK_BASE][$unit_id] = floor($fleet_info[UBE_ATTACK][$unit_id] * ($isSimulatorStatic ? 1 : mt_rand(80, 120) / 100));
74 74
         $fleet_data[UBE_SHIELD_BASE][$unit_id] = floor($fleet_info[UBE_SHIELD][$unit_id] * ($isSimulatorStatic ? 1 : mt_rand(80, 120) / 100));
75
-        $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]);// * ($is_simulator ? 1 : mt_rand(80, 120) / 100));
75
+        $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]); // * ($is_simulator ? 1 : mt_rand(80, 120) / 100));
76 76
 
77 77
         $fleet_data[UBE_ATTACK][$unit_id] = $fleet_data[UBE_ATTACK_BASE][$unit_id] * $unit_count;
78 78
         $fleet_data[UBE_SHIELD][$unit_id] = $fleet_data[UBE_SHIELD_BASE][$unit_id] * $unit_count;
Please login to merge, or discard this patch.
classes/Universe.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
   const MOON_MIN_SIZE = 1100;
9 9
   const MOON_MAX_SIZE = 8999;
10 10
 
11
-  const MOON_DEBRIS_MIN = 1000000;    // Minimum amount of debris to span a moon
12
-  const MOON_CHANCE_MIN_PERCENT = 1;  // Minimum chance to span a moon
11
+  const MOON_DEBRIS_MIN = 1000000; // Minimum amount of debris to span a moon
12
+  const MOON_CHANCE_MIN_PERCENT = 1; // Minimum chance to span a moon
13 13
   const MOON_CHANCE_MAX_PERCENT = 30; // Maximum chance to span a moon
14 14
 
15 15
   /**
Please login to merge, or discard this patch.
classes/Fleet/RecordFleet.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
   public function __construct(GlobalContainer $services = null) {
77 77
     parent::__construct($services);
78 78
 
79
-    if(empty(static::$shipInfo)) {
80
-      foreach(sn_get_groups('fleet') as $unit_id) {
79
+    if (empty(static::$shipInfo)) {
80
+      foreach (sn_get_groups('fleet') as $unit_id) {
81 81
         static::$shipInfo[$unit_id] = get_unit_param($unit_id);
82 82
         static::$shipInfo[$unit_id][P_COST_METAL] = get_unit_cost_in(static::$shipInfo[$unit_id][P_COST]);
83 83
       }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
    * @inheritdoc
104 104
    */
105 105
   public function update() {
106
-    if($this->getShipCount() < 1) {
106
+    if ($this->getShipCount() < 1) {
107 107
       return $this->delete();
108 108
     }
109 109
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
    */
128 128
   public function getCostInMetal() {
129 129
     $result = 0;
130
-    foreach($this->shipList as $shipId => $amount) {
130
+    foreach ($this->shipList as $shipId => $amount) {
131 131
       $result += $amount * $this->getShipCostInMetal($shipId);
132 132
     }
133 133
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
    */
149 149
   public function getCapacity() {
150 150
     $result = 0;
151
-    foreach($this->shipList as $shipId => $amount) {
151
+    foreach ($this->shipList as $shipId => $amount) {
152 152
       $result += $amount * $this->getShipCapacity($shipId);
153 153
     }
154 154
 
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
    */
166 166
   public function changeShipCount($shipSnId, $shipCount) {
167 167
     !isset($this->shipList[$shipSnId]) ? $this->shipList[$shipSnId] = 0 : false;
168
-    if($this->shipList[$shipSnId] + $shipCount < 0) {
168
+    if ($this->shipList[$shipSnId] + $shipCount < 0) {
169 169
       throw new \Exception("Trying to deduct more ships [{$shipSnId}] '{$shipCount}' then fleet has {$this->shipList[$shipSnId]}");
170 170
     }
171 171
 
172 172
     $this->shipList[$shipSnId] += $shipCount;
173
-    if($this->shipList[$shipSnId] <= 0) {
173
+    if ($this->shipList[$shipSnId] <= 0) {
174 174
       unset($this->shipList[$shipSnId]);
175 175
     }
176 176
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
    * @throws \Exception
186 186
    */
187 187
   public function changeResource($resourceId, $resourceCount) {
188
-    if(!array_key_exists($resourceId, $this->resources) || empty($resourceCount)) {
188
+    if (!array_key_exists($resourceId, $this->resources) || empty($resourceCount)) {
189 189
       return;
190 190
     }
191 191
 
192
-    if($this->resources[$resourceId] + $resourceCount < 0) {
192
+    if ($this->resources[$resourceId] + $resourceCount < 0) {
193 193
       throw new \Exception("Trying to deduct more resources [{$resourceId}] '{$resourceCount}' then fleet has {$this->resources[$resourceId]}");
194 194
     }
195 195
 
Please login to merge, or discard this patch.
classes/Fleet/MissionExplore.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
    *
41 41
    * @var int[] $shipsToRemove
42 42
    */
43
-  protected $shipsToRemove = [SHIP_COLONIZER, SHIP_SPY,];
43
+  protected $shipsToRemove = [SHIP_COLONIZER, SHIP_SPY, ];
44 44
 
45 45
   // -------------------------------------------------------------------------------------------------------------------
46 46
   /**
Please login to merge, or discard this patch.
includes/update.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -359,7 +359,7 @@
 block discarded – undo
359 359
       );
360 360
     }
361 361
 
362
-    updPatchApply(1, function () {
362
+    updPatchApply(1, function() {
363 363
       $q = upd_do_query("SELECT `messageid`, `user` FROM `{{chat}}`", true);
364 364
       while ($row = db_fetch($q)) {
365 365
         if (strpos($row['user'], 'a:') !== 0) {
Please login to merge, or discard this patch.
admin/userlist.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
 
86 86
   $template->assign_block_vars('user', array(
87 87
       'ID'              => $user_row['id'],
88
-      'NAME'            => $renderedNick = player_nick_render_to_html($user_row, ['player_rank' => true, 'vacancy' => true, 'birthday' => true, 'award' => true, NICK_RANK_NO_TEXT => true,]),
88
+      'NAME'            => $renderedNick = player_nick_render_to_html($user_row, ['player_rank' => true, 'vacancy' => true, 'birthday' => true, 'award' => true, NICK_RANK_NO_TEXT => true, ]),
89 89
       'NAME_HTML'       => htmlentities($user_row['username'], ENT_QUOTES, 'UTF-8'),
90 90
       'IP'              => $user_row['user_lastip'],
91 91
       'IP_MULTI'        => intval($multi_ip[$user_row['user_lastip']]),
Please login to merge, or discard this patch.
includes/vars.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
           2 => 0.01,
565 565
         ),
566 566
         P_MISSION_EXPEDITION_OUTCOME_SECONDARY => [
567
-          [P_CHANCE => 90, P_MULTIPLIER => 0.01, P_MESSAGE_ID => 2,],
568
-          [P_CHANCE =>  9, P_MULTIPLIER => 0.02, P_MESSAGE_ID => 1,],
569
-          [P_CHANCE =>  1, P_MULTIPLIER => 0.10, P_MESSAGE_ID => 0,],
567
+          [P_CHANCE => 90, P_MULTIPLIER => 0.01, P_MESSAGE_ID => 2, ],
568
+          [P_CHANCE =>  9, P_MULTIPLIER => 0.02, P_MESSAGE_ID => 1, ],
569
+          [P_CHANCE =>  1, P_MULTIPLIER => 0.10, P_MESSAGE_ID => 0, ],
570 570
         ],
571 571
       ),
572 572
       FLT_EXPEDITION_OUTCOME_FOUND_RESOURCES => array(
@@ -578,9 +578,9 @@  discard block
 block discarded – undo
578 578
           2 => 0.025,
579 579
         ),
580 580
         P_MISSION_EXPEDITION_OUTCOME_SECONDARY => [
581
-          [P_CHANCE => 90, P_MULTIPLIER => 0.025, P_MESSAGE_ID => 2,],
582
-          [P_CHANCE =>  9, P_MULTIPLIER => 0.050, P_MESSAGE_ID => 1,],
583
-          [P_CHANCE =>  1, P_MULTIPLIER => 0.100, P_MESSAGE_ID => 0,],
581
+          [P_CHANCE => 90, P_MULTIPLIER => 0.025, P_MESSAGE_ID => 2, ],
582
+          [P_CHANCE =>  9, P_MULTIPLIER => 0.050, P_MESSAGE_ID => 1, ],
583
+          [P_CHANCE =>  1, P_MULTIPLIER => 0.100, P_MESSAGE_ID => 0, ],
584 584
         ],
585 585
       ),
586 586
       FLT_EXPEDITION_OUTCOME_FOUND_DM        => array(
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
       UNIT_PLANS        => 'plans',
1237 1237
     ],
1238 1238
 
1239
-    GROUP_CAPITAL_BUILDING_BONUS_GROUPS => ['structures', 'defense','fleet',],
1239
+    GROUP_CAPITAL_BUILDING_BONUS_GROUPS => ['structures', 'defense', 'fleet', ],
1240 1240
 
1241 1241
   ),
1242 1242
 );
Please login to merge, or discard this patch.
includes/functions/eco_get_build_data.php 2 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-function eco_lab_sort_effectivness($a, $b)
4
-{
3
+function eco_lab_sort_effectivness($a, $b) {
5 4
   return $a['laboratory_effective_level'] > $b['laboratory_effective_level'] ? -1 : ($a['laboratory_effective_level'] < $b['laboratory_effective_level'] ? 1 : 0);
6 5
 }
7 6
 
@@ -11,8 +10,7 @@  discard block
 block discarded – undo
11 10
  * 1.0 - copyright (c) 2010 by Gorlum for http://supernova.ws
12 11
  * @version 1.0
13 12
  */
14
-function eco_get_lab_max_effective_level(&$user, $lab_require)
15
-{
13
+function eco_get_lab_max_effective_level(&$user, $lab_require) {
16 14
   if(!$user['user_as_ally'] && !isset($user['laboratories_active']))
17 15
   {
18 16
     $user['laboratories_active'] = array();
@@ -38,8 +36,7 @@  discard block
 block discarded – undo
38 36
     if($user['user_as_ally'])
39 37
     {
40 38
       $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true);
41
-    }
42
-    else
39
+    } else
43 40
     {
44 41
       $tech_intergalactic = mrc_get_level($user, false, TECH_RESEARCH) + 1;
45 42
       $lab_level['effective_level'] = 0;
@@ -217,8 +214,7 @@  discard block
 block discarded – undo
217 214
   return $result;
218 215
 }
219 216
 
220
-function eco_is_builds_in_que($planet_que, $unit_list)
221
-{
217
+function eco_is_builds_in_que($planet_que, $unit_list) {
222 218
   $eco_is_builds_in_que = false;
223 219
 
224 220
   $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list);
@@ -240,8 +236,7 @@  discard block
 block discarded – undo
240 236
 }
241 237
 
242 238
 function eco_unit_busy(&$user, &$planet, $unit_id){$result = null;return sn_function_call('eco_unit_busy', [&$user, &$planet, $unit_id, &$result]);}
243
-function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result)
244
-{
239
+function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) {
245 240
   global $config;
246 241
 
247 242
   $result = isset($result) ? $result : false;
@@ -262,8 +257,7 @@  discard block
 block discarded – undo
262 257
       //{
263 258
       //  $result = true;
264 259
       //}
265
-    }
266
-    elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que'])
260
+    } elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que'])
267 261
     {
268 262
       $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO));
269 263
     }
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function eco_get_lab_max_effective_level(&$user, $lab_require)
15 15
 {
16
-  if(!$user['user_as_ally'] && !isset($user['laboratories_active']))
16
+  if (!$user['user_as_ally'] && !isset($user['laboratories_active']))
17 17
   {
18 18
     $user['laboratories_active'] = array();
19 19
     $query = DBStaticUnit::db_unit_list_laboratories($user['id']);
20
-    while($row = db_fetch($query))
20
+    while ($row = db_fetch($query))
21 21
     {
22
-      if(!eco_unit_busy($user, $row, UNIT_TECHNOLOGIES))
22
+      if (!eco_unit_busy($user, $row, UNIT_TECHNOLOGIES))
23 23
       {
24 24
         $row += array(
25 25
           STRUC_LABORATORY => $level_lab = mrc_get_level($user, $row, STRUC_LABORATORY),
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
     uasort($user['laboratories_active'], 'eco_lab_sort_effectivness');
34 34
   }
35 35
 
36
-  if(!isset($user['research_effective_level'][$lab_require]))
36
+  if (!isset($user['research_effective_level'][$lab_require]))
37 37
   {
38
-    if($user['user_as_ally'])
38
+    if ($user['user_as_ally'])
39 39
     {
40 40
       $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true);
41 41
     }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
       $tech_intergalactic = mrc_get_level($user, false, TECH_RESEARCH) + 1;
45 45
       $lab_level['effective_level'] = 0;
46 46
 
47
-      foreach($user['laboratories_active'] as $data)
47
+      foreach ($user['laboratories_active'] as $data)
48 48
       {
49
-        if($tech_intergalactic <= 0)
49
+        if ($tech_intergalactic <= 0)
50 50
         {
51 51
           break;
52 52
         }
53
-        if($data[STRUC_LABORATORY] >= $lab_require)
53
+        if ($data[STRUC_LABORATORY] >= $lab_require)
54 54
         {
55 55
           $lab_level['effective_level'] += $data['laboratory_effective_level'];
56 56
           $tech_intergalactic--;
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
   $cost[P_OPTIONS][P_TIME_RAW] = 0;
91 91
   $only_dark_matter = 0;
92 92
   $cost_in_metal = 0;
93
-  foreach($unit_data[P_COST] as $resource_id => $resource_amount) {
94
-    if($resource_id === P_FACTOR || !($resource_cost = $resource_amount * $price_increase)) {
93
+  foreach ($unit_data[P_COST] as $resource_id => $resource_amount) {
94
+    if ($resource_id === P_FACTOR || !($resource_cost = $resource_amount * $price_increase)) {
95 95
       continue;
96 96
     }
97 97
 
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 
103 103
     $cost_in_metal += $cost[BUILD_CREATE][$resource_id] * $currentResourceExchange;
104 104
 
105
-    if(in_array($resource_id, $resources_loot)) {
105
+    if (in_array($resource_id, $resources_loot)) {
106 106
       $cost[P_OPTIONS][P_TIME_RAW] += $resource_cost * $currentResourceExchange / $rpg_exchange_deuterium;
107 107
       $resource_got = mrc_get_level($user, $planet, $resource_id);
108
-    } elseif($resource_id == RES_DARK_MATTER) {
108
+    } elseif ($resource_id == RES_DARK_MATTER) {
109 109
       $resource_got = mrc_get_level($user, null, $resource_id);
110
-    } elseif($resource_id == RES_ENERGY) {
110
+    } elseif ($resource_id == RES_ENERGY) {
111 111
       $resource_got = max(0, $planet['energy_max'] - $planet['energy_used']);
112 112
     } else {
113 113
       $resource_got = 0;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
   }
120 120
 
121 121
   $resources_normalized = 0;
122
-  foreach($resources_loot as $resource_id) {
122
+  foreach ($resources_loot as $resource_id) {
123 123
     $resources_normalized += floor(mrc_get_level($user, $planet, $resource_id)) * $config->__get('rpg_exchange_' . pname_resource_name($resource_id));
124 124
   }
125 125
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
   $cost[P_OPTIONS][P_TIME_RAW] = $cost[P_OPTIONS][P_TIME_RAW] * 60 * 60 / get_game_speed() / 2500;
136 136
 
137 137
   // TODO - Вынести в отдельную процедуру расчёт стоимости
138
-  if($only_cost) {
138
+  if ($only_cost) {
139 139
     return $cost;
140 140
   }
141 141
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
   $cost['RESULT'][BUILD_DESTROY] = BUILD_INDESTRUCTABLE;
148 148
 
149 149
   $mercenary = 0;
150
-  if(in_array($unit_id, sn_get_groups('structures'))) {
150
+  if (in_array($unit_id, sn_get_groups('structures'))) {
151 151
     $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_ROBOT) + 1);
152 152
     $cost['RESULT'][BUILD_DESTROY] =
153 153
       mrc_get_level($user, $planet, $unit_id, false, true)
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
           )
158 158
         : BUILD_NO_UNITS;
159 159
     $mercenary = MRC_ENGINEER;
160
-  } elseif(in_array($unit_id, sn_get_groups('tech'))) {
160
+  } elseif (in_array($unit_id, sn_get_groups('tech'))) {
161 161
     $lab_level = eco_get_lab_max_effective_level($user, intval($unit_data[P_REQUIRE][STRUC_LABORATORY]));
162 162
     $cost[RES_TIME][BUILD_CREATE] /= $lab_level;
163 163
     $mercenary = MRC_ACADEMIC;
164
-  } elseif(in_array($unit_id, sn_get_groups('defense'))) {
165
-    $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1) ;
164
+  } elseif (in_array($unit_id, sn_get_groups('defense'))) {
165
+    $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1);
166 166
     $mercenary = MRC_FORTIFIER;
167
-  } elseif(in_array($unit_id, sn_get_groups('fleet'))) {
167
+  } elseif (in_array($unit_id, sn_get_groups('fleet'))) {
168 168
     $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1);
169 169
     $mercenary = MRC_ENGINEER;
170 170
   }
171 171
 
172
-  if(
172
+  if (
173 173
     // If planet is capital
174 174
     $user['id_planet'] == $planet['id']
175 175
     &&
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
     $cost[RES_TIME][BUILD_CREATE] = $cost[RES_TIME][BUILD_CREATE] / SN::$gc->config->planet_capital_building_rate;
181 181
   }
182 182
 
183
-  if($mercenary) {
183
+  if ($mercenary) {
184 184
     $cost[RES_TIME][BUILD_CREATE] = $cost[RES_TIME][BUILD_CREATE] / mrc_modify_value($user, $planet, $mercenary, 1);
185 185
   }
186 186
 
187
-  if(in_array($unit_id, sn_get_groups('governors')) || $only_dark_matter) {
187
+  if (in_array($unit_id, sn_get_groups('governors')) || $only_dark_matter) {
188 188
     $cost[RES_TIME][BUILD_CREATE] = $cost[RES_TIME][BUILD_DESTROY] = 0;
189 189
   } else {
190 190
     $cost[RES_TIME][BUILD_CREATE]  = $cost[RES_TIME][BUILD_CREATE] > 1 ? round($cost[RES_TIME][BUILD_CREATE]) : 1;
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
   return $cost;
195 195
 }
196 196
 
197
-function eco_can_build_unit($user, $planet, $unit_id){$result = null;return sn_function_call('eco_can_build_unit', array($user, $planet, $unit_id, &$result));}
197
+function eco_can_build_unit($user, $planet, $unit_id) {$result = null; return sn_function_call('eco_can_build_unit', array($user, $planet, $unit_id, &$result)); }
198 198
 function sn_eco_can_build_unit($user, $planet, $unit_id, &$result) {
199 199
   global $config;
200 200
 
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
   $result = $result == BUILD_ALLOWED && eco_unit_busy($user, $planet, $unit_id) ? BUILD_UNIT_BUSY : $result;
203 203
 
204 204
   $unit_param = get_unit_param($unit_id);
205
-  if($unit_param[P_UNIT_TYPE] != UNIT_MERCENARIES || !$config->empire_mercenary_temporary) {
205
+  if ($unit_param[P_UNIT_TYPE] != UNIT_MERCENARIES || !$config->empire_mercenary_temporary) {
206 206
     $requirement = &$unit_param[P_REQUIRE];
207
-    if($result == BUILD_ALLOWED && $requirement) {
208
-      foreach($requirement as $require_id => $require_level) {
209
-        if(mrc_get_level($user, $planet, $require_id) < $require_level) {
207
+    if ($result == BUILD_ALLOWED && $requirement) {
208
+      foreach ($requirement as $require_id => $require_level) {
209
+        if (mrc_get_level($user, $planet, $require_id) < $require_level) {
210 210
           $result = BUILD_REQUIRE_NOT_MEET;
211 211
           break;
212 212
         }
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
 
224 224
   $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list);
225 225
   $planet_que = explode(';', $planet_que);
226
-  foreach($planet_que as $planet_que_item)
226
+  foreach ($planet_que as $planet_que_item)
227 227
   {
228
-    if($planet_que_item)
228
+    if ($planet_que_item)
229 229
     {
230 230
       list($planet_que_item) = explode(',', $planet_que_item);
231
-      if(in_array($planet_que_item, $unit_list))
231
+      if (in_array($planet_que_item, $unit_list))
232 232
       {
233 233
         $eco_is_builds_in_que = true;
234 234
         break;
@@ -239,21 +239,21 @@  discard block
 block discarded – undo
239 239
   return $eco_is_builds_in_que;
240 240
 }
241 241
 
242
-function eco_unit_busy(&$user, &$planet, $unit_id){$result = null;return sn_function_call('eco_unit_busy', [&$user, &$planet, $unit_id, &$result]);}
242
+function eco_unit_busy(&$user, &$planet, $unit_id) {$result = null; return sn_function_call('eco_unit_busy', [&$user, &$planet, $unit_id, &$result]); }
243 243
 function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result)
244 244
 {
245 245
   global $config;
246 246
 
247 247
   $result = isset($result) ? $result : false;
248
-  if(!$result)
248
+  if (!$result)
249 249
   {
250
-    if(($unit_id == STRUC_LABORATORY || $unit_id == STRUC_LABORATORY_NANO) && !$config->BuildLabWhileRun)
250
+    if (($unit_id == STRUC_LABORATORY || $unit_id == STRUC_LABORATORY_NANO) && !$config->BuildLabWhileRun)
251 251
     {
252 252
       $global_que = que_get($user['id'], $planet['id'], QUE_RESEARCH, false);
253
-      if(is_array($global_que['ques'][QUE_RESEARCH][$user['id']]))
253
+      if (is_array($global_que['ques'][QUE_RESEARCH][$user['id']]))
254 254
       {
255 255
         $first_element = reset($global_que['ques'][QUE_RESEARCH][$user['id']]);
256
-        if(is_array($first_element))
256
+        if (is_array($first_element))
257 257
         {
258 258
           $result = true;
259 259
         }
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
       //  $result = true;
264 264
       //}
265 265
     }
266
-    elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que'])
266
+    elseif (($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que'])
267 267
     {
268 268
       $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO));
269 269
     }
Please login to merge, or discard this patch.
galaxy.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     ||
126 126
     (!empty($uni_galaxyRowPlanet['destruyed']) && CheckAbandonPlanetState($uni_galaxyRowPlanet))
127 127
   ) {
128
-    $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet,]);
128
+    $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet, ]);
129 129
     continue;
130 130
   }
131 131
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     'IS_CAPITAL'      => $uni_galaxyRowUser['id_planet'] == $uni_galaxyRowPlanet['id'],
243 243
 
244 244
     'USER_ID'         => $uni_galaxyRowUser['id'],
245
-    'USER_NAME'       => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true,]),
245
+    'USER_NAME'       => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true, ]),
246 246
     'USER_NAME_JS'    => js_safe_string($renderedNick),
247 247
     'USER_RANK'       => in_array($uni_galaxyRowUser['id'], $user_skip_list) ? '-' : $uni_galaxyRowUser['total_rank'],
248 248
     'USER_BANNED'     => $uni_galaxyRowUser['banaday'],
Please login to merge, or discard this patch.