@@ -21,8 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | $sym_defender = $unpacked['D']; |
| 23 | 23 | $sym_attacker = $unpacked['A']; |
| 24 | -} |
|
| 25 | -else |
|
| 24 | +} else |
|
| 26 | 25 | { |
| 27 | 26 | $sym_defender = array(0 => $sym_defender); |
| 28 | 27 | $sym_attacker = array(1 => $sym_attacker); |
@@ -56,8 +55,7 @@ discard block |
||
| 56 | 55 | $template = gettemplate('ube_combat_report', true); |
| 57 | 56 | $template->assign_recursive($template_result); |
| 58 | 57 | display($template, '', false, '', false, false, true); |
| 59 | -} |
|
| 60 | -else |
|
| 58 | +} else |
|
| 61 | 59 | { |
| 62 | 60 | $template = gettemplate('simulator', true); |
| 63 | 61 | $techs_and_officers = array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR, MRC_ADMIRAL); |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 4 | 4 | |
| 5 | -if(sys_get_param_int('BE_DEBUG') && !defined('BE_DEBUG')) |
|
| 5 | +if (sys_get_param_int('BE_DEBUG') && !defined('BE_DEBUG')) |
|
| 6 | 6 | { |
| 7 | 7 | define('BE_DEBUG', true); |
| 8 | 8 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $sym_defender = $_POST['defender'] ? $_POST['defender'] : array(); |
| 15 | 15 | $sym_attacker = $_POST['attacker'] ? $_POST['attacker'] : array(); |
| 16 | 16 | |
| 17 | -if($replay) |
|
| 17 | +if ($replay) |
|
| 18 | 18 | { |
| 19 | 19 | $unpacked = sn_ube_simulator_decode_replay($replay); |
| 20 | 20 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $sym_attacker = array(1 => $sym_attacker); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | -if($_POST['submit'] || $execute) |
|
| 30 | +if ($_POST['submit'] || $execute) |
|
| 31 | 31 | { |
| 32 | 32 | $replay = sn_ube_simulator_encode_replay($sym_defender, 'D'); |
| 33 | 33 | $replay .= sn_ube_simulator_encode_replay($sym_attacker, 'A'); |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | $template = gettemplate('simulator', true); |
| 41 | 41 | $techs_and_officers = array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR, MRC_ADMIRAL); |
| 42 | 42 | |
| 43 | - foreach($techs_and_officers as $tech_id) |
|
| 43 | + foreach ($techs_and_officers as $tech_id) |
|
| 44 | 44 | { |
| 45 | - if(!$sym_attacker[1][$tech_id]) |
|
| 45 | + if (!$sym_attacker[1][$tech_id]) |
|
| 46 | 46 | { |
| 47 | 47 | $sym_attacker[1][$tech_id] = mrc_get_level($user, false, $tech_id); |
| 48 | 48 | } |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | UNIT_GOVERNORS => array(MRC_FORTIFIER), |
| 57 | 57 | UNIT_DEFENCE => sn_get_groups('defense_active'), |
| 58 | 58 | ); |
| 59 | - foreach($show_groups as $unit_group_id => $unit_group) |
|
| 59 | + foreach ($show_groups as $unit_group_id => $unit_group) |
|
| 60 | 60 | { |
| 61 | 61 | $template->assign_block_vars('simulator', array( |
| 62 | 62 | 'GROUP' => $unit_group_id, |
| 63 | 63 | 'NAME' => $lang['tech'][$unit_group_id], |
| 64 | 64 | )); |
| 65 | 65 | |
| 66 | - foreach($unit_group as $unit_id) |
|
| 66 | + foreach ($unit_group as $unit_id) |
|
| 67 | 67 | { |
| 68 | 68 | $tab++; |
| 69 | 69 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | include('includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
| 17 | 17 | // die(); |
| 18 | -if($template_result[F_USER_IS_AUTHORIZED]) { |
|
| 18 | +if ($template_result[F_USER_IS_AUTHORIZED]) { |
|
| 19 | 19 | sys_redirect('index' . DOT_PHP_EX); |
| 20 | 20 | } |
| 21 | 21 | lng_include('login'); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $newstock = $stock; |
| 27 | 27 | $intError = MARKET_DEAL; |
| 28 | 28 | |
| 29 | -switch($mode) |
|
| 29 | +switch ($mode) |
|
| 30 | 30 | { |
| 31 | 31 | case MARKET_RESOURCES: // Resource trader |
| 32 | 32 | require('includes/includes/market_trader.inc'); |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $message_id = sys_get_param_int('message'); |
| 85 | -if($message_id != MARKET_NOTHING) |
|
| 85 | +if ($message_id != MARKET_NOTHING) |
|
| 86 | 86 | { |
| 87 | 87 | $template->assign_block_vars('result', array('MESSAGE' => $lang['eco_mrk_errors'][$message_id])); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | -if($message) |
|
| 90 | +if ($message) |
|
| 91 | 91 | { |
| 92 | 92 | $template->assign_block_vars('result', array('MESSAGE' => $message)); |
| 93 | 93 | } |
@@ -961,7 +961,7 @@ |
||
| 961 | 961 | REGISTER_ERROR_USERNAME_WRONG => 'Некорректное имя игрока', |
| 962 | 962 | REGISTER_ERROR_ACCOUNT_NAME_EXISTS => 'Имя учётной записи уже занято. Попробуйте войти с этим именем и вашим паролем или воспользоваться сбросом пароля', |
| 963 | 963 | REGISTER_ERROR_PASSWORD_INSECURE => 'Неправильный пароль. Пароль должен состоять минимум из ' . PASSWORD_LENGTH_MIN . ' символов', |
| 964 | - REGISTER_ERROR_USERNAME_SHORT => 'Слишком короткое имя. Имя должно состоять минимум из ' . LOGIN_LENGTH_MIN. ' символов', |
|
| 964 | + REGISTER_ERROR_USERNAME_SHORT => 'Слишком короткое имя. Имя должно состоять минимум из ' . LOGIN_LENGTH_MIN . ' символов', |
|
| 965 | 965 | REGISTER_ERROR_PASSWORD_DIFFERENT => 'Пароль и проверочный пароль не совпадают. Проверьте правильность ввода', |
| 966 | 966 | REGISTER_ERROR_EMAIL_EMPTY => 'Е-Мейл не может быть пустым', |
| 967 | 967 | REGISTER_ERROR_EMAIL_WRONG => 'Введенный Е-Мейл не является допустимым адресом электронной почты. Проверьте написание Е-Мейла или используйте другой адрес почтового ящика', |
@@ -43,8 +43,7 @@ |
||
| 43 | 43 | doquery("UPDATE {{alliance}} SET ally_user_id = {$ally_user_id} WHERE id = {$ally_id} LIMIT 1;"); |
| 44 | 44 | |
| 45 | 45 | message(str_replace('%s', $ally_tag_raw, $lang['ally_been_maked']), str_replace('%s', $ally_tag_raw, $lang['ally_maked'])); |
| 46 | -} |
|
| 47 | -else |
|
| 46 | +} else |
|
| 48 | 47 | { |
| 49 | 48 | $page .= parsetemplate(gettemplate('ali_external_make'), $lang); |
| 50 | 49 | } |
@@ -9,18 +9,18 @@ |
||
| 9 | 9 | * @copyright 2008 by Chlorel for XNova |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -define('INSIDE' , true); |
|
| 13 | -define('INSTALL' , false); |
|
| 12 | +define('INSIDE', true); |
|
| 13 | +define('INSTALL', false); |
|
| 14 | 14 | define('IN_ADMIN', true); |
| 15 | 15 | require_once('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 16 | 16 | |
| 17 | 17 | // if($user['authlevel'] < 1) |
| 18 | -if($user['authlevel'] < 3) |
|
| 18 | +if ($user['authlevel'] < 3) |
|
| 19 | 19 | { |
| 20 | 20 | AdminMessage(classLocale::$lang['adm_err_denied']); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if(SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_end')) |
|
| 23 | +if (SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_stat_update_end')) |
|
| 24 | 24 | { |
| 25 | 25 | classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_NOW + 120); |
| 26 | 26 | |
@@ -69,8 +69,8 @@ |
||
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * @param Fleet $objFleet |
| 72 | - * @param $ov_label |
|
| 73 | - * @param $planet_end_type |
|
| 72 | + * @param integer $ov_label |
|
| 73 | + * @param integer $planet_end_type |
|
| 74 | 74 | * |
| 75 | 75 | * @return mixed |
| 76 | 76 | */ |
@@ -6,26 +6,26 @@ discard block |
||
| 6 | 6 | $fleet_events = array(); |
| 7 | 7 | $fleet_number = 0; |
| 8 | 8 | |
| 9 | - if($objFleetList->count() <= 0) { |
|
| 9 | + if ($objFleetList->count() <= 0) { |
|
| 10 | 10 | return; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - foreach($objFleetList->_container as $objFleet) { |
|
| 13 | + foreach ($objFleetList->_container as $objFleet) { |
|
| 14 | 14 | $planet_start_type = $objFleet->fleet_start_type == PT_MOON ? PT_MOON : PT_PLANET; |
| 15 | 15 | $planet_start = db_planet_by_gspt($objFleet->fleet_start_galaxy, $objFleet->fleet_start_system, $objFleet->fleet_start_planet, $planet_start_type, false, 'name'); |
| 16 | 16 | $objFleet->fleet_start_name = $planet_start['name']; |
| 17 | 17 | |
| 18 | 18 | $planet_end_type = $objFleet->fleet_end_type == PT_MOON ? PT_MOON : PT_PLANET; |
| 19 | - if($objFleet->fleet_end_planet > Vector::$knownPlanets) { |
|
| 19 | + if ($objFleet->fleet_end_planet > Vector::$knownPlanets) { |
|
| 20 | 20 | $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_exploration']; |
| 21 | - } elseif($objFleet->mission_type == MT_COLONIZE) { |
|
| 21 | + } elseif ($objFleet->mission_type == MT_COLONIZE) { |
|
| 22 | 22 | $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_colonization']; |
| 23 | 23 | } else { |
| 24 | 24 | $planet_end = db_planet_by_gspt($objFleet->fleet_end_galaxy, $objFleet->fleet_end_system, $objFleet->fleet_end_planet, $planet_end_type, false, 'name'); |
| 25 | 25 | $objFleet->fleet_end_name = $planet_end['name']; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - if($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE && |
|
| 28 | + if ($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE && |
|
| 29 | 29 | ($planet_scanned === false |
| 30 | 30 | || |
| 31 | 31 | ( |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | $fleet_events[] = flt_register_event_objFleet($objFleet, 0, $planet_end_type); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) { |
|
| 42 | + if ($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) { |
|
| 43 | 43 | $fleet_events[] = flt_register_event_objFleet($objFleet, 1, $planet_end_type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if( |
|
| 46 | + if ( |
|
| 47 | 47 | $objFleet->time_return_to_source > SN_TIME_NOW && $objFleet->mission_type != MT_MISSILE && ($objFleet->isReturning() || ($objFleet->mission_type != MT_RELOCATE && $objFleet->mission_type != MT_COLONIZE)) && |
| 48 | 48 | ( |
| 49 | 49 | ($planet_scanned === false && $objFleet->playerOwnerId == $user['id']) |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $fleet_events[] = flt_register_event_objFleet($objFleet, 2, $planet_end_type); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if($objFleet->mission_type == MT_MISSILE) { |
|
| 62 | + if ($objFleet->mission_type == MT_MISSILE) { |
|
| 63 | 63 | $fleet_events[] = flt_register_event_objFleet($objFleet, 3, $planet_end_type); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $is_this_planet = false; |
| 81 | 81 | |
| 82 | - switch($objFleet->ov_label = $ov_label) { |
|
| 82 | + switch ($objFleet->ov_label = $ov_label) { |
|
| 83 | 83 | case 0: |
| 84 | 84 | $objFleet->event_time = $objFleet->time_arrive_to_target; |
| 85 | 85 | $is_this_planet = ( |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $objFleet->ov_this_planet = $is_this_planet;// || $planet_scanned != false; |
|
| 113 | + $objFleet->ov_this_planet = $is_this_planet; // || $planet_scanned != false; |
|
| 114 | 114 | |
| 115 | - if($objFleet->playerOwnerId == $user['id']) { |
|
| 115 | + if ($objFleet->playerOwnerId == $user['id']) { |
|
| 116 | 116 | $user_data = $user; |
| 117 | 117 | } else { |
| 118 | 118 | $user_data = db_user_by_id($objFleet->playerOwnerId); |
@@ -125,8 +125,7 @@ |
||
| 125 | 125 | return tplParseFleetObject($objFleet, ++$fleet_number, $user_data); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | -function int_planet_pretemplate($planetrow, &$template) |
|
| 129 | -{ |
|
| 128 | +function int_planet_pretemplate($planetrow, &$template) { |
|
| 130 | 129 | global $user; |
| 131 | 130 | |
| 132 | 131 | $governor_id = $planetrow['PLANET_GOVERNOR_ID']; |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | case 0: |
| 88 | 88 | $objFleet->event_time = $objFleet->time_arrive_to_target; |
| 89 | 89 | $is_this_planet = ( |
| 90 | - ($planetrow['galaxy'] == $objFleet->fleet_end_galaxy) AND |
|
| 91 | - ($planetrow['system'] == $objFleet->fleet_end_system) AND |
|
| 92 | - ($planetrow['planet'] == $objFleet->fleet_end_planet) AND |
|
| 90 | + ($planetrow['galaxy'] == $objFleet->fleet_end_galaxy) and |
|
| 91 | + ($planetrow['system'] == $objFleet->fleet_end_system) and |
|
| 92 | + ($planetrow['planet'] == $objFleet->fleet_end_planet) and |
|
| 93 | 93 | ($planetrow['planet_type'] == $planet_end_type)); |
| 94 | 94 | break; |
| 95 | 95 | |
| 96 | 96 | case 1: |
| 97 | 97 | $objFleet->event_time = $objFleet->time_mission_job_complete; |
| 98 | 98 | $is_this_planet = ( |
| 99 | - ($planetrow['galaxy'] == $objFleet->fleet_end_galaxy) AND |
|
| 100 | - ($planetrow['system'] == $objFleet->fleet_end_system) AND |
|
| 101 | - ($planetrow['planet'] == $objFleet->fleet_end_planet) AND |
|
| 99 | + ($planetrow['galaxy'] == $objFleet->fleet_end_galaxy) and |
|
| 100 | + ($planetrow['system'] == $objFleet->fleet_end_system) and |
|
| 101 | + ($planetrow['planet'] == $objFleet->fleet_end_planet) and |
|
| 102 | 102 | ($planetrow['planet_type'] == $planet_end_type)); |
| 103 | 103 | break; |
| 104 | 104 | |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | case 3: |
| 107 | 107 | $objFleet->event_time = $objFleet->time_return_to_source; |
| 108 | 108 | $is_this_planet = ( |
| 109 | - ($planetrow['galaxy'] == $objFleet->fleet_start_galaxy) AND |
|
| 110 | - ($planetrow['system'] == $objFleet->fleet_start_system) AND |
|
| 111 | - ($planetrow['planet'] == $objFleet->fleet_start_planet) AND |
|
| 109 | + ($planetrow['galaxy'] == $objFleet->fleet_start_galaxy) and |
|
| 110 | + ($planetrow['system'] == $objFleet->fleet_start_system) and |
|
| 111 | + ($planetrow['planet'] == $objFleet->fleet_start_planet) and |
|
| 112 | 112 | ($planetrow['planet_type'] == $objFleet->fleet_start_type)); |
| 113 | 113 | break; |
| 114 | 114 | |
@@ -185,6 +185,9 @@ |
||
| 185 | 185 | return $result; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | +/** |
|
| 189 | + * @param integer $que_id |
|
| 190 | + */ |
|
| 188 | 191 | function tpl_parse_planet_que($que, $planet, $que_id) { |
| 189 | 192 | $hangar_que = array(); |
| 190 | 193 | $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']]; |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | use DBStatic\DBStaticFleetACS; |
| 5 | 5 | |
| 6 | 6 | function tpl_assign_fleet_compare($a, $b) { |
| 7 | - if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) { |
|
| 8 | - if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) { |
|
| 7 | + if ($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) { |
|
| 8 | + if ($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) { |
|
| 9 | 9 | return 0; |
| 10 | 10 | } |
| 11 | 11 | |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | * @param string $js_name |
| 22 | 22 | */ |
| 23 | 23 | function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') { |
| 24 | - if(!$fleets) { |
|
| 24 | + if (!$fleets) { |
|
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | usort($fleets, 'tpl_assign_fleet_compare'); |
| 29 | 29 | |
| 30 | - foreach($fleets as $fleet_data) { |
|
| 30 | + foreach ($fleets as $fleet_data) { |
|
| 31 | 31 | $template->assign_block_vars($js_name, $fleet_data['fleet']); |
| 32 | 32 | |
| 33 | - if($fleet_data['ships']) { |
|
| 34 | - foreach($fleet_data['ships'] as $ship_data) { |
|
| 33 | + if ($fleet_data['ships']) { |
|
| 34 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
| 35 | 35 | $template->assign_block_vars("{$js_name}.ships", $ship_data); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | 'DEUTERIUM' => $fleet[RES_DEUTERIUM], |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | - foreach($fleet as $ship_id => $ship_amount) { |
|
| 56 | - if(in_array($ship_id, classSupernova::$gc->groupFleet)) { |
|
| 55 | + foreach ($fleet as $ship_id => $ship_amount) { |
|
| 56 | + if (in_array($ship_id, classSupernova::$gc->groupFleet)) { |
|
| 57 | 57 | $single_ship_data = get_ship_data($ship_id, $user_data); |
| 58 | 58 | $return['ships'][$ship_id] = array( |
| 59 | 59 | 'ID' => $ship_id, |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | $result = array(); |
| 94 | 94 | |
| 95 | - if(!$user_data) { |
|
| 95 | + if (!$user_data) { |
|
| 96 | 96 | $user_data = $user; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if(!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) { |
|
| 99 | + if (!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) { |
|
| 100 | 100 | $aks = DBStaticFleetACS::db_acs_get_by_group_id($objFleet->group_id); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -137,14 +137,14 @@ discard block |
||
| 137 | 137 | 'STAY_LEFT' => floor($objFleet->time_mission_job_complete + 1 - SN_TIME_NOW), |
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | - if(property_exists($objFleet, 'fleet_start_name')) { |
|
| 140 | + if (property_exists($objFleet, 'fleet_start_name')) { |
|
| 141 | 141 | $result['START_NAME'] = $objFleet->fleet_start_name; |
| 142 | 142 | } |
| 143 | - if(property_exists($objFleet, 'fleet_end_name')) { |
|
| 143 | + if (property_exists($objFleet, 'fleet_end_name')) { |
|
| 144 | 144 | $result['END_NAME'] = $objFleet->fleet_end_name; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if(property_exists($objFleet, 'event_time')) { |
|
| 147 | + if (property_exists($objFleet, 'event_time')) { |
|
| 148 | 148 | $result['fleet'] = array_merge($result['fleet'], array( |
| 149 | 149 | 'OV_LABEL' => $objFleet->ov_label, |
| 150 | 150 | 'EVENT_TIME_TEXT' => property_exists($objFleet, 'event_time') ? date(FMT_DATE_TIME, $objFleet->event_time + SN_CLIENT_TIME_DIFF) : '', |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | $ship_id = 0; |
| 157 | 157 | $result['ships'] = array(); |
| 158 | - if($spy_level >= 6) { |
|
| 159 | - foreach($objFleet->shipsIterator() as $ship_sn_id => $ship) { |
|
| 160 | - if($spy_level >= 10) { |
|
| 158 | + if ($spy_level >= 6) { |
|
| 159 | + foreach ($objFleet->shipsIterator() as $ship_sn_id => $ship) { |
|
| 160 | + if ($spy_level >= 10) { |
|
| 161 | 161 | $single_ship_data = get_ship_data($ship_sn_id, $user_data); |
| 162 | 162 | $result['ships'][$ship_sn_id] = array( |
| 163 | 163 | 'ID' => $ship_sn_id, |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | function tpl_parse_planet_que($que, $planet, $que_id) { |
| 191 | 191 | $hangar_que = array(); |
| 192 | 192 | $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']]; |
| 193 | - if(!empty($que_hangar)) { |
|
| 194 | - foreach($que_hangar as $que_item) { |
|
| 193 | + if (!empty($que_hangar)) { |
|
| 194 | + foreach ($que_hangar as $que_item) { |
|
| 195 | 195 | $hangar_que['que'][] = array('id' => $que_item['que_unit_id'], 'count' => $que_item['que_unit_amount']); |
| 196 | 196 | $hangar_que[$que_item['que_unit_id']] += $que_item['que_unit_amount']; |
| 197 | 197 | } |
@@ -251,10 +251,10 @@ discard block |
||
| 251 | 251 | 'PLANET_GOVERNOR_LEVEL_MAX' => get_unit_param($planet['PLANET_GOVERNOR_ID'], P_MAX_STACK), |
| 252 | 252 | ); |
| 253 | 253 | |
| 254 | - if(!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) { |
|
| 254 | + if (!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) { |
|
| 255 | 255 | $result['building_que'] = array(); |
| 256 | 256 | $building_que = &$que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']]; |
| 257 | - foreach($building_que as $que_element) { |
|
| 257 | + foreach ($building_que as $que_element) { |
|
| 258 | 258 | $result['building_que'][] = que_tpl_parse_element($que_element); |
| 259 | 259 | } |
| 260 | 260 | } |
@@ -273,19 +273,19 @@ discard block |
||
| 273 | 273 | static $snGroupFleet; |
| 274 | 274 | !$snGroupFleet ? $snGroupFleet = classSupernova::$gc->groupFleet : false; |
| 275 | 275 | |
| 276 | - if(empty($array_of_Fleet)) { |
|
| 276 | + if (empty($array_of_Fleet)) { |
|
| 277 | 277 | return false; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | $fleet_list = array(); |
| 281 | - foreach($array_of_Fleet as $fleet) { |
|
| 282 | - if($fleet->playerOwnerId == $user['id']) { |
|
| 283 | - if($fleet->mission_type == MT_MISSILE) { |
|
| 281 | + foreach ($array_of_Fleet as $fleet) { |
|
| 282 | + if ($fleet->playerOwnerId == $user['id']) { |
|
| 283 | + if ($fleet->mission_type == MT_MISSILE) { |
|
| 284 | 284 | continue; |
| 285 | 285 | } |
| 286 | 286 | $fleet_ownage = 'own'; |
| 287 | 287 | } else { |
| 288 | - switch($fleet->mission_type) { |
|
| 288 | + switch ($fleet->mission_type) { |
|
| 289 | 289 | case MT_ATTACK: |
| 290 | 290 | case MT_ACS: |
| 291 | 291 | case MT_DESTROY: |
@@ -302,9 +302,9 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | $fleet_list[$fleet_ownage]['fleets'][$fleet->dbId] = $fleet; |
| 304 | 304 | |
| 305 | - if($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) { |
|
| 306 | - foreach($fleet->shipsIterator() as $ship_id => $ship) { |
|
| 307 | - if(!empty($snGroupFleet[$ship_id])) { |
|
| 305 | + if ($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) { |
|
| 306 | + foreach ($fleet->shipsIterator() as $ship_id => $ship) { |
|
| 307 | + if (!empty($snGroupFleet[$ship_id])) { |
|
| 308 | 308 | $fleet_list[$fleet_ownage]['total'][$ship_id] += $ship->count; |
| 309 | 309 | } |
| 310 | 310 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | return $fleet_list; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | -function tpl_set_resource_info(template &$template, $planet_row, $fleets_to_planet = array(), $round = 0) { |
|
| 324 | +function tpl_set_resource_info(template & $template, $planet_row, $fleets_to_planet = array(), $round = 0) { |
|
| 325 | 325 | $template->assign_vars(array( |
| 326 | 326 | 'RESOURCE_ROUNDING' => $round, |
| 327 | 327 | |
@@ -1,5 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +/** |
|
| 4 | + * @param string $type |
|
| 5 | + */ |
|
| 3 | 6 | function sn_ube_simulator_encode_replay($combat, $type) |
| 4 | 7 | { |
| 5 | 8 | $strPacked = "{$type}!"; |
@@ -4,9 +4,9 @@ discard block |
||
| 4 | 4 | { |
| 5 | 5 | $strPacked = "{$type}!"; |
| 6 | 6 | |
| 7 | - foreach($combat as $fleetID => $fleetCompress) |
|
| 7 | + foreach ($combat as $fleetID => $fleetCompress) |
|
| 8 | 8 | { |
| 9 | - foreach($fleetCompress as $key => $value) |
|
| 9 | + foreach ($fleetCompress as $key => $value) |
|
| 10 | 10 | { |
| 11 | 11 | $value = intval($value); |
| 12 | 12 | $strPacked .= "{$key},{$value};"; |
@@ -22,29 +22,29 @@ discard block |
||
| 22 | 22 | $fleet_id = 0; |
| 23 | 23 | |
| 24 | 24 | $arr_data_unpacked = explode('!', $str_data); |
| 25 | - foreach($arr_data_unpacked as $data_piece) |
|
| 25 | + foreach ($arr_data_unpacked as $data_piece) |
|
| 26 | 26 | { |
| 27 | - if(!$data_piece) |
|
| 27 | + if (!$data_piece) |
|
| 28 | 28 | { |
| 29 | 29 | continue; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if($data_piece == 'A' || $data_piece == 'D') |
|
| 32 | + if ($data_piece == 'A' || $data_piece == 'D') |
|
| 33 | 33 | { |
| 34 | 34 | $fleet_type = $data_piece; |
| 35 | 35 | continue; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $arr_unit_strings = explode(';', $data_piece); |
| 39 | - foreach($arr_unit_strings as $str_unit_string) |
|
| 39 | + foreach ($arr_unit_strings as $str_unit_string) |
|
| 40 | 40 | { |
| 41 | - if(!$str_unit_string) |
|
| 41 | + if (!$str_unit_string) |
|
| 42 | 42 | { |
| 43 | 43 | continue; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $arr_unit_data = explode(',', $str_unit_string); |
| 47 | - if($arr_unit_data[1]) |
|
| 47 | + if ($arr_unit_data[1]) |
|
| 48 | 48 | { |
| 49 | 49 | $unpacked[$fleet_type][$fleet_id][$arr_unit_data[0]] = intval($arr_unit_data[1]); |
| 50 | 50 | } |
@@ -1,7 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function sn_ube_simulator_encode_replay($combat, $type) |
|
| 4 | -{ |
|
| 3 | +function sn_ube_simulator_encode_replay($combat, $type) { |
|
| 5 | 4 | $strPacked = "{$type}!"; |
| 6 | 5 | |
| 7 | 6 | foreach($combat as $fleetID => $fleetCompress) |
@@ -17,8 +16,7 @@ discard block |
||
| 17 | 16 | return $strPacked; |
| 18 | 17 | } |
| 19 | 18 | |
| 20 | -function sn_ube_simulator_decode_replay($str_data) |
|
| 21 | -{ |
|
| 19 | +function sn_ube_simulator_decode_replay($str_data) { |
|
| 22 | 20 | $fleet_id = 0; |
| 23 | 21 | |
| 24 | 22 | $arr_data_unpacked = explode('!', $str_data); |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * Fleet mission "Relocate" |
| 33 | 33 | * |
| 34 | - * @param $mission_data Mission |
|
| 34 | + * @param Mission $mission_data Mission |
|
| 35 | 35 | * |
| 36 | 36 | * @return int |
| 37 | 37 | * |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | // TODO - Currently $ship_data is one for all players |
| 24 | 24 | static $shipCostInMetalPerPiece, $rates; |
| 25 | 25 | |
| 26 | - if(empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) { |
|
| 26 | + if (empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) { |
|
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | $outcome_value = &$result['$outcome_value']; |
| 49 | 49 | $outcome_list = &$result['$outcome_list']; |
| 50 | 50 | |
| 51 | - if(!$shipCostInMetalPerPiece) { |
|
| 51 | + if (!$shipCostInMetalPerPiece) { |
|
| 52 | 52 | $rates = get_resource_exchange(); |
| 53 | 53 | |
| 54 | - foreach(classSupernova::$gc->groupFleet as $unit_id) { |
|
| 54 | + foreach (classSupernova::$gc->groupFleet as $unit_id) { |
|
| 55 | 55 | $unit_info = get_unit_param($unit_id); |
| 56 | - if($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) { |
|
| 56 | + if ($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) { |
|
| 57 | 57 | continue; |
| 58 | 58 | } |
| 59 | 59 | $shipCostInMetalPerPiece[$unit_id] = get_unit_cost_in($unit_info[P_COST], RES_METAL); |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1 / 1.7)); |
| 74 | 74 | |
| 75 | 75 | $chance_max = 0; |
| 76 | - foreach($outcome_list as $key => &$value) { |
|
| 77 | - if(!$value['chance']) { |
|
| 76 | + foreach ($outcome_list as $key => &$value) { |
|
| 77 | + if (!$value['chance']) { |
|
| 78 | 78 | unset($outcome_list[$key]); |
| 79 | 79 | continue; |
| 80 | 80 | } |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | $outcome_value = mt_rand(0, $chance_max); |
| 84 | 84 | $outcome_description = &$outcome_list[$mission_outcome = FLT_EXPEDITION_OUTCOME_NONE]; |
| 85 | - foreach($outcome_list as $key => &$value) { |
|
| 86 | - if(!$value['chance']) { |
|
| 85 | + foreach ($outcome_list as $key => &$value) { |
|
| 86 | + if (!$value['chance']) { |
|
| 87 | 87 | continue; |
| 88 | 88 | } |
| 89 | 89 | $mission_outcome = $key; |
| 90 | 90 | $outcome_description = $value; |
| 91 | - if($outcome_value <= $outcome_description['value']) { |
|
| 91 | + if ($outcome_value <= $outcome_description['value']) { |
|
| 92 | 92 | break; |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | // $outcome_mission_sub = -1; |
| 106 | 106 | |
| 107 | 107 | $fleet_found = array(); |
| 108 | - switch($mission_outcome) { |
|
| 108 | + switch ($mission_outcome) { |
|
| 109 | 109 | case FLT_EXPEDITION_OUTCOME_LOST_FLEET: |
| 110 | 110 | $objFleet->shipsCountApplyLossMultiplier(mt_rand(1, 3) * mt_rand(200000, 300000) / 1000000); |
| 111 | 111 | break; |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | // Ограничиваем корабли только теми, чья стоимость в металле меньше или равно стоимости самого дорогого корабля |
| 128 | 128 | $can_be_found = array(); |
| 129 | - foreach($shipCostInMetalPerPiece as $ship_id => $shipMetalCost) { |
|
| 130 | - if($shipMetalCost < $max_metal_cost) { |
|
| 129 | + foreach ($shipCostInMetalPerPiece as $ship_id => $shipMetalCost) { |
|
| 130 | + if ($shipMetalCost < $max_metal_cost) { |
|
| 131 | 131 | $can_be_found[$ship_id] = $shipMetalCost; |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -135,13 +135,13 @@ discard block |
||
| 135 | 135 | unset($can_be_found[SHIP_COLONIZER]); |
| 136 | 136 | unset($can_be_found[SHIP_SPY]); |
| 137 | 137 | |
| 138 | - while(count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
| 138 | + while (count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
| 139 | 139 | $found_index = mt_rand(1, count($can_be_found)) - 1; |
| 140 | 140 | $found_ship = array_slice($can_be_found, $found_index, 1, true); |
| 141 | 141 | $found_ship_cost = reset($found_ship); |
| 142 | 142 | $found_ship_id = key($found_ship); |
| 143 | 143 | |
| 144 | - if($found_ship_cost > $found_in_metal) { |
|
| 144 | + if ($found_ship_cost > $found_in_metal) { |
|
| 145 | 145 | unset($can_be_found[$found_ship_id]); |
| 146 | 146 | } else { |
| 147 | 147 | $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost)); |
@@ -150,10 +150,10 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if(empty($fleet_found)) { |
|
| 153 | + if (empty($fleet_found)) { |
|
| 154 | 154 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
| 155 | 155 | } else { |
| 156 | - foreach($fleet_found as $unit_id => $unit_amount) { |
|
| 156 | + foreach ($fleet_found as $unit_id => $unit_amount) { |
|
| 157 | 157 | $objFleet->shipAdjustCount($unit_id, $unit_amount); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | $objFleet->resourcesAdjust($resources_found); |
| 179 | 179 | |
| 180 | - if(array_sum($resources_found) == 0) { |
|
| 180 | + if (array_sum($resources_found) == 0) { |
|
| 181 | 181 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
| 182 | 182 | } |
| 183 | 183 | break; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | // Рассчитываем количество найденной ТМ |
| 189 | 189 | $found_dark_matter = floor(min($outcome_percent * $result['$fleet_metal_points'] / $rates[RES_DARK_MATTER], 10000) * mt_rand(750000, 1000000) / 1000000); |
| 190 | 190 | |
| 191 | - if(!$found_dark_matter) { |
|
| 191 | + if (!$found_dark_matter) { |
|
| 192 | 192 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
| 193 | 193 | } |
| 194 | 194 | break; |
@@ -202,40 +202,39 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | mission_expedition_result_adjust($result); |
| 204 | 204 | |
| 205 | - if($found_dark_matter) { |
|
| 205 | + if ($found_dark_matter) { |
|
| 206 | 206 | rpg_points_change($objFleet->playerOwnerId, RPG_EXPEDITION, $found_dark_matter, 'Expedition Bonus'); |
| 207 | 207 | $msg_text_addon = sprintf(classLocale::$lang['flt_mission_expedition']['found_dark_matter'], $found_dark_matter); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if(!empty($fleet_lost)) { |
|
| 210 | + if (!empty($fleet_lost)) { |
|
| 211 | 211 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['lost_fleet']; |
| 212 | - foreach($fleet_lost as $ship_id => $ship_amount) { |
|
| 212 | + foreach ($fleet_lost as $ship_id => $ship_amount) { |
|
| 213 | 213 | $msg_text_addon .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - if(!empty($fleet_found)) { |
|
| 217 | + if (!empty($fleet_found)) { |
|
| 218 | 218 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['found_fleet']; |
| 219 | - foreach($fleet_found as $ship_id => $ship_amount) { |
|
| 219 | + foreach ($fleet_found as $ship_id => $ship_amount) { |
|
| 220 | 220 | $msg_text_addon .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if(!empty($resources_found) && array_sum($resources_found) > 0) { |
|
| 224 | + if (!empty($resources_found) && array_sum($resources_found) > 0) { |
|
| 225 | 225 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['found_resources']; |
| 226 | - foreach($resources_found as $resource_id => $resource_amount) { |
|
| 226 | + foreach ($resources_found as $resource_id => $resource_amount) { |
|
| 227 | 227 | $msg_text_addon .= classLocale::$lang['tech'][$resource_id] . ' - ' . $resource_amount . "\r\n"; |
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if(!$msg_text) { |
|
| 231 | + if (!$msg_text) { |
|
| 232 | 232 | $messages = &classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['messages']; |
| 233 | - if($outcome_mission_sub >= 0 && is_array($messages)) { |
|
| 233 | + if ($outcome_mission_sub >= 0 && is_array($messages)) { |
|
| 234 | 234 | $messages = &$messages[$outcome_mission_sub]; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - $msg_text = is_string($messages) ? $messages : |
|
| 238 | - (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
| 237 | + $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
| 239 | 238 | } |
| 240 | 239 | |
| 241 | 240 | $fleet_row_end_coordinates_without_type = $objFleet->target_coordinates_without_type(); |