@@ -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( |
|
175 | + foreach ($ship_data as $ship_id => $ship_info) { |
|
176 | + if ( |
|
177 | 177 | $ship_info['metal_cost'] < $max_metal_cost |
178 | 178 | // and not race ship |
179 | 179 | && empty(get_unit_param($ship_id, 'player_race')) |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | unset($can_be_found[SHIP_SPY]); |
189 | 189 | |
190 | 190 | $fleet_found = array(); |
191 | - while(count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
191 | + while (count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
192 | 192 | $found_index = mt_rand(1, count($can_be_found)) - 1; |
193 | 193 | $found_ship = array_slice($can_be_found, $found_index, 1, true); |
194 | 194 | $found_ship_cost = reset($found_ship); |
195 | 195 | $found_ship_id = key($found_ship); |
196 | 196 | |
197 | - if($found_ship_cost > $found_in_metal) { |
|
197 | + if ($found_ship_cost > $found_in_metal) { |
|
198 | 198 | unset($can_be_found[$found_ship_id]); |
199 | 199 | } else { |
200 | 200 | $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost)); |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
206 | - if(empty($fleet_found)) { |
|
206 | + if (empty($fleet_found)) { |
|
207 | 207 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
208 | 208 | } else { |
209 | - foreach($fleet_found as $unit_id => $unit_amount) { |
|
209 | + foreach ($fleet_found as $unit_id => $unit_amount) { |
|
210 | 210 | $fleet[$unit_id] += $unit_amount; |
211 | 211 | } |
212 | 212 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $fleet_row['fleet_resource_crystal'] += $resources_found[RES_CRYSTAL]; |
233 | 233 | $fleet_row['fleet_resource_deuterium'] += $resources_found[RES_DEUTERIUM]; |
234 | 234 | |
235 | - if(array_sum($resources_found) == 0) { |
|
235 | + if (array_sum($resources_found) == 0) { |
|
236 | 236 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
237 | 237 | } |
238 | 238 | break; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | // Рассчитываем количество найденной ТМ |
244 | 244 | $found_dark_matter = floor(min($outcome_percent * $fleet_metal_points / $rates[RES_DARK_MATTER], 10000) * mt_rand(750000, 1000000) / 1000000); |
245 | 245 | |
246 | - if(!$found_dark_matter) { |
|
246 | + if (!$found_dark_matter) { |
|
247 | 247 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
248 | 248 | } |
249 | 249 | break; |
@@ -257,31 +257,31 @@ discard block |
||
257 | 257 | |
258 | 258 | flt_mission_explore_addon($result); |
259 | 259 | |
260 | - if($found_dark_matter) { |
|
260 | + if ($found_dark_matter) { |
|
261 | 261 | rpg_points_change($fleet_row['fleet_owner'], RPG_EXPEDITION, $found_dark_matter, 'Expedition Bonus'); |
262 | 262 | $msg_text_addon = sprintf($lang['flt_mission_expedition']['found_dark_matter'], $found_dark_matter); |
263 | 263 | } |
264 | 264 | |
265 | - if(!empty($fleet_lost)) { |
|
265 | + if (!empty($fleet_lost)) { |
|
266 | 266 | $msg_text_addon = $lang['flt_mission_expedition']['lost_fleet']; |
267 | - foreach($fleet_lost as $ship_id => $ship_amount) { |
|
267 | + foreach ($fleet_lost as $ship_id => $ship_amount) { |
|
268 | 268 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
272 | 272 | $fleet_row['fleet_amount'] = array_sum($fleet); |
273 | - if(!empty($fleet) && $fleet_row['fleet_amount']) { |
|
274 | - if(!empty($fleet_found)) { |
|
273 | + if (!empty($fleet) && $fleet_row['fleet_amount']) { |
|
274 | + if (!empty($fleet_found)) { |
|
275 | 275 | $msg_text_addon = $lang['flt_mission_expedition']['found_fleet']; |
276 | - foreach($fleet_found as $ship_id => $ship_amount) { |
|
276 | + foreach ($fleet_found as $ship_id => $ship_amount) { |
|
277 | 277 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
281 | 281 | $query_delta = array(); |
282 | - if(!empty($resources_found) && array_sum($resources_found) > 0) { |
|
282 | + if (!empty($resources_found) && array_sum($resources_found) > 0) { |
|
283 | 283 | $msg_text_addon = $lang['flt_mission_expedition']['found_resources']; |
284 | - foreach($resources_found as $ship_id => $ship_amount) { |
|
284 | + foreach ($resources_found as $ship_id => $ship_amount) { |
|
285 | 285 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
286 | 286 | } |
287 | 287 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | |
296 | 296 | $query_data = array(); |
297 | - if(!empty($fleet_lost) || !empty($fleet_found)) { |
|
297 | + if (!empty($fleet_lost) || !empty($fleet_found)) { |
|
298 | 298 | $fleet_row['fleet_array'] = sys_unit_arr2str($fleet); |
299 | 299 | |
300 | 300 | // $query_data[] = "`fleet_amount` = {$fleet_row['fleet_amount']}"; |
@@ -322,17 +322,16 @@ discard block |
||
322 | 322 | |
323 | 323 | db_user_set_by_id($fleet_row['fleet_owner'], "`player_rpg_explore_xp` = `player_rpg_explore_xp` + 1"); |
324 | 324 | |
325 | - if(!$msg_text) { |
|
325 | + if (!$msg_text) { |
|
326 | 326 | $messages = &$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['messages']; |
327 | - if($outcome_mission_sub >= 0 && is_array($messages)) { |
|
327 | + if ($outcome_mission_sub >= 0 && is_array($messages)) { |
|
328 | 328 | $messages = &$messages[$outcome_mission_sub]; |
329 | 329 | } |
330 | 330 | |
331 | - $msg_text = is_string($messages) ? $messages : |
|
332 | - (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
331 | + $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
333 | 332 | } |
334 | 333 | $msg_text = sprintf($msg_text, $fleet_row['fleet_id'], uni_render_coordinates($fleet_row, 'fleet_end_')) . |
335 | - ($msg_text_addon ? "\r\n" . $msg_text_addon: ''); |
|
334 | + ($msg_text_addon ? "\r\n" . $msg_text_addon : ''); |
|
336 | 335 | |
337 | 336 | msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_end_stay'], MSG_TYPE_EXPLORE, $msg_sender, $msg_title, $msg_text); |
338 | 337 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | //while($CurrentFleet = db_fetch($FlyingFleets)) |
24 | 24 | |
25 | 25 | $all_flying_fleets = DbFleetStatic::db_fleet_list('', DB_SELECT_PLAIN); |
26 | -foreach($all_flying_fleets as $fleet_id => $CurrentFleet) { |
|
26 | +foreach ($all_flying_fleets as $fleet_id => $CurrentFleet) { |
|
27 | 27 | $FleetOwner = db_user_by_id($CurrentFleet['fleet_owner']); |
28 | 28 | $TargetOwner = db_user_by_id($CurrentFleet['fleet_target_owner']); |
29 | 29 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $fleet_data['fleet']['STAY_TIME_INT'] = $CurrentFleet['fleet_end_stay']; |
35 | 35 | |
36 | 36 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
37 | - foreach($fleet_data['ships'] as $ship_data) { |
|
37 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
38 | 38 | $template->assign_block_vars('fleets.ships', $ship_data); |
39 | 39 | } |
40 | 40 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | function flt_mission_destroy($mission_data) { |
11 | 11 | $fleet_row = $mission_data['fleet']; |
12 | 12 | $destination_planet = $mission_data['dst_planet']; |
13 | - if(!$destination_planet || !is_array($destination_planet) || $destination_planet['planet_type'] != PT_MOON) { |
|
13 | + if (!$destination_planet || !is_array($destination_planet) || $destination_planet['planet_type'] != PT_MOON) { |
|
14 | 14 | DbFleetStatic::fleet_send_back($fleet_row); |
15 | 15 | |
16 | 16 | return CACHE_FLEET; |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | function flt_mission_hold(&$mission_data) |
6 | 6 | { |
7 | - if($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
|
7 | + if ($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
|
8 | 8 | { |
9 | 9 | DbFleetStatic::fleet_send_back($mission_data['fleet']); |
10 | 10 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"); |
@@ -2,8 +2,7 @@ |
||
2 | 2 | |
3 | 3 | use Fleet\DbFleetStatic; |
4 | 4 | |
5 | -function flt_mission_hold(&$mission_data) |
|
6 | -{ |
|
5 | +function flt_mission_hold(&$mission_data) { |
|
7 | 6 | if($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
8 | 7 | { |
9 | 8 | DbFleetStatic::fleet_send_back($mission_data['fleet']); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @inheritdoc |
90 | 90 | */ |
91 | 91 | public function update() { |
92 | - if($this->getShipCount() < 1) { |
|
92 | + if ($this->getShipCount() < 1) { |
|
93 | 93 | return $this->delete(); |
94 | 94 | } else { |
95 | 95 | return parent::update(); |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | |
154 | 154 | $shipCount = floor($shipCount); |
155 | 155 | |
156 | - if($this->shipList[$shipSnId] + $shipCount < 0) { |
|
156 | + if ($this->shipList[$shipSnId] + $shipCount < 0) { |
|
157 | 157 | throw new \Exception("Trying to deduct more ships [{$shipSnId}] '{$shipCount}' when fleet [{$this->id}] has only {$this->shipList[$shipSnId]}"); |
158 | 158 | } |
159 | 159 | |
160 | 160 | $this->shipList[$shipSnId] += $shipCount; |
161 | - if($this->shipList[$shipSnId] < 1) { |
|
161 | + if ($this->shipList[$shipSnId] < 1) { |
|
162 | 162 | unset($this->shipList[$shipSnId]); |
163 | 163 | } |
164 | 164 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $resourceCount = ceil($resourceCount); |
185 | 185 | |
186 | - if($this->resources[$resourceId] + $resourceCount < 0) { |
|
186 | + if ($this->resources[$resourceId] + $resourceCount < 0) { |
|
187 | 187 | throw new \Exception("FLEET ERROR! Trying to deduct more resources [{$resourceId}] '{$resourceCount}' when fleet [{$this->id}] has only {$this->resources[$resourceId]}"); |
188 | 188 | } |
189 | 189 |
@@ -379,7 +379,7 @@ |
||
379 | 379 | public function dbLoadRecord($id) { |
380 | 380 | $result = parent::dbLoadRecord($id); |
381 | 381 | |
382 | - if(!$this->isNew()) { |
|
382 | + if (!$this->isNew()) { |
|
383 | 383 | $this->resources[RES_METAL] = $this->_getContainer()->metal; |
384 | 384 | $this->resources[RES_CRYSTAL] = $this->_getContainer()->crystal; |
385 | 385 | $this->resources[RES_DEUTERIUM] = $this->_getContainer()->deuterium; |
@@ -426,8 +426,8 @@ |
||
426 | 426 | protected function getTravelData() { |
427 | 427 | $travel_data = flt_travel_data( |
428 | 428 | $this->getFleetOwnerRecord(), |
429 | - ['galaxy' => $this->fleet_start_galaxy, 'system' => $this->fleet_start_system, 'planet' => $this->fleet_start_planet,], |
|
430 | - ['galaxy' => $this->fleet_end_galaxy, 'system' => $this->fleet_end_system, 'planet' => $this->fleet_end_planet,], |
|
429 | + ['galaxy' => $this->fleet_start_galaxy, 'system' => $this->fleet_start_system, 'planet' => $this->fleet_start_planet, ], |
|
430 | + ['galaxy' => $this->fleet_end_galaxy, 'system' => $this->fleet_end_system, 'planet' => $this->fleet_end_planet, ], |
|
431 | 431 | $this->getShipListArray(), |
432 | 432 | $this->speedPercentTenth |
433 | 433 | ); |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
171 | 171 | |
172 | 172 | // Alliance bonus calculations |
173 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
173 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
174 | 174 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
175 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
175 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
176 | 176 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
177 | 177 | 'ali_bonus_members' => 10, // Minimum alliance size to start using bonus |
178 | 178 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | 'eco_scale_storage' => 1, |
216 | 216 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
217 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
217 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
218 | 218 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
219 | 219 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
220 | 220 | |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | 'energy_basic_income' => 0, |
226 | 226 | |
227 | 227 | // Bashing protection settings |
228 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
229 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
230 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
231 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
232 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
228 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
229 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
230 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
231 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
232 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
233 | 233 | |
234 | 234 | 'Fleet_Cdr' => 30, |
235 | 235 | 'fleet_speed' => 1, |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | 'fleet_update_interval' => 4, |
238 | 238 | 'fleet_update_lock' => '', // SQL time when lock was acquired |
239 | 239 | |
240 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
241 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
240 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
241 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
242 | 242 | // Defaults |
243 | 243 | 'game_default_language' => 'ru', |
244 | 244 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | 'game_maxSystem' => 199, |
253 | 253 | 'game_maxPlanet' => 15, |
254 | 254 | // Game global settings |
255 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
255 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
256 | 256 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
257 | 257 | |
258 | 258 | 'game_news_actual' => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days |
259 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
260 | - 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
259 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
260 | + 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
261 | 261 | // Noob protection |
262 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
262 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
263 | 263 | 'game_noob_points' => 5000, // Below this point user threated as noob. 0 to disable |
264 | 264 | |
265 | 265 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | 'payment_currency_exchange_wmu' => 30, |
314 | 314 | 'payment_currency_exchange_wmz' => 1, |
315 | 315 | |
316 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
317 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
316 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
317 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
318 | 318 | |
319 | 319 | 'planet_capital_cost' => 25000, // Cost in DM to move Capital to current planet |
320 | - 'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
|
321 | - 'planet_capital_building_rate' => 2.0, // Capital Building rates |
|
320 | + 'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
|
321 | + 'planet_capital_building_rate' => 2.0, // Capital Building rates |
|
322 | 322 | 'planet_teleport_cost' => 50000, // Cost of planet teleportation |
323 | 323 | 'planet_teleport_timeout' => 86400, // Timeout for next teleportation |
324 | 324 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | 'resource_multiplier' => 1, |
341 | 341 | |
342 | 342 | //Roleplay system |
343 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
343 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
344 | 344 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
345 | 345 | |
346 | 346 | // Black Market - General |
@@ -405,12 +405,12 @@ discard block |
||
405 | 405 | 'url_purchase_metamatter' => '', |
406 | 406 | 'url_rules' => '', |
407 | 407 | |
408 | - 'users_amount' => 1, // Total users count |
|
408 | + 'users_amount' => 1, // Total users count |
|
409 | 409 | 'game_users_online_timeout' => PERIOD_MINUTE_15, // Seconds, How long user should considered ONLINE for online counter |
410 | - 'game_users_update_online' => 30, // How often user online should be refreshed (seconds) |
|
411 | - 'var_online_user_time' => 0, // When last time user online was refreshed |
|
412 | - 'var_online_user_count' => 0, // Last calculated online user count |
|
413 | - 'server_log_online' => 0, // Log online user count |
|
410 | + 'game_users_update_online' => 30, // How often user online should be refreshed (seconds) |
|
411 | + 'var_online_user_time' => 0, // When last time user online was refreshed |
|
412 | + 'var_online_user_count' => 0, // Last calculated online user count |
|
413 | + 'server_log_online' => 0, // Log online user count |
|
414 | 414 | |
415 | 415 | 'user_birthday_celebrate' => 0, // When last time celebrations (i.e. giftgiving) was made |
416 | 416 | 'user_birthday_gift' => 0, // User birthday gift |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use Player\playerTimeDiff; |
5 | 5 | |
6 | 6 | // Защита от двойного инита |
7 | -if(defined('INIT')) { |
|
7 | +if (defined('INIT')) { |
|
8 | 8 | return; |
9 | 9 | } |
10 | 10 | |
@@ -124,48 +124,48 @@ discard block |
||
124 | 124 | // Но нужно, пока у нас есть не MVC-страницы |
125 | 125 | $sn_page_data = $sn_mvc['pages'][$sn_page_name]; |
126 | 126 | $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
127 | -if($sn_page_name) { |
|
127 | +if ($sn_page_name) { |
|
128 | 128 | // Merging page options to global option pull |
129 | - if(is_array($sn_page_data['options'])) { |
|
129 | + if (is_array($sn_page_data['options'])) { |
|
130 | 130 | SN::$options = array_merge(SN::$options, $sn_page_data['options']); |
131 | 131 | } |
132 | 132 | |
133 | - if(isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
133 | + if (isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
134 | 134 | require_once($sn_page_name_file); |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | -if((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
138 | +if ((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
139 | 139 | SN::$options[PAGE_OPTION_FLEET_UPDATE_SKIP] = true; |
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | 143 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
144 | 144 | // TODO - костыль, что бы работали старые модули. Убрать! |
145 | -if(is_array($sn_data['pages'])) { |
|
145 | +if (is_array($sn_data['pages'])) { |
|
146 | 146 | $sn_mvc['pages'] = array_merge($sn_mvc['pages'], $sn_data['pages']); |
147 | 147 | } |
148 | -if(!isset($sn_mvc['pages'][$sn_page_name])) { |
|
148 | +if (!isset($sn_mvc['pages'][$sn_page_name])) { |
|
149 | 149 | $sn_page_name = ''; |
150 | 150 | } |
151 | 151 | |
152 | 152 | $lang->lng_switch(sys_get_param_str('lang')); |
153 | 153 | |
154 | 154 | |
155 | -if(SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
155 | +if (SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
156 | 156 | \Common\Tools\VersionCheckerDeprecated::performCheckVersion(); |
157 | 157 | } |
158 | 158 | |
159 | -if(SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
159 | +if (SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
160 | 160 | require_once(SN_ROOT_PHYSICAL . 'includes/includes/user_birthday_celebrate.php'); |
161 | 161 | sn_user_birthday_celebrate(); |
162 | 162 | } |
163 | 163 | |
164 | -if(!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) { |
|
164 | +if (!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) { |
|
165 | 165 | dbUpdateUsersCount(db_user_count()); |
166 | 166 | dbUpdateUsersOnline(db_user_count(true)); |
167 | 167 | SN::$config->pass()->var_online_user_time = SN_TIME_NOW; |
168 | - if(SN::$config->server_log_online) { |
|
168 | + if (SN::$config->server_log_online) { |
|
169 | 169 | doquery("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = " . SN::$config->var_online_user_count . ";"); |
170 | 170 | } |
171 | 171 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
190 | 190 | |
191 | -if(!empty($user['id'])) { |
|
191 | +if (!empty($user['id'])) { |
|
192 | 192 | SN::$user_options->user_change($user['id']); |
193 | 193 | } |
194 | 194 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | : false |
202 | 202 | ); |
203 | 203 | |
204 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
204 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
205 | 205 | $prohibited_characters = array_map(function($value) { |
206 | 206 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
207 | 207 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | |
212 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
212 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
213 | 213 | pdump('Отключи отладку перед продакшном!'); |
214 | 214 | } |
215 | 215 | |
@@ -223,17 +223,17 @@ discard block |
||
223 | 223 | |
224 | 224 | StatUpdateLauncher::unlock(); |
225 | 225 | |
226 | -if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
226 | +if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
227 | 227 | $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br( |
228 | 228 | SN::$config->game_disable == GAME_DISABLE_REASON |
229 | 229 | ? SN::$config->game_disable_reason |
230 | 230 | : $lang['sys_game_disable_reason'][SN::$config->game_disable] |
231 | 231 | ); |
232 | - if(defined('IN_API')) { |
|
232 | + if (defined('IN_API')) { |
|
233 | 233 | return; |
234 | 234 | } |
235 | 235 | |
236 | - if( |
|
236 | + if ( |
|
237 | 237 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
238 | 238 | && |
239 | 239 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | |
249 | 249 | // TODO ban |
250 | 250 | // TODO $skip_ban_check |
251 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
252 | - if(defined('IN_API')) { |
|
251 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
252 | + if (defined('IN_API')) { |
|
253 | 253 | return; |
254 | 254 | } |
255 | 255 | |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']); |
264 | 264 | |
265 | 265 | |
266 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
266 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
267 | 267 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
268 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
269 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
268 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
269 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
270 | 270 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
271 | 271 | } |
272 | 272 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | 'fleet_update_last', |
290 | 290 | SN::$config->fleet_update_interval, |
291 | 291 | // Promise |
292 | - function () {SN::$gc->fleetDispatcher->dispatch();}, |
|
292 | + function() {SN::$gc->fleetDispatcher->dispatch(); }, |
|
293 | 293 | WATCHDOG_TIME_SQL, |
294 | 294 | false |
295 | 295 | ); |