@@ -1,7 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function eco_lab_sort_effectivness($a, $b) |
|
4 | -{ |
|
3 | +function eco_lab_sort_effectivness($a, $b) { |
|
5 | 4 | return $a['laboratory_effective_level'] > $b['laboratory_effective_level'] ? -1 : ($a['laboratory_effective_level'] < $b['laboratory_effective_level'] ? 1 : 0); |
6 | 5 | } |
7 | 6 | |
@@ -11,8 +10,7 @@ discard block |
||
11 | 10 | * 1.0 - copyright (c) 2010 by Gorlum for http://supernova.ws |
12 | 11 | * @version 1.0 |
13 | 12 | */ |
14 | -function eco_get_lab_max_effective_level(&$user, $lab_require) |
|
15 | -{ |
|
13 | +function eco_get_lab_max_effective_level(&$user, $lab_require) { |
|
16 | 14 | if(!$user['user_as_ally'] && !isset($user['laboratories_active'])) |
17 | 15 | { |
18 | 16 | $user['laboratories_active'] = array(); |
@@ -38,8 +36,7 @@ discard block |
||
38 | 36 | if($user['user_as_ally']) |
39 | 37 | { |
40 | 38 | $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true); |
41 | - } |
|
42 | - else |
|
39 | + } else |
|
43 | 40 | { |
44 | 41 | $tech_intergalactic = mrc_get_level($user, false, TECH_RESEARCH) + 1; |
45 | 42 | $lab_level['effective_level'] = 0; |
@@ -193,8 +190,7 @@ discard block |
||
193 | 190 | return $result; |
194 | 191 | } |
195 | 192 | |
196 | -function eco_is_builds_in_que($planet_que, $unit_list) |
|
197 | -{ |
|
193 | +function eco_is_builds_in_que($planet_que, $unit_list) { |
|
198 | 194 | $eco_is_builds_in_que = false; |
199 | 195 | |
200 | 196 | $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list); |
@@ -216,8 +212,7 @@ discard block |
||
216 | 212 | } |
217 | 213 | |
218 | 214 | function eco_unit_busy(&$user, &$planet, $unit_id){return sn_function_call('eco_unit_busy', array(&$user, &$planet, $unit_id, &$result));} |
219 | -function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) |
|
220 | -{ |
|
215 | +function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) { |
|
221 | 216 | global $config; |
222 | 217 | |
223 | 218 | $result = isset($result) ? $result : false; |
@@ -238,8 +233,7 @@ discard block |
||
238 | 233 | //{ |
239 | 234 | // $result = true; |
240 | 235 | //} |
241 | - } |
|
242 | - elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
236 | + } elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
243 | 237 | { |
244 | 238 | $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO)); |
245 | 239 | } |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function eco_get_lab_max_effective_level(&$user, $lab_require) |
15 | 15 | { |
16 | - if(!$user['user_as_ally'] && !isset($user['laboratories_active'])) |
|
16 | + if (!$user['user_as_ally'] && !isset($user['laboratories_active'])) |
|
17 | 17 | { |
18 | 18 | $user['laboratories_active'] = array(); |
19 | 19 | $query = DBStaticUnit::db_unit_list_laboratories($user['id']); |
20 | - while($row = db_fetch($query)) |
|
20 | + while ($row = db_fetch($query)) |
|
21 | 21 | { |
22 | - if(!eco_unit_busy($user, $row, UNIT_TECHNOLOGIES)) |
|
22 | + if (!eco_unit_busy($user, $row, UNIT_TECHNOLOGIES)) |
|
23 | 23 | { |
24 | 24 | $row += array( |
25 | 25 | STRUC_LABORATORY => $level_lab = mrc_get_level($user, $row, STRUC_LABORATORY), |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | uasort($user['laboratories_active'], 'eco_lab_sort_effectivness'); |
34 | 34 | } |
35 | 35 | |
36 | - if(!isset($user['research_effective_level'][$lab_require])) |
|
36 | + if (!isset($user['research_effective_level'][$lab_require])) |
|
37 | 37 | { |
38 | - if($user['user_as_ally']) |
|
38 | + if ($user['user_as_ally']) |
|
39 | 39 | { |
40 | 40 | $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true); |
41 | 41 | } |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | $tech_intergalactic = mrc_get_level($user, false, TECH_RESEARCH) + 1; |
45 | 45 | $lab_level['effective_level'] = 0; |
46 | 46 | |
47 | - foreach($user['laboratories_active'] as $data) |
|
47 | + foreach ($user['laboratories_active'] as $data) |
|
48 | 48 | { |
49 | - if($tech_intergalactic <= 0) |
|
49 | + if ($tech_intergalactic <= 0) |
|
50 | 50 | { |
51 | 51 | break; |
52 | 52 | } |
53 | - if($data[STRUC_LABORATORY] >= $lab_require) |
|
53 | + if ($data[STRUC_LABORATORY] >= $lab_require) |
|
54 | 54 | { |
55 | 55 | $lab_level['effective_level'] += $data['laboratory_effective_level']; |
56 | 56 | $tech_intergalactic--; |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | $cost[P_OPTIONS][P_TIME_RAW] = 0; |
91 | 91 | $only_dark_matter = 0; |
92 | 92 | $cost_in_metal = 0; |
93 | - foreach($unit_data[P_COST] as $resource_id => $resource_amount) { |
|
94 | - if($resource_id === P_FACTOR || !($resource_cost = $resource_amount * $price_increase)) { |
|
93 | + foreach ($unit_data[P_COST] as $resource_id => $resource_amount) { |
|
94 | + if ($resource_id === P_FACTOR || !($resource_cost = $resource_amount * $price_increase)) { |
|
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | |
103 | 103 | $cost_in_metal += $cost[BUILD_CREATE][$resource_id] * $currentResourceExchange; |
104 | 104 | |
105 | - if(in_array($resource_id, $resources_loot)) { |
|
105 | + if (in_array($resource_id, $resources_loot)) { |
|
106 | 106 | $cost[P_OPTIONS][P_TIME_RAW] += $resource_cost * $currentResourceExchange / $rpg_exchange_deuterium; |
107 | 107 | $resource_got = mrc_get_level($user, $planet, $resource_id); |
108 | - } elseif($resource_id == RES_DARK_MATTER) { |
|
108 | + } elseif ($resource_id == RES_DARK_MATTER) { |
|
109 | 109 | $resource_got = mrc_get_level($user, null, $resource_id); |
110 | - } elseif($resource_id == RES_ENERGY) { |
|
110 | + } elseif ($resource_id == RES_ENERGY) { |
|
111 | 111 | $resource_got = max(0, $planet['energy_max'] - $planet['energy_used']); |
112 | 112 | } else { |
113 | 113 | $resource_got = 0; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | $resources_normalized = 0; |
122 | - foreach($resources_loot as $resource_id) { |
|
122 | + foreach ($resources_loot as $resource_id) { |
|
123 | 123 | $resources_normalized += floor(mrc_get_level($user, $planet, $resource_id)) * $config->__get('rpg_exchange_' . pname_resource_name($resource_id)); |
124 | 124 | } |
125 | 125 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $cost[P_OPTIONS][P_TIME_RAW] = $cost[P_OPTIONS][P_TIME_RAW] * 60 * 60 / get_game_speed() / 2500; |
136 | 136 | |
137 | 137 | // TODO - Вынести в отдельную процедуру расчёт стоимости |
138 | - if($only_cost) { |
|
138 | + if ($only_cost) { |
|
139 | 139 | return $cost; |
140 | 140 | } |
141 | 141 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $cost['RESULT'][BUILD_DESTROY] = BUILD_INDESTRUCTABLE; |
148 | 148 | |
149 | 149 | $mercenary = 0; |
150 | - if(in_array($unit_id, sn_get_groups('structures'))) { |
|
150 | + if (in_array($unit_id, sn_get_groups('structures'))) { |
|
151 | 151 | $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_ROBOT) + 1); |
152 | 152 | $cost['RESULT'][BUILD_DESTROY] = |
153 | 153 | mrc_get_level($user, $planet, $unit_id, false, true) |
@@ -157,23 +157,23 @@ discard block |
||
157 | 157 | ) |
158 | 158 | : BUILD_NO_UNITS; |
159 | 159 | $mercenary = MRC_ENGINEER; |
160 | - } elseif(in_array($unit_id, sn_get_groups('tech'))) { |
|
160 | + } elseif (in_array($unit_id, sn_get_groups('tech'))) { |
|
161 | 161 | $lab_level = eco_get_lab_max_effective_level($user, intval($unit_data['require'][STRUC_LABORATORY])); |
162 | 162 | $cost[RES_TIME][BUILD_CREATE] /= $lab_level; |
163 | 163 | $mercenary = MRC_ACADEMIC; |
164 | - } elseif(in_array($unit_id, sn_get_groups('defense'))) { |
|
165 | - $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1) ; |
|
164 | + } elseif (in_array($unit_id, sn_get_groups('defense'))) { |
|
165 | + $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1); |
|
166 | 166 | $mercenary = MRC_FORTIFIER; |
167 | - } elseif(in_array($unit_id, sn_get_groups('fleet'))) { |
|
167 | + } elseif (in_array($unit_id, sn_get_groups('fleet'))) { |
|
168 | 168 | $cost[RES_TIME][BUILD_CREATE] *= pow(0.5, mrc_get_level($user, $planet, STRUC_FACTORY_NANO)) / (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) + 1); |
169 | 169 | $mercenary = MRC_ENGINEER; |
170 | 170 | } |
171 | 171 | |
172 | - if($mercenary) { |
|
172 | + if ($mercenary) { |
|
173 | 173 | $cost[RES_TIME][BUILD_CREATE] = $cost[RES_TIME][BUILD_CREATE] / mrc_modify_value($user, $planet, $mercenary, 1); |
174 | 174 | } |
175 | 175 | |
176 | - if(in_array($unit_id, sn_get_groups('governors')) || $only_dark_matter) { |
|
176 | + if (in_array($unit_id, sn_get_groups('governors')) || $only_dark_matter) { |
|
177 | 177 | $cost[RES_TIME][BUILD_CREATE] = $cost[RES_TIME][BUILD_DESTROY] = 0; |
178 | 178 | } else { |
179 | 179 | $cost[RES_TIME][BUILD_CREATE] = round($cost[RES_TIME][BUILD_CREATE] > 1 ? $cost[RES_TIME][BUILD_CREATE] : 1); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | return $cost; |
184 | 184 | } |
185 | 185 | |
186 | -function eco_can_build_unit($user, $planet, $unit_id){return sn_function_call('eco_can_build_unit', array($user, $planet, $unit_id, &$result));} |
|
186 | +function eco_can_build_unit($user, $planet, $unit_id) {return sn_function_call('eco_can_build_unit', array($user, $planet, $unit_id, &$result)); } |
|
187 | 187 | function sn_eco_can_build_unit($user, $planet, $unit_id, &$result) { |
188 | 188 | global $config; |
189 | 189 | |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | $result = $result == BUILD_ALLOWED && eco_unit_busy($user, $planet, $unit_id) ? BUILD_UNIT_BUSY : $result; |
192 | 192 | |
193 | 193 | $unit_param = get_unit_param($unit_id); |
194 | - if($unit_param[P_UNIT_TYPE] != UNIT_MERCENARIES || !$config->empire_mercenary_temporary) { |
|
194 | + if ($unit_param[P_UNIT_TYPE] != UNIT_MERCENARIES || !$config->empire_mercenary_temporary) { |
|
195 | 195 | $requirement = &$unit_param[P_REQUIRE]; |
196 | - if($result == BUILD_ALLOWED && $requirement) { |
|
197 | - foreach($requirement as $require_id => $require_level) { |
|
198 | - if(mrc_get_level($user, $planet, $require_id) < $require_level) { |
|
196 | + if ($result == BUILD_ALLOWED && $requirement) { |
|
197 | + foreach ($requirement as $require_id => $require_level) { |
|
198 | + if (mrc_get_level($user, $planet, $require_id) < $require_level) { |
|
199 | 199 | $result = BUILD_REQUIRE_NOT_MEET; |
200 | 200 | break; |
201 | 201 | } |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | |
213 | 213 | $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list); |
214 | 214 | $planet_que = explode(';', $planet_que); |
215 | - foreach($planet_que as $planet_que_item) |
|
215 | + foreach ($planet_que as $planet_que_item) |
|
216 | 216 | { |
217 | - if($planet_que_item) |
|
217 | + if ($planet_que_item) |
|
218 | 218 | { |
219 | 219 | list($planet_que_item) = explode(',', $planet_que_item); |
220 | - if(in_array($planet_que_item, $unit_list)) |
|
220 | + if (in_array($planet_que_item, $unit_list)) |
|
221 | 221 | { |
222 | 222 | $eco_is_builds_in_que = true; |
223 | 223 | break; |
@@ -228,21 +228,21 @@ discard block |
||
228 | 228 | return $eco_is_builds_in_que; |
229 | 229 | } |
230 | 230 | |
231 | -function eco_unit_busy(&$user, &$planet, $unit_id){return sn_function_call('eco_unit_busy', array(&$user, &$planet, $unit_id, &$result));} |
|
231 | +function eco_unit_busy(&$user, &$planet, $unit_id) {return sn_function_call('eco_unit_busy', array(&$user, &$planet, $unit_id, &$result)); } |
|
232 | 232 | function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) |
233 | 233 | { |
234 | 234 | global $config; |
235 | 235 | |
236 | 236 | $result = isset($result) ? $result : false; |
237 | - if(!$result) |
|
237 | + if (!$result) |
|
238 | 238 | { |
239 | - if(($unit_id == STRUC_LABORATORY || $unit_id == STRUC_LABORATORY_NANO) && !$config->BuildLabWhileRun) |
|
239 | + if (($unit_id == STRUC_LABORATORY || $unit_id == STRUC_LABORATORY_NANO) && !$config->BuildLabWhileRun) |
|
240 | 240 | { |
241 | 241 | $global_que = que_get($user['id'], $planet['id'], QUE_RESEARCH, false); |
242 | - if(is_array($global_que['ques'][QUE_RESEARCH][$user['id']])) |
|
242 | + if (is_array($global_que['ques'][QUE_RESEARCH][$user['id']])) |
|
243 | 243 | { |
244 | 244 | $first_element = reset($global_que['ques'][QUE_RESEARCH][$user['id']]); |
245 | - if(is_array($first_element)) |
|
245 | + if (is_array($first_element)) |
|
246 | 246 | { |
247 | 247 | $result = true; |
248 | 248 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | // $result = true; |
253 | 253 | //} |
254 | 254 | } |
255 | - elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
255 | + elseif (($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
256 | 256 | { |
257 | 257 | $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO)); |
258 | 258 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | function flt_mission_hold(&$mission_data) |
4 | 4 | { |
5 | - if($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
|
5 | + if ($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
|
6 | 6 | { |
7 | 7 | fleet_send_back($mission_data['fleet']); |
8 | 8 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"); |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function flt_mission_hold(&$mission_data) |
|
4 | -{ |
|
3 | +function flt_mission_hold(&$mission_data) { |
|
5 | 4 | if($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
6 | 5 | { |
7 | 6 | fleet_send_back($mission_data['fleet']); |
@@ -7,8 +7,7 @@ discard block |
||
7 | 7 | * @copyright 2008 By Chlorel for XNova |
8 | 8 | */ |
9 | 9 | |
10 | -function flt_mission_recycle(&$mission_data) |
|
11 | -{ |
|
10 | +function flt_mission_recycle(&$mission_data) { |
|
12 | 11 | $fleet_row = &$mission_data['fleet']; |
13 | 12 | $destination_planet = &$mission_data['dst_planet']; |
14 | 13 | |
@@ -37,8 +36,7 @@ discard block |
||
37 | 36 | if(in_array($unit_id, sn_get_groups('flt_recyclers'))) |
38 | 37 | { |
39 | 38 | $RecyclerCapacity += $capacity; |
40 | - } |
|
41 | - else |
|
39 | + } else |
|
42 | 40 | { |
43 | 41 | $OtherFleetCapacity += $capacity; |
44 | 42 | } |
@@ -55,16 +53,14 @@ discard block |
||
55 | 53 | { |
56 | 54 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
57 | 55 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
58 | - } |
|
59 | - else |
|
56 | + } else |
|
60 | 57 | { |
61 | 58 | if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
62 | 59 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)) |
63 | 60 | { |
64 | 61 | $RecycledGoods["metal"] = $RecyclerCapacity / 2; |
65 | 62 | $RecycledGoods["crystal"] = $RecyclerCapacity / 2; |
66 | - } |
|
67 | - else |
|
63 | + } else |
|
68 | 64 | { |
69 | 65 | if ($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) |
70 | 66 | { |
@@ -72,20 +68,17 @@ discard block |
||
72 | 68 | if ($destination_planet["debris_metal"] > ($RecyclerCapacity - $RecycledGoods["crystal"])) |
73 | 69 | { |
74 | 70 | $RecycledGoods["metal"] = $RecyclerCapacity - $RecycledGoods["crystal"]; |
75 | - } |
|
76 | - else |
|
71 | + } else |
|
77 | 72 | { |
78 | 73 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
79 | 74 | } |
80 | - } |
|
81 | - else |
|
75 | + } else |
|
82 | 76 | { |
83 | 77 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
84 | 78 | if ($destination_planet["debris_crystal"] > ($RecyclerCapacity - $RecycledGoods["metal"])) |
85 | 79 | { |
86 | 80 | $RecycledGoods["crystal"] = $RecyclerCapacity - $RecycledGoods["metal"]; |
87 | - } |
|
88 | - else |
|
81 | + } else |
|
89 | 82 | { |
90 | 83 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
91 | 84 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
61 | - if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
|
61 | + if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) and |
|
62 | 62 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)) |
63 | 63 | { |
64 | 64 | $RecycledGoods["metal"] = $RecyclerCapacity / 2; |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | $fleet_row = &$mission_data['fleet']; |
13 | 13 | $destination_planet = &$mission_data['dst_planet']; |
14 | 14 | |
15 | - if(!$fleet_row) |
|
15 | + if (!$fleet_row) |
|
16 | 16 | { |
17 | 17 | return CACHE_NOTHING; |
18 | 18 | } |
19 | 19 | |
20 | - if(!isset($destination_planet['id'])) |
|
20 | + if (!isset($destination_planet['id'])) |
|
21 | 21 | { |
22 | 22 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); |
23 | 23 | fleet_send_back($mission_data['fleet']); |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | $RecyclerCapacity = 0; |
30 | 30 | $OtherFleetCapacity = 0; |
31 | 31 | $fleet_array = sys_unit_str2arr($fleet_row['fleet_array']); |
32 | - foreach($fleet_array as $unit_id => $unit_count) |
|
32 | + foreach ($fleet_array as $unit_id => $unit_count) |
|
33 | 33 | { |
34 | - if(in_array($unit_id, sn_get_groups('fleet'))) |
|
34 | + if (in_array($unit_id, sn_get_groups('fleet'))) |
|
35 | 35 | { |
36 | 36 | $capacity = get_unit_param($unit_id, P_CAPACITY) * $unit_count; |
37 | - if(in_array($unit_id, sn_get_groups('flt_recyclers'))) |
|
37 | + if (in_array($unit_id, sn_get_groups('flt_recyclers'))) |
|
38 | 38 | { |
39 | 39 | $RecyclerCapacity += $capacity; |
40 | 40 | } |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | $IncomingFleetGoods = $fleet_row["fleet_resource_metal"] + $fleet_row["fleet_resource_crystal"] + $fleet_row["fleet_resource_deuterium"]; |
49 | - if($IncomingFleetGoods > $OtherFleetCapacity) |
|
49 | + if ($IncomingFleetGoods > $OtherFleetCapacity) |
|
50 | 50 | { |
51 | 51 | $RecyclerCapacity -= ($IncomingFleetGoods - $OtherFleetCapacity); |
52 | 52 | } |
53 | 53 | |
54 | - if(($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) |
|
54 | + if (($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) |
|
55 | 55 | { |
56 | 56 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
57 | 57 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
61 | - if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
|
61 | + if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
|
62 | 62 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)) |
63 | 63 | { |
64 | 64 | $RecycledGoods["metal"] = $RecyclerCapacity / 2; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
95 | - $NewCargo['Metal'] = $fleet_row["fleet_resource_metal"] + $RecycledGoods["metal"]; |
|
95 | + $NewCargo['Metal'] = $fleet_row["fleet_resource_metal"] + $RecycledGoods["metal"]; |
|
96 | 96 | $NewCargo['Crystal'] = $fleet_row["fleet_resource_crystal"] + $RecycledGoods["crystal"]; |
97 | 97 | $NewCargo['Deuterium'] = $fleet_row["fleet_resource_deuterium"]; |
98 | 98 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | HelperString::numberFloorAndFormat($RecycledGoods["metal"]), $lang['Metal'], |
106 | 106 | HelperString::numberFloorAndFormat($RecycledGoods["crystal"]), $lang['Crystal'] |
107 | 107 | ); |
108 | - msg_send_simple_message ( $fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_RECYCLE, $lang['sys_mess_spy_control'], $lang['sys_recy_report'], $Message); |
|
108 | + msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_RECYCLE, $lang['sys_mess_spy_control'], $lang['sys_recy_report'], $Message); |
|
109 | 109 | |
110 | 110 | // $QryUpdateFleet = "UPDATE {{fleets}} SET `fleet_mess` = 1,`fleet_resource_metal` = '{$NewCargo['Metal']}',`fleet_resource_crystal` = '{$NewCargo['Crystal']}',`fleet_resource_deuterium` = '{$NewCargo['Deuterium']}' "; |
111 | 111 | // $QryUpdateFleet .= "WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $fleet_row = &$mission_data['fleet']; |
14 | 14 | $destination_planet = &$mission_data['dst_planet']; |
15 | 15 | |
16 | - if(!$destination_planet || !is_array($destination_planet) || $fleet_row['fleet_owner'] != $destination_planet['id_owner']) |
|
16 | + if (!$destination_planet || !is_array($destination_planet) || $fleet_row['fleet_owner'] != $destination_planet['id_owner']) |
|
17 | 17 | { |
18 | 18 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); |
19 | 19 | fleet_send_back($mission_data['fleet']); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $mission_data['src_planet']['name'], uni_render_coordinates_href($fleet_row, 'fleet_start_', 3, ''), $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), |
27 | 27 | $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']) . |
28 | 28 | '<br />' . $lang['sys_relocate_mess_user']; |
29 | - foreach(sys_unit_str2arr($fleet_row['fleet_array']) as $ship_id => $ship_count) |
|
29 | + foreach (sys_unit_str2arr($fleet_row['fleet_array']) as $ship_id => $ship_count) |
|
30 | 30 | { |
31 | 31 | $Message .= $lang['tech'][$ship_id] . ' - ' . $ship_count . '<br />'; |
32 | 32 | } |
@@ -8,8 +8,7 @@ |
||
8 | 8 | * @version 1.1 |
9 | 9 | * @copyright 2008 by Chlorel for XNova |
10 | 10 | */ |
11 | -function flt_mission_relocate($mission_data) |
|
12 | -{ |
|
11 | +function flt_mission_relocate($mission_data) { |
|
13 | 12 | $fleet_row = &$mission_data['fleet']; |
14 | 13 | $destination_planet = &$mission_data['dst_planet']; |
15 | 14 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | function flt_mission_destroy($mission_data) { |
9 | 9 | $fleet_row = $mission_data['fleet']; |
10 | 10 | $destination_planet = $mission_data['dst_planet']; |
11 | - if(!$destination_planet || !is_array($destination_planet) || $destination_planet['planet_type'] != PT_MOON) { |
|
11 | + if (!$destination_planet || !is_array($destination_planet) || $destination_planet['planet_type'] != PT_MOON) { |
|
12 | 12 | fleet_send_back($fleet_row); |
13 | 13 | |
14 | 14 | return CACHE_FLEET; |
@@ -170,7 +170,7 @@ |
||
170 | 170 | |
171 | 171 | function upd_db_unit_by_location($user_id = 0, $location_type, $location_id, $unit_snid = 0, $for_update = false, $fields = '*') { |
172 | 172 | return db_fetch(upd_do_query( |
173 | - "SELECT {$fields} |
|
173 | + "select {$fields} |
|
174 | 174 | FROM {{unit}} |
175 | 175 | WHERE |
176 | 176 | `unit_location_type` = {$location_type} AND `unit_location_id` = {$location_id} AND " . DBStaticUnit::db_unit_time_restrictions() . |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $source_planet = &$mission_data['src_planet']; |
15 | 15 | $destination_planet = &$mission_data['dst_planet']; |
16 | 16 | |
17 | - if(!isset($destination_planet['id']) || !$destination_planet['id_owner']) |
|
17 | + if (!isset($destination_planet['id']) || !$destination_planet['id_owner']) |
|
18 | 18 | { |
19 | 19 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); |
20 | 20 | fleet_send_back($fleet_row); |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), |
28 | 28 | $fleet_row['fleet_resource_metal'], $lang['Metal'], |
29 | 29 | $fleet_row['fleet_resource_crystal'], $lang['Crystal'], |
30 | - $fleet_row['fleet_resource_deuterium'], $lang['Deuterium'] ); |
|
30 | + $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']); |
|
31 | 31 | msg_send_simple_message($fleet_row['fleet_target_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); |
32 | 32 | |
33 | - if($fleet_row['fleet_target_owner'] <> $fleet_row['fleet_owner']) |
|
33 | + if ($fleet_row['fleet_target_owner'] <> $fleet_row['fleet_owner']) |
|
34 | 34 | { |
35 | 35 | msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); |
36 | 36 | } |
@@ -8,8 +8,7 @@ |
||
8 | 8 | * @copyright 2008 By Chlorel for XNova |
9 | 9 | */ |
10 | 10 | |
11 | -function flt_mission_transport(&$mission_data) |
|
12 | -{ |
|
11 | +function flt_mission_transport(&$mission_data) { |
|
13 | 12 | $fleet_row = &$mission_data['fleet']; |
14 | 13 | $source_planet = &$mission_data['src_planet']; |
15 | 14 | $destination_planet = &$mission_data['dst_planet']; |
@@ -5,14 +5,14 @@ |
||
5 | 5 | */ |
6 | 6 | global $template; |
7 | 7 | |
8 | -if(isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) { |
|
8 | +if (isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) { |
|
9 | 9 | require_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
10 | - if($sn_page_name) { |
|
10 | + if ($sn_page_name) { |
|
11 | 11 | // Loading page-specific language files |
12 | 12 | |
13 | 13 | !empty($sn_mvc['model'][$sn_page_name]) and execute_hooks($sn_mvc['model'][$sn_page_name], $template, 'model', $sn_page_name); |
14 | 14 | !empty($sn_mvc['view'][$sn_page_name]) and execute_hooks($sn_mvc['view'][$sn_page_name], $template, 'view', $sn_page_name); |
15 | - if(!empty($template_result) && is_object($template)) { |
|
15 | + if (!empty($template_result) && is_object($template)) { |
|
16 | 16 | $template->assign_recursive($template_result); |
17 | 17 | } |
18 | 18 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | define('IN_AJAX', true); |
23 | 23 | |
24 | - if(!is_object($template)) { |
|
24 | + if (!is_object($template)) { |
|
25 | 25 | $template = gettemplate('_ajax', true); |
26 | 26 | } |
27 | 27 | |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | |
38 | 38 | $mode = sys_get_param_str('mode'); |
39 | 39 | |
40 | - if(class_exists($className = 'Pages\\Page' . ucfirst($mode))) { |
|
40 | + if (class_exists($className = 'Pages\\Page' . ucfirst($mode))) { |
|
41 | 41 | /** |
42 | 42 | * @var \Pages\IPage $page |
43 | 43 | */ |
44 | 44 | $page = new $className(); |
45 | - if(method_exists($page, 'loadParams')) { |
|
45 | + if (method_exists($page, 'loadParams')) { |
|
46 | 46 | $page->loadParams(); |
47 | 47 | } |
48 | 48 | |
49 | - if(method_exists($page, $action = sys_get_param('action')) && $page->checkAction($action)) { |
|
49 | + if (method_exists($page, $action = sys_get_param('action')) && $page->checkAction($action)) { |
|
50 | 50 | $result = $page->$action(); |
51 | 51 | is_array($result) ? HelperArray::merge($template_result['AJAX'], $result) : false; |
52 | 52 | } |