@@ -14,14 +14,14 @@ |
||
14 | 14 | global $lang, $user, $planetrow; |
15 | 15 | |
16 | 16 | $tech_tree = array(); |
17 | - foreach(get_unit_param('techtree') as $unit_group_id => $unit_list) |
|
17 | + foreach (get_unit_param('techtree') as $unit_group_id => $unit_list) |
|
18 | 18 | { |
19 | 19 | $tech_tree[] = array( |
20 | 20 | 'NAME' => $lang['tech'][$unit_group_id], |
21 | 21 | 'GROUP_ID' => $unit_group_id, |
22 | 22 | ); |
23 | 23 | |
24 | - foreach($unit_list as $unit_id) |
|
24 | + foreach ($unit_list as $unit_id) |
|
25 | 25 | { |
26 | 26 | $sn_data_unit = get_unit_param($unit_id); |
27 | 27 | $level_basic = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id, false, true); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | function eco_get_planet_caps_modify_production(&$item, $key, $data) { |
4 | 4 | static $modifiers; |
5 | 5 | |
6 | - if(!$modifiers) { |
|
6 | + if (!$modifiers) { |
|
7 | 7 | $modifiers = sn_get_groups('modifiers'); |
8 | 8 | } |
9 | 9 | $item = floor(mrc_modify_value($data['user'], $data['planet'], $modifiers[MODIFIER_RESOURCE_PRODUCTION], $item)); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | static $sn_group_modifiers, $config_resource_multiplier, $config_resource_multiplier_plain, $config_eco_scale_storage; |
17 | 17 | |
18 | - if(!$sn_group_modifiers) { |
|
18 | + if (!$sn_group_modifiers) { |
|
19 | 19 | $sn_group_modifiers = sn_get_groups('modifiers'); |
20 | 20 | $config_resource_multiplier = game_resource_multiplier(); |
21 | 21 | $config_resource_multiplier_plain = game_resource_multiplier(true); |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | $caps['storage'][RES_METAL][0] = $config->eco_planet_storage_metal; |
27 | 27 | $caps['storage'][RES_CRYSTAL][0] = $config->eco_planet_storage_crystal; |
28 | 28 | $caps['storage'][RES_DEUTERIUM][0] = $config->eco_planet_storage_deuterium; |
29 | - foreach(sn_get_groups('storages') as $unit_id) { |
|
30 | - foreach(get_unit_param($unit_id, P_STORAGE) as $resource_id => $function) { |
|
29 | + foreach (sn_get_groups('storages') as $unit_id) { |
|
30 | + foreach (get_unit_param($unit_id, P_STORAGE) as $resource_id => $function) { |
|
31 | 31 | $caps['storage'][$resource_id][$unit_id] = floor($config_eco_scale_storage * |
32 | 32 | mrc_modify_value($user, $planet_row, $sn_group_modifiers[MODIFIER_RESOURCE_CAPACITY], $function(mrc_get_level($user, $planet_row, $unit_id))) |
33 | 33 | ); |
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | - if($planet_row['planet_type'] == PT_MOON) { |
|
37 | + if ($planet_row['planet_type'] == PT_MOON) { |
|
38 | 38 | return $caps; |
39 | 39 | } |
40 | 40 | |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $caps['production_full'][RES_DEUTERIUM][0] = floor($config->deuterium_basic_income * $config_resource_multiplier * (isset($planet_density[RES_DEUTERIUM]) ? $planet_density[RES_DEUTERIUM] : 1)); |
47 | 47 | $caps['production_full'][RES_ENERGY][0] = floor($config->energy_basic_income * $config_resource_multiplier_plain * (isset($planet_density[RES_ENERGY]) ? $planet_density[RES_ENERGY] : 1)); |
48 | 48 | |
49 | - foreach(sn_get_groups('factories') as $unit_id) { |
|
49 | + foreach (sn_get_groups('factories') as $unit_id) { |
|
50 | 50 | $unit_data = get_unit_param($unit_id); |
51 | 51 | $unit_level = mrc_get_level($user, $planet_row, $unit_id); |
52 | 52 | $unit_load = $planet_row[pname_factory_production_field_name($unit_id)]; |
53 | 53 | |
54 | - foreach($unit_data[P_UNIT_PRODUCTION] as $resource_id => $function) { |
|
54 | + foreach ($unit_data[P_UNIT_PRODUCTION] as $resource_id => $function) { |
|
55 | 55 | $caps['production_full'][$resource_id][$unit_id] = $function($unit_level, $unit_load, $user, $planet_row) |
56 | 56 | * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier) |
57 | 57 | * (isset($planet_density[$resource_id]) ? $planet_density[$resource_id] : 1); |
@@ -60,21 +60,21 @@ discard block |
||
60 | 60 | |
61 | 61 | array_walk_recursive($caps['production_full'], 'eco_get_planet_caps_modify_production', array('user' => $user, 'planet' => $planet_row)); |
62 | 62 | |
63 | - foreach($caps['production_full'] as $resource_id => $resource_data) { |
|
63 | + foreach ($caps['production_full'] as $resource_id => $resource_data) { |
|
64 | 64 | $caps['total_production_full'][$resource_id] = array_sum($resource_data); |
65 | 65 | } |
66 | 66 | |
67 | 67 | $caps['production'] = $caps['production_full']; |
68 | 68 | |
69 | - if($caps['production'][RES_ENERGY][STRUC_MINE_FUSION]) { |
|
69 | + if ($caps['production'][RES_ENERGY][STRUC_MINE_FUSION]) { |
|
70 | 70 | $deuterium_balance = array_sum($caps['production'][RES_DEUTERIUM]); |
71 | 71 | $energy_balance = array_sum($caps['production'][RES_ENERGY]); |
72 | - if($deuterium_balance < 0 || $energy_balance < 0) { |
|
72 | + if ($deuterium_balance < 0 || $energy_balance < 0) { |
|
73 | 73 | $caps['production'][RES_DEUTERIUM][STRUC_MINE_FUSION] = $caps['production'][RES_ENERGY][STRUC_MINE_FUSION] = 0; |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | - foreach($caps['production'][RES_ENERGY] as $energy) { |
|
77 | + foreach ($caps['production'][RES_ENERGY] as $energy) { |
|
78 | 78 | $caps[RES_ENERGY][$energy >= 0 ? BUILD_CREATE : BUILD_DESTROY] += $energy; |
79 | 79 | } |
80 | 80 | |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | ? $caps[RES_ENERGY][BUILD_CREATE] / $caps[RES_ENERGY][BUILD_DESTROY] |
85 | 85 | : 1; |
86 | 86 | |
87 | - foreach($caps['production'] as $resource_id => &$resource_data) { |
|
88 | - if($caps['efficiency'] != 1) { |
|
89 | - foreach($resource_data as $unit_id => &$resource_production) { |
|
90 | - if(!($unit_id == STRUC_MINE_FUSION && $resource_id == RES_DEUTERIUM) && $unit_id != 0 && !($resource_id == RES_ENERGY && $resource_production >= 0)) { |
|
87 | + foreach ($caps['production'] as $resource_id => &$resource_data) { |
|
88 | + if ($caps['efficiency'] != 1) { |
|
89 | + foreach ($resource_data as $unit_id => &$resource_production) { |
|
90 | + if (!($unit_id == STRUC_MINE_FUSION && $resource_id == RES_DEUTERIUM) && $unit_id != 0 && !($resource_id == RES_ENERGY && $resource_production >= 0)) { |
|
91 | 91 | $resource_production = $resource_production * $caps['efficiency']; |
92 | 92 | } |
93 | 93 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $caps['total'][$resource_id] = $caps['total'][$resource_id] >= 0 ? floor($caps['total'][$resource_id]) : ceil($caps['total'][$resource_id]); |
97 | 97 | } |
98 | 98 | |
99 | - foreach($caps['storage'] as $resource_id => &$resource_data) { |
|
99 | + foreach ($caps['storage'] as $resource_id => &$resource_data) { |
|
100 | 100 | $caps['total_storage'][$resource_id] = array_sum($resource_data); |
101 | 101 | } |
102 | 102 |
@@ -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,74 +10,74 @@ 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 | $db_changeset = array(); |
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 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($ship_id, -$ship_count, $user, $planetrow['id']); |
43 | 43 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($ship_id, $ship_count, $user, $TargetGate['id']); |
44 | 44 | } |
45 | 45 | } |
46 | 46 | // Dit monsieur, y avait quelque chose a envoyer ??? |
47 | - if(!empty($db_changeset)) |
|
47 | + if (!empty($db_changeset)) |
|
48 | 48 | { |
49 | - DBStaticPlanet::db_planet_set_by_id($TargetGate['id'], "`last_jump_time` = " . SN_TIME_NOW . ""); |
|
50 | - DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`last_jump_time` = " . SN_TIME_NOW . ""); |
|
49 | + DBStaticPlanet::db_planet_set_by_id($TargetGate['id'], "`last_jump_time` = ".SN_TIME_NOW.""); |
|
50 | + DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`last_jump_time` = ".SN_TIME_NOW.""); |
|
51 | 51 | db_changeset_apply($db_changeset); |
52 | 52 | |
53 | 53 | DBStaticUser::db_user_set_by_id($user['id'], "`current_planet` = '{$TargetGate['id']}'"); |
54 | 54 | |
55 | 55 | $planetrow['last_jump_time'] = SN_TIME_NOW; |
56 | - $RetMessage = classLocale::$lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow)); |
|
56 | + $RetMessage = classLocale::$lang['gate_jump_done']." - ".pretty_time(uni_get_time_to_jump($planetrow)); |
|
57 | 57 | } else { |
58 | 58 | $RetMessage = classLocale::$lang['gate_wait_data']; |
59 | 59 | } |
60 | 60 | } else { |
61 | - $RetMessage = classLocale::$lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime); |
|
61 | + $RetMessage = classLocale::$lang['gate_wait_dest']." - ".pretty_time($NextDestTime); |
|
62 | 62 | } |
63 | 63 | } else { |
64 | 64 | $RetMessage = classLocale::$lang['gate_no_dest_g']; |
65 | 65 | } |
66 | 66 | } else { |
67 | - $RetMessage = classLocale::$lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime); |
|
67 | + $RetMessage = classLocale::$lang['gate_wait_star']." - ".pretty_time($NextJumpTime); |
|
68 | 68 | } |
69 | 69 | sn_db_transaction_commit(); |
70 | 70 | message($RetMessage, classLocale::$lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10); |
71 | 71 | } else { |
72 | 72 | $template = gettemplate('jumpgate', true); |
73 | - if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
73 | + if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
74 | 74 | { |
75 | 75 | $Combo = ''; |
76 | 76 | $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']); |
77 | 77 | // while($CurMoon = db_fetch($MoonList)) |
78 | - foreach($MoonList as $CurMoon) |
|
78 | + foreach ($MoonList as $CurMoon) |
|
79 | 79 | { |
80 | - if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
80 | + if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
81 | 81 | { |
82 | 82 | $NextJumpTime = uni_get_time_to_jump($CurMoon); |
83 | 83 | $template->assign_block_vars('moon', array( |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - foreach(Fleet::$snGroupFleet as $Ship) |
|
94 | + foreach (Fleet::$snGroupFleet as $Ship) |
|
95 | 95 | { |
96 | - if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
96 | + if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
97 | 97 | { |
98 | 98 | continue; |
99 | 99 | } |
@@ -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; |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * Преобразовывает данные симулятора в данные для расчета боя |
465 | 465 | * |
466 | 466 | * @param $side_info |
467 | - * @param $attacker |
|
467 | + * @param boolean $attacker |
|
468 | 468 | * @param int $player_id |
469 | 469 | * |
470 | 470 | * @version 41a6.22 |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
575 | - * @param $template |
|
575 | + * @param null|template $template |
|
576 | 576 | * |
577 | 577 | * @return template |
578 | 578 | */ |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $this->players->db_load_player_by_id($player_id, UBE_PLAYER_IS_DEFENDER); |
148 | 148 | |
149 | 149 | $player_db_row = $this->players[$player_id]->getDbRow(); |
150 | - if($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) { |
|
150 | + if ($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) { |
|
151 | 151 | $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $fortifier_level); |
152 | 152 | } |
153 | 153 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $this->rounds[0] = new UBERound(0); |
180 | 180 | $this->rounds[0]->make_snapshot($this->fleet_list); |
181 | 181 | |
182 | - for($round = 1; $round <= 10; $round++) { |
|
182 | + for ($round = 1; $round <= 10; $round++) { |
|
183 | 183 | // Проводим раунд |
184 | 184 | defined('DEBUG_UBE') ? print("Round {$round}<br>") : false; |
185 | 185 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | // Анализируем итоги текущего раунда и готовим данные для следующего |
194 | 194 | $this->combat_result = $this->fleet_list->ubeAnalyzeFleetOutcome($round); |
195 | - if($this->combat_result != UBE_COMBAT_RESULT_DRAW) { |
|
195 | + if ($this->combat_result != UBE_COMBAT_RESULT_DRAW) { |
|
196 | 196 | break; |
197 | 197 | } |
198 | 198 | |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | // Генерируем результат боя |
222 | 222 | $this->fleet_list->ube_analyze_fleets($this->is_simulator, $this->debris, $this->resource_exchange_rates); |
223 | 223 | |
224 | - if(!$this->is_ube_loaded) { |
|
224 | + if (!$this->is_ube_loaded) { |
|
225 | 225 | $this->moon_calculator->calculate_moon($this); |
226 | 226 | |
227 | 227 | // Лутаем ресурсы - если аттакер выиграл |
228 | - if($this->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
228 | + if ($this->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
229 | 229 | $this->sn_ube_combat_analyze_loot(); |
230 | 230 | } |
231 | 231 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | RES_DEUTERIUM => 0, |
246 | 246 | ); |
247 | 247 | |
248 | - if( |
|
248 | + if ( |
|
249 | 249 | (($planet_resource_total = $this->fleet_list[0]->get_resources_amount()) > 0) |
250 | 250 | && |
251 | 251 | (($total_capacity = $this->fleet_list->ube_get_capacity_attackers()) > 0) |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | $planet_lootable_percent = $planet_lootable / $planet_resource_total; |
258 | 258 | |
259 | 259 | // Вычисляем сколько ресурсов вывезено |
260 | - foreach($this->fleet_list->_container as $fleet_id => $fleet) { |
|
260 | + foreach ($this->fleet_list->_container as $fleet_id => $fleet) { |
|
261 | 261 | $looted_in_metal = 0; |
262 | - foreach($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) { |
|
262 | + foreach ($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) { |
|
263 | 263 | // Вычисляем какой процент общей емкости трюмов атакующих будет задействован |
264 | 264 | $fleet_lootable_percent = $fleet->fleet_capacity / $total_capacity; |
265 | 265 | $looted = floor($resource_amount * $planet_lootable_percent * $fleet_lootable_percent); |
@@ -325,16 +325,16 @@ discard block |
||
325 | 325 | $destination_user_id = $this->fleet_list[0]->owner_id; |
326 | 326 | |
327 | 327 | // Обновляем поле обломков на планете |
328 | - if(!$this->is_admin_in_combat && $this->debris->debris_total() > 0) { |
|
328 | + if (!$this->is_admin_in_combat && $this->debris->debris_total() > 0) { |
|
329 | 329 | db_planet_set_by_gspt($this->ube_planet_info[PLANET_GALAXY], $this->ube_planet_info[PLANET_SYSTEM], $this->ube_planet_info[PLANET_PLANET], PT_PLANET, |
330 | - "`debris_metal` = `debris_metal` + " . $this->debris->debris_get_resource(RES_METAL) . ", `debris_crystal` = `debris_crystal` + " . $this->debris->debris_get_resource(RES_CRYSTAL) |
|
330 | + "`debris_metal` = `debris_metal` + ".$this->debris->debris_get_resource(RES_METAL).", `debris_crystal` = `debris_crystal` + ".$this->debris->debris_get_resource(RES_CRYSTAL) |
|
331 | 331 | ); |
332 | 332 | } |
333 | 333 | |
334 | - foreach($this->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
334 | + foreach ($this->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
335 | 335 | $ship_count_lost = $UBEFleet->unit_list->unitCountLost(); |
336 | 336 | |
337 | - if($fleet_id) { |
|
337 | + if ($fleet_id) { |
|
338 | 338 | // Флот |
339 | 339 | $UBEFleet->db_save_combat_result_fleet($this->is_small_fleet_recce, $this->moon_calculator->get_reapers_status()); |
340 | 340 | } else { |
@@ -342,19 +342,19 @@ discard block |
||
342 | 342 | |
343 | 343 | // Сохраняем изменения ресурсов - если они есть |
344 | 344 | $resource_delta = $UBEFleet->ube_combat_result_calculate_resources(); |
345 | - if(!empty($resource_delta)) { |
|
345 | + if (!empty($resource_delta)) { |
|
346 | 346 | $temp = array(); |
347 | - foreach($resource_delta as $resource_id => $resource_amount) { |
|
347 | + foreach ($resource_delta as $resource_id => $resource_amount) { |
|
348 | 348 | $resource_db_name = pname_resource_name($resource_id); |
349 | 349 | $temp[] = "`{$resource_db_name}` = `{$resource_db_name}` + ({$resource_amount})"; |
350 | 350 | } |
351 | 351 | db_planet_set_by_id($this->ube_planet_info[PLANET_ID], implode(',', $temp)); |
352 | 352 | } |
353 | 353 | |
354 | - if($ship_count_lost) { |
|
354 | + if ($ship_count_lost) { |
|
355 | 355 | $db_changeset = array(); |
356 | 356 | $planet_row_cache = $this->players[$destination_user_id]->getDbRow(); |
357 | - foreach($UBEFleet->unit_list->_container as $UBEUnit) { |
|
357 | + foreach ($UBEFleet->unit_list->_container as $UBEUnit) { |
|
358 | 358 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($UBEUnit->unitId, -$UBEUnit->units_lost, $planet_row_cache, $this->ube_planet_info[PLANET_ID]); |
359 | 359 | } |
360 | 360 | db_changeset_apply($db_changeset); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | // TODO: Связать сабы с флотами констраинтами ON DELETE SET NULL |
366 | 366 | // Для САБов |
367 | 367 | $fleet_group_id_list = $this->fleet_list->ube_get_groups(); |
368 | - if(!empty($fleet_group_id_list)) { |
|
368 | + if (!empty($fleet_group_id_list)) { |
|
369 | 369 | $fleet_group_id_list = implode(',', $fleet_group_id_list); |
370 | 370 | db_acs_delete_by_list($fleet_group_id_list); |
371 | 371 | } |
@@ -374,19 +374,19 @@ discard block |
||
374 | 374 | |
375 | 375 | $bashing_list = array(); |
376 | 376 | $players_sides = $this->players->get_player_sides(); |
377 | - foreach($players_sides as $player_id => $player_side) { |
|
378 | - if($player_side != UBE_PLAYER_IS_ATTACKER) { |
|
377 | + foreach ($players_sides as $player_id => $player_side) { |
|
378 | + if ($player_side != UBE_PLAYER_IS_ATTACKER) { |
|
379 | 379 | continue; |
380 | 380 | } |
381 | - if($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) { |
|
381 | + if ($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) { |
|
382 | 382 | $bashing_list[] = "({$player_id}, {$this->ube_planet_info[PLANET_ID]}, {$this->combat_timestamp})"; |
383 | 383 | } |
384 | - if($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) { |
|
384 | + if ($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) { |
|
385 | 385 | $str_loose_or_win = $this->combat_result == UBE_COMBAT_RESULT_WIN ? 'raidswin' : 'raidsloose'; |
386 | 386 | db_user_set_by_id($player_id, "`xpraid` = `xpraid` + 1, `raids` = `raids` + 1, `{$str_loose_or_win}` = `{$str_loose_or_win}` + 1"); |
387 | 387 | } |
388 | 388 | } |
389 | - if(!empty($bashing_list)) { |
|
389 | + if (!empty($bashing_list)) { |
|
390 | 390 | $bashing_list = implode(',', $bashing_list); |
391 | 391 | db_bashing_insert($bashing_list); |
392 | 392 | } |
@@ -413,20 +413,19 @@ discard block |
||
413 | 413 | $planet_info[PLANET_SYSTEM], |
414 | 414 | $planet_info[PLANET_PLANET], |
415 | 415 | htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'), |
416 | - classLocale::$lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : |
|
417 | - ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
416 | + classLocale::$lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
418 | 417 | ); |
419 | 418 | |
420 | 419 | $text_defender = ''; |
421 | 420 | $debris = $this->debris->get_debris(); |
422 | - foreach($debris as $resource_id => $resource_amount) { |
|
423 | - if($resource_id == RES_DEUTERIUM) { |
|
421 | + foreach ($debris as $resource_id => $resource_amount) { |
|
422 | + if ($resource_id == RES_DEUTERIUM) { |
|
424 | 423 | continue; |
425 | 424 | } |
426 | 425 | |
427 | - $text_defender .= "{$classLocale['tech'][$resource_id]}: " . pretty_number($resource_amount) . '<br />'; |
|
426 | + $text_defender .= "{$classLocale['tech'][$resource_id]}: ".pretty_number($resource_amount).'<br />'; |
|
428 | 427 | } |
429 | - if($text_defender) { |
|
428 | + if ($text_defender) { |
|
430 | 429 | $text_defender = "{$classLocale['ube_report_msg_body_debris']}{$text_defender}<br />"; |
431 | 430 | } |
432 | 431 | |
@@ -436,8 +435,8 @@ discard block |
||
436 | 435 | |
437 | 436 | // TODO: Оптимизировать отсылку сообщений - отсылать пакетами |
438 | 437 | $player_sides = $this->players->get_player_sides(); |
439 | - foreach($player_sides as $player_id => $player_side) { |
|
440 | - $message = $text_common . ($this->is_small_fleet_recce && ($player_side == UBE_PLAYER_IS_ATTACKER) ? classLocale::$lang['ube_report_msg_body_sfr'] : $text_defender); |
|
438 | + foreach ($player_sides as $player_id => $player_side) { |
|
439 | + $message = $text_common.($this->is_small_fleet_recce && ($player_side == UBE_PLAYER_IS_ATTACKER) ? classLocale::$lang['ube_report_msg_body_sfr'] : $text_defender); |
|
441 | 440 | msg_send_simple_message($player_id, '', $this->combat_timestamp, MSG_TYPE_COMBAT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_attack_report'], $message); |
442 | 441 | } |
443 | 442 | |
@@ -473,11 +472,11 @@ discard block |
||
473 | 472 | $player_id = $player_id == -1 ? $this->players->count() : $player_id; |
474 | 473 | $fleet_id = $player_id; // FOR SIMULATOR! |
475 | 474 | |
476 | - if(empty($this->players[$player_id])) { |
|
475 | + if (empty($this->players[$player_id])) { |
|
477 | 476 | $this->players[$player_id] = new UBEPlayer(); |
478 | 477 | } |
479 | 478 | |
480 | - foreach($side_info as $fleet_data) { |
|
479 | + foreach ($side_info as $fleet_data) { |
|
481 | 480 | $this->players[$player_id]->name = $player_id; |
482 | 481 | $this->players[$player_id]->setSide($attacker); |
483 | 482 | |
@@ -485,32 +484,32 @@ discard block |
||
485 | 484 | $this->fleet_list[$fleet_id] = $objFleet; |
486 | 485 | |
487 | 486 | $this->fleet_list[$fleet_id]->owner_id = $player_id; |
488 | - foreach($fleet_data as $unit_id => $unit_count) { |
|
489 | - if(!$unit_count) { |
|
487 | + foreach ($fleet_data as $unit_id => $unit_count) { |
|
488 | + if (!$unit_count) { |
|
490 | 489 | continue; |
491 | 490 | } |
492 | 491 | |
493 | 492 | $unit_type = get_unit_param($unit_id, P_UNIT_TYPE); |
494 | 493 | |
495 | - if($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) { |
|
494 | + if ($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) { |
|
496 | 495 | $this->fleet_list[$fleet_id]->unit_list->unitAdjustCount($unit_id, $unit_count); |
497 | - } elseif($unit_type == UNIT_RESOURCES) { |
|
496 | + } elseif ($unit_type == UNIT_RESOURCES) { |
|
498 | 497 | $this->fleet_list[$fleet_id]->resource_list[$unit_id] = $unit_count; |
499 | - } elseif($unit_type == UNIT_TECHNOLOGIES) { |
|
500 | - if($unit_id == TECH_WEAPON) { |
|
498 | + } elseif ($unit_type == UNIT_TECHNOLOGIES) { |
|
499 | + if ($unit_id == TECH_WEAPON) { |
|
501 | 500 | $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_WEAPON, $unit_count); |
502 | - } elseif($unit_id == TECH_SHIELD) { |
|
501 | + } elseif ($unit_id == TECH_SHIELD) { |
|
503 | 502 | $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_SHIELD, $unit_count); |
504 | - } elseif($unit_id == TECH_ARMOR) { |
|
503 | + } elseif ($unit_id == TECH_ARMOR) { |
|
505 | 504 | $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_ARMOR, $unit_count); |
506 | 505 | } |
507 | - } elseif($unit_type == UNIT_GOVERNORS) { |
|
508 | - if($unit_id == MRC_FORTIFIER) { |
|
506 | + } elseif ($unit_type == UNIT_GOVERNORS) { |
|
507 | + if ($unit_id == MRC_FORTIFIER) { |
|
509 | 508 | // Фортифаер даёт бонус ко всему |
510 | 509 | $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $unit_count); |
511 | 510 | } |
512 | - } elseif($unit_type == UNIT_MERCENARIES) { |
|
513 | - if($unit_id == MRC_ADMIRAL) { |
|
511 | + } elseif ($unit_type == UNIT_MERCENARIES) { |
|
512 | + if ($unit_id == MRC_ADMIRAL) { |
|
514 | 513 | $this->players[$player_id]->player_bonus->add_unit_by_snid(MRC_ADMIRAL, $unit_count); |
515 | 514 | } |
516 | 515 | } |
@@ -565,7 +564,7 @@ discard block |
||
565 | 564 | |
566 | 565 | $ube->sn_ube_message_send(); |
567 | 566 | |
568 | - defined('DEBUG_UBE') ? die('DIE at ' . __FILE__ . ' ' . __LINE__) : false; |
|
567 | + defined('DEBUG_UBE') ? die('DIE at '.__FILE__.' '.__LINE__) : false; |
|
569 | 568 | |
570 | 569 | return false; |
571 | 570 | } |
@@ -580,7 +579,7 @@ discard block |
||
580 | 579 | |
581 | 580 | $ube_report = new UBEReport(); |
582 | 581 | $ube = $ube_report->sn_ube_report_load(sys_get_param_str('cypher')); |
583 | - if($ube != UBE_REPORT_NOT_FOUND) { |
|
582 | + if ($ube != UBE_REPORT_NOT_FOUND) { |
|
584 | 583 | $ube_report->sn_ube_report_generate($ube, $template_result); |
585 | 584 | |
586 | 585 | $template = gettemplate('ube_combat_report', $template); |
@@ -608,9 +607,9 @@ discard block |
||
608 | 607 | $ube->sn_ube_combat(); |
609 | 608 | $ube_report = new UBEReport(); |
610 | 609 | |
611 | - if(sys_get_param_str('reload')) { |
|
610 | + if (sys_get_param_str('reload')) { |
|
612 | 611 | $ube_new = $ube_report->sn_ube_report_load($ube->get_cypher()); // $combat_data = sn_ube_report_load($combat_data[UBE_REPORT_CYPHER]); |
613 | - if($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) { |
|
612 | + if ($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) { |
|
614 | 613 | $ube = $ube_new; |
615 | 614 | } |
616 | 615 | } |
@@ -658,7 +657,7 @@ discard block |
||
658 | 657 | $this->debris->load_from_report_row($report_row); |
659 | 658 | |
660 | 659 | $query = doquery("SELECT * FROM {{ube_report_player}} WHERE `ube_report_id` = {$report_row['ube_report_id']}"); |
661 | - while($player_row = db_fetch($query)) { |
|
660 | + while ($player_row = db_fetch($query)) { |
|
662 | 661 | $this->players->init_player_from_report_info($player_row); |
663 | 662 | } |
664 | 663 |