@@ -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 | } |
@@ -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;"; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | function flt_mission_destroy($mission_data) { |
11 | 11 | $fleet_row = $mission_data['fleet']; |
12 | 12 | $destination_planet = $mission_data['dst_planet']; |
13 | - if(!$destination_planet || !is_array($destination_planet) || $destination_planet['planet_type'] != PT_MOON) { |
|
13 | + if (!$destination_planet || !is_array($destination_planet) || $destination_planet['planet_type'] != PT_MOON) { |
|
14 | 14 | DbFleetStatic::fleet_send_back($fleet_row); |
15 | 15 | |
16 | 16 | return CACHE_FLEET; |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | function flt_mission_hold(&$mission_data) |
6 | 6 | { |
7 | - if($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
|
7 | + if ($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
|
8 | 8 | { |
9 | 9 | DbFleetStatic::fleet_send_back($mission_data['fleet']); |
10 | 10 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"); |
@@ -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 | } |
@@ -3,18 +3,18 @@ discard block |
||
3 | 3 | use Fleet\DbFleetStatic; |
4 | 4 | use Planet\DBStaticPlanet; |
5 | 5 | |
6 | -if(SN_IN_FLEET !== true) { |
|
6 | +if (SN_IN_FLEET !== true) { |
|
7 | 7 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
8 | 8 | } |
9 | 9 | |
10 | 10 | $fleetid = sys_get_param_id('fleetid'); |
11 | 11 | |
12 | -if(!is_numeric($fleetid) || empty($fleetid)) { |
|
12 | +if (!is_numeric($fleetid) || empty($fleetid)) { |
|
13 | 13 | sys_redirect("fleet.php"); |
14 | 14 | } |
15 | 15 | |
16 | 16 | $fleet = DbFleetStatic::db_fleet_get($fleetid); |
17 | -if(!$fleet) { |
|
17 | +if (!$fleet) { |
|
18 | 18 | messageBox($lang['fl_fleet_not_exists'], $lang['fl_error']); |
19 | 19 | } |
20 | 20 | //$query = doquery("SELECT * FROM `{{fleets}}` WHERE fleet_id = '{$fleetid}'"); |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | messageBox($lang['fl_isback'], $lang['fl_error']); |
29 | 29 | } |
30 | 30 | |
31 | -if($fleet['fleet_owner'] != $user['id']) { |
|
32 | - $debug->warning($lang['fl_aks_hack_wrong_fleet'],'Wrong Fleet Owner',301); |
|
31 | +if ($fleet['fleet_owner'] != $user['id']) { |
|
32 | + $debug->warning($lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301); |
|
33 | 33 | messageBox($lang['fl_aks_hack_wrong_fleet'], $lang['fl_error']); |
34 | 34 | } |
35 | 35 | |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | |
40 | 40 | !$aks && !$userToAdd_unsafe ? $userToAdd_unsafe = $user['username'] : false; |
41 | 41 | |
42 | -if($userToAdd_unsafe) { |
|
42 | +if ($userToAdd_unsafe) { |
|
43 | 43 | $userToAdd = db_escape($userToAdd_unsafe); |
44 | 44 | $userToAddID = db_user_by_username($userToAdd_unsafe, true); |
45 | 45 | $userToAddID = $userToAddID['id']; |
46 | 46 | |
47 | - if($fleet['fleet_target_owner'] == $userToAddID) { |
|
47 | + if ($fleet['fleet_target_owner'] == $userToAddID) { |
|
48 | 48 | messageBox($lang['flt_aks_player_same'], $lang['fl_error']); |
49 | 49 | } |
50 | 50 | |
51 | - if($userToAddID) { |
|
52 | - if(!$aks) { |
|
51 | + if ($userToAddID) { |
|
52 | + if (!$aks) { |
|
53 | 53 | // No AСS exists - making one |
54 | - if(!$fleet['fleet_group']) { |
|
54 | + if (!$fleet['fleet_group']) { |
|
55 | 55 | doquery("INSERT INTO {{aks}} SET |
56 | 56 | `name` = '" . db_escape($lang['flt_acs_prefix'] . $fleetid) . "', |
57 | 57 | `teilnehmer` = '" . $user['id'] . "', |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | `planet` = '" . $fleet['fleet_end_planet'] . "', |
63 | 63 | `planet_type` = '" . $fleet['fleet_end_type'] . "', |
64 | 64 | `eingeladen` = '" . $user['id'] . "', |
65 | - `fleet_end_time` = '" . $fleet['fleet_end_time']. "'"); |
|
65 | + `fleet_end_time` = '" . $fleet['fleet_end_time'] . "'"); |
|
66 | 66 | |
67 | 67 | $aks = doquery("SELECT * FROM {{aks}} WHERE `flotten` = {$fleetid} LIMIT 1;", true); |
68 | 68 | |
@@ -80,26 +80,26 @@ discard block |
||
80 | 80 | |
81 | 81 | $isUserExists = false; |
82 | 82 | $invited_ar = explode(",", $aks['eingeladen']); |
83 | - foreach($invited_ar as $inv) { |
|
83 | + foreach ($invited_ar as $inv) { |
|
84 | 84 | if ($userToAddID == $inv) { |
85 | 85 | $isUserExists = true; |
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | - if(count($invited_ar) >= 5) { |
|
89 | + if (count($invited_ar) >= 5) { |
|
90 | 90 | messageBox($lang['flt_aks_error_too_much_players'], $lang['fl_error']); |
91 | 91 | } |
92 | 92 | |
93 | - if($isUserExists) { |
|
93 | + if ($isUserExists) { |
|
94 | 94 | $userToAdd_unsafe != $user['username'] ? $add_user_message_mr = sprintf($lang['fl_aks_player_invited_already'], $userToAdd) : false; |
95 | 95 | } else { |
96 | 96 | $add_user_message_mr = sprintf($lang['fl_aks_player_invited'], $userToAdd); |
97 | 97 | doquery("UPDATE `{{aks}}` SET `eingeladen` = concat(`eingeladen`, ',{$userToAddID}') WHERE `flotten` = {$fleetid};") |
98 | - or die(sprintf($lang['fl_aks_adding_error'],db_error())); |
|
98 | + or die(sprintf($lang['fl_aks_adding_error'], db_error())); |
|
99 | 99 | $aks['eingeladen'] .= ',' . $userToAddID; |
100 | 100 | } |
101 | - msg_send_simple_message ( $userToAddID, $user['id'], SN_TIME_NOW, MSG_TYPE_COMBAT, $user['username'], |
|
102 | - $lang['fl_aks_invite_message_header'], sprintf( $lang['fl_aks_invite_message'], $user['username'])); |
|
101 | + msg_send_simple_message($userToAddID, $user['id'], SN_TIME_NOW, MSG_TYPE_COMBAT, $user['username'], |
|
102 | + $lang['fl_aks_invite_message_header'], sprintf($lang['fl_aks_invite_message'], $user['username'])); |
|
103 | 103 | } else { |
104 | 104 | $add_user_message_mr = sprintf($lang['fl_aks_player_error'], $userToAdd); |
105 | 105 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | 'MISSION_NAME' => $lang['type_mission'][MT_AKS], |
114 | 114 | )); |
115 | 115 | |
116 | -if($aks['eingeladen'] && is_array($members = SN::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
117 | - foreach($members as $row) { |
|
116 | +if ($aks['eingeladen'] && is_array($members = SN::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
117 | + foreach ($members as $row) { |
|
118 | 118 | $template->assign_block_vars('invited', array( |
119 | 119 | 'NAME' => $row['username'], |
120 | 120 | )); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $i++; |
125 | 125 | $fleet_row = DbFleetStatic::db_fleet_get($fleetid); |
126 | 126 | |
127 | -if(is_array($fleet_row) && !empty($fleet_row)) { |
|
127 | +if (is_array($fleet_row) && !empty($fleet_row)) { |
|
128 | 128 | $planet_start = DBStaticPlanet::db_planet_by_id($fleet_row['fleet_start_planet_id']); |
129 | 129 | $fleet_row['fleet_start_name'] = !empty($planet_start['name']) ? $planet_start['name'] : ''; |
130 | 130 | $planet_end = DBStaticPlanet::db_planet_by_id($fleet_row['fleet_end_planet_id']); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | $fleet_data = tpl_parse_fleet_db($fleet_row, $i, $user); |
134 | 134 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
135 | -foreach($fleet_data['ships'] as $ship_data) { |
|
135 | +foreach ($fleet_data['ships'] as $ship_data) { |
|
136 | 136 | $template->assign_block_vars('fleets.ships', $ship_data); |
137 | 137 | } |
138 | 138 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @inheritdoc |
90 | 90 | */ |
91 | 91 | public function update() { |
92 | - if($this->getShipCount() < 1) { |
|
92 | + if ($this->getShipCount() < 1) { |
|
93 | 93 | return $this->delete(); |
94 | 94 | } else { |
95 | 95 | return parent::update(); |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | |
154 | 154 | $shipCount = floor($shipCount); |
155 | 155 | |
156 | - if($this->shipList[$shipSnId] + $shipCount < 0) { |
|
156 | + if ($this->shipList[$shipSnId] + $shipCount < 0) { |
|
157 | 157 | throw new \Exception("Trying to deduct more ships [{$shipSnId}] '{$shipCount}' when fleet [{$this->id}] has only {$this->shipList[$shipSnId]}"); |
158 | 158 | } |
159 | 159 | |
160 | 160 | $this->shipList[$shipSnId] += $shipCount; |
161 | - if($this->shipList[$shipSnId] < 1) { |
|
161 | + if ($this->shipList[$shipSnId] < 1) { |
|
162 | 162 | unset($this->shipList[$shipSnId]); |
163 | 163 | } |
164 | 164 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $resourceCount = ceil($resourceCount); |
185 | 185 | |
186 | - if($this->resources[$resourceId] + $resourceCount < 0) { |
|
186 | + if ($this->resources[$resourceId] + $resourceCount < 0) { |
|
187 | 187 | throw new \Exception("FLEET ERROR! Trying to deduct more resources [{$resourceId}] '{$resourceCount}' when fleet [{$this->id}] has only {$this->resources[$resourceId]}"); |
188 | 188 | } |
189 | 189 |
@@ -379,7 +379,7 @@ |
||
379 | 379 | public function dbLoadRecord($id) { |
380 | 380 | $result = parent::dbLoadRecord($id); |
381 | 381 | |
382 | - if(!$this->isNew()) { |
|
382 | + if (!$this->isNew()) { |
|
383 | 383 | $this->resources[RES_METAL] = $this->_getContainer()->metal; |
384 | 384 | $this->resources[RES_CRYSTAL] = $this->_getContainer()->crystal; |
385 | 385 | $this->resources[RES_DEUTERIUM] = $this->_getContainer()->deuterium; |
@@ -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 | ); |