@@ -10,34 +10,34 @@ discard block |
||
10 | 10 | * @copyright 2008 By Chlorel for XNova |
11 | 11 | */ |
12 | 12 | |
13 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
13 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
14 | 14 | |
15 | 15 | lng_include('fleet'); |
16 | 16 | |
17 | -if($TargetPlanet = sys_get_param_id('jmpto')) |
|
17 | +if ($TargetPlanet = sys_get_param_id('jmpto')) |
|
18 | 18 | { |
19 | 19 | sn_db_transaction_start(); |
20 | 20 | DBStaticUser::db_user_by_id($user['id'], true, 'id'); |
21 | 21 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
22 | - if(!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
22 | + if (!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
23 | 23 | { |
24 | 24 | $TargetGate = DBStaticPlanet::db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`'); |
25 | - if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
25 | + if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
26 | 26 | { |
27 | - $NextDestTime = uni_get_time_to_jump ( $TargetGate ); |
|
28 | - if(!$NextDestTime) |
|
27 | + $NextDestTime = uni_get_time_to_jump($TargetGate); |
|
28 | + if (!$NextDestTime) |
|
29 | 29 | { |
30 | 30 | $ship_list = sys_get_param('ships'); |
31 | 31 | $jumpMade = false; |
32 | - foreach($ship_list as $ship_id => $ship_count) |
|
32 | + foreach ($ship_list as $ship_id => $ship_count) |
|
33 | 33 | { |
34 | - if(!in_array($ship_id, Fleet::$snGroupFleet)) |
|
34 | + if (!in_array($ship_id, Fleet::$snGroupFleet)) |
|
35 | 35 | { |
36 | 36 | continue; |
37 | 37 | } |
38 | 38 | |
39 | 39 | $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id))); |
40 | - if($ship_count) |
|
40 | + if ($ship_count) |
|
41 | 41 | { |
42 | 42 | $jumpMade = true; |
43 | 43 | DBStaticUnit::dbUpdateOrInsertUnit($ship_id, -$ship_count, $user, $planetrow['id']); |
@@ -45,39 +45,39 @@ discard block |
||
45 | 45 | } |
46 | 46 | } |
47 | 47 | // Dit monsieur, y avait quelque chose a envoyer ??? |
48 | - if($jumpMade) |
|
48 | + if ($jumpMade) |
|
49 | 49 | { |
50 | - DBStaticPlanet::db_planet_update_set_by_id($TargetGate['id'], "`last_jump_time` = " . SN_TIME_NOW . ""); |
|
51 | - DBStaticPlanet::db_planet_update_set_by_id($planetrow['id'], "`last_jump_time` = " . SN_TIME_NOW . ""); |
|
50 | + DBStaticPlanet::db_planet_update_set_by_id($TargetGate['id'], "`last_jump_time` = ".SN_TIME_NOW.""); |
|
51 | + DBStaticPlanet::db_planet_update_set_by_id($planetrow['id'], "`last_jump_time` = ".SN_TIME_NOW.""); |
|
52 | 52 | |
53 | 53 | DBStaticUser::db_user_set_by_id($user['id'], "`current_planet` = '{$TargetGate['id']}'"); |
54 | 54 | |
55 | 55 | $planetrow['last_jump_time'] = SN_TIME_NOW; |
56 | - $RetMessage = classLocale::$lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow)); |
|
56 | + $RetMessage = classLocale::$lang['gate_jump_done']." - ".pretty_time(uni_get_time_to_jump($planetrow)); |
|
57 | 57 | } else { |
58 | 58 | $RetMessage = classLocale::$lang['gate_wait_data']; |
59 | 59 | } |
60 | 60 | } else { |
61 | - $RetMessage = classLocale::$lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime); |
|
61 | + $RetMessage = classLocale::$lang['gate_wait_dest']." - ".pretty_time($NextDestTime); |
|
62 | 62 | } |
63 | 63 | } else { |
64 | 64 | $RetMessage = classLocale::$lang['gate_no_dest_g']; |
65 | 65 | } |
66 | 66 | } else { |
67 | - $RetMessage = classLocale::$lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime); |
|
67 | + $RetMessage = classLocale::$lang['gate_wait_star']." - ".pretty_time($NextJumpTime); |
|
68 | 68 | } |
69 | 69 | sn_db_transaction_commit(); |
70 | 70 | message($RetMessage, classLocale::$lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10); |
71 | 71 | } else { |
72 | 72 | $template = gettemplate('jumpgate', true); |
73 | - if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
73 | + if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
74 | 74 | { |
75 | 75 | $Combo = ''; |
76 | 76 | $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']); |
77 | 77 | // while($CurMoon = db_fetch($MoonList)) |
78 | - foreach($MoonList as $CurMoon) |
|
78 | + foreach ($MoonList as $CurMoon) |
|
79 | 79 | { |
80 | - if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
80 | + if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
81 | 81 | { |
82 | 82 | $NextJumpTime = uni_get_time_to_jump($CurMoon); |
83 | 83 | $template->assign_block_vars('moon', array( |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - foreach(Fleet::$snGroupFleet as $Ship) |
|
94 | + foreach (Fleet::$snGroupFleet as $Ship) |
|
95 | 95 | { |
96 | - if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
96 | + if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
97 | 97 | { |
98 | 98 | continue; |
99 | 99 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $template->assign_vars($quest_templatized); |
180 | 180 | if (!empty($quest_templatized['quest_rewards_list'])) { |
181 | 181 | foreach ($quest_templatized['quest_rewards_list'] as $quest_reward) { |
182 | - $template->assign_block_vars(($block_name ? $block_name . '.' : '') . 'quest_rewards_list', $quest_reward); |
|
182 | + $template->assign_block_vars(($block_name ? $block_name.'.' : '').'quest_rewards_list', $quest_reward); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | } |
@@ -248,10 +248,10 @@ discard block |
||
248 | 248 | |
249 | 249 | $comment_reward = array(); |
250 | 250 | foreach ($reward_list as $unit_id => $unit_amount) { |
251 | - $comment_reward[] = $unit_amount . ' ' . classLocale::$lang['tech'][$unit_id]; |
|
251 | + $comment_reward[] = $unit_amount.' '.classLocale::$lang['tech'][$unit_id]; |
|
252 | 252 | $total_rewards[$user_id][$planet_id][$unit_id] += $unit_amount; |
253 | 253 | } |
254 | - $comment .= " {$classLocale['qst_msg_your_reward']} " . implode(',', $comment_reward); |
|
254 | + $comment .= " {$classLocale['qst_msg_your_reward']} ".implode(',', $comment_reward); |
|
255 | 255 | |
256 | 256 | DBStaticMessages::msg_send_simple_message($user['id'], 0, SN_TIME_NOW, MSG_TYPE_ADMIN, classLocale::$lang['msg_from_admin'], classLocale::$lang['qst_msg_complete_subject'], $comment); |
257 | 257 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | if (!empty($resourcesChange)) { |
291 | 291 | $planet_id = $planet_id == 0 && isset($user_row['id_planet']) ? $user_row['id_planet'] : $planet_id; |
292 | - if($planet_id) { |
|
292 | + if ($planet_id) { |
|
293 | 293 | // update planet |
294 | 294 | DBStaticPlanet::db_planet_update_resources($resourcesChange, $planet_id); |
295 | 295 | } else { |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | function que_get_unit_que($unit_id) { |
4 | 4 | $que_type = false; |
5 | - foreach(sn_get_groups('ques') as $que_id => $que_data) { |
|
6 | - if(in_array($unit_id, $que_data['unit_list'])) { |
|
5 | + foreach (sn_get_groups('ques') as $que_id => $que_data) { |
|
6 | + if (in_array($unit_id, $que_data['unit_list'])) { |
|
7 | 7 | $que_type = $que_id; |
8 | 8 | break; |
9 | 9 | } |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | |
15 | 15 | |
16 | 16 | function que_get_max_que_length($user, $planet, $que_id, $que_data = null) { |
17 | - if(empty($que_data)) { |
|
17 | + if (empty($que_data)) { |
|
18 | 18 | $que_data = sn_get_groups('ques'); |
19 | 19 | $que_data = $que_data[$que_id]; |
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | 23 | $que_length = 1; |
24 | - switch($que_id) { |
|
24 | + switch ($que_id) { |
|
25 | 25 | case QUE_RESEARCH: |
26 | 26 | $que_length = classSupernova::$config->server_que_length_research + mrc_get_level($user, null, UNIT_PREMIUM); // TODO - вынести в модуль |
27 | 27 | break; |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | function eco_que_str2arr($que_str) { |
37 | 37 | $que_arr = explode(';', $que_str); |
38 | - foreach($que_arr as $que_index => &$que_item) { |
|
39 | - if($que_item) { |
|
38 | + foreach ($que_arr as $que_index => &$que_item) { |
|
39 | + if ($que_item) { |
|
40 | 40 | $que_item = explode(',', $que_item); |
41 | 41 | } else { |
42 | 42 | unset($que_arr[$que_index]); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | function eco_que_arr2str($que_arr) { |
50 | - foreach($que_arr as &$que_item) { |
|
50 | + foreach ($que_arr as &$que_item) { |
|
51 | 51 | $que_item = implode(',', $que_item); |
52 | 52 | } |
53 | 53 | |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | $classLocale = classLocale::$lang; |
60 | 60 | |
61 | 61 | $is_autoconvert = false; |
62 | - if($build_mode == BUILD_AUTOCONVERT || sys_get_param_int('auto_convert')) { |
|
62 | + if ($build_mode == BUILD_AUTOCONVERT || sys_get_param_int('auto_convert')) { |
|
63 | 63 | $build_mode = BUILD_CREATE; |
64 | 64 | $is_autoconvert = true; |
65 | 65 | } |
66 | 66 | |
67 | 67 | $unit_amount_qued = 0; |
68 | 68 | try { |
69 | - if(!$user['id']) { |
|
69 | + if (!$user['id']) { |
|
70 | 70 | throw new exception('{Нет идентификатора пользователя - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
71 | 71 | } |
72 | 72 | |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | foreach($unit_list as $unit_id => $unit_amount) if($unit_amount) break; |
78 | 78 | } |
79 | 79 | */ |
80 | - if(!$unit_id) { |
|
80 | + if (!$unit_id) { |
|
81 | 81 | throw new exception('{Нет идентификатора юнита - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
82 | 82 | } |
83 | 83 | |
84 | 84 | $que_id = que_get_unit_que($unit_id); |
85 | - if(!$que_id) { |
|
85 | + if (!$que_id) { |
|
86 | 86 | throw new exception('{Неправильный тип очереди - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
87 | 87 | } |
88 | 88 | |
89 | - if($build_mode == BUILD_DESTROY && $que_id != QUE_STRUCTURES) { |
|
89 | + if ($build_mode == BUILD_DESTROY && $que_id != QUE_STRUCTURES) { |
|
90 | 90 | throw new exception('{Уничтожать можно только здания на планете}', ERR_ERROR); // TODO EXCEPTION |
91 | 91 | } |
92 | 92 | |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | $que_data = $que_data[$que_id]; |
95 | 95 | |
96 | 96 | // TODO Переделать под подочереди |
97 | - if($que_id == QUE_STRUCTURES) { |
|
97 | + if ($que_id == QUE_STRUCTURES) { |
|
98 | 98 | $sn_groups_build_allow = sn_get_groups('build_allow'); |
99 | 99 | $que_data['unit_list'] = $sn_groups_build_allow[$planet['planet_type']]; |
100 | 100 | |
101 | - if(!isset($que_data['unit_list'][$unit_id])) { |
|
102 | - throw new exception('{Это здание нельзя строить на ' . ($planet['planet_type'] == PT_PLANET ? 'планете' : 'луне'), ERR_ERROR); // TODO EXCEPTION |
|
101 | + if (!isset($que_data['unit_list'][$unit_id])) { |
|
102 | + throw new exception('{Это здание нельзя строить на '.($planet['planet_type'] == PT_PLANET ? 'планете' : 'луне'), ERR_ERROR); // TODO EXCEPTION |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | /* |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | // Это нужно, что бы заблокировать пользователя и работу с очередями |
120 | 120 | $user = DBStaticUser::db_user_by_id($user['id']); |
121 | 121 | // Это нужно, что бы заблокировать планету от списания ресурсов |
122 | - if(isset($planet['id']) && $planet['id']) { |
|
122 | + if (isset($planet['id']) && $planet['id']) { |
|
123 | 123 | $planet = DBStaticPlanet::db_planet_by_id($planet['id'], true); |
124 | 124 | } else { |
125 | 125 | $planet['id'] = 0; |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | $in_que = &$que['in_que'][$que_id][$user['id']][$planet_id]; |
132 | 132 | $que_max_length = que_get_max_que_length($user, $planet, $que_id, $que_data); |
133 | 133 | // TODO Добавить вызовы функций проверок текущей и максимальной длин очередей |
134 | - if(count($in_que) >= $que_max_length) { |
|
134 | + if (count($in_que) >= $que_max_length) { |
|
135 | 135 | throw new exception('{Все слоты очереди заняты}', ERR_ERROR); // TODO EXCEPTION |
136 | 136 | } |
137 | 137 | |
138 | 138 | // TODO Отдельно посмотреть на уничтожение зданий - что бы можно было уничтожать их без планов |
139 | - switch(eco_can_build_unit($user, $planet, $unit_id)) { |
|
139 | + switch (eco_can_build_unit($user, $planet, $unit_id)) { |
|
140 | 140 | case BUILD_ALLOWED: |
141 | 141 | break; |
142 | 142 | case BUILD_UNIT_BUSY: |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | break; // TODO EXCEPTION eco_bld_msg_err_laboratory_upgrading |
145 | 145 | // case BUILD_REQUIRE_NOT_MEET: |
146 | 146 | default: |
147 | - if($build_mode == BUILD_CREATE) { |
|
147 | + if ($build_mode == BUILD_CREATE) { |
|
148 | 148 | throw new exception('{Требования не удовлетворены}', ERR_ERROR); |
149 | 149 | } |
150 | 150 | break; // TODO EXCEPTION eco_bld_msg_err_requirements_not_meet |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | $unit_amount_qued = $unit_amount; |
155 | 155 | $units_qued = isset($in_que[$unit_id]) ? $in_que[$unit_id] : 0; |
156 | 156 | $unit_level = mrc_get_level($user, $planet, $unit_id, true, true) + $units_qued; |
157 | - if($unit_max = get_unit_param($unit_id, P_MAX_STACK)) { |
|
158 | - if($unit_level >= $unit_max) { |
|
157 | + if ($unit_max = get_unit_param($unit_id, P_MAX_STACK)) { |
|
158 | + if ($unit_level >= $unit_max) { |
|
159 | 159 | throw new exception('{Максимальное количество юнитов данного типа уже достигнуто или будет достигнуто по окончанию очереди}', ERR_ERROR); // TODO EXCEPTION |
160 | 160 | } |
161 | 161 | $unit_amount = max(0, min($unit_amount, $unit_max - $unit_level)); |
162 | 162 | } |
163 | 163 | |
164 | - if($unit_amount < 1) { |
|
164 | + if ($unit_amount < 1) { |
|
165 | 165 | throw new exception('{Неправильное количество юнитов - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
166 | 166 | } |
167 | 167 | |
@@ -170,21 +170,21 @@ discard block |
||
170 | 170 | // { |
171 | 171 | // die('Unit busy'); // TODO EXCEPTION |
172 | 172 | // } |
173 | - if(get_unit_param($unit_id, P_STACKABLE)) { |
|
173 | + if (get_unit_param($unit_id, P_STACKABLE)) { |
|
174 | 174 | // TODO Поле 'max_Lot_size' для ограничения размера стэка в очереди - то ли в юниты, то ли в очередь |
175 | - if(in_array($unit_id, $group_missile = sn_get_groups(GROUP_STR_MISSILES))) { |
|
175 | + if (in_array($unit_id, $group_missile = sn_get_groups(GROUP_STR_MISSILES))) { |
|
176 | 176 | // TODO Поле 'container' - указывает на родительску структуру, в которой хранится данный юнит и по вместительности которой нужно применять размер юнита |
177 | 177 | $used_silo = 0; |
178 | - foreach($group_missile as $missile_id) { |
|
178 | + foreach ($group_missile as $missile_id) { |
|
179 | 179 | $missile_qued = isset($in_que[$missile_id]) ? $in_que[$missile_id] : 0; |
180 | 180 | $used_silo += (mrc_get_level($user, $planet, $missile_id, true, true) + $missile_qued) * get_unit_param($missile_id, P_UNIT_SIZE); |
181 | 181 | } |
182 | 182 | $free_silo = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY) - $used_silo; |
183 | - if($free_silo <= 0) { |
|
183 | + if ($free_silo <= 0) { |
|
184 | 184 | throw new exception('{Ракетная шахта уже заполнена или будет заполнена по окончанию очереди}', ERR_ERROR); // TODO EXCEPTION |
185 | 185 | } |
186 | 186 | $unit_size = get_unit_param($unit_id, P_UNIT_SIZE); |
187 | - if($free_silo < $unit_size) { |
|
187 | + if ($free_silo < $unit_size) { |
|
188 | 188 | throw new exception("{В ракетной шахте нет места для {$classLocale['tech'][$unit_id]}}", ERR_ERROR); // TODO EXCEPTION |
189 | 189 | } |
190 | 190 | $unit_amount = max(0, min($unit_amount, floor($free_silo / $unit_size))); |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | $unit_level = $new_unit_level = 0; |
193 | 193 | } else { |
194 | 194 | $unit_amount = 1; |
195 | - if($que_id == QUE_STRUCTURES) { |
|
195 | + if ($que_id == QUE_STRUCTURES) { |
|
196 | 196 | // if($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $que['sectors'][$planet['id']] <= 0) |
197 | 197 | $sectors_qued = is_array($in_que) ? array_sum($in_que) : 0; |
198 | - if($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $sectors_qued <= 0) { |
|
198 | + if ($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $sectors_qued <= 0) { |
|
199 | 199 | throw new exception('{Не хватает секторов на планете}', ERR_ERROR); // TODO EXCEPTION |
200 | 200 | } |
201 | 201 | // И что это я такое написал? Зачем? |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | |
213 | 213 | $exchange = array(); |
214 | 214 | $market_get_autoconvert_cost = market_get_autoconvert_cost(); |
215 | - if($is_autoconvert && $build_data[BUILD_AUTOCONVERT]) { |
|
215 | + if ($is_autoconvert && $build_data[BUILD_AUTOCONVERT]) { |
|
216 | 216 | $dark_matter = mrc_get_level($user, null, RES_DARK_MATTER); |
217 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $market_get_autoconvert_cost) { |
|
218 | - throw new exception("{Нет хватает " . ($market_get_autoconvert_cost - $dark_matter) . "ТМ на постройки с автоконвертацией ресурсов}", ERR_ERROR); // TODO EXCEPTION |
|
217 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $market_get_autoconvert_cost) { |
|
218 | + throw new exception("{Нет хватает ".($market_get_autoconvert_cost - $dark_matter)."ТМ на постройки с автоконвертацией ресурсов}", ERR_ERROR); // TODO EXCEPTION |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | !get_unit_param($unit_id, P_STACKABLE) ? $unit_amount = 1 : false; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $resource_exchange_rates = array(); |
225 | 225 | $resource_diff = array(); |
226 | 226 | $all_positive = true; |
227 | - foreach($resources_loot as $resource_id) { |
|
227 | + foreach ($resources_loot as $resource_id) { |
|
228 | 228 | $resource_db_name = pname_resource_name($resource_id); |
229 | 229 | $resource_got[$resource_id] = floor(mrc_get_level($user, $planet, $resource_id)); |
230 | 230 | $resource_exchange_rates[$resource_id] = classSupernova::$config->__get("rpg_exchange_{$resource_db_name}"); |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | $all_positive = $all_positive && ($resource_diff[$resource_id] > 0); |
233 | 233 | } |
234 | 234 | // Нужна автоконвертация |
235 | - if($all_positive) { |
|
235 | + if ($all_positive) { |
|
236 | 236 | $is_autoconvert = false; |
237 | 237 | } else { |
238 | - foreach($resource_diff as $resource_diff_id => &$resource_diff_amount) { |
|
239 | - if($resource_diff_amount >= 0) { |
|
238 | + foreach ($resource_diff as $resource_diff_id => &$resource_diff_amount) { |
|
239 | + if ($resource_diff_amount >= 0) { |
|
240 | 240 | continue; |
241 | 241 | } |
242 | - foreach($resource_diff as $resource_got_id => &$resource_got_amount) { |
|
243 | - if($resource_got_amount <= 0) { |
|
242 | + foreach ($resource_diff as $resource_got_id => &$resource_got_amount) { |
|
243 | + if ($resource_got_amount <= 0) { |
|
244 | 244 | continue; |
245 | 245 | } |
246 | 246 | $current_exchange = $resource_exchange_rates[$resource_got_id] / $resource_exchange_rates[$resource_diff_id]; |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | $is_autoconvert_ok = true; |
259 | - foreach($resource_diff as $resource_diff_amount2) { |
|
260 | - if($resource_diff_amount2 < 0) { |
|
259 | + foreach ($resource_diff as $resource_diff_amount2) { |
|
260 | + if ($resource_diff_amount2 < 0) { |
|
261 | 261 | $is_autoconvert_ok = false; |
262 | 262 | break; |
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - if($is_autoconvert_ok) { |
|
266 | + if ($is_autoconvert_ok) { |
|
267 | 267 | $build_data['RESULT'][$build_mode] = BUILD_ALLOWED; |
268 | 268 | $build_data['CAN'][$build_mode] = $unit_amount; |
269 | 269 | } else { |
@@ -272,19 +272,19 @@ discard block |
||
272 | 272 | } |
273 | 273 | } |
274 | 274 | $unit_amount = min($build_data['CAN'][$build_mode], $unit_amount); |
275 | - if($unit_amount <= 0) { |
|
275 | + if ($unit_amount <= 0) { |
|
276 | 276 | throw new exception('{Не хватает ресурсов}', ERR_ERROR); // TODO EXCEPTION |
277 | 277 | } |
278 | 278 | |
279 | - if($new_unit_level < 0) { |
|
279 | + if ($new_unit_level < 0) { |
|
280 | 280 | throw new exception('{Нельзя уничтожить больше юнитов, чем есть}', ERR_ERROR); // TODO EXCEPTION |
281 | 281 | } |
282 | 282 | |
283 | - if($build_data['RESULT'][$build_mode] != BUILD_ALLOWED) { |
|
283 | + if ($build_data['RESULT'][$build_mode] != BUILD_ALLOWED) { |
|
284 | 284 | throw new exception('{Строительство блокировано}', ERR_ERROR); // TODO EXCEPTION |
285 | 285 | } |
286 | 286 | |
287 | - if($is_autoconvert) { |
|
287 | + if ($is_autoconvert) { |
|
288 | 288 | ksort($exchange); |
289 | 289 | ksort($resource_got); |
290 | 290 | db_change_units($user, $planet, array( |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | $unit_amount_qued = 0; |
302 | - while($unit_amount > 0 && count($que['ques'][$que_id][$user['id']][$planet_id]) < $que_max_length) { |
|
302 | + while ($unit_amount > 0 && count($que['ques'][$que_id][$user['id']][$planet_id]) < $que_max_length) { |
|
303 | 303 | $place = min($unit_amount, MAX_FLEET_OR_DEFS_PER_ROW); |
304 | 304 | que_add_unit($unit_id, $user, $planet, $build_data, $new_unit_level, $place, $build_mode); |
305 | 305 | $unit_amount -= $place; |
@@ -309,8 +309,8 @@ discard block |
||
309 | 309 | |
310 | 310 | sn_db_transaction_commit(); |
311 | 311 | |
312 | - if($redirect) { |
|
313 | - sys_redirect("{$_SERVER['PHP_SELF']}?mode=" . sys_get_param_str('mode') . "&ally_id=" . sys_get_param_id('ally_id')); |
|
312 | + if ($redirect) { |
|
313 | + sys_redirect("{$_SERVER['PHP_SELF']}?mode=".sys_get_param_str('mode')."&ally_id=".sys_get_param_id('ally_id')); |
|
314 | 314 | die(); |
315 | 315 | } |
316 | 316 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | 'STATUS' => ERR_NONE, |
319 | 319 | 'MESSAGE' => '{Строительство начато}', |
320 | 320 | ); |
321 | - } catch(exception $e) { |
|
321 | + } catch (exception $e) { |
|
322 | 322 | sn_db_transaction_rollback(); |
323 | 323 | $operation_result = array( |
324 | 324 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | ); |
327 | 327 | } |
328 | 328 | |
329 | - if(!empty($operation_result['MESSAGE'])) { |
|
330 | - $operation_result['MESSAGE'] .= ' ' . ($unit_amount_qued ? $unit_amount_qued : $unit_amount) . 'x[' . classLocale::$lang['tech'][$unit_id] . ']'; |
|
329 | + if (!empty($operation_result['MESSAGE'])) { |
|
330 | + $operation_result['MESSAGE'] .= ' '.($unit_amount_qued ? $unit_amount_qued : $unit_amount).'x['.classLocale::$lang['tech'][$unit_id].']'; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | return $operation_result; |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | function que_recalculate($old_que) { |
338 | 338 | $new_que = array(); |
339 | 339 | |
340 | - if(!is_array($old_que['items'])) { |
|
340 | + if (!is_array($old_que['items'])) { |
|
341 | 341 | return $new_que; |
342 | 342 | } |
343 | - foreach($old_que['items'] as $row) { |
|
344 | - if(!isset($row) || !$row || $row['que_unit_amount'] <= 0) { |
|
343 | + foreach ($old_que['items'] as $row) { |
|
344 | + if (!isset($row) || !$row || $row['que_unit_amount'] <= 0) { |
|
345 | 345 | continue; |
346 | 346 | } |
347 | 347 | |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | |
353 | 353 | $last_id = count($new_que['items']) - 1; |
354 | 354 | |
355 | - if($row['que_planet_id']) { |
|
355 | + if ($row['que_planet_id']) { |
|
356 | 356 | $new_que['planets'][$row['que_planet_id']][$row['que_type']][] = &$new_que['items'][$last_id]; |
357 | - } elseif($row['que_type'] == QUE_RESEARCH) { |
|
357 | + } elseif ($row['que_type'] == QUE_RESEARCH) { |
|
358 | 358 | $new_que['players'][$row['que_player_id']][$row['que_type']][] = &$new_que['items'][$last_id]; |
359 | 359 | } |
360 | 360 | $new_que['ques'][$row['que_type']][$row['que_player_id']][intval($row['que_planet_id'])][] = &$new_que['items'][$last_id]; |
@@ -389,9 +389,9 @@ discard block |
||
389 | 389 | $que_type = que_get_unit_que($unit_id); |
390 | 390 | $planet_id_origin = $planet['id'] ? $planet['id'] : 'NULL'; |
391 | 391 | $planet_id = $que_type == QUE_RESEARCH ? 'NULL' : $planet_id_origin; |
392 | - if(is_numeric($planet_id)) { |
|
392 | + if (is_numeric($planet_id)) { |
|
393 | 393 | DBStaticPlanet::db_planet_update_set_by_id($planet_id, "`que_processed` = UNIX_TIMESTAMP(NOW())"); |
394 | - } elseif(is_numeric($user['id'])) { |
|
394 | + } elseif (is_numeric($user['id'])) { |
|
395 | 395 | DBStaticUser::db_user_set_by_id($user['id'], '`que_processed` = UNIX_TIMESTAMP(NOW())'); |
396 | 396 | } |
397 | 397 | |
@@ -421,17 +421,17 @@ discard block |
||
421 | 421 | $planet['id'] = $planet['id'] && $que_type !== QUE_RESEARCH ? $planet['id'] : 0; |
422 | 422 | $global_que = que_get($user['id'], $planet['id'], $que_type, true); |
423 | 423 | |
424 | - if(!empty($global_que['ques'][$que_type][$user['id']][$planet['id']])) { |
|
424 | + if (!empty($global_que['ques'][$que_type][$user['id']][$planet['id']])) { |
|
425 | 425 | $que = array_reverse($global_que['ques'][$que_type][$user['id']][$planet['id']]); |
426 | 426 | |
427 | - foreach($que as $que_item) { |
|
427 | + foreach ($que as $que_item) { |
|
428 | 428 | DBStaticQue::db_que_delete_by_id($que_item['que_id']); |
429 | 429 | |
430 | - if($que_item['que_planet_id_origin']) { |
|
430 | + if ($que_item['que_planet_id_origin']) { |
|
431 | 431 | $planet['id'] = $que_item['que_planet_id_origin']; |
432 | 432 | } |
433 | 433 | |
434 | - if(!isset($planets_locked[$planet['id']])) { |
|
434 | + if (!isset($planets_locked[$planet['id']])) { |
|
435 | 435 | $planets_locked[$planet['id']] = $planet['id'] ? DBStaticPlanet::db_planet_by_id($planet['id'], true) : $planet; |
436 | 436 | } |
437 | 437 | |
@@ -443,14 +443,14 @@ discard block |
||
443 | 443 | RES_DEUTERIUM => $build_data[RES_DEUTERIUM] * $que_item['que_unit_amount'], |
444 | 444 | )); |
445 | 445 | |
446 | - if(!$clear) { |
|
446 | + if (!$clear) { |
|
447 | 447 | break; |
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
451 | - if(is_numeric($planet['id'])) { |
|
451 | + if (is_numeric($planet['id'])) { |
|
452 | 452 | DBStaticPlanet::db_planet_update_set_by_id($planet['id'], "`que_processed` = UNIX_TIMESTAMP(NOW())"); |
453 | - } elseif(is_numeric($user['id'])) { |
|
453 | + } elseif (is_numeric($user['id'])) { |
|
454 | 454 | DBStaticUser::db_user_set_by_id($user['id'], '`que_processed` = UNIX_TIMESTAMP(NOW())'); |
455 | 455 | } |
456 | 456 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | sn_db_transaction_rollback(); |
460 | 460 | } |
461 | 461 | //die(); |
462 | - header("Location: {$_SERVER['PHP_SELF']}?mode={$que_type}" . "&ally_id=" . sys_get_param_id('ally_id')); |
|
462 | + header("Location: {$_SERVER['PHP_SELF']}?mode={$que_type}"."&ally_id=".sys_get_param_id('ally_id')); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | |
@@ -498,21 +498,21 @@ discard block |
||
498 | 498 | // TODO: Переделать для $que_type === false |
499 | 499 | $planet['id'] = $planet['id'] ? $planet['id'] : 0; |
500 | 500 | |
501 | - if(!is_array($que)) { |
|
501 | + if (!is_array($que)) { |
|
502 | 502 | $que = que_get($user['id'], $planet['id'], $que_type); |
503 | 503 | } |
504 | 504 | |
505 | - if(is_array($que) && isset($que['items'])) { |
|
505 | + if (is_array($que) && isset($que['items'])) { |
|
506 | 506 | $que = $que['ques'][$que_type][$user['id']][$planet['id']]; |
507 | 507 | } |
508 | 508 | |
509 | - if($que) { |
|
510 | - foreach($que as $que_element) { |
|
509 | + if ($que) { |
|
510 | + foreach ($que as $que_element) { |
|
511 | 511 | $template->assign_block_vars('que', que_tpl_parse_element($que_element, $short_names)); |
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | - if($que_type == QUE_RESEARCH) { |
|
515 | + if ($que_type == QUE_RESEARCH) { |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
539 | 539 | |
540 | 540 | $time_left[$user['id']][0] = max(0, $on_time - $user['que_processed']); |
541 | - if($planet === null && !$time_left[$user['id']][0]) { |
|
541 | + if ($planet === null && !$time_left[$user['id']][0]) { |
|
542 | 542 | // TODO |
543 | 543 | return $que; |
544 | 544 | } |
@@ -547,12 +547,12 @@ discard block |
||
547 | 547 | $que_type_id = $planet === null ? QUE_RESEARCH : false; |
548 | 548 | $planet = intval(is_array($planet) ? $planet['id'] : $planet); // В $planet у нас теперь только её ID или шаблон null/0/false |
549 | 549 | $que = que_get($user['id'], $planet, $que_type_id, true); |
550 | - if(empty($que['items'])) { |
|
550 | + if (empty($que['items'])) { |
|
551 | 551 | return $que; |
552 | 552 | } |
553 | 553 | |
554 | 554 | $planet_list = array(); |
555 | - if($planet !== null) { |
|
555 | + if ($planet !== null) { |
|
556 | 556 | // Если нужно изменять данные на планетах - блокируем планеты и получаем данные о них |
557 | 557 | // TODO - от них не надо ничего, кроме ID и que_processed |
558 | 558 | $planet_row = DBStaticPlanet::db_planet_list_by_user_or_planet($user['id'], $planet); |
@@ -561,20 +561,20 @@ discard block |
||
561 | 561 | } |
562 | 562 | |
563 | 563 | // Теперь в $time_left лежит время обсчета всех очередей по каждой из планеты |
564 | - if(array_sum($time_left[$user['id']]) == 0) { |
|
564 | + if (array_sum($time_left[$user['id']]) == 0) { |
|
565 | 565 | return $que; |
566 | 566 | } |
567 | 567 | |
568 | 568 | $unit_changes = array(); |
569 | - foreach($que['items'] as &$que_item) { |
|
569 | + foreach ($que['items'] as &$que_item) { |
|
570 | 570 | $que_player_id = &$que_item['que_player_id']; |
571 | 571 | $que_planet_id = intval($que_item['que_planet_id']); |
572 | 572 | |
573 | 573 | $que_time_left = &$que['time_left'][$que_player_id][$que_planet_id][$que_item['que_type']]; |
574 | - if(!isset($que_time_left)) { |
|
574 | + if (!isset($que_time_left)) { |
|
575 | 575 | $que_time_left = $time_left[$que_player_id][$que_planet_id]; |
576 | 576 | } |
577 | - if($que_time_left <= 0 || $que_item['que_unit_amount'] <= 0) { |
|
577 | + if ($que_time_left <= 0 || $que_item['que_unit_amount'] <= 0) { |
|
578 | 578 | continue; |
579 | 579 | } |
580 | 580 | // Дальше мы идем, если только осталось время в очереди И юниты к постройке |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | // Теперь работаем с остатком времени на юните. Оно не может быть равно или меньше нуля |
588 | 588 | |
589 | 589 | // Если времени в очереди осталось не меньше, чем время текущего юнита - значит мы достроили юнит |
590 | - if($que_time_left >= $que_item['que_time_left']) { |
|
590 | + if ($que_time_left >= $que_item['que_time_left']) { |
|
591 | 591 | // Увеличиваем количество отстроенных юнитов |
592 | 592 | $unit_processed++; |
593 | 593 | // Вычитаем из времени очереди потраченное на постройку время |
@@ -600,12 +600,12 @@ discard block |
||
600 | 600 | $que_item['que_unit_amount'] -= $unit_processed; |
601 | 601 | |
602 | 602 | // Если еще остались юниты - значит ВСЁ оставшееся время приходится на достройку следующего юнита |
603 | - if($que_item['que_unit_amount'] > 0) { |
|
603 | + if ($que_item['que_unit_amount'] > 0) { |
|
604 | 604 | $que_item['que_time_left'] = $que_item['que_time_left'] - $que_time_left; |
605 | 605 | $que_time_left = 0; |
606 | 606 | } |
607 | 607 | |
608 | - if($que_item['que_unit_amount'] <= 0) { |
|
608 | + if ($que_item['que_unit_amount'] <= 0) { |
|
609 | 609 | DBStaticQue::db_que_delete_by_id($que_item['que_id']); |
610 | 610 | } else { |
611 | 611 | classSupernova::db_upd_record_list( |
@@ -615,15 +615,15 @@ discard block |
||
615 | 615 | ); |
616 | 616 | } |
617 | 617 | |
618 | - if($unit_processed) { |
|
618 | + if ($unit_processed) { |
|
619 | 619 | $unit_processed_delta = $unit_processed * ($que_item['que_unit_mode'] == BUILD_CREATE ? 1 : -1); |
620 | 620 | $unit_changes[$que_player_id][$que_planet_id][$que_item['que_unit_id']] += $unit_processed_delta; |
621 | 621 | } |
622 | 622 | } |
623 | 623 | |
624 | - foreach($time_left as $player_id => $planet_data) { |
|
625 | - foreach($planet_data as $planet_id => $time_on_planet) { |
|
626 | - if($planet_id) { |
|
624 | + foreach ($time_left as $player_id => $planet_data) { |
|
625 | + foreach ($planet_data as $planet_id => $time_on_planet) { |
|
626 | + if ($planet_id) { |
|
627 | 627 | // update planet |
628 | 628 | classSupernova::db_upd_record_list(LOC_PLANET, "`que_processed` = {$on_time}", "id = {$planet_id}"); |
629 | 629 | } else { |
@@ -631,8 +631,8 @@ discard block |
||
631 | 631 | classSupernova::db_upd_record_list(LOC_USER, "`que_processed` = {$on_time}", "id = {$player_id}"); |
632 | 632 | } |
633 | 633 | |
634 | - if(is_array($unit_changes[$player_id][$planet_id])) { |
|
635 | - foreach($unit_changes[$player_id][$planet_id] as $unit_id => $unit_amount) { |
|
634 | + if (is_array($unit_changes[$player_id][$planet_id])) { |
|
635 | + foreach ($unit_changes[$player_id][$planet_id] as $unit_id => $unit_amount) { |
|
636 | 636 | DBStaticUnit::dbUpdateOrInsertUnit($unit_id, $unit_amount, $user, $planet_id ? $planet_id : null); |
637 | 637 | } |
638 | 638 | } |
@@ -642,38 +642,38 @@ discard block |
||
642 | 642 | $que = que_recalculate($que); |
643 | 643 | |
644 | 644 | // TODO: Re-enable quests for Alliances |
645 | - if(!empty($unit_changes) && !$user['user_as_ally']) { |
|
645 | + if (!empty($unit_changes) && !$user['user_as_ally']) { |
|
646 | 646 | $quest_list = qst_get_quests($user['id']); |
647 | 647 | $quest_triggers = qst_active_triggers($quest_list); |
648 | 648 | $quest_rewards = array(); |
649 | 649 | |
650 | 650 | |
651 | 651 | $xp_incoming = array(); |
652 | - foreach($unit_changes as $user_id => $planet_changes) { |
|
653 | - foreach($planet_changes as $planet_id => $changes) { |
|
652 | + foreach ($unit_changes as $user_id => $planet_changes) { |
|
653 | + foreach ($planet_changes as $planet_id => $changes) { |
|
654 | 654 | $planet_this = $planet_id ? classSupernova::db_get_record_by_id(LOC_PLANET, $planet_id) : array(); |
655 | - foreach($changes as $unit_id => $unit_value) { |
|
655 | + foreach ($changes as $unit_id => $unit_value) { |
|
656 | 656 | $que_id = que_get_unit_que($unit_id); |
657 | 657 | $unit_level_new = mrc_get_level($user, $planet_this, $unit_id, false, true) + $unit_value; |
658 | - if($que_id == QUE_STRUCTURES || $que_id == QUE_RESEARCH) { |
|
658 | + if ($que_id == QUE_STRUCTURES || $que_id == QUE_RESEARCH) { |
|
659 | 659 | $build_data = eco_get_build_data($user, $planet_this, $unit_id, $unit_level_new - 1); |
660 | 660 | $build_data = $build_data[BUILD_CREATE]; |
661 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
661 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
662 | 662 | $xp_incoming[$que_id] += $build_data[$resource_id]; // TODO - добавить конверсию рейтов обмена |
663 | 663 | } |
664 | 664 | } |
665 | 665 | |
666 | - if(is_array($quest_triggers)) { |
|
666 | + if (is_array($quest_triggers)) { |
|
667 | 667 | // TODO: Check mutiply condition quests |
668 | 668 | $quest_trigger_list = array_keys($quest_triggers, $unit_id); |
669 | - if(is_array($quest_trigger_list)) { |
|
670 | - foreach($quest_trigger_list as $quest_id) { |
|
669 | + if (is_array($quest_trigger_list)) { |
|
670 | + foreach ($quest_trigger_list as $quest_id) { |
|
671 | 671 | $quest_unit_level = $unit_level_new; |
672 | - if(get_unit_param($unit_id, P_UNIT_TYPE) == UNIT_SHIPS) { |
|
672 | + if (get_unit_param($unit_id, P_UNIT_TYPE) == UNIT_SHIPS) { |
|
673 | 673 | $quest_unit_level = DBStaticUnit::db_unit_count_by_user_and_type_and_snid($user_id, 0, $unit_id); |
674 | 674 | $quest_unit_level = $quest_unit_level[$unit_id]['qty']; |
675 | 675 | } |
676 | - if($quest_list[$quest_id]['quest_status_status'] != QUEST_STATUS_COMPLETE && $quest_list[$quest_id]['quest_unit_amount'] <= $quest_unit_level) { |
|
676 | + if ($quest_list[$quest_id]['quest_status_status'] != QUEST_STATUS_COMPLETE && $quest_list[$quest_id]['quest_unit_amount'] <= $quest_unit_level) { |
|
677 | 677 | $quest_rewards[$quest_id][$user_id][$planet_id] = $quest_list[$quest_id]['quest_rewards_list']; |
678 | 678 | $quest_list[$quest_id]['quest_status_status'] = QUEST_STATUS_COMPLETE; |
679 | 679 | } |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | // TODO: Изменить начисление награды за квесты на ту планету, на которой происходил ресеч |
687 | 687 | qst_reward($user, $quest_rewards, $quest_list); |
688 | 688 | |
689 | - foreach($xp_incoming as $que_id => $xp) { |
|
689 | + foreach ($xp_incoming as $que_id => $xp) { |
|
690 | 690 | rpg_level_up($user, $que_id == QUE_RESEARCH ? RPG_TECH : RPG_STRUCTURE, $xp / 1000); |
691 | 691 | } |
692 | 692 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | if ($que_type == QUE_RESEARCH || $planet_id === null) { |
39 | 39 | $query[] = "`que_planet_id` IS NULL"; |
40 | 40 | } elseif ($planet_id) { |
41 | - $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")"; |
|
41 | + $query[] = "(`que_planet_id` = {$planet_id}".($que_type ? '' : ' OR que_planet_id IS NULL').")"; |
|
42 | 42 | } |
43 | 43 | if ($que_type) { |
44 | 44 | $query[] = "`que_type` = {$que_type}"; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | ->where('`user_as_ally` IS NULL') |
24 | 24 | ->orderBy(array('`id` DESC')); |
25 | 25 | |
26 | - return (string)$query->selectValue(); |
|
26 | + return (string) $query->selectValue(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -48,15 +48,15 @@ discard block |
||
48 | 48 | static::buildDBQ() |
49 | 49 | ->field('id') |
50 | 50 | ->where("`user_as_ally` IS NULL") |
51 | - ->where("`user_bot` = " . USER_BOT_PLAYER) |
|
51 | + ->where("`user_bot` = ".USER_BOT_PLAYER) |
|
52 | 52 | ->setForUpdate(); |
53 | 53 | |
54 | 54 | return $query->selectIterator(); |
55 | 55 | } |
56 | 56 | |
57 | 57 | public static function db_user_lock_with_target_owner_and_acs($user, $planet = array()) { |
58 | - $query = "SELECT 1 FROM `{{users}}` WHERE `id` = " . idval($user['id']) . |
|
59 | - (!empty($planet['id_owner']) ? ' OR `id` = ' . idval($planet['id_owner']) : '') |
|
58 | + $query = "SELECT 1 FROM `{{users}}` WHERE `id` = ".idval($user['id']). |
|
59 | + (!empty($planet['id_owner']) ? ' OR `id` = '.idval($planet['id_owner']) : '') |
|
60 | 60 | . " FOR UPDATE"; |
61 | 61 | |
62 | 62 | static::getDb()->doSelect($query); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | FROM `{{users}}` |
74 | 74 | WHERE |
75 | 75 | `user_as_ally` IS NULL" . |
76 | - ($online ? ' AND `onlinetime` > ' . (SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '') |
|
76 | + ($online ? ' AND `onlinetime` > '.(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '') |
|
77 | 77 | )); |
78 | 78 | } |
79 | 79 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ->fieldCount('r.id', 'referral_count') |
96 | 96 | ->fieldSingleFunction('sum', 'r.dark_matter', 'referral_dm') |
97 | 97 | ->join('LEFT JOIN {{referrals}} as r on r.id_partner = u.id') |
98 | - ->where($online ? "`onlinetime` >= " . intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL') |
|
98 | + ->where($online ? "`onlinetime` >= ".intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL') |
|
99 | 99 | ->groupBy('u.id') |
100 | 100 | ->orderBy("user_as_ally, {$sort} ASC"); |
101 | 101 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ->where('(`user_birthday_celebrated` IS NULL OR DATE_ADD(`user_birthday_celebrated`, INTERVAL 1 YEAR) < CURRENT_DATE)') |
114 | 114 | ->where('`user_as_ally` IS NULL') |
115 | 115 | ->having('`days_after_birthday` >= 0') |
116 | - ->having('`days_after_birthday` < ' . intval($config_user_birthday_range)) |
|
116 | + ->having('`days_after_birthday` < '.intval($config_user_birthday_range)) |
|
117 | 117 | ->setForUpdate(); |
118 | 118 | |
119 | 119 | $result = $query->selectIterator(); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $username_safe = db_escape($like ? strtolower($username_unsafe) : $username_unsafe); // тут на самом деле strtolower() лишняя, но пусть будет |
208 | 208 | |
209 | 209 | $user = classSupernova::$db->doSelectFetch( |
210 | - "SELECT * FROM {{users}} WHERE `username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'" |
|
210 | + "SELECT * FROM {{users}} WHERE `username` ".($like ? 'LIKE' : '=')." '{$username_safe}'" |
|
211 | 211 | . " FOR UPDATE" |
212 | 212 | ); |
213 | 213 | SnCache::cache_set(LOC_USER, $user); // В кэш-юзер так же заполнять индексы |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | |
259 | 259 | public static function db_user_list_set_mass_mail(&$owners_list, $set) { |
260 | - return classSupernova::db_upd_record_list(LOC_USER, $set, !empty($owners_list) ? '`id` IN (' . implode(',', $owners_list) . ');' : ''); |
|
260 | + return classSupernova::db_upd_record_list(LOC_USER, $set, !empty($owners_list) ? '`id` IN ('.implode(',', $owners_list).');' : ''); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | public static function db_user_list_set_by_ally_and_rank($ally_id, $ally_rank_id, $set) { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @param array $playerArray |
273 | 273 | */ |
274 | 274 | public static function renderNameAndCoordinates($playerArray) { |
275 | - return "{$playerArray['username']} " . uni_render_coordinates($playerArray); |
|
275 | + return "{$playerArray['username']} ".uni_render_coordinates($playerArray); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $fieldName = pname_resource_name($resourceId); |
304 | 304 | $value = "{$fieldName} = {$fieldName} + ('{$value}')"; |
305 | 305 | } |
306 | - if($query = implode(',', $playerRowFieldChanges)) { |
|
306 | + if ($query = implode(',', $playerRowFieldChanges)) { |
|
307 | 307 | classSupernova::$gc->db->doUpdate("UPDATE `{{users}}` SET {$query} WHERE id = {$userId}"); |
308 | 308 | } |
309 | 309 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | public static function db_lock_tables($tables) { |
206 | 206 | $tables = is_array($tables) ? $tables : array($tables => ''); |
207 | 207 | foreach ($tables as $table_name => $condition) { |
208 | - self::$db->doSelect("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : '')); |
|
208 | + self::$db->doSelect("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : '')); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | $query = static::$db->doSelect( |
248 | 248 | "SELECT |
249 | 249 | distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id |
250 | - FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
251 | - ($filter ? ' WHERE ' . $filter : '') . |
|
250 | + FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
251 | + ($filter ? ' WHERE '.$filter : ''). |
|
252 | 252 | ($fetch ? ' LIMIT 1' : '')); |
253 | 253 | while ($row = db_fetch($query)) { |
254 | 254 | // Исключаем из списка родительских ИД уже заблокированные записи |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | if ($indexes_str = implode(',', $parent_id_list)) { |
262 | 262 | $parent_id_field = static::$location_info[$owner_location_type][P_ID]; |
263 | 263 | static::db_get_record_list($owner_location_type, |
264 | - $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
264 | + $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | 269 | $query = static::$db->doSelect( |
270 | - "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
270 | + "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
271 | 271 | (($filter = trim($filter)) ? " WHERE {$filter}" : '') |
272 | 272 | . " FOR UPDATE" |
273 | 273 | ); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $condition = trim($condition); |
342 | 342 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
343 | 343 | |
344 | - if ($result = static::$db->doUpdate("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) { |
|
344 | + if ($result = static::$db->doUpdate("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) { |
|
345 | 345 | |
346 | 346 | if (static::$db->db_affected_rows()) { // Обновляем данные только если ряд был затронут |
347 | 347 | // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | ini_get('magic_quotes_sybase') ? die('SN is incompatible with \'magic_quotes_sybase\' turned on. Disable it in php.ini or .htaccess...') : false; |
492 | 492 | if (@get_magic_quotes_gpc()) { |
493 | 493 | $gpcr = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); |
494 | - array_walk_recursive($gpcr, function (&$value, $key) { |
|
494 | + array_walk_recursive($gpcr, function(&$value, $key) { |
|
495 | 495 | $value = stripslashes($value); |
496 | 496 | }); |
497 | 497 | } |
@@ -507,43 +507,43 @@ discard block |
||
507 | 507 | $gc = static::$gc; |
508 | 508 | |
509 | 509 | // Default db |
510 | - $gc->db = function ($c) { |
|
510 | + $gc->db = function($c) { |
|
511 | 511 | $db = new db_mysql($c); |
512 | 512 | $db->sn_db_connect(); |
513 | 513 | |
514 | 514 | return $db; |
515 | 515 | }; |
516 | 516 | |
517 | - $gc->debug = function ($c) { |
|
517 | + $gc->debug = function($c) { |
|
518 | 518 | return new debug(); |
519 | 519 | }; |
520 | 520 | |
521 | - $gc->cache = function ($c) { |
|
521 | + $gc->cache = function($c) { |
|
522 | 522 | return new classCache(classSupernova::$cache_prefix); |
523 | 523 | }; |
524 | 524 | |
525 | - $gc->config = function ($c) { |
|
525 | + $gc->config = function($c) { |
|
526 | 526 | return new classConfig(classSupernova::$cache_prefix); |
527 | 527 | }; |
528 | 528 | |
529 | - $gc->localePlayer = function (GlobalContainer $c) { |
|
529 | + $gc->localePlayer = function(GlobalContainer $c) { |
|
530 | 530 | return new classLocale($c->config->server_locale_log_usage); |
531 | 531 | }; |
532 | 532 | |
533 | - $gc->dbRowOperator = function ($c) { |
|
533 | + $gc->dbRowOperator = function($c) { |
|
534 | 534 | return new DbRowDirectOperator($c); |
535 | 535 | }; |
536 | 536 | |
537 | 537 | $gc->buddyClass = 'Buddy\BuddyModel'; |
538 | - $gc->buddy = $gc->factory(function (GlobalContainer $c) { |
|
538 | + $gc->buddy = $gc->factory(function(GlobalContainer $c) { |
|
539 | 539 | return new $c->buddyClass($c); |
540 | 540 | }); |
541 | 541 | |
542 | - $gc->query = $gc->factory(function (GlobalContainer $c) { |
|
542 | + $gc->query = $gc->factory(function(GlobalContainer $c) { |
|
543 | 543 | return new DbQueryConstructor($c->db); |
544 | 544 | }); |
545 | 545 | |
546 | - $gc->unit = $gc->factory(function (GlobalContainer $c) { |
|
546 | + $gc->unit = $gc->factory(function(GlobalContainer $c) { |
|
547 | 547 | return new \V2Unit\V2UnitModel($c); |
548 | 548 | }); |
549 | 549 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | public static function init_3_load_config_file() { |
557 | 557 | $dbsettings = array(); |
558 | 558 | |
559 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
559 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
560 | 560 | self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix']; |
561 | 561 | self::$db_name = $dbsettings['name']; |
562 | 562 | self::$sn_secret_word = $dbsettings['secretword']; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | if (SnCache::isUnitLocatorNotSet($location_type, $location_id)) { |
27 | - $got_data = classSupernova::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND " . DBStaticUnit::db_unit_time_restrictions()); |
|
27 | + $got_data = classSupernova::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND ".DBStaticUnit::db_unit_time_restrictions()); |
|
28 | 28 | if (!empty($got_data) && is_array($got_data)) { |
29 | 29 | foreach ($got_data as $unit_id => $unit_data) { |
30 | 30 | SnCache::setUnitLocatorByLocationAndIDs($location_type, $location_id, $unit_data); |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | |
60 | 60 | public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) { |
61 | 61 | $query = classSupernova::$db->doSelect( |
62 | - "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} " . |
|
63 | - ($unit_type ? "AND `unit_type` = {$unit_type} " : '') . |
|
64 | - ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') . |
|
62 | + "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} ". |
|
63 | + ($unit_type ? "AND `unit_type` = {$unit_type} " : ''). |
|
64 | + ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : ''). |
|
65 | 65 | 'GROUP BY `unit_snid`' |
66 | 66 | ); |
67 | 67 | $result = array(); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | WHERE |
82 | 82 | f.fleet_owner = {$user_id} AND |
83 | 83 | (f.fleet_start_planet_id = {$location_id} OR f.fleet_end_planet_id = {$location_id}) |
84 | - AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = " . LOC_FLEET . " AND " . self::db_unit_time_restrictions() . |
|
85 | - " LIMIT 1" . |
|
84 | + AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = ".LOC_FLEET." AND ".self::db_unit_time_restrictions(). |
|
85 | + " LIMIT 1". |
|
86 | 86 | ($for_update ? ' FOR UPDATE' : '')); |
87 | 87 | } |
88 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public static function db_unit_list_laboratories($user_id) { |
91 | 91 | return classSupernova::$db->doSelect("SELECT DISTINCT unit_location_id AS `id` |
92 | 92 | FROM {{unit}} |
93 | - WHERE unit_player_id = {$user_id} AND unit_location_type = " . LOC_PLANET . " AND unit_level > 0 AND unit_snid IN (" . STRUC_LABORATORY . ", " . STRUC_LABORATORY_NANO . ");"); |
|
93 | + WHERE unit_player_id = {$user_id} AND unit_location_type = ".LOC_PLANET." AND unit_level > 0 AND unit_snid IN (".STRUC_LABORATORY.", ".STRUC_LABORATORY_NANO.");"); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | public static function db_unit_set_by_id($unit_id, $set) { |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | |
109 | 109 | public static function db_unit_list_delete($user_id = 0, $unit_location_type, $unit_location_id = 0, $unit_snid = 0) { |
110 | 110 | return classSupernova::db_del_record_list(LOC_UNIT, |
111 | - "`unit_location_type` = {$unit_location_type}" . |
|
112 | - ($unit_location_id = idval($unit_location_id) ? " AND `unit_location_id` = {$unit_location_id}" : '') . |
|
113 | - ($user_id = idval($user_id) ? " AND `unit_player_id` = {$user_id}" : '') . |
|
111 | + "`unit_location_type` = {$unit_location_type}". |
|
112 | + ($unit_location_id = idval($unit_location_id) ? " AND `unit_location_id` = {$unit_location_id}" : ''). |
|
113 | + ($user_id = idval($user_id) ? " AND `unit_player_id` = {$user_id}" : ''). |
|
114 | 114 | ($unit_snid = idval($unit_snid) ? " AND `unit_snid` = {$unit_snid}" : '')); |
115 | 115 | } |
116 | 116 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | return classSupernova::$db->doSelect( |
119 | 119 | "SELECT unit_player_id, unit_type, unit_snid, unit_level, count(*) AS unit_amount |
120 | 120 | FROM `{{unit}}` |
121 | - WHERE unit_level > 0 AND " . self::db_unit_time_restrictions() . |
|
121 | + WHERE unit_level > 0 AND " . self::db_unit_time_restrictions(). |
|
122 | 122 | " GROUP BY unit_player_id, unit_type, unit_snid, unit_level" |
123 | 123 | ); |
124 | 124 | } |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | |
131 | 131 | |
132 | 132 | public static function db_unit_list_admin_delete_mercenaries_finished() { |
133 | - return classSupernova::$db->doDelete("DELETE FROM `{{unit}}` WHERE unit_time_finish IS NOT NULL AND unit_time_finish < FROM_UNIXTIME(" . SN_TIME_NOW . ") AND unit_type = " . UNIT_MERCENARIES); |
|
133 | + return classSupernova::$db->doDelete("DELETE FROM `{{unit}}` WHERE unit_time_finish IS NOT NULL AND unit_time_finish < FROM_UNIXTIME(".SN_TIME_NOW.") AND unit_type = ".UNIT_MERCENARIES); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | public static function db_unit_list_admin_set_mercenaries_expire_time($default_length) { |
137 | 137 | return classSupernova::$db->doUpdate( |
138 | 138 | "UPDATE `{{unit}}` |
139 | 139 | SET |
140 | - unit_time_start = FROM_UNIXTIME(" . SN_TIME_NOW . "), |
|
141 | - unit_time_finish = FROM_UNIXTIME(" . (SN_TIME_NOW + $default_length) . ") |
|
140 | + unit_time_start = FROM_UNIXTIME(" . SN_TIME_NOW."), |
|
141 | + unit_time_finish = FROM_UNIXTIME(" . (SN_TIME_NOW + $default_length).") |
|
142 | 142 | WHERE unit_type = " . UNIT_MERCENARIES |
143 | 143 | ); |
144 | 144 | } |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | |
164 | 164 | $temp = DBStaticUnit::db_get_unit_by_location($user['id'], $unit_location, $location_id, $unit_id, true, 'unit_id'); |
165 | 165 | if (!empty($temp['unit_id'])) { |
166 | - $result = (bool)classSupernova::db_upd_record_list( |
|
166 | + $result = (bool) classSupernova::db_upd_record_list( |
|
167 | 167 | LOC_UNIT, "`unit_level` = `unit_level` + ($unit_value)", "`unit_id` = {$temp['unit_id']}" |
168 | 168 | ); |
169 | 169 | } else { |
170 | 170 | $locationIdRendered = $unit_location == LOC_USER ? $user['id'] : $planet_id; |
171 | 171 | $unitType = get_unit_param($unit_id, P_UNIT_TYPE); |
172 | - $result = (bool)classSupernova::db_ins_record( |
|
172 | + $result = (bool) classSupernova::db_ins_record( |
|
173 | 173 | LOC_UNIT, |
174 | 174 | "unit_player_id = {$user['id']}, |
175 | 175 | unit_location_type = {$unit_location}, |
@@ -55,11 +55,10 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | public static function db_planet_by_vector($vector, $prefix = '', $for_update = false, $fields = '*') { |
58 | - $galaxy = isset($vector[$prefix . 'galaxy']) ? intval($vector[$prefix . 'galaxy']) : 0; |
|
59 | - $system = isset($vector[$prefix . 'system']) ? intval($vector[$prefix . 'system']) : 0; |
|
60 | - $planet = isset($vector[$prefix . 'planet']) ? intval($vector[$prefix . 'planet']) : 0; |
|
61 | - $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : |
|
62 | - (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0); |
|
58 | + $galaxy = isset($vector[$prefix.'galaxy']) ? intval($vector[$prefix.'galaxy']) : 0; |
|
59 | + $system = isset($vector[$prefix.'system']) ? intval($vector[$prefix.'system']) : 0; |
|
60 | + $planet = isset($vector[$prefix.'planet']) ? intval($vector[$prefix.'planet']) : 0; |
|
61 | + $planet_type = isset($vector[$prefix.'planet_type']) ? intval($vector[$prefix.'planet_type']) : (isset($vector[$prefix.'type']) ? intval($vector[$prefix.'type']) : 0); |
|
63 | 62 | $planet_type = $planet_type == PT_DEBRIS ? PT_PLANET : $planet_type; |
64 | 63 | |
65 | 64 | return DBStaticPlanet::db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update, $fields); |
@@ -85,7 +84,7 @@ discard block |
||
85 | 84 | } |
86 | 85 | |
87 | 86 | return classSupernova::db_get_record_list(LOC_PLANET, |
88 | - "`parent_planet` = {$parent_id} AND `planet_type` = " . PT_MOON, true); |
|
87 | + "`parent_planet` = {$parent_id} AND `planet_type` = ".PT_MOON, true); |
|
89 | 88 | } |
90 | 89 | |
91 | 90 | public static function db_planet_by_id_and_owner($planet_id, $owner_id, $for_update = false, $fields = '*') { |
@@ -106,7 +105,7 @@ discard block |
||
106 | 105 | } |
107 | 106 | |
108 | 107 | return classSupernova::db_get_record_list(LOC_PLANET, |
109 | - "`planet_type` = " . PT_MOON . " AND `id_owner` = {$user_id} AND `id` != {$this_moon_id}"); |
|
108 | + "`planet_type` = ".PT_MOON." AND `id_owner` = {$user_id} AND `id` != {$this_moon_id}"); |
|
110 | 109 | } |
111 | 110 | |
112 | 111 | public static function db_planet_list_in_system($galaxy, $system) { |
@@ -132,7 +131,7 @@ discard block |
||
132 | 131 | ); |
133 | 132 | $order_by = classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT]; |
134 | 133 | empty($sort_orders[$order_by]) ? $order_by = SORT_ID : false; |
135 | - $order_by = $sort_orders[$order_by] . ' ' . (classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT_INVERSE] == SORT_ASCENDING ? 'ASC' : 'DESC'); |
|
134 | + $order_by = $sort_orders[$order_by].' '.(classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT_INVERSE] == SORT_ASCENDING ? 'ASC' : 'DESC'); |
|
136 | 135 | |
137 | 136 | // Compilating query |
138 | 137 | return classSupernova::db_get_record_list(LOC_PLANET, |
@@ -157,7 +156,7 @@ discard block |
||
157 | 156 | $fieldName = pname_resource_name($resourceId); |
158 | 157 | $value = "{$fieldName} = {$fieldName} + ('{$value}')"; |
159 | 158 | } |
160 | - if($query = implode(',', $planetRowFieldChanges)) { |
|
159 | + if ($query = implode(',', $planetRowFieldChanges)) { |
|
161 | 160 | classSupernova::$gc->db->doUpdate("UPDATE `{{planets}}` SET {$query} WHERE id = {$planetId}"); |
162 | 161 | } |
163 | 162 | } |
@@ -208,7 +207,7 @@ discard block |
||
208 | 207 | return false; |
209 | 208 | } |
210 | 209 | classSupernova::db_del_record_by_id(LOC_PLANET, $planet_id); |
211 | - classSupernova::db_del_record_list(LOC_UNIT, "`unit_location_type` = " . LOC_PLANET . " AND `unit_location_id` = " . $planet_id); |
|
210 | + classSupernova::db_del_record_list(LOC_UNIT, "`unit_location_type` = ".LOC_PLANET." AND `unit_location_id` = ".$planet_id); |
|
212 | 211 | |
213 | 212 | // Очереди очистятся автоматически по FOREIGN KEY |
214 | 213 | return true; |
@@ -220,7 +219,7 @@ discard block |
||
220 | 219 | return false; |
221 | 220 | } |
222 | 221 | classSupernova::db_del_record_list(LOC_PLANET, "`id_owner` = {$si_owner_id}"); |
223 | - classSupernova::db_del_record_list(LOC_UNIT, "`unit_location_type` = " . LOC_PLANET . " AND `unit_player_id` = " . $si_owner_id); |
|
222 | + classSupernova::db_del_record_list(LOC_UNIT, "`unit_location_type` = ".LOC_PLANET." AND `unit_player_id` = ".$si_owner_id); |
|
224 | 223 | |
225 | 224 | // Очереди очистятся автоматически по FOREIGN KEY |
226 | 225 | return true; |