@@ -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 | } |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | |
144 | 144 | preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches); |
145 | 145 | $include_blocks = $matches[1]; |
146 | - if($include_blocks) |
|
146 | + if ($include_blocks) |
|
147 | 147 | { |
148 | - foreach($include_blocks as &$included_file) |
|
148 | + foreach ($include_blocks as &$included_file) |
|
149 | 149 | { |
150 | 150 | $included_file .= '.tpl.html'; |
151 | 151 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $varname = $var_val[3]; |
311 | 311 | $new = $this->generate_block_varref($namespace, $varname, $var_val[2]); |
312 | 312 | |
313 | - if(!empty($var_val[4])) { |
|
313 | + if (!empty($var_val[4])) { |
|
314 | 314 | $new = \Ptl\PtlVariableDecorator::decorate($var_val[0], $new, $this->template); |
315 | 315 | } |
316 | 316 | |
@@ -464,8 +464,8 @@ discard block |
||
464 | 464 | |
465 | 465 | $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; |
466 | 466 | // $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;'; |
467 | - $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
468 | - $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
467 | + $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
468 | + $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
469 | 469 | |
470 | 470 | return $tag_template_php; |
471 | 471 | } |
@@ -569,10 +569,10 @@ discard block |
||
569 | 569 | break; |
570 | 570 | |
571 | 571 | case 'is': |
572 | - $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1; |
|
572 | + $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1; |
|
573 | 573 | $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); |
574 | 574 | |
575 | - $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); |
|
575 | + $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1)); |
|
576 | 576 | |
577 | 577 | array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens); |
578 | 578 | |
@@ -836,11 +836,11 @@ discard block |
||
836 | 836 | } |
837 | 837 | else if ($include_last_iterator) |
838 | 838 | { |
839 | - return '$_'. $blocks[$blockcount] . '_val'; |
|
839 | + return '$_' . $blocks[$blockcount] . '_val'; |
|
840 | 840 | } |
841 | 841 | else |
842 | 842 | { |
843 | - return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
|
843 | + return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']'; |
|
844 | 844 | } |
845 | 845 | } |
846 | 846 | |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | if ($fp = @fopen($filename, 'wb')) |
858 | 858 | { |
859 | 859 | @flock($fp, LOCK_EX); |
860 | - @fwrite ($fp, $data); |
|
860 | + @fwrite($fp, $data); |
|
861 | 861 | @flock($fp, LOCK_UN); |
862 | 862 | @fclose($fp); |
863 | 863 | |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | { |
878 | 878 | global $config; |
879 | 879 | |
880 | - if(!$config->tpl_minifier) |
|
880 | + if (!$config->tpl_minifier) |
|
881 | 881 | { |
882 | 882 | return $html; |
883 | 883 | } |
@@ -889,14 +889,14 @@ discard block |
||
889 | 889 | //$html = preg_replace('/[\r\n\t]+/', ' ', $html); |
890 | 890 | $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags |
891 | 891 | $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space |
892 | - if(!empty($pre[0])) |
|
892 | + if (!empty($pre[0])) |
|
893 | 893 | { |
894 | - foreach($pre[0] as $tag) |
|
894 | + foreach ($pre[0] as $tag) |
|
895 | 895 | { |
896 | 896 | $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside |
897 | 897 | $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one |
898 | 898 | $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one |
899 | - $html = preg_replace('/#pre#/', $tag, $html,1); |
|
899 | + $html = preg_replace('/#pre#/', $tag, $html, 1); |
|
900 | 900 | } |
901 | 901 | } |
902 | 902 |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | ]); |
51 | 51 | }; |
52 | 52 | |
53 | -$ValidList['percent'] = array ( 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ); |
|
53 | +$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100); |
|
54 | 54 | $template = gettemplate('resources', true); |
55 | 55 | |
56 | 56 | $planet = new \Planet\Planet($planetrow['id']); |
57 | -if(!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
57 | +if (!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
58 | 58 | $template->assign_block_vars('result', $transmutation_result); |
59 | 59 | $planet = new \Planet\Planet($planetrow['id']); |
60 | 60 | } |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | $production = $_POST['production']; |
64 | 64 | //$SubQry = ''; |
65 | 65 | $SubQry = array(); |
66 | -if(is_array($production)) { |
|
67 | - foreach($production as $prod_id => $percent) { |
|
68 | - if($percent > 100 || $percent < 0) { |
|
66 | +if (is_array($production)) { |
|
67 | + foreach ($production as $prod_id => $percent) { |
|
68 | + if ($percent > 100 || $percent < 0) { |
|
69 | 69 | $debug->warning('Supplying wrong production percent (less then 0 or greater then 100)', 'Hack attempt', 302, array('base_dump' => true)); |
70 | 70 | die(); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $prod_id = intval($prod_id); |
74 | - if(in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
74 | + if (in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
75 | 75 | $field_name = pname_factory_production_field_name($prod_id); |
76 | 76 | $percent = floor($percent / 10); |
77 | 77 | $planetrow[$field_name] = $percent; |
78 | 78 | //$SubQry .= "`{$field_name}` = '{$percent}',"; |
79 | - $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
79 | + $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
80 | 80 | } else { |
81 | 81 | $debug->warning('Supplying wrong ID in production array - attempt to change some field - ID' . $prod_id, 'Resource Page', 301); |
82 | 82 | continue; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | 'ENERGY_TYPE' => $capsObj->productionCurrentMatrix[RES_ENERGY][0], |
114 | 114 | )); |
115 | 115 | |
116 | -foreach($sn_group_factories as $unit_id) |
|
116 | +foreach ($sn_group_factories as $unit_id) |
|
117 | 117 | { |
118 | - if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
118 | + if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
119 | 119 | { |
120 | 120 | $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true); |
121 | 121 | $template->assign_block_vars('production', array( |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $payment_methods_available = array_combine(array_keys(sn_module_payment::$payment_methods), array_fill(0, count(sn_module_payment::$payment_methods), null)); |
115 | -array_walk($payment_methods_available, function (&$value, $index) { |
|
115 | +array_walk($payment_methods_available, function(&$value, $index) { |
|
116 | 116 | $value = !empty(sn_module_payment::$payment_methods[$index]) ? array_combine(array_keys(sn_module_payment::$payment_methods[$index]), array_fill(0, count(sn_module_payment::$payment_methods[$index]), null)) : $value; |
117 | 117 | }); |
118 | 118 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | 'PLAYER_CURRENCY' => $player_currency, |
301 | 301 | 'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10), |
302 | 302 | |
303 | - 'UNIT_AMOUNT' => (float)$request['metamatter'], |
|
303 | + 'UNIT_AMOUNT' => (float) $request['metamatter'], |
|
304 | 304 | 'UNIT_AMOUNT_TEXT' => HelperString::numberFloorAndFormat($request['metamatter']), |
305 | 305 | 'UNIT_AMOUNT_BONUS_PERCENT' => $bonus_percent, |
306 | 306 | 'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text, |
@@ -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); |
@@ -118,7 +118,7 @@ |
||
118 | 118 | // Для не-симулятора - рандомизируем каждый раунд значения атаки и щитов |
119 | 119 | $fleet_data[UBE_ATTACK_BASE][$unit_id] = floor($fleet_info[UBE_ATTACK][$unit_id] * ($is_simulator ? 1 : mt_rand(80, 120) / 100)); |
120 | 120 | $fleet_data[UBE_SHIELD_BASE][$unit_id] = floor($fleet_info[UBE_SHIELD][$unit_id] * ($is_simulator ? 1 : mt_rand(80, 120) / 100)); |
121 | - $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]);// * ($is_simulator ? 1 : mt_rand(80, 120) / 100)); |
|
121 | + $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]); // * ($is_simulator ? 1 : mt_rand(80, 120) / 100)); |
|
122 | 122 | |
123 | 123 | $fleet_data[UBE_ATTACK][$unit_id] = $fleet_data[UBE_ATTACK_BASE][$unit_id] * $unit_count; |
124 | 124 | $fleet_data[UBE_SHIELD][$unit_id] = $fleet_data[UBE_SHIELD_BASE][$unit_id] * $unit_count; |
@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | |
3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
4 | 4 | |
5 | -if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
5 | +if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
6 | 6 | $error_message = classSupernova::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : ( |
7 | 7 | !classSupernova::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : '' |
8 | 8 | ); |
9 | 9 | |
10 | - if($error_message) { |
|
10 | + if ($error_message) { |
|
11 | 11 | messageBox($lang[$error_message], $lang['sys_error'], 'overview.php', 10); |
12 | 12 | die(); |
13 | 13 | } |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | $current_round = intval(classSupernova::$config->db_loadItem('game_blitz_register_round')); |
18 | 18 | $current_price = intval(classSupernova::$config->db_loadItem('game_blitz_register_price')); |
19 | 19 | |
20 | -if(classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
20 | +if (classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
21 | 21 | sn_db_transaction_start(); |
22 | 22 | $user = db_user_by_id($user['id'], true); |
23 | 23 | $is_registered = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `user_id` = {$user['id']} AND `round_number` = {$current_round} FOR UPDATE;", true); |
24 | - if(sys_get_param_str('register_me')) { |
|
25 | - if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
24 | + if (sys_get_param_str('register_me')) { |
|
25 | + if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
26 | 26 | doquery("INSERT IGNORE INTO {{blitz_registrations}} SET `user_id` = {$user['id']}, `round_number` = {$current_round};"); |
27 | 27 | //mm_points_change($user['id'], RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
28 | 28 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
@@ -43,17 +43,17 @@ discard block |
||
43 | 43 | $blitz_players = 0; |
44 | 44 | $blitz_prize_dark_matter = 0; |
45 | 45 | $blitz_prize_places = 0; |
46 | -if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
47 | - if(sys_get_param_str('generate')) { |
|
46 | +if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
47 | + if (sys_get_param_str('generate')) { |
|
48 | 48 | $next_id = 0; |
49 | 49 | $query = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY RAND();"); |
50 | - while($row = db_fetch($query)) { |
|
50 | + while ($row = db_fetch($query)) { |
|
51 | 51 | $next_id++; |
52 | 52 | $blitz_name = 'Игрок' . $next_id; |
53 | 53 | $blitz_password = sys_random_string(8); |
54 | 54 | doquery("UPDATE {{blitz_registrations}} SET blitz_name = '{$blitz_name}', blitz_password = '{$blitz_password}' WHERE `id` = {$row['id']} AND `round_number` = {$current_round};"); |
55 | 55 | } |
56 | - } elseif(sys_get_param_str('import_generated')) { |
|
56 | + } elseif (sys_get_param_str('import_generated')) { |
|
57 | 57 | // ЭТО НА БЛИЦЕ!!! |
58 | 58 | doquery("DELETE FROM {{users}} WHERE username like 'Игрок%';"); |
59 | 59 | doquery("DELETE FROM {{planets}} WHERE id_owner not in (SELECT `id` FROM {{users}});"); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $system = $system_step; |
76 | 76 | $planet = round(classSupernova::$config->game_maxPlanet / 2); |
77 | 77 | |
78 | - foreach($imported_string as &$string_data) { |
|
78 | + foreach ($imported_string as &$string_data) { |
|
79 | 79 | $string_data = explode(',', $string_data); |
80 | 80 | $username_safe = $string_data[0]; |
81 | 81 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], Universe::MOON_MAX_SIZE, false); |
91 | 91 | |
92 | - if(($system += $system_step) >= classSupernova::$config->game_maxSystem) { |
|
92 | + if (($system += $system_step) >= classSupernova::$config->game_maxSystem) { |
|
93 | 93 | $galaxy++; |
94 | 94 | $system = $system_step; |
95 | 95 | } |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | |
99 | 99 | classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->users_amount + $new_players); |
100 | 100 | // generated_string |
101 | - } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
101 | + } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
102 | 102 | $blitz_result = explode(';', $blitz_result_string); |
103 | 103 | $blitz_last_update = $blitz_result[0]; // Пока не используется |
104 | 104 | unset($blitz_result[0]); |
105 | - foreach($blitz_result as $blitz_result_data) { |
|
105 | + foreach ($blitz_result as $blitz_result_data) { |
|
106 | 106 | $blitz_result_data = explode(',', $blitz_result_data); |
107 | - if(count($blitz_result_data) == 5) { |
|
107 | + if (count($blitz_result_data) == 5) { |
|
108 | 108 | $blitz_result_data[1] = db_escape($blitz_result_data[1]); |
109 | 109 | doquery( |
110 | 110 | "UPDATE `{{blitz_registrations}}` SET |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | $blitz_result = array(); |
119 | 119 | } |
120 | 120 | |
121 | - if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
121 | + if (classSupernova::$config->game_mode == GAME_BLITZ) { |
|
122 | 122 | $blitz_result = array(classSupernova::$config->db_loadItem('var_stat_update')); |
123 | 123 | $query = doquery("SELECT id, username, total_rank, total_points, onlinetime FROM {{users}} ORDER BY `id`;"); |
124 | - while($row = db_fetch($query)) { |
|
124 | + while ($row = db_fetch($query)) { |
|
125 | 125 | $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}"; |
126 | 126 | } |
127 | 127 | } else { |
128 | 128 | $query = doquery("SELECT blitz_name, blitz_password, blitz_online FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `id`;"); |
129 | - while($row = db_fetch($query)) { |
|
129 | + while ($row = db_fetch($query)) { |
|
130 | 130 | $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}"; |
131 | 131 | $row['blitz_online'] ? $blitz_prize_players_active++ : false; |
132 | 132 | $blitz_players++; |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | 'Игрок40' |
142 | 142 | */ |
143 | 143 | |
144 | - if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
144 | + if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
145 | 145 | // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'); |
146 | 146 | $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places'); |
147 | 147 | sn_db_transaction_start(); |
148 | 148 | $query = doquery("SELECT * FROM {{blitz_registrations}} WHERE `round_number` = {$current_round} ORDER BY `blitz_place` FOR UPDATE;"); |
149 | - while($row = db_fetch($query)) { |
|
150 | - if(!$row['blitz_place']) { |
|
149 | + while ($row = db_fetch($query)) { |
|
150 | + if (!$row['blitz_place']) { |
|
151 | 151 | continue; |
152 | 152 | } |
153 | 153 | |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | $blitz_prize_places_actual--; |
156 | 156 | |
157 | 157 | $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter']; |
158 | -pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}",$row['id']); |
|
159 | - if($reward) { |
|
158 | +pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']); |
|
159 | + if ($reward) { |
|
160 | 160 | rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf( |
161 | 161 | $lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name'] |
162 | 162 | )); |
163 | 163 | doquery("UPDATE {{blitz_registrations}} SET blitz_reward_dark_matter = blitz_reward_dark_matter + ($reward) WHERE id = {$row['id']} AND `round_number` = {$current_round};"); |
164 | 164 | } |
165 | 165 | |
166 | - if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
166 | + if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
167 | 167 | break; |
168 | 168 | } |
169 | 169 | } |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | JOIN {{users}} AS u ON u.id = br.user_id |
184 | 184 | WHERE br.`round_number` = {$current_round} |
185 | 185 | order by `blitz_place`, `timestamp`;"); |
186 | -while($row = db_fetch($query)) { |
|
186 | +while ($row = db_fetch($query)) { |
|
187 | 187 | $tpl_player_data = array( |
188 | 188 | 'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)), |
189 | 189 | ); |
190 | 190 | |
191 | - if(classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
191 | + if (classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
192 | 192 | // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда |
193 | 193 | $tpl_player_data = array_merge($tpl_player_data, array( |
194 | 194 | 'ID' => $row['id'], |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | $template->assign_block_vars('registrations', $tpl_player_data); |
204 | - if($row['id'] == $user['id']) { |
|
204 | + if ($row['id'] == $user['id']) { |
|
205 | 205 | $player_registered = $row; |
206 | 206 | } |
207 | 207 | } |
@@ -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 | switch ($unit_id) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | break; |
43 | 43 | } |
44 | 44 | |
45 | - if($moonSize) |
|
45 | + if ($moonSize) |
|
46 | 46 | { |
47 | 47 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moonSize); |
48 | 48 | $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moonSize)); |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | case ART_RCD_MEDIUM: |
64 | 64 | case ART_RCD_LARGE: |
65 | 65 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
66 | - if($planetrow['planet_type'] != PT_PLANET) |
|
66 | + if ($planetrow['planet_type'] != PT_PLANET) |
|
67 | 67 | { |
68 | 68 | $message = $lang['art_rcd_err_moon']; |
69 | 69 | break; |
70 | 70 | } |
71 | 71 | |
72 | 72 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false); |
73 | - if(!empty($que['items'])) |
|
73 | + if (!empty($que['items'])) |
|
74 | 74 | { |
75 | 75 | $message = $lang['art_rcd_err_que']; |
76 | 76 | break; |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | $artifact_deploy = get_unit_param($unit_id, P_DEPLOY); |
80 | 80 | |
81 | 81 | $sectors_used = 0; |
82 | - foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
82 | + foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
83 | 83 | { |
84 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
84 | + if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
85 | 85 | continue; |
86 | 86 | $sectors_used += $levels_deployed; |
87 | 87 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); |
88 | 88 | } |
89 | 89 | |
90 | - if($sectors_used == 0) |
|
90 | + if ($sectors_used == 0) |
|
91 | 91 | { |
92 | 92 | $message = $lang['art_rcd_err_no_sense']; |
93 | 93 | break; |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | $que_item = null; |
103 | 103 | $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true); |
104 | 104 | $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0]; |
105 | - if(!empty($current_que)) |
|
105 | + if (!empty($current_que)) |
|
106 | 106 | { |
107 | 107 | reset($current_que); |
108 | 108 | $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)]; |
109 | 109 | } |
110 | 110 | |
111 | - if(!empty($que_item) && $que_item['que_time_left'] > 60) |
|
111 | + if (!empty($que_item) && $que_item['que_time_left'] > 60) |
|
112 | 112 | { |
113 | 113 | $unit_level--; |
114 | 114 | $old_time = $que_item['que_time_left']; |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true); |
130 | 130 | $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']]; |
131 | 131 | // $que_item = &$que['que'][QUE_STRUCTURES][0]; |
132 | - if(!empty($current_que)) |
|
132 | + if (!empty($current_que)) |
|
133 | 133 | { |
134 | 134 | reset($current_que); |
135 | 135 | $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)]; |
136 | 136 | } |
137 | 137 | |
138 | - if(isset($que_item) && $que_item['que_time_left'] > 60) |
|
138 | + if (isset($que_item) && $que_item['que_time_left'] > 60) |
|
139 | 139 | { |
140 | 140 | $unit_level--; |
141 | 141 | $old_time = $que_item['que_time_left']; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | break; |
154 | 154 | |
155 | 155 | } |
156 | - if($unit_level != $artifact_level_old) |
|
156 | + if ($unit_level != $artifact_level_old) |
|
157 | 157 | { |
158 | 158 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user); |
159 | 159 | OldDbChangeSet::db_changeset_apply($db_changeset); |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | const MOON_MIN_SIZE = 1100; |
9 | 9 | const MOON_MAX_SIZE = 8999; |
10 | 10 | |
11 | - const MOON_DEBRIS_MIN = 1000000; // Minimum amount of debris to span a moon |
|
12 | - const MOON_CHANCE_MIN_PERCENT = 1; // Minimum chance to span a moon |
|
11 | + const MOON_DEBRIS_MIN = 1000000; // Minimum amount of debris to span a moon |
|
12 | + const MOON_CHANCE_MIN_PERCENT = 1; // Minimum chance to span a moon |
|
13 | 13 | const MOON_CHANCE_MAX_PERCENT = 30; // Maximum chance to span a moon |
14 | 14 | |
15 | 15 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public static function moonRollSize($debrisTotal) { |
53 | 53 | $roll = mt_rand(1, 100); |
54 | - if($roll <= static::moonCalcChanceFromDebris($debrisTotal)) { |
|
54 | + if ($roll <= static::moonCalcChanceFromDebris($debrisTotal)) { |
|
55 | 55 | $moonSize = Universe::moonRollSizeSecondary($roll); |
56 | 56 | } else { |
57 | 57 | $moonSize = 0; |