@@ -58,8 +58,8 @@ |
||
58 | 58 | protected function bonusSort(BonusAtom $a, BonusAtom $b) { |
59 | 59 | static $bonusOrder = [BonusAtom::class, BonusAtomAbility::class, BonusAtomAdd::class, BonusAtomPercent::class, BonusAtomMultiply::class]; |
60 | 60 | |
61 | - $indexA = (int)array_search(get_class($a), $bonusOrder); |
|
62 | - $indexB = (int)array_search(get_class($b), $bonusOrder); |
|
61 | + $indexA = (int) array_search(get_class($a), $bonusOrder); |
|
62 | + $indexB = (int) array_search(get_class($b), $bonusOrder); |
|
63 | 63 | |
64 | 64 | return $indexA == $indexB ? 0 : ($indexA > $indexB ? +1 : -1); |
65 | 65 | } |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | |
15 | 15 | $fleet_left = 1 - mt_rand(1, 3) * mt_rand(200000, 300000) / 1000000; |
16 | 16 | $fleet_lost = array(); |
17 | - foreach($fleet as $unit_id => &$unit_amount) { |
|
17 | + foreach ($fleet as $unit_id => &$unit_amount) { |
|
18 | 18 | $ships_left = floor($unit_amount * $fleet_left); |
19 | 19 | $fleet_lost[$unit_id] = $unit_amount - $ships_left; |
20 | 20 | $unit_amount = $ships_left; |
21 | - if(!$unit_amount) { |
|
21 | + if (!$unit_amount) { |
|
22 | 22 | unset($fleet[$unit_id]); |
23 | 23 | } |
24 | 24 | } |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | // $fleet = array(); |
32 | 32 | } |
33 | 33 | |
34 | -function flt_mission_explore_addon(&$result){return sn_function_call('flt_mission_explore_addon', array(&$result));} |
|
34 | +function flt_mission_explore_addon(&$result) {return sn_function_call('flt_mission_explore_addon', array(&$result)); } |
|
35 | 35 | function sn_flt_mission_explore_addon(&$result) { |
36 | 36 | return $result; |
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | 40 | function flt_mission_explore(&$mission_data) { |
41 | - if(!isset($mission_data['fleet_event']) || $mission_data['fleet_event'] != EVENT_FLT_ACOMPLISH) { |
|
41 | + if (!isset($mission_data['fleet_event']) || $mission_data['fleet_event'] != EVENT_FLT_ACOMPLISH) { |
|
42 | 42 | return CACHE_NONE; |
43 | 43 | } |
44 | 44 | |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | $outcome_list = &$result['$outcome_list']; |
72 | 72 | $fleet_metal_points = &$result['$fleet_metal_points']; |
73 | 73 | |
74 | - if(!$ship_data) { |
|
75 | - foreach(sn_get_groups('fleet') as $unit_id) { |
|
74 | + if (!$ship_data) { |
|
75 | + foreach (sn_get_groups('fleet') as $unit_id) { |
|
76 | 76 | $unit_info = get_unit_param($unit_id); |
77 | - if($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) { |
|
77 | + if ($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) { |
|
78 | 78 | continue; |
79 | 79 | } |
80 | 80 | $ship_data[$unit_id][P_COST_METAL] = get_unit_cost_in($unit_info[P_COST]); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $fleet = sys_unit_str2arr($fleet_row['fleet_array']); |
87 | 87 | $fleet_capacity = 0; |
88 | 88 | $fleet_metal_points = 0; |
89 | - foreach($fleet as $ship_id => $ship_amount) { |
|
89 | + foreach ($fleet as $ship_id => $ship_amount) { |
|
90 | 90 | $unit_info = get_unit_param($ship_id); |
91 | 91 | $fleet_capacity += $ship_amount * $unit_info[P_CAPACITY]; |
92 | 92 | $fleet_metal_points += $ship_amount * $ship_data[$ship_id][P_COST_METAL]; |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $flt_stay_hours = ($fleet_row['fleet_end_stay'] - $fleet_row['fleet_start_time']) / 3600 * ($config->game_speed_expedition ? $config->game_speed_expedition : 1); |
97 | 97 | |
98 | 98 | $outcome_list = sn_get_groups(GROUP_MISSION_EXPLORE_OUTCOMES); |
99 | - $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1/1.7)); |
|
99 | + $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1 / 1.7)); |
|
100 | 100 | |
101 | 101 | $chance_max = 0; |
102 | - foreach($outcome_list as $key => &$value) { |
|
103 | - if(!$value['chance']) { |
|
102 | + foreach ($outcome_list as $key => &$value) { |
|
103 | + if (!$value['chance']) { |
|
104 | 104 | unset($outcome_list[$key]); |
105 | 105 | continue; |
106 | 106 | } |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | $outcome_value = mt_rand(0, $chance_max); |
110 | 110 | // $outcome_value = 409; |
111 | 111 | $outcome_description = &$outcome_list[$mission_outcome = FLT_EXPEDITION_OUTCOME_NONE]; |
112 | - foreach($outcome_list as $key => &$value) { |
|
113 | - if(!$value['chance']) { |
|
112 | + foreach ($outcome_list as $key => &$value) { |
|
113 | + if (!$value['chance']) { |
|
114 | 114 | continue; |
115 | 115 | } |
116 | 116 | $mission_outcome = $key; |
117 | 117 | $outcome_description = $value; |
118 | - if($outcome_value <= $outcome_description['value']) { |
|
118 | + if ($outcome_value <= $outcome_description['value']) { |
|
119 | 119 | break; |
120 | 120 | } |
121 | 121 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $found_dark_matter = 0; |
132 | 132 | // $outcome_mission_sub = -1; |
133 | 133 | |
134 | - switch($mission_outcome) { |
|
134 | + switch ($mission_outcome) { |
|
135 | 135 | // switch(FLT_EXPEDITION_OUTCOME_LOST_FLEET) { // TODO DEBUG! |
136 | 136 | case FLT_EXPEDITION_OUTCOME_LOST_FLEET: |
137 | 137 | flt_mission_explore_outcome_lost_fleet($result); |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | |
167 | 167 | // Рассчитываем стоимость самого дорого корабля в металле |
168 | 168 | $max_metal_cost = 0; |
169 | - foreach($fleet as $ship_id => $ship_amount) { |
|
169 | + foreach ($fleet as $ship_id => $ship_amount) { |
|
170 | 170 | $max_metal_cost = max($max_metal_cost, $ship_data[$ship_id]['metal_cost']); |
171 | 171 | } |
172 | 172 | |
173 | 173 | // Ограничиваем корабли только теми, чья стоимость в металле меньше или равно стоимости самого дорогого корабля |
174 | 174 | $can_be_found = array(); |
175 | - foreach($ship_data as $ship_id => $ship_info) { |
|
176 | - if($ship_info['metal_cost'] < $max_metal_cost) { |
|
175 | + foreach ($ship_data as $ship_id => $ship_info) { |
|
176 | + if ($ship_info['metal_cost'] < $max_metal_cost) { |
|
177 | 177 | $can_be_found[$ship_id] = $ship_info['metal_cost']; |
178 | 178 | } |
179 | 179 | } |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | unset($can_be_found[SHIP_SPY]); |
183 | 183 | |
184 | 184 | $fleet_found = array(); |
185 | - while(count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
185 | + while (count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
186 | 186 | $found_index = mt_rand(1, count($can_be_found)) - 1; |
187 | 187 | $found_ship = array_slice($can_be_found, $found_index, 1, true); |
188 | 188 | $found_ship_cost = reset($found_ship); |
189 | 189 | $found_ship_id = key($found_ship); |
190 | 190 | |
191 | - if($found_ship_cost > $found_in_metal) { |
|
191 | + if ($found_ship_cost > $found_in_metal) { |
|
192 | 192 | unset($can_be_found[$found_ship_id]); |
193 | 193 | } else { |
194 | 194 | $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost)); |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if(empty($fleet_found)) { |
|
200 | + if (empty($fleet_found)) { |
|
201 | 201 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
202 | 202 | } else { |
203 | - foreach($fleet_found as $unit_id => $unit_amount) { |
|
203 | + foreach ($fleet_found as $unit_id => $unit_amount) { |
|
204 | 204 | $fleet[$unit_id] += $unit_amount; |
205 | 205 | } |
206 | 206 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $fleet_row['fleet_resource_crystal'] += $resources_found[RES_CRYSTAL]; |
227 | 227 | $fleet_row['fleet_resource_deuterium'] += $resources_found[RES_DEUTERIUM]; |
228 | 228 | |
229 | - if(array_sum($resources_found) == 0) { |
|
229 | + if (array_sum($resources_found) == 0) { |
|
230 | 230 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
231 | 231 | } |
232 | 232 | break; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | // Рассчитываем количество найденной ТМ |
238 | 238 | $found_dark_matter = floor(min($outcome_percent * $fleet_metal_points / $rates[RES_DARK_MATTER], 10000) * mt_rand(750000, 1000000) / 1000000); |
239 | 239 | |
240 | - if(!$found_dark_matter) { |
|
240 | + if (!$found_dark_matter) { |
|
241 | 241 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
242 | 242 | } |
243 | 243 | break; |
@@ -251,31 +251,31 @@ discard block |
||
251 | 251 | |
252 | 252 | flt_mission_explore_addon($result); |
253 | 253 | |
254 | - if($found_dark_matter) { |
|
254 | + if ($found_dark_matter) { |
|
255 | 255 | rpg_points_change($fleet_row['fleet_owner'], RPG_EXPEDITION, $found_dark_matter, 'Expedition Bonus'); |
256 | 256 | $msg_text_addon = sprintf($lang['flt_mission_expedition']['found_dark_matter'], $found_dark_matter); |
257 | 257 | } |
258 | 258 | |
259 | - if(!empty($fleet_lost)) { |
|
259 | + if (!empty($fleet_lost)) { |
|
260 | 260 | $msg_text_addon = $lang['flt_mission_expedition']['lost_fleet']; |
261 | - foreach($fleet_lost as $ship_id => $ship_amount) { |
|
261 | + foreach ($fleet_lost as $ship_id => $ship_amount) { |
|
262 | 262 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | 266 | $fleet_row['fleet_amount'] = array_sum($fleet); |
267 | - if(!empty($fleet) && $fleet_row['fleet_amount']) { |
|
268 | - if(!empty($fleet_found)) { |
|
267 | + if (!empty($fleet) && $fleet_row['fleet_amount']) { |
|
268 | + if (!empty($fleet_found)) { |
|
269 | 269 | $msg_text_addon = $lang['flt_mission_expedition']['found_fleet']; |
270 | - foreach($fleet_found as $ship_id => $ship_amount) { |
|
270 | + foreach ($fleet_found as $ship_id => $ship_amount) { |
|
271 | 271 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
275 | 275 | $query_delta = array(); |
276 | - if(!empty($resources_found) && array_sum($resources_found) > 0) { |
|
276 | + if (!empty($resources_found) && array_sum($resources_found) > 0) { |
|
277 | 277 | $msg_text_addon = $lang['flt_mission_expedition']['found_resources']; |
278 | - foreach($resources_found as $ship_id => $ship_amount) { |
|
278 | + foreach ($resources_found as $ship_id => $ship_amount) { |
|
279 | 279 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
280 | 280 | } |
281 | 281 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | $query_data = array(); |
291 | - if(!empty($fleet_lost) || !empty($fleet_found)) { |
|
291 | + if (!empty($fleet_lost) || !empty($fleet_found)) { |
|
292 | 292 | $fleet_row['fleet_array'] = sys_unit_arr2str($fleet); |
293 | 293 | |
294 | 294 | // $query_data[] = "`fleet_amount` = {$fleet_row['fleet_amount']}"; |
@@ -316,17 +316,16 @@ discard block |
||
316 | 316 | |
317 | 317 | db_user_set_by_id($fleet_row['fleet_owner'], "`player_rpg_explore_xp` = `player_rpg_explore_xp` + 1"); |
318 | 318 | |
319 | - if(!$msg_text) { |
|
319 | + if (!$msg_text) { |
|
320 | 320 | $messages = &$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['messages']; |
321 | - if($outcome_mission_sub >= 0 && is_array($messages)) { |
|
321 | + if ($outcome_mission_sub >= 0 && is_array($messages)) { |
|
322 | 322 | $messages = &$messages[$outcome_mission_sub]; |
323 | 323 | } |
324 | 324 | |
325 | - $msg_text = is_string($messages) ? $messages : |
|
326 | - (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
325 | + $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
327 | 326 | } |
328 | 327 | $msg_text = sprintf($msg_text, $fleet_row['fleet_id'], uni_render_coordinates($fleet_row, 'fleet_end_')) . |
329 | - ($msg_text_addon ? "\r\n" . $msg_text_addon: ''); |
|
328 | + ($msg_text_addon ? "\r\n" . $msg_text_addon : ''); |
|
330 | 329 | |
331 | 330 | msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_end_stay'], MSG_TYPE_EXPLORE, $msg_sender, $msg_title, $msg_text); |
332 | 331 |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | protected function initValues() { |
51 | - $this[UNIT_SERVER_SPEED_BUILDING] = function (ValueStorage $vs) { |
|
51 | + $this[UNIT_SERVER_SPEED_BUILDING] = function(ValueStorage $vs) { |
|
52 | 52 | return new ValueBonused(UNIT_SERVER_SPEED_BUILDING, floatval($vs->getGlobalContainer()->config->game_speed)); |
53 | 53 | }; |
54 | - $this[UNIT_SERVER_SPEED_MINING] = function (ValueStorage $vs) { |
|
54 | + $this[UNIT_SERVER_SPEED_MINING] = function(ValueStorage $vs) { |
|
55 | 55 | return new ValueBonused(UNIT_SERVER_SPEED_MINING, floatval($vs->getGlobalContainer()->config->resource_multiplier)); |
56 | 56 | }; |
57 | - $this[UNIT_SERVER_SPEED_FLEET] = function (ValueStorage $vs) { |
|
57 | + $this[UNIT_SERVER_SPEED_FLEET] = function(ValueStorage $vs) { |
|
58 | 58 | return new ValueBonused(UNIT_SERVER_SPEED_FLEET, floatval($vs->getGlobalContainer()->config->fleet_speed)); |
59 | 59 | }; |
60 | - $this[UNIT_SERVER_SPEED_EXPEDITION] = function (ValueStorage $vs) { |
|
60 | + $this[UNIT_SERVER_SPEED_EXPEDITION] = function(ValueStorage $vs) { |
|
61 | 61 | return new ValueBonused(UNIT_SERVER_SPEED_EXPEDITION, floatval(1)); |
62 | 62 | }; |
63 | 63 | |
64 | - $this[UNIT_SERVER_FLEET_NOOB_POINTS] = function (ValueStorage $vs) { |
|
64 | + $this[UNIT_SERVER_FLEET_NOOB_POINTS] = function(ValueStorage $vs) { |
|
65 | 65 | $config = $vs->getGlobalContainer()->config; |
66 | 66 | |
67 | 67 | return new ValueBonused( |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | floatval($config->game_noob_points * $vs->getBase(UNIT_SERVER_SPEED_MINING)) |
70 | 70 | ); |
71 | 71 | }; |
72 | - $this[UNIT_SERVER_FLEET_NOOB_FACTOR] = function (ValueStorage $vs) { |
|
72 | + $this[UNIT_SERVER_FLEET_NOOB_FACTOR] = function(ValueStorage $vs) { |
|
73 | 73 | return new ValueBonused(UNIT_SERVER_FLEET_NOOB_FACTOR, floatval($vs->getGlobalContainer()->config->game_noob_factor)); |
74 | 74 | }; |
75 | 75 | |
76 | - $this[UNIT_SERVER_PAYMENT_MM_PER_CURRENCY] = function (ValueStorage $vs) { |
|
76 | + $this[UNIT_SERVER_PAYMENT_MM_PER_CURRENCY] = function(ValueStorage $vs) { |
|
77 | 77 | return new ValueBonused(UNIT_SERVER_PAYMENT_MM_PER_CURRENCY, floatval($vs->getGlobalContainer()->config->payment_currency_exchange_mm_)); |
78 | 78 | }; |
79 | 79 | } |
@@ -105,7 +105,7 @@ |
||
105 | 105 | * @return int |
106 | 106 | */ |
107 | 107 | public function getMaxLevel() { |
108 | - $snId = $this->getSnId(); |
|
108 | + $snId = $this->getSnId(); |
|
109 | 109 | return !empty($snId) ? get_unit_param($snId, P_MAX_STACK) : 0; |
110 | 110 | } |
111 | 111 |
@@ -136,7 +136,7 @@ |
||
136 | 136 | $dbq->setWhereArray(static::translateNames($propertyFilter, static::PROPERTIES_TO_FIELDS)); |
137 | 137 | } |
138 | 138 | |
139 | - if(static::$_forUpdate == DbQuery::DB_FOR_UPDATE) { |
|
139 | + if (static::$_forUpdate == DbQuery::DB_FOR_UPDATE) { |
|
140 | 140 | $dbq->setForUpdate(); |
141 | 141 | static::$_forUpdate = DbQuery::DB_SHARED; |
142 | 142 | } |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | ]); |
51 | 51 | }; |
52 | 52 | |
53 | -$ValidList['percent'] = array ( 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ); |
|
53 | +$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100); |
|
54 | 54 | $template = gettemplate('resources', true); |
55 | 55 | |
56 | 56 | $planet = new \Planet\Planet($planetrow['id']); |
57 | -if(!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
57 | +if (!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
58 | 58 | $template->assign_block_vars('result', $transmutation_result); |
59 | 59 | $planet = new \Planet\Planet($planetrow['id']); |
60 | 60 | } |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | $production = $_POST['production']; |
64 | 64 | //$SubQry = ''; |
65 | 65 | $SubQry = array(); |
66 | -if(is_array($production)) { |
|
67 | - foreach($production as $prod_id => $percent) { |
|
68 | - if($percent > 100 || $percent < 0) { |
|
66 | +if (is_array($production)) { |
|
67 | + foreach ($production as $prod_id => $percent) { |
|
68 | + if ($percent > 100 || $percent < 0) { |
|
69 | 69 | $debug->warning('Supplying wrong production percent (less then 0 or greater then 100)', 'Hack attempt', 302, array('base_dump' => true)); |
70 | 70 | die(); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $prod_id = intval($prod_id); |
74 | - if(in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
74 | + if (in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
75 | 75 | $field_name = pname_factory_production_field_name($prod_id); |
76 | 76 | $percent = floor($percent / 10); |
77 | 77 | $planetrow[$field_name] = $percent; |
78 | 78 | //$SubQry .= "`{$field_name}` = '{$percent}',"; |
79 | - $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
79 | + $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
80 | 80 | } else { |
81 | 81 | $debug->warning('Supplying wrong ID in production array - attempt to change some field - ID' . $prod_id, 'Resource Page', 301); |
82 | 82 | continue; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | 'ENERGY_TYPE' => $capsObj->productionCurrentMatrix[RES_ENERGY][0], |
114 | 114 | )); |
115 | 115 | |
116 | -foreach($sn_group_factories as $unit_id) |
|
116 | +foreach ($sn_group_factories as $unit_id) |
|
117 | 117 | { |
118 | - if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
118 | + if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
119 | 119 | { |
120 | 120 | $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true); |
121 | 121 | $template->assign_block_vars('production', array( |
@@ -165,8 +165,7 @@ discard block |
||
165 | 165 | $planet_info[PLANET_SYSTEM], |
166 | 166 | $planet_info[PLANET_PLANET], |
167 | 167 | htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'), |
168 | - $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : |
|
169 | - ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
168 | + $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
170 | 169 | ); |
171 | 170 | |
172 | 171 | $text_defender = ''; |
@@ -251,7 +250,7 @@ discard block |
||
251 | 250 | // Просматриваем результаты изменения флотов |
252 | 251 | foreach ($fleet_info[UBE_COUNT] as $unit_id => $unit_count) { |
253 | 252 | // Перебираем аутком на случай восстановления юнитов |
254 | - $units_lost = (float)$fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id]; |
|
253 | + $units_lost = (float) $fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id]; |
|
255 | 254 | |
256 | 255 | $units_left = $unit_count - $units_lost; |
257 | 256 | if ($fleet_id) { |
@@ -275,7 +274,7 @@ discard block |
||
275 | 274 | // Если во флоте остались юниты или это планета - генерируем изменение ресурсов |
276 | 275 | if ($new_fleet_count || !$fleet_id) { |
277 | 276 | foreach (sn_get_groups('resources_loot') as $resource_id) { |
278 | - $resource_change = (float)$fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float)$fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id]; |
|
277 | + $resource_change = (float) $fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float) $fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id]; |
|
279 | 278 | if ($resource_change) { |
280 | 279 | $resource_db_name = ($fleet_id ? 'fleet_resource_' : '') . pname_resource_name($resource_id); |
281 | 280 | $fleet_delta[$resource_db_name] = -($resource_change); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | { |
5 | 5 | global $lang; |
6 | 6 | |
7 | - if(!in_array($unit_id, sn_get_groups('artifacts'))) |
|
7 | + if (!in_array($unit_id, sn_get_groups('artifacts'))) |
|
8 | 8 | { |
9 | 9 | return; |
10 | 10 | } |
@@ -13,17 +13,17 @@ discard block |
||
13 | 13 | $user = db_user_by_id($user['id'], true); |
14 | 14 | |
15 | 15 | $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true); |
16 | - if($unit_level > 0) |
|
16 | + if ($unit_level > 0) |
|
17 | 17 | { |
18 | 18 | $db_changeset = array(); |
19 | - switch($unit_id) |
|
19 | + switch ($unit_id) |
|
20 | 20 | { |
21 | 21 | case ART_LHC: |
22 | 22 | case ART_HOOK_SMALL: |
23 | 23 | case ART_HOOK_MEDIUM: |
24 | 24 | case ART_HOOK_LARGE: |
25 | 25 | $has_moon = DBStaticPlanet::db_planet_by_parent($planetrow['id'], true, '`id`'); |
26 | - if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) |
|
26 | + if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) |
|
27 | 27 | { |
28 | 28 | $unit_level--; |
29 | 29 | $updateDebris = false; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | break; |
45 | 45 | } |
46 | 46 | |
47 | - if($moonSize) |
|
47 | + if ($moonSize) |
|
48 | 48 | { |
49 | 49 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moonSize, $updateDebris); |
50 | 50 | $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moonSize)); |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | case ART_RCD_MEDIUM: |
66 | 66 | case ART_RCD_LARGE: |
67 | 67 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
68 | - if($planetrow['planet_type'] != PT_PLANET) |
|
68 | + if ($planetrow['planet_type'] != PT_PLANET) |
|
69 | 69 | { |
70 | 70 | $message = $lang['art_rcd_err_moon']; |
71 | 71 | break; |
72 | 72 | } |
73 | 73 | |
74 | 74 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false); |
75 | - if(!empty($que['items'])) |
|
75 | + if (!empty($que['items'])) |
|
76 | 76 | { |
77 | 77 | $message = $lang['art_rcd_err_que']; |
78 | 78 | break; |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | $artifact_deploy = get_unit_param($unit_id, P_DEPLOY); |
82 | 82 | |
83 | 83 | $sectors_used = 0; |
84 | - foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
84 | + foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
85 | 85 | { |
86 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
86 | + if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
87 | 87 | continue; |
88 | 88 | $sectors_used += $levels_deployed; |
89 | 89 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); |
90 | 90 | } |
91 | 91 | |
92 | - if($sectors_used == 0) |
|
92 | + if ($sectors_used == 0) |
|
93 | 93 | { |
94 | 94 | $message = $lang['art_rcd_err_no_sense']; |
95 | 95 | break; |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | $que_item = null; |
105 | 105 | $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true); |
106 | 106 | $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0]; |
107 | - if(!empty($current_que)) |
|
107 | + if (!empty($current_que)) |
|
108 | 108 | { |
109 | 109 | reset($current_que); |
110 | 110 | $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)]; |
111 | 111 | } |
112 | 112 | |
113 | - if(!empty($que_item) && $que_item['que_time_left'] > 60) |
|
113 | + if (!empty($que_item) && $que_item['que_time_left'] > 60) |
|
114 | 114 | { |
115 | 115 | $unit_level--; |
116 | 116 | $old_time = $que_item['que_time_left']; |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true); |
132 | 132 | $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']]; |
133 | 133 | // $que_item = &$que['que'][QUE_STRUCTURES][0]; |
134 | - if(!empty($current_que)) |
|
134 | + if (!empty($current_que)) |
|
135 | 135 | { |
136 | 136 | reset($current_que); |
137 | 137 | $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)]; |
138 | 138 | } |
139 | 139 | |
140 | - if(isset($que_item) && $que_item['que_time_left'] > 60) |
|
140 | + if (isset($que_item) && $que_item['que_time_left'] > 60) |
|
141 | 141 | { |
142 | 142 | $unit_level--; |
143 | 143 | $old_time = $que_item['que_time_left']; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | break; |
156 | 156 | |
157 | 157 | } |
158 | - if($unit_level != $artifact_level_old) |
|
158 | + if ($unit_level != $artifact_level_old) |
|
159 | 159 | { |
160 | 160 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user); |
161 | 161 | OldDbChangeSet::db_changeset_apply($db_changeset); |
@@ -72,7 +72,7 @@ |
||
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; |