@@ -73,29 +73,29 @@ discard block |
||
73 | 73 | Constants::K_OUTCOME => Constants::EXPEDITION_OUTCOME_FOUND_FLEET, |
74 | 74 | Constants::K_OUTCOME_TYPE => Constants::OUTCOME_TYPE_GOOD, |
75 | 75 | P_CHANCE => 200, |
76 | - 'percent' => [0 => 0.1, 1 => 0.02, 2 => 0.01,], |
|
76 | + 'percent' => [0 => 0.1, 1 => 0.02, 2 => 0.01, ], |
|
77 | 77 | Constants::K_OUTCOME_SECONDARY => [ |
78 | - [P_CHANCE => 90, P_MULTIPLIER => 0.01, P_MESSAGE_ID => 2,], |
|
79 | - [P_CHANCE => 9, P_MULTIPLIER => 0.02, P_MESSAGE_ID => 1,], |
|
80 | - [P_CHANCE => 1, P_MULTIPLIER => 0.10, P_MESSAGE_ID => 0,], |
|
78 | + [P_CHANCE => 90, P_MULTIPLIER => 0.01, P_MESSAGE_ID => 2, ], |
|
79 | + [P_CHANCE => 9, P_MULTIPLIER => 0.02, P_MESSAGE_ID => 1, ], |
|
80 | + [P_CHANCE => 1, P_MULTIPLIER => 0.10, P_MESSAGE_ID => 0, ], |
|
81 | 81 | ], |
82 | 82 | ], |
83 | 83 | Constants::EXPEDITION_OUTCOME_FOUND_RESOURCES => [ |
84 | 84 | Constants::K_OUTCOME => Constants::EXPEDITION_OUTCOME_FOUND_RESOURCES, |
85 | 85 | Constants::K_OUTCOME_TYPE => Constants::OUTCOME_TYPE_GOOD, |
86 | 86 | P_CHANCE => 300, |
87 | - 'percent' => [0 => 0.1, 1 => 0.050, 2 => 0.025,], |
|
87 | + 'percent' => [0 => 0.1, 1 => 0.050, 2 => 0.025, ], |
|
88 | 88 | Constants::K_OUTCOME_SECONDARY => [ |
89 | - [P_CHANCE => 90, P_MULTIPLIER => 0.025, P_MESSAGE_ID => 2,], |
|
90 | - [P_CHANCE => 9, P_MULTIPLIER => 0.050, P_MESSAGE_ID => 1,], |
|
91 | - [P_CHANCE => 1, P_MULTIPLIER => 0.100, P_MESSAGE_ID => 0,], |
|
89 | + [P_CHANCE => 90, P_MULTIPLIER => 0.025, P_MESSAGE_ID => 2, ], |
|
90 | + [P_CHANCE => 9, P_MULTIPLIER => 0.050, P_MESSAGE_ID => 1, ], |
|
91 | + [P_CHANCE => 1, P_MULTIPLIER => 0.100, P_MESSAGE_ID => 0, ], |
|
92 | 92 | ], |
93 | 93 | ], |
94 | 94 | Constants::EXPEDITION_OUTCOME_FOUND_DM => [ |
95 | 95 | Constants::K_OUTCOME => Constants::EXPEDITION_OUTCOME_FOUND_DM, |
96 | 96 | Constants::K_OUTCOME_TYPE => Constants::OUTCOME_TYPE_GOOD, |
97 | 97 | P_CHANCE => 100, |
98 | - 'percent' => [0 => 0.0100, 1 => 0.0040, 2 => 0.0010,], |
|
98 | + 'percent' => [0 => 0.0100, 1 => 0.0040, 2 => 0.0010, ], |
|
99 | 99 | Constants::K_OUTCOME_SECONDARY => [ |
100 | 100 | [P_CHANCE => 90, P_MULTIPLIER => 0.0010, /*P_MESSAGE_ID => 2,*/], |
101 | 101 | [P_CHANCE => 9, P_MULTIPLIER => 0.0040, /*P_MESSAGE_ID => 1,*/], |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if (!$config[P_CHANCE]) { |
155 | 155 | continue; |
156 | 156 | } |
157 | - $this->outcome = $key1; |
|
157 | + $this->outcome = $key1; |
|
158 | 158 | if ($this->valueRolled <= $config [self::K_ROLL_VALUE]) { |
159 | 159 | break; |
160 | 160 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | if ($found_ship_cost > $found_in_metal) { |
625 | 625 | unset($can_be_found[$found_ship_id]); |
626 | 626 | } else { |
627 | - $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost)); |
|
627 | + $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost)); |
|
628 | 628 | $this->shipsFound[$found_ship_id] += $found_ship_count; |
629 | 629 | $found_in_metal -= $found_ship_count * $found_ship_cost; |
630 | 630 | } |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | public static $processedIPR = -1; |
47 | 47 | |
48 | 48 | public static $MISSIONS = [ |
49 | - MT_ATTACK => [self::IS_TRANSPORT => false, self::IS_ATTACK => true,], |
|
50 | - MT_AKS => [self::IS_TRANSPORT => false, self::IS_ATTACK => true,], |
|
51 | - MT_DESTROY => [self::IS_TRANSPORT => false, self::IS_ATTACK => true,], |
|
52 | - MT_HOLD => [self::IS_TRANSPORT => false,], |
|
53 | - MT_SPY => [self::IS_TRANSPORT => false, self::IS_LOCK_SOURCE => true, 'AJAX' => true,], |
|
54 | - MT_TRANSPORT => [self::IS_TRANSPORT => true, self::IS_LOCK_SOURCE => true,], |
|
55 | - MT_RELOCATE => [self::IS_TRANSPORT => true, self::IS_LOCK_SOURCE => true,], |
|
56 | - MT_RECYCLE => [self::IS_TRANSPORT => false, 'AJAX' => true,], |
|
57 | - MT_EXPLORE => [self::IS_TRANSPORT => false,], |
|
58 | - MT_COLONIZE => [self::IS_TRANSPORT => true,], |
|
59 | - MT_MISSILE => [self::IS_TRANSPORT => false, 'AJAX' => true,], |
|
49 | + MT_ATTACK => [self::IS_TRANSPORT => false, self::IS_ATTACK => true, ], |
|
50 | + MT_AKS => [self::IS_TRANSPORT => false, self::IS_ATTACK => true, ], |
|
51 | + MT_DESTROY => [self::IS_TRANSPORT => false, self::IS_ATTACK => true, ], |
|
52 | + MT_HOLD => [self::IS_TRANSPORT => false, ], |
|
53 | + MT_SPY => [self::IS_TRANSPORT => false, self::IS_LOCK_SOURCE => true, 'AJAX' => true, ], |
|
54 | + MT_TRANSPORT => [self::IS_TRANSPORT => true, self::IS_LOCK_SOURCE => true, ], |
|
55 | + MT_RELOCATE => [self::IS_TRANSPORT => true, self::IS_LOCK_SOURCE => true, ], |
|
56 | + MT_RECYCLE => [self::IS_TRANSPORT => false, 'AJAX' => true, ], |
|
57 | + MT_EXPLORE => [self::IS_TRANSPORT => false, ], |
|
58 | + MT_COLONIZE => [self::IS_TRANSPORT => true, ], |
|
59 | + MT_MISSILE => [self::IS_TRANSPORT => false, 'AJAX' => true, ], |
|
60 | 60 | ]; |
61 | 61 | |
62 | 62 | public function __construct($fleetRow, $eventType) { |
@@ -71,19 +71,18 @@ discard block |
||
71 | 71 | |
72 | 72 | $this->fleetOwnerId = $fleetRow[self::F_FLEET_OWNER_ID]; |
73 | 73 | |
74 | - $this->missionId = (int)$this->fleet[FleetDispatcher::F_FLEET_MISSION]; |
|
74 | + $this->missionId = (int) $this->fleet[FleetDispatcher::F_FLEET_MISSION]; |
|
75 | 75 | $this->missionInfoNew = self::$MISSIONS[$this->missionId]; |
76 | 76 | |
77 | - $this->eventTimeStamp = (int)$this->fleet[$this->event === EVENT_FLT_ARRIVE ? 'fleet_start_time' : |
|
78 | - ($this->event === EVENT_FLT_ACCOMPLISH ? 'fleet_end_stay' : /* EVENT_FLT_RETURN */ |
|
77 | + $this->eventTimeStamp = (int) $this->fleet[$this->event === EVENT_FLT_ARRIVE ? 'fleet_start_time' : ($this->event === EVENT_FLT_ACCOMPLISH ? 'fleet_end_stay' : /* EVENT_FLT_RETURN */ |
|
79 | 78 | 'fleet_end_time')]; |
80 | 79 | |
81 | 80 | /** @var Fleet $fleetObject */ |
82 | - $fleetObject = (object)$this->fleet; |
|
81 | + $fleetObject = (object) $this->fleet; |
|
83 | 82 | |
84 | 83 | // Always locking flying fleet and fleet owner |
85 | - $this->userIdsToLock = [(int)$fleetObject->fleet_owner ?: 0 => true,]; |
|
86 | - $this->fleetIdsToLock = [(int)$fleetObject->fleet_id => true,]; |
|
84 | + $this->userIdsToLock = [(int) $fleetObject->fleet_owner ?: 0 => true, ]; |
|
85 | + $this->fleetIdsToLock = [(int) $fleetObject->fleet_id => true, ]; |
|
87 | 86 | $this->planetIdsToLock = []; |
88 | 87 | |
89 | 88 | // Some locks make sense only on specific event types |
@@ -103,10 +102,10 @@ discard block |
||
103 | 102 | // If the fleet is a part of existing fleet group - locking also fleets in group and their respected owners |
104 | 103 | // Only doing it for EVENT_FLT_ARRIVE - currently no other event types does trigger fleet group actions |
105 | 104 | if (!empty($fleetObject->fleet_group) && $this->event === EVENT_FLT_ARRIVE) { |
106 | - $fleetGroupId = (int)$fleetObject->fleet_group; |
|
105 | + $fleetGroupId = (int) $fleetObject->fleet_group; |
|
107 | 106 | foreach (DbFleetStatic::db_fleet_list("`fleet_group` = {$fleetGroupId}") as $fleetInGroup) { |
108 | - $this->userIdsToLock[(int)$fleetInGroup[self::F_FLEET_OWNER_ID] ?: 0] = true; |
|
109 | - $this->fleetIdsToLock[(int)$fleetInGroup[self::F_FLEET_ID] ?: 0] = true; |
|
107 | + $this->userIdsToLock[(int) $fleetInGroup[self::F_FLEET_OWNER_ID] ?: 0] = true; |
|
108 | + $this->fleetIdsToLock[(int) $fleetInGroup[self::F_FLEET_ID] ?: 0] = true; |
|
110 | 109 | } |
111 | 110 | } |
112 | 111 | |
@@ -129,8 +128,8 @@ discard block |
||
129 | 128 | $this->eventTimeStamp |
130 | 129 | ); |
131 | 130 | foreach ($fleetsOnHold as $aFleet) { |
132 | - $this->userIdsToLock[(int)$aFleet[self::F_FLEET_OWNER_ID] ?: 0] = true; |
|
133 | - $this->fleetIdsToLock[(int)$aFleet[self::F_FLEET_ID] ?: 0] = true; |
|
131 | + $this->userIdsToLock[(int) $aFleet[self::F_FLEET_OWNER_ID] ?: 0] = true; |
|
132 | + $this->fleetIdsToLock[(int) $aFleet[self::F_FLEET_ID] ?: 0] = true; |
|
134 | 133 | } |
135 | 134 | } |
136 | 135 | |
@@ -164,18 +163,14 @@ discard block |
||
164 | 163 | } |
165 | 164 | |
166 | 165 | public static function sortEvents(&$eventList) { |
167 | - uasort($eventList, function (FleetDispatchEvent $a, FleetDispatchEvent $b) { |
|
166 | + uasort($eventList, function(FleetDispatchEvent $a, FleetDispatchEvent $b) { |
|
168 | 167 | return |
169 | 168 | // Сравниваем время флотов - кто раньше, тот и первый обрабатывается |
170 | - $a->eventTimeStamp > $b->eventTimeStamp ? 1 : ($a->eventTimeStamp < $b->eventTimeStamp ? -1 : |
|
171 | - // Если время - одинаковое, сравниваем события флотов |
|
169 | + $a->eventTimeStamp > $b->eventTimeStamp ? 1 : ($a->eventTimeStamp < $b->eventTimeStamp ? -1 : // Если время - одинаковое, сравниваем события флотов |
|
172 | 170 | // Если события - одинаковые, то флоты равны |
173 | - ($a->event == $b->event ? 0 : |
|
174 | - // Если события разные - первыми считаем прибывающие флоты |
|
175 | - ($a->event == EVENT_FLT_ARRIVE ? 1 : ($b->event == EVENT_FLT_ARRIVE ? -1 : |
|
176 | - // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию |
|
177 | - ($a->event == EVENT_FLT_ACCOMPLISH ? 1 : ($b->event == EVENT_FLT_ACCOMPLISH ? -1 : |
|
178 | - // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой |
|
171 | + ($a->event == $b->event ? 0 : // Если события разные - первыми считаем прибывающие флоты |
|
172 | + ($a->event == EVENT_FLT_ARRIVE ? 1 : ($b->event == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию |
|
173 | + ($a->event == EVENT_FLT_ACCOMPLISH ? 1 : ($b->event == EVENT_FLT_ACCOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой |
|
179 | 174 | // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска |
180 | 175 | ( |
181 | 176 | 0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий |
@@ -228,10 +223,10 @@ discard block |
||
228 | 223 | // $this->srcPlanetRow = is_array($srcPlanetRow) ? $srcPlanetRow : DBStaticPlanet::db_planet_by_vector($this->fleet, 'fleet_start_'); |
229 | 224 | $this->srcPlanetRow = $srcPlanetRow; |
230 | 225 | |
231 | - $this->srcPlanetId = !empty($this->srcPlanetRow[self::F_PLANET_ID]) ? (int)$this->srcPlanetRow[self::F_PLANET_ID] : 0; |
|
226 | + $this->srcPlanetId = !empty($this->srcPlanetRow[self::F_PLANET_ID]) ? (int) $this->srcPlanetRow[self::F_PLANET_ID] : 0; |
|
232 | 227 | // Starting planet can change owner while fleet mission - and even change planet ID |
233 | 228 | // It can happen due to teleport shenanigans or because of planet capturing (in certain game modes) |
234 | - $this->fleetOwnerId = !empty($this->srcPlanetRow[self::F_PLANET_OWNER_ID]) ? (int)$this->srcPlanetRow[self::F_PLANET_OWNER_ID] : $this->fleetOwnerId; |
|
229 | + $this->fleetOwnerId = !empty($this->srcPlanetRow[self::F_PLANET_OWNER_ID]) ? (int) $this->srcPlanetRow[self::F_PLANET_OWNER_ID] : $this->fleetOwnerId; |
|
235 | 230 | |
236 | 231 | return $this->srcPlanetRow; |
237 | 232 | } |
@@ -253,9 +248,9 @@ discard block |
||
253 | 248 | public function updateDstPlanetRow($dstPlanetRow = null) { |
254 | 249 | $this->dstPlanetRow = $dstPlanetRow; |
255 | 250 | |
256 | - $this->dstPlanetId = !empty($this->dstPlanetRow[self::F_PLANET_ID]) ? (int)$this->dstPlanetRow[self::F_PLANET_ID] : 0; |
|
251 | + $this->dstPlanetId = !empty($this->dstPlanetRow[self::F_PLANET_ID]) ? (int) $this->dstPlanetRow[self::F_PLANET_ID] : 0; |
|
257 | 252 | // Retrieving destination owner ID |
258 | - $this->dstPlanetOwnerId = !empty($this->dstPlanetRow[self::F_PLANET_OWNER_ID]) ? (int)$this->dstPlanetRow[self::F_PLANET_OWNER_ID] : 0; |
|
253 | + $this->dstPlanetOwnerId = !empty($this->dstPlanetRow[self::F_PLANET_OWNER_ID]) ? (int) $this->dstPlanetRow[self::F_PLANET_OWNER_ID] : 0; |
|
259 | 254 | |
260 | 255 | return $this->dstPlanetRow; |
261 | 256 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | $result = []; |
301 | 301 | while ($row = $this->db_fetch($queryResult)) { |
302 | - $result[] = $asArray ? $row : (object)$row; |
|
302 | + $result[] = $asArray ? $row : (object) $row; |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | return $result; |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | // Detecting primary key name |
783 | 783 | $idFieldName = !empty(static::TABLE_ID_FIELD[$tableName]) ? static::TABLE_ID_FIELD[$tableName] : 'id'; |
784 | 784 | // Making ID mysql-safe |
785 | - array_walk($lockedIds, function (&$id) { $id = idval($id); }); |
|
785 | + array_walk($lockedIds, function(&$id) { $id = idval($id); }); |
|
786 | 786 | /** @noinspection SqlResolve */ |
787 | 787 | $queries[] = "(SELECT 1 FROM `{{{$tableName}}}` WHERE `{$idFieldName}` IN (" . implode(',', $lockedIds) . ") FOR UPDATE)"; |
788 | 788 | } |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | // 'chat' => ['sn_chat_model'], |
36 | 36 | // 'chat_add' => ['sn_chat_add_model'], |
37 | 37 | /** @see Chat::chatModel() */ |
38 | - 'chat' => [Chat::class . '::' . 'chatModel'], |
|
38 | + 'chat' => [Chat::class . '::' . 'chatModel'], |
|
39 | 39 | /** @see Chat::chatAddModel() */ |
40 | - 'chat_add' => [Chat::class . '::' . 'chatAddModel'], |
|
40 | + 'chat_add' => [Chat::class . '::' . 'chatAddModel'], |
|
41 | 41 | |
42 | 42 | /** @see PageImperium::modelStatic() */ |
43 | 43 | 'imperium' => [PageImperium::class . '::' . 'modelStatic'], |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | // 'chat' => ['sn_chat_view'], |
56 | 56 | // 'chat_msg' => ['sn_chat_msg_view'], |
57 | 57 | /** @see Chat::chatView() */ |
58 | - 'chat' => [Chat::class . '::' . 'chatView'], |
|
58 | + 'chat' => [Chat::class . '::' . 'chatView'], |
|
59 | 59 | /** @see Chat::chatMsgView() */ |
60 | - 'chat_msg' => [Chat::class . '::' . 'chatMsgView'], |
|
60 | + 'chat_msg' => [Chat::class . '::' . 'chatMsgView'], |
|
61 | 61 | /** @see Chat::chatFrameView() */ |
62 | - 'chat_frame' => [Chat::class . '::' . 'chatFrameView'], |
|
62 | + 'chat_frame' => [Chat::class . '::' . 'chatFrameView'], |
|
63 | 63 | |
64 | 64 | 'battle_report' => ['sn_battle_report_view'], |
65 | 65 | 'contact' => ['sn_contact_view'], |
@@ -617,14 +617,14 @@ discard block |
||
617 | 617 | ], |
618 | 618 | |
619 | 619 | 'planet_generator' => [ |
620 | - 0 => [ // HomeWorld |
|
620 | + 0 => [// HomeWorld |
|
621 | 621 | 't_max_min' => 40, // Tmax 40 |
622 | 622 | 't_max_max' => 40, |
623 | 623 | 't_delta_min' => 40, // Tmin 0 |
624 | 624 | 't_delta_max' => 40, |
625 | 625 | 'size_min' => $config->initial_fields, |
626 | 626 | 'size_max' => $config->initial_fields, |
627 | - 'core_types' => [PLANET_DENSITY_STANDARD,], |
|
627 | + 'core_types' => [PLANET_DENSITY_STANDARD, ], |
|
628 | 628 | 'planet_images' => ['normaltemp'], |
629 | 629 | ], |
630 | 630 | 1 => [ |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | ], |
855 | 855 | 'planet_images' => ['eis'], |
856 | 856 | ], |
857 | - 16 => [ // Random planet - stranger; -35 avg |
|
857 | + 16 => [// Random planet - stranger; -35 avg |
|
858 | 858 | 't_max_min' => -90, |
859 | 859 | 't_max_max' => +40, |
860 | 860 | 't_delta_min' => 2, |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | PLANET_DENSITY_METAL_PERIDOT, |
875 | 875 | PLANET_DENSITY_METAL_RAW, |
876 | 876 | ], |
877 | - 'planet_images' => ['trocken', 'dschjungel', 'normaltemp', 'wasser', 'eis',], |
|
877 | + 'planet_images' => ['trocken', 'dschjungel', 'normaltemp', 'wasser', 'eis', ], |
|
878 | 878 | ], |
879 | 879 | ], |
880 | 880 | |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_HYDROGEN, |
898 | 898 | UNIT_PLANET_DENSITY_RARITY => 30, // 1, // 40.00, // * 1/121 0,82645 |
899 | 899 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT, |
900 | - UNIT_RESOURCES => [RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10,], |
|
900 | + UNIT_RESOURCES => [RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10, ], |
|
901 | 901 | UNIT_PLANET_DENSITY_MAX_SECTORS => 150, |
902 | 902 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11, |
903 | 903 | ], |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_METHANE, |
907 | 907 | UNIT_PLANET_DENSITY_RARITY => 130, // 6, // 6.67, // * 6,0 4,95868 |
908 | 908 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD, |
909 | - UNIT_RESOURCES => [RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60,], |
|
909 | + UNIT_RESOURCES => [RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60, ], |
|
910 | 910 | UNIT_PLANET_DENSITY_MAX_SECTORS => 200, |
911 | 911 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6, |
912 | 912 | ], |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_WATER, |
916 | 916 | UNIT_PLANET_DENSITY_RARITY => 450, //20, // 2.00, // * 20,0 16,52893 |
917 | 917 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE, |
918 | - UNIT_RESOURCES => [RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20,], |
|
918 | + UNIT_RESOURCES => [RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20, ], |
|
919 | 919 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
920 | 920 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
921 | 921 | ], |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_RAW, |
926 | 926 | UNIT_PLANET_DENSITY_RARITY => 20, // 1, // 40.00, // *1,0 0,82645 |
927 | 927 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT, |
928 | - UNIT_RESOURCES => [RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50,], |
|
928 | + UNIT_RESOURCES => [RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50, ], |
|
929 | 929 | UNIT_PLANET_DENSITY_MAX_SECTORS => 150, |
930 | 930 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11, |
931 | 931 | ], |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_SILICATE, |
935 | 935 | UNIT_PLANET_DENSITY_RARITY => 140, // 5.71, // * 7,0 5,78512 |
936 | 936 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD, |
937 | - UNIT_RESOURCES => [RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85,], |
|
937 | + UNIT_RESOURCES => [RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85, ], |
|
938 | 938 | UNIT_PLANET_DENSITY_MAX_SECTORS => 200, |
939 | 939 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6, |
940 | 940 | ], |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_STONE, |
944 | 944 | UNIT_PLANET_DENSITY_RARITY => 500, // 1.90, // * 21,0 17,35537 |
945 | 945 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE, |
946 | - UNIT_RESOURCES => [RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95,], |
|
946 | + UNIT_RESOURCES => [RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95, ], |
|
947 | 947 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
948 | 948 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
949 | 949 | ], |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_STANDARD, |
954 | 954 | UNIT_PLANET_DENSITY_RARITY => 1000, // 1.0, // * 40,0 33,05785 |
955 | 955 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_NORMAL, |
956 | - UNIT_RESOURCES => [RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00,], |
|
956 | + UNIT_RESOURCES => [RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00, ], |
|
957 | 957 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
958 | 958 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
959 | 959 | ], |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_ORE, |
964 | 964 | UNIT_PLANET_DENSITY_RARITY => 550, // 2.11, // * 19,0 15,70248 |
965 | 965 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE, |
966 | - UNIT_RESOURCES => [RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80,], |
|
966 | + UNIT_RESOURCES => [RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80, ], |
|
967 | 967 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
968 | 968 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
969 | 969 | ], |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_PERIDOT, |
973 | 973 | UNIT_PLANET_DENSITY_RARITY => 120, // 8.00, // * 5,0 4,13223 |
974 | 974 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD, |
975 | - UNIT_RESOURCES => [RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55,], |
|
975 | + UNIT_RESOURCES => [RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55, ], |
|
976 | 976 | UNIT_PLANET_DENSITY_MAX_SECTORS => 200, |
977 | 977 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6, |
978 | 978 | ], |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_RAW, |
982 | 982 | UNIT_PLANET_DENSITY_RARITY => 25, // 40.00, // * 1,0 0,82645 |
983 | 983 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT, |
984 | - UNIT_RESOURCES => [RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25,], |
|
984 | + UNIT_RESOURCES => [RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25, ], |
|
985 | 985 | UNIT_PLANET_DENSITY_MAX_SECTORS => 150, |
986 | 986 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11, |
987 | 987 | ], |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | ], |
1159 | 1159 | |
1160 | 1160 | // Missiles list |
1161 | - UNIT_DEF_MISSILES_STR => [UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,], |
|
1161 | + UNIT_DEF_MISSILES_STR => [UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET, ], |
|
1162 | 1162 | |
1163 | 1163 | // Combat units list |
1164 | 1164 | 'combat' => [ |
@@ -1207,7 +1207,7 @@ discard block |
||
1207 | 1207 | // Resource list |
1208 | 1208 | UNIT_RESOURCES_STR => [0 => 'metal', 1 => 'crystal', 2 => 'deuterium', 3 => 'dark_matter'], |
1209 | 1209 | // Resources all |
1210 | - 'resources_all' => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER,], |
|
1210 | + 'resources_all' => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER, ], |
|
1211 | 1211 | // Resources can be produced on planet |
1212 | 1212 | 'resources_planet' => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY], |
1213 | 1213 | // Resources can be looted from planet |
@@ -1226,13 +1226,13 @@ discard block |
||
1226 | 1226 | ], |
1227 | 1227 | |
1228 | 1228 | // Resources that can be tradeable in market trader AND be a quest_rewards |
1229 | - 'quest_rewards' => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER,], |
|
1229 | + 'quest_rewards' => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER, ], |
|
1230 | 1230 | |
1231 | 1231 | // // Ques list |
1232 | 1232 | // 'ques' => array(QUE_STRUCTURES, QUE_HANGAR, QUE_RESEARCH), |
1233 | 1233 | |
1234 | - 'STAT_COMMON' => [STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE,], |
|
1235 | - 'STAT_PLAYER' => [STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID,], |
|
1234 | + 'STAT_COMMON' => [STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE, ], |
|
1235 | + 'STAT_PLAYER' => [STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID, ], |
|
1236 | 1236 | |
1237 | 1237 | GROUP_GROUP_ID_TO_NAMES => [ |
1238 | 1238 | UNIT_STRUCTURES => 'structures', |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | UNIT_PLANS => 'plans', |
1247 | 1247 | ], |
1248 | 1248 | |
1249 | - GROUP_CAPITAL_BUILDING_BONUS_GROUPS => ['structures', 'defense', 'fleet',], |
|
1249 | + GROUP_CAPITAL_BUILDING_BONUS_GROUPS => ['structures', 'defense', 'fleet', ], |
|
1250 | 1250 | |
1251 | 1251 | GROUP_UNIT_COMBAT_SORT_ORDER => [ |
1252 | 1252 | SHIP_SPY, |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use Planet\DBStaticPlanet; |
10 | 10 | use Unit\DBStaticUnit; |
11 | 11 | |
12 | -if(SN_IN_FLEET !== true) { |
|
12 | +if (SN_IN_FLEET !== true) { |
|
13 | 13 | SN::$debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
14 | 14 | } |
15 | 15 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $errorlist .= $lang['fl_limit_galaxy']; |
30 | 30 | if (!$system || $system > $config->game_maxSystem || $system < 1) |
31 | 31 | $errorlist .= $lang['fl_limit_system']; |
32 | - if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) |
|
32 | + if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE)) |
|
33 | 33 | $errorlist .= $lang['fl_limit_planet']; |
34 | 34 | if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) |
35 | 35 | $errorlist .= $lang['fl_ownpl_err']; |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | |
53 | 53 | // Preparing to lock both source and target users and planets |
54 | 54 | $recordsToLock = [ |
55 | - 'users' => [$user['id'],] + (!empty($TargetPlanet['id_owner']) ? [1 => $TargetPlanet['id_owner'],] : []), |
|
56 | - 'planets' => [$planetrow['id'],] + (!empty($TargetPlanet['id']) ? [1 => $TargetPlanet['id'],] : []), |
|
55 | + 'users' => [$user['id'], ] + (!empty($TargetPlanet['id_owner']) ? [1 => $TargetPlanet['id_owner'], ] : []), |
|
56 | + 'planets' => [$planetrow['id'], ] + (!empty($TargetPlanet['id']) ? [1 => $TargetPlanet['id'], ] : []), |
|
57 | 57 | ]; |
58 | 58 | // Adding incoming aggressive fleets from current user to this planet - to lock those fleets. They will be needed later in bashing check |
59 | 59 | if (!empty($TargetPlanet) && !empty($fleetsBashing = DbFleetStatic::fleet_list_bashing($user['id'], $TargetPlanet))) { |
60 | - foreach($fleetsBashing as $bashingFleet) { |
|
60 | + foreach ($fleetsBashing as $bashingFleet) { |
|
61 | 61 | $recordsToLock['fleets'][] = $bashingFleet['fleet_id']; |
62 | 62 | } |
63 | 63 | } |
@@ -71,35 +71,35 @@ discard block |
||
71 | 71 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
72 | 72 | |
73 | 73 | if ($target_mission == MT_EXPLORE) { |
74 | - if ($MaxExpeditions == 0 ) { |
|
74 | + if ($MaxExpeditions == 0) { |
|
75 | 75 | $errorlist .= $lang['fl_expe_notech']; |
76 | - } elseif ($FlyingExpeditions >= $MaxExpeditions ) { |
|
76 | + } elseif ($FlyingExpeditions >= $MaxExpeditions) { |
|
77 | 77 | $errorlist .= $lang['fl_expe_max']; |
78 | 78 | } |
79 | 79 | } else { |
80 | - if ($TargetPlanet['id_owner']){ |
|
80 | + if ($TargetPlanet['id_owner']) { |
|
81 | 81 | if ($target_mission == MT_COLONIZE) |
82 | 82 | $errorlist .= $lang['fl_colonized']; |
83 | 83 | |
84 | - if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){ |
|
84 | + if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) { |
|
85 | 85 | if ($target_mission == MT_ATTACK) |
86 | 86 | $errorlist .= $lang['fl_no_self_attack']; |
87 | 87 | |
88 | 88 | if ($target_mission == MT_SPY) |
89 | 89 | $errorlist .= $lang['fl_no_self_spy']; |
90 | - }else{ |
|
90 | + } else { |
|
91 | 91 | if ($target_mission == MT_RELOCATE) |
92 | 92 | $errorlist .= $lang['fl_only_stay_at_home']; |
93 | 93 | } |
94 | - }else{ |
|
95 | - if ($target_mission < MT_COLONIZE){ |
|
94 | + } else { |
|
95 | + if ($target_mission < MT_COLONIZE) { |
|
96 | 96 | $errorlist .= $lang['fl_unknow_target']; |
97 | - }else{ |
|
97 | + } else { |
|
98 | 98 | if ($target_mission == MT_DESTROY) |
99 | 99 | $errorlist .= $lang['fl_nomoon']; |
100 | 100 | |
101 | - if ($target_mission == MT_RECYCLE){ |
|
102 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
101 | + if ($target_mission == MT_RECYCLE) { |
|
102 | + if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
103 | 103 | $errorlist .= $lang['fl_nodebris']; |
104 | 104 | } |
105 | 105 | } |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | - if(is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) { |
|
110 | + if (is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) { |
|
111 | 111 | $captain = $captainModule->unit_captain_get($planetrow['id']); |
112 | 112 | // mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true); |
113 | - if(!$captain) { |
|
113 | + if (!$captain) { |
|
114 | 114 | $errorlist .= $lang['module_unit_captain_error_no_captain']; |
115 | - } elseif($captain['unit_location_type'] == LOC_PLANET) { |
|
116 | - if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
115 | + } elseif ($captain['unit_location_type'] == LOC_PLANET) { |
|
116 | + if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
117 | 117 | $errorlist .= $lang['module_unit_captain_error_captain_already_bound']; |
118 | 118 | } |
119 | 119 | } else { |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | $fleet_group = max(0, intval($_POST['fleet_group'])); |
138 | 138 | //But is it acs?? |
139 | 139 | //Well all acs fleets must have a fleet code. |
140 | - if($fleet_group) { |
|
140 | + if ($fleet_group) { |
|
141 | 141 | //Also it must be mission type 2 |
142 | 142 | $target_mission = MT_AKS; |
143 | 143 | |
144 | 144 | //The co-ords must be the same as where the acs fleet is going. |
145 | 145 | $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}"; |
146 | - if($_POST['acs_target_mr'] == $target) { |
|
146 | + if ($_POST['acs_target_mr'] == $target) { |
|
147 | 147 | //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!) |
148 | 148 | $aks = DbFleetStatic::dbAcsGetById($fleet_group); |
149 | 149 | if (!$aks) { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet. |
162 | - if(!$fleet_group && $target_mission == MT_AKS) { |
|
162 | + if (!$fleet_group && $target_mission == MT_AKS) { |
|
163 | 163 | $target_mission = MT_ATTACK; |
164 | 164 | } |
165 | 165 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $options = [P_FLEET_ATTACK_SPEED_PERCENT_TENTH => $speed_percent, P_FLEET_ATTACK_FLEET_GROUP => $fleet_group, P_FLEET_ATTACK_RESOURCES_SUM => $StorageNeeded]; |
170 | 170 | $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options); |
171 | 171 | |
172 | - if($cant_attack !== ATTACK_ALLOWED) { |
|
172 | + if ($cant_attack !== ATTACK_ALLOWED) { |
|
173 | 173 | SnTemplate::messageBox("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99); |
174 | 174 | } |
175 | 175 | |
@@ -180,11 +180,10 @@ discard block |
||
180 | 180 | |
181 | 181 | $fleet['start_time'] = $duration + SN_TIME_NOW; |
182 | 182 | |
183 | - $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : |
|
184 | - ($target_mission == MT_HOLD ? 12 : 0); |
|
185 | - if($max_duration) { |
|
183 | + $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0); |
|
184 | + if ($max_duration) { |
|
186 | 185 | $StayDuration = sys_get_param_id('missiontime'); |
187 | - if($StayDuration > $max_duration || $StayDuration < 1) { |
|
186 | + if ($StayDuration > $max_duration || $StayDuration < 1) { |
|
188 | 187 | SN::$debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true)); |
189 | 188 | die(); |
190 | 189 | } |
@@ -194,10 +193,10 @@ discard block |
||
194 | 193 | $StayDuration = 0; |
195 | 194 | $StayTime = 0; |
196 | 195 | } |
197 | - $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
196 | + $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
198 | 197 | |
199 | - if($aks && $target_mission == MT_AKS) { |
|
200 | - if ($fleet['start_time']>$aks['ankunft']) { |
|
198 | + if ($aks && $target_mission == MT_AKS) { |
|
199 | + if ($fleet['start_time'] > $aks['ankunft']) { |
|
201 | 200 | SnTemplate::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']); |
202 | 201 | } |
203 | 202 | $fleet['start_time'] = $aks['ankunft']; |
@@ -208,14 +207,14 @@ discard block |
||
208 | 207 | $FleetShipCount = 0; |
209 | 208 | $db_changeset = array(); |
210 | 209 | foreach ($fleetarray as $Ship => $Count) { |
211 | - $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
210 | + $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
212 | 211 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($Ship, -$Count, $user, $planetrow['id']); |
213 | 212 | } |
214 | 213 | $fleet_array = sys_unit_arr2str($fleetarray); |
215 | - $FleetShipCount += array_sum($fleetarray); |
|
216 | - $FleetStorage -= $consumption; |
|
214 | + $FleetShipCount += array_sum($fleetarray); |
|
215 | + $FleetStorage -= $consumption; |
|
217 | 216 | |
218 | - if ( $StorageNeeded > $FleetStorage) { |
|
217 | + if ($StorageNeeded > $FleetStorage) { |
|
219 | 218 | SnTemplate::messageBox("<span class='error'><b>" . $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
220 | 219 | } |
221 | 220 | if ($planetrow['deuterium'] < $TransDeuterium + $consumption) { |
@@ -264,7 +263,7 @@ discard block |
||
264 | 263 | // )); |
265 | 264 | // } |
266 | 265 | |
267 | - if(is_array($captain)) { |
|
266 | + if (is_array($captain)) { |
|
268 | 267 | DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}"); |
269 | 268 | } |
270 | 269 | |
@@ -277,7 +276,7 @@ discard block |
||
277 | 276 | 'START_LEFT' => floor($fleet['end_time'] + 1 - SN_TIME_NOW), |
278 | 277 | ); |
279 | 278 | |
280 | - if(!empty($TargetPlanet)) { |
|
279 | + if (!empty($TargetPlanet)) { |
|
281 | 280 | $template_route += array( |
282 | 281 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
283 | 282 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -290,8 +289,8 @@ discard block |
||
290 | 289 | $template->assign_block_vars('fleets', $template_route); |
291 | 290 | |
292 | 291 | $sn_groups_fleet = sn_get_groups('fleet'); |
293 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
294 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
292 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
293 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
295 | 294 | // $ship_base_data = get_ship_data($ship_id, $user); |
296 | 295 | $template->assign_block_vars('fleets.ships', array( |
297 | 296 | 'ID' => $ship_id, |
@@ -25,18 +25,24 @@ discard block |
||
25 | 25 | $errorlist .= !is_array($fleetarray) ? $lang['fl_no_fleetarray'] : ''; |
26 | 26 | |
27 | 27 | $errorlist = ''; |
28 | - if (!$galaxy || $galaxy > $config->game_maxGalaxy || $galaxy < 1) |
|
29 | - $errorlist .= $lang['fl_limit_galaxy']; |
|
30 | - if (!$system || $system > $config->game_maxSystem || $system < 1) |
|
31 | - $errorlist .= $lang['fl_limit_system']; |
|
32 | - if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) |
|
33 | - $errorlist .= $lang['fl_limit_planet']; |
|
34 | - if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) |
|
35 | - $errorlist .= $lang['fl_ownpl_err']; |
|
36 | - if (!$planet_type) |
|
37 | - $errorlist .= $lang['fl_no_planettype']; |
|
38 | - if ($planet_type != PT_PLANET && $planet_type != PT_DEBRIS && $planet_type != PT_MOON) |
|
39 | - $errorlist .= $lang['fl_fleet_err_pl']; |
|
28 | + if (!$galaxy || $galaxy > $config->game_maxGalaxy || $galaxy < 1) { |
|
29 | + $errorlist .= $lang['fl_limit_galaxy']; |
|
30 | + } |
|
31 | + if (!$system || $system > $config->game_maxSystem || $system < 1) { |
|
32 | + $errorlist .= $lang['fl_limit_system']; |
|
33 | + } |
|
34 | + if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) { |
|
35 | + $errorlist .= $lang['fl_limit_planet']; |
|
36 | + } |
|
37 | + if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) { |
|
38 | + $errorlist .= $lang['fl_ownpl_err']; |
|
39 | + } |
|
40 | + if (!$planet_type) { |
|
41 | + $errorlist .= $lang['fl_no_planettype']; |
|
42 | + } |
|
43 | + if ($planet_type != PT_PLANET && $planet_type != PT_DEBRIS && $planet_type != PT_MOON) { |
|
44 | + $errorlist .= $lang['fl_fleet_err_pl']; |
|
45 | + } |
|
40 | 46 | if (empty($missiontype[$target_mission])) { |
41 | 47 | $errorlist .= $lang['fl_bad_mission']; |
42 | 48 | } |
@@ -78,29 +84,35 @@ discard block |
||
78 | 84 | } |
79 | 85 | } else { |
80 | 86 | if ($TargetPlanet['id_owner']){ |
81 | - if ($target_mission == MT_COLONIZE) |
|
82 | - $errorlist .= $lang['fl_colonized']; |
|
87 | + if ($target_mission == MT_COLONIZE) { |
|
88 | + $errorlist .= $lang['fl_colonized']; |
|
89 | + } |
|
83 | 90 | |
84 | 91 | if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){ |
85 | - if ($target_mission == MT_ATTACK) |
|
86 | - $errorlist .= $lang['fl_no_self_attack']; |
|
87 | - |
|
88 | - if ($target_mission == MT_SPY) |
|
89 | - $errorlist .= $lang['fl_no_self_spy']; |
|
90 | - }else{ |
|
91 | - if ($target_mission == MT_RELOCATE) |
|
92 | - $errorlist .= $lang['fl_only_stay_at_home']; |
|
92 | + if ($target_mission == MT_ATTACK) { |
|
93 | + $errorlist .= $lang['fl_no_self_attack']; |
|
94 | + } |
|
95 | + |
|
96 | + if ($target_mission == MT_SPY) { |
|
97 | + $errorlist .= $lang['fl_no_self_spy']; |
|
98 | + } |
|
99 | + } else{ |
|
100 | + if ($target_mission == MT_RELOCATE) { |
|
101 | + $errorlist .= $lang['fl_only_stay_at_home']; |
|
102 | + } |
|
93 | 103 | } |
94 | - }else{ |
|
104 | + } else{ |
|
95 | 105 | if ($target_mission < MT_COLONIZE){ |
96 | 106 | $errorlist .= $lang['fl_unknow_target']; |
97 | - }else{ |
|
98 | - if ($target_mission == MT_DESTROY) |
|
99 | - $errorlist .= $lang['fl_nomoon']; |
|
107 | + } else{ |
|
108 | + if ($target_mission == MT_DESTROY) { |
|
109 | + $errorlist .= $lang['fl_nomoon']; |
|
110 | + } |
|
100 | 111 | |
101 | 112 | if ($target_mission == MT_RECYCLE){ |
102 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
103 | - $errorlist .= $lang['fl_nodebris']; |
|
113 | + if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) { |
|
114 | + $errorlist .= $lang['fl_nodebris']; |
|
115 | + } |
|
104 | 116 | } |
105 | 117 | } |
106 | 118 | } |
@@ -148,8 +160,7 @@ discard block |
||
148 | 160 | $aks = DbFleetStatic::dbAcsGetById($fleet_group); |
149 | 161 | if (!$aks) { |
150 | 162 | $fleet_group = 0; |
151 | - } |
|
152 | - else |
|
163 | + } else |
|
153 | 164 | { |
154 | 165 | $galaxy = $aks['galaxy']; |
155 | 166 | $system = $aks['system']; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | use Fleet\Constants; |
29 | 29 | |
30 | 30 | if (!defined('INSIDE')) { |
31 | - die('Hack attempt!'); |
|
31 | + die('Hack attempt!'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | global $config; |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | db_mysql::db_transaction_start(); |
59 | 59 | // Locking all necessary user/planet records |
60 | 60 | SN::$gc->db->lockRecords([ |
61 | - 'users' => [$user['id'],] + (!empty($enemy['id']) ? [1 => $enemy['id'],] : []), |
|
62 | - 'planets' => [$user['current_planet'],] + (!empty($target_row['id']) ? [1 => $target_row['id'],] : []), |
|
61 | + 'users' => [$user['id'], ] + (!empty($enemy['id']) ? [1 => $enemy['id'], ] : []), |
|
62 | + 'planets' => [$user['current_planet'], ] + (!empty($target_row['id']) ? [1 => $target_row['id'], ] : []), |
|
63 | 63 | ]); |
64 | 64 | |
65 | 65 | $user = db_user_by_id($user['id'], true); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | //$ships_sent_js = array(); |
178 | 178 | $ships_sent_js = 0; |
179 | 179 | foreach ($fleet_array as $unit_id => $unit_count) { |
180 | - $ships_sent[] = "{$unit_count} {$lang['tech'][$unit_id]}"; |
|
180 | + $ships_sent[] = "{$unit_count} {$lang['tech'][$unit_id]}"; |
|
181 | 181 | $ships_sent_js += mrc_get_level($user, $planetrow, $unit_id, false, true); |
182 | 182 | } |
183 | 183 | $ships_sent = implode(', ', $ships_sent); |