@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * @param UBE $ube |
9 | 9 | * |
10 | - * @return bool|string |
|
10 | + * @return false|string |
|
11 | 11 | * |
12 | 12 | * @version 2016-02-25 23:42:45 41a4.68 |
13 | 13 | */ |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | // ------------------------------------------------------------------------------------------------ |
187 | 187 | // Читает боевой отчет из БД |
188 | 188 | /** |
189 | - * @param $report_cypher |
|
189 | + * @param string $report_cypher |
|
190 | 190 | * |
191 | 191 | * @return string|UBE |
192 | 192 | */ |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function sn_ube_report_save($ube) { |
15 | 15 | // Если уже есть ИД репорта - значит репорт был взят из таблицы. С таким мы не работаем |
16 | - if($ube->get_cypher()) { |
|
16 | + if ($ube->get_cypher()) { |
|
17 | 17 | return false; |
18 | 18 | } |
19 | 19 | |
20 | 20 | // Генерируем уникальный секретный ключ и проверяем наличие в базе |
21 | 21 | do { |
22 | 22 | $ube->report_cypher = sys_random_string(32); |
23 | - } while(doquery("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE", true)); |
|
23 | + } while (doquery("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE", true)); |
|
24 | 24 | |
25 | 25 | // Инициализация таблицы для пакетной вставки информации |
26 | 26 | $sql_perform = array( |
@@ -108,24 +108,24 @@ discard block |
||
108 | 108 | $sql_str = "INSERT INTO `{{ube_report}}` |
109 | 109 | SET |
110 | 110 | `ube_report_cypher` = '{$ube->report_cypher}', |
111 | - `ube_report_time_combat` = '" . date(FMT_DATE_TIME_SQL, $ube->combat_timestamp) . "', |
|
111 | + `ube_report_time_combat` = '".date(FMT_DATE_TIME_SQL, $ube->combat_timestamp)."', |
|
112 | 112 | `ube_report_time_spent` = {$ube->time_spent}, |
113 | 113 | |
114 | - `ube_report_combat_admin` = " . (int)$ube->is_admin_in_combat . ", |
|
114 | + `ube_report_combat_admin` = ".(int) $ube->is_admin_in_combat.", |
|
115 | 115 | `ube_report_mission_type` = {$ube->mission_type_id}, |
116 | 116 | |
117 | 117 | `ube_report_combat_result` = {$ube->combat_result}, |
118 | - `ube_report_combat_sfr` = " . (int)$ube->is_small_fleet_recce . ", |
|
118 | + `ube_report_combat_sfr` = ".(int) $ube->is_small_fleet_recce.", |
|
119 | 119 | |
120 | - `ube_report_planet_id` = " . (int)$ube->ube_planet_info[PLANET_ID] . ", |
|
121 | - `ube_report_planet_name` = '" . db_escape($ube->ube_planet_info[PLANET_NAME]) . "', |
|
122 | - `ube_report_planet_size` = " . (int)$ube->ube_planet_info[PLANET_SIZE] . ", |
|
123 | - `ube_report_planet_galaxy` = " . (int)$ube->ube_planet_info[PLANET_GALAXY] . ", |
|
124 | - `ube_report_planet_system` = " . (int)$ube->ube_planet_info[PLANET_SYSTEM] . ", |
|
125 | - `ube_report_planet_planet` = " . (int)$ube->ube_planet_info[PLANET_PLANET] . ", |
|
126 | - `ube_report_planet_planet_type` = " . (int)$ube->ube_planet_info[PLANET_TYPE] . ", |
|
120 | + `ube_report_planet_id` = " . (int) $ube->ube_planet_info[PLANET_ID].", |
|
121 | + `ube_report_planet_name` = '" . db_escape($ube->ube_planet_info[PLANET_NAME])."', |
|
122 | + `ube_report_planet_size` = " . (int) $ube->ube_planet_info[PLANET_SIZE].", |
|
123 | + `ube_report_planet_galaxy` = " . (int) $ube->ube_planet_info[PLANET_GALAXY].", |
|
124 | + `ube_report_planet_system` = " . (int) $ube->ube_planet_info[PLANET_SYSTEM].", |
|
125 | + `ube_report_planet_planet` = " . (int) $ube->ube_planet_info[PLANET_PLANET].", |
|
126 | + `ube_report_planet_planet_type` = " . (int) $ube->ube_planet_info[PLANET_TYPE].", |
|
127 | 127 | |
128 | - `ube_report_capture_result` = " . (int)$ube->capture_result . ", " |
|
128 | + `ube_report_capture_result` = " . (int) $ube->capture_result.", " |
|
129 | 129 | . $ube->debris->report_generate_sql() |
130 | 130 | . $ube->moon_calculator->report_generate_sql(); |
131 | 131 | |
@@ -134,22 +134,22 @@ discard block |
||
134 | 134 | |
135 | 135 | // Сохраняем общую информацию по игрокам |
136 | 136 | $player_sides = $ube->players->get_player_sides(); |
137 | - foreach($player_sides as $player_id => $player_side) { |
|
137 | + foreach ($player_sides as $player_id => $player_side) { |
|
138 | 138 | $sql_perform['ube_report_player'][] = array( |
139 | 139 | $ube_report_id, |
140 | 140 | $player_id, |
141 | 141 | |
142 | - "'" . db_escape($ube->players[$player_id]->name) . "'", |
|
142 | + "'".db_escape($ube->players[$player_id]->name)."'", |
|
143 | 143 | $ube->players[$player_id]->getSide() == UBE_PLAYER_IS_ATTACKER ? 1 : 0, |
144 | 144 | |
145 | - (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK), |
|
146 | - (float)$ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD), |
|
147 | - (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR), |
|
145 | + (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK), |
|
146 | + (float) $ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD), |
|
147 | + (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR), |
|
148 | 148 | ); |
149 | 149 | } |
150 | 150 | |
151 | 151 | // Всякая информация по флотам |
152 | - foreach($ube->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
152 | + foreach ($ube->fleet_list->_container as $fleet_id => $UBEFleet) { |
|
153 | 153 | // Сохраняем общую информацию по флотам |
154 | 154 | $sql_perform['ube_report_fleet'][] = $UBEFleet->sql_generate_array($ube_report_id); |
155 | 155 | |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | $ube->rounds->sql_generate_unit_array($sql_perform['ube_report_unit'], $ube_report_id, $ube->fleet_list); |
166 | 166 | |
167 | 167 | // Пакетная вставка данных |
168 | - foreach($sql_perform as $table_name => $table_data) { |
|
169 | - if(count($table_data) < 2) { |
|
168 | + foreach ($sql_perform as $table_name => $table_data) { |
|
169 | + if (count($table_data) < 2) { |
|
170 | 170 | continue; |
171 | 171 | } |
172 | - foreach($table_data as &$record_data) { |
|
173 | - $record_data = '(' . implode(',', $record_data) . ')'; |
|
172 | + foreach ($table_data as &$record_data) { |
|
173 | + $record_data = '('.implode(',', $record_data).')'; |
|
174 | 174 | } |
175 | 175 | $fields = $table_data[0]; |
176 | 176 | unset($table_data[0]); |
177 | - doquery("INSERT INTO {{{$table_name}}} {$fields} VALUES " . implode(',', $table_data)); |
|
177 | + doquery("INSERT INTO {{{$table_name}}} {$fields} VALUES ".implode(',', $table_data)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | return $ube->report_cypher; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $report_cypher = db_escape($report_cypher); |
193 | 193 | |
194 | 194 | $report_row = doquery("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1", true); |
195 | - if(!$report_row) { |
|
195 | + if (!$report_row) { |
|
196 | 196 | return UBE_REPORT_NOT_FOUND; |
197 | 197 | } |
198 | 198 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @param $template_result |
209 | 209 | */ |
210 | 210 | function sn_ube_report_generate(UBE $ube, &$template_result) { |
211 | - if(!is_object($ube)) { |
|
211 | + if (!is_object($ube)) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | 214 | |
@@ -223,15 +223,15 @@ discard block |
||
223 | 223 | |
224 | 224 | // Координаты, тип и название планеты - если есть |
225 | 225 | //R $planet_owner_id = $combat_data[UBE_FLEETS][0][UBE_OWNER]; |
226 | - if(isset($ube->ube_planet_info)) { |
|
226 | + if (isset($ube->ube_planet_info)) { |
|
227 | 227 | $template_result += $ube->ube_planet_info; |
228 | 228 | $template_result[PLANET_NAME] = str_replace(' ', ' ', htmlentities($template_result[PLANET_NAME], ENT_COMPAT, 'UTF-8')); |
229 | 229 | } |
230 | 230 | |
231 | 231 | // Обломки |
232 | 232 | $debris = array(); |
233 | - foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) { |
|
234 | - if($resource_amount = $ube->debris->debris_get_resource($resource_id)) { |
|
233 | + foreach (array(RES_METAL, RES_CRYSTAL) as $resource_id) { |
|
234 | + if ($resource_amount = $ube->debris->debris_get_resource($resource_id)) { |
|
235 | 235 | $debris[] = array( |
236 | 236 | 'NAME' => classLocale::$lang['tech'][$resource_id], |
237 | 237 | 'AMOUNT' => pretty_number($resource_amount), |
@@ -293,7 +293,7 @@ |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
296 | - * @param $ranklist |
|
296 | + * @param string $ranklist |
|
297 | 297 | * @param $user |
298 | 298 | */ |
299 | 299 | function db_ally_update_ranklist($ranklist, $user) { |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | `ally_name` = '{$ally_name}', |
65 | 65 | `ally_tag` = '{$ally_tag}', |
66 | 66 | `ally_owner` = '{$user['id']}', |
67 | - `ally_owner_range` = '" . classLocale::$lang['ali_leaderRank'] . "', |
|
67 | + `ally_owner_range` = '".classLocale::$lang['ali_leaderRank']."', |
|
68 | 68 | `ally_members` = 1, |
69 | - `ranklist` = '" . classLocale::$lang['ali_defaultRankName'] . ",0,0,0,0,0', |
|
69 | + `ranklist` = '" . classLocale::$lang['ali_defaultRankName'].",0,0,0,0,0', |
|
70 | 70 | `ally_register_time`= " . SN_TIME_NOW |
71 | 71 | ); |
72 | 72 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param $POST_text |
86 | 86 | */ |
87 | 87 | function db_ally_request_insert($user, $id_ally, $POST_text) { |
88 | - doquery("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=" . SN_TIME_NOW . ";"); |
|
88 | + doquery("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=".SN_TIME_NOW.";"); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param $ally |
136 | 136 | */ |
137 | 137 | function db_ally_update_by_changeset($ally_changeset, $ally) { |
138 | - doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;"); |
|
138 | + doquery("UPDATE {{alliance}} SET ".implode(',', $ally_changeset)." WHERE `id`='{$ally['id']}' LIMIT 1;"); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @param $d |
247 | 247 | */ |
248 | 248 | function db_ally_request_deny($d) { |
249 | - doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '" . classLocale::$lang['ali_req_deny_reason'] . "' WHERE `id_user`= {$d} LIMIT 1;"); |
|
249 | + doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '".classLocale::$lang['ali_req_deny_reason']."' WHERE `id_user`= {$d} LIMIT 1;"); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param $user_id |
20 | - * @param $nick |
|
20 | + * @param string $nick |
|
21 | 21 | * @param $ally_id |
22 | - * @param $message |
|
22 | + * @param string $message |
|
23 | 23 | * @param $chat_message_sender_name |
24 | 24 | * @param $chat_message_recipient_id |
25 | 25 | * @param $chat_message_recipient_name |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param $alliance |
56 | 56 | * @param $where_add |
57 | 57 | * @param $start_row |
58 | - * @param $page_limit |
|
58 | + * @param integer $page_limit |
|
59 | 59 | * |
60 | 60 | * @return array|bool|mysqli_result|null |
61 | 61 | */ |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | JOIN {{users}} AS u ON u.id = cp.chat_player_player_id |
11 | 11 | WHERE |
12 | 12 | `chat_player_refresh_last` >= '{$sql_date}' |
13 | - AND (`banaday` IS NULL OR `banaday` <= " . SN_TIME_NOW . ") |
|
13 | + AND (`banaday` IS NULL OR `banaday` <= ".SN_TIME_NOW.") |
|
14 | 14 | {$ally_add} |
15 | 15 | ORDER BY authlevel DESC, `username`"); |
16 | 16 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | `user` = '{$nick}', |
34 | 34 | `ally_id` = '{$ally_id}', |
35 | 35 | `message` = '{$message}', |
36 | - `timestamp` = " . SN_TIME_NOW . ", |
|
36 | + `timestamp` = ".SN_TIME_NOW.", |
|
37 | 37 | `chat_message_sender_name` = '{$chat_message_sender_name}', |
38 | 38 | `chat_message_recipient_id` = {$chat_message_recipient_id}, |
39 | 39 | `chat_message_recipient_name` = '{$chat_message_recipient_name}'" |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param $user |
140 | 140 | */ |
141 | 141 | function db_chat_player_update($user) { |
142 | - doquery("UPDATE {{chat_player}} SET `chat_player_refresh_last` = " . SN_TIME_NOW . " WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;"); |
|
142 | + doquery("UPDATE {{chat_player}} SET `chat_player_refresh_last` = ".SN_TIME_NOW." WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;"); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -211,5 +211,5 @@ discard block |
||
211 | 211 | * @param $user |
212 | 212 | */ |
213 | 213 | function db_chat_player_update_activity($user) { |
214 | - doquery("UPDATE {{chat_player}} SET `chat_player_activity` = '" . classSupernova::$db->db_escape(SN_TIME_SQL) . "' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1"); |
|
214 | + doquery("UPDATE {{chat_player}} SET `chat_player_activity` = '".classSupernova::$db->db_escape(SN_TIME_SQL)."' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1"); |
|
215 | 215 | } |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | - * @param $template |
|
83 | - * @param $query_where |
|
84 | - * @param $query_limit |
|
82 | + * @param template $template |
|
83 | + * @param string $query_where |
|
84 | + * @param integer $query_limit |
|
85 | 85 | * |
86 | 86 | * @return array|bool|mysqli_result|null |
87 | 87 | */ |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param $user |
106 | 106 | * @param $survey_id |
107 | 107 | * @param $survey_vote_id |
108 | - * @param $user_name_safe |
|
108 | + * @param string $user_name_safe |
|
109 | 109 | */ |
110 | 110 | function db_survey_vote_insert(&$user, $survey_id, $survey_vote_id, $user_name_safe) { |
111 | 111 | doquery("INSERT INTO {{survey_votes}} SET `survey_parent_id` = {$survey_id}, `survey_parent_answer_id` = {$survey_vote_id}, `survey_vote_user_id` = {$user['id']}, `survey_vote_user_name` = '{$user_name_safe}';"); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function db_news_insert_set($announce_time, $text, $detail_url, $user) { |
13 | 13 | doquery("INSERT INTO {{announce}} |
14 | 14 | SET `tsTimeStamp` = FROM_UNIXTIME({$announce_time}), `strAnnounce`='{$text}', detail_url = '{$detail_url}', |
15 | - `user_id` = {$user['id']}, `user_name` = '" . db_escape($user['username']) . "'"); |
|
15 | + `user_id` = {$user['id']}, `user_name` = '".db_escape($user['username'])."'"); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | function db_survey_insert($announce_id, $survey_question, $survey_until) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | LEFT JOIN {{survey}} AS s ON s.survey_announce_id = a.idAnnounce |
94 | 94 | LEFT JOIN {{users}} AS u ON u.id = a.user_id |
95 | 95 | {$query_where} |
96 | - ORDER BY `tsTimeStamp` DESC, idAnnounce" . |
|
96 | + ORDER BY `tsTimeStamp` DESC, idAnnounce". |
|
97 | 97 | ($query_limit ? " LIMIT {$query_limit}" : '')); |
98 | 98 | |
99 | 99 | $template->assign_var('NEWS_COUNT', db_num_rows($announce_list)); |
@@ -69,8 +69,8 @@ |
||
69 | 69 | |
70 | 70 | /** |
71 | 71 | * @param Fleet $objFleet |
72 | - * @param $ov_label |
|
73 | - * @param $planet_end_type |
|
72 | + * @param integer $ov_label |
|
73 | + * @param integer $planet_end_type |
|
74 | 74 | * |
75 | 75 | * @return mixed |
76 | 76 | */ |
@@ -6,26 +6,26 @@ discard block |
||
6 | 6 | $fleet_events = array(); |
7 | 7 | $fleet_number = 0; |
8 | 8 | |
9 | - if($objFleetList->count() <= 0) { |
|
9 | + if ($objFleetList->count() <= 0) { |
|
10 | 10 | return; |
11 | 11 | } |
12 | 12 | |
13 | - foreach($objFleetList->_container as $objFleet) { |
|
13 | + foreach ($objFleetList->_container as $objFleet) { |
|
14 | 14 | $planet_start_type = $objFleet->fleet_start_type == PT_MOON ? PT_MOON : PT_PLANET; |
15 | 15 | $planet_start = db_planet_by_gspt($objFleet->fleet_start_galaxy, $objFleet->fleet_start_system, $objFleet->fleet_start_planet, $planet_start_type, false, 'name'); |
16 | 16 | $objFleet->fleet_start_name = $planet_start['name']; |
17 | 17 | |
18 | 18 | $planet_end_type = $objFleet->fleet_end_type == PT_MOON ? PT_MOON : PT_PLANET; |
19 | - if($objFleet->fleet_end_planet > Vector::$knownPlanets) { |
|
19 | + if ($objFleet->fleet_end_planet > Vector::$knownPlanets) { |
|
20 | 20 | $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_exploration']; |
21 | - } elseif($objFleet->mission_type == MT_COLONIZE) { |
|
21 | + } elseif ($objFleet->mission_type == MT_COLONIZE) { |
|
22 | 22 | $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_colonization']; |
23 | 23 | } else { |
24 | 24 | $planet_end = db_planet_by_gspt($objFleet->fleet_end_galaxy, $objFleet->fleet_end_system, $objFleet->fleet_end_planet, $planet_end_type, false, 'name'); |
25 | 25 | $objFleet->fleet_end_name = $planet_end['name']; |
26 | 26 | } |
27 | 27 | |
28 | - if($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE && |
|
28 | + if ($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE && |
|
29 | 29 | ($planet_scanned === false |
30 | 30 | || |
31 | 31 | ( |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | $fleet_events[] = flt_register_event_objFleet($objFleet, 0, $planet_end_type); |
40 | 40 | } |
41 | 41 | |
42 | - if($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) { |
|
42 | + if ($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) { |
|
43 | 43 | $fleet_events[] = flt_register_event_objFleet($objFleet, 1, $planet_end_type); |
44 | 44 | } |
45 | 45 | |
46 | - if( |
|
46 | + if ( |
|
47 | 47 | $objFleet->time_return_to_source > SN_TIME_NOW && $objFleet->mission_type != MT_MISSILE && ($objFleet->isReturning() || ($objFleet->mission_type != MT_RELOCATE && $objFleet->mission_type != MT_COLONIZE)) && |
48 | 48 | ( |
49 | 49 | ($planet_scanned === false && $objFleet->playerOwnerId == $user['id']) |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $fleet_events[] = flt_register_event_objFleet($objFleet, 2, $planet_end_type); |
60 | 60 | } |
61 | 61 | |
62 | - if($objFleet->mission_type == MT_MISSILE) { |
|
62 | + if ($objFleet->mission_type == MT_MISSILE) { |
|
63 | 63 | $fleet_events[] = flt_register_event_objFleet($objFleet, 3, $planet_end_type); |
64 | 64 | } |
65 | 65 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $is_this_planet = false; |
81 | 81 | |
82 | - switch($objFleet->ov_label = $ov_label) { |
|
82 | + switch ($objFleet->ov_label = $ov_label) { |
|
83 | 83 | case 0: |
84 | 84 | $objFleet->event_time = $objFleet->time_arrive_to_target; |
85 | 85 | $is_this_planet = ( |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | } |
112 | 112 | |
113 | - $objFleet->ov_this_planet = $is_this_planet;// || $planet_scanned != false; |
|
113 | + $objFleet->ov_this_planet = $is_this_planet; // || $planet_scanned != false; |
|
114 | 114 | |
115 | - if($objFleet->playerOwnerId == $user['id']) { |
|
115 | + if ($objFleet->playerOwnerId == $user['id']) { |
|
116 | 116 | $user_data = $user; |
117 | 117 | } else { |
118 | 118 | $user_data = db_user_by_id($objFleet->playerOwnerId); |
@@ -185,6 +185,9 @@ |
||
185 | 185 | return $result; |
186 | 186 | } |
187 | 187 | |
188 | +/** |
|
189 | + * @param integer $que_id |
|
190 | + */ |
|
188 | 191 | function tpl_parse_planet_que($que, $planet, $que_id) { |
189 | 192 | $hangar_que = array(); |
190 | 193 | $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']]; |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | // Compare function to sort fleet in time order |
4 | 4 | function tpl_assign_fleet_compare($a, $b) { |
5 | - if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) { |
|
6 | - if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) { |
|
5 | + if ($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) { |
|
6 | + if ($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) { |
|
7 | 7 | return 0; |
8 | 8 | } |
9 | 9 | |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | * @param string $js_name |
20 | 20 | */ |
21 | 21 | function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') { |
22 | - if(!$fleets) { |
|
22 | + if (!$fleets) { |
|
23 | 23 | return; |
24 | 24 | } |
25 | 25 | |
26 | 26 | usort($fleets, 'tpl_assign_fleet_compare'); |
27 | 27 | |
28 | - foreach($fleets as $fleet_data) { |
|
28 | + foreach ($fleets as $fleet_data) { |
|
29 | 29 | $template->assign_block_vars($js_name, $fleet_data['fleet']); |
30 | 30 | |
31 | - if($fleet_data['ships']) { |
|
32 | - foreach($fleet_data['ships'] as $ship_data) { |
|
31 | + if ($fleet_data['ships']) { |
|
32 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
33 | 33 | $template->assign_block_vars("{$js_name}.ships", $ship_data); |
34 | 34 | } |
35 | 35 | } |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | 'DEUTERIUM' => $fleet[RES_DEUTERIUM], |
51 | 51 | ); |
52 | 52 | |
53 | - foreach($fleet as $ship_id => $ship_amount) { |
|
54 | - if(in_array($ship_id, sn_get_groups('fleet'))) { |
|
53 | + foreach ($fleet as $ship_id => $ship_amount) { |
|
54 | + if (in_array($ship_id, sn_get_groups('fleet'))) { |
|
55 | 55 | $single_ship_data = get_ship_data($ship_id, $user_data); |
56 | 56 | $return['ships'][$ship_id] = array( |
57 | 57 | 'ID' => $ship_id, |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | |
91 | 91 | $result = array(); |
92 | 92 | |
93 | - if(!$user_data) { |
|
93 | + if (!$user_data) { |
|
94 | 94 | $user_data = $user; |
95 | 95 | } |
96 | 96 | |
97 | - if(!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) { |
|
97 | + if (!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) { |
|
98 | 98 | $aks = db_acs_get_by_group_id($objFleet->group_id); |
99 | 99 | } |
100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | 'MISSION' => $objFleet->mission_type, |
114 | 114 | 'MISSION_NAME' => classLocale::$lang['type_mission'][$objFleet->mission_type], |
115 | 115 | 'ACS' => !empty($aks['name']) ? $aks['name'] : (!empty($objFleet->group_id) ? $objFleet->group_id : ''), |
116 | - 'AMOUNT' => $spy_level >= 4 ? (pretty_number($objFleet->shipsGetTotal()) . (array_sum($fleet_resources) ? '+' : '')) : '?', |
|
116 | + 'AMOUNT' => $spy_level >= 4 ? (pretty_number($objFleet->shipsGetTotal()).(array_sum($fleet_resources) ? '+' : '')) : '?', |
|
117 | 117 | |
118 | 118 | 'METAL' => $spy_level >= 8 ? $fleet_resources[RES_METAL] : 0, |
119 | 119 | 'CRYSTAL' => $spy_level >= 8 ? $fleet_resources[RES_CRYSTAL] : 0, |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | 'STAY_LEFT' => floor($objFleet->time_mission_job_complete + 1 - SN_TIME_NOW), |
136 | 136 | ); |
137 | 137 | |
138 | - if(property_exists($objFleet, 'fleet_start_name')) { |
|
138 | + if (property_exists($objFleet, 'fleet_start_name')) { |
|
139 | 139 | $result['START_NAME'] = $objFleet->fleet_start_name; |
140 | 140 | } |
141 | - if(property_exists($objFleet, 'fleet_end_name')) { |
|
141 | + if (property_exists($objFleet, 'fleet_end_name')) { |
|
142 | 142 | $result['END_NAME'] = $objFleet->fleet_end_name; |
143 | 143 | } |
144 | 144 | |
145 | - if(property_exists($objFleet, 'event_time')) { |
|
145 | + if (property_exists($objFleet, 'event_time')) { |
|
146 | 146 | $result['fleet'] = array_merge($result['fleet'], array( |
147 | 147 | 'OV_LABEL' => $objFleet->ov_label, |
148 | 148 | 'EVENT_TIME_TEXT' => property_exists($objFleet, 'event_time') ? date(FMT_DATE_TIME, $objFleet->event_time + SN_CLIENT_TIME_DIFF) : '', |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | |
156 | 156 | $ship_id = 0; |
157 | 157 | $result['ships'] = array(); |
158 | - if($spy_level >= 6) { |
|
159 | - foreach($ship_list_fully_parsed as $ship_sn_id => $ship_amount) { |
|
160 | - if($spy_level >= 10) { |
|
158 | + if ($spy_level >= 6) { |
|
159 | + foreach ($ship_list_fully_parsed as $ship_sn_id => $ship_amount) { |
|
160 | + if ($spy_level >= 10) { |
|
161 | 161 | $single_ship_data = get_ship_data($ship_sn_id, $user_data); |
162 | 162 | $result['ships'][$ship_sn_id] = array( |
163 | 163 | 'ID' => $ship_sn_id, |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | function tpl_parse_planet_que($que, $planet, $que_id) { |
191 | 191 | $hangar_que = array(); |
192 | 192 | $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']]; |
193 | - if(!empty($que_hangar)) { |
|
194 | - foreach($que_hangar as $que_item) { |
|
193 | + if (!empty($que_hangar)) { |
|
194 | + foreach ($que_hangar as $que_item) { |
|
195 | 195 | $hangar_que['que'][] = array('id' => $que_item['que_unit_id'], 'count' => $que_item['que_unit_amount']); |
196 | 196 | $hangar_que[$que_item['que_unit_id']] += $que_item['que_unit_amount']; |
197 | 197 | } |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | 'PLANET_GOVERNOR_LEVEL_MAX' => get_unit_param($planet['PLANET_GOVERNOR_ID'], P_MAX_STACK), |
252 | 252 | ); |
253 | 253 | |
254 | - if(!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) { |
|
254 | + if (!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) { |
|
255 | 255 | $result['building_que'] = array(); |
256 | 256 | $building_que = &$que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']]; |
257 | - foreach($building_que as $que_element) { |
|
257 | + foreach ($building_que as $que_element) { |
|
258 | 258 | $result['building_que'][] = que_tpl_parse_element($que_element); |
259 | 259 | } |
260 | 260 | } |
@@ -270,19 +270,19 @@ discard block |
||
270 | 270 | function flt_get_fleets_to_planet_by_array_of_Fleet($array_of_Fleet) { |
271 | 271 | global $user; |
272 | 272 | |
273 | - if(empty($array_of_Fleet)) { |
|
273 | + if (empty($array_of_Fleet)) { |
|
274 | 274 | return false; |
275 | 275 | } |
276 | 276 | |
277 | 277 | $fleet_list = array(); |
278 | - foreach($array_of_Fleet as $fleet) { |
|
279 | - if($fleet->playerOwnerId == $user['id']) { |
|
280 | - if($fleet->mission_type == MT_MISSILE) { |
|
278 | + foreach ($array_of_Fleet as $fleet) { |
|
279 | + if ($fleet->playerOwnerId == $user['id']) { |
|
280 | + if ($fleet->mission_type == MT_MISSILE) { |
|
281 | 281 | continue; |
282 | 282 | } |
283 | 283 | $fleet_ownage = 'own'; |
284 | 284 | } else { |
285 | - switch($fleet->mission_type) { |
|
285 | + switch ($fleet->mission_type) { |
|
286 | 286 | case MT_ATTACK: |
287 | 287 | case MT_ACS: |
288 | 288 | case MT_DESTROY: |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | |
300 | 300 | $fleet_list[$fleet_ownage]['fleets'][$fleet->dbId] = $fleet; |
301 | 301 | |
302 | - if($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) { |
|
302 | + if ($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) { |
|
303 | 303 | $fleet_sn = $fleet->shipsGetArray(); |
304 | - foreach($fleet_sn as $ship_id => $ship_amount) { |
|
305 | - if(in_array($ship_id, sn_get_groups('fleet'))) { |
|
304 | + foreach ($fleet_sn as $ship_id => $ship_amount) { |
|
305 | + if (in_array($ship_id, sn_get_groups('fleet'))) { |
|
306 | 306 | $fleet_list[$fleet_ownage]['total'][$ship_id] += $ship_amount; |
307 | 307 | } |
308 | 308 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | return $fleet_list; |
320 | 320 | } |
321 | 321 | |
322 | -function tpl_set_resource_info(template &$template, $planet_row, $fleets_to_planet = array(), $round = 0) { |
|
322 | +function tpl_set_resource_info(template & $template, $planet_row, $fleets_to_planet = array(), $round = 0) { |
|
323 | 323 | $template->assign_vars(array( |
324 | 324 | 'RESOURCE_ROUNDING' => $round, |
325 | 325 |
@@ -1,5 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | +/** |
|
4 | + * @param string $type |
|
5 | + */ |
|
3 | 6 | function sn_ube_simulator_encode_replay($combat, $type) |
4 | 7 | { |
5 | 8 | $strPacked = "{$type}!"; |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | { |
5 | 5 | $strPacked = "{$type}!"; |
6 | 6 | |
7 | - foreach($combat as $fleetID => $fleetCompress) |
|
7 | + foreach ($combat as $fleetID => $fleetCompress) |
|
8 | 8 | { |
9 | - foreach($fleetCompress as $key => $value) |
|
9 | + foreach ($fleetCompress as $key => $value) |
|
10 | 10 | { |
11 | 11 | $value = intval($value); |
12 | 12 | $strPacked .= "{$key},{$value};"; |
@@ -22,29 +22,29 @@ discard block |
||
22 | 22 | $fleet_id = 0; |
23 | 23 | |
24 | 24 | $arr_data_unpacked = explode('!', $str_data); |
25 | - foreach($arr_data_unpacked as $data_piece) |
|
25 | + foreach ($arr_data_unpacked as $data_piece) |
|
26 | 26 | { |
27 | - if(!$data_piece) |
|
27 | + if (!$data_piece) |
|
28 | 28 | { |
29 | 29 | continue; |
30 | 30 | } |
31 | 31 | |
32 | - if($data_piece == 'A' || $data_piece == 'D') |
|
32 | + if ($data_piece == 'A' || $data_piece == 'D') |
|
33 | 33 | { |
34 | 34 | $fleet_type = $data_piece; |
35 | 35 | continue; |
36 | 36 | } |
37 | 37 | |
38 | 38 | $arr_unit_strings = explode(';', $data_piece); |
39 | - foreach($arr_unit_strings as $str_unit_string) |
|
39 | + foreach ($arr_unit_strings as $str_unit_string) |
|
40 | 40 | { |
41 | - if(!$str_unit_string) |
|
41 | + if (!$str_unit_string) |
|
42 | 42 | { |
43 | 43 | continue; |
44 | 44 | } |
45 | 45 | |
46 | 46 | $arr_unit_data = explode(',', $str_unit_string); |
47 | - if($arr_unit_data[1]) |
|
47 | + if ($arr_unit_data[1]) |
|
48 | 48 | { |
49 | 49 | $unpacked[$fleet_type][$fleet_id][$arr_unit_data[0]] = intval($arr_unit_data[1]); |
50 | 50 | } |
@@ -10,9 +10,8 @@ |
||
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param Mission $objMission |
13 | - * @param array $mission_data |
|
14 | 13 | * |
15 | - * @return array|null |
|
14 | + * @return null|boolean |
|
16 | 15 | */ |
17 | 16 | function flt_mission_attack($objMission) { |
18 | 17 | $objFleet = $objMission->fleet; |
@@ -17,14 +17,14 @@ |
||
17 | 17 | function flt_mission_attack($objMission) { |
18 | 18 | $objFleet = $objMission->fleet; |
19 | 19 | |
20 | - if($objFleet->shipsGetTotal() <= 0) { |
|
20 | + if ($objFleet->shipsGetTotal() <= 0) { |
|
21 | 21 | return null; |
22 | 22 | } |
23 | 23 | |
24 | 24 | $destination_user = $objMission->dst_user; |
25 | 25 | $destination_planet = $objMission->dst_planet; |
26 | 26 | |
27 | - if( |
|
27 | + if ( |
|
28 | 28 | // Нет данных о планете назначения или её владельце |
29 | 29 | empty($destination_user) || empty($destination_planet) || !is_array($destination_user) || !is_array($destination_planet) |
30 | 30 | || |
@@ -31,7 +31,7 @@ |
||
31 | 31 | /** |
32 | 32 | * Fleet mission "Relocate" |
33 | 33 | * |
34 | - * @param $mission_data Mission |
|
34 | + * @param Mission $mission_data Mission |
|
35 | 35 | * |
36 | 36 | * @return int |
37 | 37 | * |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | function flt_mission_explore(&$mission_data) { |
21 | 21 | static $ship_data, $rates; |
22 | 22 | |
23 | - if(empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) { |
|
23 | + if (empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) { |
|
24 | 24 | return CACHE_NONE; |
25 | 25 | } |
26 | 26 | |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $outcome_value = &$result['$outcome_value']; |
46 | 46 | $outcome_list = &$result['$outcome_list']; |
47 | 47 | |
48 | - if(!$ship_data) { |
|
49 | - foreach(sn_get_groups('fleet') as $unit_id) { |
|
48 | + if (!$ship_data) { |
|
49 | + foreach (sn_get_groups('fleet') as $unit_id) { |
|
50 | 50 | $unit_info = get_unit_param($unit_id); |
51 | - if($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) { |
|
51 | + if ($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) { |
|
52 | 52 | continue; |
53 | 53 | } |
54 | 54 | $ship_data[$unit_id][P_COST_METAL] = get_unit_cost_in($unit_info[P_COST]); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $max_metal_cost = 0; |
60 | 60 | $fleet_real_array = $objFleet->shipsGetArray(); |
61 | - foreach($fleet_real_array as $ship_id => $ship_amount) { |
|
61 | + foreach ($fleet_real_array as $ship_id => $ship_amount) { |
|
62 | 62 | $ship_cost_in_metal = $ship_amount * $ship_data[$ship_id][P_COST_METAL]; |
63 | 63 | $result['$fleet_metal_points'] += $ship_amount * $ship_data[$ship_id][P_COST_METAL]; |
64 | 64 | // Рассчитываем стоимость самого дорого корабля в металле |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1 / 1.7)); |
73 | 73 | |
74 | 74 | $chance_max = 0; |
75 | - foreach($outcome_list as $key => &$value) { |
|
76 | - if(!$value['chance']) { |
|
75 | + foreach ($outcome_list as $key => &$value) { |
|
76 | + if (!$value['chance']) { |
|
77 | 77 | unset($outcome_list[$key]); |
78 | 78 | continue; |
79 | 79 | } |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | } |
82 | 82 | $outcome_value = mt_rand(0, $chance_max); |
83 | 83 | $outcome_description = &$outcome_list[$mission_outcome = FLT_EXPEDITION_OUTCOME_NONE]; |
84 | - foreach($outcome_list as $key => &$value) { |
|
85 | - if(!$value['chance']) { |
|
84 | + foreach ($outcome_list as $key => &$value) { |
|
85 | + if (!$value['chance']) { |
|
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | $mission_outcome = $key; |
89 | 89 | $outcome_description = $value; |
90 | - if($outcome_value <= $outcome_description['value']) { |
|
90 | + if ($outcome_value <= $outcome_description['value']) { |
|
91 | 91 | break; |
92 | 92 | } |
93 | 93 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // $outcome_mission_sub = -1; |
105 | 105 | |
106 | 106 | $fleet_found = array(); |
107 | - switch($mission_outcome) { |
|
107 | + switch ($mission_outcome) { |
|
108 | 108 | case FLT_EXPEDITION_OUTCOME_LOST_FLEET: |
109 | 109 | $objFleet->shipsCountApplyLossMultiplier(mt_rand(1, 3) * mt_rand(200000, 300000) / 1000000); |
110 | 110 | break; |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | |
126 | 126 | // Ограничиваем корабли только теми, чья стоимость в металле меньше или равно стоимости самого дорогого корабля |
127 | 127 | $can_be_found = array(); |
128 | - foreach($ship_data as $ship_id => $ship_info) { |
|
129 | - if($ship_info['metal_cost'] < $max_metal_cost) { |
|
128 | + foreach ($ship_data as $ship_id => $ship_info) { |
|
129 | + if ($ship_info['metal_cost'] < $max_metal_cost) { |
|
130 | 130 | $can_be_found[$ship_id] = $ship_info['metal_cost']; |
131 | 131 | } |
132 | 132 | } |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | unset($can_be_found[SHIP_COLONIZER]); |
135 | 135 | unset($can_be_found[SHIP_SPY]); |
136 | 136 | |
137 | - while(count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
137 | + while (count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
138 | 138 | $found_index = mt_rand(1, count($can_be_found)) - 1; |
139 | 139 | $found_ship = array_slice($can_be_found, $found_index, 1, true); |
140 | 140 | $found_ship_cost = reset($found_ship); |
141 | 141 | $found_ship_id = key($found_ship); |
142 | 142 | |
143 | - if($found_ship_cost > $found_in_metal) { |
|
143 | + if ($found_ship_cost > $found_in_metal) { |
|
144 | 144 | unset($can_be_found[$found_ship_id]); |
145 | 145 | } else { |
146 | 146 | $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost)); |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | - if(empty($fleet_found)) { |
|
152 | + if (empty($fleet_found)) { |
|
153 | 153 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
154 | 154 | } else { |
155 | - foreach($fleet_found as $unit_id => $unit_amount) { |
|
155 | + foreach ($fleet_found as $unit_id => $unit_amount) { |
|
156 | 156 | $objFleet->shipAdjustCount($unit_id, $unit_amount); |
157 | 157 | } |
158 | 158 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | $objFleet->resourcesAdjust($resources_found); |
178 | 178 | |
179 | - if(array_sum($resources_found) == 0) { |
|
179 | + if (array_sum($resources_found) == 0) { |
|
180 | 180 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
181 | 181 | } |
182 | 182 | break; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | // Рассчитываем количество найденной ТМ |
188 | 188 | $found_dark_matter = floor(min($outcome_percent * $result['$fleet_metal_points'] / $rates[RES_DARK_MATTER], 10000) * mt_rand(750000, 1000000) / 1000000); |
189 | 189 | |
190 | - if(!$found_dark_matter) { |
|
190 | + if (!$found_dark_matter) { |
|
191 | 191 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
192 | 192 | } |
193 | 193 | break; |
@@ -201,46 +201,45 @@ discard block |
||
201 | 201 | |
202 | 202 | mission_expedition_result_adjust($result, $objFleet); |
203 | 203 | |
204 | - if($found_dark_matter) { |
|
204 | + if ($found_dark_matter) { |
|
205 | 205 | rpg_points_change($objFleet->playerOwnerId, RPG_EXPEDITION, $found_dark_matter, 'Expedition Bonus'); |
206 | 206 | $msg_text_addon = sprintf(classLocale::$lang['flt_mission_expedition']['found_dark_matter'], $found_dark_matter); |
207 | 207 | } |
208 | 208 | |
209 | - if(!empty($fleet_lost)) { |
|
209 | + if (!empty($fleet_lost)) { |
|
210 | 210 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['lost_fleet']; |
211 | - foreach($fleet_lost as $ship_id => $ship_amount) { |
|
212 | - $msg_text_addon .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
|
211 | + foreach ($fleet_lost as $ship_id => $ship_amount) { |
|
212 | + $msg_text_addon .= classLocale::$lang['tech'][$ship_id].' - '.$ship_amount."\r\n"; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
216 | - if(!empty($fleet_found)) { |
|
216 | + if (!empty($fleet_found)) { |
|
217 | 217 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['found_fleet']; |
218 | - foreach($fleet_found as $ship_id => $ship_amount) { |
|
219 | - $msg_text_addon .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
|
218 | + foreach ($fleet_found as $ship_id => $ship_amount) { |
|
219 | + $msg_text_addon .= classLocale::$lang['tech'][$ship_id].' - '.$ship_amount."\r\n"; |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | - if(!empty($resources_found) && array_sum($resources_found) > 0) { |
|
223 | + if (!empty($resources_found) && array_sum($resources_found) > 0) { |
|
224 | 224 | $msg_text_addon = classLocale::$lang['flt_mission_expedition']['found_resources']; |
225 | - foreach($resources_found as $resource_id => $resource_amount) { |
|
226 | - $msg_text_addon .= classLocale::$lang['tech'][$resource_id] . ' - ' . $resource_amount . "\r\n"; |
|
225 | + foreach ($resources_found as $resource_id => $resource_amount) { |
|
226 | + $msg_text_addon .= classLocale::$lang['tech'][$resource_id].' - '.$resource_amount."\r\n"; |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - if(!$msg_text) { |
|
230 | + if (!$msg_text) { |
|
231 | 231 | $messages = &classLocale::$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['messages']; |
232 | - if($outcome_mission_sub >= 0 && is_array($messages)) { |
|
232 | + if ($outcome_mission_sub >= 0 && is_array($messages)) { |
|
233 | 233 | $messages = &$messages[$outcome_mission_sub]; |
234 | 234 | } |
235 | 235 | |
236 | - $msg_text = is_string($messages) ? $messages : |
|
237 | - (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
236 | + $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
238 | 237 | } |
239 | 238 | |
240 | 239 | $fleet_row_end_coordinates_without_type = $objFleet->target_coordinates_without_type(); |
241 | 240 | |
242 | - $msg_text = sprintf($msg_text, $objFleet->dbId, uni_render_coordinates($fleet_row_end_coordinates_without_type)) . |
|
243 | - ($msg_text_addon ? "\r\n" . $msg_text_addon : ''); |
|
241 | + $msg_text = sprintf($msg_text, $objFleet->dbId, uni_render_coordinates($fleet_row_end_coordinates_without_type)). |
|
242 | + ($msg_text_addon ? "\r\n".$msg_text_addon : ''); |
|
244 | 243 | |
245 | 244 | msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_mission_job_complete, MSG_TYPE_EXPLORE, $msg_sender, $msg_title, $msg_text); |
246 | 245 |