@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | use Player\playerTimeDiff; |
| 5 | 5 | |
| 6 | 6 | // Защита от двойного инита |
| 7 | -if(defined('INIT')) { |
|
| 7 | +if (defined('INIT')) { |
|
| 8 | 8 | return; |
| 9 | 9 | } |
| 10 | 10 | |
@@ -122,47 +122,47 @@ discard block |
||
| 122 | 122 | // Но нужно, пока у нас есть не MVC-страницы |
| 123 | 123 | $sn_page_data = $sn_mvc['pages'][$sn_page_name]; |
| 124 | 124 | $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
| 125 | -if($sn_page_name) { |
|
| 125 | +if ($sn_page_name) { |
|
| 126 | 126 | // Merging page options to global option pull |
| 127 | - if(is_array($sn_page_data['options'])) { |
|
| 127 | + if (is_array($sn_page_data['options'])) { |
|
| 128 | 128 | SN::$options = array_merge(SN::$options, $sn_page_data['options']); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if(isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 131 | + if (isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 132 | 132 | require_once($sn_page_name_file); |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | -if((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
| 136 | +if ((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
| 137 | 137 | SN::$options[PAGE_OPTION_FLEET_UPDATE_SKIP] = true; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
| 142 | 142 | // TODO - костыль, что бы работали старые модули. Убрать! |
| 143 | -if(is_array($sn_data['pages'])) { |
|
| 143 | +if (is_array($sn_data['pages'])) { |
|
| 144 | 144 | $sn_mvc['pages'] = array_merge($sn_mvc['pages'], $sn_data['pages']); |
| 145 | 145 | } |
| 146 | -if(!isset($sn_mvc['pages'][$sn_page_name])) { |
|
| 146 | +if (!isset($sn_mvc['pages'][$sn_page_name])) { |
|
| 147 | 147 | $sn_page_name = ''; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $lang->lng_switch(sys_get_param_str('lang')); |
| 151 | 151 | |
| 152 | 152 | |
| 153 | -if(SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 153 | +if (SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 154 | 154 | \Common\Tools\VersionCheckerDeprecated::performCheckVersion(); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | -if(SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 157 | +if (SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 158 | 158 | require_once(SN_ROOT_PHYSICAL . 'includes/includes/user_birthday_celebrate.php'); |
| 159 | 159 | sn_user_birthday_celebrate(); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | -if(!SN::$config->var_online_user_count || SN::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
| 162 | +if (!SN::$config->var_online_user_count || SN::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
| 163 | 163 | SN::$config->db_saveItem('var_online_user_count', db_user_count(true)); |
| 164 | 164 | SN::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
| 165 | - if(SN::$config->server_log_online) { |
|
| 165 | + if (SN::$config->server_log_online) { |
|
| 166 | 166 | doquery("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = " . SN::$config->var_online_user_count . ";"); |
| 167 | 167 | } |
| 168 | 168 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
| 187 | 187 | |
| 188 | -if(!empty($user['id'])) { |
|
| 188 | +if (!empty($user['id'])) { |
|
| 189 | 189 | SN::$user_options->user_change($user['id']); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | : false |
| 199 | 199 | ); |
| 200 | 200 | |
| 201 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 201 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 202 | 202 | $prohibited_characters = array_map(function($value) { |
| 203 | 203 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
| 204 | 204 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
| 209 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 209 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 210 | 210 | pdump('Отключи отладку перед продакшном!'); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -220,17 +220,17 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | StatUpdateLauncher::unlock(); |
| 222 | 222 | |
| 223 | -if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
| 223 | +if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
| 224 | 224 | $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br( |
| 225 | 225 | SN::$config->game_disable == GAME_DISABLE_REASON |
| 226 | 226 | ? SN::$config->game_disable_reason |
| 227 | 227 | : $lang['sys_game_disable_reason'][SN::$config->game_disable] |
| 228 | 228 | ); |
| 229 | - if(defined('IN_API')) { |
|
| 229 | + if (defined('IN_API')) { |
|
| 230 | 230 | return; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if( |
|
| 233 | + if ( |
|
| 234 | 234 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
| 235 | 235 | && |
| 236 | 236 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | // TODO ban |
| 247 | 247 | // TODO $skip_ban_check |
| 248 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 249 | - if(defined('IN_API')) { |
|
| 248 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 249 | + if (defined('IN_API')) { |
|
| 250 | 250 | return; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -260,10 +260,10 @@ discard block |
||
| 260 | 260 | $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']); |
| 261 | 261 | |
| 262 | 262 | |
| 263 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 263 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 264 | 264 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
| 265 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 266 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
| 265 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 266 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
| 267 | 267 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | 'fleet_update_last', |
| 287 | 287 | SN::$config->fleet_update_interval, |
| 288 | 288 | // Promise |
| 289 | - function () {SN::$gc->fleetDispatcher->dispatch();}, |
|
| 289 | + function() {SN::$gc->fleetDispatcher->dispatch(); }, |
|
| 290 | 290 | WATCHDOG_TIME_SQL, |
| 291 | 291 | false |
| 292 | 292 | ); |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches); |
| 143 | 143 | $include_blocks = $matches[1]; |
| 144 | - if($include_blocks) |
|
| 144 | + if ($include_blocks) |
|
| 145 | 145 | { |
| 146 | - foreach($include_blocks as &$included_file) |
|
| 146 | + foreach ($include_blocks as &$included_file) |
|
| 147 | 147 | { |
| 148 | 148 | $included_file .= '.tpl.html'; |
| 149 | 149 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | $varname = $var_val[3]; |
| 309 | 309 | $new = $this->generate_block_varref($namespace, $varname, $var_val[2]); |
| 310 | 310 | |
| 311 | - if(!empty($var_val[4])) { |
|
| 311 | + if (!empty($var_val[4])) { |
|
| 312 | 312 | $new = \Ptl\PtlVariableDecorator::decorate($var_val[0], $new, $this->template); |
| 313 | 313 | } |
| 314 | 314 | |
@@ -462,8 +462,8 @@ discard block |
||
| 462 | 462 | |
| 463 | 463 | $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; |
| 464 | 464 | // $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;'; |
| 465 | - $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
| 466 | - $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
| 465 | + $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
| 466 | + $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
| 467 | 467 | |
| 468 | 468 | return $tag_template_php; |
| 469 | 469 | } |
@@ -567,10 +567,10 @@ discard block |
||
| 567 | 567 | break; |
| 568 | 568 | |
| 569 | 569 | case 'is': |
| 570 | - $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1; |
|
| 570 | + $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1; |
|
| 571 | 571 | $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); |
| 572 | 572 | |
| 573 | - $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); |
|
| 573 | + $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1)); |
|
| 574 | 574 | |
| 575 | 575 | array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens); |
| 576 | 576 | |
@@ -834,11 +834,11 @@ discard block |
||
| 834 | 834 | } |
| 835 | 835 | else if ($include_last_iterator) |
| 836 | 836 | { |
| 837 | - return '$_'. $blocks[$blockcount] . '_val'; |
|
| 837 | + return '$_' . $blocks[$blockcount] . '_val'; |
|
| 838 | 838 | } |
| 839 | 839 | else |
| 840 | 840 | { |
| 841 | - return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
|
| 841 | + return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']'; |
|
| 842 | 842 | } |
| 843 | 843 | } |
| 844 | 844 | |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | if ($fp = @fopen($filename, 'wb')) |
| 856 | 856 | { |
| 857 | 857 | @flock($fp, LOCK_EX); |
| 858 | - @fwrite ($fp, $data); |
|
| 858 | + @fwrite($fp, $data); |
|
| 859 | 859 | @flock($fp, LOCK_UN); |
| 860 | 860 | @fclose($fp); |
| 861 | 861 | |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | */ |
| 874 | 874 | function minify($html) |
| 875 | 875 | { |
| 876 | - if(!SN::$config->tpl_minifier) |
|
| 876 | + if (!SN::$config->tpl_minifier) |
|
| 877 | 877 | { |
| 878 | 878 | return $html; |
| 879 | 879 | } |
@@ -885,14 +885,14 @@ discard block |
||
| 885 | 885 | //$html = preg_replace('/[\r\n\t]+/', ' ', $html); |
| 886 | 886 | $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags |
| 887 | 887 | $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space |
| 888 | - if(!empty($pre[0])) |
|
| 888 | + if (!empty($pre[0])) |
|
| 889 | 889 | { |
| 890 | - foreach($pre[0] as $tag) |
|
| 890 | + foreach ($pre[0] as $tag) |
|
| 891 | 891 | { |
| 892 | 892 | $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside |
| 893 | 893 | $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one |
| 894 | 894 | $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one |
| 895 | - $html = preg_replace('/#pre#/', $tag, $html,1); |
|
| 895 | + $html = preg_replace('/#pre#/', $tag, $html, 1); |
|
| 896 | 896 | } |
| 897 | 897 | } |
| 898 | 898 | |
@@ -29,19 +29,19 @@ |
||
| 29 | 29 | 'ID' => self::PAGE_SORT_BY_RANK, |
| 30 | 30 | 'HTML_ID' => 'byTotalRank', |
| 31 | 31 | 'HTML_NAME' => '{ byTotalRank }', |
| 32 | - 'SQL_SORT' => ['u.total_rank',], |
|
| 32 | + 'SQL_SORT' => ['u.total_rank', ], |
|
| 33 | 33 | ], |
| 34 | 34 | self::PAGE_SORT_BY_ID => [ |
| 35 | 35 | 'ID' => self::PAGE_SORT_BY_ID, |
| 36 | 36 | 'HTML_ID' => 'byId', |
| 37 | 37 | 'HTML_NAME' => '{ byId }', |
| 38 | - 'SQL_SORT' => ['u.id',], |
|
| 38 | + 'SQL_SORT' => ['u.id', ], |
|
| 39 | 39 | ], |
| 40 | 40 | self::PAGE_SORT_BY_NAME => [ |
| 41 | 41 | 'ID' => self::PAGE_SORT_BY_NAME, |
| 42 | 42 | 'HTML_ID' => 'byName', |
| 43 | 43 | 'HTML_NAME' => '{ byName }', |
| 44 | - 'SQL_SORT' => ['u.username',], |
|
| 44 | + 'SQL_SORT' => ['u.username', ], |
|
| 45 | 45 | ], |
| 46 | 46 | |
| 47 | 47 | self::PAGE_SORT_BY_POINTS => [ |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | const SORT_BY_ACTIVITY = 1; |
| 14 | 14 | |
| 15 | 15 | private static $sorting = [ |
| 16 | - self::SORT_BY_PACKAGE => ['PACKAGE', 'NAME', '!ACTIVE', '!INSTALLED',], |
|
| 17 | - self::SORT_BY_ACTIVITY => ['!ACTIVE', '!INSTALLED', 'PACKAGE', 'NAME',], |
|
| 16 | + self::SORT_BY_PACKAGE => ['PACKAGE', 'NAME', '!ACTIVE', '!INSTALLED', ], |
|
| 17 | + self::SORT_BY_ACTIVITY => ['!ACTIVE', '!INSTALLED', 'PACKAGE', 'NAME', ], |
|
| 18 | 18 | ]; |
| 19 | 19 | |
| 20 | 20 | private static $sortFields = []; |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | * @return DbMysqliResultIterator|EmptyCountableIterator |
| 19 | 19 | */ |
| 20 | 20 | public static function dbFleetsOnHoldOnPlanetsByIds($planetIds, $time = SN_TIME_NOW) { |
| 21 | - if(empty($planetIds) || !is_array($planetIds)) { |
|
| 21 | + if (empty($planetIds) || !is_array($planetIds)) { |
|
| 22 | 22 | return new EmptyCountableIterator(); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | function que_get_unit_que($unit_id) { |
| 9 | 9 | $que_type = false; |
| 10 | - foreach(sn_get_groups('ques') as $que_id => $que_data) { |
|
| 11 | - if(in_array($unit_id, $que_data['unit_list'])) { |
|
| 10 | + foreach (sn_get_groups('ques') as $que_id => $que_data) { |
|
| 11 | + if (in_array($unit_id, $que_data['unit_list'])) { |
|
| 12 | 12 | $que_type = $que_id; |
| 13 | 13 | break; |
| 14 | 14 | } |
@@ -21,14 +21,14 @@ discard block |
||
| 21 | 21 | function que_get_max_que_length($user, $planet, $que_id, $que_data = null) { |
| 22 | 22 | global $config; |
| 23 | 23 | |
| 24 | - if(empty($que_data)) { |
|
| 24 | + if (empty($que_data)) { |
|
| 25 | 25 | $que_data = sn_get_groups('ques'); |
| 26 | 26 | $que_data = $que_data[$que_id]; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | $que_length = 1; |
| 31 | - switch($que_id) { |
|
| 31 | + switch ($que_id) { |
|
| 32 | 32 | case QUE_RESEARCH: |
| 33 | 33 | $que_length = $config->server_que_length_research + mrc_get_level($user, '', UNIT_PREMIUM); // TODO - вынести в модуль |
| 34 | 34 | break; |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | function eco_que_str2arr($que_str) { |
| 44 | 44 | $que_arr = explode(';', $que_str); |
| 45 | - foreach($que_arr as $que_index => &$que_item) { |
|
| 46 | - if($que_item) { |
|
| 45 | + foreach ($que_arr as $que_index => &$que_item) { |
|
| 46 | + if ($que_item) { |
|
| 47 | 47 | $que_item = explode(',', $que_item); |
| 48 | 48 | } else { |
| 49 | 49 | unset($que_arr[$que_index]); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | function eco_que_arr2str($que_arr) { |
| 56 | - foreach($que_arr as &$que_item) { |
|
| 56 | + foreach ($que_arr as &$que_item) { |
|
| 57 | 57 | $que_item = implode(',', $que_item); |
| 58 | 58 | } |
| 59 | 59 | return implode(';', $que_arr); |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | global $lang, $config; |
| 65 | 65 | |
| 66 | 66 | $is_autoconvert = false; |
| 67 | - if($build_mode == BUILD_AUTOCONVERT || sys_get_param_int('auto_convert')) { |
|
| 67 | + if ($build_mode == BUILD_AUTOCONVERT || sys_get_param_int('auto_convert')) { |
|
| 68 | 68 | $build_mode = BUILD_CREATE; |
| 69 | 69 | $is_autoconvert = true; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $unit_amount_qued = 0; |
| 73 | 73 | try { |
| 74 | - if(!$user['id']) { |
|
| 74 | + if (!$user['id']) { |
|
| 75 | 75 | throw new exception('{Нет идентификатора пользователя - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
| 76 | 76 | } |
| 77 | 77 | |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | foreach($unit_list as $unit_id => $unit_amount) if($unit_amount) break; |
| 83 | 83 | } |
| 84 | 84 | */ |
| 85 | - if(!$unit_id) { |
|
| 85 | + if (!$unit_id) { |
|
| 86 | 86 | throw new exception('{Нет идентификатора юнита - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $que_id = que_get_unit_que($unit_id); |
| 90 | - if(!$que_id) { |
|
| 90 | + if (!$que_id) { |
|
| 91 | 91 | throw new exception('{Неправильный тип очереди - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if($build_mode == BUILD_DESTROY && $que_id != QUE_STRUCTURES) { |
|
| 94 | + if ($build_mode == BUILD_DESTROY && $que_id != QUE_STRUCTURES) { |
|
| 95 | 95 | throw new exception('{Уничтожать можно только здания на планете}', ERR_ERROR); // TODO EXCEPTION |
| 96 | 96 | } |
| 97 | 97 | |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | $que_data = $que_data[$que_id]; |
| 100 | 100 | |
| 101 | 101 | // TODO Переделать под подочереди |
| 102 | - if($que_id == QUE_STRUCTURES) { |
|
| 102 | + if ($que_id == QUE_STRUCTURES) { |
|
| 103 | 103 | $sn_groups_build_allow = sn_get_groups('build_allow'); |
| 104 | 104 | $que_data['unit_list'] = $sn_groups_build_allow[$planet['planet_type']]; |
| 105 | 105 | |
| 106 | - if(!isset($que_data['unit_list'][$unit_id])) { |
|
| 106 | + if (!isset($que_data['unit_list'][$unit_id])) { |
|
| 107 | 107 | throw new exception('{Это здание нельзя строить на ' . ($planet['planet_type'] == PT_PLANET ? 'планете' : 'луне'), ERR_ERROR); // TODO EXCEPTION |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | // Это нужно, что бы заблокировать пользователя и работу с очередями |
| 125 | 125 | $user = db_user_by_id($user['id']); |
| 126 | 126 | // Это нужно, что бы заблокировать планету от списания ресурсов |
| 127 | - if(isset($planet['id']) && $planet['id']) { |
|
| 127 | + if (isset($planet['id']) && $planet['id']) { |
|
| 128 | 128 | $planet = DBStaticPlanet::db_planet_by_id($planet['id'], true); |
| 129 | 129 | } else { |
| 130 | 130 | $planet['id'] = 0; |
@@ -136,17 +136,17 @@ discard block |
||
| 136 | 136 | $in_que = &$que['in_que'][$que_id][$user['id']][$planet_id]; |
| 137 | 137 | $que_max_length = que_get_max_que_length($user, $planet, $que_id, $que_data); |
| 138 | 138 | // TODO Добавить вызовы функций проверок текущей и максимальной длин очередей |
| 139 | - if(count($in_que) >= $que_max_length) { |
|
| 139 | + if (count($in_que) >= $que_max_length) { |
|
| 140 | 140 | throw new exception('{Все слоты очереди заняты}', ERR_ERROR); // TODO EXCEPTION |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // TODO Отдельно посмотреть на уничтожение зданий - что бы можно было уничтожать их без планов |
| 144 | - switch(eco_can_build_unit($user, $planet, $unit_id)) { |
|
| 144 | + switch (eco_can_build_unit($user, $planet, $unit_id)) { |
|
| 145 | 145 | case BUILD_ALLOWED: break; |
| 146 | 146 | case BUILD_UNIT_BUSY: throw new exception('{Строение занято}', ERR_ERROR); break; // TODO EXCEPTION eco_bld_msg_err_laboratory_upgrading |
| 147 | 147 | // case BUILD_REQUIRE_NOT_MEET: |
| 148 | 148 | default: |
| 149 | - if($build_mode == BUILD_CREATE) { |
|
| 149 | + if ($build_mode == BUILD_CREATE) { |
|
| 150 | 150 | throw new exception('{Требования не удовлетворены}', ERR_ERROR); |
| 151 | 151 | } |
| 152 | 152 | break; // TODO EXCEPTION eco_bld_msg_err_requirements_not_meet |
@@ -156,14 +156,14 @@ discard block |
||
| 156 | 156 | $unit_amount_qued = $unit_amount; |
| 157 | 157 | $units_qued = isset($in_que[$unit_id]) ? $in_que[$unit_id] : 0; |
| 158 | 158 | $unit_level = mrc_get_level($user, $planet, $unit_id, true, true) + $units_qued; |
| 159 | - if($unit_max = get_unit_param($unit_id, P_MAX_STACK)) { |
|
| 160 | - if($unit_level >= $unit_max) { |
|
| 159 | + if ($unit_max = get_unit_param($unit_id, P_MAX_STACK)) { |
|
| 160 | + if ($unit_level >= $unit_max) { |
|
| 161 | 161 | throw new exception('{Максимальное количество юнитов данного типа уже достигнуто или будет достигнуто по окончанию очереди}', ERR_ERROR); // TODO EXCEPTION |
| 162 | 162 | } |
| 163 | 163 | $unit_amount = max(0, min($unit_amount, $unit_max - $unit_level)); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if($unit_amount < 1) { |
|
| 166 | + if ($unit_amount < 1) { |
|
| 167 | 167 | throw new exception('{Неправильное количество юнитов - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
| 168 | 168 | } |
| 169 | 169 | |
@@ -179,21 +179,21 @@ discard block |
||
| 179 | 179 | // { |
| 180 | 180 | // die('Unit busy'); // TODO EXCEPTION |
| 181 | 181 | // } |
| 182 | - if(get_unit_param($unit_id, P_STACKABLE)) { |
|
| 182 | + if (get_unit_param($unit_id, P_STACKABLE)) { |
|
| 183 | 183 | // TODO Поле 'max_Lot_size' для ограничения размера стэка в очереди - то ли в юниты, то ли в очередь |
| 184 | - if(in_array($unit_id, $group_missile = sn_get_groups('missile'))) { |
|
| 184 | + if (in_array($unit_id, $group_missile = sn_get_groups('missile'))) { |
|
| 185 | 185 | // TODO Поле 'container' - указывает на родительску структуру, в которой хранится данный юнит и по вместительности которой нужно применять размер юнита |
| 186 | 186 | $used_silo = 0; |
| 187 | - foreach($group_missile as $missile_id) { |
|
| 187 | + foreach ($group_missile as $missile_id) { |
|
| 188 | 188 | $missile_qued = isset($in_que[$missile_id]) ? $in_que[$missile_id] : 0; |
| 189 | 189 | $used_silo += (mrc_get_level($user, $planet, $missile_id, true, true) + $missile_qued) * get_unit_param($missile_id, P_UNIT_SIZE); |
| 190 | 190 | } |
| 191 | 191 | $free_silo = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY) - $used_silo; |
| 192 | - if($free_silo <= 0) { |
|
| 192 | + if ($free_silo <= 0) { |
|
| 193 | 193 | throw new exception('{Ракетная шахта уже заполнена или будет заполнена по окончанию очереди}', ERR_ERROR); // TODO EXCEPTION |
| 194 | 194 | } |
| 195 | 195 | $unit_size = get_unit_param($unit_id, P_UNIT_SIZE); |
| 196 | - if($free_silo < $unit_size) { |
|
| 196 | + if ($free_silo < $unit_size) { |
|
| 197 | 197 | throw new exception("{В ракетной шахте нет места для {$lang['tech'][$unit_id]}}", ERR_ERROR); // TODO EXCEPTION |
| 198 | 198 | } |
| 199 | 199 | $unit_amount = max(0, min($unit_amount, floor($free_silo / $unit_size))); |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | $unit_level = $new_unit_level = 0; |
| 202 | 202 | } else { |
| 203 | 203 | $unit_amount = 1; |
| 204 | - if($que_id == QUE_STRUCTURES) { |
|
| 204 | + if ($que_id == QUE_STRUCTURES) { |
|
| 205 | 205 | // if($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $que['sectors'][$planet['id']] <= 0) |
| 206 | 206 | $sectors_qued = is_array($in_que) ? array_sum($in_que) : 0; |
| 207 | - if($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $sectors_qued <= 0) |
|
| 207 | + if ($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $sectors_qued <= 0) |
|
| 208 | 208 | { |
| 209 | 209 | throw new exception('{Не хватает секторов на планете}', ERR_ERROR); // TODO EXCEPTION |
| 210 | 210 | } |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | $exchange = array(); |
| 224 | 224 | $market_get_autoconvert_cost = market_get_autoconvert_cost(); |
| 225 | - if($is_autoconvert && $build_data[BUILD_AUTOCONVERT]) { |
|
| 225 | + if ($is_autoconvert && $build_data[BUILD_AUTOCONVERT]) { |
|
| 226 | 226 | $dark_matter = mrc_get_level($user, null, RES_DARK_MATTER); |
| 227 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $market_get_autoconvert_cost) { |
|
| 227 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $market_get_autoconvert_cost) { |
|
| 228 | 228 | throw new exception("{Нет хватает " . ($market_get_autoconvert_cost - $dark_matter) . "ТМ на постройки с автоконвертацией ресурсов}", ERR_ERROR); // TODO EXCEPTION |
| 229 | 229 | } |
| 230 | 230 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $resource_exchange_rates = array(); |
| 235 | 235 | $resource_diff = array(); |
| 236 | 236 | $all_positive = true; |
| 237 | - foreach($resources_loot as $resource_id) { |
|
| 237 | + foreach ($resources_loot as $resource_id) { |
|
| 238 | 238 | $resource_db_name = pname_resource_name($resource_id); |
| 239 | 239 | $resource_got[$resource_id] = floor(mrc_get_level($user, $planet, $resource_id)); |
| 240 | 240 | $resource_exchange_rates[$resource_id] = $config->__get("rpg_exchange_{$resource_db_name}"); |
@@ -242,15 +242,15 @@ discard block |
||
| 242 | 242 | $all_positive = $all_positive && ($resource_diff[$resource_id] > 0); |
| 243 | 243 | } |
| 244 | 244 | // Нужна автоконвертация |
| 245 | - if($all_positive) { |
|
| 245 | + if ($all_positive) { |
|
| 246 | 246 | $is_autoconvert = false; |
| 247 | 247 | } else { |
| 248 | - foreach($resource_diff as $resource_diff_id => &$resource_diff_amount) { |
|
| 249 | - if($resource_diff_amount >= 0) { |
|
| 248 | + foreach ($resource_diff as $resource_diff_id => &$resource_diff_amount) { |
|
| 249 | + if ($resource_diff_amount >= 0) { |
|
| 250 | 250 | continue; |
| 251 | 251 | } |
| 252 | - foreach($resource_diff as $resource_got_id => &$resource_got_amount) { |
|
| 253 | - if($resource_got_amount <= 0) { |
|
| 252 | + foreach ($resource_diff as $resource_got_id => &$resource_got_amount) { |
|
| 253 | + if ($resource_got_amount <= 0) { |
|
| 254 | 254 | continue; |
| 255 | 255 | } |
| 256 | 256 | $current_exchange = $resource_exchange_rates[$resource_got_id] / $resource_exchange_rates[$resource_diff_id]; |
@@ -266,14 +266,14 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | $is_autoconvert_ok = true; |
| 269 | - foreach($resource_diff as $resource_diff_amount2) { |
|
| 270 | - if($resource_diff_amount2 < 0) { |
|
| 269 | + foreach ($resource_diff as $resource_diff_amount2) { |
|
| 270 | + if ($resource_diff_amount2 < 0) { |
|
| 271 | 271 | $is_autoconvert_ok = false; |
| 272 | 272 | break; |
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - if($is_autoconvert_ok) { |
|
| 276 | + if ($is_autoconvert_ok) { |
|
| 277 | 277 | $build_data['RESULT'][$build_mode] = BUILD_ALLOWED; |
| 278 | 278 | $build_data['CAN'][$build_mode] = $unit_amount; |
| 279 | 279 | } else { |
@@ -282,19 +282,19 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | $unit_amount = min($build_data['CAN'][$build_mode], $unit_amount); |
| 285 | - if($unit_amount <= 0) { |
|
| 285 | + if ($unit_amount <= 0) { |
|
| 286 | 286 | throw new exception('{Не хватает ресурсов}', ERR_ERROR); // TODO EXCEPTION |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - if($new_unit_level < 0) { |
|
| 289 | + if ($new_unit_level < 0) { |
|
| 290 | 290 | throw new exception('{Нельзя уничтожить больше юнитов, чем есть}', ERR_ERROR); // TODO EXCEPTION |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if($build_data['RESULT'][$build_mode] != BUILD_ALLOWED) { |
|
| 293 | + if ($build_data['RESULT'][$build_mode] != BUILD_ALLOWED) { |
|
| 294 | 294 | throw new exception('{Строительство блокировано}', ERR_ERROR); // TODO EXCEPTION |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - if($is_autoconvert) { |
|
| 297 | + if ($is_autoconvert) { |
|
| 298 | 298 | ksort($exchange); |
| 299 | 299 | ksort($resource_got); |
| 300 | 300 | db_change_units($user, $planet, array( |
@@ -309,13 +309,13 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | $unit_amount_qued = 0; |
| 312 | - while($unit_amount > 0 && count($que['ques'][$que_id][$user['id']][$planet_id]) < $que_max_length) { |
|
| 312 | + while ($unit_amount > 0 && count($que['ques'][$que_id][$user['id']][$planet_id]) < $que_max_length) { |
|
| 313 | 313 | $place = min($unit_amount, MAX_FLEET_OR_DEFS_PER_ROW); |
| 314 | 314 | // $sqlBlock = QueUnitStatic::que_unit_make_sql($unit_id, $user, $planet, $build_data, $new_unit_level, $place, $build_mode); |
| 315 | 315 | $sqlBlock = SN::$gc->pimp->que_unit_make_sql($unit_id, $user, $planet, $build_data, $new_unit_level, $place, $build_mode); |
| 316 | 316 | |
| 317 | - array_walk($sqlBlock, function (&$value, $field) { |
|
| 318 | - if($value === null) { |
|
| 317 | + array_walk($sqlBlock, function(&$value, $field) { |
|
| 318 | + if ($value === null) { |
|
| 319 | 319 | $value = 'NULL'; |
| 320 | 320 | } elseif (is_string($value)) { |
| 321 | 321 | $value = "'{$value}'"; |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | sn_db_transaction_commit(); |
| 348 | 348 | |
| 349 | - if($redirect) { |
|
| 349 | + if ($redirect) { |
|
| 350 | 350 | sys_redirect("{$_SERVER['PHP_SELF']}?mode=" . sys_get_param_str('mode') . "&ally_id=" . sys_get_param_id('ally_id')); |
| 351 | 351 | } |
| 352 | 352 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | 'STATUS' => ERR_NONE, |
| 355 | 355 | 'MESSAGE' => '{Строительство начато}', |
| 356 | 356 | ); |
| 357 | - } catch(exception $e) { |
|
| 357 | + } catch (exception $e) { |
|
| 358 | 358 | sn_db_transaction_rollback(); |
| 359 | 359 | $operation_result = array( |
| 360 | 360 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | ); |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - if(!empty($operation_result['MESSAGE'])) { |
|
| 365 | + if (!empty($operation_result['MESSAGE'])) { |
|
| 366 | 366 | $operation_result['MESSAGE'] .= ' ' . ($unit_amount_qued ? $unit_amount_qued : $unit_amount) . 'x[' . $lang['tech'][$unit_id] . ']'; |
| 367 | 367 | } |
| 368 | 368 | |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | function que_recalculate($old_que) { |
| 377 | 377 | $new_que = array(); |
| 378 | 378 | |
| 379 | - if(!is_array($old_que['items'])) { |
|
| 379 | + if (!is_array($old_que['items'])) { |
|
| 380 | 380 | return $new_que; |
| 381 | 381 | } |
| 382 | - foreach($old_que['items'] as $row) { |
|
| 383 | - if(!isset($row) || !$row || $row['que_unit_amount'] <= 0) { |
|
| 382 | + foreach ($old_que['items'] as $row) { |
|
| 383 | + if (!isset($row) || !$row || $row['que_unit_amount'] <= 0) { |
|
| 384 | 384 | continue; |
| 385 | 385 | } |
| 386 | 386 | |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | $last_id = count($new_que['items']) - 1; |
| 393 | 393 | |
| 394 | - if($row['que_planet_id']) { |
|
| 394 | + if ($row['que_planet_id']) { |
|
| 395 | 395 | $new_que['planets'][$row['que_planet_id']][$row['que_type']][] = &$new_que['items'][$last_id]; |
| 396 | - } elseif($row['que_type'] == QUE_RESEARCH) { |
|
| 396 | + } elseif ($row['que_type'] == QUE_RESEARCH) { |
|
| 397 | 397 | $new_que['players'][$row['que_player_id']][$row['que_type']][] = &$new_que['items'][$last_id]; |
| 398 | 398 | } |
| 399 | 399 | $new_que['ques'][$row['que_type']][$row['que_player_id']][intval($row['que_planet_id'])][] = &$new_que['items'][$last_id]; |
@@ -418,17 +418,17 @@ discard block |
||
| 418 | 418 | $planet['id'] = $planet['id'] && $que_type !== QUE_RESEARCH ? $planet['id'] : 0; |
| 419 | 419 | $global_que = que_get($user['id'], $planet['id'], $que_type, true); |
| 420 | 420 | |
| 421 | - if(!empty($global_que['ques'][$que_type][$user['id']][$planet['id']])) { |
|
| 421 | + if (!empty($global_que['ques'][$que_type][$user['id']][$planet['id']])) { |
|
| 422 | 422 | $que = array_reverse($global_que['ques'][$que_type][$user['id']][$planet['id']]); |
| 423 | 423 | |
| 424 | - foreach($que as $que_item) { |
|
| 424 | + foreach ($que as $que_item) { |
|
| 425 | 425 | DBStaticQue::db_que_delete_by_id($que_item['que_id']); |
| 426 | 426 | |
| 427 | - if($que_item['que_planet_id_origin']) { |
|
| 427 | + if ($que_item['que_planet_id_origin']) { |
|
| 428 | 428 | $planet['id'] = $que_item['que_planet_id_origin']; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - if(!isset($planets_locked[$planet['id']])) { |
|
| 431 | + if (!isset($planets_locked[$planet['id']])) { |
|
| 432 | 432 | $planets_locked[$planet['id']] = $planet['id'] ? DBStaticPlanet::db_planet_by_id($planet['id'], true) : $planet; |
| 433 | 433 | } |
| 434 | 434 | |
@@ -440,15 +440,15 @@ discard block |
||
| 440 | 440 | RES_DEUTERIUM => $build_data[RES_DEUTERIUM] * $que_item['que_unit_amount'], |
| 441 | 441 | )); |
| 442 | 442 | |
| 443 | - if(!$clear) { |
|
| 443 | + if (!$clear) { |
|
| 444 | 444 | break; |
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - if(is_numeric($planet['id'])) { |
|
| 448 | + if (is_numeric($planet['id'])) { |
|
| 449 | 449 | DBStaticPlanet::db_planet_set_by_id($planet['id'], "`que_processed` = UNIX_TIMESTAMP(NOW())"); |
| 450 | 450 | } |
| 451 | - elseif(is_numeric($user['id'])) { |
|
| 451 | + elseif (is_numeric($user['id'])) { |
|
| 452 | 452 | db_user_set_by_id($user['id'], '`que_processed` = UNIX_TIMESTAMP(NOW())'); |
| 453 | 453 | } |
| 454 | 454 | |
@@ -493,21 +493,21 @@ discard block |
||
| 493 | 493 | // TODO: Переделать для $que_type === false |
| 494 | 494 | $planet['id'] = $planet['id'] ? $planet['id'] : 0; |
| 495 | 495 | |
| 496 | - if(!is_array($que)) { |
|
| 496 | + if (!is_array($que)) { |
|
| 497 | 497 | $que = que_get($user['id'], $planet['id'], $que_type); |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if(is_array($que) && isset($que['items'])) { |
|
| 500 | + if (is_array($que) && isset($que['items'])) { |
|
| 501 | 501 | $que = $que['ques'][$que_type][$user['id']][$planet['id']]; |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | - if($que) { |
|
| 505 | - foreach($que as $que_element) { |
|
| 504 | + if ($que) { |
|
| 505 | + foreach ($que as $que_element) { |
|
| 506 | 506 | $template->assign_block_vars('que', que_tpl_parse_element($que_element, $short_names)); |
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - if($que_type == QUE_RESEARCH) { |
|
| 510 | + if ($que_type == QUE_RESEARCH) { |
|
| 511 | 511 | // TODO Исправить |
| 512 | 512 | // $template->assign_var('RESEARCH_ONGOING', count($global_que[QUE_RESEARCH][0]) >= $config->server_que_length_research); |
| 513 | 513 | } |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | $user = db_user_by_id($user['id'], true); |
| 536 | 536 | |
| 537 | 537 | $time_left[$user['id']][0] = max(0, $on_time - $user['que_processed']); |
| 538 | - if($planet === null && !$time_left[$user['id']][0]) { |
|
| 538 | + if ($planet === null && !$time_left[$user['id']][0]) { |
|
| 539 | 539 | // TODO |
| 540 | 540 | return $que; |
| 541 | 541 | } |
@@ -544,12 +544,12 @@ discard block |
||
| 544 | 544 | $que_type_id = $planet === null ? QUE_RESEARCH : false; |
| 545 | 545 | $planet = intval(is_array($planet) ? $planet['id'] : $planet); // В $planet у нас теперь только её ID или шаблон null/0/false |
| 546 | 546 | $que = que_get($user['id'], $planet, $que_type_id, true); |
| 547 | - if(empty($que['items'])) { |
|
| 547 | + if (empty($que['items'])) { |
|
| 548 | 548 | return $que; |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | $planet_list = array(); |
| 552 | - if($planet !== null) { |
|
| 552 | + if ($planet !== null) { |
|
| 553 | 553 | // Если нужно изменять данные на планетах - блокируем планеты и получаем данные о них |
| 554 | 554 | // TODO - от них не надо ничего, кроме ID и que_processed |
| 555 | 555 | $planet_row = DBStaticPlanet::db_planet_list_by_user_or_planet($user['id'], $planet); |
@@ -558,21 +558,21 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | // Теперь в $time_left лежит время обсчета всех очередей по каждой из планеты |
| 561 | - if(array_sum($time_left[$user['id']]) == 0) { |
|
| 561 | + if (array_sum($time_left[$user['id']]) == 0) { |
|
| 562 | 562 | return $que; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | $db_changeset = array(); |
| 566 | 566 | $unit_changes = array(); |
| 567 | - foreach($que['items'] as &$que_item) { |
|
| 567 | + foreach ($que['items'] as &$que_item) { |
|
| 568 | 568 | $que_player_id = &$que_item['que_player_id']; |
| 569 | 569 | $que_planet_id = intval($que_item['que_planet_id']); |
| 570 | 570 | |
| 571 | 571 | $que_time_left = &$que['time_left'][$que_player_id][$que_planet_id][$que_item['que_type']]; |
| 572 | - if(!isset($que_time_left)) { |
|
| 572 | + if (!isset($que_time_left)) { |
|
| 573 | 573 | $que_time_left = $time_left[$que_player_id][$que_planet_id]; |
| 574 | 574 | } |
| 575 | - if($que_time_left <= 0 || $que_item['que_unit_amount'] <= 0) { |
|
| 575 | + if ($que_time_left <= 0 || $que_item['que_unit_amount'] <= 0) { |
|
| 576 | 576 | continue; |
| 577 | 577 | } |
| 578 | 578 | // Дальше мы идем, если только осталось время в очереди И юниты к постройке |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | // Теперь работаем с остатком времени на юните. Оно не может быть равно или меньше нуля |
| 586 | 586 | |
| 587 | 587 | // Если времени в очереди осталось не меньше, чем время текущего юнита - значит мы достроили юнит |
| 588 | - if($que_time_left >= $que_item['que_time_left']) { |
|
| 588 | + if ($que_time_left >= $que_item['que_time_left']) { |
|
| 589 | 589 | // Увеличиваем количество отстроенных юнитов |
| 590 | 590 | $unit_processed++; |
| 591 | 591 | // Вычитаем из времени очереди потраченное на постройку время |
@@ -598,12 +598,12 @@ discard block |
||
| 598 | 598 | $que_item['que_unit_amount'] -= $unit_processed; |
| 599 | 599 | |
| 600 | 600 | // Если еще остались юниты - значит ВСЁ оставшееся время приходится на достройку следующего юнита |
| 601 | - if($que_item['que_unit_amount'] > 0) { |
|
| 601 | + if ($que_item['que_unit_amount'] > 0) { |
|
| 602 | 602 | $que_item['que_time_left'] = $que_item['que_time_left'] - $que_time_left; |
| 603 | 603 | $que_time_left = 0; |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - if($que_item['que_unit_amount'] <= 0) { |
|
| 606 | + if ($que_item['que_unit_amount'] <= 0) { |
|
| 607 | 607 | $db_changeset['que'][] = array( |
| 608 | 608 | 'action' => SQL_OP_DELETE, |
| 609 | 609 | P_VERSION => 1, |
@@ -629,14 +629,14 @@ discard block |
||
| 629 | 629 | ); |
| 630 | 630 | } |
| 631 | 631 | |
| 632 | - if($unit_processed) { |
|
| 632 | + if ($unit_processed) { |
|
| 633 | 633 | $unit_processed_delta = $unit_processed * ($que_item['que_unit_mode'] == BUILD_CREATE ? 1 : -1); |
| 634 | 634 | $unit_changes[$que_player_id][$que_planet_id][$que_item['que_unit_id']] += $unit_processed_delta; |
| 635 | 635 | } |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - foreach($time_left as $player_id => $planet_data) { |
|
| 639 | - foreach($planet_data as $planet_id => $time_on_planet) { |
|
| 638 | + foreach ($time_left as $player_id => $planet_data) { |
|
| 639 | + foreach ($planet_data as $planet_id => $time_on_planet) { |
|
| 640 | 640 | $table = $planet_id ? 'planets' : 'users'; |
| 641 | 641 | $id = $planet_id ? $planet_id : $player_id; |
| 642 | 642 | $db_changeset[$table][] = array( |
@@ -652,8 +652,8 @@ discard block |
||
| 652 | 652 | ), |
| 653 | 653 | ); |
| 654 | 654 | |
| 655 | - if(is_array($unit_changes[$player_id][$planet_id])) { |
|
| 656 | - foreach($unit_changes[$player_id][$planet_id] as $unit_id => $unit_amount) { |
|
| 655 | + if (is_array($unit_changes[$player_id][$planet_id])) { |
|
| 656 | + foreach ($unit_changes[$player_id][$planet_id] as $unit_id => $unit_amount) { |
|
| 657 | 657 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_amount, $user, $planet_id ? $planet_id : null); |
| 658 | 658 | } |
| 659 | 659 | } |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | $que = que_recalculate($que); |
| 664 | 664 | |
| 665 | 665 | // TODO: Re-enable quests for Alliances |
| 666 | - if(!empty($unit_changes) && !$user['user_as_ally']) { |
|
| 666 | + if (!empty($unit_changes) && !$user['user_as_ally']) { |
|
| 667 | 667 | $quest_list = qst_get_quests($user['id'], QUEST_STATUS_ALL); |
| 668 | 668 | $quest_triggers = qst_active_triggers($quest_list); |
| 669 | 669 | $quest_rewards = array(); |
@@ -671,26 +671,26 @@ discard block |
||
| 671 | 671 | |
| 672 | 672 | |
| 673 | 673 | $xp_incoming = array(); |
| 674 | - foreach($unit_changes as $user_id => $planet_changes) { |
|
| 675 | - foreach($planet_changes as $planet_id => $changes) { |
|
| 674 | + foreach ($unit_changes as $user_id => $planet_changes) { |
|
| 675 | + foreach ($planet_changes as $planet_id => $changes) { |
|
| 676 | 676 | $planet_this = $planet_id ? SN::db_get_record_by_id(LOC_PLANET, $planet_id) : array(); |
| 677 | - foreach($changes as $unit_id => $unit_value) { |
|
| 677 | + foreach ($changes as $unit_id => $unit_value) { |
|
| 678 | 678 | $que_id = que_get_unit_que($unit_id); |
| 679 | 679 | $unit_level_new = mrc_get_level($user, $planet_this, $unit_id, false, true) + $unit_value; |
| 680 | - if($que_id == QUE_STRUCTURES || $que_id == QUE_RESEARCH) { |
|
| 680 | + if ($que_id == QUE_STRUCTURES || $que_id == QUE_RESEARCH) { |
|
| 681 | 681 | $build_data = eco_get_build_data($user, $planet_this, $unit_id, $unit_level_new - 1); |
| 682 | 682 | $build_data = $build_data[BUILD_CREATE]; |
| 683 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
| 683 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
| 684 | 684 | $xp_incoming[$que_id] += $build_data[$resource_id]; // TODO - добавить конверсию рейтов обмена |
| 685 | 685 | } |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - if(is_array($quest_triggers)) { |
|
| 688 | + if (is_array($quest_triggers)) { |
|
| 689 | 689 | // TODO: Check mutiply condition quests |
| 690 | 690 | $quest_trigger_list = array_keys($quest_triggers, $unit_id); |
| 691 | 691 | |
| 692 | - if(is_array($quest_trigger_list)) { |
|
| 693 | - foreach($quest_trigger_list as $quest_id) { |
|
| 692 | + if (is_array($quest_trigger_list)) { |
|
| 693 | + foreach ($quest_trigger_list as $quest_id) { |
|
| 694 | 694 | if ($quest_list[$quest_id]['quest_status_status'] != QUEST_STATUS_COMPLETE) { |
| 695 | 695 | if ($quest_list[$quest_id]['quest_unit_amount'] <= $unit_level_new) { |
| 696 | 696 | $quest_rewards[$quest_id][$user_id][$planet_id] = $quest_list[$quest_id]['quest_rewards_list']; |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | // TODO: Изменить начисление награды за квесты на ту планету, на которой происходил ресеч |
| 709 | 709 | qst_reward($user, $quest_rewards, $quest_list, $quest_statuses); |
| 710 | 710 | |
| 711 | - foreach($xp_incoming as $que_id => $xp) { |
|
| 711 | + foreach ($xp_incoming as $que_id => $xp) { |
|
| 712 | 712 | rpg_level_up($user, $que_id == QUE_RESEARCH ? RPG_TECH : RPG_STRUCTURE, $xp / 1000); |
| 713 | 713 | } |
| 714 | 714 | } |
@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -define('INSIDE' , true); |
|
| 11 | -define('INSTALL' , false); |
|
| 12 | -define('IN_ADMIN' , true); |
|
| 10 | +define('INSIDE', true); |
|
| 11 | +define('INSTALL', false); |
|
| 12 | +define('IN_ADMIN', true); |
|
| 13 | 13 | |
| 14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 15 | 15 | |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | function adm_lng_assign_string($lang_id, $locale_string_name, $value) { |
| 21 | 21 | global $locale_string_template, $languages_info, $languages, $domain; |
| 22 | 22 | |
| 23 | - if(is_array($value)) { |
|
| 24 | - foreach($value as $sub_key => $sub_value) { |
|
| 23 | + if (is_array($value)) { |
|
| 24 | + foreach ($value as $sub_key => $sub_value) { |
|
| 25 | 25 | adm_lng_assign_string($lang_id, "{$locale_string_name}[{$sub_key}]", $sub_value); |
| 26 | 26 | } |
| 27 | - } elseif($value) { |
|
| 28 | - if(!isset($locale_string_template[$locale_string_name])) { |
|
| 27 | + } elseif ($value) { |
|
| 28 | + if (!isset($locale_string_template[$locale_string_name])) { |
|
| 29 | 29 | $locale_string_template[$locale_string_name] = array(); |
| 30 | 30 | } |
| 31 | 31 | $locale_string_template[$locale_string_name] = array_merge($locale_string_template[$locale_string_name], array("[{$lang_id}]" => htmlentities($value, ENT_COMPAT, 'utf-8'))); |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | global $domain, $lang_id; |
| 47 | 47 | |
| 48 | 48 | $return = "{$ident}'{$string_name}' => "; |
| 49 | - if(isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) { |
|
| 49 | + if (isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) { |
|
| 50 | 50 | $return .= "'" . str_replace(array("\\", "'"), array('\\\\', "\\'"), $string_value[$lang_id]) . "',"; |
| 51 | 51 | } else { |
| 52 | 52 | $return .= "array(\r\n"; |
| 53 | - foreach($string_value as $arr_name => $arr_data) { |
|
| 53 | + foreach ($string_value as $arr_name => $arr_data) { |
|
| 54 | 54 | $return .= adm_lng_parse_string($arr_name, $arr_data, $ident . ' '); |
| 55 | 55 | } |
| 56 | 56 | $return .= "{$ident}),\r\n"; |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $string_name_new = false; |
| 105 | 105 | |
| 106 | - if(isset($honor_constants[$domain][$string_name_prefix])) { |
|
| 106 | + if (isset($honor_constants[$domain][$string_name_prefix])) { |
|
| 107 | 107 | $found_constants = array_keys($constants, $string_name); |
| 108 | - foreach($found_constants as $constant_name) { |
|
| 108 | + foreach ($found_constants as $constant_name) { |
|
| 109 | 109 | $honor_prefix_list = is_array($honor_constants[$domain][$string_name_prefix]) ? $honor_constants[$domain][$string_name_prefix] : array($honor_constants[$domain][$string_name_prefix]); |
| 110 | - foreach($honor_prefix_list as $honor_prefix) { |
|
| 111 | - if(strpos($constant_name, $honor_prefix) === 0) { |
|
| 110 | + foreach ($honor_prefix_list as $honor_prefix) { |
|
| 111 | + if (strpos($constant_name, $honor_prefix) === 0) { |
|
| 112 | 112 | $string_name_new = $constant_name; |
| 113 | 113 | break; |
| 114 | 114 | } |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $string_name_new = $string_name_new ? $string_name_new : "'{$string_name}'"; |
| 120 | 120 | fwrite($file_handler, "{$ident}{$string_name_new} => "); |
| 121 | - if(isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) { |
|
| 121 | + if (isset($string_value[$lang_id]) && !is_array($string_value[$lang_id])) { |
|
| 122 | 122 | fwrite($file_handler, "'" . str_replace(array("\\", "'"), array('\\\\', "\\'"), $string_value[$lang_id]) . "',"); |
| 123 | 123 | // fwrite($file_handler, "'" . addslashes($string_value[$lang_id]) . "',"); |
| 124 | 124 | } else { |
| 125 | 125 | $string_name_prefix = $string_name_prefix . "[{$string_name}]"; |
| 126 | 126 | fwrite($file_handler, "array(\r\n"); |
| 127 | - foreach($string_value as $arr_name => $arr_data) { |
|
| 127 | + foreach ($string_value as $arr_name => $arr_data) { |
|
| 128 | 128 | adm_lng_write_string($arr_name, $arr_data, $ident . ' ', $string_name_prefix); |
| 129 | 129 | } |
| 130 | 130 | fwrite($file_handler, "{$ident}),\r\n"); |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | $languages_info = lng_get_list(); |
| 145 | 145 | $domain = sys_get_param_str('domain'); |
| 146 | 146 | |
| 147 | -if($domain) { |
|
| 147 | +if ($domain) { |
|
| 148 | 148 | $lang_new = sys_get_param('lang_new'); |
| 149 | - if(!empty($lang_new) && is_array($lang_new)) { |
|
| 149 | + if (!empty($lang_new) && is_array($lang_new)) { |
|
| 150 | 150 | $constants = get_defined_constants(true); |
| 151 | 151 | $constants = $constants['user']; |
| 152 | 152 | ksort($constants); |
| 153 | - foreach($languages_info as $lang_id => $land_data) { |
|
| 153 | + foreach ($languages_info as $lang_id => $land_data) { |
|
| 154 | 154 | $file_handler = fopen(SN_ROOT_PHYSICAL . "language/{$lang_id}/{$domain}.mo.php.new", 'w'); |
| 155 | 155 | fwrite($file_handler, "<?php\r\n\r\n/*\r\n############################################################################# |
| 156 | 156 | # Filename: {$domain}.mo.php |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | # Website: http://www.supernova.ws |
| 159 | 159 | # Description: Massive Multiplayer Online Browser Space Strategy Game\r\n#\r\n"); |
| 160 | 160 | |
| 161 | - foreach($land_data['LANG_COPYRIGHT'] as $lang_copyright) { |
|
| 161 | + foreach ($land_data['LANG_COPYRIGHT'] as $lang_copyright) { |
|
| 162 | 162 | $lang_copyright = str_replace(array('©', '"', '<', '>'), array('©', '"', '<', '>'), $lang_copyright); |
| 163 | 163 | fwrite($file_handler, "# {$lang_copyright}\r\n"); |
| 164 | 164 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | /**\r\n*\r\n* @package language\r\n* @system [{$land_data['LANG_NAME_ENGLISH']}]\r\n* @version " . SN_VERSION . "\r\n*\r\n*/\r\n |
| 167 | 167 | /**\r\n* DO NOT CHANGE\r\n*/\r\n\r\nif (!defined('INSIDE')) die();\r\n |
| 168 | 168 | \$a_lang_array = array(\r\n"); |
| 169 | - foreach($lang_new as $string_name => $string_value) { |
|
| 169 | + foreach ($lang_new as $string_name => $string_value) { |
|
| 170 | 170 | adm_lng_write_string($string_name, $string_value); |
| 171 | 171 | } |
| 172 | 172 | fwrite($file_handler, ");\r\n"); |
@@ -176,21 +176,21 @@ discard block |
||
| 176 | 176 | sys_redirect("admin_locale.php?domain={$domain}"); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - foreach($languages_info as $lang_id => $lang_data) { |
|
| 179 | + foreach ($languages_info as $lang_id => $lang_data) { |
|
| 180 | 180 | $template->assign_block_vars('language', $lang_data); |
| 181 | 181 | $full_filename = SN_ROOT_PHYSICAL . "language/{$lang_id}/{$domain}.mo.php"; |
| 182 | 182 | $languages[$lang_id] = adm_lng_load($full_filename . (file_exists($full_filename . '.new') ? '.new' : '')); |
| 183 | - foreach($languages[$lang_id] as $locale_string_name => $cork) { |
|
| 183 | + foreach ($languages[$lang_id] as $locale_string_name => $cork) { |
|
| 184 | 184 | adm_lng_assign_string($lang_id, "[{$locale_string_name}]", $languages[$lang_id][$locale_string_name]); |
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - foreach($locale_string_template as $locale_string_name => $locale_string_list) { |
|
| 188 | + foreach ($locale_string_template as $locale_string_name => $locale_string_list) { |
|
| 189 | 189 | $template->assign_block_vars('string', array( |
| 190 | 190 | 'NAME' => $locale_string_name, |
| 191 | 191 | )); |
| 192 | 192 | |
| 193 | - foreach($languages_info as $lang_id => $cork2) { |
|
| 193 | + foreach ($languages_info as $lang_id => $cork2) { |
|
| 194 | 194 | $template->assign_block_vars('string.locale', array( |
| 195 | 195 | 'LANG' => $lang_id, |
| 196 | 196 | 'VALUE' => $locale_string_list["[{$lang_id}]"], |
@@ -206,17 +206,17 @@ discard block |
||
| 206 | 206 | $dir = dir($path); |
| 207 | 207 | while (false !== ($lang_id = $dir->read())) { |
| 208 | 208 | $full_path = $path . $lang_id; |
| 209 | - if($lang_id[0] != "." && is_dir($full_path)) { |
|
| 209 | + if ($lang_id[0] != "." && is_dir($full_path)) { |
|
| 210 | 210 | $lang_file_list = dir($full_path); |
| 211 | 211 | while (false !== ($filename = $lang_file_list->read())) { |
| 212 | 212 | $lang_domain = strtolower(substr($filename, 0, strpos($filename, '.'))); |
| 213 | - if(!$lang_domain) { |
|
| 213 | + if (!$lang_domain) { |
|
| 214 | 214 | continue; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $file_ext = strtolower(substr($filename, strpos($filename, '.'))); |
| 218 | - if($lang_domain != 'language') { |
|
| 219 | - if($file_ext == '.mo.php.new' || ($file_ext == '.mo.php' && empty($languages[$lang_id][$lang_domain]))) { |
|
| 218 | + if ($lang_domain != 'language') { |
|
| 219 | + if ($file_ext == '.mo.php.new' || ($file_ext == '.mo.php' && empty($languages[$lang_id][$lang_domain]))) { |
|
| 220 | 220 | $language_domains[$lang_domain] = $lang_domain; |
| 221 | 221 | $languages[$lang_id][$lang_domain] = $lang_domain; |
| 222 | 222 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | $dir->close(); |
| 228 | 228 | |
| 229 | - foreach($language_domains as $lang_domain) { |
|
| 229 | + foreach ($language_domains as $lang_domain) { |
|
| 230 | 230 | $template->assign_block_vars('domain', array( |
| 231 | 231 | 'NAME' => $lang_domain, |
| 232 | 232 | )); |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
| 165 | 165 | |
| 166 | 166 | // Alliance bonus calculations |
| 167 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
| 167 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
| 168 | 168 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
| 169 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
| 169 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
| 170 | 170 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
| 171 | 171 | 'ali_bonus_members' => 10, // Minimum alliance size to start using bonus |
| 172 | 172 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | 'eco_scale_storage' => 1, |
| 210 | 210 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
| 211 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
| 211 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
| 212 | 212 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
| 213 | 213 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
| 214 | 214 | |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | 'energy_basic_income' => 0, |
| 220 | 220 | |
| 221 | 221 | // Bashing protection settings |
| 222 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
| 223 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
| 224 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
| 225 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
| 226 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
| 222 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
| 223 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
| 224 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
| 225 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
| 226 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
| 227 | 227 | |
| 228 | 228 | 'Fleet_Cdr' => 30, |
| 229 | 229 | 'fleet_speed' => 1, |
@@ -231,8 +231,8 @@ discard block |
||
| 231 | 231 | 'fleet_update_interval' => 4, |
| 232 | 232 | 'fleet_update_lock' => '', // SQL time when lock was acquired |
| 233 | 233 | |
| 234 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
| 235 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
| 234 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
| 235 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
| 236 | 236 | // Defaults |
| 237 | 237 | 'game_default_language' => 'ru', |
| 238 | 238 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | 'game_maxSystem' => 199, |
| 247 | 247 | 'game_maxPlanet' => 15, |
| 248 | 248 | // Game global settings |
| 249 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
| 249 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
| 250 | 250 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
| 251 | 251 | |
| 252 | 252 | 'game_news_actual' => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days |
| 253 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
| 254 | - 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
| 253 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
| 254 | + 'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
|
| 255 | 255 | // Noob protection |
| 256 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
| 256 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
| 257 | 257 | 'game_noob_points' => 5000, // Below this point user threated as noob. 0 to disable |
| 258 | 258 | |
| 259 | 259 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -307,12 +307,12 @@ discard block |
||
| 307 | 307 | 'payment_currency_exchange_wmu' => 30, |
| 308 | 308 | 'payment_currency_exchange_wmz' => 1, |
| 309 | 309 | |
| 310 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
| 311 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
| 310 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
| 311 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
| 312 | 312 | |
| 313 | 313 | 'planet_capital_cost' => 25000, // Cost in DM to move Capital to current planet |
| 314 | - 'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
|
| 315 | - 'planet_capital_building_rate' => 2.0, // Capital Building rates |
|
| 314 | + 'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
|
| 315 | + 'planet_capital_building_rate' => 2.0, // Capital Building rates |
|
| 316 | 316 | 'planet_teleport_cost' => 50000, // Cost of planet teleportation |
| 317 | 317 | 'planet_teleport_timeout' => 86400, // Timeout for next teleportation |
| 318 | 318 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | 'resource_multiplier' => 1, |
| 335 | 335 | |
| 336 | 336 | //Roleplay system |
| 337 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
| 337 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
| 338 | 338 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
| 339 | 339 | |
| 340 | 340 | // Black Market - General |
@@ -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']) |