@@ -2,16 +2,16 @@ |
||
| 2 | 2 | // Captcha code for registration - really didn't work alot :( |
| 3 | 3 | |
| 4 | 4 | session_start(); |
| 5 | -$en=100; |
|
| 6 | -$boy=25; |
|
| 7 | -$sayi = mt_rand(0,9999999); |
|
| 5 | +$en = 100; |
|
| 6 | +$boy = 25; |
|
| 7 | +$sayi = mt_rand(0, 9999999); |
|
| 8 | 8 | $_SESSION['captcha'] = $sayi; |
| 9 | -$tuval = imagecreatetruecolor($en,$boy); |
|
| 10 | -$b = imagecolorallocate($tuval,175,238,238); |
|
| 11 | -$s = imagecolorallocate($tuval,0,0,0); |
|
| 12 | -imagefill($tuval,0,0,$s); |
|
| 13 | -imageline($tuval,20,50,$en,$boy,$b); |
|
| 14 | -imagestring($tuval,3,27,7,$sayi,$b); |
|
| 9 | +$tuval = imagecreatetruecolor($en, $boy); |
|
| 10 | +$b = imagecolorallocate($tuval, 175, 238, 238); |
|
| 11 | +$s = imagecolorallocate($tuval, 0, 0, 0); |
|
| 12 | +imagefill($tuval, 0, 0, $s); |
|
| 13 | +imageline($tuval, 20, 50, $en, $boy, $b); |
|
| 14 | +imagestring($tuval, 3, 27, 7, $sayi, $b); |
|
| 15 | 15 | Header("content-type:image/gif"); |
| 16 | 16 | imagegif($tuval); |
| 17 | 17 | imagedestroy($tuval); |
@@ -115,8 +115,7 @@ |
||
| 115 | 115 | )); |
| 116 | 116 | |
| 117 | 117 | display($template, $lang['tech'][STRUC_MOON_GATE]); |
| 118 | - } |
|
| 119 | - else |
|
| 118 | + } else |
|
| 120 | 119 | { |
| 121 | 120 | message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10); |
| 122 | 121 | } |
@@ -10,34 +10,34 @@ discard block |
||
| 10 | 10 | * @copyright 2008 By Chlorel for XNova |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 13 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 14 | 14 | |
| 15 | 15 | lng_include('fleet'); |
| 16 | 16 | |
| 17 | -if($TargetPlanet = sys_get_param_id('jmpto')) |
|
| 17 | +if ($TargetPlanet = sys_get_param_id('jmpto')) |
|
| 18 | 18 | { |
| 19 | 19 | sn_db_transaction_start(); |
| 20 | 20 | DBStaticUser::db_user_by_id($user['id'], true, 'id'); |
| 21 | 21 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
| 22 | - if(!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
| 22 | + if (!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
| 23 | 23 | { |
| 24 | 24 | $TargetGate = DBStaticPlanet::db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`'); |
| 25 | - if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
| 25 | + if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
| 26 | 26 | { |
| 27 | - $NextDestTime = uni_get_time_to_jump ( $TargetGate ); |
|
| 28 | - if(!$NextDestTime) |
|
| 27 | + $NextDestTime = uni_get_time_to_jump($TargetGate); |
|
| 28 | + if (!$NextDestTime) |
|
| 29 | 29 | { |
| 30 | 30 | $ship_list = sys_get_param('ships'); |
| 31 | 31 | $jumpMade = false; |
| 32 | - foreach($ship_list as $ship_id => $ship_count) |
|
| 32 | + foreach ($ship_list as $ship_id => $ship_count) |
|
| 33 | 33 | { |
| 34 | - if(!in_array($ship_id, Fleet::$snGroupFleet)) |
|
| 34 | + if (!in_array($ship_id, Fleet::$snGroupFleet)) |
|
| 35 | 35 | { |
| 36 | 36 | continue; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id))); |
| 40 | - if($ship_count) |
|
| 40 | + if ($ship_count) |
|
| 41 | 41 | { |
| 42 | 42 | $jumpMade = true; |
| 43 | 43 | DBStaticUnit::dbUpdateOrInsertUnit($ship_id, -$ship_count, $user, $planetrow['id']); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if($jumpMade) |
|
| 48 | + if ($jumpMade) |
|
| 49 | 49 | { |
| 50 | 50 | DBStaticPlanet::db_planet_update_set_by_id( |
| 51 | 51 | $TargetGate['id'], |
@@ -67,31 +67,31 @@ discard block |
||
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | 69 | $planetrow['last_jump_time'] = SN_TIME_NOW; |
| 70 | - $RetMessage = classLocale::$lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow)); |
|
| 70 | + $RetMessage = classLocale::$lang['gate_jump_done']." - ".pretty_time(uni_get_time_to_jump($planetrow)); |
|
| 71 | 71 | } else { |
| 72 | 72 | $RetMessage = classLocale::$lang['gate_wait_data']; |
| 73 | 73 | } |
| 74 | 74 | } else { |
| 75 | - $RetMessage = classLocale::$lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime); |
|
| 75 | + $RetMessage = classLocale::$lang['gate_wait_dest']." - ".pretty_time($NextDestTime); |
|
| 76 | 76 | } |
| 77 | 77 | } else { |
| 78 | 78 | $RetMessage = classLocale::$lang['gate_no_dest_g']; |
| 79 | 79 | } |
| 80 | 80 | } else { |
| 81 | - $RetMessage = classLocale::$lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime); |
|
| 81 | + $RetMessage = classLocale::$lang['gate_wait_star']." - ".pretty_time($NextJumpTime); |
|
| 82 | 82 | } |
| 83 | 83 | sn_db_transaction_commit(); |
| 84 | 84 | message($RetMessage, classLocale::$lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10); |
| 85 | 85 | } else { |
| 86 | 86 | $template = gettemplate('jumpgate', true); |
| 87 | - if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
| 87 | + if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
| 88 | 88 | { |
| 89 | 89 | $Combo = ''; |
| 90 | 90 | $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']); |
| 91 | 91 | // while($CurMoon = db_fetch($MoonList)) |
| 92 | - foreach($MoonList as $CurMoon) |
|
| 92 | + foreach ($MoonList as $CurMoon) |
|
| 93 | 93 | { |
| 94 | - if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
| 94 | + if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
| 95 | 95 | { |
| 96 | 96 | $NextJumpTime = uni_get_time_to_jump($CurMoon); |
| 97 | 97 | $template->assign_block_vars('moon', array( |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - foreach(Fleet::$snGroupFleet as $Ship) |
|
| 108 | + foreach (Fleet::$snGroupFleet as $Ship) |
|
| 109 | 109 | { |
| 110 | - if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
| 110 | + if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
| 111 | 111 | { |
| 112 | 112 | continue; |
| 113 | 113 | } |
@@ -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); |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 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, null, $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' => classLocale::$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 | |
@@ -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 | -require_once('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 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_loadAll('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_end')) |
|
| 23 | +if (SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_end')) |
|
| 24 | 24 | { |
| 25 | 25 | classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_NOW + 120); |
| 26 | 26 | |
@@ -115,8 +115,7 @@ |
||
| 115 | 115 | )); |
| 116 | 116 | |
| 117 | 117 | display($template, $lang['tech'][STRUC_MOON_GATE]); |
| 118 | - } |
|
| 119 | - else |
|
| 118 | + } else |
|
| 120 | 119 | { |
| 121 | 120 | message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10); |
| 122 | 121 | } |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -define('INSIDE' , true); |
|
| 3 | -define('INSTALL' , false); |
|
| 2 | +define('INSIDE', true); |
|
| 3 | +define('INSTALL', false); |
|
| 4 | 4 | define('IN_ADMIN', true); |
| 5 | 5 | |
| 6 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 6 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 7 | 7 | |
| 8 | -if($user['authlevel'] < 3) |
|
| 8 | +if ($user['authlevel'] < 3) |
|
| 9 | 9 | { |
| 10 | 10 | AdminMessage(classLocale::$lang['adm_err_denied']); |
| 11 | 11 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $username_unsafe = sys_get_param_str_unsafe('username'); |
| 26 | 26 | $username = sys_get_param_escaped('username'); |
| 27 | 27 | |
| 28 | -if($galaxy_src) |
|
| 28 | +if ($galaxy_src) |
|
| 29 | 29 | { |
| 30 | 30 | sn_db_transaction_start(); |
| 31 | 31 | $errors = array(); |
@@ -35,41 +35,41 @@ discard block |
||
| 35 | 35 | $planet = sys_o_get_updated($owner, array('galaxy' => $galaxy_src, 'system' => $system_src, 'planet' => $planet_src, 'planet_type' => 1), SN_TIME_NOW); |
| 36 | 36 | $que = $planet['que']; |
| 37 | 37 | $planet = $planet['planet']; |
| 38 | - if(!$planet) |
|
| 38 | + if (!$planet) |
|
| 39 | 39 | { |
| 40 | 40 | $errors[] = classLocale::$lang['adm_pl_comp_err_0']; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if($planet['destruyed']) |
|
| 43 | + if ($planet['destruyed']) |
|
| 44 | 44 | { |
| 45 | 45 | $errors[] = classLocale::$lang['adm_pl_comp_err_1']; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if($planet['id_owner'] != $owner['id'] || !$username) |
|
| 48 | + if ($planet['id_owner'] != $owner['id'] || !$username) |
|
| 49 | 49 | { |
| 50 | 50 | $errors[] = classLocale::$lang['adm_pl_comp_err_4']; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $destination = sys_o_get_updated($owner, array('galaxy' => $galaxy_dst, 'system' => $system_dst, 'planet' => $planet_dst, 'planet_type' => 1), SN_TIME_NOW); |
| 54 | 54 | $destination = $destination['planet']; |
| 55 | - if(!$destination) |
|
| 55 | + if (!$destination) |
|
| 56 | 56 | { |
| 57 | 57 | $errors[] = classLocale::$lang['adm_pl_comp_err_2']; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if($planet['id'] == $destination['id']) |
|
| 60 | + if ($planet['id'] == $destination['id']) |
|
| 61 | 61 | { |
| 62 | 62 | $errors[] = classLocale::$lang['adm_pl_comp_err_5']; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if($planet['id_owner'] != $destination['id_owner']) |
|
| 65 | + if ($planet['id_owner'] != $destination['id_owner']) |
|
| 66 | 66 | { |
| 67 | 67 | $errors[] = classLocale::$lang['adm_pl_comp_err_3']; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if(!empty($errors)) |
|
| 70 | + if (!empty($errors)) |
|
| 71 | 71 | { |
| 72 | - foreach($errors as $error) |
|
| 72 | + foreach ($errors as $error) |
|
| 73 | 73 | { |
| 74 | 74 | $template->assign_block_vars('error', array( |
| 75 | 75 | 'TEXT' => $error, |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | killer_add_planet($planet); |
| 84 | 84 | |
| 85 | 85 | $moon = db_planet_by_gspt($galaxy_src, $system_src, $planet_src, PT_MOON, true); |
| 86 | - if($moon) |
|
| 86 | + if ($moon) |
|
| 87 | 87 | { |
| 88 | 88 | $moon = sys_o_get_updated($owner, $moon, SN_TIME_NOW); |
| 89 | 89 | $moon = $moon['planet']; |
| 90 | 90 | killer_add_planet($moon); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - foreach(sn_get_groups('resources_loot') as $resource_id) |
|
| 93 | + foreach (sn_get_groups('resources_loot') as $resource_id) |
|
| 94 | 94 | { |
| 95 | 95 | $resource_name = pname_resource_name($resource_id); |
| 96 | 96 | $template->assign_var("{$resource_name}_cost", $final_cost[$resource_id]); |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | $template->assign_var("{$resource_name}_bonus", $final_cost[$resource_id]); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if($_GET['btn_confirm']) |
|
| 101 | + if ($_GET['btn_confirm']) |
|
| 102 | 102 | { |
| 103 | 103 | $time = SN_TIME_NOW + PERIOD_DAY; |
| 104 | 104 | |
| 105 | 105 | db_unit_list_delete($planet['id_owner'], LOC_PLANET, $planet['id']); |
| 106 | 106 | db_planet_set_by_id($planet['id'], "id_owner = 0, destruyed = {$time}"); |
| 107 | - if($moon) |
|
| 107 | + if ($moon) |
|
| 108 | 108 | { |
| 109 | 109 | db_unit_list_delete($planet['id_owner'], LOC_PLANET, $moon['id']); |
| 110 | 110 | db_planet_set_by_id($moon['id'], "id_owner = 0, destruyed = {$time}"); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | 'username' => $username, |
| 132 | 132 | )); |
| 133 | 133 | |
| 134 | -display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true ); |
|
| 134 | +display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true); |
|
| 135 | 135 | |
| 136 | 136 | function killer_add_planet($planet) |
| 137 | 137 | { |
@@ -146,34 +146,34 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | */ |
| 148 | 148 | |
| 149 | - foreach(sn_get_groups('structures') as $unit_id) |
|
| 149 | + foreach (sn_get_groups('structures') as $unit_id) |
|
| 150 | 150 | { |
| 151 | 151 | $build_level = mrc_get_level($user, $planet, $unit_id, true, true); |
| 152 | - if($build_level > 0) |
|
| 152 | + if ($build_level > 0) |
|
| 153 | 153 | { |
| 154 | 154 | $unit_cost = get_unit_param($unit_id, 'cost'); |
| 155 | 155 | $build_factor = $unit_cost['factor'] != 1 ? (1 - pow($unit_cost['factor'], $build_level)) / (1 - $unit_cost['factor']) : $unit_cost['factor']; |
| 156 | - foreach($sn_group_resources_loot as $resource_id) |
|
| 156 | + foreach ($sn_group_resources_loot as $resource_id) |
|
| 157 | 157 | { |
| 158 | 158 | $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $build_factor) : 0; |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - foreach(sn_get_groups(array('defense', 'fleet')) as $unit_id) |
|
| 163 | + foreach (sn_get_groups(array('defense', 'fleet')) as $unit_id) |
|
| 164 | 164 | { |
| 165 | 165 | $unit_count = mrc_get_level($user, $planet, $unit_id, true, true); |
| 166 | - if($unit_count > 0) |
|
| 166 | + if ($unit_count > 0) |
|
| 167 | 167 | { |
| 168 | 168 | $unit_cost = get_unit_param($unit_id, 'cost'); |
| 169 | - foreach($sn_group_resources_loot as $resource_id) |
|
| 169 | + foreach ($sn_group_resources_loot as $resource_id) |
|
| 170 | 170 | { |
| 171 | 171 | $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $unit_count) : 0; |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - foreach($sn_group_resources_loot as $resource_id) |
|
| 176 | + foreach ($sn_group_resources_loot as $resource_id) |
|
| 177 | 177 | { |
| 178 | 178 | $final_cost[$resource_id] += floor(mrc_get_level($user, $planet, $resource_id, true, true)); |
| 179 | 179 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * Добавляет юнит к списку бонусов |
| 26 | 26 | * |
| 27 | - * @param $unit_id |
|
| 27 | + * @param integer $unit_id |
|
| 28 | 28 | * @param $unit_level |
| 29 | 29 | */ |
| 30 | 30 | public function add_unit_by_snid($unit_id, $unit_level) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * Выдает финальный бонус в виде множителя |
| 69 | 69 | * |
| 70 | - * @param string|int $param - ИД бонуса |
|
| 70 | + * @param string $param - ИД бонуса |
|
| 71 | 71 | * |
| 72 | 72 | * @return float |
| 73 | 73 | */ |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | * @param $unit_level |
| 29 | 29 | */ |
| 30 | 30 | public function add_unit_by_snid($unit_id, $unit_level) { |
| 31 | - if(!$unit_level) { |
|
| 31 | + if (!$unit_level) { |
|
| 32 | 32 | return; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - foreach(static::$_bonus_group as $param_name => $unit_list) { |
|
| 36 | - if(!empty($unit_list[$unit_id])) { |
|
| 35 | + foreach (static::$_bonus_group as $param_name => $unit_list) { |
|
| 36 | + if (!empty($unit_list[$unit_id])) { |
|
| 37 | 37 | // Простейший вариант - мультипликатор по базе |
| 38 | 38 | // Общий мультипликатор добавляется в конец |
| 39 | 39 | $this->grants[$param_name][$unit_id] = $unit_level; |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | // $this->grants[$param_name][$unit_id] = $unit_level * get_unit_param($unit_id, P_BONUS_VALUE) / 100;; |
| 83 | 83 | $value_add = floatval($base_value); |
| 84 | 84 | $cumulative = 1.0; // Для случая BONUS_PERCENT |
| 85 | - if(!empty($this->grants[$param]) && is_array($this->grants[$param])) { |
|
| 86 | - foreach($this->grants[$param] as $unit_id => $unit_level) { |
|
| 85 | + if (!empty($this->grants[$param]) && is_array($this->grants[$param])) { |
|
| 86 | + foreach ($this->grants[$param] as $unit_id => $unit_level) { |
|
| 87 | 87 | $unit_bonus = 0; |
| 88 | - if($unit_id < 0) { |
|
| 88 | + if ($unit_id < 0) { |
|
| 89 | 89 | // Meta-unit - leave as is |
| 90 | 90 | } else { |
| 91 | 91 | // TODO - Подумать, что будет при смешивании разных бонусов и как этого избежать |
| 92 | 92 | $bonus_value = get_unit_param($unit_id, P_BONUS_VALUE); |
| 93 | 93 | $bonus_type = get_unit_param($unit_id, P_BONUS_TYPE); |
| 94 | - switch($bonus_type) { |
|
| 94 | + switch ($bonus_type) { |
|
| 95 | 95 | case BONUS_PERCENT: |
| 96 | 96 | $unit_bonus = $unit_level * $bonus_value / 100; |
| 97 | 97 | $cumulative += $unit_bonus; |
@@ -278,6 +278,9 @@ |
||
| 278 | 278 | return count($this->ube_side_present_at_round_start); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | + /** |
|
| 282 | + * @param integer $round |
|
| 283 | + */ |
|
| 281 | 284 | public function ubeAnalyzeFleetOutcome($round) { |
| 282 | 285 | $this->ube_actualize_sides(); |
| 283 | 286 | |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function ube_db_load_fleets_outcome($report_row) { |
| 84 | 84 | $query = doquery("SELECT * FROM {{ube_report_outcome_fleet}} WHERE `ube_report_id` = {$report_row['ube_report_id']}"); |
| 85 | - while($row = db_fetch($query)) { |
|
| 85 | + while ($row = db_fetch($query)) { |
|
| 86 | 86 | $fleet_id = $row['ube_report_outcome_fleet_fleet_id']; |
| 87 | 87 | $this[$fleet_id]->load_outcome_from_report_row($row); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $query = doquery("SELECT * FROM {{ube_report_outcome_unit}} WHERE `ube_report_id` = {$report_row['ube_report_id']} ORDER BY `ube_report_outcome_unit_sort_order`"); |
| 91 | - while($row = db_fetch($query)) { |
|
| 91 | + while ($row = db_fetch($query)) { |
|
| 92 | 92 | $fleet_id = $row['ube_report_outcome_unit_fleet_id']; |
| 93 | 93 | $this[$fleet_id]->load_unit_outcome_from_row($row); |
| 94 | 94 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | UBE_PLAYER_IS_DEFENDER => array(), |
| 109 | 109 | ); |
| 110 | 110 | |
| 111 | - foreach($this->_container as $fleet_id => $UBEFleet) { |
|
| 111 | + foreach ($this->_container as $fleet_id => $UBEFleet) { |
|
| 112 | 112 | $result[$UBEFleet->is_attacker][] = array( |
| 113 | 113 | 'ID' => $fleet_id, |
| 114 | 114 | 'NAME' => $ube->players[$UBEFleet->owner_id]->name, |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function ube_analyze_fleets($is_simulator, UBEDebris $debris, array $resource_exchange_rates) { |
| 133 | 133 | // Генерируем результат боя |
| 134 | - foreach($this->_container as $fleet_id => $UBEFleet) { |
|
| 134 | + foreach ($this->_container as $fleet_id => $UBEFleet) { |
|
| 135 | 135 | // Инициализируем массив результатов для флота |
| 136 | 136 | // $this->init_fleet_outcome_and_link_to_side($UBEFleet); |
| 137 | 137 | |
| 138 | - foreach($UBEFleet->unit_list->_container as $UBEUnit) { |
|
| 138 | + foreach ($UBEFleet->unit_list->_container as $UBEUnit) { |
|
| 139 | 139 | $UBEUnit->ube_analyze_unit($is_simulator); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -152,10 +152,10 @@ discard block |
||
| 152 | 152 | $this->resources_lost_in_metal = array( |
| 153 | 153 | RES_METAL => 0, |
| 154 | 154 | ); |
| 155 | - foreach($UBEFleet->resources_lost_on_units as $resource_id => $resource_amount) { |
|
| 155 | + foreach ($UBEFleet->resources_lost_on_units as $resource_id => $resource_amount) { |
|
| 156 | 156 | $UBEFleet->resources_lost_in_metal[RES_METAL] += $resource_amount * $resource_exchange_rates[$resource_id]; |
| 157 | 157 | } |
| 158 | - foreach($UBEFleet->cargo_dropped as $resource_id => $resource_amount) { |
|
| 158 | + foreach ($UBEFleet->cargo_dropped as $resource_id => $resource_amount) { |
|
| 159 | 159 | $UBEFleet->resources_lost_in_metal[RES_METAL] += $resource_amount * $resource_exchange_rates[$resource_id]; |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function ube_get_groups() { |
| 168 | 168 | $result = array(); |
| 169 | - foreach($this->_container as $UBEFleet) { |
|
| 170 | - if($UBEFleet->group_id) { |
|
| 169 | + foreach ($this->_container as $UBEFleet) { |
|
| 170 | + if ($UBEFleet->group_id) { |
|
| 171 | 171 | $result[$UBEFleet->group_id] = $UBEFleet->group_id; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function ube_get_capacity_attackers() { |
| 182 | 182 | $result = 0; |
| 183 | - foreach($this->_container as $UBEFleet) { |
|
| 184 | - if($UBEFleet->is_attacker) { |
|
| 183 | + foreach ($this->_container as $UBEFleet) { |
|
| 184 | + if ($UBEFleet->is_attacker) { |
|
| 185 | 185 | $result += $UBEFleet->fleet_capacity; |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function ube_db_load_from_report_row(array $report_row, UBE $ube) { |
| 197 | 197 | $query = doquery("SELECT * FROM {{ube_report_fleet}} WHERE `ube_report_id` = {$report_row['ube_report_id']}"); |
| 198 | - while($fleet_row = db_fetch($query)) { |
|
| 198 | + while ($fleet_row = db_fetch($query)) { |
|
| 199 | 199 | $objFleet = new UBEFleet(); |
| 200 | 200 | $objFleet->load_from_report($fleet_row, $ube); |
| 201 | 201 | $this[$objFleet->db_id] = $objFleet; |
@@ -209,20 +209,20 @@ discard block |
||
| 209 | 209 | * @version 2016-02-25 23:42:45 41a4.68 |
| 210 | 210 | */ |
| 211 | 211 | public function ube_prepare_for_next_round($is_simulator) { |
| 212 | - foreach($this->_container as $fleet_id => $UBEFleet) { |
|
| 212 | + foreach ($this->_container as $fleet_id => $UBEFleet) { |
|
| 213 | 213 | $UBEFleet->prepare_for_next_round($is_simulator); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | // Суммируем данные по атакующим и защитникам |
| 217 | 217 | $this->ube_total[UBE_PLAYER_IS_ATTACKER]->_reset(); |
| 218 | 218 | $this->ube_total[UBE_PLAYER_IS_DEFENDER]->_reset(); |
| 219 | - foreach($this->_container as $fleet_id => $UBEFleet) { |
|
| 219 | + foreach ($this->_container as $fleet_id => $UBEFleet) { |
|
| 220 | 220 | $this->ube_total[$UBEFleet->is_attacker]->add_unit_stats_array($UBEFleet->total_stats); |
| 221 | 221 | } |
| 222 | 222 | //pvar_dump($this->ube_total); |
| 223 | 223 | |
| 224 | 224 | // Высчитываем долю атаки, приходящейся на юнит равную отношению брони юнита к общей броне - крупные цели атакуют чаще |
| 225 | - foreach($this->_container as $fleet_id => $UBEFleet) { |
|
| 225 | + foreach ($this->_container as $fleet_id => $UBEFleet) { |
|
| 226 | 226 | $UBEFleet->calculate_unit_partial_data($this->ube_total[$UBEFleet->is_attacker]); |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function ube_calculate_attack_results(UBE $ube) { |
| 238 | 238 | // Каждый флот атакует все |
| 239 | - foreach($this->_container as $attack_fleet_data) { |
|
| 239 | + foreach ($this->_container as $attack_fleet_data) { |
|
| 240 | 240 | defined('DEBUG_UBE') ? print("Fleet {$attack_fleet_data->db_id} attacks<br /><div style='margin-left: 30px;'>") : false; |
| 241 | 241 | |
| 242 | 242 | $attack_fleet_data->attack_fleets($this, $ube->is_simulator); |
@@ -251,8 +251,8 @@ discard block |
||
| 251 | 251 | * @version 2016-02-25 23:42:45 41a4.68 |
| 252 | 252 | */ |
| 253 | 253 | public function ube_actualize_sides() { |
| 254 | - foreach($this->_container as $UBEFleet) { |
|
| 255 | - if($UBEFleet->get_unit_count() > 0) { |
|
| 254 | + foreach ($this->_container as $UBEFleet) { |
|
| 255 | + if ($UBEFleet->get_unit_count() > 0) { |
|
| 256 | 256 | $this->ube_side_present_at_round_start[$UBEFleet->is_attacker] = 1; |
| 257 | 257 | } |
| 258 | 258 | } |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function ube_calculate_attack_reapers() { |
| 267 | 267 | $reapers = 0; |
| 268 | - foreach($this->_container as $fleet_id => $UBERoundFleetCombat) { |
|
| 269 | - if($UBERoundFleetCombat->is_attacker == UBE_PLAYER_IS_ATTACKER) { |
|
| 268 | + foreach ($this->_container as $fleet_id => $UBERoundFleetCombat) { |
|
| 269 | + if ($UBERoundFleetCombat->is_attacker == UBE_PLAYER_IS_ATTACKER) { |
|
| 270 | 270 | $reapers += $UBERoundFleetCombat->unit_list->unitCountReapers(); |
| 271 | 271 | } |
| 272 | 272 | } |
@@ -283,10 +283,10 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | $result = UBE_COMBAT_RESULT_DRAW; |
| 285 | 285 | // Проверяем результат боя |
| 286 | - if($this->ube_get_sides_count() == 0 || $round >= 10) { |
|
| 286 | + if ($this->ube_get_sides_count() == 0 || $round >= 10) { |
|
| 287 | 287 | // Если кого-то не осталось или не осталось обоих - заканчиваем цикл |
| 288 | 288 | $result = UBE_COMBAT_RESULT_DRAW_END; |
| 289 | - } elseif($this->ube_get_sides_count() == 1) { |
|
| 289 | + } elseif ($this->ube_get_sides_count() == 1) { |
|
| 290 | 290 | // Если осталась одна сторона - она и выиграла |
| 291 | 291 | $result = isset($this->ube_side_present_at_round_start[UBE_PLAYER_IS_ATTACKER]) ? UBE_COMBAT_RESULT_WIN : UBE_COMBAT_RESULT_LOSS; |
| 292 | 292 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * @version 41a6.16 |
| 304 | 304 | */ |
| 305 | 305 | public function ubeInitGetAttackers(Fleet $objFleet, UBEPlayerList $players) { |
| 306 | - if($objFleet->group_id) { |
|
| 306 | + if ($objFleet->group_id) { |
|
| 307 | 307 | $fleets_added = $this->dbLoadWhere("`fleet_group` = {$objFleet->group_id}"); |
| 308 | 308 | } else { |
| 309 | 309 | $this->ube_insert_from_Fleet($objFleet); |
@@ -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); |
@@ -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']]; |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // Compare function to sort fleet in time order |
| 4 | 4 | function tpl_assign_fleet_compare($a, $b) { |
| 5 | - if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) { |
|
| 6 | - if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) { |
|
| 5 | + if ($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) { |
|
| 6 | + if ($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) { |
|
| 7 | 7 | return 0; |
| 8 | 8 | } |
| 9 | 9 | |
@@ -19,17 +19,17 @@ discard block |
||
| 19 | 19 | * @param string $js_name |
| 20 | 20 | */ |
| 21 | 21 | function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') { |
| 22 | - if(!$fleets) { |
|
| 22 | + if (!$fleets) { |
|
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | usort($fleets, 'tpl_assign_fleet_compare'); |
| 27 | 27 | |
| 28 | - foreach($fleets as $fleet_data) { |
|
| 28 | + foreach ($fleets as $fleet_data) { |
|
| 29 | 29 | $template->assign_block_vars($js_name, $fleet_data['fleet']); |
| 30 | 30 | |
| 31 | - if($fleet_data['ships']) { |
|
| 32 | - foreach($fleet_data['ships'] as $ship_data) { |
|
| 31 | + if ($fleet_data['ships']) { |
|
| 32 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
| 33 | 33 | $template->assign_block_vars("{$js_name}.ships", $ship_data); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | 'DEUTERIUM' => $fleet[RES_DEUTERIUM], |
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | - foreach($fleet as $ship_id => $ship_amount) { |
|
| 54 | - if(in_array($ship_id, Fleet::$snGroupFleet)) { |
|
| 53 | + foreach ($fleet as $ship_id => $ship_amount) { |
|
| 54 | + if (in_array($ship_id, Fleet::$snGroupFleet)) { |
|
| 55 | 55 | $single_ship_data = get_ship_data($ship_id, $user_data); |
| 56 | 56 | $return['ships'][$ship_id] = array( |
| 57 | 57 | 'ID' => $ship_id, |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $result = array(); |
| 92 | 92 | |
| 93 | - if(!$user_data) { |
|
| 93 | + if (!$user_data) { |
|
| 94 | 94 | $user_data = $user; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if(!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) { |
|
| 97 | + if (!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) { |
|
| 98 | 98 | $aks = DBStaticFleetACS::db_acs_get_by_group_id($objFleet->group_id); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | 'MISSION' => $objFleet->mission_type, |
| 114 | 114 | 'MISSION_NAME' => classLocale::$lang['type_mission'][$objFleet->mission_type], |
| 115 | 115 | 'ACS' => !empty($aks['name']) ? $aks['name'] : (!empty($objFleet->group_id) ? $objFleet->group_id : ''), |
| 116 | - 'AMOUNT' => $spy_level >= 4 ? (pretty_number($objFleet->shipsGetTotal()) . (array_sum($fleet_resources) ? '+' : '')) : '?', |
|
| 116 | + 'AMOUNT' => $spy_level >= 4 ? (pretty_number($objFleet->shipsGetTotal()).(array_sum($fleet_resources) ? '+' : '')) : '?', |
|
| 117 | 117 | |
| 118 | 118 | 'METAL' => $spy_level >= 8 ? $fleet_resources[RES_METAL] : 0, |
| 119 | 119 | 'CRYSTAL' => $spy_level >= 8 ? $fleet_resources[RES_CRYSTAL] : 0, |
@@ -135,14 +135,14 @@ discard block |
||
| 135 | 135 | 'STAY_LEFT' => floor($objFleet->time_mission_job_complete + 1 - SN_TIME_NOW), |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | - if(property_exists($objFleet, 'fleet_start_name')) { |
|
| 138 | + if (property_exists($objFleet, 'fleet_start_name')) { |
|
| 139 | 139 | $result['START_NAME'] = $objFleet->fleet_start_name; |
| 140 | 140 | } |
| 141 | - if(property_exists($objFleet, 'fleet_end_name')) { |
|
| 141 | + if (property_exists($objFleet, 'fleet_end_name')) { |
|
| 142 | 142 | $result['END_NAME'] = $objFleet->fleet_end_name; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if(property_exists($objFleet, 'event_time')) { |
|
| 145 | + if (property_exists($objFleet, 'event_time')) { |
|
| 146 | 146 | $result['fleet'] = array_merge($result['fleet'], array( |
| 147 | 147 | 'OV_LABEL' => $objFleet->ov_label, |
| 148 | 148 | 'EVENT_TIME_TEXT' => property_exists($objFleet, 'event_time') ? date(FMT_DATE_TIME, $objFleet->event_time + SN_CLIENT_TIME_DIFF) : '', |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $ship_id = 0; |
| 155 | 155 | $result['ships'] = array(); |
| 156 | - if($spy_level >= 6) { |
|
| 157 | - foreach($objFleet->shipsIterator() as $ship_sn_id => $ship) { |
|
| 158 | - if($spy_level >= 10) { |
|
| 156 | + if ($spy_level >= 6) { |
|
| 157 | + foreach ($objFleet->shipsIterator() as $ship_sn_id => $ship) { |
|
| 158 | + if ($spy_level >= 10) { |
|
| 159 | 159 | $single_ship_data = get_ship_data($ship_sn_id, $user_data); |
| 160 | 160 | $result['ships'][$ship_sn_id] = array( |
| 161 | 161 | 'ID' => $ship_sn_id, |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | function tpl_parse_planet_que($que, $planet, $que_id) { |
| 189 | 189 | $hangar_que = array(); |
| 190 | 190 | $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']]; |
| 191 | - if(!empty($que_hangar)) { |
|
| 192 | - foreach($que_hangar as $que_item) { |
|
| 191 | + if (!empty($que_hangar)) { |
|
| 192 | + foreach ($que_hangar as $que_item) { |
|
| 193 | 193 | $hangar_que['que'][] = array('id' => $que_item['que_unit_id'], 'count' => $que_item['que_unit_amount']); |
| 194 | 194 | $hangar_que[$que_item['que_unit_id']] += $que_item['que_unit_amount']; |
| 195 | 195 | } |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | 'PLANET_GOVERNOR_LEVEL_MAX' => get_unit_param($planet['PLANET_GOVERNOR_ID'], P_MAX_STACK), |
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | - if(!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) { |
|
| 252 | + if (!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) { |
|
| 253 | 253 | $result['building_que'] = array(); |
| 254 | 254 | $building_que = &$que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']]; |
| 255 | - foreach($building_que as $que_element) { |
|
| 255 | + foreach ($building_que as $que_element) { |
|
| 256 | 256 | $result['building_que'][] = que_tpl_parse_element($que_element); |
| 257 | 257 | } |
| 258 | 258 | } |
@@ -271,19 +271,19 @@ discard block |
||
| 271 | 271 | static $snGroupFleet; |
| 272 | 272 | !$snGroupFleet ? $snGroupFleet = Fleet::$snGroupFleet : false; |
| 273 | 273 | |
| 274 | - if(empty($array_of_Fleet)) { |
|
| 274 | + if (empty($array_of_Fleet)) { |
|
| 275 | 275 | return false; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | $fleet_list = array(); |
| 279 | - foreach($array_of_Fleet as $fleet) { |
|
| 280 | - if($fleet->playerOwnerId == $user['id']) { |
|
| 281 | - if($fleet->mission_type == MT_MISSILE) { |
|
| 279 | + foreach ($array_of_Fleet as $fleet) { |
|
| 280 | + if ($fleet->playerOwnerId == $user['id']) { |
|
| 281 | + if ($fleet->mission_type == MT_MISSILE) { |
|
| 282 | 282 | continue; |
| 283 | 283 | } |
| 284 | 284 | $fleet_ownage = 'own'; |
| 285 | 285 | } else { |
| 286 | - switch($fleet->mission_type) { |
|
| 286 | + switch ($fleet->mission_type) { |
|
| 287 | 287 | case MT_ATTACK: |
| 288 | 288 | case MT_ACS: |
| 289 | 289 | case MT_DESTROY: |
@@ -300,9 +300,9 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | $fleet_list[$fleet_ownage]['fleets'][$fleet->dbId] = $fleet; |
| 302 | 302 | |
| 303 | - if($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) { |
|
| 304 | - foreach($fleet->shipsIterator() as $ship_id => $ship) { |
|
| 305 | - if(!empty($snGroupFleet[$ship_id])) { |
|
| 303 | + if ($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) { |
|
| 304 | + foreach ($fleet->shipsIterator() as $ship_id => $ship) { |
|
| 305 | + if (!empty($snGroupFleet[$ship_id])) { |
|
| 306 | 306 | $fleet_list[$fleet_ownage]['total'][$ship_id] += $ship->count; |
| 307 | 307 | } |
| 308 | 308 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | return $fleet_list; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | -function tpl_set_resource_info(template &$template, $planet_row, $fleets_to_planet = array(), $round = 0) { |
|
| 322 | +function tpl_set_resource_info(template & $template, $planet_row, $fleets_to_planet = array(), $round = 0) { |
|
| 323 | 323 | $template->assign_vars(array( |
| 324 | 324 | 'RESOURCE_ROUNDING' => $round, |
| 325 | 325 | |