@@ -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 | /** |
@@ -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']]), |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | $mode = sys_get_param_escaped('mode'); |
| 22 | 22 | $mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode))); |
| 23 | 23 | |
| 24 | -if($building_sort = sys_get_param_id('sort_elements')) { |
|
| 25 | - if(!empty($lang['player_option_building_sort'][$building_sort])) { |
|
| 24 | +if ($building_sort = sys_get_param_id('sort_elements')) { |
|
| 25 | + if (!empty($lang['player_option_building_sort'][$building_sort])) { |
|
| 26 | 26 | SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort; |
| 27 | 27 | SN::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0); |
| 28 | 28 | } |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | array('query' => "DELETE FROM `{{planets}}` WHERE `id_owner` = 0 AND `destruyed` < UNIX_TIMESTAMP();", 'result' => false, 'error' => '', 'affected_rows' => 0), |
| 18 | 18 | ); |
| 19 | 19 | |
| 20 | - foreach($queries as &$query) |
|
| 20 | + foreach ($queries as &$query) |
|
| 21 | 21 | { |
| 22 | 22 | $query['result'] = doquery($query['query']); |
| 23 | 23 | $query['error'] = SN::$db->db_error(); |
| 24 | - $query['affected_rows'] = SN::$db->db_affected_rows(); |
|
| 24 | + $query['affected_rows'] = SN::$db->db_affected_rows(); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | return $queries; |
@@ -53,30 +53,30 @@ discard block |
||
| 53 | 53 | $recorded_run = strtotime($recorded_run); |
| 54 | 54 | |
| 55 | 55 | $prev_run_array = getdate($recorded_run); |
| 56 | - $prev_run_array = array($prev_run_array['seconds'],$prev_run_array['minutes'],$prev_run_array['hours'],$prev_run_array['mday'],$prev_run_array['mon'],$prev_run_array['year']); |
|
| 56 | + $prev_run_array = array($prev_run_array['seconds'], $prev_run_array['minutes'], $prev_run_array['hours'], $prev_run_array['mday'], $prev_run_array['mon'], $prev_run_array['year']); |
|
| 57 | 57 | $today_array = getdate(SN_TIME_NOW); |
| 58 | - $today_array = array($today_array['seconds'],$today_array['minutes'],$today_array['hours'],$today_array['mday'],$today_array['mon'],$today_array['year']); |
|
| 58 | + $today_array = array($today_array['seconds'], $today_array['minutes'], $today_array['hours'], $today_array['mday'], $today_array['mon'], $today_array['year']); |
|
| 59 | 59 | $scheduleList = explode(',', $scheduleList); |
| 60 | 60 | array_walk($scheduleList, function(&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
| 61 | 61 | $schedule = array('schedule_array' => array_reverse(explode(':', trim($schedule)))); |
| 62 | 62 | |
| 63 | 63 | $interval = $date_part_names_reverse[count($schedule['schedule_array'])]; |
| 64 | 64 | |
| 65 | - foreach($prev_run_array as $index => $date_part) { |
|
| 65 | + foreach ($prev_run_array as $index => $date_part) { |
|
| 66 | 66 | $schedule['array']['recorded'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $date_part; |
| 67 | 67 | $schedule['array']['now'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $today_array[$index]; |
| 68 | 68 | } |
| 69 | - if($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
| 69 | + if ($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
| 70 | 70 | unset($schedule['array']['now']); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - foreach($schedule['array'] as $name => $array) { |
|
| 73 | + foreach ($schedule['array'] as $name => $array) { |
|
| 74 | 74 | $schedule['string'][$name] = "{$array[5]}-{$array[4]}-{$array[3]} {$array[2]}:{$array[1]}:{$array[0]}"; |
| 75 | 75 | $schedule['string'][$name . '_next'] = $schedule['string'][$name] . ' +1 ' . $interval; |
| 76 | 76 | $schedule['string'][$name . '_prev'] = $schedule['string'][$name] . ' -1 ' . $interval; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - foreach($schedule['string'] as $string) { |
|
| 79 | + foreach ($schedule['string'] as $string) { |
|
| 80 | 80 | $timestamp = strtotime($string); |
| 81 | 81 | $schedule['timestamp'][$timestamp] = $possible_schedules[$timestamp] = date(FMT_DATE_TIME_SQL, strtotime($string)); |
| 82 | 82 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $prev_run = 0; |
| 88 | 88 | $next_run = 0; |
| 89 | - foreach($possible_schedules as $timestamp => $string_date) { |
|
| 89 | + foreach ($possible_schedules as $timestamp => $string_date) { |
|
| 90 | 90 | $prev_run = SN_TIME_NOW >= $timestamp ? $timestamp : $prev_run; |
| 91 | 91 | $next_run = SN_TIME_NOW < $timestamp && !$next_run ? $timestamp : $next_run; |
| 92 | 92 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | unset($player_options[PLAYER_OPTION_TUTORIAL_CURRENT]); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - array_walk($player_options, function (&$value) { |
|
| 404 | + array_walk($player_options, function(&$value) { |
|
| 405 | 405 | // TODO - Когда будет больше параметров - сделать больше проверок |
| 406 | 406 | $value = intval($value); |
| 407 | 407 | }); |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $user['id'], |
| 451 | 451 | RPG_NAME_CHANGE, |
| 452 | 452 | -$config->game_user_changename_cost, |
| 453 | - vsprintf('Пользователь ID %1$d сменил имя с "%2$s" на "%3$s"', [$user['id'], $user['username'], $username,]) |
|
| 453 | + vsprintf('Пользователь ID %1$d сменил имя с "%2$s" на "%3$s"', [$user['id'], $user['username'], $username, ]) |
|
| 454 | 454 | ); |
| 455 | 455 | |
| 456 | 456 | case SERVER_PLAYER_NAME_CHANGE_FREE: |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | protected static $autoloaderRegistered = false; |
| 25 | 25 | |
| 26 | 26 | protected static function _constructorStatic() { |
| 27 | - if(!static::$autoloaderRegistered) { |
|
| 27 | + if (!static::$autoloaderRegistered) { |
|
| 28 | 28 | spl_autoload_register(array(__CLASS__, 'autoloader')); |
| 29 | 29 | static::$autoloaderRegistered = true; |
| 30 | 30 | } |
@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | public static function autoloader($class) { |
| 37 | 37 | static::_constructorStatic(); |
| 38 | 38 | |
| 39 | - foreach(static::$folders as $data) { |
|
| 39 | + foreach (static::$folders as $data) { |
|
| 40 | 40 | $theClassFile = $class; |
| 41 | 41 | |
| 42 | - if($data[static::P_PREFIX] && strrpos($class, $data[static::P_PREFIX]) !== false) { |
|
| 42 | + if ($data[static::P_PREFIX] && strrpos($class, $data[static::P_PREFIX]) !== false) { |
|
| 43 | 43 | $theClassFile = substr($class, strlen($data[static::P_PREFIX])); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $classFullFileName = str_replace('\\', '/', $data[static::P_FOLDER] . $theClassFile) . DOT_PHP_EX; |
| 47 | - if(file_exists($classFullFileName) && is_file($classFullFileName)) { |
|
| 47 | + if (file_exists($classFullFileName) && is_file($classFullFileName)) { |
|
| 48 | 48 | require_once($classFullFileName); |
| 49 | - if(method_exists($class, '_constructorStatic')) { |
|
| 49 | + if (method_exists($class, '_constructorStatic')) { |
|
| 50 | 50 | $class::_constructorStatic(); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $absoluteClassRoot = str_replace('\\', '/', SN_ROOT_PHYSICAL . $absoluteClassRoot); |
| 64 | 64 | |
| 65 | - if(!($absoluteClassRoot = realpath($absoluteClassRoot))) { |
|
| 65 | + if (!($absoluteClassRoot = realpath($absoluteClassRoot))) { |
|
| 66 | 66 | // TODO - throw new \Exception("There is some error when installing autoloader for '{$absoluteClassRoot}' class prefix '{$classPrefix}'"); |
| 67 | 67 | return; |
| 68 | 68 | } |
| 69 | 69 | $absoluteClassRoot = str_replace('\\', '/', $absoluteClassRoot) . '/'; |
| 70 | 70 | |
| 71 | - if($classPrefix && strrpos($classPrefix, 1) != '\\') { |
|
| 71 | + if ($classPrefix && strrpos($classPrefix, 1) != '\\') { |
|
| 72 | 72 | $classPrefix .= '\\'; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | |
| 18 | 18 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 19 | 19 | |
| 20 | -if(!SN::$gc->modules->countModulesInGroup('payment')) { |
|
| 20 | +if (!SN::$gc->modules->countModulesInGroup('payment')) { |
|
| 21 | 21 | sys_redirect(SN_ROOT_VIRTUAL . 'admin/overview.php'); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | 'START_NAME' => $planetrow['name'], |
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | - if(!empty($TargetPlanet)) { |
|
| 30 | + if (!empty($TargetPlanet)) { |
|
| 31 | 31 | $template_route += array( |
| 32 | 32 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
| 33 | 33 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | $template->assign_block_vars('fleets', $template_route); |
| 39 | 39 | |
| 40 | 40 | $sn_groups_fleet = sn_get_groups('fleet'); |
| 41 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
| 42 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 41 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
| 42 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 43 | 43 | // $ship_base_data = get_ship_data($ship_id, $user); |
| 44 | 44 | $template->assign_block_vars('fleets.ships', array( |
| 45 | 45 | 'ID' => $ship_id, |
@@ -57,11 +57,10 @@ discard block |
||
| 57 | 57 | $fleet_capacity += get_unit_param($Ship, P_CAPACITY) * $Count; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : |
|
| 61 | - (isset($missiontype[MT_HOLD]) ? 12 : 0); |
|
| 62 | - if($max_duration) { |
|
| 60 | + $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : (isset($missiontype[MT_HOLD]) ? 12 : 0); |
|
| 61 | + if ($max_duration) { |
|
| 63 | 62 | $config_game_speed_expedition = ($target_mission == MT_EXPLORE && $config->game_speed_expedition ? $config->game_speed_expedition : 1); |
| 64 | - for($i = 1; $i <= $max_duration; $i++) { |
|
| 63 | + for ($i = 1; $i <= $max_duration; $i++) { |
|
| 65 | 64 | $template->assign_block_vars('duration', array( |
| 66 | 65 | 'ID' => $i, |
| 67 | 66 | 'TIME' => pretty_time(ceil($i * 3600 / $config_game_speed_expedition)), |
@@ -80,7 +79,7 @@ discard block |
||
| 80 | 79 | // $TableTitle = uni_render_planet_full($planetrow) . ' => ' . uni_render_planet_full($temp); |
| 81 | 80 | |
| 82 | 81 | $sn_group_resources = sn_get_groups('resources'); |
| 83 | - for($i = 0; $i<3; $i++) { |
|
| 82 | + for ($i = 0; $i < 3; $i++) { |
|
| 84 | 83 | $amount = $planetrow[$sn_group_resources[$i]] - ($i == 2 ? $consumption : 0); |
| 85 | 84 | $template->assign_block_vars('resources', array( |
| 86 | 85 | 'ID' => $i, |
@@ -90,7 +89,7 @@ discard block |
||
| 90 | 89 | )); |
| 91 | 90 | } |
| 92 | 91 | |
| 93 | - if(is_object($captainModule = moduleCaptain()) && ($captain = $captainModule->unit_captain_get($planetrow['id'])) && $captain['unit_location_type'] == LOC_PLANET) { |
|
| 92 | + if (is_object($captainModule = moduleCaptain()) && ($captain = $captainModule->unit_captain_get($planetrow['id'])) && $captain['unit_location_type'] == LOC_PLANET) { |
|
| 94 | 93 | $template->assign_vars(array( |
| 95 | 94 | 'CAPTAIN_ID' => $captain['unit_id'], |
| 96 | 95 | 'CAPTAIN_LEVEL' => $captain['captain_level'], |
@@ -112,9 +111,9 @@ discard block |
||
| 112 | 111 | |
| 113 | 112 | |
| 114 | 113 | 'speedallsmin' => sys_get_param_float('speedallsmin'), |
| 115 | - 'speed' => sys_get_param_int('speed') , |
|
| 114 | + 'speed' => sys_get_param_int('speed'), |
|
| 116 | 115 | |
| 117 | - 'fleet_group' => sys_get_param_id('fleet_group') , |
|
| 116 | + 'fleet_group' => sys_get_param_id('fleet_group'), |
|
| 118 | 117 | 'acs_target_mr' => sys_get_param_str('acs_target_mr'), |
| 119 | 118 | |
| 120 | 119 | 'MAX_DURATION' => $max_duration, |