@@ -814,6 +814,9 @@ discard block |
||
814 | 814 | return max(0, $this->shipsGetCapacity() - $this->resourcesGetTotal()); |
815 | 815 | } |
816 | 816 | |
817 | + /** |
|
818 | + * @param integer $ship_id |
|
819 | + */ |
|
817 | 820 | public function shipsGetTotalById($ship_id) { |
818 | 821 | return $this->unitList->unitsCountById($ship_id); |
819 | 822 | } |
@@ -928,7 +931,7 @@ discard block |
||
928 | 931 | /** |
929 | 932 | * Set current resource list from array of units |
930 | 933 | * |
931 | - * @param array $resource_list |
|
934 | + * @param integer[] $resource_list |
|
932 | 935 | */ |
933 | 936 | public function resourcesSet($resource_list) { |
934 | 937 | if(!empty($this->propertiesAdjusted['resource_list'])) { |
@@ -973,7 +976,7 @@ discard block |
||
973 | 976 | } |
974 | 977 | |
975 | 978 | /** |
976 | - * @param array $rate |
|
979 | + * @param integer[] $rate |
|
977 | 980 | * |
978 | 981 | * @return float |
979 | 982 | */ |
@@ -1004,7 +1007,6 @@ discard block |
||
1004 | 1007 | * Restores fleet or resources to planet |
1005 | 1008 | * |
1006 | 1009 | * @param bool $start |
1007 | - * @param bool $only_resources |
|
1008 | 1010 | * @param int $result |
1009 | 1011 | * |
1010 | 1012 | * @return int |
@@ -1055,7 +1057,7 @@ discard block |
||
1055 | 1057 | /** |
1056 | 1058 | * @param int $speed_percent |
1057 | 1059 | * |
1058 | - * @return array |
|
1060 | + * @return integer |
|
1059 | 1061 | */ |
1060 | 1062 | protected function flt_travel_data($speed_percent = 10) { |
1061 | 1063 | $distance = $this->targetVector->distanceFromCoordinates($this->dbSourcePlanetRow); |
@@ -1157,6 +1159,9 @@ discard block |
||
1157 | 1159 | } |
1158 | 1160 | } |
1159 | 1161 | |
1162 | + /** |
|
1163 | + * @param integer $errorCode |
|
1164 | + */ |
|
1160 | 1165 | public function restrictToTypePlanet($errorCode) { |
1161 | 1166 | if($this->targetVector->type != PT_PLANET) { |
1162 | 1167 | throw new Exception($errorCode, $errorCode); |
@@ -2558,6 +2563,9 @@ discard block |
||
2558 | 2563 | return $result; |
2559 | 2564 | } |
2560 | 2565 | |
2566 | + /** |
|
2567 | + * @param integer $missionType |
|
2568 | + */ |
|
2561 | 2569 | protected function checkMission($missionType) { |
2562 | 2570 | $result = !$this->_mission_type || $this->_mission_type == $missionType; |
2563 | 2571 | if($result) { |
@@ -2571,6 +2579,9 @@ discard block |
||
2571 | 2579 | return $result; |
2572 | 2580 | } |
2573 | 2581 | |
2582 | + /** |
|
2583 | + * @param integer $missionType |
|
2584 | + */ |
|
2574 | 2585 | protected function checkMissionNonRestrict($missionType) { |
2575 | 2586 | return $this->_mission_type == $missionType; |
2576 | 2587 | } |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | public function renderAvailableShips(&$template_result, $playerRow, $planetRow) { |
310 | 310 | $record_index = 0; |
311 | 311 | $ship_list = array(); |
312 | - foreach(sn_get_groups('fleet') as $n => $unit_id) { |
|
312 | + foreach (sn_get_groups('fleet') as $n => $unit_id) { |
|
313 | 313 | $unit_level = mrc_get_level($playerRow, $planetRow, $unit_id, false, true); |
314 | - if($unit_level <= 0) { |
|
314 | + if ($unit_level <= 0) { |
|
315 | 315 | continue; |
316 | 316 | } |
317 | 317 | $ship_data = get_ship_data($unit_id, $playerRow); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | sortUnitRenderedList($ship_list, classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT], classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE]); |
334 | 334 | |
335 | - foreach($ship_list as $ship_data) { |
|
335 | + foreach ($ship_list as $ship_data) { |
|
336 | 336 | $template_result['.']['ships'][] = $ship_data; |
337 | 337 | } |
338 | 338 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | public function dbInsert() { |
352 | 352 | // WARNING! MISSION TIMES MUST BE SET WITH set_times() method! |
353 | 353 | // TODO - more checks! |
354 | - if(empty($this->_time_launch)) { |
|
354 | + if (empty($this->_time_launch)) { |
|
355 | 355 | die('Fleet time not set!'); |
356 | 356 | } |
357 | 357 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | // Записываем изменения в БД |
561 | 561 | $this->dbSave(); |
562 | 562 | |
563 | - if($this->_group_id) { |
|
563 | + if ($this->_group_id) { |
|
564 | 564 | // TODO: Make here to delete only one AKS - by adding aks_fleet_count to AKS table |
565 | 565 | db_fleet_aks_purge(); |
566 | 566 | } |
@@ -627,18 +627,18 @@ discard block |
||
627 | 627 | */ |
628 | 628 | // TODO - separate shipList and unitList |
629 | 629 | public function unitsSetFromArray($unit_array) { |
630 | - if(empty($unit_array) || !is_array($unit_array)) { |
|
630 | + if (empty($unit_array) || !is_array($unit_array)) { |
|
631 | 631 | return; |
632 | 632 | } |
633 | - foreach($unit_array as $unit_id => $unit_count) { |
|
633 | + foreach ($unit_array as $unit_id => $unit_count) { |
|
634 | 634 | $unit_count = floatval($unit_count); |
635 | - if(!$unit_count) { |
|
635 | + if (!$unit_count) { |
|
636 | 636 | continue; |
637 | 637 | } |
638 | 638 | |
639 | - if($this->isShip($unit_id)) { |
|
639 | + if ($this->isShip($unit_id)) { |
|
640 | 640 | $this->unitList->unitSetCount($unit_id, $unit_count); |
641 | - } elseif($this->isResource($unit_id)) { |
|
641 | + } elseif ($this->isResource($unit_id)) { |
|
642 | 642 | $this->resource_list[$unit_id] = $unit_count; |
643 | 643 | } else { |
644 | 644 | throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), ERR_ERROR); |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | public function parse_missile_db_row($missile_db_row) { |
668 | 668 | // $this->_reset(); |
669 | 669 | |
670 | - if(empty($missile_db_row) || !is_array($missile_db_row)) { |
|
670 | + if (empty($missile_db_row) || !is_array($missile_db_row)) { |
|
671 | 671 | return; |
672 | 672 | } |
673 | 673 | |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | public function shipsGetCapacityRecyclers(array $recycler_info) { |
831 | 831 | $recyclers_incoming_capacity = 0; |
832 | 832 | $fleet_data = $this->shipsGetArray(); |
833 | - foreach($recycler_info as $recycler_id => $recycler_data) { |
|
833 | + foreach ($recycler_info as $recycler_id => $recycler_data) { |
|
834 | 834 | $recyclers_incoming_capacity += $fleet_data[$recycler_id] * $recycler_data['capacity']; |
835 | 835 | } |
836 | 836 | |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | sn_db_transaction_check(true); |
851 | 851 | |
852 | 852 | // Если флот уже обработан - не существует или возращается - тогда ничего не делаем |
853 | - if($this->isEmpty()) { |
|
853 | + if ($this->isEmpty()) { |
|
854 | 854 | return $result; |
855 | 855 | } |
856 | 856 | |
@@ -872,18 +872,18 @@ discard block |
||
872 | 872 | // TODO - Проверка, что планета всё еще существует на указанных координатах, а не телепортировалась, не удалена хозяином, не уничтожена врагом |
873 | 873 | // Флот, который возвращается на захваченную планету, пропадает |
874 | 874 | // Ship landing is possible only to fleet owner's planet |
875 | - if($this->getPlayerOwnerId() == $planet_arrival['id_owner']) { |
|
875 | + if ($this->getPlayerOwnerId() == $planet_arrival['id_owner']) { |
|
876 | 876 | $db_changeset = array(); |
877 | 877 | |
878 | 878 | $fleet_array = $this->shipsGetArray(); |
879 | - foreach($fleet_array as $ship_id => $ship_count) { |
|
880 | - if($ship_count) { |
|
879 | + foreach ($fleet_array as $ship_id => $ship_count) { |
|
880 | + if ($ship_count) { |
|
881 | 881 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($ship_id, $ship_count, $user, $planet_arrival['id']); |
882 | 882 | } |
883 | 883 | } |
884 | 884 | |
885 | 885 | // Adjusting ship amount on planet |
886 | - if(!empty($db_changeset)) { |
|
886 | + if (!empty($db_changeset)) { |
|
887 | 887 | db_changeset_apply($db_changeset); |
888 | 888 | } |
889 | 889 | |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | * @param array $resource_list |
932 | 932 | */ |
933 | 933 | public function resourcesSet($resource_list) { |
934 | - if(!empty($this->propertiesAdjusted['resource_list'])) { |
|
934 | + if (!empty($this->propertiesAdjusted['resource_list'])) { |
|
935 | 935 | throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR); |
936 | 936 | } |
937 | 937 | $this->resourcesAdjust($resource_list, true); |
@@ -945,13 +945,13 @@ discard block |
||
945 | 945 | public function resourcesAdjust($resource_delta_list, $replace_value = false) { |
946 | 946 | !is_array($resource_delta_list) ? $resource_delta_list = array() : false; |
947 | 947 | |
948 | - foreach($resource_delta_list as $resource_id => $unit_delta) { |
|
949 | - if(!UnitResourceLoot::is_in_group($resource_id) || !($unit_delta = floor($unit_delta))) { |
|
948 | + foreach ($resource_delta_list as $resource_id => $unit_delta) { |
|
949 | + if (!UnitResourceLoot::is_in_group($resource_id) || !($unit_delta = floor($unit_delta))) { |
|
950 | 950 | // Not a resource or no resources - continuing |
951 | 951 | continue; |
952 | 952 | } |
953 | 953 | |
954 | - if($replace_value) { |
|
954 | + if ($replace_value) { |
|
955 | 955 | $this->resource_list[$resource_id] = $unit_delta; |
956 | 956 | } else { |
957 | 957 | $this->resource_list[$resource_id] += $unit_delta; |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | } |
962 | 962 | |
963 | 963 | // Check for negative unit value |
964 | - if($this->resource_list[$resource_id] < 0) { |
|
964 | + if ($this->resource_list[$resource_id] < 0) { |
|
965 | 965 | // TODO |
966 | 966 | throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR); |
967 | 967 | } |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | sn_db_transaction_check(true); |
1014 | 1014 | |
1015 | 1015 | // Если флот уже обработан - не существует или возращается - тогда ничего не делаем |
1016 | - if(!$this->resourcesGetTotal()) { |
|
1016 | + if (!$this->resourcesGetTotal()) { |
|
1017 | 1017 | return $result; |
1018 | 1018 | } |
1019 | 1019 | |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | // TODO - Проверка, что планета всё еще существует на указанных координатах, а не телепортировалась, не удалена хозяином, не уничтожена врагом |
1034 | 1034 | |
1035 | 1035 | // Restoring resources to planet |
1036 | - if($this->resourcesGetTotal()) { |
|
1036 | + if ($this->resourcesGetTotal()) { |
|
1037 | 1037 | $fleet_resources = $this->resourcesGetList(); |
1038 | 1038 | db_planet_set_by_id($planet_arrival['id'], |
1039 | 1039 | "`metal` = `metal` + '{$fleet_resources[RES_METAL]}', `crystal` = `crystal` + '{$fleet_resources[RES_CRYSTAL]}', `deuterium` = `deuterium` + '{$fleet_resources[RES_DEUTERIUM]}'"); |
@@ -1099,12 +1099,12 @@ discard block |
||
1099 | 1099 | |
1100 | 1100 | protected function populateTargetPlanet() { |
1101 | 1101 | $targetPlanetCoords = $this->targetVector; |
1102 | - if($this->mission_type != MT_NONE) { |
|
1102 | + if ($this->mission_type != MT_NONE) { |
|
1103 | 1103 | $this->restrictTargetTypeByMission(); |
1104 | 1104 | |
1105 | 1105 | // TODO - Нельзя тут просто менять тип планеты или координат! |
1106 | 1106 | // If current planet type is not allowed on mission - switch planet type |
1107 | - if(empty($this->allowed_planet_types[$this->targetVector->type])) { |
|
1107 | + if (empty($this->allowed_planet_types[$this->targetVector->type])) { |
|
1108 | 1108 | $targetPlanetCoords->type = reset($this->allowed_planet_types); |
1109 | 1109 | } |
1110 | 1110 | } |
@@ -1113,14 +1113,14 @@ discard block |
||
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | protected function restrictTargetTypeByMission() { |
1116 | - if($this->_mission_type == MT_MISSILE) { |
|
1116 | + if ($this->_mission_type == MT_MISSILE) { |
|
1117 | 1117 | $this->allowed_planet_types = array(PT_PLANET => PT_PLANET); |
1118 | - } elseif($this->_mission_type == MT_COLONIZE || $this->_mission_type == MT_EXPLORE) { |
|
1118 | + } elseif ($this->_mission_type == MT_COLONIZE || $this->_mission_type == MT_EXPLORE) { |
|
1119 | 1119 | // TODO - PT_NONE |
1120 | 1120 | $this->allowed_planet_types = array(PT_PLANET => PT_PLANET); |
1121 | - } elseif($this->_mission_type == MT_RECYCLE) { |
|
1121 | + } elseif ($this->_mission_type == MT_RECYCLE) { |
|
1122 | 1122 | $this->allowed_planet_types = array(PT_DEBRIS => PT_DEBRIS); |
1123 | - } elseif($this->_mission_type == MT_DESTROY) { |
|
1123 | + } elseif ($this->_mission_type == MT_DESTROY) { |
|
1124 | 1124 | $this->allowed_planet_types = array(PT_MOON => PT_MOON); |
1125 | 1125 | } else { |
1126 | 1126 | $this->allowed_planet_types = array(PT_PLANET => PT_PLANET, PT_MOON => PT_MOON); |
@@ -1152,13 +1152,13 @@ discard block |
||
1152 | 1152 | |
1153 | 1153 | |
1154 | 1154 | public function restrictToKnownSpace() { |
1155 | - if(!$this->targetVector->isInKnownSpace()) { |
|
1155 | + if (!$this->targetVector->isInKnownSpace()) { |
|
1156 | 1156 | throw new Exception('FLIGHT_VECTOR_BEYOND_SYSTEM', FLIGHT_VECTOR_BEYOND_SYSTEM); |
1157 | 1157 | } |
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | public function restrictToTypePlanet($errorCode) { |
1161 | - if($this->targetVector->type != PT_PLANET) { |
|
1161 | + if ($this->targetVector->type != PT_PLANET) { |
|
1162 | 1162 | throw new Exception($errorCode, $errorCode); |
1163 | 1163 | } |
1164 | 1164 | } |
@@ -1166,56 +1166,56 @@ discard block |
||
1166 | 1166 | public function restrictToNoMissiles() { |
1167 | 1167 | $missilesAttack = $this->unitList->unitsCountById(UNIT_DEF_MISSILE_INTERPLANET); |
1168 | 1168 | $missilesDefense = $this->unitList->unitsCountById(UNIT_DEF_MISSILE_INTERCEPTOR); |
1169 | - if($missilesAttack > 0 || $missilesDefense > 0) { |
|
1169 | + if ($missilesAttack > 0 || $missilesDefense > 0) { |
|
1170 | 1170 | throw new Exception('FLIGHT_SHIPS_NO_MISSILES', FLIGHT_SHIPS_NO_MISSILES); |
1171 | 1171 | } |
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | public function restrictToTargetOwn() { |
1175 | - if($this->dbTargetRow['id'] != $this->getPlayerOwnerId()) { |
|
1175 | + if ($this->dbTargetRow['id'] != $this->getPlayerOwnerId()) { |
|
1176 | 1176 | throw new Exception('FLIGHT_VECTOR_ONLY_OWN', FLIGHT_VECTOR_ONLY_OWN); |
1177 | 1177 | } |
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | public function restrictToTargetOther() { |
1181 | - if($this->dbTargetRow['id'] == $this->getPlayerOwnerId()) { |
|
1181 | + if ($this->dbTargetRow['id'] == $this->getPlayerOwnerId()) { |
|
1182 | 1182 | throw new Exception('FLIGHT_VECTOR_ONLY_OTHER', FLIGHT_VECTOR_ONLY_OTHER); |
1183 | 1183 | } |
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | public function restrictToNotOnlySpies() { |
1187 | - if($this->unitList->unitsCountById(SHIP_SPY) == $this->shipsGetTotal()) { |
|
1187 | + if ($this->unitList->unitsCountById(SHIP_SPY) == $this->shipsGetTotal()) { |
|
1188 | 1188 | throw new Exception('FLIGHT_SHIPS_NOT_ONLY_SPIES', FLIGHT_SHIPS_NOT_ONLY_SPIES); |
1189 | 1189 | } |
1190 | 1190 | } |
1191 | 1191 | |
1192 | 1192 | protected function restrictToUniverse() { |
1193 | - if(!$this->targetVector->isInUniverse()) { |
|
1193 | + if (!$this->targetVector->isInUniverse()) { |
|
1194 | 1194 | throw new Exception('FLIGHT_VECTOR_BEYOND_UNIVERSE', FLIGHT_VECTOR_BEYOND_UNIVERSE); |
1195 | 1195 | } |
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | protected function restrictToMovable() { |
1199 | - if(!$this->unitList->unitsIsAllMovable($this->dbOwnerRow)) { |
|
1199 | + if (!$this->unitList->unitsIsAllMovable($this->dbOwnerRow)) { |
|
1200 | 1200 | throw new Exception('FLIGHT_SHIPS_UNMOVABLE', FLIGHT_SHIPS_UNMOVABLE); |
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | protected function restrictToFleetUnits() { |
1205 | - if(!$this->unitList->unitsInGroup(sn_get_groups(array('fleet', 'missile')))) { |
|
1205 | + if (!$this->unitList->unitsInGroup(sn_get_groups(array('fleet', 'missile')))) { |
|
1206 | 1206 | throw new Exception('FLIGHT_SHIPS_UNIT_WRONG', FLIGHT_SHIPS_UNIT_WRONG); |
1207 | 1207 | } |
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | protected function restrictToColonizer() { |
1211 | 1211 | // Colonization fleet should have at least one colonizer |
1212 | - if(!$this->unitList->unitsCountById(SHIP_COLONIZER) <= 0) { |
|
1212 | + if (!$this->unitList->unitsCountById(SHIP_COLONIZER) <= 0) { |
|
1213 | 1213 | throw new Exception('FLIGHT_SHIPS_NO_COLONIZER', FLIGHT_SHIPS_NO_COLONIZER); |
1214 | 1214 | } |
1215 | 1215 | } |
1216 | 1216 | |
1217 | 1217 | protected function restrictToTargetExists() { |
1218 | - if(empty($this->dbTargetRow) || empty($this->dbTargetRow['id'])) { |
|
1218 | + if (empty($this->dbTargetRow) || empty($this->dbTargetRow['id'])) { |
|
1219 | 1219 | throw new Exception('FLIGHT_VECTOR_NO_TARGET', FLIGHT_VECTOR_NO_TARGET); |
1220 | 1220 | } |
1221 | 1221 | } |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | |
1224 | 1224 | protected function restrictKnownSpaceOrMissionExplore() { |
1225 | 1225 | // Is it exploration - fleet sent beyond of system? |
1226 | - if($this->targetVector->isInKnownSpace()) { |
|
1226 | + if ($this->targetVector->isInKnownSpace()) { |
|
1227 | 1227 | // No exploration beyond this point |
1228 | 1228 | unset($this->allowed_missions[MT_EXPLORE]); |
1229 | 1229 | |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | |
1242 | 1242 | protected function restrictTargetExistsOrMissionColonize() { |
1243 | 1243 | // Is it colonization - fleet sent to empty place? |
1244 | - if(!empty($this->dbTargetRow)) { |
|
1244 | + if (!empty($this->dbTargetRow)) { |
|
1245 | 1245 | // No colonization beyond this point |
1246 | 1246 | unset($this->allowed_missions[MT_COLONIZE]); |
1247 | 1247 | |
@@ -1260,7 +1260,7 @@ discard block |
||
1260 | 1260 | } |
1261 | 1261 | |
1262 | 1262 | protected function restrictNotDebrisOrMissionRecycle() { |
1263 | - if($this->targetVector->type != PT_DEBRIS) { |
|
1263 | + if ($this->targetVector->type != PT_DEBRIS) { |
|
1264 | 1264 | // No recycling beyond this point |
1265 | 1265 | unset($this->allowed_missions[MT_RECYCLE]); |
1266 | 1266 | |
@@ -1271,11 +1271,11 @@ discard block |
||
1271 | 1271 | |
1272 | 1272 | // restrict to recyclers |
1273 | 1273 | $recyclers = 0; |
1274 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
1274 | + foreach (sn_get_groups('flt_recyclers') as $recycler_id) { |
|
1275 | 1275 | $recyclers += $this->unitList->unitsCountById($recycler_id); |
1276 | 1276 | } |
1277 | 1277 | |
1278 | - if($recyclers <= 0) { |
|
1278 | + if ($recyclers <= 0) { |
|
1279 | 1279 | throw new Exception('FLIGHT_SHIPS_NO_RECYCLERS', FLIGHT_SHIPS_NO_RECYCLERS); |
1280 | 1280 | } |
1281 | 1281 | |
@@ -1286,14 +1286,14 @@ discard block |
||
1286 | 1286 | |
1287 | 1287 | protected function restrictMissionMissile() { |
1288 | 1288 | $missilesAttack = $this->unitList->unitsCountById(UNIT_DEF_MISSILE_INTERPLANET); |
1289 | - if($missilesAttack <= 0) { |
|
1289 | + if ($missilesAttack <= 0) { |
|
1290 | 1290 | // No missile attack beyond this point |
1291 | 1291 | unset($this->allowed_missions[MT_MISSILE]); |
1292 | 1292 | |
1293 | 1293 | return; |
1294 | 1294 | } |
1295 | 1295 | |
1296 | - if($missilesAttack != $this->shipsGetTotal()) { |
|
1296 | + if ($missilesAttack != $this->shipsGetTotal()) { |
|
1297 | 1297 | throw new Exception('FLIGHT_SHIPS_ONLY_MISSILES', FLIGHT_SHIPS_ONLY_MISSILES); |
1298 | 1298 | } |
1299 | 1299 | |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | protected function restrictToNotOnlySpiesOrMissionSpy() { |
1308 | - if($this->unitList->unitsCountById(SHIP_SPY) != $this->shipsGetTotal()) { |
|
1308 | + if ($this->unitList->unitsCountById(SHIP_SPY) != $this->shipsGetTotal()) { |
|
1309 | 1309 | // throw new Exception('FLIGHT_SHIPS_ONLY_SPIES', FLIGHT_SHIPS_ONLY_SPIES); |
1310 | 1310 | unset($this->allowed_missions[MT_SPY]); |
1311 | 1311 | |
@@ -1321,14 +1321,14 @@ discard block |
||
1321 | 1321 | protected function restrictMissionDestroy() { |
1322 | 1322 | // If target vector is not Moon - then it can't be Destroy mission |
1323 | 1323 | // If no Reapers (i.e. Death Star) in fleet - then mission Moon Destroy is unaccessible |
1324 | - if($this->targetVector->type != PT_MOON || $this->unitList->unitsCountById(SHIP_HUGE_DEATH_STAR) <= 0) { |
|
1324 | + if ($this->targetVector->type != PT_MOON || $this->unitList->unitsCountById(SHIP_HUGE_DEATH_STAR) <= 0) { |
|
1325 | 1325 | unset($this->allowed_missions[MT_DESTROY]); |
1326 | 1326 | } |
1327 | 1327 | } |
1328 | 1328 | |
1329 | 1329 | protected function restrictMissionACS() { |
1330 | 1330 | // If no ACS group is shown - then it can't be an ACS attack |
1331 | - if(empty($this->_group_id)) { |
|
1331 | + if (empty($this->_group_id)) { |
|
1332 | 1332 | unset($this->allowed_missions[MT_ACS]); |
1333 | 1333 | } |
1334 | 1334 | } |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | /** @throws Exception */ |
1337 | 1337 | protected function restrictFriendOrFoe() { |
1338 | 1338 | // Checking target owner |
1339 | - if($this->dbTargetRow['id'] == $this->getPlayerOwnerId()) { |
|
1339 | + if ($this->dbTargetRow['id'] == $this->getPlayerOwnerId()) { |
|
1340 | 1340 | // Spying can't be done on owner's planet/moon |
1341 | 1341 | unset($this->allowed_missions[MT_SPY]); |
1342 | 1342 | // Attack can't be done on owner's planet/moon |
@@ -1392,51 +1392,51 @@ discard block |
||
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | protected function restrictToNotSource() { |
1395 | - if($this->targetVector->isEqualToPlanet($this->dbSourcePlanetRow)) { |
|
1395 | + if ($this->targetVector->isEqualToPlanet($this->dbSourcePlanetRow)) { |
|
1396 | 1396 | throw new Exception('FLIGHT_VECTOR_SAME_SOURCE', FLIGHT_VECTOR_SAME_SOURCE); |
1397 | 1397 | } |
1398 | 1398 | } |
1399 | 1399 | |
1400 | 1400 | protected function restrictToNonVacationSender() { |
1401 | - if(!empty($this->dbOwnerRow['vacation']) && $this->dbOwnerRow['vacation'] >= SN_TIME_NOW) { |
|
1401 | + if (!empty($this->dbOwnerRow['vacation']) && $this->dbOwnerRow['vacation'] >= SN_TIME_NOW) { |
|
1402 | 1402 | throw new Exception('FLIGHT_PLAYER_VACATION_OWN', FLIGHT_PLAYER_VACATION_OWN); |
1403 | 1403 | } |
1404 | 1404 | } |
1405 | 1405 | |
1406 | 1406 | protected function restrictToValidSpeedPercentOld() { |
1407 | 1407 | $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); |
1408 | - if(!in_array($this->oldSpeedInTens, $speed_possible)) { |
|
1408 | + if (!in_array($this->oldSpeedInTens, $speed_possible)) { |
|
1409 | 1409 | throw new Exception('FLIGHT_FLEET_SPEED_WRONG', FLIGHT_FLEET_SPEED_WRONG); |
1410 | 1410 | } |
1411 | 1411 | |
1412 | 1412 | } |
1413 | 1413 | |
1414 | 1414 | protected function restrict2ToAllowedMissions() { |
1415 | - if(empty($this->allowed_missions[$this->_mission_type])) { |
|
1415 | + if (empty($this->allowed_missions[$this->_mission_type])) { |
|
1416 | 1416 | throw new Exception('FLIGHT_MISSION_IMPOSSIBLE', FLIGHT_MISSION_IMPOSSIBLE); |
1417 | 1417 | } |
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | protected function restrict2ToAllowedPlanetTypes() { |
1421 | - if(empty($this->allowed_planet_types[$this->targetVector->type])) { |
|
1421 | + if (empty($this->allowed_planet_types[$this->targetVector->type])) { |
|
1422 | 1422 | throw new Exception('FLIGHT_MISSION_IMPOSSIBLE', FLIGHT_MISSION_IMPOSSIBLE); |
1423 | 1423 | } |
1424 | 1424 | } |
1425 | 1425 | |
1426 | 1426 | protected function restrict2ToMaxFleets() { |
1427 | - if(FleetList::fleet_count_flying($this->getPlayerOwnerId()) >= GetMaxFleets($this->dbOwnerRow)) { |
|
1427 | + if (FleetList::fleet_count_flying($this->getPlayerOwnerId()) >= GetMaxFleets($this->dbOwnerRow)) { |
|
1428 | 1428 | throw new Exception('FLIGHT_FLEET_NO_SLOTS', FLIGHT_FLEET_NO_SLOTS); |
1429 | 1429 | } |
1430 | 1430 | } |
1431 | 1431 | |
1432 | 1432 | protected function restrict2ToEnoughShips() { |
1433 | - if(!$this->unitList->shipsIsEnoughOnPlanet($this->dbSourcePlanetRow)) { |
|
1433 | + if (!$this->unitList->shipsIsEnoughOnPlanet($this->dbSourcePlanetRow)) { |
|
1434 | 1434 | throw new Exception('FLIGHT_SHIPS_NOT_ENOUGH', FLIGHT_SHIPS_NOT_ENOUGH); |
1435 | 1435 | } |
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | protected function restrict2ToEnoughCapacity($fleetCapacity, $fleetConsumption) { |
1439 | - if(floor($fleetCapacity) < ceil(array_sum($this->resource_list) + $fleetConsumption)) { |
|
1439 | + if (floor($fleetCapacity) < ceil(array_sum($this->resource_list) + $fleetConsumption)) { |
|
1440 | 1440 | throw new Exception('FLIGHT_FLEET_OVERLOAD', FLIGHT_FLEET_OVERLOAD); |
1441 | 1441 | } |
1442 | 1442 | } |
@@ -1444,13 +1444,13 @@ discard block |
||
1444 | 1444 | protected function restrict2ByResources($fleetConsumption) { |
1445 | 1445 | $fleetResources = $this->resource_list; |
1446 | 1446 | $fleetResources[RES_DEUTERIUM] = ceil($fleetResources[RES_DEUTERIUM] + $fleetConsumption); |
1447 | - foreach($fleetResources as $resourceId => $resourceAmount) { |
|
1448 | - if($fleetResources[$resourceId] < 0) { |
|
1447 | + foreach ($fleetResources as $resourceId => $resourceAmount) { |
|
1448 | + if ($fleetResources[$resourceId] < 0) { |
|
1449 | 1449 | throw new Exception('FLIGHT_RESOURCES_NEGATIVE', FLIGHT_RESOURCES_NEGATIVE); |
1450 | 1450 | } |
1451 | 1451 | |
1452 | - if(mrc_get_level($this->dbOwnerRow, $this->dbSourcePlanetRow, $resourceId) < ceil($fleetResources[$resourceId])) { |
|
1453 | - if($resourceId == RES_DEUTERIUM) { |
|
1452 | + if (mrc_get_level($this->dbOwnerRow, $this->dbSourcePlanetRow, $resourceId) < ceil($fleetResources[$resourceId])) { |
|
1453 | + if ($resourceId == RES_DEUTERIUM) { |
|
1454 | 1454 | throw new Exception('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH', FLIGHT_RESOURCES_FUEL_NOT_ENOUGH); |
1455 | 1455 | } else { |
1456 | 1456 | throw new Exception('FLIGHT_RESOURCES_NOT_ENOUGH', FLIGHT_RESOURCES_NOT_ENOUGH); |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | |
1504 | 1504 | |
1505 | 1505 | protected function printErrorIfNoShips() { |
1506 | - if($this->unitList->unitsCount() <= 0) { |
|
1506 | + if ($this->unitList->unitsCount() <= 0) { |
|
1507 | 1507 | message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
1508 | 1508 | } |
1509 | 1509 | } |
@@ -1541,10 +1541,10 @@ discard block |
||
1541 | 1541 | protected function renderAllowedMissions(&$template_result) { |
1542 | 1542 | ksort($this->allowed_missions); |
1543 | 1543 | // If mission is not set - setting first mission from allowed |
1544 | - if(empty($this->_mission_type) && is_array($this->allowed_missions)) { |
|
1544 | + if (empty($this->_mission_type) && is_array($this->allowed_missions)) { |
|
1545 | 1545 | $this->_mission_type = reset($this->allowed_missions); |
1546 | 1546 | } |
1547 | - foreach($this->allowed_missions as $key => $value) { |
|
1547 | + foreach ($this->allowed_missions as $key => $value) { |
|
1548 | 1548 | $template_result['.']['missions'][] = array( |
1549 | 1549 | 'ID' => $key, |
1550 | 1550 | 'NAME' => classLocale::$lang['type_mission'][$key], |
@@ -1556,9 +1556,9 @@ discard block |
||
1556 | 1556 | * @param $template_result |
1557 | 1557 | */ |
1558 | 1558 | protected function renderDuration(&$template_result, $max_duration) { |
1559 | - if($max_duration) { |
|
1559 | + if ($max_duration) { |
|
1560 | 1560 | $config_game_speed_expedition = ($this->_mission_type == MT_EXPLORE && classSupernova::$config->game_speed_expedition ? classSupernova::$config->game_speed_expedition : 1); |
1561 | - for($i = 1; $i <= $max_duration; $i++) { |
|
1561 | + for ($i = 1; $i <= $max_duration; $i++) { |
|
1562 | 1562 | $template_result['.']['duration'][] = array( |
1563 | 1563 | 'ID' => $i, |
1564 | 1564 | 'TIME' => pretty_time(ceil($i * 3600 / $config_game_speed_expedition)), |
@@ -1574,7 +1574,7 @@ discard block |
||
1574 | 1574 | protected function renderPlanetResources(&$planetResources, &$template_result) { |
1575 | 1575 | // TODO - REDO to resource_id |
1576 | 1576 | $i = 0; |
1577 | - foreach($planetResources as $resource_id => $resource_amount) { |
|
1577 | + foreach ($planetResources as $resource_id => $resource_amount) { |
|
1578 | 1578 | $template_result['.']['resources'][] = array( |
1579 | 1579 | 'ID' => $i++, // $resource_id, |
1580 | 1580 | 'ON_PLANET' => $resource_amount, |
@@ -1588,7 +1588,7 @@ discard block |
||
1588 | 1588 | * @param $template_result |
1589 | 1589 | */ |
1590 | 1590 | protected function renderAllowedPlanetTypes(&$template_result) { |
1591 | - foreach($this->allowed_planet_types as $possible_planet_type_id) { |
|
1591 | + foreach ($this->allowed_planet_types as $possible_planet_type_id) { |
|
1592 | 1592 | $template_result['.']['possible_planet_type_id'][] = array( |
1593 | 1593 | 'ID' => $possible_planet_type_id, |
1594 | 1594 | 'NAME' => classLocale::$lang['sys_planet_type'][$possible_planet_type_id], |
@@ -1611,14 +1611,14 @@ discard block |
||
1611 | 1611 | 'TYPE_PRINT' => classLocale::$lang['fl_shrtcup'][$shortcut['planet_type']], |
1612 | 1612 | ); |
1613 | 1613 | |
1614 | - if(isset($shortcut['priority'])) { |
|
1614 | + if (isset($shortcut['priority'])) { |
|
1615 | 1615 | $result += array( |
1616 | 1616 | 'PRIORITY' => $shortcut['priority'], |
1617 | 1617 | 'PRIORITY_CLASS' => $note_priority_classes[$shortcut['priority']], |
1618 | 1618 | ); |
1619 | 1619 | } |
1620 | 1620 | |
1621 | - if(isset($shortcut['id'])) { |
|
1621 | + if (isset($shortcut['id'])) { |
|
1622 | 1622 | $result += array( |
1623 | 1623 | 'ID' => $shortcut['id'], |
1624 | 1624 | ); |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | protected function renderFleetShortcuts(&$template_result) { |
1634 | 1634 | // Building list of shortcuts |
1635 | 1635 | $query = db_note_list_select_by_owner_and_planet($this->dbOwnerRow); |
1636 | - while($row = db_fetch($query)) { |
|
1636 | + while ($row = db_fetch($query)) { |
|
1637 | 1637 | $template_result['.']['shortcut'][] = $this->renderFleet1TargetSelect($row); |
1638 | 1638 | } |
1639 | 1639 | } |
@@ -1645,12 +1645,12 @@ discard block |
||
1645 | 1645 | */ |
1646 | 1646 | protected function renderOwnPlanets(&$template_result) { |
1647 | 1647 | $colonies = db_planet_list_sorted($this->dbOwnerRow); |
1648 | - if(count($colonies) <= 1) { |
|
1648 | + if (count($colonies) <= 1) { |
|
1649 | 1649 | return; |
1650 | 1650 | } |
1651 | 1651 | |
1652 | - foreach($colonies as $row) { |
|
1653 | - if($row['id'] == $this->dbSourcePlanetRow['id']) { |
|
1652 | + foreach ($colonies as $row) { |
|
1653 | + if ($row['id'] == $this->dbSourcePlanetRow['id']) { |
|
1654 | 1654 | continue; |
1655 | 1655 | } |
1656 | 1656 | |
@@ -1663,10 +1663,10 @@ discard block |
||
1663 | 1663 | */ |
1664 | 1664 | protected function renderACSList(&$template_result) { |
1665 | 1665 | $query = db_acs_get_list(); |
1666 | - while($row = db_fetch($query)) { |
|
1666 | + while ($row = db_fetch($query)) { |
|
1667 | 1667 | $members = explode(',', $row['eingeladen']); |
1668 | - foreach($members as $a => $b) { |
|
1669 | - if($b == $this->dbOwnerRow['id']) { |
|
1668 | + foreach ($members as $a => $b) { |
|
1669 | + if ($b == $this->dbOwnerRow['id']) { |
|
1670 | 1670 | $template_result['.']['acss'][] = $this->renderFleet1TargetSelect($row); |
1671 | 1671 | } |
1672 | 1672 | } |
@@ -1677,7 +1677,7 @@ discard block |
||
1677 | 1677 | * @param $template_result |
1678 | 1678 | */ |
1679 | 1679 | protected function renderShipSortOptions(&$template_result) { |
1680 | - foreach(classLocale::$lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
1680 | + foreach (classLocale::$lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
1681 | 1681 | $template_result['.']['ship_sort_list'][] = array( |
1682 | 1682 | 'VALUE' => $sort_id, |
1683 | 1683 | 'TEXT' => $sort_text, |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | |
1697 | 1697 | lng_include('overview'); |
1698 | 1698 | |
1699 | - if(empty($this->dbSourcePlanetRow)) { |
|
1699 | + if (empty($this->dbSourcePlanetRow)) { |
|
1700 | 1700 | message(classLocale::$lang['fl_noplanetrow'], classLocale::$lang['fl_error']); |
1701 | 1701 | } |
1702 | 1702 | |
@@ -1772,9 +1772,9 @@ discard block |
||
1772 | 1772 | |
1773 | 1773 | try { |
1774 | 1774 | $this->restrictMission(); |
1775 | - } catch(Exception $e) { |
|
1775 | + } catch (Exception $e) { |
|
1776 | 1776 | // TODO - MESSAGE BOX |
1777 | - if($e->getCode() != FLIGHT_ALLOWED) { |
|
1777 | + if ($e->getCode() != FLIGHT_ALLOWED) { |
|
1778 | 1778 | pdie(classLocale::$lang['fl_attack_error'][$e->getCode()]); |
1779 | 1779 | } else { |
1780 | 1780 | pdump('FLIGHT_ALLOWED', FLIGHT_ALLOWED); |
@@ -1784,20 +1784,19 @@ discard block |
||
1784 | 1784 | $this->renderAllowedMissions($template_result); |
1785 | 1785 | $this->renderFleet($template_result); |
1786 | 1786 | |
1787 | - $max_duration = $this->_mission_type == MT_EXPLORE ? get_player_max_expedition_duration($this->dbOwnerRow) : |
|
1788 | - (isset($this->allowed_missions[MT_HOLD]) ? 12 : 0); |
|
1787 | + $max_duration = $this->_mission_type == MT_EXPLORE ? get_player_max_expedition_duration($this->dbOwnerRow) : (isset($this->allowed_missions[MT_HOLD]) ? 12 : 0); |
|
1789 | 1788 | $this->renderDuration($template_result, $max_duration); |
1790 | 1789 | |
1791 | 1790 | $travel_data = $this->flt_travel_data($this->oldSpeedInTens); |
1792 | 1791 | |
1793 | 1792 | $sn_group_resources = sn_get_groups('resources_loot'); |
1794 | 1793 | $planetResources = array(); |
1795 | - foreach($sn_group_resources as $resource_id) { |
|
1794 | + foreach ($sn_group_resources as $resource_id) { |
|
1796 | 1795 | $planetResources[$resource_id] = floor(mrc_get_level($this->dbOwnerRow, $this->dbSourcePlanetRow, $resource_id) - ($resource_id == RES_DEUTERIUM ? $travel_data['consumption'] : 0)); |
1797 | 1796 | } |
1798 | 1797 | $this->renderPlanetResources($planetResources, $template_result); |
1799 | 1798 | |
1800 | - if(sn_module::$sn_module['unit_captain']->manifest['active'] && ($captain = sn_module::$sn_module['unit_captain']->unit_captain_get($this->dbSourcePlanetRow['id'])) && $captain['unit_location_type'] == LOC_PLANET) { |
|
1799 | + if (sn_module::$sn_module['unit_captain']->manifest['active'] && ($captain = sn_module::$sn_module['unit_captain']->unit_captain_get($this->dbSourcePlanetRow['id'])) && $captain['unit_location_type'] == LOC_PLANET) { |
|
1801 | 1800 | $template_result += array( |
1802 | 1801 | 'CAPTAIN_ID' => $captain['unit_id'], |
1803 | 1802 | 'CAPTAIN_LEVEL' => $captain['captain_level'], |
@@ -1833,24 +1832,24 @@ discard block |
||
1833 | 1832 | |
1834 | 1833 | |
1835 | 1834 | public function restrict2MissionTransportWithResources($fleetResources) { |
1836 | - if($this->_mission_type != MT_TRANSPORT) { |
|
1835 | + if ($this->_mission_type != MT_TRANSPORT) { |
|
1837 | 1836 | return; |
1838 | 1837 | } |
1839 | 1838 | |
1840 | - if(array_sum($fleetResources) <= 0) { |
|
1839 | + if (array_sum($fleetResources) <= 0) { |
|
1841 | 1840 | throw new Exception('FLIGHT_RESOURCES_EMPTY', FLIGHT_RESOURCES_EMPTY); |
1842 | 1841 | } |
1843 | 1842 | } |
1844 | 1843 | |
1845 | 1844 | protected function restrict2MissionExploreAvailable() { |
1846 | - if($this->_mission_type != MT_EXPLORE) { |
|
1845 | + if ($this->_mission_type != MT_EXPLORE) { |
|
1847 | 1846 | return; |
1848 | 1847 | } |
1849 | 1848 | |
1850 | - if(($expeditionsMax = get_player_max_expeditons($this->dbOwnerRow)) <= 0) { |
|
1849 | + if (($expeditionsMax = get_player_max_expeditons($this->dbOwnerRow)) <= 0) { |
|
1851 | 1850 | throw new Exception('FLIGHT_MISSION_EXPLORE_NO_ASTROTECH', FLIGHT_MISSION_EXPLORE_NO_ASTROTECH); |
1852 | 1851 | } |
1853 | - if(FleetList::fleet_count_flying($this->getPlayerOwnerId(), MT_EXPLORE) >= $expeditionsMax) { |
|
1852 | + if (FleetList::fleet_count_flying($this->getPlayerOwnerId(), MT_EXPLORE) >= $expeditionsMax) { |
|
1854 | 1853 | throw new Exception('FLIGHT_MISSION_EXPLORE_NO_SLOTS', FLIGHT_MISSION_EXPLORE_NO_SLOTS); |
1855 | 1854 | } |
1856 | 1855 | |
@@ -1877,10 +1876,10 @@ discard block |
||
1877 | 1876 | |
1878 | 1877 | $this->dbOwnerRow = db_user_by_id($this->dbOwnerRow['id'], true); |
1879 | 1878 | $this->dbSourcePlanetRow = db_planet_by_id($this->dbSourcePlanetRow['id'], true); |
1880 | - if(!empty($this->dbTargetRow['id'])) { |
|
1879 | + if (!empty($this->dbTargetRow['id'])) { |
|
1881 | 1880 | $this->dbTargetRow = db_planet_by_id($this->dbTargetRow['id'], true); |
1882 | 1881 | } |
1883 | - if(!empty($this->dbTargetRow['id_owner'])) { |
|
1882 | + if (!empty($this->dbTargetRow['id_owner'])) { |
|
1884 | 1883 | $this->dbTargetOwnerRow = db_planet_by_id($this->dbTargetRow['id_owner'], true); |
1885 | 1884 | } |
1886 | 1885 | |
@@ -1931,9 +1930,9 @@ discard block |
||
1931 | 1930 | |
1932 | 1931 | // TODO - ALL OF THE ABOVE! |
1933 | 1932 | $this->restrictMission(); |
1934 | - } catch(Exception $e) { |
|
1933 | + } catch (Exception $e) { |
|
1935 | 1934 | // If mission is restricted - rethrow exception |
1936 | - if($e->getCode() != FLIGHT_ALLOWED) { |
|
1935 | + if ($e->getCode() != FLIGHT_ALLOWED) { |
|
1937 | 1936 | throw new Exception($e->getMessage(), $e->getCode()); |
1938 | 1937 | } |
1939 | 1938 | } |
@@ -1971,7 +1970,7 @@ discard block |
||
1971 | 1970 | $this->restrictTargetExistsOrMissionColonize(); |
1972 | 1971 | $this->restrictNotDebrisOrMissionRecycle(); |
1973 | 1972 | // TODO - START $this->restrictFriendOrFoe(); |
1974 | - if($this->dbTargetRow['id'] == $this->getPlayerOwnerId()) { |
|
1973 | + if ($this->dbTargetRow['id'] == $this->getPlayerOwnerId()) { |
|
1975 | 1974 | // Spying can't be done on owner's planet/moon |
1976 | 1975 | unset($this->allowed_missions[MT_SPY]); |
1977 | 1976 | // Attack can't be done on owner's planet/moon |
@@ -2048,9 +2047,9 @@ discard block |
||
2048 | 2047 | |
2049 | 2048 | |
2050 | 2049 | // $this->restrict2MissionTransportWithResources($fleetResources); |
2051 | - } catch(Exception $e) { |
|
2050 | + } catch (Exception $e) { |
|
2052 | 2051 | // TODO - MESSAGE BOX |
2053 | - if($e->getCode() != FLIGHT_ALLOWED) { |
|
2052 | + if ($e->getCode() != FLIGHT_ALLOWED) { |
|
2054 | 2053 | sn_db_transaction_rollback(); |
2055 | 2054 | pdie(classLocale::$lang['fl_attack_error'][$e->getCode()]); |
2056 | 2055 | } else { |
@@ -2070,46 +2069,46 @@ discard block |
||
2070 | 2069 | $TransDeuterium = max(0, floor(sys_get_param_float('resource2'))); |
2071 | 2070 | $StorageNeeded = $TransMetal + $TransCrystal + $TransDeuterium; |
2072 | 2071 | |
2073 | - if(!$StorageNeeded && $target_mission == MT_TRANSPORT) { |
|
2072 | + if (!$StorageNeeded && $target_mission == MT_TRANSPORT) { |
|
2074 | 2073 | $errorlist .= classLocale::$lang['fl_noenoughtgoods']; |
2075 | 2074 | } |
2076 | 2075 | |
2077 | 2076 | |
2078 | - if($target_mission == MT_EXPLORE) { |
|
2079 | - if($MaxExpeditions == 0) { |
|
2077 | + if ($target_mission == MT_EXPLORE) { |
|
2078 | + if ($MaxExpeditions == 0) { |
|
2080 | 2079 | $errorlist .= classLocale::$lang['fl_expe_notech']; |
2081 | - } elseif($FlyingExpeditions >= $MaxExpeditions) { |
|
2080 | + } elseif ($FlyingExpeditions >= $MaxExpeditions) { |
|
2082 | 2081 | $errorlist .= classLocale::$lang['fl_expe_max']; |
2083 | 2082 | } |
2084 | 2083 | } else { |
2085 | - if($TargetPlanet['id_owner']) { |
|
2086 | - if($target_mission == MT_COLONIZE) { |
|
2084 | + if ($TargetPlanet['id_owner']) { |
|
2085 | + if ($target_mission == MT_COLONIZE) { |
|
2087 | 2086 | $errorlist .= classLocale::$lang['fl_colonized']; |
2088 | 2087 | } |
2089 | 2088 | |
2090 | - if($TargetPlanet['id_owner'] == $planetrow['id_owner']) { |
|
2091 | - if($target_mission == MT_ATTACK) { |
|
2089 | + if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) { |
|
2090 | + if ($target_mission == MT_ATTACK) { |
|
2092 | 2091 | $errorlist .= classLocale::$lang['fl_no_self_attack']; |
2093 | 2092 | } |
2094 | 2093 | |
2095 | - if($target_mission == MT_SPY) { |
|
2094 | + if ($target_mission == MT_SPY) { |
|
2096 | 2095 | $errorlist .= classLocale::$lang['fl_no_self_spy']; |
2097 | 2096 | } |
2098 | 2097 | } else { |
2099 | - if($target_mission == MT_RELOCATE) { |
|
2098 | + if ($target_mission == MT_RELOCATE) { |
|
2100 | 2099 | $errorlist .= classLocale::$lang['fl_only_stay_at_home']; |
2101 | 2100 | } |
2102 | 2101 | } |
2103 | 2102 | } else { |
2104 | - if($target_mission < MT_COLONIZE) { |
|
2103 | + if ($target_mission < MT_COLONIZE) { |
|
2105 | 2104 | $errorlist .= classLocale::$lang['fl_unknow_target']; |
2106 | 2105 | } else { |
2107 | 2106 | // if($target_mission == MT_DESTROY) { |
2108 | 2107 | // $errorlist .= classLocale::$lang['fl_nomoon']; |
2109 | 2108 | // } |
2110 | 2109 | |
2111 | - if($target_mission == MT_RECYCLE) { |
|
2112 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) { |
|
2110 | + if ($target_mission == MT_RECYCLE) { |
|
2111 | + if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) { |
|
2113 | 2112 | $errorlist .= classLocale::$lang['fl_nodebris']; |
2114 | 2113 | } |
2115 | 2114 | } |
@@ -2118,12 +2117,12 @@ discard block |
||
2118 | 2117 | } |
2119 | 2118 | |
2120 | 2119 | |
2121 | - if(sn_module::$sn_module['unit_captain']->manifest['active'] && $captain_id = sys_get_param_id('captain_id')) { |
|
2120 | + if (sn_module::$sn_module['unit_captain']->manifest['active'] && $captain_id = sys_get_param_id('captain_id')) { |
|
2122 | 2121 | $captain = sn_module::$sn_module['unit_captain']->unit_captain_get($planetrow['id']); |
2123 | - if(!$captain) { |
|
2122 | + if (!$captain) { |
|
2124 | 2123 | $errorlist .= classLocale::$lang['module_unit_captain_error_no_captain']; |
2125 | - } elseif($captain['unit_location_type'] == LOC_PLANET) { |
|
2126 | - if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
2124 | + } elseif ($captain['unit_location_type'] == LOC_PLANET) { |
|
2125 | + if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
2127 | 2126 | $errorlist .= classLocale::$lang['module_unit_captain_error_captain_already_bound']; |
2128 | 2127 | } |
2129 | 2128 | } else { |
@@ -2131,7 +2130,7 @@ discard block |
||
2131 | 2130 | } |
2132 | 2131 | } |
2133 | 2132 | |
2134 | - if($errorlist) { |
|
2133 | + if ($errorlist) { |
|
2135 | 2134 | sn_db_transaction_rollback(); |
2136 | 2135 | message("<span class='error'><ul>{$errorlist}</ul></span>", classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
2137 | 2136 | } |
@@ -2142,10 +2141,10 @@ discard block |
||
2142 | 2141 | //But is it acs?? |
2143 | 2142 | //Well all acs fleets must have a fleet code. |
2144 | 2143 | //The co-ords must be the same as where the acs fleet is going. |
2145 | - if($fleet_group && sys_get_param_str('acs_target_mr') == "g{$galaxy}s{$system}p{$planet}t{$planet_type}") { |
|
2144 | + if ($fleet_group && sys_get_param_str('acs_target_mr') == "g{$galaxy}s{$system}p{$planet}t{$planet_type}") { |
|
2146 | 2145 | //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!) |
2147 | 2146 | $aks = db_acs_get_by_group_id($fleet_group); |
2148 | - if(!$aks) { |
|
2147 | + if (!$aks) { |
|
2149 | 2148 | $fleet_group = 0; |
2150 | 2149 | } else { |
2151 | 2150 | //Also it must be mission type 2 |
@@ -2156,26 +2155,26 @@ discard block |
||
2156 | 2155 | $planet = $aks['planet']; |
2157 | 2156 | $planet_type = $aks['planet_type']; |
2158 | 2157 | } |
2159 | - } elseif($target_mission == MT_ACS) { |
|
2158 | + } elseif ($target_mission == MT_ACS) { |
|
2160 | 2159 | //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet. |
2161 | 2160 | $target_mission = MT_ATTACK; |
2162 | 2161 | } |
2163 | 2162 | |
2164 | - if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) { |
|
2163 | + if ($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) { |
|
2165 | 2164 | $TargetPlanet = array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet, 'id_owner' => 0); |
2166 | 2165 | } |
2167 | 2166 | $options = array('fleet_speed_percent' => $speed_percent, 'fleet_group' => $fleet_group, 'resources' => $StorageNeeded); |
2168 | 2167 | $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options); |
2169 | 2168 | |
2170 | - if($cant_attack !== FLIGHT_ALLOWED) { |
|
2169 | + if ($cant_attack !== FLIGHT_ALLOWED) { |
|
2171 | 2170 | message("<span class='error'><b>{$classLocale['fl_attack_error'][$cant_attack]}</b></span>", classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 99); |
2172 | 2171 | } |
2173 | 2172 | |
2174 | 2173 | $mission_time_in_seconds = 0; |
2175 | 2174 | $arrival_time = SN_TIME_NOW + $time_to_travel; |
2176 | - if($target_mission == MT_ACS && $aks) { |
|
2175 | + if ($target_mission == MT_ACS && $aks) { |
|
2177 | 2176 | // if($fleet_start_time > $aks['ankunft']) { |
2178 | - if($arrival_time > $aks['ankunft']) { |
|
2177 | + if ($arrival_time > $aks['ankunft']) { |
|
2179 | 2178 | message(classLocale::$lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, $arrival_time) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), classLocale::$lang['fl_error']); |
2180 | 2179 | } |
2181 | 2180 | $group_sync_delta_time = $aks['ankunft'] - $arrival_time; |
@@ -2184,11 +2183,11 @@ discard block |
||
2184 | 2183 | // Set return time to ACS return time + fleet's time to travel |
2185 | 2184 | $return_time = $aks['ankunft'] + $time_to_travel; |
2186 | 2185 | } else { |
2187 | - if($target_mission == MT_EXPLORE || $target_mission == MT_HOLD) { |
|
2186 | + if ($target_mission == MT_EXPLORE || $target_mission == MT_HOLD) { |
|
2188 | 2187 | $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0); |
2189 | - if($max_duration) { |
|
2188 | + if ($max_duration) { |
|
2190 | 2189 | $mission_time_in_hours = sys_get_param_id('missiontime'); |
2191 | - if($mission_time_in_hours > $max_duration || $mission_time_in_hours < 1) { |
|
2190 | + if ($mission_time_in_hours > $max_duration || $mission_time_in_hours < 1) { |
|
2192 | 2191 | $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true)); |
2193 | 2192 | die(); |
2194 | 2193 | } |
@@ -2202,7 +2201,7 @@ discard block |
||
2202 | 2201 | // $FleetStorage = 0; |
2203 | 2202 | |
2204 | 2203 | $db_changeset = array(); |
2205 | - foreach($fleetarray as $Ship => $Count) { |
|
2204 | + foreach ($fleetarray as $Ship => $Count) { |
|
2206 | 2205 | // $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
2207 | 2206 | $db_changeset['unit'][] = sn_db_unit_changeset_prepare($Ship, -$Count, $user, $planetrow['id']); |
2208 | 2207 | } |
@@ -2255,7 +2254,7 @@ discard block |
||
2255 | 2254 | |
2256 | 2255 | $template = gettemplate('fleet3', true); |
2257 | 2256 | |
2258 | - if(is_array($captain)) { |
|
2257 | + if (is_array($captain)) { |
|
2259 | 2258 | db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$objFleet->dbId}"); |
2260 | 2259 | } |
2261 | 2260 | |
@@ -2267,7 +2266,7 @@ discard block |
||
2267 | 2266 | 'START_TIME_TEXT' => date(FMT_DATE_TIME, $return_time + SN_CLIENT_TIME_DIFF), |
2268 | 2267 | 'START_LEFT' => floor($return_time + 1 - SN_TIME_NOW), |
2269 | 2268 | ); |
2270 | - if(!empty($TargetPlanet)) { |
|
2269 | + if (!empty($TargetPlanet)) { |
|
2271 | 2270 | $template_route += array( |
2272 | 2271 | 'END_TYPE_TEXT_SH' => classLocale::$lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
2273 | 2272 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -2280,8 +2279,8 @@ discard block |
||
2280 | 2279 | $template->assign_block_vars('fleets', $template_route); |
2281 | 2280 | |
2282 | 2281 | $sn_groups_fleet = sn_get_groups('fleet'); |
2283 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
2284 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
2282 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
2283 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
2285 | 2284 | // $ship_base_data = get_ship_data($ship_id, $user); |
2286 | 2285 | $template->assign_block_vars('fleets.ships', array( |
2287 | 2286 | 'ID' => $ship_id, |
@@ -2321,16 +2320,16 @@ discard block |
||
2321 | 2320 | * @throws Exception |
2322 | 2321 | */ |
2323 | 2322 | public function checkMissionRestrictions($checklist) { |
2324 | - foreach($checklist as $condition => $action) { |
|
2323 | + foreach ($checklist as $condition => $action) { |
|
2325 | 2324 | $checkResult = call_user_func(array($this, $condition)); |
2326 | 2325 | |
2327 | - if(is_array($action) && !empty($action[$checkResult])) { |
|
2326 | + if (is_array($action) && !empty($action[$checkResult])) { |
|
2328 | 2327 | $action = $action[$checkResult]; |
2329 | 2328 | } |
2330 | 2329 | |
2331 | - if(is_array($action)) { |
|
2330 | + if (is_array($action)) { |
|
2332 | 2331 | $this->checkMissionRestrictions($action); |
2333 | - } elseif(!$checkResult) { |
|
2332 | + } elseif (!$checkResult) { |
|
2334 | 2333 | throw new Exception($action, $action); |
2335 | 2334 | } |
2336 | 2335 | } |
@@ -2403,8 +2402,8 @@ discard block |
||
2403 | 2402 | } |
2404 | 2403 | |
2405 | 2404 | protected function checkResourcesPositive() { |
2406 | - foreach($this->resource_list as $resourceId => $resourceAmount) { |
|
2407 | - if($resourceAmount < 0) { |
|
2405 | + foreach ($this->resource_list as $resourceId => $resourceAmount) { |
|
2406 | + if ($resourceAmount < 0) { |
|
2408 | 2407 | return false; |
2409 | 2408 | } |
2410 | 2409 | } |
@@ -2426,8 +2425,8 @@ discard block |
||
2426 | 2425 | protected function checkSourceEnoughResources() { |
2427 | 2426 | $fleetResources = $this->resource_list; |
2428 | 2427 | $fleetResources[RES_DEUTERIUM] = ceil($fleetResources[RES_DEUTERIUM] + $this->travelData['consumption']); |
2429 | - foreach($fleetResources as $resourceId => $resourceAmount) { |
|
2430 | - if(mrc_get_level($this->dbOwnerRow, $this->dbSourcePlanetRow, $resourceId) < ceil($fleetResources[$resourceId])) { |
|
2428 | + foreach ($fleetResources as $resourceId => $resourceAmount) { |
|
2429 | + if (mrc_get_level($this->dbOwnerRow, $this->dbSourcePlanetRow, $resourceId) < ceil($fleetResources[$resourceId])) { |
|
2431 | 2430 | return false; |
2432 | 2431 | } |
2433 | 2432 | } |
@@ -2469,7 +2468,7 @@ discard block |
||
2469 | 2468 | |
2470 | 2469 | protected function checkHaveRecyclers() { |
2471 | 2470 | $recyclers = 0; |
2472 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
2471 | + foreach (sn_get_groups('flt_recyclers') as $recycler_id) { |
|
2473 | 2472 | $recyclers += $this->unitList->unitsCountById($recycler_id); |
2474 | 2473 | } |
2475 | 2474 | |
@@ -2481,7 +2480,7 @@ discard block |
||
2481 | 2480 | protected function checkTargetOwn() { |
2482 | 2481 | $result = $this->dbTargetRow['id_owner'] == $this->dbSourcePlanetRow['id_owner']; |
2483 | 2482 | |
2484 | - if($result) { |
|
2483 | + if ($result) { |
|
2485 | 2484 | // Spying can't be done on owner's planet/moon |
2486 | 2485 | unset($this->allowed_missions[MT_SPY]); |
2487 | 2486 | // Attack can't be done on owner's planet/moon |
@@ -2518,7 +2517,7 @@ discard block |
||
2518 | 2517 | |
2519 | 2518 | protected function checkSpiesOnly() { |
2520 | 2519 | $result = $this->unitList->unitsCountById(SHIP_SPY) == $this->shipsGetTotal(); |
2521 | - if($result) { |
|
2520 | + if ($result) { |
|
2522 | 2521 | $this->allowed_missions = array( |
2523 | 2522 | MT_SPY => MT_SPY, |
2524 | 2523 | ); |
@@ -2531,7 +2530,7 @@ discard block |
||
2531 | 2530 | |
2532 | 2531 | protected function checkTargetAllyDeposit() { |
2533 | 2532 | $result = mrc_get_level($this->dbTargetOwnerRow, $this->dbTargetRow, STRUC_ALLY_DEPOSIT) >= 1; |
2534 | - if(!$result) { |
|
2533 | + if (!$result) { |
|
2535 | 2534 | unset($this->allowed_missions[MT_HOLD]); |
2536 | 2535 | } |
2537 | 2536 | |
@@ -2560,7 +2559,7 @@ discard block |
||
2560 | 2559 | |
2561 | 2560 | protected function checkMission($missionType) { |
2562 | 2561 | $result = !$this->_mission_type || $this->_mission_type == $missionType; |
2563 | - if($result) { |
|
2562 | + if ($result) { |
|
2564 | 2563 | $this->allowed_missions = array( |
2565 | 2564 | $missionType => $missionType, |
2566 | 2565 | ); |
@@ -2682,7 +2681,7 @@ discard block |
||
2682 | 2681 | protected function checkMissiles() { |
2683 | 2682 | $missilesAttack = $this->unitList->unitsCountById(UNIT_DEF_MISSILE_INTERPLANET); |
2684 | 2683 | $missilesDefense = $this->unitList->unitsCountById(UNIT_DEF_MISSILE_INTERCEPTOR); |
2685 | - if($missilesAttack > 0 || $missilesDefense > 0) { |
|
2684 | + if ($missilesAttack > 0 || $missilesDefense > 0) { |
|
2686 | 2685 | throw new Exception('FLIGHT_SHIPS_NO_MISSILES', FLIGHT_SHIPS_NO_MISSILES); |
2687 | 2686 | } |
2688 | 2687 | } |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | $user_option_list = array(); |
184 | 184 | |
185 | 185 | $user_option_list[OPT_MESSAGE] = array(); |
186 | -foreach($sn_message_class_list as $message_class_id => $message_class_data) { |
|
187 | - if($message_class_data['switchable']) { |
|
186 | +foreach ($sn_message_class_list as $message_class_id => $message_class_data) { |
|
187 | + if ($message_class_data['switchable']) { |
|
188 | 188 | $user_option_list[OPT_MESSAGE]["opt_{$message_class_data['name']}"] = 1; |
189 | 189 | } |
190 | 190 | |
191 | - if($message_class_data['email']) { |
|
191 | + if ($message_class_data['email']) { |
|
192 | 192 | $user_option_list[OPT_MESSAGE]["opt_email_{$message_class_data['name']}"] = 0; |
193 | 193 | } |
194 | 194 | } |
@@ -333,26 +333,26 @@ discard block |
||
333 | 333 | // Each mission will filter only necessary checks and do it in this order |
334 | 334 | 'mission_checks' => array( |
335 | 335 | // Cheap checks - class Fleet already have all this info internally |
336 | - 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, //+ |
|
337 | - 'checkTargetNoVacation' => FLIGHT_PLAYER_VACATION, //+ |
|
338 | - 'checkFleetNotEmpty' => FLIGHT_SHIPS_NO_SHIPS, //+ |
|
336 | + 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, //+ |
|
337 | + 'checkTargetNoVacation' => FLIGHT_PLAYER_VACATION, //+ |
|
338 | + 'checkFleetNotEmpty' => FLIGHT_SHIPS_NO_SHIPS, //+ |
|
339 | 339 | // FLIGHT_MISSION_UNKNOWN |
340 | 340 | // FLIGHT_RESOURCES_FORBIDDEN |
341 | - 'checkSpeedPercentOld' => FLIGHT_FLEET_SPEED_WRONG, //+ |
|
342 | - 'checkTargetNotSource' => FLIGHT_VECTOR_SAME_SOURCE, //+ |
|
341 | + 'checkSpeedPercentOld' => FLIGHT_FLEET_SPEED_WRONG, //+ |
|
342 | + 'checkTargetNotSource' => FLIGHT_VECTOR_SAME_SOURCE, //+ |
|
343 | 343 | 'checkTargetInUniverse' => FLIGHT_VECTOR_BEYOND_UNIVERSE, |
344 | - 'checkUnitsPositive' => FLIGHT_SHIPS_NEGATIVE, //+ |
|
344 | + 'checkUnitsPositive' => FLIGHT_SHIPS_NEGATIVE, //+ |
|
345 | 345 | 'checkOnlyFleetUnits' => FLIGHT_SHIPS_UNIT_WRONG, |
346 | - 'checkOnlyFlyingUnits' => FLIGHT_SHIPS_UNMOVABLE, //+ |
|
347 | - 'checkResourcesPositive' => FLIGHT_RESOURCES_NEGATIVE, //+ |
|
348 | - 'checkNotTooFar' => FLIGHT_FLEET_TOO_FAR, //+ |
|
349 | - 'checkEnoughCapacity' => FLIGHT_FLEET_OVERLOAD, //+ |
|
346 | + 'checkOnlyFlyingUnits' => FLIGHT_SHIPS_UNMOVABLE, //+ |
|
347 | + 'checkResourcesPositive' => FLIGHT_RESOURCES_NEGATIVE, //+ |
|
348 | + 'checkNotTooFar' => FLIGHT_FLEET_TOO_FAR, //+ |
|
349 | + 'checkEnoughCapacity' => FLIGHT_FLEET_OVERLOAD, //+ |
|
350 | 350 | // Medium checks - currently requires access to DB but potentially doesn't |
351 | - 'checkSourceEnoughShips' => FLIGHT_SHIPS_NOT_ENOUGH, //+ |
|
352 | - 'checkSourceEnoughFuel' => FLIGHT_RESOURCES_FUEL_NOT_ENOUGH, //+ |
|
353 | - 'checkSourceEnoughResources' => FLIGHT_RESOURCES_NOT_ENOUGH, //+ |
|
351 | + 'checkSourceEnoughShips' => FLIGHT_SHIPS_NOT_ENOUGH, //+ |
|
352 | + 'checkSourceEnoughFuel' => FLIGHT_RESOURCES_FUEL_NOT_ENOUGH, //+ |
|
353 | + 'checkSourceEnoughResources' => FLIGHT_RESOURCES_NOT_ENOUGH, //+ |
|
354 | 354 | // Heavy checks - will absolutely require DB access |
355 | - 'checkEnoughFleetSlots' => FLIGHT_FLEET_NO_SLOTS, //+ |
|
355 | + 'checkEnoughFleetSlots' => FLIGHT_FLEET_NO_SLOTS, //+ |
|
356 | 356 | |
357 | 357 | // If it is not known space then it can be only Explore mission |
358 | 358 | 'checkKnownSpace' => array( |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | 'checkNotOnlySpies' => FLIGHT_SHIPS_NOT_ONLY_SPIES, |
363 | 363 | 'checkNoMissiles' => FLIGHT_SHIPS_NO_MISSILES, |
364 | 364 | 'checkMissionExplore' => array( |
365 | - true => FLIGHT_ALLOWED, //+ |
|
365 | + true => FLIGHT_ALLOWED, //+ |
|
366 | 366 | false => FLIGHT_VECTOR_BEYOND_SYSTEM, |
367 | 367 | ), |
368 | 368 | ), |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | 'checkNoMissiles' => FLIGHT_SHIPS_NO_MISSILES, |
378 | 378 | 'checkTargetIsPlanet' => FLIGHT_MISSION_COLONIZE_NOT_PLANET, |
379 | 379 | 'checkMissionColonize' => array( |
380 | - true => FLIGHT_ALLOWED, //+ |
|
380 | + true => FLIGHT_ALLOWED, //+ |
|
381 | 381 | false => FLIGHT_VECTOR_NO_TARGET, |
382 | 382 | ), |
383 | 383 | ), |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | 'checkTargetIsDebris' => array( |
389 | 389 | true => array( |
390 | 390 | // Recycle mission checks |
391 | - 'checkHaveRecyclers' => FLIGHT_SHIPS_NO_RECYCLERS, //+ |
|
391 | + 'checkHaveRecyclers' => FLIGHT_SHIPS_NO_RECYCLERS, //+ |
|
392 | 392 | 'checkNoMissiles' => FLIGHT_SHIPS_NO_MISSILES, |
393 | - 'checkDebrisExists' => FLIGHT_MISSION_RECYCLE_NO_DEBRIS, //+ |
|
393 | + 'checkDebrisExists' => FLIGHT_MISSION_RECYCLE_NO_DEBRIS, //+ |
|
394 | 394 | 'checkMissionRecycle' => array( |
395 | - true => FLIGHT_ALLOWED, //+ |
|
395 | + true => FLIGHT_ALLOWED, //+ |
|
396 | 396 | false => FLIGHT_VECTOR_TARGET_DEBRIS, |
397 | 397 | ), |
398 | 398 | ), |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | // Beyond this point fleet should contain some other additionally to spies - or no spies at all |
466 | 466 | |
467 | 467 | // Check for multiaccount |
468 | - 'checkMultiAccount' => FLIGHT_PLAYER_SAME_IP, //+ |
|
468 | + 'checkMultiAccount' => FLIGHT_PLAYER_SAME_IP, //+ |
|
469 | 469 | // TODO - check for moratorium |
470 | 470 | |
471 | 471 | // If HOLD is selected AND it is real mission (page 3)... |