@@ -136,7 +136,7 @@ |
||
136 | 136 | $dbq->setWhereArray(static::translateNames($propertyFilter, static::PROPERTIES_TO_FIELDS)); |
137 | 137 | } |
138 | 138 | |
139 | - if(static::$_forUpdate == DbQuery::DB_FOR_UPDATE) { |
|
139 | + if (static::$_forUpdate == DbQuery::DB_FOR_UPDATE) { |
|
140 | 140 | $dbq->setForUpdate(); |
141 | 141 | static::$_forUpdate = DbQuery::DB_SHARED; |
142 | 142 | } |
@@ -165,8 +165,7 @@ discard block |
||
165 | 165 | $planet_info[PLANET_SYSTEM], |
166 | 166 | $planet_info[PLANET_PLANET], |
167 | 167 | htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'), |
168 | - $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : |
|
169 | - ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
168 | + $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
170 | 169 | ); |
171 | 170 | |
172 | 171 | $text_defender = ''; |
@@ -251,7 +250,7 @@ discard block |
||
251 | 250 | // Просматриваем результаты изменения флотов |
252 | 251 | foreach ($fleet_info[UBE_COUNT] as $unit_id => $unit_count) { |
253 | 252 | // Перебираем аутком на случай восстановления юнитов |
254 | - $units_lost = (float)$fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id]; |
|
253 | + $units_lost = (float) $fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id]; |
|
255 | 254 | |
256 | 255 | $units_left = $unit_count - $units_lost; |
257 | 256 | if ($fleet_id) { |
@@ -275,7 +274,7 @@ discard block |
||
275 | 274 | // Если во флоте остались юниты или это планета - генерируем изменение ресурсов |
276 | 275 | if ($new_fleet_count || !$fleet_id) { |
277 | 276 | foreach (sn_get_groups('resources_loot') as $resource_id) { |
278 | - $resource_change = (float)$fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float)$fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id]; |
|
277 | + $resource_change = (float) $fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float) $fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id]; |
|
279 | 278 | if ($resource_change) { |
280 | 279 | $resource_db_name = ($fleet_id ? 'fleet_resource_' : '') . pname_resource_name($resource_id); |
281 | 280 | $fleet_delta[$resource_db_name] = -($resource_change); |
@@ -290,10 +290,12 @@ discard block |
||
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
293 | - if ($fleet_id) // Не планета |
|
293 | + if ($fleet_id) { |
|
294 | + // Не планета |
|
294 | 295 | { |
295 | 296 | if ($fleet_info[UBE_FLEET_TYPE] == UBE_ATTACKERS && $outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_DIED) { |
296 | 297 | $new_fleet_count = 0; |
298 | + } |
|
297 | 299 | } |
298 | 300 | |
299 | 301 | if ($new_fleet_count) { |
@@ -316,10 +318,12 @@ discard block |
||
316 | 318 | } |
317 | 319 | DBStaticPlanet::db_planet_set_by_id($planet_id, implode(',', $temp)); |
318 | 320 | } |
319 | - if (!empty($db_changeset)) // Сохраняем изменения юнитов на планете - если они есть |
|
321 | + if (!empty($db_changeset)) { |
|
322 | + // Сохраняем изменения юнитов на планете - если они есть |
|
320 | 323 | { |
321 | 324 | OldDbChangeSet::db_changeset_apply($db_changeset); |
322 | 325 | } |
326 | + } |
|
323 | 327 | } |
324 | 328 | } |
325 | 329 |
@@ -236,9 +236,11 @@ |
||
236 | 236 | } |
237 | 237 | |
238 | 238 | // Если новая планета не найдена или было переключения - проверяем текущую выбранную планету |
239 | - if (!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet'] |
|
239 | + if (!isset($planet_row['id'])) { |
|
240 | + // || $planet_row['id'] != $user['current_planet'] |
|
240 | 241 | { |
241 | 242 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['current_planet'], $user['id'], false, 'id'); |
243 | + } |
|
242 | 244 | // Если текущей планеты не существует - выставляем Столицу |
243 | 245 | if (!isset($planet_row['id'])) { |
244 | 246 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['id_planet'], $user['id'], false, 'id'); |
@@ -96,8 +96,7 @@ |
||
96 | 96 | |
97 | 97 | $core_info = uni_create_planet_get_density($position_data, $user_row, $planet_sectors); |
98 | 98 | |
99 | - $planet_name_unsafe = !empty($options['force_name']) ? $options['force_name'] : |
|
100 | - ($user_row['username'] . ' ' . ( |
|
99 | + $planet_name_unsafe = !empty($options['force_name']) ? $options['force_name'] : ($user_row['username'] . ' ' . ( |
|
101 | 100 | $HomeWorld |
102 | 101 | ? SN::$lang['sys_capital'] |
103 | 102 | : ($planet_name_unsafe ? $planet_name_unsafe : SN::$lang['sys_colo_defaultname']) |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | { |
5 | 5 | global $lang; |
6 | 6 | |
7 | - if(!in_array($unit_id, sn_get_groups('artifacts'))) |
|
7 | + if (!in_array($unit_id, sn_get_groups('artifacts'))) |
|
8 | 8 | { |
9 | 9 | return; |
10 | 10 | } |
@@ -13,17 +13,17 @@ discard block |
||
13 | 13 | $user = db_user_by_id($user['id'], true); |
14 | 14 | |
15 | 15 | $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true); |
16 | - if($unit_level > 0) |
|
16 | + if ($unit_level > 0) |
|
17 | 17 | { |
18 | 18 | $db_changeset = array(); |
19 | - switch($unit_id) |
|
19 | + switch ($unit_id) |
|
20 | 20 | { |
21 | 21 | case ART_LHC: |
22 | 22 | case ART_HOOK_SMALL: |
23 | 23 | case ART_HOOK_MEDIUM: |
24 | 24 | case ART_HOOK_LARGE: |
25 | 25 | $has_moon = DBStaticPlanet::db_planet_by_parent($planetrow['id'], true, '`id`'); |
26 | - if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) |
|
26 | + if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) |
|
27 | 27 | { |
28 | 28 | $unit_level--; |
29 | 29 | $updateDebris = false; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | break; |
45 | 45 | } |
46 | 46 | |
47 | - if($moonSize) |
|
47 | + if ($moonSize) |
|
48 | 48 | { |
49 | 49 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moonSize, $updateDebris); |
50 | 50 | $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moonSize)); |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | case ART_RCD_MEDIUM: |
66 | 66 | case ART_RCD_LARGE: |
67 | 67 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
68 | - if($planetrow['planet_type'] != PT_PLANET) |
|
68 | + if ($planetrow['planet_type'] != PT_PLANET) |
|
69 | 69 | { |
70 | 70 | $message = $lang['art_rcd_err_moon']; |
71 | 71 | break; |
72 | 72 | } |
73 | 73 | |
74 | 74 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false); |
75 | - if(!empty($que['items'])) |
|
75 | + if (!empty($que['items'])) |
|
76 | 76 | { |
77 | 77 | $message = $lang['art_rcd_err_que']; |
78 | 78 | break; |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | $artifact_deploy = get_unit_param($unit_id, P_DEPLOY); |
82 | 82 | |
83 | 83 | $sectors_used = 0; |
84 | - foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
84 | + foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
85 | 85 | { |
86 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
86 | + if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
87 | 87 | continue; |
88 | 88 | $sectors_used += $levels_deployed; |
89 | 89 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); |
90 | 90 | } |
91 | 91 | |
92 | - if($sectors_used == 0) |
|
92 | + if ($sectors_used == 0) |
|
93 | 93 | { |
94 | 94 | $message = $lang['art_rcd_err_no_sense']; |
95 | 95 | break; |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | $que_item = null; |
105 | 105 | $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true); |
106 | 106 | $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0]; |
107 | - if(!empty($current_que)) |
|
107 | + if (!empty($current_que)) |
|
108 | 108 | { |
109 | 109 | reset($current_que); |
110 | 110 | $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)]; |
111 | 111 | } |
112 | 112 | |
113 | - if(!empty($que_item) && $que_item['que_time_left'] > 60) |
|
113 | + if (!empty($que_item) && $que_item['que_time_left'] > 60) |
|
114 | 114 | { |
115 | 115 | $unit_level--; |
116 | 116 | $old_time = $que_item['que_time_left']; |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true); |
132 | 132 | $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']]; |
133 | 133 | // $que_item = &$que['que'][QUE_STRUCTURES][0]; |
134 | - if(!empty($current_que)) |
|
134 | + if (!empty($current_que)) |
|
135 | 135 | { |
136 | 136 | reset($current_que); |
137 | 137 | $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)]; |
138 | 138 | } |
139 | 139 | |
140 | - if(isset($que_item) && $que_item['que_time_left'] > 60) |
|
140 | + if (isset($que_item) && $que_item['que_time_left'] > 60) |
|
141 | 141 | { |
142 | 142 | $unit_level--; |
143 | 143 | $old_time = $que_item['que_time_left']; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | break; |
156 | 156 | |
157 | 157 | } |
158 | - if($unit_level != $artifact_level_old) |
|
158 | + if ($unit_level != $artifact_level_old) |
|
159 | 159 | { |
160 | 160 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user); |
161 | 161 | OldDbChangeSet::db_changeset_apply($db_changeset); |
@@ -5,8 +5,7 @@ discard block |
||
5 | 5 | use Que\DBStaticQue; |
6 | 6 | use Universe\Universe; |
7 | 7 | |
8 | -function art_use(&$user, &$planetrow, $unit_id) |
|
9 | -{ |
|
8 | +function art_use(&$user, &$planetrow, $unit_id) { |
|
10 | 9 | global $lang; |
11 | 10 | |
12 | 11 | if(!in_array($unit_id, sn_get_groups('artifacts'))) |
@@ -53,14 +52,12 @@ discard block |
||
53 | 52 | { |
54 | 53 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moonSize, $updateDebris); |
55 | 54 | $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moonSize)); |
56 | - } |
|
57 | - else |
|
55 | + } else |
|
58 | 56 | { |
59 | 57 | $message = $lang['art_lhc_moon_fail']; |
60 | 58 | } |
61 | 59 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message); |
62 | - } |
|
63 | - else |
|
60 | + } else |
|
64 | 61 | { |
65 | 62 | $message = $lang['art_moon_exists']; |
66 | 63 | } |
@@ -88,8 +85,9 @@ discard block |
||
88 | 85 | $sectors_used = 0; |
89 | 86 | foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
90 | 87 | { |
91 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
92 | - continue; |
|
88 | + if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) { |
|
89 | + continue; |
|
90 | + } |
|
93 | 91 | $sectors_used += $levels_deployed; |
94 | 92 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); |
95 | 93 | } |
@@ -123,8 +121,7 @@ discard block |
||
123 | 121 | DBStaticQue::db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']); |
124 | 122 | $message = sprintf($lang['art_heurestic_chip_ok'], $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], sys_time_human($old_time - $que_item['que_time_left'])); |
125 | 123 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message); |
126 | - } |
|
127 | - else |
|
124 | + } else |
|
128 | 125 | { |
129 | 126 | $message = $lang['art_heurestic_chip_no_research']; |
130 | 127 | } |
@@ -152,8 +149,7 @@ discard block |
||
152 | 149 | $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], $planetrow['name'], uni_render_coordinates($planetrow), sys_time_human($old_time - $que_item['que_time_left']) |
153 | 150 | ); |
154 | 151 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message); |
155 | - } |
|
156 | - else |
|
152 | + } else |
|
157 | 153 | { |
158 | 154 | $message = $lang['art_nano_builder_no_que']; |
159 | 155 | } |
@@ -165,8 +161,7 @@ discard block |
||
165 | 161 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user); |
166 | 162 | OldDbChangeSet::db_changeset_apply($db_changeset); |
167 | 163 | } |
168 | - } |
|
169 | - else |
|
164 | + } else |
|
170 | 165 | { |
171 | 166 | $message = $lang['art_err_no_artifact']; |
172 | 167 | } |
@@ -72,7 +72,7 @@ |
||
72 | 72 | // Для не-симулятора - рандомизируем каждый раунд значения атаки и щитов |
73 | 73 | $fleet_data[UBE_ATTACK_BASE][$unit_id] = floor($fleet_info[UBE_ATTACK][$unit_id] * ($isSimulatorStatic ? 1 : mt_rand(80, 120) / 100)); |
74 | 74 | $fleet_data[UBE_SHIELD_BASE][$unit_id] = floor($fleet_info[UBE_SHIELD][$unit_id] * ($isSimulatorStatic ? 1 : mt_rand(80, 120) / 100)); |
75 | - $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]);// * ($is_simulator ? 1 : mt_rand(80, 120) / 100)); |
|
75 | + $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]); // * ($is_simulator ? 1 : mt_rand(80, 120) / 100)); |
|
76 | 76 | |
77 | 77 | $fleet_data[UBE_ATTACK][$unit_id] = $fleet_data[UBE_ATTACK_BASE][$unit_id] * $unit_count; |
78 | 78 | $fleet_data[UBE_SHIELD][$unit_id] = $fleet_data[UBE_SHIELD_BASE][$unit_id] * $unit_count; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * |
41 | 41 | * @var int[] $shipsToRemove |
42 | 42 | */ |
43 | - protected $shipsToRemove = [SHIP_COLONIZER, SHIP_SPY,]; |
|
43 | + protected $shipsToRemove = [SHIP_COLONIZER, SHIP_SPY, ]; |
|
44 | 44 | |
45 | 45 | // ------------------------------------------------------------------------------------------------------------------- |
46 | 46 | /** |
@@ -359,7 +359,7 @@ |
||
359 | 359 | ); |
360 | 360 | } |
361 | 361 | |
362 | - updPatchApply(1, function () { |
|
362 | + updPatchApply(1, function() { |
|
363 | 363 | $q = upd_do_query("SELECT `messageid`, `user` FROM `{{chat}}`", true); |
364 | 364 | while ($row = db_fetch($q)) { |
365 | 365 | if (strpos($row['user'], 'a:') !== 0) { |
@@ -85,7 +85,7 @@ |
||
85 | 85 | |
86 | 86 | $template->assign_block_vars('user', array( |
87 | 87 | 'ID' => $user_row['id'], |
88 | - 'NAME' => $renderedNick = player_nick_render_to_html($user_row, ['player_rank' => true, 'vacancy' => true, 'birthday' => true, 'award' => true, NICK_RANK_NO_TEXT => true,]), |
|
88 | + 'NAME' => $renderedNick = player_nick_render_to_html($user_row, ['player_rank' => true, 'vacancy' => true, 'birthday' => true, 'award' => true, NICK_RANK_NO_TEXT => true, ]), |
|
89 | 89 | 'NAME_HTML' => htmlentities($user_row['username'], ENT_QUOTES, 'UTF-8'), |
90 | 90 | 'IP' => $user_row['user_lastip'], |
91 | 91 | 'IP_MULTI' => intval($multi_ip[$user_row['user_lastip']]), |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | || |
126 | 126 | (!empty($uni_galaxyRowPlanet['destruyed']) && CheckAbandonPlanetState($uni_galaxyRowPlanet)) |
127 | 127 | ) { |
128 | - $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet,]); |
|
128 | + $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet, ]); |
|
129 | 129 | continue; |
130 | 130 | } |
131 | 131 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | 'IS_CAPITAL' => $uni_galaxyRowUser['id_planet'] == $uni_galaxyRowPlanet['id'], |
243 | 243 | |
244 | 244 | 'USER_ID' => $uni_galaxyRowUser['id'], |
245 | - 'USER_NAME' => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true,]), |
|
245 | + 'USER_NAME' => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true, ]), |
|
246 | 246 | 'USER_NAME_JS' => js_safe_string($renderedNick), |
247 | 247 | 'USER_RANK' => in_array($uni_galaxyRowUser['id'], $user_skip_list) ? '-' : $uni_galaxyRowUser['total_rank'], |
248 | 248 | 'USER_BANNED' => $uni_galaxyRowUser['banaday'], |