@@ -26,7 +26,9 @@ |
||
26 | 26 | * DO NOT CHANGE |
27 | 27 | */ |
28 | 28 | |
29 | -if (!defined('INSIDE')) die(); |
|
29 | +if (!defined('INSIDE')) { |
|
30 | + die(); |
|
31 | +} |
|
30 | 32 | |
31 | 33 | |
32 | 34 | $a_lang_array = (array( |
@@ -8,23 +8,23 @@ discard block |
||
8 | 8 | $fleet_events = array(); |
9 | 9 | $fleet_number = 0; |
10 | 10 | |
11 | - if(empty($fleet_list)) |
|
11 | + if (empty($fleet_list)) |
|
12 | 12 | { |
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | - foreach($fleet_list as $fleet) |
|
16 | + foreach ($fleet_list as $fleet) |
|
17 | 17 | { |
18 | 18 | $planet_start_type = $fleet['fleet_start_type'] == PT_MOON ? PT_MOON : PT_PLANET; |
19 | 19 | $planet_start = DBStaticPlanet::db_planet_by_gspt($fleet['fleet_start_galaxy'], $fleet['fleet_start_system'], $fleet['fleet_start_planet'], $planet_start_type, false, 'name'); |
20 | 20 | $fleet['fleet_start_name'] = $planet_start['name']; |
21 | 21 | |
22 | 22 | $planet_end_type = $fleet['fleet_end_type'] == PT_MOON ? PT_MOON : PT_PLANET; |
23 | - if($fleet['fleet_end_planet'] > $config->game_maxPlanet) |
|
23 | + if ($fleet['fleet_end_planet'] > $config->game_maxPlanet) |
|
24 | 24 | { |
25 | 25 | $fleet['fleet_end_name'] = $lang['ov_fleet_exploration']; |
26 | 26 | } |
27 | - elseif($fleet['fleet_mission'] == MT_COLONIZE) |
|
27 | + elseif ($fleet['fleet_mission'] == MT_COLONIZE) |
|
28 | 28 | { |
29 | 29 | $fleet['fleet_end_name'] = $lang['ov_fleet_colonization']; |
30 | 30 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $fleet['fleet_end_name'] = $planet_end['name']; |
35 | 35 | } |
36 | 36 | |
37 | - if($fleet['fleet_start_time'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] != MT_MISSILE && |
|
37 | + if ($fleet['fleet_start_time'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] != MT_MISSILE && |
|
38 | 38 | ($planet_scanned === false |
39 | 39 | || |
40 | 40 | ( |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | $fleet_events[] = flt_register_fleet_event($fleet, 0, $planet_end_type); |
50 | 50 | } |
51 | 51 | |
52 | - if($fleet['fleet_end_stay'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $planet_scanned === false && $fleet['fleet_mission'] != MT_MISSILE) |
|
52 | + if ($fleet['fleet_end_stay'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $planet_scanned === false && $fleet['fleet_mission'] != MT_MISSILE) |
|
53 | 53 | { |
54 | 54 | $fleet_events[] = flt_register_fleet_event($fleet, 1, $planet_end_type); |
55 | 55 | } |
56 | 56 | |
57 | - if( |
|
57 | + if ( |
|
58 | 58 | $fleet['fleet_end_time'] > SN_TIME_NOW && $fleet['fleet_mission'] != MT_MISSILE && ($fleet['fleet_mess'] == 1 || ($fleet['fleet_mission'] != MT_RELOCATE && $fleet['fleet_mission'] != MT_COLONIZE)) && |
59 | 59 | ( |
60 | 60 | ($planet_scanned === false && $fleet['fleet_owner'] == $user['id']) |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $fleet_events[] = flt_register_fleet_event($fleet, 2, $planet_end_type); |
72 | 72 | } |
73 | 73 | |
74 | - if($fleet['fleet_mission'] == MT_MISSILE) |
|
74 | + if ($fleet['fleet_mission'] == MT_MISSILE) |
|
75 | 75 | { |
76 | 76 | $fleet_events[] = flt_register_fleet_event($fleet, 3, $planet_end_type); |
77 | 77 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | global $user, $planetrow, $fleet_number; |
86 | 86 | |
87 | - switch($fleet['ov_label'] = $ov_label) |
|
87 | + switch ($fleet['ov_label'] = $ov_label) |
|
88 | 88 | { |
89 | 89 | case 0: |
90 | 90 | $fleet['event_time'] = $fleet['fleet_start_time']; |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | |
117 | 117 | } |
118 | 118 | |
119 | - $fleet['ov_this_planet'] = $is_this_planet;// || $planet_scanned != false; |
|
119 | + $fleet['ov_this_planet'] = $is_this_planet; // || $planet_scanned != false; |
|
120 | 120 | |
121 | - if($fleet['fleet_owner'] == $user['id']) |
|
121 | + if ($fleet['fleet_owner'] == $user['id']) |
|
122 | 122 | { |
123 | 123 | $user_data = $user; |
124 | 124 | } |
@@ -89,18 +89,18 @@ discard block |
||
89 | 89 | case 0: |
90 | 90 | $fleet['event_time'] = $fleet['fleet_start_time']; |
91 | 91 | $is_this_planet = ( |
92 | - ($planetrow['galaxy'] == $fleet['fleet_end_galaxy']) AND |
|
93 | - ($planetrow['system'] == $fleet['fleet_end_system']) AND |
|
94 | - ($planetrow['planet'] == $fleet['fleet_end_planet']) AND |
|
92 | + ($planetrow['galaxy'] == $fleet['fleet_end_galaxy']) and |
|
93 | + ($planetrow['system'] == $fleet['fleet_end_system']) and |
|
94 | + ($planetrow['planet'] == $fleet['fleet_end_planet']) and |
|
95 | 95 | ($planetrow['planet_type'] == $planet_end_type)); |
96 | 96 | break; |
97 | 97 | |
98 | 98 | case 1: |
99 | 99 | $fleet['event_time'] = $fleet['fleet_end_stay']; |
100 | 100 | $is_this_planet = ( |
101 | - ($planetrow['galaxy'] == $fleet['fleet_end_galaxy']) AND |
|
102 | - ($planetrow['system'] == $fleet['fleet_end_system']) AND |
|
103 | - ($planetrow['planet'] == $fleet['fleet_end_planet']) AND |
|
101 | + ($planetrow['galaxy'] == $fleet['fleet_end_galaxy']) and |
|
102 | + ($planetrow['system'] == $fleet['fleet_end_system']) and |
|
103 | + ($planetrow['planet'] == $fleet['fleet_end_planet']) and |
|
104 | 104 | ($planetrow['planet_type'] == $planet_end_type)); |
105 | 105 | break; |
106 | 106 | |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | case 3: |
109 | 109 | $fleet['event_time'] = $fleet['fleet_end_time']; |
110 | 110 | $is_this_planet = ( |
111 | - ($planetrow['galaxy'] == $fleet['fleet_start_galaxy']) AND |
|
112 | - ($planetrow['system'] == $fleet['fleet_start_system']) AND |
|
113 | - ($planetrow['planet'] == $fleet['fleet_start_planet']) AND |
|
111 | + ($planetrow['galaxy'] == $fleet['fleet_start_galaxy']) and |
|
112 | + ($planetrow['system'] == $fleet['fleet_start_system']) and |
|
113 | + ($planetrow['planet'] == $fleet['fleet_start_planet']) and |
|
114 | 114 | ($planetrow['planet_type'] == $fleet['fleet_start_type'])); |
115 | 115 | break; |
116 | 116 |
@@ -3,8 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | use Planet\DBStaticPlanet; |
5 | 5 | |
6 | -function flt_parse_fleets_to_events($fleet_list, $planet_scanned = false) |
|
7 | -{ |
|
6 | +function flt_parse_fleets_to_events($fleet_list, $planet_scanned = false) { |
|
8 | 7 | global $config, $user, $fleet_number, $lang; |
9 | 8 | |
10 | 9 | $fleet_events = array(); |
@@ -25,12 +24,10 @@ discard block |
||
25 | 24 | if($fleet['fleet_end_planet'] > $config->game_maxPlanet) |
26 | 25 | { |
27 | 26 | $fleet['fleet_end_name'] = $lang['ov_fleet_exploration']; |
28 | - } |
|
29 | - elseif($fleet['fleet_mission'] == MT_COLONIZE) |
|
27 | + } elseif($fleet['fleet_mission'] == MT_COLONIZE) |
|
30 | 28 | { |
31 | 29 | $fleet['fleet_end_name'] = $lang['ov_fleet_colonization']; |
32 | - } |
|
33 | - else |
|
30 | + } else |
|
34 | 31 | { |
35 | 32 | $planet_end = DBStaticPlanet::db_planet_by_gspt($fleet['fleet_end_galaxy'], $fleet['fleet_end_system'], $fleet['fleet_end_planet'], $planet_end_type, false, 'name'); |
36 | 33 | $fleet['fleet_end_name'] = $planet_end['name']; |
@@ -82,8 +79,7 @@ discard block |
||
82 | 79 | return $fleet_events; |
83 | 80 | } |
84 | 81 | |
85 | -function flt_register_fleet_event($fleet, $ov_label, $planet_end_type) |
|
86 | -{ |
|
82 | +function flt_register_fleet_event($fleet, $ov_label, $planet_end_type) { |
|
87 | 83 | global $user, $planetrow, $fleet_number; |
88 | 84 | |
89 | 85 | switch($fleet['ov_label'] = $ov_label) |
@@ -123,8 +119,7 @@ discard block |
||
123 | 119 | if($fleet['fleet_owner'] == $user['id']) |
124 | 120 | { |
125 | 121 | $user_data = $user; |
126 | - } |
|
127 | - else |
|
122 | + } else |
|
128 | 123 | { |
129 | 124 | $user_data = db_user_by_id($fleet['fleet_owner']); |
130 | 125 | } |
@@ -136,8 +131,7 @@ discard block |
||
136 | 131 | * @param array $planetrow |
137 | 132 | * @param template $template |
138 | 133 | */ |
139 | -function int_planet_pretemplate($planetrow, &$template) |
|
140 | -{ |
|
134 | +function int_planet_pretemplate($planetrow, &$template) { |
|
141 | 135 | global $lang, $user; |
142 | 136 | |
143 | 137 | $governor_id = $planetrow['PLANET_GOVERNOR_ID']; |
@@ -161,8 +161,7 @@ discard block |
||
161 | 161 | return $rows_affected; |
162 | 162 | } |
163 | 163 | |
164 | -function rpg_level_up(&$user, $type, $xp_to_add = 0) |
|
165 | -{ |
|
164 | +function rpg_level_up(&$user, $type, $xp_to_add = 0) { |
|
166 | 165 | $q = 1.03; |
167 | 166 | |
168 | 167 | switch($type) |
@@ -223,27 +222,22 @@ discard block |
||
223 | 222 | } |
224 | 223 | } |
225 | 224 | |
226 | -function rpg_xp_for_level($level, $b1, $q) |
|
227 | -{ |
|
225 | +function rpg_xp_for_level($level, $b1, $q) { |
|
228 | 226 | return floor($b1 * (pow($q, $level) - 1)/($q - 1)); |
229 | 227 | } |
230 | 228 | |
231 | -function rpg_get_miner_xp($level) |
|
232 | -{ |
|
229 | +function rpg_get_miner_xp($level) { |
|
233 | 230 | return rpg_xp_for_level($level, 50, 1.03); |
234 | 231 | } |
235 | 232 | |
236 | -function RPG_get_raider_xp($level) |
|
237 | -{ |
|
233 | +function RPG_get_raider_xp($level) { |
|
238 | 234 | return rpg_xp_for_level($level, 10, 1.03); |
239 | 235 | } |
240 | 236 | |
241 | -function rpg_get_tech_xp($level) |
|
242 | -{ |
|
237 | +function rpg_get_tech_xp($level) { |
|
243 | 238 | return rpg_xp_for_level($level, 50, 1.03); |
244 | 239 | } |
245 | 240 | |
246 | -function rpg_get_explore_xp($level) |
|
247 | -{ |
|
241 | +function rpg_get_explore_xp($level) { |
|
248 | 242 | return rpg_xp_for_level($level, 10, 1.05); |
249 | 243 | } |
@@ -32,28 +32,28 @@ discard block |
||
32 | 32 | function rpg_points_change($user_id, $change_type, $dark_matter, $comment = false, $already_changed = false) { |
33 | 33 | global $debug, $config, $dm_change_legit, $user; |
34 | 34 | |
35 | - if(!$user_id) { |
|
35 | + if (!$user_id) { |
|
36 | 36 | return false; |
37 | 37 | } |
38 | 38 | |
39 | 39 | $dm_change_legit = true; |
40 | 40 | $sn_data_dark_matter_db_name = pname_resource_name(RES_DARK_MATTER); |
41 | 41 | |
42 | - if($already_changed) { |
|
42 | + if ($already_changed) { |
|
43 | 43 | $rows_affected = 1; |
44 | 44 | } else { |
45 | 45 | $changeset = array(); |
46 | 46 | $a_user = db_user_by_id($user_id, true); |
47 | - if($dark_matter < 0) { |
|
47 | + if ($dark_matter < 0) { |
|
48 | 48 | $dark_matter_exists = mrc_get_level($a_user, null, RES_DARK_MATTER, false, true); |
49 | 49 | $dark_matter_exists < 0 ? $dark_matter_exists = 0 : false; |
50 | 50 | $metamatter_to_reduce = -$dark_matter - $dark_matter_exists; |
51 | - if($metamatter_to_reduce > 0) { |
|
51 | + if ($metamatter_to_reduce > 0) { |
|
52 | 52 | $metamatter_exists = mrc_get_level($a_user, null, RES_METAMATTER); |
53 | - if($metamatter_exists < $metamatter_to_reduce) { |
|
53 | + if ($metamatter_exists < $metamatter_to_reduce) { |
|
54 | 54 | $debug->error('Ошибка снятия ТМ - ММ+ТМ меньше, чем сумма для снятия!', 'Ошибка снятия ТМ', LOG_ERR_INT_NOT_ENOUGH_DARK_MATTER); |
55 | 55 | } |
56 | - if(is_array($comment)) { |
|
56 | + if (is_array($comment)) { |
|
57 | 57 | $comment = call_user_func_array('sprintf', $comment); |
58 | 58 | } |
59 | 59 | // mm_points_change($user_id, $change_type, -$metamatter_to_reduce, 'ММ в ТМ: ' . (-$dark_matter) . ' ТМ = ' . $dark_matter_exists . ' ТМ + ' . $metamatter_to_reduce . ' ММ. ' . $comment); |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | $rows_affected = SN::$db->db_affected_rows(); |
69 | 69 | } |
70 | 70 | |
71 | - if($rows_affected || !$dark_matter) { |
|
71 | + if ($rows_affected || !$dark_matter) { |
|
72 | 72 | $page_url = SN::$db->db_escape($_SERVER['SCRIPT_NAME']); |
73 | - if(is_array($comment)) { |
|
73 | + if (is_array($comment)) { |
|
74 | 74 | $comment = call_user_func_array('sprintf', $comment); |
75 | 75 | } |
76 | 76 | $comment = SN::$db->db_escape($comment); |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | {$dark_matter}, '{$comment}', '{$page_url}', {$user_id} |
85 | 85 | );"); |
86 | 86 | |
87 | - if($user['id'] == $user_id) { |
|
87 | + if ($user['id'] == $user_id) { |
|
88 | 88 | $user['dark_matter'] += $dark_matter; |
89 | 89 | } |
90 | 90 | |
91 | - if($dark_matter > 0) { |
|
91 | + if ($dark_matter > 0) { |
|
92 | 92 | $old_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id} LIMIT 1 FOR UPDATE;", '', true); |
93 | - if($old_referral['id']) { |
|
93 | + if ($old_referral['id']) { |
|
94 | 94 | doquery("UPDATE {{referrals}} SET dark_matter = dark_matter + '{$dark_matter}' WHERE `id` = {$user_id} LIMIT 1;"); |
95 | 95 | $new_referral = doquery("SELECT * FROM {{referrals}} WHERE `id` = {$user_id} LIMIT 1;", '', true); |
96 | 96 | |
97 | 97 | $partner_bonus = floor($new_referral['dark_matter'] / $config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= $config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / $config->rpg_bonus_divisor) : 0); |
98 | - if($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) { |
|
98 | + if ($partner_bonus > 0 && $new_referral['dark_matter'] >= $config->rpg_bonus_minimum) { |
|
99 | 99 | rpg_points_change($new_referral['id_partner'], RPG_REFERRAL, $partner_bonus, "Incoming From Referral ID {$user_id}"); |
100 | 100 | } |
101 | 101 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | { |
113 | 113 | $q = 1.03; |
114 | 114 | |
115 | - switch($type) |
|
115 | + switch ($type) |
|
116 | 116 | { |
117 | 117 | case RPG_STRUCTURE: |
118 | 118 | $field_level = 'lvl_minier'; |
@@ -150,19 +150,19 @@ discard block |
||
150 | 150 | |
151 | 151 | $xp = &$user[$field_xp]; |
152 | 152 | |
153 | - if($xp_to_add) |
|
153 | + if ($xp_to_add) |
|
154 | 154 | { |
155 | 155 | $xp += $xp_to_add; |
156 | 156 | db_user_set_by_id($user['id'], "`{$field_xp}` = `{$field_xp}` + '{$xp_to_add}'"); |
157 | 157 | } |
158 | 158 | |
159 | 159 | $level = $user[$field_level]; |
160 | - while($xp > rpg_xp_for_level($level + 1, $b1, $q)) |
|
160 | + while ($xp > rpg_xp_for_level($level + 1, $b1, $q)) |
|
161 | 161 | { |
162 | 162 | $level++; |
163 | 163 | } |
164 | 164 | $level -= $user[$field_level]; |
165 | - if($level > 0) |
|
165 | + if ($level > 0) |
|
166 | 166 | { |
167 | 167 | db_user_set_by_id($user['id'], "`{$field_level}` = `{$field_level}` + '{$level}'"); |
168 | 168 | rpg_points_change($user['id'], $type, $level * 1000, $comment); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | function rpg_xp_for_level($level, $b1, $q) |
174 | 174 | { |
175 | - return floor($b1 * (pow($q, $level) - 1)/($q - 1)); |
|
175 | + return floor($b1 * (pow($q, $level) - 1) / ($q - 1)); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | function rpg_get_miner_xp($level) |
@@ -458,8 +458,7 @@ |
||
458 | 458 | |
459 | 459 | if(is_numeric($planet['id'])) { |
460 | 460 | DBStaticPlanet::db_planet_set_by_id($planet['id'], "`que_processed` = UNIX_TIMESTAMP(NOW())"); |
461 | - } |
|
462 | - elseif(is_numeric($user['id'])) { |
|
461 | + } elseif(is_numeric($user['id'])) { |
|
463 | 462 | db_user_set_by_id($user['id'], '`que_processed` = UNIX_TIMESTAMP(NOW())'); |
464 | 463 | } |
465 | 464 |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | |
8 | 8 | function que_get_unit_que($unit_id) { |
9 | 9 | $que_type = false; |
10 | - foreach(sn_get_groups('ques') as $que_id => $que_data) { |
|
11 | - if(in_array($unit_id, $que_data['unit_list'])) { |
|
10 | + foreach (sn_get_groups('ques') as $que_id => $que_data) { |
|
11 | + if (in_array($unit_id, $que_data['unit_list'])) { |
|
12 | 12 | $que_type = $que_id; |
13 | 13 | break; |
14 | 14 | } |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | function que_get_max_que_length($user, $planet, $que_id, $que_data = null) { |
22 | 22 | global $config; |
23 | 23 | |
24 | - if(empty($que_data)) { |
|
24 | + if (empty($que_data)) { |
|
25 | 25 | $que_data = sn_get_groups('ques'); |
26 | 26 | $que_data = $que_data[$que_id]; |
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | $que_length = 1; |
31 | - switch($que_id) { |
|
31 | + switch ($que_id) { |
|
32 | 32 | case QUE_RESEARCH: |
33 | 33 | $que_length = $config->server_que_length_research + mrc_get_level($user, '', UNIT_PREMIUM); // TODO - вынести в модуль |
34 | 34 | break; |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | function eco_que_str2arr($que_str) { |
44 | 44 | $que_arr = explode(';', $que_str); |
45 | - foreach($que_arr as $que_index => &$que_item) { |
|
46 | - if($que_item) { |
|
45 | + foreach ($que_arr as $que_index => &$que_item) { |
|
46 | + if ($que_item) { |
|
47 | 47 | $que_item = explode(',', $que_item); |
48 | 48 | } else { |
49 | 49 | unset($que_arr[$que_index]); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | function eco_que_arr2str($que_arr) { |
56 | - foreach($que_arr as &$que_item) { |
|
56 | + foreach ($que_arr as &$que_item) { |
|
57 | 57 | $que_item = implode(',', $que_item); |
58 | 58 | } |
59 | 59 | return implode(';', $que_arr); |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | global $lang, $config; |
65 | 65 | |
66 | 66 | $is_autoconvert = false; |
67 | - if($build_mode == BUILD_AUTOCONVERT || sys_get_param_int('auto_convert')) { |
|
67 | + if ($build_mode == BUILD_AUTOCONVERT || sys_get_param_int('auto_convert')) { |
|
68 | 68 | $build_mode = BUILD_CREATE; |
69 | 69 | $is_autoconvert = true; |
70 | 70 | } |
71 | 71 | |
72 | 72 | $unit_amount_qued = 0; |
73 | 73 | try { |
74 | - if(!$user['id']) { |
|
74 | + if (!$user['id']) { |
|
75 | 75 | throw new exception('{Нет идентификатора пользователя - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
76 | 76 | } |
77 | 77 | |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | foreach($unit_list as $unit_id => $unit_amount) if($unit_amount) break; |
83 | 83 | } |
84 | 84 | */ |
85 | - if(!$unit_id) { |
|
85 | + if (!$unit_id) { |
|
86 | 86 | throw new exception('{Нет идентификатора юнита - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
87 | 87 | } |
88 | 88 | |
89 | 89 | $que_id = que_get_unit_que($unit_id); |
90 | - if(!$que_id) { |
|
90 | + if (!$que_id) { |
|
91 | 91 | throw new exception('{Неправильный тип очереди - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
92 | 92 | } |
93 | 93 | |
94 | - if($build_mode == BUILD_DESTROY && $que_id != QUE_STRUCTURES) { |
|
94 | + if ($build_mode == BUILD_DESTROY && $que_id != QUE_STRUCTURES) { |
|
95 | 95 | throw new exception('{Уничтожать можно только здания на планете}', ERR_ERROR); // TODO EXCEPTION |
96 | 96 | } |
97 | 97 | |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | $que_data = $que_data[$que_id]; |
100 | 100 | |
101 | 101 | // TODO Переделать под подочереди |
102 | - if($que_id == QUE_STRUCTURES) { |
|
102 | + if ($que_id == QUE_STRUCTURES) { |
|
103 | 103 | $sn_groups_build_allow = sn_get_groups('build_allow'); |
104 | 104 | $que_data['unit_list'] = $sn_groups_build_allow[$planet['planet_type']]; |
105 | 105 | |
106 | - if(!isset($que_data['unit_list'][$unit_id])) { |
|
106 | + if (!isset($que_data['unit_list'][$unit_id])) { |
|
107 | 107 | throw new exception('{Это здание нельзя строить на ' . ($planet['planet_type'] == PT_PLANET ? 'планете' : 'луне'), ERR_ERROR); // TODO EXCEPTION |
108 | 108 | } |
109 | 109 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | // Это нужно, что бы заблокировать пользователя и работу с очередями |
125 | 125 | $user = db_user_by_id($user['id']); |
126 | 126 | // Это нужно, что бы заблокировать планету от списания ресурсов |
127 | - if(isset($planet['id']) && $planet['id']) { |
|
127 | + if (isset($planet['id']) && $planet['id']) { |
|
128 | 128 | $planet = DBStaticPlanet::db_planet_by_id($planet['id'], true); |
129 | 129 | } else { |
130 | 130 | $planet['id'] = 0; |
@@ -136,17 +136,17 @@ discard block |
||
136 | 136 | $in_que = &$que['in_que'][$que_id][$user['id']][$planet_id]; |
137 | 137 | $que_max_length = que_get_max_que_length($user, $planet, $que_id, $que_data); |
138 | 138 | // TODO Добавить вызовы функций проверок текущей и максимальной длин очередей |
139 | - if(count($in_que) >= $que_max_length) { |
|
139 | + if (count($in_que) >= $que_max_length) { |
|
140 | 140 | throw new exception('{Все слоты очереди заняты}', ERR_ERROR); // TODO EXCEPTION |
141 | 141 | } |
142 | 142 | |
143 | 143 | // TODO Отдельно посмотреть на уничтожение зданий - что бы можно было уничтожать их без планов |
144 | - switch(eco_can_build_unit($user, $planet, $unit_id)) { |
|
144 | + switch (eco_can_build_unit($user, $planet, $unit_id)) { |
|
145 | 145 | case BUILD_ALLOWED: break; |
146 | 146 | case BUILD_UNIT_BUSY: throw new exception('{Строение занято}', ERR_ERROR); break; // TODO EXCEPTION eco_bld_msg_err_laboratory_upgrading |
147 | 147 | // case BUILD_REQUIRE_NOT_MEET: |
148 | 148 | default: |
149 | - if($build_mode == BUILD_CREATE) { |
|
149 | + if ($build_mode == BUILD_CREATE) { |
|
150 | 150 | throw new exception('{Требования не удовлетворены}', ERR_ERROR); |
151 | 151 | } |
152 | 152 | break; // TODO EXCEPTION eco_bld_msg_err_requirements_not_meet |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | $unit_amount_qued = $unit_amount; |
157 | 157 | $units_qued = isset($in_que[$unit_id]) ? $in_que[$unit_id] : 0; |
158 | 158 | $unit_level = mrc_get_level($user, $planet, $unit_id, true, true) + $units_qued; |
159 | - if($unit_max = get_unit_param($unit_id, P_MAX_STACK)) { |
|
160 | - if($unit_level >= $unit_max) { |
|
159 | + if ($unit_max = get_unit_param($unit_id, P_MAX_STACK)) { |
|
160 | + if ($unit_level >= $unit_max) { |
|
161 | 161 | throw new exception('{Максимальное количество юнитов данного типа уже достигнуто или будет достигнуто по окончанию очереди}', ERR_ERROR); // TODO EXCEPTION |
162 | 162 | } |
163 | 163 | $unit_amount = max(0, min($unit_amount, $unit_max - $unit_level)); |
164 | 164 | } |
165 | 165 | |
166 | - if($unit_amount < 1) { |
|
166 | + if ($unit_amount < 1) { |
|
167 | 167 | throw new exception('{Неправильное количество юнитов - сообщите Администрации}', ERR_ERROR); // TODO EXCEPTION |
168 | 168 | } |
169 | 169 | |
@@ -179,21 +179,21 @@ discard block |
||
179 | 179 | // { |
180 | 180 | // die('Unit busy'); // TODO EXCEPTION |
181 | 181 | // } |
182 | - if(get_unit_param($unit_id, P_STACKABLE)) { |
|
182 | + if (get_unit_param($unit_id, P_STACKABLE)) { |
|
183 | 183 | // TODO Поле 'max_Lot_size' для ограничения размера стэка в очереди - то ли в юниты, то ли в очередь |
184 | - if(in_array($unit_id, $group_missile = sn_get_groups('missile'))) { |
|
184 | + if (in_array($unit_id, $group_missile = sn_get_groups('missile'))) { |
|
185 | 185 | // TODO Поле 'container' - указывает на родительску структуру, в которой хранится данный юнит и по вместительности которой нужно применять размер юнита |
186 | 186 | $used_silo = 0; |
187 | - foreach($group_missile as $missile_id) { |
|
187 | + foreach ($group_missile as $missile_id) { |
|
188 | 188 | $missile_qued = isset($in_que[$missile_id]) ? $in_que[$missile_id] : 0; |
189 | 189 | $used_silo += (mrc_get_level($user, $planet, $missile_id, true, true) + $missile_qued) * get_unit_param($missile_id, P_UNIT_SIZE); |
190 | 190 | } |
191 | 191 | $free_silo = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY) - $used_silo; |
192 | - if($free_silo <= 0) { |
|
192 | + if ($free_silo <= 0) { |
|
193 | 193 | throw new exception('{Ракетная шахта уже заполнена или будет заполнена по окончанию очереди}', ERR_ERROR); // TODO EXCEPTION |
194 | 194 | } |
195 | 195 | $unit_size = get_unit_param($unit_id, P_UNIT_SIZE); |
196 | - if($free_silo < $unit_size) { |
|
196 | + if ($free_silo < $unit_size) { |
|
197 | 197 | throw new exception("{В ракетной шахте нет места для {$lang['tech'][$unit_id]}}", ERR_ERROR); // TODO EXCEPTION |
198 | 198 | } |
199 | 199 | $unit_amount = max(0, min($unit_amount, floor($free_silo / $unit_size))); |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | $unit_level = $new_unit_level = 0; |
202 | 202 | } else { |
203 | 203 | $unit_amount = 1; |
204 | - if($que_id == QUE_STRUCTURES) { |
|
204 | + if ($que_id == QUE_STRUCTURES) { |
|
205 | 205 | // if($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $que['sectors'][$planet['id']] <= 0) |
206 | 206 | $sectors_qued = is_array($in_que) ? array_sum($in_que) : 0; |
207 | - if($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $sectors_qued <= 0) |
|
207 | + if ($build_mode == BUILD_CREATE && eco_planet_fields_max($planet) - $planet['field_current'] - $sectors_qued <= 0) |
|
208 | 208 | { |
209 | 209 | throw new exception('{Не хватает секторов на планете}', ERR_ERROR); // TODO EXCEPTION |
210 | 210 | } |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | |
223 | 223 | $exchange = array(); |
224 | 224 | $market_get_autoconvert_cost = market_get_autoconvert_cost(); |
225 | - if($is_autoconvert && $build_data[BUILD_AUTOCONVERT]) { |
|
225 | + if ($is_autoconvert && $build_data[BUILD_AUTOCONVERT]) { |
|
226 | 226 | $dark_matter = mrc_get_level($user, null, RES_DARK_MATTER); |
227 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $market_get_autoconvert_cost) { |
|
227 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $market_get_autoconvert_cost) { |
|
228 | 228 | throw new exception("{Нет хватает " . ($market_get_autoconvert_cost - $dark_matter) . "ТМ на постройки с автоконвертацией ресурсов}", ERR_ERROR); // TODO EXCEPTION |
229 | 229 | } |
230 | 230 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $resource_exchange_rates = array(); |
235 | 235 | $resource_diff = array(); |
236 | 236 | $all_positive = true; |
237 | - foreach($resources_loot as $resource_id) { |
|
237 | + foreach ($resources_loot as $resource_id) { |
|
238 | 238 | $resource_db_name = pname_resource_name($resource_id); |
239 | 239 | $resource_got[$resource_id] = floor(mrc_get_level($user, $planet, $resource_id)); |
240 | 240 | $resource_exchange_rates[$resource_id] = $config->__get("rpg_exchange_{$resource_db_name}"); |
@@ -242,15 +242,15 @@ discard block |
||
242 | 242 | $all_positive = $all_positive && ($resource_diff[$resource_id] > 0); |
243 | 243 | } |
244 | 244 | // Нужна автоконвертация |
245 | - if($all_positive) { |
|
245 | + if ($all_positive) { |
|
246 | 246 | $is_autoconvert = false; |
247 | 247 | } else { |
248 | - foreach($resource_diff as $resource_diff_id => &$resource_diff_amount) { |
|
249 | - if($resource_diff_amount >= 0) { |
|
248 | + foreach ($resource_diff as $resource_diff_id => &$resource_diff_amount) { |
|
249 | + if ($resource_diff_amount >= 0) { |
|
250 | 250 | continue; |
251 | 251 | } |
252 | - foreach($resource_diff as $resource_got_id => &$resource_got_amount) { |
|
253 | - if($resource_got_amount <= 0) { |
|
252 | + foreach ($resource_diff as $resource_got_id => &$resource_got_amount) { |
|
253 | + if ($resource_got_amount <= 0) { |
|
254 | 254 | continue; |
255 | 255 | } |
256 | 256 | $current_exchange = $resource_exchange_rates[$resource_got_id] / $resource_exchange_rates[$resource_diff_id]; |
@@ -266,14 +266,14 @@ discard block |
||
266 | 266 | } |
267 | 267 | |
268 | 268 | $is_autoconvert_ok = true; |
269 | - foreach($resource_diff as $resource_diff_amount2) { |
|
270 | - if($resource_diff_amount2 < 0) { |
|
269 | + foreach ($resource_diff as $resource_diff_amount2) { |
|
270 | + if ($resource_diff_amount2 < 0) { |
|
271 | 271 | $is_autoconvert_ok = false; |
272 | 272 | break; |
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
276 | - if($is_autoconvert_ok) { |
|
276 | + if ($is_autoconvert_ok) { |
|
277 | 277 | $build_data['RESULT'][$build_mode] = BUILD_ALLOWED; |
278 | 278 | $build_data['CAN'][$build_mode] = $unit_amount; |
279 | 279 | } else { |
@@ -282,19 +282,19 @@ discard block |
||
282 | 282 | } |
283 | 283 | } |
284 | 284 | $unit_amount = min($build_data['CAN'][$build_mode], $unit_amount); |
285 | - if($unit_amount <= 0) { |
|
285 | + if ($unit_amount <= 0) { |
|
286 | 286 | throw new exception('{Не хватает ресурсов}', ERR_ERROR); // TODO EXCEPTION |
287 | 287 | } |
288 | 288 | |
289 | - if($new_unit_level < 0) { |
|
289 | + if ($new_unit_level < 0) { |
|
290 | 290 | throw new exception('{Нельзя уничтожить больше юнитов, чем есть}', ERR_ERROR); // TODO EXCEPTION |
291 | 291 | } |
292 | 292 | |
293 | - if($build_data['RESULT'][$build_mode] != BUILD_ALLOWED) { |
|
293 | + if ($build_data['RESULT'][$build_mode] != BUILD_ALLOWED) { |
|
294 | 294 | throw new exception('{Строительство блокировано}', ERR_ERROR); // TODO EXCEPTION |
295 | 295 | } |
296 | 296 | |
297 | - if($is_autoconvert) { |
|
297 | + if ($is_autoconvert) { |
|
298 | 298 | ksort($exchange); |
299 | 299 | ksort($resource_got); |
300 | 300 | db_change_units($user, $planet, array( |
@@ -309,13 +309,13 @@ discard block |
||
309 | 309 | } |
310 | 310 | |
311 | 311 | $unit_amount_qued = 0; |
312 | - while($unit_amount > 0 && count($que['ques'][$que_id][$user['id']][$planet_id]) < $que_max_length) { |
|
312 | + while ($unit_amount > 0 && count($que['ques'][$que_id][$user['id']][$planet_id]) < $que_max_length) { |
|
313 | 313 | $place = min($unit_amount, MAX_FLEET_OR_DEFS_PER_ROW); |
314 | 314 | // $sqlBlock = QueUnitStatic::que_unit_make_sql($unit_id, $user, $planet, $build_data, $new_unit_level, $place, $build_mode); |
315 | 315 | $sqlBlock = SN::$gc->pimp->que_unit_make_sql($unit_id, $user, $planet, $build_data, $new_unit_level, $place, $build_mode); |
316 | 316 | |
317 | - array_walk($sqlBlock, function (&$value, $field) { |
|
318 | - if($value === null) { |
|
317 | + array_walk($sqlBlock, function(&$value, $field) { |
|
318 | + if ($value === null) { |
|
319 | 319 | $value = 'NULL'; |
320 | 320 | } elseif (is_string($value)) { |
321 | 321 | $value = "'{$value}'"; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | SN::db_transaction_commit(); |
348 | 348 | |
349 | - if($redirect) { |
|
349 | + if ($redirect) { |
|
350 | 350 | sys_redirect("{$_SERVER['PHP_SELF']}?mode=" . sys_get_param_str('mode') . "&ally_id=" . sys_get_param_id('ally_id')); |
351 | 351 | } |
352 | 352 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | 'STATUS' => ERR_NONE, |
355 | 355 | 'MESSAGE' => '{Строительство начато}', |
356 | 356 | ); |
357 | - } catch(exception $e) { |
|
357 | + } catch (exception $e) { |
|
358 | 358 | SN::db_transaction_rollback(); |
359 | 359 | $operation_result = array( |
360 | 360 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | ); |
363 | 363 | } |
364 | 364 | |
365 | - if(!empty($operation_result['MESSAGE'])) { |
|
365 | + if (!empty($operation_result['MESSAGE'])) { |
|
366 | 366 | $operation_result['MESSAGE'] .= ' ' . ($unit_amount_qued ? $unit_amount_qued : $unit_amount) . 'x[' . $lang['tech'][$unit_id] . ']'; |
367 | 367 | } |
368 | 368 | |
@@ -376,11 +376,11 @@ discard block |
||
376 | 376 | function que_recalculate($old_que) { |
377 | 377 | $new_que = array(); |
378 | 378 | |
379 | - if(!is_array($old_que['items'])) { |
|
379 | + if (!is_array($old_que['items'])) { |
|
380 | 380 | return $new_que; |
381 | 381 | } |
382 | - foreach($old_que['items'] as $row) { |
|
383 | - if(!isset($row) || !$row || $row['que_unit_amount'] <= 0) { |
|
382 | + foreach ($old_que['items'] as $row) { |
|
383 | + if (!isset($row) || !$row || $row['que_unit_amount'] <= 0) { |
|
384 | 384 | continue; |
385 | 385 | } |
386 | 386 | |
@@ -391,9 +391,9 @@ discard block |
||
391 | 391 | |
392 | 392 | $last_id = count($new_que['items']) - 1; |
393 | 393 | |
394 | - if($row['que_planet_id']) { |
|
394 | + if ($row['que_planet_id']) { |
|
395 | 395 | $new_que['planets'][$row['que_planet_id']][$row['que_type']][] = &$new_que['items'][$last_id]; |
396 | - } elseif($row['que_type'] == QUE_RESEARCH) { |
|
396 | + } elseif ($row['que_type'] == QUE_RESEARCH) { |
|
397 | 397 | $new_que['players'][$row['que_player_id']][$row['que_type']][] = &$new_que['items'][$last_id]; |
398 | 398 | } |
399 | 399 | $new_que['ques'][$row['que_type']][$row['que_player_id']][intval($row['que_planet_id'])][] = &$new_que['items'][$last_id]; |
@@ -418,17 +418,17 @@ discard block |
||
418 | 418 | $planet['id'] = $planet['id'] && $que_type !== QUE_RESEARCH ? $planet['id'] : 0; |
419 | 419 | $global_que = que_get($user['id'], $planet['id'], $que_type, true); |
420 | 420 | |
421 | - if(!empty($global_que['ques'][$que_type][$user['id']][$planet['id']])) { |
|
421 | + if (!empty($global_que['ques'][$que_type][$user['id']][$planet['id']])) { |
|
422 | 422 | $que = array_reverse($global_que['ques'][$que_type][$user['id']][$planet['id']]); |
423 | 423 | |
424 | - foreach($que as $que_item) { |
|
424 | + foreach ($que as $que_item) { |
|
425 | 425 | DBStaticQue::db_que_delete_by_id($que_item['que_id']); |
426 | 426 | |
427 | - if($que_item['que_planet_id_origin']) { |
|
427 | + if ($que_item['que_planet_id_origin']) { |
|
428 | 428 | $planet['id'] = $que_item['que_planet_id_origin']; |
429 | 429 | } |
430 | 430 | |
431 | - if(!isset($planets_locked[$planet['id']])) { |
|
431 | + if (!isset($planets_locked[$planet['id']])) { |
|
432 | 432 | $planets_locked[$planet['id']] = $planet['id'] ? DBStaticPlanet::db_planet_by_id($planet['id'], true) : $planet; |
433 | 433 | } |
434 | 434 | |
@@ -440,15 +440,15 @@ discard block |
||
440 | 440 | RES_DEUTERIUM => $build_data[RES_DEUTERIUM] * $que_item['que_unit_amount'], |
441 | 441 | )); |
442 | 442 | |
443 | - if(!$clear) { |
|
443 | + if (!$clear) { |
|
444 | 444 | break; |
445 | 445 | } |
446 | 446 | } |
447 | 447 | |
448 | - if(is_numeric($planet['id'])) { |
|
448 | + if (is_numeric($planet['id'])) { |
|
449 | 449 | DBStaticPlanet::db_planet_set_by_id($planet['id'], "`que_processed` = UNIX_TIMESTAMP(NOW())"); |
450 | 450 | } |
451 | - elseif(is_numeric($user['id'])) { |
|
451 | + elseif (is_numeric($user['id'])) { |
|
452 | 452 | db_user_set_by_id($user['id'], '`que_processed` = UNIX_TIMESTAMP(NOW())'); |
453 | 453 | } |
454 | 454 | |
@@ -493,21 +493,21 @@ discard block |
||
493 | 493 | // TODO: Переделать для $que_type === false |
494 | 494 | $planet['id'] = $planet['id'] ? $planet['id'] : 0; |
495 | 495 | |
496 | - if(!is_array($que)) { |
|
496 | + if (!is_array($que)) { |
|
497 | 497 | $que = que_get($user['id'], $planet['id'], $que_type); |
498 | 498 | } |
499 | 499 | |
500 | - if(is_array($que) && isset($que['items'])) { |
|
500 | + if (is_array($que) && isset($que['items'])) { |
|
501 | 501 | $que = $que['ques'][$que_type][$user['id']][$planet['id']]; |
502 | 502 | } |
503 | 503 | |
504 | - if($que) { |
|
505 | - foreach($que as $que_element) { |
|
504 | + if ($que) { |
|
505 | + foreach ($que as $que_element) { |
|
506 | 506 | $template->assign_block_vars('que', que_tpl_parse_element($que_element, $short_names)); |
507 | 507 | } |
508 | 508 | } |
509 | 509 | |
510 | - if($que_type == QUE_RESEARCH) { |
|
510 | + if ($que_type == QUE_RESEARCH) { |
|
511 | 511 | // TODO Исправить |
512 | 512 | // $template->assign_var('RESEARCH_ONGOING', count($global_que[QUE_RESEARCH][0]) >= $config->server_que_length_research); |
513 | 513 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $user = db_user_by_id($user['id'], true); |
536 | 536 | |
537 | 537 | $time_left[$user['id']][0] = max(0, $on_time - $user['que_processed']); |
538 | - if($planet === null && !$time_left[$user['id']][0]) { |
|
538 | + if ($planet === null && !$time_left[$user['id']][0]) { |
|
539 | 539 | // TODO |
540 | 540 | return $que; |
541 | 541 | } |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | $que_type_id = $planet === null ? QUE_RESEARCH : false; |
545 | 545 | $planet = intval(is_array($planet) ? $planet['id'] : $planet); // В $planet у нас теперь только её ID или шаблон null/0/false |
546 | 546 | $que = que_get($user['id'], $planet, $que_type_id, true); |
547 | - if(empty($que['items'])) { |
|
547 | + if (empty($que['items'])) { |
|
548 | 548 | return $que; |
549 | 549 | } |
550 | 550 | |
551 | 551 | $planet_list = array(); |
552 | - if($planet !== null) { |
|
552 | + if ($planet !== null) { |
|
553 | 553 | // Если нужно изменять данные на планетах - блокируем планеты и получаем данные о них |
554 | 554 | // TODO - от них не надо ничего, кроме ID и que_processed |
555 | 555 | $planet_row = DBStaticPlanet::db_planet_list_by_user_or_planet($user['id'], $planet); |
@@ -558,21 +558,21 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | // Теперь в $time_left лежит время обсчета всех очередей по каждой из планеты |
561 | - if(array_sum($time_left[$user['id']]) == 0) { |
|
561 | + if (array_sum($time_left[$user['id']]) == 0) { |
|
562 | 562 | return $que; |
563 | 563 | } |
564 | 564 | |
565 | 565 | $db_changeset = array(); |
566 | 566 | $unit_changes = array(); |
567 | - foreach($que['items'] as &$que_item) { |
|
567 | + foreach ($que['items'] as &$que_item) { |
|
568 | 568 | $que_player_id = &$que_item['que_player_id']; |
569 | 569 | $que_planet_id = intval($que_item['que_planet_id']); |
570 | 570 | |
571 | 571 | $que_time_left = &$que['time_left'][$que_player_id][$que_planet_id][$que_item['que_type']]; |
572 | - if(!isset($que_time_left)) { |
|
572 | + if (!isset($que_time_left)) { |
|
573 | 573 | $que_time_left = $time_left[$que_player_id][$que_planet_id]; |
574 | 574 | } |
575 | - if($que_time_left <= 0 || $que_item['que_unit_amount'] <= 0) { |
|
575 | + if ($que_time_left <= 0 || $que_item['que_unit_amount'] <= 0) { |
|
576 | 576 | continue; |
577 | 577 | } |
578 | 578 | // Дальше мы идем, если только осталось время в очереди И юниты к постройке |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | // Теперь работаем с остатком времени на юните. Оно не может быть равно или меньше нуля |
586 | 586 | |
587 | 587 | // Если времени в очереди осталось не меньше, чем время текущего юнита - значит мы достроили юнит |
588 | - if($que_time_left >= $que_item['que_time_left']) { |
|
588 | + if ($que_time_left >= $que_item['que_time_left']) { |
|
589 | 589 | // Увеличиваем количество отстроенных юнитов |
590 | 590 | $unit_processed++; |
591 | 591 | // Вычитаем из времени очереди потраченное на постройку время |
@@ -598,12 +598,12 @@ discard block |
||
598 | 598 | $que_item['que_unit_amount'] -= $unit_processed; |
599 | 599 | |
600 | 600 | // Если еще остались юниты - значит ВСЁ оставшееся время приходится на достройку следующего юнита |
601 | - if($que_item['que_unit_amount'] > 0) { |
|
601 | + if ($que_item['que_unit_amount'] > 0) { |
|
602 | 602 | $que_item['que_time_left'] = $que_item['que_time_left'] - $que_time_left; |
603 | 603 | $que_time_left = 0; |
604 | 604 | } |
605 | 605 | |
606 | - if($que_item['que_unit_amount'] <= 0) { |
|
606 | + if ($que_item['que_unit_amount'] <= 0) { |
|
607 | 607 | $db_changeset['que'][] = array( |
608 | 608 | 'action' => SQL_OP_DELETE, |
609 | 609 | P_VERSION => 1, |
@@ -629,14 +629,14 @@ discard block |
||
629 | 629 | ); |
630 | 630 | } |
631 | 631 | |
632 | - if($unit_processed) { |
|
632 | + if ($unit_processed) { |
|
633 | 633 | $unit_processed_delta = $unit_processed * ($que_item['que_unit_mode'] == BUILD_CREATE ? 1 : -1); |
634 | 634 | $unit_changes[$que_player_id][$que_planet_id][$que_item['que_unit_id']] += $unit_processed_delta; |
635 | 635 | } |
636 | 636 | } |
637 | 637 | |
638 | - foreach($time_left as $player_id => $planet_data) { |
|
639 | - foreach($planet_data as $planet_id => $time_on_planet) { |
|
638 | + foreach ($time_left as $player_id => $planet_data) { |
|
639 | + foreach ($planet_data as $planet_id => $time_on_planet) { |
|
640 | 640 | $table = $planet_id ? 'planets' : 'users'; |
641 | 641 | $id = $planet_id ? $planet_id : $player_id; |
642 | 642 | $db_changeset[$table][] = array( |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | ), |
653 | 653 | ); |
654 | 654 | |
655 | - if(is_array($unit_changes[$player_id][$planet_id])) { |
|
656 | - foreach($unit_changes[$player_id][$planet_id] as $unit_id => $unit_amount) { |
|
655 | + if (is_array($unit_changes[$player_id][$planet_id])) { |
|
656 | + foreach ($unit_changes[$player_id][$planet_id] as $unit_id => $unit_amount) { |
|
657 | 657 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_amount, $user, $planet_id ? $planet_id : null); |
658 | 658 | } |
659 | 659 | } |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | $que = que_recalculate($que); |
664 | 664 | |
665 | 665 | // TODO: Re-enable quests for Alliances |
666 | - if(!empty($unit_changes) && !$user['user_as_ally']) { |
|
666 | + if (!empty($unit_changes) && !$user['user_as_ally']) { |
|
667 | 667 | $quest_list = qst_get_quests($user['id'], QUEST_STATUS_ALL); |
668 | 668 | $quest_triggers = qst_active_triggers($quest_list); |
669 | 669 | $quest_rewards = array(); |
@@ -671,26 +671,26 @@ discard block |
||
671 | 671 | |
672 | 672 | |
673 | 673 | $xp_incoming = array(); |
674 | - foreach($unit_changes as $user_id => $planet_changes) { |
|
675 | - foreach($planet_changes as $planet_id => $changes) { |
|
674 | + foreach ($unit_changes as $user_id => $planet_changes) { |
|
675 | + foreach ($planet_changes as $planet_id => $changes) { |
|
676 | 676 | $planet_this = $planet_id ? SN::db_get_record_by_id(LOC_PLANET, $planet_id) : array(); |
677 | - foreach($changes as $unit_id => $unit_value) { |
|
677 | + foreach ($changes as $unit_id => $unit_value) { |
|
678 | 678 | $que_id = que_get_unit_que($unit_id); |
679 | 679 | $unit_level_new = mrc_get_level($user, $planet_this, $unit_id, false, true) + $unit_value; |
680 | - if($que_id == QUE_STRUCTURES || $que_id == QUE_RESEARCH) { |
|
680 | + if ($que_id == QUE_STRUCTURES || $que_id == QUE_RESEARCH) { |
|
681 | 681 | $build_data = eco_get_build_data($user, $planet_this, $unit_id, $unit_level_new - 1); |
682 | 682 | $build_data = $build_data[BUILD_CREATE]; |
683 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
683 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
684 | 684 | $xp_incoming[$que_id] += $build_data[$resource_id]; // TODO - добавить конверсию рейтов обмена |
685 | 685 | } |
686 | 686 | } |
687 | 687 | |
688 | - if(is_array($quest_triggers)) { |
|
688 | + if (is_array($quest_triggers)) { |
|
689 | 689 | // TODO: Check mutiply condition quests |
690 | 690 | $quest_trigger_list = array_keys($quest_triggers, $unit_id); |
691 | 691 | |
692 | - if(is_array($quest_trigger_list)) { |
|
693 | - foreach($quest_trigger_list as $quest_id) { |
|
692 | + if (is_array($quest_trigger_list)) { |
|
693 | + foreach ($quest_trigger_list as $quest_id) { |
|
694 | 694 | if ($quest_list[$quest_id]['quest_status_status'] != QUEST_STATUS_COMPLETE) { |
695 | 695 | if ($quest_list[$quest_id]['quest_unit_amount'] <= $unit_level_new) { |
696 | 696 | $quest_rewards[$quest_id][$user_id][$planet_id] = $quest_list[$quest_id]['quest_rewards_list']; |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | // TODO: Изменить начисление награды за квесты на ту планету, на которой происходил ресеч |
709 | 709 | qst_reward($user, $quest_rewards, $quest_list, $quest_statuses); |
710 | 710 | |
711 | - foreach($xp_incoming as $que_id => $xp) { |
|
711 | + foreach ($xp_incoming as $que_id => $xp) { |
|
712 | 712 | rpg_level_up($user, $que_id == QUE_RESEARCH ? RPG_TECH : RPG_STRUCTURE, $xp / 1000); |
713 | 713 | } |
714 | 714 | } |
@@ -1,7 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function sys_maintenance() |
|
4 | -{ |
|
3 | +function sys_maintenance() { |
|
5 | 4 | global $config; |
6 | 5 | |
7 | 6 | $bashing_time_limit = SN_TIME_NOW - $config->fleet_bashing_scope; |
@@ -42,8 +41,7 @@ discard block |
||
42 | 41 | * TODO: 2. [<m|w|d|h|m|s>@]<time> |
43 | 42 | */ |
44 | 43 | |
45 | -function sys_schedule_get_prev_run($scheduleList, $recorded_run = SN_TIME_NOW, $return_next_run = false) |
|
46 | -{ |
|
44 | +function sys_schedule_get_prev_run($scheduleList, $recorded_run = SN_TIME_NOW, $return_next_run = false) { |
|
47 | 45 | static $date_part_names_reverse = array('seconds', 'minutes', 'hours', 'days', 'months', 'years',); |
48 | 46 | |
49 | 47 | $possible_schedules = array(); |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | array('query' => "DELETE FROM `{{planets}}` WHERE `id_owner` = 0 AND `destruyed` < UNIX_TIMESTAMP();", 'result' => false, 'error' => '', 'affected_rows' => 0), |
18 | 18 | ); |
19 | 19 | |
20 | - foreach($queries as &$query) |
|
20 | + foreach ($queries as &$query) |
|
21 | 21 | { |
22 | 22 | $query['result'] = doquery($query['query']); |
23 | 23 | $query['error'] = SN::$db->db_error(); |
24 | - $query['affected_rows'] = SN::$db->db_affected_rows(); |
|
24 | + $query['affected_rows'] = SN::$db->db_affected_rows(); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | return $queries; |
@@ -53,30 +53,30 @@ discard block |
||
53 | 53 | $recorded_run = strtotime($recorded_run); |
54 | 54 | |
55 | 55 | $prev_run_array = getdate($recorded_run); |
56 | - $prev_run_array = array($prev_run_array['seconds'],$prev_run_array['minutes'],$prev_run_array['hours'],$prev_run_array['mday'],$prev_run_array['mon'],$prev_run_array['year']); |
|
56 | + $prev_run_array = array($prev_run_array['seconds'], $prev_run_array['minutes'], $prev_run_array['hours'], $prev_run_array['mday'], $prev_run_array['mon'], $prev_run_array['year']); |
|
57 | 57 | $today_array = getdate(SN_TIME_NOW); |
58 | - $today_array = array($today_array['seconds'],$today_array['minutes'],$today_array['hours'],$today_array['mday'],$today_array['mon'],$today_array['year']); |
|
58 | + $today_array = array($today_array['seconds'], $today_array['minutes'], $today_array['hours'], $today_array['mday'], $today_array['mon'], $today_array['year']); |
|
59 | 59 | $scheduleList = explode(',', $scheduleList); |
60 | 60 | array_walk($scheduleList, function(&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
61 | 61 | $schedule = array('schedule_array' => array_reverse(explode(':', trim($schedule)))); |
62 | 62 | |
63 | 63 | $interval = $date_part_names_reverse[count($schedule['schedule_array'])]; |
64 | 64 | |
65 | - foreach($prev_run_array as $index => $date_part) { |
|
65 | + foreach ($prev_run_array as $index => $date_part) { |
|
66 | 66 | $schedule['array']['recorded'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $date_part; |
67 | 67 | $schedule['array']['now'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $today_array[$index]; |
68 | 68 | } |
69 | - if($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
69 | + if ($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
70 | 70 | unset($schedule['array']['now']); |
71 | 71 | } |
72 | 72 | |
73 | - foreach($schedule['array'] as $name => $array) { |
|
73 | + foreach ($schedule['array'] as $name => $array) { |
|
74 | 74 | $schedule['string'][$name] = "{$array[5]}-{$array[4]}-{$array[3]} {$array[2]}:{$array[1]}:{$array[0]}"; |
75 | 75 | $schedule['string'][$name . '_next'] = $schedule['string'][$name] . ' +1 ' . $interval; |
76 | 76 | $schedule['string'][$name . '_prev'] = $schedule['string'][$name] . ' -1 ' . $interval; |
77 | 77 | } |
78 | 78 | |
79 | - foreach($schedule['string'] as $string) { |
|
79 | + foreach ($schedule['string'] as $string) { |
|
80 | 80 | $timestamp = strtotime($string); |
81 | 81 | $schedule['timestamp'][$timestamp] = $possible_schedules[$timestamp] = date(FMT_DATE_TIME_SQL, strtotime($string)); |
82 | 82 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $prev_run = 0; |
88 | 88 | $next_run = 0; |
89 | - foreach($possible_schedules as $timestamp => $string_date) { |
|
89 | + foreach ($possible_schedules as $timestamp => $string_date) { |
|
90 | 90 | $prev_run = SN_TIME_NOW >= $timestamp ? $timestamp : $prev_run; |
91 | 91 | $next_run = SN_TIME_NOW < $timestamp && !$next_run ? $timestamp : $next_run; |
92 | 92 | } |
@@ -1,14 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // ---------------------------------------------------------------------------------------------------------------- |
4 | -function lng_try_filepath($path, $file_path_relative) |
|
5 | -{ |
|
4 | +function lng_try_filepath($path, $file_path_relative) { |
|
6 | 5 | $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative; |
7 | 6 | return file_exists($file_path) ? $file_path : false; |
8 | 7 | } |
9 | 8 | |
10 | -function lng_die_not_an_object() |
|
11 | -{ |
|
9 | +function lng_die_not_an_object() { |
|
12 | 10 | print('Ошибка - $lang не объект! Сообщите Администратору сервера и приложите содержимое страницы'); |
13 | 11 | $trace = debug_backtrace(); |
14 | 12 | unset($trace[0]); |
@@ -17,32 +15,27 @@ discard block |
||
17 | 15 | } |
18 | 16 | |
19 | 17 | // ---------------------------------------------------------------------------------------------------------------- |
20 | -function lng_include($filename, $path = '', $ext = '.mo.php') |
|
21 | -{ |
|
18 | +function lng_include($filename, $path = '', $ext = '.mo.php') { |
|
22 | 19 | global $lang; |
23 | 20 | return is_object($lang) ? $lang->lng_include($filename, $path, $ext) : lng_die_not_an_object(); |
24 | 21 | } |
25 | 22 | |
26 | -function lng_get_list() |
|
27 | -{ |
|
23 | +function lng_get_list() { |
|
28 | 24 | global $lang; |
29 | 25 | return is_object($lang) ? $lang->lng_get_list() : lng_die_not_an_object(); |
30 | 26 | } |
31 | 27 | |
32 | -function lng_get_info($entry) |
|
33 | -{ |
|
28 | +function lng_get_info($entry) { |
|
34 | 29 | global $lang; |
35 | 30 | return is_object($lang) ? $lang->lng_get_info($entry) : lng_die_not_an_object(); |
36 | 31 | } |
37 | 32 | |
38 | -function lng_switch($language_new) |
|
39 | -{ |
|
33 | +function lng_switch($language_new) { |
|
40 | 34 | global $lang; |
41 | 35 | return is_object($lang) ? $lang->lng_switch($language_new) : lng_die_not_an_object(); |
42 | 36 | } |
43 | 37 | |
44 | -function lng_load_i18n($i18n) |
|
45 | -{ |
|
38 | +function lng_load_i18n($i18n) { |
|
46 | 39 | global $lang; |
47 | 40 | return is_object($lang) ? $lang->lng_load_i18n($i18n) : lng_die_not_an_object(); |
48 | 41 | } |
@@ -7,8 +7,7 @@ discard block |
||
7 | 7 | * @copyright 2008 By Chlorel for XNova |
8 | 8 | */ |
9 | 9 | |
10 | -function flt_mission_recycle(&$mission_data) |
|
11 | -{ |
|
10 | +function flt_mission_recycle(&$mission_data) { |
|
12 | 11 | $fleet_row = &$mission_data['fleet']; |
13 | 12 | $destination_planet = &$mission_data['dst_planet']; |
14 | 13 | |
@@ -37,8 +36,7 @@ discard block |
||
37 | 36 | if(in_array($unit_id, sn_get_groups('flt_recyclers'))) |
38 | 37 | { |
39 | 38 | $RecyclerCapacity += $capacity; |
40 | - } |
|
41 | - else |
|
39 | + } else |
|
42 | 40 | { |
43 | 41 | $OtherFleetCapacity += $capacity; |
44 | 42 | } |
@@ -55,16 +53,14 @@ discard block |
||
55 | 53 | { |
56 | 54 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
57 | 55 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
58 | - } |
|
59 | - else |
|
56 | + } else |
|
60 | 57 | { |
61 | 58 | if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
62 | 59 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)) |
63 | 60 | { |
64 | 61 | $RecycledGoods["metal"] = $RecyclerCapacity / 2; |
65 | 62 | $RecycledGoods["crystal"] = $RecyclerCapacity / 2; |
66 | - } |
|
67 | - else |
|
63 | + } else |
|
68 | 64 | { |
69 | 65 | if ($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) |
70 | 66 | { |
@@ -72,20 +68,17 @@ discard block |
||
72 | 68 | if ($destination_planet["debris_metal"] > ($RecyclerCapacity - $RecycledGoods["crystal"])) |
73 | 69 | { |
74 | 70 | $RecycledGoods["metal"] = $RecyclerCapacity - $RecycledGoods["crystal"]; |
75 | - } |
|
76 | - else |
|
71 | + } else |
|
77 | 72 | { |
78 | 73 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
79 | 74 | } |
80 | - } |
|
81 | - else |
|
75 | + } else |
|
82 | 76 | { |
83 | 77 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
84 | 78 | if ($destination_planet["debris_crystal"] > ($RecyclerCapacity - $RecycledGoods["metal"])) |
85 | 79 | { |
86 | 80 | $RecycledGoods["crystal"] = $RecyclerCapacity - $RecycledGoods["metal"]; |
87 | - } |
|
88 | - else |
|
81 | + } else |
|
89 | 82 | { |
90 | 83 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
91 | 84 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
61 | - if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
|
61 | + if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) and |
|
62 | 62 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)) |
63 | 63 | { |
64 | 64 | $RecycledGoods["metal"] = $RecyclerCapacity / 2; |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | $fleet_row = &$mission_data['fleet']; |
16 | 16 | $destination_planet = &$mission_data['dst_planet']; |
17 | 17 | |
18 | - if(!$fleet_row) |
|
18 | + if (!$fleet_row) |
|
19 | 19 | { |
20 | 20 | return CACHE_NOTHING; |
21 | 21 | } |
22 | 22 | |
23 | - if(!isset($destination_planet['id'])) |
|
23 | + if (!isset($destination_planet['id'])) |
|
24 | 24 | { |
25 | 25 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); |
26 | 26 | DbFleetStatic::fleet_send_back($mission_data['fleet']); |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | $RecyclerCapacity = 0; |
33 | 33 | $OtherFleetCapacity = 0; |
34 | 34 | $fleet_array = sys_unit_str2arr($fleet_row['fleet_array']); |
35 | - foreach($fleet_array as $unit_id => $unit_count) |
|
35 | + foreach ($fleet_array as $unit_id => $unit_count) |
|
36 | 36 | { |
37 | - if(in_array($unit_id, sn_get_groups('fleet'))) |
|
37 | + if (in_array($unit_id, sn_get_groups('fleet'))) |
|
38 | 38 | { |
39 | 39 | $capacity = get_unit_param($unit_id, P_CAPACITY) * $unit_count; |
40 | - if(in_array($unit_id, sn_get_groups('flt_recyclers'))) |
|
40 | + if (in_array($unit_id, sn_get_groups('flt_recyclers'))) |
|
41 | 41 | { |
42 | 42 | $RecyclerCapacity += $capacity; |
43 | 43 | } |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | $IncomingFleetGoods = $fleet_row["fleet_resource_metal"] + $fleet_row["fleet_resource_crystal"] + $fleet_row["fleet_resource_deuterium"]; |
52 | - if($IncomingFleetGoods > $OtherFleetCapacity) |
|
52 | + if ($IncomingFleetGoods > $OtherFleetCapacity) |
|
53 | 53 | { |
54 | 54 | $RecyclerCapacity -= ($IncomingFleetGoods - $OtherFleetCapacity); |
55 | 55 | } |
56 | 56 | |
57 | - if(($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) |
|
57 | + if (($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) |
|
58 | 58 | { |
59 | 59 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
60 | 60 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
61 | 61 | } |
62 | 62 | else |
63 | 63 | { |
64 | - if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
|
64 | + if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
|
65 | 65 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)) |
66 | 66 | { |
67 | 67 | $RecycledGoods["metal"] = $RecyclerCapacity / 2; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
98 | - $NewCargo['Metal'] = $fleet_row["fleet_resource_metal"] + $RecycledGoods["metal"]; |
|
98 | + $NewCargo['Metal'] = $fleet_row["fleet_resource_metal"] + $RecycledGoods["metal"]; |
|
99 | 99 | $NewCargo['Crystal'] = $fleet_row["fleet_resource_crystal"] + $RecycledGoods["crystal"]; |
100 | 100 | $NewCargo['Deuterium'] = $fleet_row["fleet_resource_deuterium"]; |
101 | 101 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | HelperString::numberFloorAndFormat($RecycledGoods["metal"]), $lang['Metal'], |
109 | 109 | HelperString::numberFloorAndFormat($RecycledGoods["crystal"]), $lang['Crystal'] |
110 | 110 | ); |
111 | - msg_send_simple_message ( $fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_RECYCLE, $lang['sys_mess_spy_control'], $lang['sys_recy_report'], $Message); |
|
111 | + msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_RECYCLE, $lang['sys_mess_spy_control'], $lang['sys_recy_report'], $Message); |
|
112 | 112 | |
113 | 113 | // $QryUpdateFleet = "UPDATE {{fleets}} SET `fleet_mess` = 1,`fleet_resource_metal` = '{$NewCargo['Metal']}',`fleet_resource_crystal` = '{$NewCargo['Crystal']}',`fleet_resource_deuterium` = '{$NewCargo['Deuterium']}' "; |
114 | 114 | // $QryUpdateFleet .= "WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"; |
@@ -8,8 +8,7 @@ |
||
8 | 8 | * @version 1.1 |
9 | 9 | * @copyright 2008 by Chlorel for XNova |
10 | 10 | */ |
11 | -function flt_mission_relocate($mission_data) |
|
12 | -{ |
|
11 | +function flt_mission_relocate($mission_data) { |
|
13 | 12 | $fleet_row = &$mission_data['fleet']; |
14 | 13 | $destination_planet = &$mission_data['dst_planet']; |
15 | 14 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $fleet_row = &$mission_data['fleet']; |
16 | 16 | $destination_planet = &$mission_data['dst_planet']; |
17 | 17 | |
18 | - if(!$destination_planet || !is_array($destination_planet) || $fleet_row['fleet_owner'] != $destination_planet['id_owner']) |
|
18 | + if (!$destination_planet || !is_array($destination_planet) || $fleet_row['fleet_owner'] != $destination_planet['id_owner']) |
|
19 | 19 | { |
20 | 20 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); |
21 | 21 | DbFleetStatic::fleet_send_back($mission_data['fleet']); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $mission_data['src_planet']['name'], uni_render_coordinates_href($fleet_row, 'fleet_start_', 3, ''), $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), |
29 | 29 | $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']) . |
30 | 30 | '<br />' . $lang['sys_relocate_mess_user']; |
31 | - foreach(sys_unit_str2arr($fleet_row['fleet_array']) as $ship_id => $ship_count) |
|
31 | + foreach (sys_unit_str2arr($fleet_row['fleet_array']) as $ship_id => $ship_count) |
|
32 | 32 | { |
33 | 33 | $Message .= $lang['tech'][$ship_id] . ' - ' . $ship_count . '<br />'; |
34 | 34 | } |
@@ -8,8 +8,7 @@ |
||
8 | 8 | * @copyright 2008 By Chlorel for XNova |
9 | 9 | */ |
10 | 10 | |
11 | -function flt_mission_transport(&$mission_data) |
|
12 | -{ |
|
11 | +function flt_mission_transport(&$mission_data) { |
|
13 | 12 | $fleet_row = &$mission_data['fleet']; |
14 | 13 | $source_planet = &$mission_data['src_planet']; |
15 | 14 | $destination_planet = &$mission_data['dst_planet']; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $source_planet = &$mission_data['src_planet']; |
17 | 17 | $destination_planet = &$mission_data['dst_planet']; |
18 | 18 | |
19 | - if(!isset($destination_planet['id']) || !$destination_planet['id_owner']) |
|
19 | + if (!isset($destination_planet['id']) || !$destination_planet['id_owner']) |
|
20 | 20 | { |
21 | 21 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); |
22 | 22 | DbFleetStatic::fleet_send_back($fleet_row); |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), |
30 | 30 | $fleet_row['fleet_resource_metal'], $lang['Metal'], |
31 | 31 | $fleet_row['fleet_resource_crystal'], $lang['Crystal'], |
32 | - $fleet_row['fleet_resource_deuterium'], $lang['Deuterium'] ); |
|
32 | + $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']); |
|
33 | 33 | msg_send_simple_message($fleet_row['fleet_target_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); |
34 | 34 | |
35 | - if($fleet_row['fleet_target_owner'] <> $fleet_row['fleet_owner']) |
|
35 | + if ($fleet_row['fleet_target_owner'] <> $fleet_row['fleet_owner']) |
|
36 | 36 | { |
37 | 37 | msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); |
38 | 38 | } |