@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | 'factor' => 1.5, |
16 | 16 | ), |
17 | 17 | P_UNIT_PRODUCTION => array( |
18 | - RES_METAL => function ($level, $production_factor, $user, $planet_row) {return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
19 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
18 | + RES_METAL => function($level, $production_factor, $user, $planet_row) {return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
19 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
20 | 20 | ), |
21 | 21 | P_MINING_IS_MANAGED => true, |
22 | 22 | ), |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | 'factor' => 1.6, |
34 | 34 | ), |
35 | 35 | P_UNIT_PRODUCTION => array( |
36 | - RES_CRYSTAL => function ($level, $production_factor, $user, $planet_row) {return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
37 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
36 | + RES_CRYSTAL => function($level, $production_factor, $user, $planet_row) {return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
37 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
38 | 38 | ), |
39 | 39 | P_MINING_IS_MANAGED => true, |
40 | 40 | ), |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | 'factor' => 1.5, |
52 | 52 | ), |
53 | 53 | P_UNIT_PRODUCTION => array( |
54 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28);}, |
|
55 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
54 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); }, |
|
55 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
56 | 56 | ), |
57 | 57 | P_MINING_IS_MANAGED => true, |
58 | 58 | ), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'factor' => 1.5, |
70 | 70 | ), |
71 | 71 | P_UNIT_PRODUCTION => array( |
72 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
72 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
73 | 73 | ), |
74 | 74 | P_MINING_IS_MANAGED => true, |
75 | 75 | ), |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | 'factor' => 1.8, |
88 | 88 | ), |
89 | 89 | P_UNIT_PRODUCTION => array( |
90 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
91 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor);}, |
|
90 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
91 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor); }, |
|
92 | 92 | ), |
93 | 93 | P_MINING_IS_MANAGED => true, |
94 | 94 | ), |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'factor' => 2, |
106 | 106 | ), |
107 | 107 | 'storage' => array( |
108 | - RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
108 | + RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
109 | 109 | ), |
110 | 110 | ), |
111 | 111 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'factor' => 2, |
122 | 122 | ), |
123 | 123 | 'storage' => array( |
124 | - RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
124 | + RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | 'factor' => 2, |
138 | 138 | ), |
139 | 139 | 'storage' => array( |
140 | - RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
140 | + RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
141 | 141 | ), |
142 | 142 | ), |
143 | 143 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | 'GROUP BY `unit_snid`' |
27 | 27 | ); |
28 | 28 | $result = array(); |
29 | - while($row = db_fetch($query)) { |
|
29 | + while ($row = db_fetch($query)) { |
|
30 | 30 | $result[$row['unit_snid']] = $row; |
31 | 31 | } |
32 | 32 |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | * @version 1.0 |
12 | 12 | */ |
13 | 13 | function eco_get_lab_max_effective_level(&$user, $lab_require) { |
14 | - if(!$user['user_as_ally'] && !isset($user['laboratories_active'])) { |
|
14 | + if (!$user['user_as_ally'] && !isset($user['laboratories_active'])) { |
|
15 | 15 | $user['laboratories_active'] = array(); |
16 | 16 | $query = db_unit_list_laboratories($user['id']); |
17 | - while($row = db_fetch($query)) { |
|
18 | - if(!eco_unit_busy($user, $row, UNIT_TECHNOLOGIES)) { |
|
17 | + while ($row = db_fetch($query)) { |
|
18 | + if (!eco_unit_busy($user, $row, UNIT_TECHNOLOGIES)) { |
|
19 | 19 | $row += array( |
20 | 20 | STRUC_LABORATORY => $level_lab = mrc_get_level($user, $row, STRUC_LABORATORY), |
21 | 21 | STRUC_LABORATORY_NANO => $level_lab_nano = mrc_get_level($user, $row, STRUC_LABORATORY_NANO), |
@@ -28,18 +28,18 @@ discard block |
||
28 | 28 | uasort($user['laboratories_active'], 'eco_lab_sort_effectivness'); |
29 | 29 | } |
30 | 30 | |
31 | - if(!isset($user['research_effective_level'][$lab_require])) { |
|
32 | - if($user['user_as_ally']) { |
|
31 | + if (!isset($user['research_effective_level'][$lab_require])) { |
|
32 | + if ($user['user_as_ally']) { |
|
33 | 33 | $lab_level = db_ally_get_ally_count($user); |
34 | 34 | } else { |
35 | 35 | $tech_intergalactic = mrc_get_level($user, null, TECH_RESEARCH) + 1; |
36 | 36 | $lab_level['effective_level'] = 0; |
37 | 37 | |
38 | - foreach($user['laboratories_active'] as $data) { |
|
39 | - if($tech_intergalactic <= 0) { |
|
38 | + foreach ($user['laboratories_active'] as $data) { |
|
39 | + if ($tech_intergalactic <= 0) { |
|
40 | 40 | break; |
41 | 41 | } |
42 | - if($data[STRUC_LABORATORY] >= $lab_require) { |
|
42 | + if ($data[STRUC_LABORATORY] >= $lab_require) { |
|
43 | 43 | $lab_level['effective_level'] += $data['laboratory_effective_level']; |
44 | 44 | $tech_intergalactic--; |
45 | 45 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $time = 0; |
66 | 66 | $only_dark_matter = 0; |
67 | 67 | $cost_in_metal = 0; |
68 | - foreach($unit_data[P_COST] as $resource_id => $resource_amount) { |
|
69 | - if($resource_id === P_FACTOR || !($resource_cost = $resource_amount * $price_increase)) { |
|
68 | + foreach ($unit_data[P_COST] as $resource_id => $resource_amount) { |
|
69 | + if ($resource_id === P_FACTOR || !($resource_cost = $resource_amount * $price_increase)) { |
|
70 | 70 | continue; |
71 | 71 | } |
72 | 72 | |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | |
76 | 76 | $resource_db_name = pname_resource_name($resource_id); |
77 | 77 | $cost_in_metal += $cost[BUILD_CREATE][$resource_id] * classSupernova::$config->__get("rpg_exchange_{$resource_db_name}"); |
78 | - if(in_array($resource_id, sn_get_groups('resources_loot'))) { |
|
78 | + if (in_array($resource_id, sn_get_groups('resources_loot'))) { |
|
79 | 79 | $time += $resource_cost * classSupernova::$config->__get("rpg_exchange_{$resource_db_name}") / $rpg_exchange_deuterium; |
80 | 80 | $resource_got = mrc_get_level($user, $planet, $resource_id); |
81 | - } elseif($resource_id == RES_DARK_MATTER) { |
|
81 | + } elseif ($resource_id == RES_DARK_MATTER) { |
|
82 | 82 | $resource_got = mrc_get_level($user, null, $resource_id); |
83 | - } elseif($resource_id == RES_ENERGY) { |
|
83 | + } elseif ($resource_id == RES_ENERGY) { |
|
84 | 84 | $resource_got = max(0, $planet['energy_max'] - $planet['energy_used']); |
85 | 85 | } else { |
86 | 86 | $resource_got = 0; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $resources_normalized = 0; |
95 | 95 | $resources_loot = sn_get_groups('resources_loot'); |
96 | - foreach($resources_loot as $resource_id) { |
|
96 | + foreach ($resources_loot as $resource_id) { |
|
97 | 97 | $resource_db_name = pname_resource_name($resource_id); |
98 | 98 | $resource_got = mrc_get_level($user, $planet, $resource_id); |
99 | 99 | $resources_normalized += floor($resource_got) * classSupernova::$config->__get("rpg_exchange_{$resource_db_name}"); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $cost[P_OPTIONS][P_TIME_RAW] = $time = $time * 60 * 60 / get_game_speed() / 2500; |
112 | 112 | |
113 | 113 | // TODO - Вынести в отдельную процедуру расчёт стоимости |
114 | - if($only_cost) { |
|
114 | + if ($only_cost) { |
|
115 | 115 | return $cost; |
116 | 116 | } |
117 | 117 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $mercenary = 0; |
122 | 122 | $cost['RESULT'][BUILD_DESTROY] = BUILD_INDESTRUCTABLE; |
123 | - if(in_array($unit_id, sn_get_groups('structures'))) { |
|
123 | + if (in_array($unit_id, sn_get_groups('structures'))) { |
|
124 | 124 | $time = $time * pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_ROBOT) + 1); |
125 | 125 | $mercenary = MRC_ENGINEER; |
126 | 126 | $cost['RESULT'][BUILD_DESTROY] = |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | : BUILD_NO_RESOURCES |
131 | 131 | ) |
132 | 132 | : BUILD_NO_UNITS; |
133 | - } elseif(in_array($unit_id, sn_get_groups('tech'))) { |
|
133 | + } elseif (in_array($unit_id, sn_get_groups('tech'))) { |
|
134 | 134 | $lab_level = eco_get_lab_max_effective_level($user, intval($unit_data['require'][STRUC_LABORATORY])); |
135 | 135 | $time = $time / $lab_level; |
136 | 136 | $mercenary = MRC_ACADEMIC; |
137 | - } elseif(in_array($unit_id, sn_get_groups('defense'))) { |
|
137 | + } elseif (in_array($unit_id, sn_get_groups('defense'))) { |
|
138 | 138 | $time = $time * pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1); |
139 | 139 | $mercenary = MRC_FORTIFIER; |
140 | - } elseif(in_array($unit_id, sn_get_groups('fleet'))) { |
|
140 | + } elseif (in_array($unit_id, sn_get_groups('fleet'))) { |
|
141 | 141 | $time = $time * pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1); |
142 | 142 | $mercenary = MRC_ENGINEER; |
143 | 143 | } |
144 | 144 | |
145 | - if($mercenary) { |
|
145 | + if ($mercenary) { |
|
146 | 146 | $time = $time / mrc_modify_value($user, $planet, $mercenary, 1); |
147 | 147 | } |
148 | 148 | |
149 | - if(in_array($unit_id, sn_get_groups('governors')) || $only_dark_matter) { |
|
149 | + if (in_array($unit_id, sn_get_groups('governors')) || $only_dark_matter) { |
|
150 | 150 | $cost[RES_TIME][BUILD_CREATE] = $cost[RES_TIME][BUILD_DESTROY] = 0; |
151 | 151 | } else { |
152 | 152 | $cost[RES_TIME][BUILD_CREATE] = round($time >= 1 ? $time : 1); |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | $result = $result == BUILD_ALLOWED && eco_unit_busy($user, $planet, $unit_id) ? BUILD_UNIT_BUSY : $result; |
164 | 164 | |
165 | 165 | $unit_param = get_unit_param($unit_id); |
166 | - if($unit_param[P_UNIT_TYPE] != UNIT_MERCENARIES || !classSupernova::$config->empire_mercenary_temporary) { |
|
166 | + if ($unit_param[P_UNIT_TYPE] != UNIT_MERCENARIES || !classSupernova::$config->empire_mercenary_temporary) { |
|
167 | 167 | $requirement = &$unit_param[P_REQUIRE]; |
168 | - if($result == BUILD_ALLOWED && $requirement) { |
|
169 | - foreach($requirement as $require_id => $require_level) { |
|
170 | - if(mrc_get_level($user, $planet, $require_id) < $require_level) { |
|
168 | + if ($result == BUILD_ALLOWED && $requirement) { |
|
169 | + foreach ($requirement as $require_id => $require_level) { |
|
170 | + if (mrc_get_level($user, $planet, $require_id) < $require_level) { |
|
171 | 171 | $result = BUILD_REQUIRE_NOT_MEET; |
172 | 172 | break; |
173 | 173 | } |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | |
184 | 184 | $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list); |
185 | 185 | $planet_que = explode(';', $planet_que); |
186 | - foreach($planet_que as $planet_que_item) { |
|
187 | - if($planet_que_item) { |
|
186 | + foreach ($planet_que as $planet_que_item) { |
|
187 | + if ($planet_que_item) { |
|
188 | 188 | list($planet_que_item) = explode(',', $planet_que_item); |
189 | - if(in_array($planet_que_item, $unit_list)) { |
|
189 | + if (in_array($planet_que_item, $unit_list)) { |
|
190 | 190 | $eco_is_builds_in_que = true; |
191 | 191 | break; |
192 | 192 | } |
@@ -200,12 +200,12 @@ discard block |
||
200 | 200 | |
201 | 201 | function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) { |
202 | 202 | $result = isset($result) ? $result : false; |
203 | - if(!$result) { |
|
204 | - if(($unit_id == STRUC_LABORATORY || $unit_id == STRUC_LABORATORY_NANO) && !classSupernova::$config->BuildLabWhileRun) { |
|
203 | + if (!$result) { |
|
204 | + if (($unit_id == STRUC_LABORATORY || $unit_id == STRUC_LABORATORY_NANO) && !classSupernova::$config->BuildLabWhileRun) { |
|
205 | 205 | $global_que = que_get($user['id'], $planet['id'], QUE_RESEARCH, false); |
206 | - if(is_array($global_que['ques'][QUE_RESEARCH][$user['id']])) { |
|
206 | + if (is_array($global_que['ques'][QUE_RESEARCH][$user['id']])) { |
|
207 | 207 | $first_element = reset($global_que['ques'][QUE_RESEARCH][$user['id']]); |
208 | - if(is_array($first_element)) { |
|
208 | + if (is_array($first_element)) { |
|
209 | 209 | $result = true; |
210 | 210 | } |
211 | 211 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | //{ |
214 | 214 | // $result = true; |
215 | 215 | //} |
216 | - } elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !classSupernova::$config->BuildLabWhileRun && $planet['que']) { |
|
216 | + } elseif (($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !classSupernova::$config->BuildLabWhileRun && $planet['que']) { |
|
217 | 217 | $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO)); |
218 | 218 | } |
219 | 219 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $user_auth_level = isset($user['authlevel']) ? $user['authlevel'] : AUTH_LEVEL_ANONYMOUS; |
37 | 37 | |
38 | 38 | $mode = sys_get_param_int('mode'); |
39 | - switch($mode) { |
|
39 | + switch ($mode) { |
|
40 | 40 | case CHAT_MODE_ALLY: |
41 | 41 | $template_result['ALLY'] = intval($user['ally_id']); |
42 | 42 | $page_title = classLocale::$lang['chat_ally']; |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | $template_result['.']['smiles'] = array(); |
52 | - foreach($supernova->design['smiles'] as $auth_level => $replaces) { |
|
53 | - if($auth_level > $user_auth_level) { |
|
52 | + foreach ($supernova->design['smiles'] as $auth_level => $replaces) { |
|
53 | + if ($auth_level > $user_auth_level) { |
|
54 | 54 | continue; |
55 | 55 | } |
56 | 56 | |
57 | - foreach($replaces as $bbcode => $filename) { |
|
57 | + foreach ($replaces as $bbcode => $filename) { |
|
58 | 58 | $template_result['.']['smiles'][] = array( |
59 | 59 | 'BBCODE' => $bbcode, |
60 | 60 | 'FILENAME' => $filename, |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | define('IN_AJAX', true); |
78 | 78 | $skip_fleet_update = true; |
79 | 79 | |
80 | - if(classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
80 | + if (classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
81 | 81 | die(); |
82 | 82 | } |
83 | 83 | |
84 | - if(($message = sys_get_param_str('message')) && $user['username']) { |
|
84 | + if (($message = sys_get_param_str('message')) && $user['username']) { |
|
85 | 85 | $ally_id = sys_get_param('ally') && $user['ally_id'] ? $user['ally_id'] : 0; |
86 | 86 | $nick = db_escape(player_nick_compact(player_nick_render_current_to_array($user, array('color' => true, 'icons' => true, 'ally' => !$ally_id)))); |
87 | 87 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $skip_fleet_update = true; |
104 | 104 | |
105 | 105 | $history = sys_get_param_str('history'); |
106 | - if(!$history) { |
|
106 | + if (!$history) { |
|
107 | 107 | classSupernova::$config->array_set('users', $user['id'], 'chat_last_refresh', SN_TIME_MICRO); |
108 | 108 | } |
109 | 109 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $last_message = ''; |
112 | 112 | $alliance = 0; |
113 | 113 | $template_result['.']['chat'] = array(); |
114 | - if(!$history && classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
114 | + if (!$history && classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
115 | 115 | $result['disable'] = true; |
116 | 116 | $template_result['.']['chat'][] = array( |
117 | 117 | 'TIME' => date(FMT_DATE_TIME, htmlentities(SN_CLIENT_TIME_LOCAL, ENT_QUOTES, 'utf-8')), |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | |
125 | 125 | $where_add = ''; |
126 | 126 | $last_message = 0; |
127 | - if($history) { |
|
127 | + if ($history) { |
|
128 | 128 | $rows = db_chat_message_count_by_ally($alliance); |
129 | 129 | $page_count = ceil($rows['CNT'] / $page_limit); |
130 | 130 | |
131 | - for($i = 0; $i < $page_count; $i++) { |
|
131 | + for ($i = 0; $i < $page_count; $i++) { |
|
132 | 132 | $template_result['.']['page'][] = array( |
133 | 133 | 'NUMBER' => $i |
134 | 134 | ); |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | |
143 | 143 | $start_row = $page * $page_limit; |
144 | 144 | $query = db_chat_message_get_page($alliance, $where_add, $start_row, $page_limit); |
145 | - while($chat_row = db_fetch($query)) { |
|
145 | + while ($chat_row = db_fetch($query)) { |
|
146 | 146 | // Little magik here - to retain HTML codes from DB and stripping HTML codes from nick |
147 | 147 | $chat_row['user'] = player_nick_render_to_html($chat_row['user']); |
148 | 148 | $nick_stripped = htmlentities(strip_tags($chat_row['user']), ENT_QUOTES, 'utf-8'); |
149 | 149 | $nick = str_replace(strip_tags($chat_row['user']), $nick_stripped, $chat_row['user']); |
150 | - if(!$history) { |
|
150 | + if (!$history) { |
|
151 | 151 | $nick = "<span style=\"cursor: pointer;\" onclick=\"addSmiley('({$nick_stripped})');\">{$nick}</span>"; |
152 | 152 | } |
153 | 153 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $template = gettemplate('chat_messages', $template); |
173 | 173 | $template->assign_recursive($template_result); |
174 | 174 | |
175 | - if($history) { |
|
175 | + if ($history) { |
|
176 | 176 | display($template, "{$classLocale['chat_history']} - {$classLocale[$alliance ? 'chat_ally' : 'chat_common']}", true, '', false, true); |
177 | 177 | } else { |
178 | 178 | $result['last_message'] = $last_message; |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | * @return int|mixed |
229 | 229 | */ |
230 | 230 | public function calcColonyMaxCount($astrotech = -1) { |
231 | - if($astrotech == -1) { |
|
232 | - if(!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) { |
|
231 | + if ($astrotech == -1) { |
|
232 | + if (!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) { |
|
233 | 233 | |
234 | 234 | $expeditions = get_player_max_expeditons($this->_dbRow); |
235 | 235 | $astrotech = mrc_get_level($this->_dbRow, null, TECH_ASTROTECH); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | |
304 | 304 | public function expeditionsMax() { |
305 | - if($this->expeditionsMax === null) { |
|
305 | + if ($this->expeditionsMax === null) { |
|
306 | 306 | $this->expeditionsMax = get_player_max_expeditons($this->_dbRow); |
307 | 307 | } |
308 | 308 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | |
312 | 312 | public function expeditionsFlying() { |
313 | - if($this->expeditionsFlying === null) { |
|
313 | + if ($this->expeditionsFlying === null) { |
|
314 | 314 | $this->expeditionsFlying = FleetList::fleet_count_flying($this->_dbId, MT_EXPLORE); |
315 | 315 | } |
316 | 316 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | |
321 | 321 | public function fleetsMax() { |
322 | - if($this->fleetMax === null) { |
|
322 | + if ($this->fleetMax === null) { |
|
323 | 323 | $this->fleetMax = GetMaxFleets($this->_dbRow); |
324 | 324 | } |
325 | 325 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | } |
328 | 328 | |
329 | 329 | public function fleetsFlying() { |
330 | - if($this->fleetFlying === null) { |
|
330 | + if ($this->fleetFlying === null) { |
|
331 | 331 | $this->fleetFlying = FleetList::fleet_count_flying($this->_dbId); |
332 | 332 | } |
333 | 333 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | |
337 | 337 | |
338 | 338 | public function coloniesMax() { |
339 | - if($this->coloniesMax === null) { |
|
339 | + if ($this->coloniesMax === null) { |
|
340 | 340 | $this->coloniesMax = get_player_max_colonies($this->_dbRow); |
341 | 341 | } |
342 | 342 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | public function coloniesCurrent() { |
347 | - if($this->coloniesCurrent === null) { |
|
347 | + if ($this->coloniesCurrent === null) { |
|
348 | 348 | $this->coloniesCurrent = get_player_current_colonies($this->_dbRow); |
349 | 349 | } |
350 | 350 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | **/ |
14 | 14 | |
15 | -if(SN_IN_FLEET !== true) { |
|
15 | +if (SN_IN_FLEET !== true) { |
|
16 | 16 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
17 | 17 | } |
18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $planet_list = array(); |
27 | 27 | |
28 | - if(is_array($resources_taken)) |
|
28 | + if (is_array($resources_taken)) |
|
29 | 29 | { |
30 | 30 | $query = implode(',', array_keys($resources_taken)); |
31 | 31 | $query = " AND `destruyed` = 0 AND `id` IN ({$query})"; |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | $query = ''; |
34 | 34 | } |
35 | 35 | |
36 | - foreach(sn_get_groups('flt_transports') as $transport_id) { |
|
36 | + foreach (sn_get_groups('flt_transports') as $transport_id) { |
|
37 | 37 | $transports[$transport_id] = get_unit_param($transport_id, P_CAPACITY); |
38 | 38 | } |
39 | 39 | arsort($transports); |
40 | 40 | |
41 | 41 | $planets_db_list = db_planet_list_sorted($user, $planetrow['id'], '*', $query); |
42 | 42 | !is_array($planets_db_list) ? $planets_db_list = array() : false; |
43 | - foreach($planets_db_list as $planet_db_data) { |
|
43 | + foreach ($planets_db_list as $planet_db_data) { |
|
44 | 44 | // begin planet loop |
45 | - if(!$query) { |
|
45 | + if (!$query) { |
|
46 | 46 | $resources_taken[$planet_db_data['id']] = 1; |
47 | 47 | } |
48 | 48 | sn_db_transaction_start(); |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | $planet_id = $planet_db_data['id']; |
55 | 55 | |
56 | 56 | $planet_resources = 0; |
57 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
58 | - if($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) { |
|
57 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
58 | + if ($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) { |
|
59 | 59 | $planet_resources += floor(mrc_get_level($user, $planet_db_data, $resource_id, true, true)); // $planet_db_data[get_unit_param($resource_id, P_NAME)]); |
60 | 60 | } |
61 | 61 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | $fleet_capacity = 0; |
87 | 87 | $ship_loadout = array(); |
88 | 88 | $fleet = array(); |
89 | - foreach($transports as $ship_id => $ship_capacity) { |
|
90 | - if($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) { |
|
89 | + foreach ($transports as $ship_id => $ship_capacity) { |
|
90 | + if ($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) { |
|
91 | 91 | $ship_loadout[$ship_id]['capacity'] = $ship_count * $ship_capacity; |
92 | 92 | $ship_loadout[$ship_id]['taken'] = 0; |
93 | 93 | $fleet_capacity += $ship_loadout[$ship_id]['capacity']; |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | |
99 | 99 | $will_take = min($planet_resources, $fleet_capacity); |
100 | 100 | |
101 | - foreach($ship_loadout as $ship_id => &$planet_ship) { |
|
101 | + foreach ($ship_loadout as $ship_id => &$planet_ship) { |
|
102 | 102 | $can_take = min($will_take, $planet_ship['capacity']); |
103 | - if($can_take <= 0) { |
|
103 | + if ($can_take <= 0) { |
|
104 | 104 | continue; |
105 | 105 | } |
106 | 106 | $planet_ship['capacity'] -= $can_take; |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | $fleet[$ship_id] = ceil($planet_ship['taken'] / $transports[$ship_id]); |
109 | 109 | |
110 | 110 | $will_take -= $can_take; |
111 | - if($will_take <= 0) { |
|
111 | + if ($will_take <= 0) { |
|
112 | 112 | break; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | - if(!empty($fleet)) { |
|
116 | + if (!empty($fleet)) { |
|
117 | 117 | $travel_data = flt_travel_data($user, $planetrow, $planet_db_data, $fleet, 10); |
118 | 118 | $planet_data['FLEET_SPEED'] = $travel_data['fleet_speed']; |
119 | 119 | $planet_data['DISTANCE'] = $travel_data['distance']; |
120 | 120 | $planet_data['DURATION'] = $travel_data['duration']; |
121 | 121 | $planet_data['CONSUMPTION'] = $travel_data['consumption']; |
122 | 122 | |
123 | - if(floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) { |
|
123 | + if (floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) { |
|
124 | 124 | $will_take = min($planet_resources, $fleet_capacity) - $planet_data['CONSUMPTION']; |
125 | 125 | |
126 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
127 | - if($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) { |
|
126 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
127 | + if ($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) { |
|
128 | 128 | continue; |
129 | 129 | } |
130 | 130 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $fleet[$resource_id] = min($will_take, $resource_amount); |
134 | 134 | $will_take -= $resource_amount; |
135 | 135 | |
136 | - if($will_take <= 0) { |
|
136 | + if ($will_take <= 0) { |
|
137 | 137 | break; |
138 | 138 | } |
139 | 139 | } |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | |
158 | 158 | $resources_taken = sys_get_param('resources'); |
159 | 159 | |
160 | -if(!empty($resources_taken)) { // begin processing parameters |
|
160 | +if (!empty($resources_taken)) { // begin processing parameters |
|
161 | 161 | $planet_list = flt_build_gathering($resources_taken); |
162 | 162 | |
163 | - foreach($planet_list as $planet_id => $planet_data) { |
|
164 | - if($planet_data['RESULT'] == FLIGHT_ALLOWED) { |
|
163 | + foreach ($planet_list as $planet_id => $planet_data) { |
|
164 | + if ($planet_data['RESULT'] == FLIGHT_ALLOWED) { |
|
165 | 165 | $planet_data['RESULT'] = flt_t_send_fleet($user, $planet_data['PLANET_DB_DATA'], $planetrow, $planet_data['FLEET'], MT_TRANSPORT); |
166 | 166 | } |
167 | 167 | |
168 | 168 | $planet_data['MESSAGE'] = classLocale::$lang['fl_attack_error'][$planet_data['RESULT']]; |
169 | 169 | |
170 | 170 | $template->assign_block_vars('results', $planet_data); |
171 | - if(!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) { |
|
172 | - foreach($planet_data['FLEET'] as $unit_id => $amount) { |
|
171 | + if (!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) { |
|
172 | + foreach ($planet_data['FLEET'] as $unit_id => $amount) { |
|
173 | 173 | $template->assign_block_vars('results.units', array( |
174 | 174 | 'ID' => $unit_id, |
175 | 175 | 'NAME' => classLocale::$lang['tech'][$unit_id], |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | // Building list of own planets & moons |
184 | 184 | $planet_list = flt_build_gathering(); |
185 | -foreach($planet_list as $planet_data) { |
|
185 | +foreach ($planet_list as $planet_data) { |
|
186 | 186 | $planet_data['DURATION'] = $planet_data['DURATION'] ? pretty_time($planet_data['DURATION']) : classLocale::$lang['flt_no_fuel']; |
187 | 187 | $template->assign_block_vars('colonies', $planet_data); |
188 | 188 | } |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function flt_fleet_speed($user, $fleet) { |
4 | - if(!is_array($fleet)) { |
|
4 | + if (!is_array($fleet)) { |
|
5 | 5 | $fleet = array($fleet => 1); |
6 | 6 | } |
7 | 7 | |
8 | 8 | $speeds = array(); |
9 | - if(!empty($fleet)) { |
|
10 | - foreach($fleet as $ship_id => $amount) { |
|
11 | - if($amount && in_array($ship_id, sn_get_groups(array('fleet', 'missile')))) { |
|
9 | + if (!empty($fleet)) { |
|
10 | + foreach ($fleet as $ship_id => $amount) { |
|
11 | + if ($amount && in_array($ship_id, sn_get_groups(array('fleet', 'missile')))) { |
|
12 | 12 | $single_ship_data = get_ship_data($ship_id, $user); |
13 | 13 | $speeds[] = $single_ship_data['speed']; |
14 | 14 | } |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | |
52 | 52 | $game_fleet_speed = flt_server_flight_speed_multiplier(); |
53 | 53 | $fleet_speed = flt_fleet_speed($user_row, $fleet_array); |
54 | - if(!empty($fleet_array) && $fleet_speed && $game_fleet_speed) { |
|
54 | + if (!empty($fleet_array) && $fleet_speed && $game_fleet_speed) { |
|
55 | 55 | $speed_percent = $speed_percent ? max(min($speed_percent, 10), 1) : 10; |
56 | 56 | $real_speed = $speed_percent * sqrt($fleet_speed); |
57 | 57 | |
58 | 58 | $duration = max(1, round((35000 / $speed_percent * sqrt($distance * 10 / $fleet_speed) + 10) / $game_fleet_speed)); |
59 | 59 | |
60 | - foreach($fleet_array as $ship_id => $ship_count) { |
|
61 | - if(!$ship_id || !$ship_count) { |
|
60 | + foreach ($fleet_array as $ship_id => $ship_count) { |
|
61 | + if (!$ship_id || !$ship_count) { |
|
62 | 62 | continue; |
63 | 63 | } |
64 | 64 | |
@@ -86,19 +86,19 @@ discard block |
||
86 | 86 | function flt_bashing_check($user, $enemy, $planet_dst, $mission, $flight_duration, $fleet_group = 0) { |
87 | 87 | $config_bashing_attacks = classSupernova::$config->fleet_bashing_attacks; |
88 | 88 | $config_bashing_interval = classSupernova::$config->fleet_bashing_interval; |
89 | - if(!$config_bashing_attacks) { |
|
89 | + if (!$config_bashing_attacks) { |
|
90 | 90 | // Bashing allowed - protection disabled |
91 | 91 | return FLIGHT_ALLOWED; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $bashing_result = FLIGHT_MISSION_ATTACK_BASHING; |
95 | - if($user['ally_id'] && $enemy['ally_id']) { |
|
95 | + if ($user['ally_id'] && $enemy['ally_id']) { |
|
96 | 96 | $relations = ali_relations($user['ally_id'], $enemy['ally_id']); |
97 | - if(!empty($relations)) { |
|
97 | + if (!empty($relations)) { |
|
98 | 98 | $relations = $relations[$enemy['ally_id']]; |
99 | - switch($relations['alliance_diplomacy_relation']) { |
|
99 | + switch ($relations['alliance_diplomacy_relation']) { |
|
100 | 100 | case ALLY_DIPLOMACY_WAR: |
101 | - if(SN_TIME_NOW - $relations['alliance_diplomacy_time'] <= classSupernova::$config->fleet_bashing_war_delay) { |
|
101 | + if (SN_TIME_NOW - $relations['alliance_diplomacy_time'] <= classSupernova::$config->fleet_bashing_war_delay) { |
|
102 | 102 | $bashing_result = FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY; |
103 | 103 | } else { |
104 | 104 | return FLIGHT_ALLOWED; |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | |
121 | 121 | // Retrieving flying fleets |
122 | 122 | $objFleetsBashing = FleetList::dbGetFleetListBashing($user['id'], $planet_dst); |
123 | - foreach($objFleetsBashing->_container as $fleetBashing) { |
|
123 | + foreach ($objFleetsBashing->_container as $fleetBashing) { |
|
124 | 124 | // Checking for ACS - each ACS count only once |
125 | - if($fleetBashing->group_id) { |
|
125 | + if ($fleetBashing->group_id) { |
|
126 | 126 | $bashing_list["{$user['id']}_{$fleetBashing->group_id}"] = $fleetBashing->time_arrive_to_target; |
127 | 127 | } else { |
128 | 128 | $bashing_list[] = $fleetBashing->time_arrive_to_target; |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | // Check for joining to ACS - if there are already fleets in ACS no checks should be done |
133 | - if($mission == MT_ACS && $bashing_list["{$user['id']}_{$fleet_group}"]) { |
|
133 | + if ($mission == MT_ACS && $bashing_list["{$user['id']}_{$fleet_group}"]) { |
|
134 | 134 | return FLIGHT_ALLOWED; |
135 | 135 | } |
136 | 136 | |
137 | 137 | $query = db_bashing_list_get($user, $planet_dst, $time_limit); |
138 | - while($bashing_row = db_fetch($query)) { |
|
138 | + while ($bashing_row = db_fetch($query)) { |
|
139 | 139 | $bashing_list[] = $bashing_row['bashing_time']; |
140 | 140 | } |
141 | 141 | |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | $last_attack = 0; |
145 | 145 | $wave = 0; |
146 | 146 | $attack = 1; |
147 | - foreach($bashing_list as &$bash_time) { |
|
147 | + foreach ($bashing_list as &$bash_time) { |
|
148 | 148 | $attack++; |
149 | - if($bash_time - $last_attack > $config_bashing_interval || $attack > $config_bashing_attacks) { |
|
149 | + if ($bash_time - $last_attack > $config_bashing_interval || $attack > $config_bashing_attacks) { |
|
150 | 150 | $attack = 1; |
151 | 151 | $wave++; |
152 | 152 | } |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | //TODO: try..catch |
164 | 164 | global $user; |
165 | 165 | |
166 | - if($user['vacation']) { |
|
166 | + if ($user['vacation']) { |
|
167 | 167 | return $result = FLIGHT_PLAYER_VACATION_OWN; |
168 | 168 | } |
169 | 169 | |
170 | - if(empty($fleet) || !is_array($fleet)) { |
|
170 | + if (empty($fleet) || !is_array($fleet)) { |
|
171 | 171 | return $result = FLIGHT_SHIPS_NO_SHIPS; |
172 | 172 | } |
173 | 173 | |
174 | 174 | $sn_groups_mission = sn_get_groups('missions'); |
175 | - if(!isset($sn_groups_mission[$mission])) { |
|
175 | + if (!isset($sn_groups_mission[$mission])) { |
|
176 | 176 | return $result = FLIGHT_MISSION_UNKNOWN; |
177 | 177 | } |
178 | 178 | $sn_data_mission = $sn_groups_mission[$mission]; |
@@ -191,32 +191,32 @@ discard block |
||
191 | 191 | $resources = 0; |
192 | 192 | $ship_ids = sn_get_groups('fleet'); |
193 | 193 | $resource_ids = sn_get_groups('resources_loot'); |
194 | - foreach($fleet as $ship_id => $ship_count) { |
|
194 | + foreach ($fleet as $ship_id => $ship_count) { |
|
195 | 195 | $is_ship = in_array($ship_id, $ship_ids); |
196 | 196 | $is_resource = in_array($ship_id, $resource_ids); |
197 | - if(!$is_ship && !$is_resource) { |
|
197 | + if (!$is_ship && !$is_resource) { |
|
198 | 198 | // TODO Спецобработчик для Капитана и модулей |
199 | 199 | // return FLIGHT_SHIPS_UNIT_WRONG; |
200 | 200 | } |
201 | 201 | |
202 | - if($ship_count < 0) { |
|
202 | + if ($ship_count < 0) { |
|
203 | 203 | return $result = $is_ship ? FLIGHT_SHIPS_NEGATIVE : FLIGHT_RESOURCES_NEGATIVE; |
204 | 204 | } |
205 | 205 | |
206 | - if($ship_count > mrc_get_level($user, $planet_src, $ship_id)) { |
|
206 | + if ($ship_count > mrc_get_level($user, $planet_src, $ship_id)) { |
|
207 | 207 | // TODO FLIGHT_MISSION_MISSILE_NO_MISSILES |
208 | 208 | return $result = $is_ship ? FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES : FLIGHT_RESOURCES_NOT_ENOUGH; |
209 | 209 | } |
210 | 210 | |
211 | - if($is_ship) { |
|
211 | + if ($is_ship) { |
|
212 | 212 | $single_ship_data = get_ship_data($ship_id, $user); |
213 | - if($single_ship_data[P_SPEED] <= 0) { |
|
213 | + if ($single_ship_data[P_SPEED] <= 0) { |
|
214 | 214 | return $result = FLIGHT_SHIPS_UNMOVABLE; |
215 | 215 | } |
216 | 216 | $ships += $ship_count; |
217 | 217 | $recyclers += in_array($ship_id, sn_get_groups('flt_recyclers')) ? $ship_count : 0; |
218 | 218 | $spies += $ship_id == SHIP_SPY ? $ship_count : 0; |
219 | - } elseif($is_resource) { |
|
219 | + } elseif ($is_resource) { |
|
220 | 220 | $resources += $ship_count; |
221 | 221 | } |
222 | 222 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | } |
228 | 228 | */ |
229 | 229 | |
230 | - if(isset($options['resources']) && $options['resources'] > 0 && !(isset($sn_data_mission['transport']) && $sn_data_mission['transport'])) { |
|
230 | + if (isset($options['resources']) && $options['resources'] > 0 && !(isset($sn_data_mission['transport']) && $sn_data_mission['transport'])) { |
|
231 | 231 | return $result = FLIGHT_RESOURCES_FORBIDDEN; |
232 | 232 | } |
233 | 233 | |
@@ -239,78 +239,78 @@ discard block |
||
239 | 239 | */ |
240 | 240 | |
241 | 241 | $speed = $options['fleet_speed_percent']; |
242 | - if($speed && ($speed != intval($speed) || $speed < 1 || $speed > 10)) { |
|
242 | + if ($speed && ($speed != intval($speed) || $speed < 1 || $speed > 10)) { |
|
243 | 243 | return $result = FLIGHT_FLEET_SPEED_WRONG; |
244 | 244 | } |
245 | 245 | |
246 | 246 | $travel_data = flt_travel_data($user, $planet_src, $planet_dst, $fleet, $options['fleet_speed_percent']); |
247 | 247 | |
248 | 248 | |
249 | - if(mrc_get_level($user, $planet_src, RES_DEUTERIUM) < $fleet[RES_DEUTERIUM] + $travel_data['consumption']) { |
|
249 | + if (mrc_get_level($user, $planet_src, RES_DEUTERIUM) < $fleet[RES_DEUTERIUM] + $travel_data['consumption']) { |
|
250 | 250 | return $result = FLIGHT_RESOURCES_FUEL_NOT_ENOUGH; |
251 | 251 | } |
252 | 252 | |
253 | - if($travel_data['consumption'] > $travel_data['capacity']) { |
|
253 | + if ($travel_data['consumption'] > $travel_data['capacity']) { |
|
254 | 254 | return $result = FLIGHT_FLEET_TOO_FAR; |
255 | 255 | } |
256 | 256 | |
257 | - if($travel_data['hold'] < $resources) { |
|
257 | + if ($travel_data['hold'] < $resources) { |
|
258 | 258 | return $result = FLIGHT_FLEET_OVERLOAD; |
259 | 259 | } |
260 | 260 | |
261 | 261 | $fleet_start_time = SN_TIME_NOW + $travel_data['duration']; |
262 | 262 | |
263 | 263 | $fleet_group = $options['fleet_group']; |
264 | - if($fleet_group) { |
|
265 | - if($mission != MT_ACS) { |
|
264 | + if ($fleet_group) { |
|
265 | + if ($mission != MT_ACS) { |
|
266 | 266 | return $result = FLIGHT_MISSION_IMPOSSIBLE; |
267 | 267 | }; |
268 | 268 | |
269 | 269 | $acs = db_acs_get_by_group_id($fleet_group); |
270 | - if(!$acs['id']) { |
|
270 | + if (!$acs['id']) { |
|
271 | 271 | return $result = FLIGHT_MISSION_ACS_NOT_EXISTS; |
272 | 272 | } |
273 | 273 | |
274 | - if($planet_dst['galaxy'] != $acs['galaxy'] || $planet_dst['system'] != $acs['system'] || $planet_dst['planet'] != $acs['planet'] || $planet_dst['planet_type'] != $acs['planet_type']) { |
|
274 | + if ($planet_dst['galaxy'] != $acs['galaxy'] || $planet_dst['system'] != $acs['system'] || $planet_dst['planet'] != $acs['planet'] || $planet_dst['planet_type'] != $acs['planet_type']) { |
|
275 | 275 | return $result = FLIGHT_MISSION_ACS_WRONG_TARGET; |
276 | 276 | } |
277 | 277 | |
278 | - if($fleet_start_time > $acs['ankunft']) { |
|
278 | + if ($fleet_start_time > $acs['ankunft']) { |
|
279 | 279 | return $result = FLIGHT_MISSION_ACS_TOO_LATE; |
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
283 | 283 | $flying_fleets = $options['flying_fleets']; |
284 | - if(!$flying_fleets) { |
|
284 | + if (!$flying_fleets) { |
|
285 | 285 | $flying_fleets = FleetList::fleet_count_flying($user['id']); |
286 | 286 | } |
287 | - if(GetMaxFleets($user) <= $flying_fleets && $mission != MT_MISSILE) { |
|
287 | + if (GetMaxFleets($user) <= $flying_fleets && $mission != MT_MISSILE) { |
|
288 | 288 | return $result = FLIGHT_FLEET_NO_SLOTS; |
289 | 289 | } |
290 | 290 | |
291 | 291 | // В одиночку шпионские зонды могут летать только в миссии Шпионаж, Передислокация и Транспорт |
292 | - if($ships && $spies && $spies == $ships && !($mission == MT_SPY || $mission == MT_RELOCATE || $mission == MT_TRANSPORT)) { |
|
292 | + if ($ships && $spies && $spies == $ships && !($mission == MT_SPY || $mission == MT_RELOCATE || $mission == MT_TRANSPORT)) { |
|
293 | 293 | return $result = FLIGHT_SHIPS_NOT_ONLY_SPIES; |
294 | 294 | } |
295 | 295 | |
296 | 296 | // Checking for no planet |
297 | - if(!$planet_dst['id_owner']) { |
|
298 | - if($mission == MT_COLONIZE && !$fleet[SHIP_COLONIZER]) { |
|
297 | + if (!$planet_dst['id_owner']) { |
|
298 | + if ($mission == MT_COLONIZE && !$fleet[SHIP_COLONIZER]) { |
|
299 | 299 | return $result = FLIGHT_SHIPS_NO_COLONIZER; |
300 | 300 | } |
301 | 301 | |
302 | - if($mission == MT_EXPLORE || $mission == MT_COLONIZE) { |
|
302 | + if ($mission == MT_EXPLORE || $mission == MT_COLONIZE) { |
|
303 | 303 | return $result = FLIGHT_ALLOWED; |
304 | 304 | } |
305 | 305 | |
306 | 306 | return $result = FLIGHT_VECTOR_NO_TARGET; |
307 | 307 | } |
308 | 308 | |
309 | - if($mission == MT_RECYCLE) { |
|
310 | - if($planet_dst['debris_metal'] + $planet_dst['debris_crystal'] <= 0) { |
|
309 | + if ($mission == MT_RECYCLE) { |
|
310 | + if ($planet_dst['debris_metal'] + $planet_dst['debris_crystal'] <= 0) { |
|
311 | 311 | return $result = FLIGHT_MISSION_RECYCLE_NO_DEBRIS; |
312 | 312 | } |
313 | - if($recyclers <= 0) { |
|
313 | + if ($recyclers <= 0) { |
|
314 | 314 | return $result = FLIGHT_SHIPS_NO_RECYCLERS; |
315 | 315 | } |
316 | 316 | |
@@ -318,8 +318,8 @@ discard block |
||
318 | 318 | } |
319 | 319 | |
320 | 320 | // Got planet. Checking if it is ours |
321 | - if($planet_dst['id_owner'] == $user['id']) { |
|
322 | - if($mission == MT_TRANSPORT || $mission == MT_RELOCATE) { |
|
321 | + if ($planet_dst['id_owner'] == $user['id']) { |
|
322 | + if ($mission == MT_TRANSPORT || $mission == MT_RELOCATE) { |
|
323 | 323 | return $result = FLIGHT_ALLOWED; |
324 | 324 | } |
325 | 325 | |
@@ -327,19 +327,19 @@ discard block |
||
327 | 327 | } |
328 | 328 | |
329 | 329 | // No, planet not ours. Cutting mission that can't be send to not-ours planet |
330 | - if($mission == MT_RELOCATE || $mission == MT_COLONIZE || $mission == MT_EXPLORE) { |
|
330 | + if ($mission == MT_RELOCATE || $mission == MT_COLONIZE || $mission == MT_EXPLORE) { |
|
331 | 331 | return $result = FLIGHT_MISSION_IMPOSSIBLE; |
332 | 332 | } |
333 | 333 | |
334 | 334 | $enemy = db_user_by_id($planet_dst['id_owner']); |
335 | 335 | // We cannot attack or send resource to users in VACATION mode |
336 | - if($enemy['vacation'] && $mission != MT_RECYCLE) { |
|
336 | + if ($enemy['vacation'] && $mission != MT_RECYCLE) { |
|
337 | 337 | return $result = FLIGHT_PLAYER_VACATION; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // Multi IP protection |
341 | 341 | // TODO: Here we need a procedure to check proxies |
342 | - if(sys_is_multiaccount($user, $enemy)) { |
|
342 | + if (sys_is_multiaccount($user, $enemy)) { |
|
343 | 343 | return $result = FLIGHT_PLAYER_SAME_IP; |
344 | 344 | } |
345 | 345 | |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | $enemy_points = $enemy['total_points']; |
348 | 348 | |
349 | 349 | // Is it transport? If yes - checking for buffing to prevent mega-alliance destroyer |
350 | - if($mission == MT_TRANSPORT) { |
|
351 | - if($user_points >= $enemy_points || classSupernova::$config->allow_buffing) { |
|
350 | + if ($mission == MT_TRANSPORT) { |
|
351 | + if ($user_points >= $enemy_points || classSupernova::$config->allow_buffing) { |
|
352 | 352 | return $result = FLIGHT_ALLOWED; |
353 | 353 | } else { |
354 | 354 | return $result = FLIGHT_PLAYER_BUFFING; |
@@ -358,66 +358,66 @@ discard block |
||
358 | 358 | // Only aggresive missions passed to this point. HOLD counts as passive but aggresive |
359 | 359 | |
360 | 360 | // Is it admin with planet protection? |
361 | - if($planet_dst['id_level'] > $user['authlevel']) { |
|
361 | + if ($planet_dst['id_level'] > $user['authlevel']) { |
|
362 | 362 | return $result = FLIGHT_PLAYER_ADMIN; |
363 | 363 | } |
364 | 364 | |
365 | 365 | // Okay. Now skipping protection checks for inactive longer then 1 week |
366 | - if(!$enemy['onlinetime'] || $enemy['onlinetime'] >= (SN_TIME_NOW - 60 * 60 * 24 * 7)) { |
|
367 | - if( |
|
366 | + if (!$enemy['onlinetime'] || $enemy['onlinetime'] >= (SN_TIME_NOW - 60 * 60 * 24 * 7)) { |
|
367 | + if ( |
|
368 | 368 | ($enemy_points <= classSupernova::$config->game_noob_points && $user_points > classSupernova::$config->game_noob_points) |
369 | 369 | || |
370 | 370 | (classSupernova::$config->game_noob_factor && $user_points > $enemy_points * classSupernova::$config->game_noob_factor) |
371 | 371 | ) { |
372 | - if($mission != MT_HOLD) { |
|
372 | + if ($mission != MT_HOLD) { |
|
373 | 373 | return $result = FLIGHT_PLAYER_NOOB; |
374 | 374 | } |
375 | - if($mission == MT_HOLD && !($user['ally_id'] && $user['ally_id'] == $enemy['ally_id'] && classSupernova::$config->ally_help_weak)) { |
|
375 | + if ($mission == MT_HOLD && !($user['ally_id'] && $user['ally_id'] == $enemy['ally_id'] && classSupernova::$config->ally_help_weak)) { |
|
376 | 376 | return $result = FLIGHT_PLAYER_NOOB; |
377 | 377 | } |
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
381 | 381 | // Is it HOLD mission? If yes - there should be ally deposit |
382 | - if($mission == MT_HOLD) { |
|
383 | - if(mrc_get_level($user, $planet_dst, STRUC_ALLY_DEPOSIT)) { |
|
382 | + if ($mission == MT_HOLD) { |
|
383 | + if (mrc_get_level($user, $planet_dst, STRUC_ALLY_DEPOSIT)) { |
|
384 | 384 | return $result = FLIGHT_ALLOWED; |
385 | 385 | } |
386 | 386 | |
387 | 387 | return $result = FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT; |
388 | 388 | } |
389 | 389 | |
390 | - if($mission == MT_SPY) { |
|
390 | + if ($mission == MT_SPY) { |
|
391 | 391 | return $result = $spies >= 1 ? FLIGHT_ALLOWED : FLIGHT_MISSION_SPY_NO_SPIES; |
392 | 392 | } |
393 | 393 | |
394 | 394 | // Is it MISSILE mission? |
395 | - if($mission == MT_MISSILE) { |
|
395 | + if ($mission == MT_MISSILE) { |
|
396 | 396 | $sn_data_mip = get_unit_param(UNIT_DEF_MISSILE_INTERPLANET); |
397 | - if(mrc_get_level($user, $planet_src, STRUC_SILO) < $sn_data_mip[P_REQUIRE][STRUC_SILO]) { |
|
397 | + if (mrc_get_level($user, $planet_src, STRUC_SILO) < $sn_data_mip[P_REQUIRE][STRUC_SILO]) { |
|
398 | 398 | return $result = FLIGHT_MISSION_MISSILE_NO_SILO; |
399 | 399 | } |
400 | 400 | |
401 | - if(!$fleet[UNIT_DEF_MISSILE_INTERPLANET]) { |
|
401 | + if (!$fleet[UNIT_DEF_MISSILE_INTERPLANET]) { |
|
402 | 402 | return $result = FLIGHT_MISSION_MISSILE_NO_MISSILES; |
403 | 403 | } |
404 | 404 | |
405 | 405 | $distance = abs($planet_dst['system'] - $planet_src['system']); |
406 | 406 | $mip_range = flt_get_missile_range($user); |
407 | - if($distance > $mip_range || $planet_dst['galaxy'] != $planet_src['galaxy']) { |
|
407 | + if ($distance > $mip_range || $planet_dst['galaxy'] != $planet_src['galaxy']) { |
|
408 | 408 | return $result = FLIGHT_MISSION_MISSILE_TOO_FAR; |
409 | 409 | } |
410 | 410 | |
411 | - if(isset($options['target_structure']) && $options['target_structure'] && !in_array($options['target_structure'], sn_get_groups('defense_active'))) { |
|
411 | + if (isset($options['target_structure']) && $options['target_structure'] && !in_array($options['target_structure'], sn_get_groups('defense_active'))) { |
|
412 | 412 | return $result = FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE; |
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
416 | - if($mission == MT_DESTROY && $planet_dst['planet_type'] != PT_MOON) { |
|
416 | + if ($mission == MT_DESTROY && $planet_dst['planet_type'] != PT_MOON) { |
|
417 | 417 | return $result = FLIGHT_MISSION_IMPOSSIBLE; |
418 | 418 | } |
419 | 419 | |
420 | - if($mission == MT_ATTACK || $mission == MT_ACS || $mission == MT_DESTROY) { |
|
420 | + if ($mission == MT_ATTACK || $mission == MT_ACS || $mission == MT_DESTROY) { |
|
421 | 421 | return $result = flt_bashing_check($user, $enemy, $planet_dst, $mission, $travel_data['duration'], $fleet_group); |
422 | 422 | } |
423 | 423 | |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $from = $from['planet']; |
445 | 445 | |
446 | 446 | $can_attack = flt_can_attack($from, $to, $fleet_REAL_array, $mission, $options); |
447 | - if($can_attack != FLIGHT_ALLOWED) { |
|
447 | + if ($can_attack != FLIGHT_ALLOWED) { |
|
448 | 448 | $internal_transaction ? sn_db_transaction_rollback() : false; |
449 | 449 | |
450 | 450 | return $can_attack; |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | $travel_data = flt_travel_data($user, $from, $to, $fleet_REAL_array, $options['fleet_speed_percent']); |
456 | 456 | |
457 | 457 | $time_on_mission = 0; |
458 | - if($mission == MT_EXPLORE || $mission == MT_HOLD) { |
|
458 | + if ($mission == MT_EXPLORE || $mission == MT_HOLD) { |
|
459 | 459 | // TODO - include some checks about maximum and minumum stay_duration |
460 | 460 | $time_on_mission = $options['stay_time'] * 3600; |
461 | 461 | } |
@@ -478,14 +478,14 @@ discard block |
||
478 | 478 | $sn_group_resources_loot = sn_get_groups('resources_loot'); |
479 | 479 | $db_changeset = array(); |
480 | 480 | $planet_row_changed_fields = array(); |
481 | - foreach($fleet_REAL_array as $unit_id => $amount) { |
|
482 | - if(!$amount || !$unit_id) { |
|
481 | + foreach ($fleet_REAL_array as $unit_id => $amount) { |
|
482 | + if (!$amount || !$unit_id) { |
|
483 | 483 | continue; |
484 | 484 | } |
485 | 485 | |
486 | - if(in_array($unit_id, $sn_group_fleet)) { |
|
486 | + if (in_array($unit_id, $sn_group_fleet)) { |
|
487 | 487 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, -$amount, $user, $from['id']); |
488 | - } elseif(in_array($unit_id, $sn_group_resources_loot)) { |
|
488 | + } elseif (in_array($unit_id, $sn_group_resources_loot)) { |
|
489 | 489 | $planet_row_changed_fields[pname_resource_name($unit_id)]['delta'] -= $amount; |
490 | 490 | } |
491 | 491 | } |
@@ -524,16 +524,16 @@ discard block |
||
524 | 524 | |
525 | 525 | $ship_data = array(); |
526 | 526 | $fleet_array = array(); |
527 | - foreach($ship_list as $transport_id => $cork) { |
|
527 | + foreach ($ship_list as $transport_id => $cork) { |
|
528 | 528 | $ship_data[$transport_id] = flt_travel_data($user, $from, $to, array($transport_id => 1), 10); |
529 | 529 | } |
530 | 530 | uasort($ship_data, 'flt_calculate_ship_to_transport_sort'); |
531 | 531 | |
532 | 532 | $fleet_capacity = 0; |
533 | 533 | $fuel_total = $fuel_left = mrc_get_level($user, $from, RES_DEUTERIUM); |
534 | - foreach($ship_data as $transport_id => &$ship_info) { |
|
534 | + foreach ($ship_data as $transport_id => &$ship_info) { |
|
535 | 535 | $ship_loaded = min($ship_list[$transport_id], ceil($resource_amount / $ship_info['hold']), floor($fuel_left / $ship_info['consumption'])); |
536 | - if($ship_loaded) { |
|
536 | + if ($ship_loaded) { |
|
537 | 537 | $fleet_array[$transport_id] = $ship_loaded; |
538 | 538 | $resource_amount -= min($resource_amount, $ship_info['hold'] * $ship_loaded); |
539 | 539 | $fuel_left -= $ship_info['consumption'] * $ship_loaded; |
@@ -6,26 +6,26 @@ discard block |
||
6 | 6 | $fleet_events = array(); |
7 | 7 | $fleet_number = 0; |
8 | 8 | |
9 | - if($objFleetList->count() <= 0) { |
|
9 | + if ($objFleetList->count() <= 0) { |
|
10 | 10 | return; |
11 | 11 | } |
12 | 12 | |
13 | - foreach($objFleetList->_container as $objFleet) { |
|
13 | + foreach ($objFleetList->_container as $objFleet) { |
|
14 | 14 | $planet_start_type = $objFleet->fleet_start_type == PT_MOON ? PT_MOON : PT_PLANET; |
15 | 15 | $planet_start = db_planet_by_gspt($objFleet->fleet_start_galaxy, $objFleet->fleet_start_system, $objFleet->fleet_start_planet, $planet_start_type, false, 'name'); |
16 | 16 | $objFleet->fleet_start_name = $planet_start['name']; |
17 | 17 | |
18 | 18 | $planet_end_type = $objFleet->fleet_end_type == PT_MOON ? PT_MOON : PT_PLANET; |
19 | - if($objFleet->fleet_end_planet > Vector::$knownPlanets) { |
|
19 | + if ($objFleet->fleet_end_planet > Vector::$knownPlanets) { |
|
20 | 20 | $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_exploration']; |
21 | - } elseif($objFleet->mission_type == MT_COLONIZE) { |
|
21 | + } elseif ($objFleet->mission_type == MT_COLONIZE) { |
|
22 | 22 | $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_colonization']; |
23 | 23 | } else { |
24 | 24 | $planet_end = db_planet_by_gspt($objFleet->fleet_end_galaxy, $objFleet->fleet_end_system, $objFleet->fleet_end_planet, $planet_end_type, false, 'name'); |
25 | 25 | $objFleet->fleet_end_name = $planet_end['name']; |
26 | 26 | } |
27 | 27 | |
28 | - if($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE && |
|
28 | + if ($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE && |
|
29 | 29 | ($planet_scanned === false |
30 | 30 | || |
31 | 31 | ( |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | $fleet_events[] = flt_register_event_objFleet($objFleet, 0, $planet_end_type); |
40 | 40 | } |
41 | 41 | |
42 | - if($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) { |
|
42 | + if ($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) { |
|
43 | 43 | $fleet_events[] = flt_register_event_objFleet($objFleet, 1, $planet_end_type); |
44 | 44 | } |
45 | 45 | |
46 | - if( |
|
46 | + if ( |
|
47 | 47 | $objFleet->time_return_to_source > SN_TIME_NOW && $objFleet->mission_type != MT_MISSILE && ($objFleet->isReturning() || ($objFleet->mission_type != MT_RELOCATE && $objFleet->mission_type != MT_COLONIZE)) && |
48 | 48 | ( |
49 | 49 | ($planet_scanned === false && $objFleet->playerOwnerId == $user['id']) |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $fleet_events[] = flt_register_event_objFleet($objFleet, 2, $planet_end_type); |
60 | 60 | } |
61 | 61 | |
62 | - if($objFleet->mission_type == MT_MISSILE) { |
|
62 | + if ($objFleet->mission_type == MT_MISSILE) { |
|
63 | 63 | $fleet_events[] = flt_register_event_objFleet($objFleet, 3, $planet_end_type); |
64 | 64 | } |
65 | 65 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $is_this_planet = false; |
81 | 81 | |
82 | - switch($objFleet->ov_label = $ov_label) { |
|
82 | + switch ($objFleet->ov_label = $ov_label) { |
|
83 | 83 | case 0: |
84 | 84 | $objFleet->event_time = $objFleet->time_arrive_to_target; |
85 | 85 | $is_this_planet = ( |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | } |
112 | 112 | |
113 | - $objFleet->ov_this_planet = $is_this_planet;// || $planet_scanned != false; |
|
113 | + $objFleet->ov_this_planet = $is_this_planet; // || $planet_scanned != false; |
|
114 | 114 | |
115 | - if($objFleet->playerOwnerId == $user['id']) { |
|
115 | + if ($objFleet->playerOwnerId == $user['id']) { |
|
116 | 116 | $user_data = $user; |
117 | 117 | } else { |
118 | 118 | $user_data = db_user_by_id($objFleet->playerOwnerId); |
@@ -333,26 +333,26 @@ discard block |
||
333 | 333 | // Each mission will filter only necessary checks and do it in this order |
334 | 334 | 'mission_checks' => array( |
335 | 335 | // Cheap checks - class Fleet already have all this info internally |
336 | - 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, //+ |
|
337 | - 'checkTargetNoVacation' => FLIGHT_PLAYER_VACATION, //+ |
|
338 | - 'checkFleetNotEmpty' => FLIGHT_SHIPS_NO_SHIPS, //+ |
|
336 | + 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, //+ |
|
337 | + 'checkTargetNoVacation' => FLIGHT_PLAYER_VACATION, //+ |
|
338 | + 'checkFleetNotEmpty' => FLIGHT_SHIPS_NO_SHIPS, //+ |
|
339 | 339 | // FLIGHT_MISSION_UNKNOWN |
340 | 340 | // FLIGHT_RESOURCES_FORBIDDEN |
341 | - 'checkSpeedPercentOld' => FLIGHT_FLEET_SPEED_WRONG, //+ |
|
342 | - 'checkTargetNotSource' => FLIGHT_VECTOR_SAME_SOURCE, //+ |
|
341 | + 'checkSpeedPercentOld' => FLIGHT_FLEET_SPEED_WRONG, //+ |
|
342 | + 'checkTargetNotSource' => FLIGHT_VECTOR_SAME_SOURCE, //+ |
|
343 | 343 | 'checkTargetInUniverse' => FLIGHT_VECTOR_BEYOND_UNIVERSE, |
344 | - 'checkUnitsPositive' => FLIGHT_SHIPS_NEGATIVE, //+ |
|
344 | + 'checkUnitsPositive' => FLIGHT_SHIPS_NEGATIVE, //+ |
|
345 | 345 | 'checkOnlyFleetUnits' => FLIGHT_SHIPS_UNIT_WRONG, |
346 | - 'checkOnlyFlyingUnits' => FLIGHT_SHIPS_UNMOVABLE, //+ |
|
347 | - 'checkResourcesPositive' => FLIGHT_RESOURCES_NEGATIVE, //+ |
|
348 | - 'checkNotTooFar' => FLIGHT_FLEET_TOO_FAR, //+ |
|
349 | - 'checkEnoughCapacity' => FLIGHT_FLEET_OVERLOAD, //+ |
|
346 | + 'checkOnlyFlyingUnits' => FLIGHT_SHIPS_UNMOVABLE, //+ |
|
347 | + 'checkResourcesPositive' => FLIGHT_RESOURCES_NEGATIVE, //+ |
|
348 | + 'checkNotTooFar' => FLIGHT_FLEET_TOO_FAR, //+ |
|
349 | + 'checkEnoughCapacity' => FLIGHT_FLEET_OVERLOAD, //+ |
|
350 | 350 | // Medium checks - currently requires access to DB but potentially doesn't |
351 | - 'checkSourceEnoughShips' => FLIGHT_SHIPS_NOT_ENOUGH, //+ |
|
352 | - 'checkSourceEnoughFuel' => FLIGHT_RESOURCES_FUEL_NOT_ENOUGH, //+ |
|
353 | - 'checkSourceEnoughResources' => FLIGHT_RESOURCES_NOT_ENOUGH, //+ |
|
351 | + 'checkSourceEnoughShips' => FLIGHT_SHIPS_NOT_ENOUGH, //+ |
|
352 | + 'checkSourceEnoughFuel' => FLIGHT_RESOURCES_FUEL_NOT_ENOUGH, //+ |
|
353 | + 'checkSourceEnoughResources' => FLIGHT_RESOURCES_NOT_ENOUGH, //+ |
|
354 | 354 | // Heavy checks - will absolutely require DB access |
355 | - 'checkEnoughFleetSlots' => FLIGHT_FLEET_NO_SLOTS, //+ |
|
355 | + 'checkEnoughFleetSlots' => FLIGHT_FLEET_NO_SLOTS, //+ |
|
356 | 356 | |
357 | 357 | // Vector targeting space beyond MaxPlanet forces MT_EXPLORE mission |
358 | 358 | 'checkKnownSpace' => array( |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | 'checkNotOnlySpies' => FLIGHT_SHIPS_NOT_ONLY_SPIES, |
363 | 363 | 'checkNoMissiles' => FLIGHT_SHIPS_NO_MISSILES, |
364 | 364 | 'forceMissionExplore' => array( |
365 | - true => FLIGHT_ALLOWED, //+ |
|
365 | + true => FLIGHT_ALLOWED, //+ |
|
366 | 366 | false => FLIGHT_VECTOR_BEYOND_SYSTEM, |
367 | 367 | ), |
368 | 368 | ), |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | 'checkNoMissiles' => FLIGHT_SHIPS_NO_MISSILES, |
378 | 378 | 'checkTargetIsPlanet' => FLIGHT_MISSION_COLONIZE_NOT_PLANET, |
379 | 379 | 'forceMissionColonize' => array( |
380 | - true => FLIGHT_ALLOWED, //+ |
|
380 | + true => FLIGHT_ALLOWED, //+ |
|
381 | 381 | false => FLIGHT_VECTOR_NO_TARGET, |
382 | 382 | ), |
383 | 383 | ), |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | 'checkTargetIsDebris' => array( |
389 | 389 | true => array( |
390 | 390 | // Recycle mission checks |
391 | - 'checkHaveRecyclers' => FLIGHT_SHIPS_NO_RECYCLERS, //+ |
|
391 | + 'checkHaveRecyclers' => FLIGHT_SHIPS_NO_RECYCLERS, //+ |
|
392 | 392 | 'checkNoMissiles' => FLIGHT_SHIPS_NO_MISSILES, |
393 | - 'checkDebrisExists' => FLIGHT_MISSION_RECYCLE_NO_DEBRIS, //+ |
|
393 | + 'checkDebrisExists' => FLIGHT_MISSION_RECYCLE_NO_DEBRIS, //+ |
|
394 | 394 | 'forceMissionRecycle' => array( |
395 | - true => FLIGHT_ALLOWED, //+ |
|
395 | + true => FLIGHT_ALLOWED, //+ |
|
396 | 396 | false => FLIGHT_VECTOR_TARGET_DEBRIS, |
397 | 397 | ), |
398 | 398 | ), |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | |
489 | 489 | |
490 | 490 | // Check for multiaccount |
491 | - 'checkMultiAccount' => FLIGHT_PLAYER_SAME_IP, //+ |
|
491 | + 'checkMultiAccount' => FLIGHT_PLAYER_SAME_IP, //+ |
|
492 | 492 | // TODO - check for moratorium |
493 | 493 | |
494 | 494 |