@@ -24,7 +24,9 @@ |
||
24 | 24 | * DO NOT CHANGE |
25 | 25 | */ |
26 | 26 | |
27 | -if (!defined('INSIDE')) die(); |
|
27 | +if (!defined('INSIDE')) { |
|
28 | + die(); |
|
29 | +} |
|
28 | 30 | |
29 | 31 | $a_lang_array = array( |
30 | 32 | 'built' => 'Построено', |
@@ -26,7 +26,9 @@ |
||
26 | 26 | * DO NOT CHANGE |
27 | 27 | */ |
28 | 28 | |
29 | -if (!defined('INSIDE')) die(); |
|
29 | +if (!defined('INSIDE')) { |
|
30 | + die(); |
|
31 | +} |
|
30 | 32 | |
31 | 33 | |
32 | 34 | $a_lang_array = array( |
@@ -21,8 +21,8 @@ |
||
21 | 21 | $mode = sys_get_param_escaped('mode'); |
22 | 22 | $mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode))); |
23 | 23 | |
24 | -if($building_sort = sys_get_param_id('sort_elements')) { |
|
25 | - if(!empty($lang['player_option_building_sort'][$building_sort])) { |
|
24 | +if ($building_sort = sys_get_param_id('sort_elements')) { |
|
25 | + if (!empty($lang['player_option_building_sort'][$building_sort])) { |
|
26 | 26 | SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort; |
27 | 27 | SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0); |
28 | 28 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | unset($player_options[PLAYER_OPTION_TUTORIAL_CURRENT]); |
402 | 402 | } |
403 | 403 | |
404 | - array_walk($player_options, function (&$value) { |
|
404 | + array_walk($player_options, function(&$value) { |
|
405 | 405 | // TODO - Когда будет больше параметров - сделать больше проверок |
406 | 406 | $value = intval($value); |
407 | 407 | }); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $user['id'], |
451 | 451 | RPG_NAME_CHANGE, |
452 | 452 | -$config->game_user_changename_cost, |
453 | - vsprintf('Пользователь ID %1$d сменил имя с "%2$s" на "%3$s"', [$user['id'], $user['username'], $username,]) |
|
453 | + vsprintf('Пользователь ID %1$d сменил имя с "%2$s" на "%3$s"', [$user['id'], $user['username'], $username, ]) |
|
454 | 454 | ); |
455 | 455 | |
456 | 456 | case SERVER_PLAYER_NAME_CHANGE_FREE: |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
19 | 19 | |
20 | -if(!SN::$gc->modules->countModulesInGroup('payment')) { |
|
20 | +if (!SN::$gc->modules->countModulesInGroup('payment')) { |
|
21 | 21 | sys_redirect(SN_ROOT_VIRTUAL . 'admin/overview.php'); |
22 | 22 | } |
23 | 23 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'START_NAME' => $planetrow['name'], |
28 | 28 | ); |
29 | 29 | |
30 | - if(!empty($TargetPlanet)) { |
|
30 | + if (!empty($TargetPlanet)) { |
|
31 | 31 | $template_route += array( |
32 | 32 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
33 | 33 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | $template->assign_block_vars('fleets', $template_route); |
39 | 39 | |
40 | 40 | $sn_groups_fleet = sn_get_groups('fleet'); |
41 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
42 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
41 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
42 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
43 | 43 | // $ship_base_data = get_ship_data($ship_id, $user); |
44 | 44 | $template->assign_block_vars('fleets.ships', array( |
45 | 45 | 'ID' => $ship_id, |
@@ -57,11 +57,10 @@ discard block |
||
57 | 57 | $fleet_capacity += get_unit_param($Ship, P_CAPACITY) * $Count; |
58 | 58 | } |
59 | 59 | |
60 | - $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : |
|
61 | - (isset($missiontype[MT_HOLD]) ? 12 : 0); |
|
62 | - if($max_duration) { |
|
60 | + $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : (isset($missiontype[MT_HOLD]) ? 12 : 0); |
|
61 | + if ($max_duration) { |
|
63 | 62 | $config_game_speed_expedition = ($target_mission == MT_EXPLORE && $config->game_speed_expedition ? $config->game_speed_expedition : 1); |
64 | - for($i = 1; $i <= $max_duration; $i++) { |
|
63 | + for ($i = 1; $i <= $max_duration; $i++) { |
|
65 | 64 | $template->assign_block_vars('duration', array( |
66 | 65 | 'ID' => $i, |
67 | 66 | 'TIME' => pretty_time(ceil($i * 3600 / $config_game_speed_expedition)), |
@@ -80,7 +79,7 @@ discard block |
||
80 | 79 | // $TableTitle = uni_render_planet_full($planetrow) . ' => ' . uni_render_planet_full($temp); |
81 | 80 | |
82 | 81 | $sn_group_resources = sn_get_groups('resources'); |
83 | - for($i = 0; $i<3; $i++) { |
|
82 | + for ($i = 0; $i < 3; $i++) { |
|
84 | 83 | $amount = $planetrow[$sn_group_resources[$i]] - ($i == 2 ? $consumption : 0); |
85 | 84 | $template->assign_block_vars('resources', array( |
86 | 85 | 'ID' => $i, |
@@ -90,7 +89,7 @@ discard block |
||
90 | 89 | )); |
91 | 90 | } |
92 | 91 | |
93 | - if(is_object($captainModule = moduleCaptain()) && ($captain = $captainModule->unit_captain_get($planetrow['id'])) && $captain['unit_location_type'] == LOC_PLANET) { |
|
92 | + if (is_object($captainModule = moduleCaptain()) && ($captain = $captainModule->unit_captain_get($planetrow['id'])) && $captain['unit_location_type'] == LOC_PLANET) { |
|
94 | 93 | $template->assign_vars(array( |
95 | 94 | 'CAPTAIN_ID' => $captain['unit_id'], |
96 | 95 | 'CAPTAIN_LEVEL' => $captain['captain_level'], |
@@ -112,9 +111,9 @@ discard block |
||
112 | 111 | |
113 | 112 | |
114 | 113 | 'speedallsmin' => sys_get_param_float('speedallsmin'), |
115 | - 'speed' => sys_get_param_int('speed') , |
|
114 | + 'speed' => sys_get_param_int('speed'), |
|
116 | 115 | |
117 | - 'fleet_group' => sys_get_param_id('fleet_group') , |
|
116 | + 'fleet_group' => sys_get_param_id('fleet_group'), |
|
118 | 117 | 'acs_target_mr' => sys_get_param_str('acs_target_mr'), |
119 | 118 | |
120 | 119 | 'MAX_DURATION' => $max_duration, |
@@ -8,8 +8,8 @@ |
||
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 | /** |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use DBAL\OldDbChangeSet; |
4 | 4 | use Planet\DBStaticPlanet; |
5 | 5 | |
6 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) { |
|
6 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) { |
|
7 | 7 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
8 | 8 | } |
9 | 9 | |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | 'rpg_cost' => $rpg_cost, |
16 | 16 | )); |
17 | 17 | |
18 | -if(is_array($shipList)) { |
|
19 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
18 | +if (is_array($shipList)) { |
|
19 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
20 | 20 | $intError = MARKET_NO_DM; |
21 | 21 | } |
22 | 22 | |
@@ -33,30 +33,30 @@ discard block |
||
33 | 33 | $qry = array(); |
34 | 34 | $total = array(); |
35 | 35 | $db_changeset = 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 | $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, sn_get_groups('fleet'))) { |
|
59 | + if (!in_array($shipID, sn_get_groups('fleet'))) { |
|
60 | 60 | $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 |
||
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 | 79 | $message .= "<li>{$lang['tech'][$shipID]}: " . HelperString::numberFloorAndFormat($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 | $debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301); |
87 | 87 | break; |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | |
92 | 92 | $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError; |
93 | 93 | |
94 | - if($intError == MARKET_DEAL) { |
|
94 | + if ($intError == MARKET_DEAL) { |
|
95 | 95 | $message .= '</ul>' . $lang["eco_mrk_{$submode}_res"] . '<ul>'; |
96 | - foreach($total as $resID => $resCount) { |
|
97 | - if(!$resCount) { |
|
96 | + foreach ($total as $resID => $resCount) { |
|
97 | + if (!$resCount) { |
|
98 | 98 | continue; |
99 | 99 | } |
100 | 100 | |
@@ -128,38 +128,38 @@ discard block |
||
128 | 128 | 'MESSAGE' => $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(!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
139 | - $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, sn_get_groups('fleet')))); |
|
138 | +if (!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
139 | + $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, sn_get_groups('fleet')))); |
|
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 = sn_get_groups('fleet'); |
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, |
@@ -19,7 +19,7 @@ |
||
19 | 19 | } |
20 | 20 | } |
21 | 21 | |
22 | - if(!empty($paramList)) { |
|
22 | + if (!empty($paramList)) { |
|
23 | 23 | $strParams = implode('&', $paramList); |
24 | 24 | } |
25 | 25 |