@@ -426,8 +426,8 @@ |
||
426 | 426 | protected function getTravelData() { |
427 | 427 | $travel_data = flt_travel_data( |
428 | 428 | $this->getFleetOwnerRecord(), |
429 | - ['galaxy' => $this->fleet_start_galaxy, 'system' => $this->fleet_start_system, 'planet' => $this->fleet_start_planet,], |
|
430 | - ['galaxy' => $this->fleet_end_galaxy, 'system' => $this->fleet_end_system, 'planet' => $this->fleet_end_planet,], |
|
429 | + ['galaxy' => $this->fleet_start_galaxy, 'system' => $this->fleet_start_system, 'planet' => $this->fleet_start_planet, ], |
|
430 | + ['galaxy' => $this->fleet_end_galaxy, 'system' => $this->fleet_end_system, 'planet' => $this->fleet_end_planet, ], |
|
431 | 431 | $this->getShipListArray(), |
432 | 432 | $this->speedPercentTenth |
433 | 433 | ); |
@@ -539,7 +539,7 @@ |
||
539 | 539 | |
540 | 540 | |
541 | 541 | !is_array($resources) ? $resources = [] : false; |
542 | - if(empty($options[P_FLEET_ATTACK_RES_LIST])) { |
|
542 | + if (empty($options[P_FLEET_ATTACK_RES_LIST])) { |
|
543 | 543 | $options[P_FLEET_ATTACK_RES_LIST] = $resources; |
544 | 544 | } |
545 | 545 | $can_attack = flt_can_attack($from, $to, $fleet, $mission, $options); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use Planet\DBStaticPlanet; |
9 | 9 | use Unit\DBStaticUnit; |
10 | 10 | |
11 | -if(SN_IN_FLEET !== true) { |
|
11 | +if (SN_IN_FLEET !== true) { |
|
12 | 12 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
13 | 13 | } |
14 | 14 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $errorlist .= $lang['fl_limit_galaxy']; |
28 | 28 | if (!$system || $system > $config->game_maxSystem || $system < 1) |
29 | 29 | $errorlist .= $lang['fl_limit_system']; |
30 | - if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) |
|
30 | + if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE)) |
|
31 | 31 | $errorlist .= $lang['fl_limit_planet']; |
32 | 32 | if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) |
33 | 33 | $errorlist .= $lang['fl_ownpl_err']; |
@@ -54,35 +54,35 @@ discard block |
||
54 | 54 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
55 | 55 | |
56 | 56 | if ($target_mission == MT_EXPLORE) { |
57 | - if ($MaxExpeditions == 0 ) { |
|
57 | + if ($MaxExpeditions == 0) { |
|
58 | 58 | $errorlist .= $lang['fl_expe_notech']; |
59 | - } elseif ($FlyingExpeditions >= $MaxExpeditions ) { |
|
59 | + } elseif ($FlyingExpeditions >= $MaxExpeditions) { |
|
60 | 60 | $errorlist .= $lang['fl_expe_max']; |
61 | 61 | } |
62 | 62 | } else { |
63 | - if ($TargetPlanet['id_owner']){ |
|
63 | + if ($TargetPlanet['id_owner']) { |
|
64 | 64 | if ($target_mission == MT_COLONIZE) |
65 | 65 | $errorlist .= $lang['fl_colonized']; |
66 | 66 | |
67 | - if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){ |
|
67 | + if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) { |
|
68 | 68 | if ($target_mission == MT_ATTACK) |
69 | 69 | $errorlist .= $lang['fl_no_self_attack']; |
70 | 70 | |
71 | 71 | if ($target_mission == MT_SPY) |
72 | 72 | $errorlist .= $lang['fl_no_self_spy']; |
73 | - }else{ |
|
73 | + } else { |
|
74 | 74 | if ($target_mission == MT_RELOCATE) |
75 | 75 | $errorlist .= $lang['fl_only_stay_at_home']; |
76 | 76 | } |
77 | - }else{ |
|
78 | - if ($target_mission < MT_COLONIZE){ |
|
77 | + } else { |
|
78 | + if ($target_mission < MT_COLONIZE) { |
|
79 | 79 | $errorlist .= $lang['fl_unknow_target']; |
80 | - }else{ |
|
80 | + } else { |
|
81 | 81 | if ($target_mission == MT_DESTROY) |
82 | 82 | $errorlist .= $lang['fl_nomoon']; |
83 | 83 | |
84 | - if ($target_mission == MT_RECYCLE){ |
|
85 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
84 | + if ($target_mission == MT_RECYCLE) { |
|
85 | + if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
86 | 86 | $errorlist .= $lang['fl_nodebris']; |
87 | 87 | } |
88 | 88 | } |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | |
93 | - if(is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) { |
|
93 | + if (is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) { |
|
94 | 94 | $captain = $captainModule->unit_captain_get($planetrow['id']); |
95 | 95 | // mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true); |
96 | - if(!$captain) { |
|
96 | + if (!$captain) { |
|
97 | 97 | $errorlist .= $lang['module_unit_captain_error_no_captain']; |
98 | - } elseif($captain['unit_location_type'] == LOC_PLANET) { |
|
99 | - if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
98 | + } elseif ($captain['unit_location_type'] == LOC_PLANET) { |
|
99 | + if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
100 | 100 | $errorlist .= $lang['module_unit_captain_error_captain_already_bound']; |
101 | 101 | } |
102 | 102 | } else { |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | |
107 | 107 | if ($errorlist) { |
108 | 108 | sn_db_transaction_rollback(); |
109 | - messageBox ("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
109 | + messageBox("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // On verifie s'il y a assez de vaisseaux sur la planete ! |
113 | 113 | foreach ($fleetarray as $Ship => $Count) { |
114 | 114 | if ($Count > mrc_get_level($user, $planetrow, $Ship)) { |
115 | - messageBox ("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
115 | + messageBox("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | $fleet_group = max(0, intval($_POST['fleet_group'])); |
121 | 121 | //But is it acs?? |
122 | 122 | //Well all acs fleets must have a fleet code. |
123 | - if($fleet_group) { |
|
123 | + if ($fleet_group) { |
|
124 | 124 | //Also it must be mission type 2 |
125 | 125 | $target_mission = MT_AKS; |
126 | 126 | |
127 | 127 | //The co-ords must be the same as where the acs fleet is going. |
128 | 128 | $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}"; |
129 | - if($_POST['acs_target_mr'] == $target) { |
|
129 | + if ($_POST['acs_target_mr'] == $target) { |
|
130 | 130 | //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!) |
131 | 131 | $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true); |
132 | 132 | if (!$aks) { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | } |
144 | 144 | //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet. |
145 | - if(!$fleet_group && $target_mission == MT_AKS) { |
|
145 | + if (!$fleet_group && $target_mission == MT_AKS) { |
|
146 | 146 | $target_mission = MT_ATTACK; |
147 | 147 | } |
148 | 148 | |
@@ -152,22 +152,21 @@ discard block |
||
152 | 152 | $options = [P_FLEET_ATTACK_SPEED_PERCENT_TENTH => $speed_percent, P_FLEET_ATTACK_FLEET_GROUP => $fleet_group, P_FLEET_ATTACK_RESOURCES_SUM => $StorageNeeded]; |
153 | 153 | $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options); |
154 | 154 | |
155 | - if($cant_attack !== ATTACK_ALLOWED) { |
|
155 | + if ($cant_attack !== ATTACK_ALLOWED) { |
|
156 | 156 | messageBox("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99); |
157 | 157 | } |
158 | 158 | |
159 | 159 | $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); |
160 | 160 | if (!in_array($speed_percent, $speed_possible)) { |
161 | - messageBox ("<span class='error'><b>". $lang['fl_cheat_speed'] ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
161 | + messageBox("<span class='error'><b>" . $lang['fl_cheat_speed'] . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | $fleet['start_time'] = $duration + SN_TIME_NOW; |
165 | 165 | |
166 | - $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : |
|
167 | - ($target_mission == MT_HOLD ? 12 : 0); |
|
168 | - if($max_duration) { |
|
166 | + $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0); |
|
167 | + if ($max_duration) { |
|
169 | 168 | $StayDuration = sys_get_param_id('missiontime'); |
170 | - if($StayDuration > $max_duration || $StayDuration < 1) { |
|
169 | + if ($StayDuration > $max_duration || $StayDuration < 1) { |
|
171 | 170 | $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true)); |
172 | 171 | die(); |
173 | 172 | } |
@@ -177,11 +176,11 @@ discard block |
||
177 | 176 | $StayDuration = 0; |
178 | 177 | $StayTime = 0; |
179 | 178 | } |
180 | - $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
179 | + $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
181 | 180 | |
182 | - if($aks && $target_mission == MT_AKS) { |
|
183 | - if ($fleet['start_time']>$aks['ankunft']) { |
|
184 | - messageBox ($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME,$fleet['start_time']) . " AKS arrival: " .date(FMT_DATE_TIME,$aks['ankunft']), $lang['fl_error']); |
|
181 | + if ($aks && $target_mission == MT_AKS) { |
|
182 | + if ($fleet['start_time'] > $aks['ankunft']) { |
|
183 | + messageBox($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, $fleet['start_time']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), $lang['fl_error']); |
|
185 | 184 | } |
186 | 185 | $fleet['start_time'] = $aks['ankunft']; |
187 | 186 | $fleet['end_time'] = $aks['ankunft'] + $duration; |
@@ -191,21 +190,21 @@ discard block |
||
191 | 190 | $FleetShipCount = 0; |
192 | 191 | $db_changeset = array(); |
193 | 192 | foreach ($fleetarray as $Ship => $Count) { |
194 | - $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
193 | + $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
195 | 194 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($Ship, -$Count, $user, $planetrow['id']); |
196 | 195 | } |
197 | 196 | $fleet_array = sys_unit_arr2str($fleetarray); |
198 | - $FleetShipCount += array_sum($fleetarray); |
|
199 | - $FleetStorage -= $consumption; |
|
197 | + $FleetShipCount += array_sum($fleetarray); |
|
198 | + $FleetStorage -= $consumption; |
|
200 | 199 | |
201 | - if ( $StorageNeeded > $FleetStorage) { |
|
202 | - messageBox ("<span class='error'><b>". $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
200 | + if ($StorageNeeded > $FleetStorage) { |
|
201 | + messageBox("<span class='error'><b>" . $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
203 | 202 | } |
204 | 203 | if ($planetrow['deuterium'] < $TransDeuterium + $consumption) { |
205 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
204 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
206 | 205 | } |
207 | 206 | if (($planetrow['metal'] < $TransMetal) || ($planetrow['crystal'] < $TransCrystal)) { |
208 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_resources'] ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
207 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_resources'] . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
209 | 208 | } |
210 | 209 | |
211 | 210 | $fleet_set = array( |
@@ -247,7 +246,7 @@ discard block |
||
247 | 246 | // )); |
248 | 247 | // } |
249 | 248 | |
250 | - if(is_array($captain)) { |
|
249 | + if (is_array($captain)) { |
|
251 | 250 | DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}"); |
252 | 251 | } |
253 | 252 | |
@@ -260,7 +259,7 @@ discard block |
||
260 | 259 | 'START_LEFT' => floor($fleet['end_time'] + 1 - SN_TIME_NOW), |
261 | 260 | ); |
262 | 261 | |
263 | - if(!empty($TargetPlanet)) { |
|
262 | + if (!empty($TargetPlanet)) { |
|
264 | 263 | $template_route += array( |
265 | 264 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
266 | 265 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -273,8 +272,8 @@ discard block |
||
273 | 272 | $template->assign_block_vars('fleets', $template_route); |
274 | 273 | |
275 | 274 | $sn_groups_fleet = sn_get_groups('fleet'); |
276 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
277 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
275 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
276 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
278 | 277 | // $ship_base_data = get_ship_data($ship_id, $user); |
279 | 278 | $template->assign_block_vars('fleets.ships', array( |
280 | 279 | 'ID' => $ship_id, |