@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | 'advGoogleLeftMenuCode' => '(Place here code for banner)', |
| 191 | 191 | |
| 192 | 192 | // Alliance bonus calculations |
| 193 | - 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
| 193 | + 'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
|
| 194 | 194 | 'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
| 195 | - 'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
|
| 195 | + 'ali_bonus_brackets_divisor' => 10, // Bonus divisor for ALI_BONUS_BY_RANK |
|
| 196 | 196 | 'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
| 197 | 197 | 'ali_bonus_members' => 10, // Minumum alliace size to start using bonus |
| 198 | 198 | |
@@ -223,25 +223,25 @@ discard block |
||
| 223 | 223 | 'deuterium_basic_income' => 0, |
| 224 | 224 | 'eco_scale_storage' => 1, |
| 225 | 225 | 'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
| 226 | - 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
| 226 | + 'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
|
| 227 | 227 | 'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
| 228 | 228 | 'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
| 229 | 229 | 'energy_basic_income' => 0, |
| 230 | 230 | |
| 231 | 231 | // Bashing protection settings |
| 232 | - 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
| 233 | - 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
| 234 | - 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
| 235 | - 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
| 236 | - 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
| 232 | + 'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
|
| 233 | + 'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
|
| 234 | + 'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
|
| 235 | + 'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
|
| 236 | + 'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
|
| 237 | 237 | |
| 238 | 238 | 'Fleet_Cdr' => 30, |
| 239 | 239 | 'fleet_speed' => 1, |
| 240 | 240 | |
| 241 | 241 | 'fleet_update_interval' => 4, |
| 242 | 242 | |
| 243 | - 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
| 244 | - 'game_counter' => 0, // Does built-in page hit counter is on? |
|
| 243 | + 'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
|
| 244 | + 'game_counter' => 0, // Does built-in page hit counter is on? |
|
| 245 | 245 | // Defaults |
| 246 | 246 | 'game_default_language' => 'ru', |
| 247 | 247 | 'game_default_skin' => 'skins/EpicBlue/', |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | 'game_maxSystem' => 199, |
| 256 | 256 | 'game_maxPlanet' => 15, |
| 257 | 257 | // Game global settings |
| 258 | - 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
| 258 | + 'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
|
| 259 | 259 | 'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
| 260 | 260 | |
| 261 | 261 | 'game_news_actual' => 259200, // How long announcement would be marked as "New". In seconds. Default - 3 days |
| 262 | - 'game_news_overview' => 3, // How much last news to show in Overview page |
|
| 262 | + 'game_news_overview' => 3, // How much last news to show in Overview page |
|
| 263 | 263 | // Noob protection |
| 264 | - 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
| 264 | + 'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
|
| 265 | 265 | 'game_noob_points' => 5000, // Below this point user threated as noob. 0 to disable |
| 266 | 266 | |
| 267 | 267 | 'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | 'payment_currency_exchange_wmu' => 30, |
| 312 | 312 | 'payment_currency_exchange_wmz' => 1, |
| 313 | 313 | |
| 314 | - 'payment_lot_price' => 1, // Lot price in default currency |
|
| 315 | - 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
| 314 | + 'payment_lot_price' => 1, // Lot price in default currency |
|
| 315 | + 'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
|
| 316 | 316 | |
| 317 | 317 | 'planet_teleport_cost' => 50000, // |
| 318 | 318 | 'planet_teleport_timeout' => 86400, // |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | 'resource_multiplier' => 1, |
| 331 | 331 | |
| 332 | 332 | //Roleplay system |
| 333 | - 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
| 333 | + 'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
|
| 334 | 334 | 'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
| 335 | 335 | |
| 336 | 336 | // Black Market - General |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | * @since 5.0.0 |
| 81 | 81 | */ |
| 82 | 82 | public function offsetUnset($offset) { |
| 83 | - if($this->offsetExists($offset)) { |
|
| 83 | + if ($this->offsetExists($offset)) { |
|
| 84 | 84 | parent::offsetUnset($this->offsetGet($offset)); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public static function build($callable) { |
| 18 | - if(is_array($callable) && count($callable) == 2 && is_object($callable[0])) { |
|
| 18 | + if (is_array($callable) && count($callable) == 2 && is_object($callable[0])) { |
|
| 19 | 19 | return new static($callable); |
| 20 | 20 | } else { |
| 21 | 21 | return false; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $source_planet = &$mission_data->src_planet; |
| 19 | 19 | $destination_planet = &$mission_data->dst_planet; |
| 20 | 20 | |
| 21 | - if(empty($destination_planet['id_owner'])) { |
|
| 21 | + if (empty($destination_planet['id_owner'])) { |
|
| 22 | 22 | $objFleet->markReturnedAndSave(); |
| 23 | 23 | |
| 24 | 24 | return $result; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $fleet_resources[RES_DEUTERIUM], classLocale::$lang['Deuterium']); |
| 34 | 34 | DBStaticMessages::msg_send_simple_message($objFleet->target_owner_id, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_transport'], $Message); |
| 35 | 35 | |
| 36 | - if($objFleet->target_owner_id <> $objFleet->playerOwnerId) { |
|
| 36 | + if ($objFleet->target_owner_id <> $objFleet->playerOwnerId) { |
|
| 37 | 37 | DBStaticMessages::msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_transport'], $Message); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -93,28 +93,28 @@ discard block |
||
| 93 | 93 | public function __construct(\Common\GlobalContainer $gc) { |
| 94 | 94 | parent::__construct($gc); |
| 95 | 95 | |
| 96 | - $this->accessors->set(P_CONTAINER_SET, 'dbId', function (V2FleetContainer $that, $value) { |
|
| 96 | + $this->accessors->set(P_CONTAINER_SET, 'dbId', function(V2FleetContainer $that, $value) { |
|
| 97 | 97 | $that->setDirect('dbId', $value); |
| 98 | 98 | $that->location->setLocationId($value); |
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | - $this->accessors->set(P_CONTAINER_SET, 'ownerId', function (V2FleetContainer $that, $value) { |
|
| 101 | + $this->accessors->set(P_CONTAINER_SET, 'ownerId', function(V2FleetContainer $that, $value) { |
|
| 102 | 102 | $that->setDirect('ownerId', $value); |
| 103 | 103 | $that->location->setLocationPlayerId($value); |
| 104 | 104 | }); |
| 105 | 105 | |
| 106 | - $this->accessors->set(P_CONTAINER_SET, 'owner', function (V2FleetContainer $that, $value) { |
|
| 106 | + $this->accessors->set(P_CONTAINER_SET, 'owner', function(V2FleetContainer $that, $value) { |
|
| 107 | 107 | $that->owner = $value; |
| 108 | - if(isset($value['id'])) { |
|
| 108 | + if (isset($value['id'])) { |
|
| 109 | 109 | $that->ownerId = $value['id']; |
| 110 | 110 | } else { |
| 111 | 111 | $that->ownerId = 0; |
| 112 | 112 | } |
| 113 | 113 | }); |
| 114 | 114 | |
| 115 | - $this->accessors->set(P_CONTAINER_SET, 'departure', function (V2FleetContainer $that, $value) { |
|
| 115 | + $this->accessors->set(P_CONTAINER_SET, 'departure', function(V2FleetContainer $that, $value) { |
|
| 116 | 116 | $that->departure = $value; |
| 117 | - if(isset($value['id'])) { |
|
| 117 | + if (isset($value['id'])) { |
|
| 118 | 118 | $that->departurePlanetId = $value['id']; |
| 119 | 119 | $that->vectorDeparture = $value; |
| 120 | 120 | } else { |
@@ -122,20 +122,20 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | 124 | |
| 125 | - $this->accessors->set(P_CONTAINER_GET, 'vectorDeparture', function (V2FleetContainer $that) { |
|
| 125 | + $this->accessors->set(P_CONTAINER_GET, 'vectorDeparture', function(V2FleetContainer $that) { |
|
| 126 | 126 | $vector = new Vector(); |
| 127 | 127 | $that->setDirect('vectorDeparture', $vector); |
| 128 | 128 | |
| 129 | 129 | return $vector; |
| 130 | 130 | }, ACCESSOR_SHARED); |
| 131 | - $this->accessors->set(P_CONTAINER_SET, 'vectorDeparture', function (V2FleetContainer $that, $value) { |
|
| 131 | + $this->accessors->set(P_CONTAINER_SET, 'vectorDeparture', function(V2FleetContainer $that, $value) { |
|
| 132 | 132 | $vector = $that->vectorDeparture; |
| 133 | 133 | |
| 134 | - if(is_array($value)) { |
|
| 134 | + if (is_array($value)) { |
|
| 135 | 135 | $value = Vector::convertToVector($value); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if($value instanceof Vector) { |
|
| 138 | + if ($value instanceof Vector) { |
|
| 139 | 139 | $vector->readFromVector($value); |
| 140 | 140 | } else { |
| 141 | 141 | throw new \Exception('V2Fleet::vectorDeparture setter - value is not a Vector or array!', ERR_ERROR); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $this->accessors->set(P_CONTAINER_EXPORT, 'vectorArrive', array($this, 'exportVector')); |
| 149 | 149 | |
| 150 | 150 | |
| 151 | - $this->accessors->set(P_CONTAINER_GET, 'location', function (V2FleetContainer $that) { |
|
| 151 | + $this->accessors->set(P_CONTAINER_GET, 'location', function(V2FleetContainer $that) { |
|
| 152 | 152 | // if (is_null($location = $that->getDirect('location'))) {} |
| 153 | 153 | $location = new V2Location(LOC_FLEET); |
| 154 | 154 | $that->setDirect('location', $location); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | return $location; |
| 157 | 157 | }, ACCESSOR_SHARED); |
| 158 | 158 | |
| 159 | - $this->accessors->set(P_CONTAINER_GET, 'units', function (V2FleetContainer $that) { |
|
| 159 | + $this->accessors->set(P_CONTAINER_GET, 'units', function(V2FleetContainer $that) { |
|
| 160 | 160 | // if (is_null($units = $that->getDirect('units'))) {} |
| 161 | 161 | $units = \classSupernova::$gc->unitList; |
| 162 | 162 | $that->setDirect('units', $units); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | return $units; |
| 165 | 165 | }, ACCESSOR_SHARED); |
| 166 | 166 | |
| 167 | - $this->accessors->set(P_CONTAINER_GET, 'isReturning', function (V2FleetContainer $that) { |
|
| 167 | + $this->accessors->set(P_CONTAINER_GET, 'isReturning', function(V2FleetContainer $that) { |
|
| 168 | 168 | return $that->status == FLEET_FLAG_RETURNING; |
| 169 | 169 | }); |
| 170 | 170 | |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | $RecyclerCapacity = 0; |
| 17 | 17 | $OtherFleetCapacity = 0; |
| 18 | 18 | |
| 19 | - foreach($objFleet->shipsIterator() as $unit_id => $unit) { |
|
| 20 | - if(in_array($unit_id, classSupernova::$gc->groupFleet)) { |
|
| 19 | + foreach ($objFleet->shipsIterator() as $unit_id => $unit) { |
|
| 20 | + if (in_array($unit_id, classSupernova::$gc->groupFleet)) { |
|
| 21 | 21 | $capacity = get_unit_param($unit_id, P_CAPACITY) * $unit->count; |
| 22 | - if(in_array($unit_id, classSupernova::$gc->groupRecyclers)) { |
|
| 22 | + if (in_array($unit_id, classSupernova::$gc->groupRecyclers)) { |
|
| 23 | 23 | $RecyclerCapacity += $capacity; |
| 24 | 24 | } else { |
| 25 | 25 | $OtherFleetCapacity += $capacity; |
@@ -28,33 +28,33 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $fleet_resources_amount = $objFleet->resourcesGetTotal(); |
| 31 | - if($fleet_resources_amount > $OtherFleetCapacity) { |
|
| 31 | + if ($fleet_resources_amount > $OtherFleetCapacity) { |
|
| 32 | 32 | // Если во флоте есть другие корабли И количество ресурсов больше, чем их ёмкость трюмов - значит часть этих ресурсов лежит в трюмах переработчиков |
| 33 | 33 | // Уменьшаем ёмкость переработчиков на указанную величину |
| 34 | 34 | $RecyclerCapacity -= ($fleet_resources_amount - $OtherFleetCapacity); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $resources_recycled = array(); |
| 38 | - if(($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) { |
|
| 38 | + if (($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) { |
|
| 39 | 39 | $resources_recycled[RES_METAL] = $destination_planet["debris_metal"]; |
| 40 | 40 | $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"]; |
| 41 | 41 | } else { |
| 42 | - if(($destination_planet["debris_metal"] > $RecyclerCapacity / 2) && |
|
| 42 | + if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) && |
|
| 43 | 43 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2) |
| 44 | 44 | ) { |
| 45 | 45 | $resources_recycled[RES_METAL] = $RecyclerCapacity / 2; |
| 46 | 46 | $resources_recycled[RES_CRYSTAL] = $RecyclerCapacity / 2; |
| 47 | 47 | } else { |
| 48 | - if($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) { |
|
| 48 | + if ($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) { |
|
| 49 | 49 | $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"]; |
| 50 | - if($destination_planet["debris_metal"] > ($RecyclerCapacity - $resources_recycled[RES_CRYSTAL])) { |
|
| 50 | + if ($destination_planet["debris_metal"] > ($RecyclerCapacity - $resources_recycled[RES_CRYSTAL])) { |
|
| 51 | 51 | $resources_recycled[RES_METAL] = $RecyclerCapacity - $resources_recycled[RES_CRYSTAL]; |
| 52 | 52 | } else { |
| 53 | 53 | $resources_recycled[RES_METAL] = $destination_planet["debris_metal"]; |
| 54 | 54 | } |
| 55 | 55 | } else { |
| 56 | 56 | $resources_recycled[RES_METAL] = $destination_planet["debris_metal"]; |
| 57 | - if($destination_planet["debris_crystal"] > ($RecyclerCapacity - $resources_recycled[RES_METAL])) { |
|
| 57 | + if ($destination_planet["debris_crystal"] > ($RecyclerCapacity - $resources_recycled[RES_METAL])) { |
|
| 58 | 58 | $resources_recycled[RES_CRYSTAL] = $RecyclerCapacity - $resources_recycled[RES_METAL]; |
| 59 | 59 | } else { |
| 60 | 60 | $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"]; |
@@ -8,14 +8,14 @@ discard block |
||
| 8 | 8 | use Vector\Vector; |
| 9 | 9 | |
| 10 | 10 | function flt_fleet_speed($user, $fleet) { |
| 11 | - if(!is_array($fleet)) { |
|
| 11 | + if (!is_array($fleet)) { |
|
| 12 | 12 | $fleet = array($fleet => 1); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | $speeds = array(); |
| 16 | - if(!empty($fleet)) { |
|
| 17 | - foreach($fleet as $ship_id => $amount) { |
|
| 18 | - if($amount && in_array($ship_id, classSupernova::$gc->groupFleetAndMissiles)) { |
|
| 16 | + if (!empty($fleet)) { |
|
| 17 | + foreach ($fleet as $ship_id => $amount) { |
|
| 18 | + if ($amount && in_array($ship_id, classSupernova::$gc->groupFleetAndMissiles)) { |
|
| 19 | 19 | $single_ship_data = get_ship_data($ship_id, $user); |
| 20 | 20 | $speeds[] = $single_ship_data['speed']; |
| 21 | 21 | } |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $game_fleet_speed = flt_server_flight_speed_multiplier(); |
| 49 | 49 | $fleet_speed = flt_fleet_speed($user_row, $fleet_array); |
| 50 | - if(!empty($fleet_array) && $fleet_speed && $game_fleet_speed) { |
|
| 50 | + if (!empty($fleet_array) && $fleet_speed && $game_fleet_speed) { |
|
| 51 | 51 | $speed_percent = $speed_percent ? max(min($speed_percent, 10), 1) : 10; |
| 52 | 52 | $real_speed = $speed_percent * sqrt($fleet_speed); |
| 53 | 53 | |
| 54 | 54 | $duration = max(1, round((35000 / $speed_percent * sqrt($distance * 10 / $fleet_speed) + 10) / $game_fleet_speed)); |
| 55 | 55 | |
| 56 | - foreach($fleet_array as $ship_id => $ship_count) { |
|
| 57 | - if(!$ship_id || !$ship_count) { |
|
| 56 | + foreach ($fleet_array as $ship_id => $ship_count) { |
|
| 57 | + if (!$ship_id || !$ship_count) { |
|
| 58 | 58 | continue; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -82,19 +82,19 @@ discard block |
||
| 82 | 82 | function flt_bashing_check($user, $enemy, $planet_dst, $mission, $flight_duration, $fleet_group = 0) { |
| 83 | 83 | $config_bashing_attacks = classSupernova::$config->fleet_bashing_attacks; |
| 84 | 84 | $config_bashing_interval = classSupernova::$config->fleet_bashing_interval; |
| 85 | - if(!$config_bashing_attacks) { |
|
| 85 | + if (!$config_bashing_attacks) { |
|
| 86 | 86 | // Bashing allowed - protection disabled |
| 87 | 87 | return FLIGHT_ALLOWED; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $bashing_result = FLIGHT_MISSION_ATTACK_BASHING; |
| 91 | - if($user['ally_id'] && $enemy['ally_id']) { |
|
| 91 | + if ($user['ally_id'] && $enemy['ally_id']) { |
|
| 92 | 92 | $relations = ali_relations($user['ally_id'], $enemy['ally_id']); |
| 93 | - if(!empty($relations)) { |
|
| 93 | + if (!empty($relations)) { |
|
| 94 | 94 | $relations = $relations[$enemy['ally_id']]; |
| 95 | - switch($relations['alliance_diplomacy_relation']) { |
|
| 95 | + switch ($relations['alliance_diplomacy_relation']) { |
|
| 96 | 96 | case ALLY_DIPLOMACY_WAR: |
| 97 | - if(SN_TIME_NOW - $relations['alliance_diplomacy_time'] <= classSupernova::$config->fleet_bashing_war_delay) { |
|
| 97 | + if (SN_TIME_NOW - $relations['alliance_diplomacy_time'] <= classSupernova::$config->fleet_bashing_war_delay) { |
|
| 98 | 98 | $bashing_result = FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY; |
| 99 | 99 | } else { |
| 100 | 100 | return FLIGHT_ALLOWED; |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | // Retrieving flying fleets |
| 118 | 118 | $objFleetsBashing = FleetList::dbGetFleetListBashing($user['id'], $planet_dst); |
| 119 | - foreach($objFleetsBashing->_container as $fleetBashing) { |
|
| 119 | + foreach ($objFleetsBashing->_container as $fleetBashing) { |
|
| 120 | 120 | // Checking for ACS - each ACS count only once |
| 121 | - if($fleetBashing->group_id) { |
|
| 121 | + if ($fleetBashing->group_id) { |
|
| 122 | 122 | $bashing_list["{$user['id']}_{$fleetBashing->group_id}"] = $fleetBashing->time_arrive_to_target; |
| 123 | 123 | } else { |
| 124 | 124 | $bashing_list[] = $fleetBashing->time_arrive_to_target; |
@@ -126,12 +126,12 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // Check for joining to ACS - if there are already fleets in ACS no checks should be done |
| 129 | - if($mission == MT_ACS && $bashing_list["{$user['id']}_{$fleet_group}"]) { |
|
| 129 | + if ($mission == MT_ACS && $bashing_list["{$user['id']}_{$fleet_group}"]) { |
|
| 130 | 130 | return FLIGHT_ALLOWED; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $query = DBStaticFleetBashing::db_bashing_list_get($user, $planet_dst, $time_limit); |
| 134 | - while($bashing_row = db_fetch($query)) { |
|
| 134 | + while ($bashing_row = db_fetch($query)) { |
|
| 135 | 135 | $bashing_list[] = $bashing_row['bashing_time']; |
| 136 | 136 | } |
| 137 | 137 | |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | $last_attack = 0; |
| 141 | 141 | $wave = 0; |
| 142 | 142 | $attack = 1; |
| 143 | - foreach($bashing_list as &$bash_time) { |
|
| 143 | + foreach ($bashing_list as &$bash_time) { |
|
| 144 | 144 | $attack++; |
| 145 | - if($bash_time - $last_attack > $config_bashing_interval || $attack > $config_bashing_attacks) { |
|
| 145 | + if ($bash_time - $last_attack > $config_bashing_interval || $attack > $config_bashing_attacks) { |
|
| 146 | 146 | $attack = 1; |
| 147 | 147 | $wave++; |
| 148 | 148 | } |
@@ -159,16 +159,16 @@ discard block |
||
| 159 | 159 | //TODO: try..catch |
| 160 | 160 | global $user; |
| 161 | 161 | |
| 162 | - if($user['vacation']) { |
|
| 162 | + if ($user['vacation']) { |
|
| 163 | 163 | return $result = FLIGHT_PLAYER_VACATION_OWN; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if(empty($fleet) || !is_array($fleet)) { |
|
| 166 | + if (empty($fleet) || !is_array($fleet)) { |
|
| 167 | 167 | return $result = FLIGHT_SHIPS_NO_SHIPS; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $sn_groups_mission = sn_get_groups('missions'); |
| 171 | - if(!isset($sn_groups_mission[$mission])) { |
|
| 171 | + if (!isset($sn_groups_mission[$mission])) { |
|
| 172 | 172 | return $result = FLIGHT_MISSION_UNKNOWN; |
| 173 | 173 | } |
| 174 | 174 | $sn_data_mission = $sn_groups_mission[$mission]; |
@@ -187,32 +187,32 @@ discard block |
||
| 187 | 187 | $resources = 0; |
| 188 | 188 | $ship_ids = classSupernova::$gc->groupFleet; |
| 189 | 189 | $resource_ids = sn_get_groups('resources_loot'); |
| 190 | - foreach($fleet as $ship_id => $ship_count) { |
|
| 190 | + foreach ($fleet as $ship_id => $ship_count) { |
|
| 191 | 191 | $is_ship = in_array($ship_id, $ship_ids); |
| 192 | 192 | $is_resource = in_array($ship_id, $resource_ids); |
| 193 | - if(!$is_ship && !$is_resource) { |
|
| 193 | + if (!$is_ship && !$is_resource) { |
|
| 194 | 194 | // TODO Спецобработчик для Капитана и модулей |
| 195 | 195 | // return FLIGHT_SHIPS_UNIT_WRONG; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if($ship_count < 0) { |
|
| 198 | + if ($ship_count < 0) { |
|
| 199 | 199 | return $result = $is_ship ? FLIGHT_SHIPS_NEGATIVE : FLIGHT_RESOURCES_NEGATIVE; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if($ship_count > mrc_get_level($user, $planet_src, $ship_id)) { |
|
| 202 | + if ($ship_count > mrc_get_level($user, $planet_src, $ship_id)) { |
|
| 203 | 203 | // TODO FLIGHT_MISSION_MISSILE_NO_MISSILES |
| 204 | 204 | return $result = $is_ship ? FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES : FLIGHT_RESOURCES_NOT_ENOUGH; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if($is_ship) { |
|
| 207 | + if ($is_ship) { |
|
| 208 | 208 | $single_ship_data = get_ship_data($ship_id, $user); |
| 209 | - if($single_ship_data[P_SPEED] <= 0) { |
|
| 209 | + if ($single_ship_data[P_SPEED] <= 0) { |
|
| 210 | 210 | return $result = FLIGHT_SHIPS_UNMOVABLE; |
| 211 | 211 | } |
| 212 | 212 | $ships += $ship_count; |
| 213 | 213 | $recyclers += in_array($ship_id, classSupernova::$gc->groupRecyclers) ? $ship_count : 0; |
| 214 | 214 | $spies += $ship_id == SHIP_SPY ? $ship_count : 0; |
| 215 | - } elseif($is_resource) { |
|
| 215 | + } elseif ($is_resource) { |
|
| 216 | 216 | $resources += $ship_count; |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | */ |
| 225 | 225 | |
| 226 | - if(isset($options['resources']) && $options['resources'] > 0 && !(isset($sn_data_mission['transport']) && $sn_data_mission['transport'])) { |
|
| 226 | + if (isset($options['resources']) && $options['resources'] > 0 && !(isset($sn_data_mission['transport']) && $sn_data_mission['transport'])) { |
|
| 227 | 227 | return $result = FLIGHT_RESOURCES_FORBIDDEN; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -235,78 +235,78 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | |
| 237 | 237 | $speed = $options['fleet_speed_percent']; |
| 238 | - if($speed && ($speed != intval($speed) || $speed < 1 || $speed > 10)) { |
|
| 238 | + if ($speed && ($speed != intval($speed) || $speed < 1 || $speed > 10)) { |
|
| 239 | 239 | return $result = FLIGHT_FLEET_SPEED_WRONG; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $travel_data = flt_travel_data($user, $planet_src, $planet_dst, $fleet, $options['fleet_speed_percent']); |
| 243 | 243 | |
| 244 | 244 | |
| 245 | - if(mrc_get_level($user, $planet_src, RES_DEUTERIUM) < $fleet[RES_DEUTERIUM] + $travel_data['consumption']) { |
|
| 245 | + if (mrc_get_level($user, $planet_src, RES_DEUTERIUM) < $fleet[RES_DEUTERIUM] + $travel_data['consumption']) { |
|
| 246 | 246 | return $result = FLIGHT_RESOURCES_FUEL_NOT_ENOUGH; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if($travel_data['consumption'] > $travel_data['capacity']) { |
|
| 249 | + if ($travel_data['consumption'] > $travel_data['capacity']) { |
|
| 250 | 250 | return $result = FLIGHT_FLEET_TOO_FAR; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - if($travel_data['hold'] < $resources) { |
|
| 253 | + if ($travel_data['hold'] < $resources) { |
|
| 254 | 254 | return $result = FLIGHT_FLEET_OVERLOAD; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | $fleet_start_time = SN_TIME_NOW + $travel_data['duration']; |
| 258 | 258 | |
| 259 | 259 | $fleet_group = $options['fleet_group']; |
| 260 | - if($fleet_group) { |
|
| 261 | - if($mission != MT_ACS) { |
|
| 260 | + if ($fleet_group) { |
|
| 261 | + if ($mission != MT_ACS) { |
|
| 262 | 262 | return $result = FLIGHT_MISSION_IMPOSSIBLE; |
| 263 | 263 | }; |
| 264 | 264 | |
| 265 | 265 | $acs = DBStaticFleetACS::db_acs_get_by_group_id($fleet_group); |
| 266 | - if(!$acs['id']) { |
|
| 266 | + if (!$acs['id']) { |
|
| 267 | 267 | return $result = FLIGHT_MISSION_ACS_NOT_EXISTS; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - if($planet_dst['galaxy'] != $acs['galaxy'] || $planet_dst['system'] != $acs['system'] || $planet_dst['planet'] != $acs['planet'] || $planet_dst['planet_type'] != $acs['planet_type']) { |
|
| 270 | + if ($planet_dst['galaxy'] != $acs['galaxy'] || $planet_dst['system'] != $acs['system'] || $planet_dst['planet'] != $acs['planet'] || $planet_dst['planet_type'] != $acs['planet_type']) { |
|
| 271 | 271 | return $result = FLIGHT_MISSION_ACS_WRONG_TARGET; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if($fleet_start_time > $acs['ankunft']) { |
|
| 274 | + if ($fleet_start_time > $acs['ankunft']) { |
|
| 275 | 275 | return $result = FLIGHT_MISSION_ACS_TOO_LATE; |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | $flying_fleets = $options['flying_fleets']; |
| 280 | - if(!$flying_fleets) { |
|
| 280 | + if (!$flying_fleets) { |
|
| 281 | 281 | $flying_fleets = FleetList::fleet_count_flying($user['id']); |
| 282 | 282 | } |
| 283 | - if(GetMaxFleets($user) <= $flying_fleets && $mission != MT_MISSILE) { |
|
| 283 | + if (GetMaxFleets($user) <= $flying_fleets && $mission != MT_MISSILE) { |
|
| 284 | 284 | return $result = FLIGHT_FLEET_NO_SLOTS; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // В одиночку шпионские зонды могут летать только в миссии Шпионаж, Передислокация и Транспорт |
| 288 | - if($ships && $spies && $spies == $ships && !($mission == MT_SPY || $mission == MT_RELOCATE || $mission == MT_TRANSPORT)) { |
|
| 288 | + if ($ships && $spies && $spies == $ships && !($mission == MT_SPY || $mission == MT_RELOCATE || $mission == MT_TRANSPORT)) { |
|
| 289 | 289 | return $result = FLIGHT_SHIPS_NOT_ONLY_SPIES; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | // Checking for no planet |
| 293 | - if(!$planet_dst['id_owner']) { |
|
| 294 | - if($mission == MT_COLONIZE && !$fleet[SHIP_COLONIZER]) { |
|
| 293 | + if (!$planet_dst['id_owner']) { |
|
| 294 | + if ($mission == MT_COLONIZE && !$fleet[SHIP_COLONIZER]) { |
|
| 295 | 295 | return $result = FLIGHT_SHIPS_NO_COLONIZER; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - if($mission == MT_EXPLORE || $mission == MT_COLONIZE) { |
|
| 298 | + if ($mission == MT_EXPLORE || $mission == MT_COLONIZE) { |
|
| 299 | 299 | return $result = FLIGHT_ALLOWED; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | return $result = FLIGHT_VECTOR_NO_TARGET; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - if($mission == MT_RECYCLE) { |
|
| 306 | - if($planet_dst['debris_metal'] + $planet_dst['debris_crystal'] <= 0) { |
|
| 305 | + if ($mission == MT_RECYCLE) { |
|
| 306 | + if ($planet_dst['debris_metal'] + $planet_dst['debris_crystal'] <= 0) { |
|
| 307 | 307 | return $result = FLIGHT_MISSION_RECYCLE_NO_DEBRIS; |
| 308 | 308 | } |
| 309 | - if($recyclers <= 0) { |
|
| 309 | + if ($recyclers <= 0) { |
|
| 310 | 310 | return $result = FLIGHT_SHIPS_NO_RECYCLERS; |
| 311 | 311 | } |
| 312 | 312 | |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | // Got planet. Checking if it is ours |
| 317 | - if($planet_dst['id_owner'] == $user['id']) { |
|
| 318 | - if($mission == MT_TRANSPORT || $mission == MT_RELOCATE) { |
|
| 317 | + if ($planet_dst['id_owner'] == $user['id']) { |
|
| 318 | + if ($mission == MT_TRANSPORT || $mission == MT_RELOCATE) { |
|
| 319 | 319 | return $result = FLIGHT_ALLOWED; |
| 320 | 320 | } |
| 321 | 321 | |
@@ -323,19 +323,19 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | // No, planet not ours. Cutting mission that can't be send to not-ours planet |
| 326 | - if($mission == MT_RELOCATE || $mission == MT_COLONIZE || $mission == MT_EXPLORE) { |
|
| 326 | + if ($mission == MT_RELOCATE || $mission == MT_COLONIZE || $mission == MT_EXPLORE) { |
|
| 327 | 327 | return $result = FLIGHT_MISSION_IMPOSSIBLE; |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $enemy = DBStaticUser::db_user_by_id($planet_dst['id_owner']); |
| 331 | 331 | // We cannot attack or send resource to users in VACATION mode |
| 332 | - if($enemy['vacation'] && $mission != MT_RECYCLE) { |
|
| 332 | + if ($enemy['vacation'] && $mission != MT_RECYCLE) { |
|
| 333 | 333 | return $result = FLIGHT_PLAYER_VACATION; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | // Multi IP protection |
| 337 | 337 | // TODO: Here we need a procedure to check proxies |
| 338 | - if(sys_is_multiaccount($user, $enemy)) { |
|
| 338 | + if (sys_is_multiaccount($user, $enemy)) { |
|
| 339 | 339 | return $result = FLIGHT_PLAYER_SAME_IP; |
| 340 | 340 | } |
| 341 | 341 | |
@@ -343,8 +343,8 @@ discard block |
||
| 343 | 343 | $enemy_points = $enemy['total_points']; |
| 344 | 344 | |
| 345 | 345 | // Is it transport? If yes - checking for buffing to prevent mega-alliance destroyer |
| 346 | - if($mission == MT_TRANSPORT) { |
|
| 347 | - if($user_points >= $enemy_points || classSupernova::$config->allow_buffing) { |
|
| 346 | + if ($mission == MT_TRANSPORT) { |
|
| 347 | + if ($user_points >= $enemy_points || classSupernova::$config->allow_buffing) { |
|
| 348 | 348 | return $result = FLIGHT_ALLOWED; |
| 349 | 349 | } else { |
| 350 | 350 | return $result = FLIGHT_PLAYER_BUFFING; |
@@ -354,66 +354,66 @@ discard block |
||
| 354 | 354 | // Only aggresive missions passed to this point. HOLD counts as passive but aggresive |
| 355 | 355 | |
| 356 | 356 | // Is it admin with planet protection? |
| 357 | - if($planet_dst['id_level'] > $user['authlevel']) { |
|
| 357 | + if ($planet_dst['id_level'] > $user['authlevel']) { |
|
| 358 | 358 | return $result = FLIGHT_PLAYER_ADMIN; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | // Okay. Now skipping protection checks for inactive longer then 1 week |
| 362 | - if(!$enemy['onlinetime'] || $enemy['onlinetime'] >= (SN_TIME_NOW - 60 * 60 * 24 * 7)) { |
|
| 363 | - if( |
|
| 362 | + if (!$enemy['onlinetime'] || $enemy['onlinetime'] >= (SN_TIME_NOW - 60 * 60 * 24 * 7)) { |
|
| 363 | + if ( |
|
| 364 | 364 | ($enemy_points <= classSupernova::$config->game_noob_points && $user_points > classSupernova::$config->game_noob_points) |
| 365 | 365 | || |
| 366 | 366 | (classSupernova::$config->game_noob_factor && $user_points > $enemy_points * classSupernova::$config->game_noob_factor) |
| 367 | 367 | ) { |
| 368 | - if($mission != MT_HOLD) { |
|
| 368 | + if ($mission != MT_HOLD) { |
|
| 369 | 369 | return $result = FLIGHT_PLAYER_NOOB; |
| 370 | 370 | } |
| 371 | - if($mission == MT_HOLD && !($user['ally_id'] && $user['ally_id'] == $enemy['ally_id'] && classSupernova::$config->ally_help_weak)) { |
|
| 371 | + if ($mission == MT_HOLD && !($user['ally_id'] && $user['ally_id'] == $enemy['ally_id'] && classSupernova::$config->ally_help_weak)) { |
|
| 372 | 372 | return $result = FLIGHT_PLAYER_NOOB; |
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | // Is it HOLD mission? If yes - there should be ally deposit |
| 378 | - if($mission == MT_HOLD) { |
|
| 379 | - if(mrc_get_level($user, $planet_dst, STRUC_ALLY_DEPOSIT)) { |
|
| 378 | + if ($mission == MT_HOLD) { |
|
| 379 | + if (mrc_get_level($user, $planet_dst, STRUC_ALLY_DEPOSIT)) { |
|
| 380 | 380 | return $result = FLIGHT_ALLOWED; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | return $result = FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - if($mission == MT_SPY) { |
|
| 386 | + if ($mission == MT_SPY) { |
|
| 387 | 387 | return $result = $spies >= 1 ? FLIGHT_ALLOWED : FLIGHT_MISSION_SPY_NO_SPIES; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // Is it MISSILE mission? |
| 391 | - if($mission == MT_MISSILE) { |
|
| 391 | + if ($mission == MT_MISSILE) { |
|
| 392 | 392 | $sn_data_mip = get_unit_param(UNIT_DEF_MISSILE_INTERPLANET); |
| 393 | - if(mrc_get_level($user, $planet_src, STRUC_SILO) < $sn_data_mip[P_REQUIRE][STRUC_SILO]) { |
|
| 393 | + if (mrc_get_level($user, $planet_src, STRUC_SILO) < $sn_data_mip[P_REQUIRE][STRUC_SILO]) { |
|
| 394 | 394 | return $result = FLIGHT_MISSION_MISSILE_NO_SILO; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - if(!$fleet[UNIT_DEF_MISSILE_INTERPLANET]) { |
|
| 397 | + if (!$fleet[UNIT_DEF_MISSILE_INTERPLANET]) { |
|
| 398 | 398 | return $result = FLIGHT_MISSION_MISSILE_NO_MISSILES; |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | $distance = abs($planet_dst['system'] - $planet_src['system']); |
| 402 | 402 | $mip_range = flt_get_missile_range($user); |
| 403 | - if($distance > $mip_range || $planet_dst['galaxy'] != $planet_src['galaxy']) { |
|
| 403 | + if ($distance > $mip_range || $planet_dst['galaxy'] != $planet_src['galaxy']) { |
|
| 404 | 404 | return $result = FLIGHT_MISSION_MISSILE_TOO_FAR; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | - if(isset($options['target_structure']) && $options['target_structure'] && !in_array($options['target_structure'], sn_get_groups('defense_active'))) { |
|
| 407 | + if (isset($options['target_structure']) && $options['target_structure'] && !in_array($options['target_structure'], sn_get_groups('defense_active'))) { |
|
| 408 | 408 | return $result = FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE; |
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | - if($mission == MT_DESTROY && $planet_dst['planet_type'] != PT_MOON) { |
|
| 412 | + if ($mission == MT_DESTROY && $planet_dst['planet_type'] != PT_MOON) { |
|
| 413 | 413 | return $result = FLIGHT_MISSION_IMPOSSIBLE; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - if($mission == MT_ATTACK || $mission == MT_ACS || $mission == MT_DESTROY) { |
|
| 416 | + if ($mission == MT_ATTACK || $mission == MT_ACS || $mission == MT_DESTROY) { |
|
| 417 | 417 | return $result = flt_bashing_check($user, $enemy, $planet_dst, $mission, $travel_data['duration'], $fleet_group); |
| 418 | 418 | } |
| 419 | 419 | |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | $from = $from['planet']; |
| 441 | 441 | |
| 442 | 442 | $can_attack = flt_can_attack($from, $to, $fleet_REAL_array, $mission, $options); |
| 443 | - if($can_attack != FLIGHT_ALLOWED) { |
|
| 443 | + if ($can_attack != FLIGHT_ALLOWED) { |
|
| 444 | 444 | $internal_transaction ? sn_db_transaction_rollback() : false; |
| 445 | 445 | |
| 446 | 446 | return $can_attack; |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | $travel_data = flt_travel_data($user, $from, $to, $fleet_REAL_array, $options['fleet_speed_percent']); |
| 452 | 452 | |
| 453 | 453 | $time_on_mission = 0; |
| 454 | - if($mission == MT_EXPLORE || $mission == MT_HOLD) { |
|
| 454 | + if ($mission == MT_EXPLORE || $mission == MT_HOLD) { |
|
| 455 | 455 | // TODO - include some checks about maximum and minumum stay_duration |
| 456 | 456 | $time_on_mission = $options['stay_time'] * 3600; |
| 457 | 457 | } |
@@ -473,14 +473,14 @@ discard block |
||
| 473 | 473 | $sn_group_fleet = classSupernova::$gc->groupFleet; |
| 474 | 474 | $sn_group_resources_loot = sn_get_groups('resources_loot'); |
| 475 | 475 | $planetRowFieldChanges = array(); |
| 476 | - foreach($fleet_REAL_array as $unit_id => $amount) { |
|
| 477 | - if(!$amount || !$unit_id) { |
|
| 476 | + foreach ($fleet_REAL_array as $unit_id => $amount) { |
|
| 477 | + if (!$amount || !$unit_id) { |
|
| 478 | 478 | continue; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - if(in_array($unit_id, $sn_group_fleet)) { |
|
| 481 | + if (in_array($unit_id, $sn_group_fleet)) { |
|
| 482 | 482 | DBStaticUnit::dbUpdateOrInsertUnit($unit_id, -$amount, $user, $from['id']); |
| 483 | - } elseif(in_array($unit_id, $sn_group_resources_loot)) { |
|
| 483 | + } elseif (in_array($unit_id, $sn_group_resources_loot)) { |
|
| 484 | 484 | $planetRowFieldChanges[$unit_id] -= $amount; |
| 485 | 485 | } |
| 486 | 486 | } |
@@ -512,16 +512,16 @@ discard block |
||
| 512 | 512 | |
| 513 | 513 | $ship_data = array(); |
| 514 | 514 | $fleet_array = array(); |
| 515 | - foreach($ship_list as $transport_id => $cork) { |
|
| 515 | + foreach ($ship_list as $transport_id => $cork) { |
|
| 516 | 516 | $ship_data[$transport_id] = flt_travel_data($user, $from, $to, array($transport_id => 1), 10); |
| 517 | 517 | } |
| 518 | 518 | uasort($ship_data, 'flt_calculate_ship_to_transport_sort'); |
| 519 | 519 | |
| 520 | 520 | $fleet_capacity = 0; |
| 521 | 521 | $fuel_total = $fuel_left = mrc_get_level($user, $from, RES_DEUTERIUM); |
| 522 | - foreach($ship_data as $transport_id => &$ship_info) { |
|
| 522 | + foreach ($ship_data as $transport_id => &$ship_info) { |
|
| 523 | 523 | $ship_loaded = min($ship_list[$transport_id], ceil($resource_amount / $ship_info['hold']), floor($fuel_left / $ship_info['consumption'])); |
| 524 | - if($ship_loaded) { |
|
| 524 | + if ($ship_loaded) { |
|
| 525 | 525 | $fleet_array[$transport_id] = $ship_loaded; |
| 526 | 526 | $resource_amount -= min($resource_amount, $ship_info['hold'] * $ship_loaded); |
| 527 | 527 | $fuel_left -= $ship_info['consumption'] * $ship_loaded; |
@@ -52,82 +52,82 @@ |
||
| 52 | 52 | $gc = $this; |
| 53 | 53 | |
| 54 | 54 | // Default db |
| 55 | - $gc->db = function ($c) { |
|
| 55 | + $gc->db = function($c) { |
|
| 56 | 56 | classSupernova::$db = $db = new \db_mysql($c); |
| 57 | 57 | |
| 58 | 58 | return $db; |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | - $gc->debug = function ($c) { |
|
| 61 | + $gc->debug = function($c) { |
|
| 62 | 62 | return new \debug(); |
| 63 | 63 | }; |
| 64 | 64 | |
| 65 | - $gc->types = function ($c) { |
|
| 65 | + $gc->types = function($c) { |
|
| 66 | 66 | return new \Common\Types(); |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | - $gc->cache = function ($c) { |
|
| 69 | + $gc->cache = function($c) { |
|
| 70 | 70 | return new \classCache(classSupernova::$cache_prefix); |
| 71 | 71 | }; |
| 72 | 72 | |
| 73 | - $gc->config = function ($c) { |
|
| 73 | + $gc->config = function($c) { |
|
| 74 | 74 | return new \classConfig(classSupernova::$cache_prefix); |
| 75 | 75 | }; |
| 76 | 76 | |
| 77 | - $gc->localePlayer = function (GlobalContainer $c) { |
|
| 77 | + $gc->localePlayer = function(GlobalContainer $c) { |
|
| 78 | 78 | return new \classLocale($c->config->server_locale_log_usage); |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | - $gc->dbGlobalRowOperator = function (GlobalContainer $c) { |
|
| 81 | + $gc->dbGlobalRowOperator = function(GlobalContainer $c) { |
|
| 82 | 82 | return new \DbRowDirectOperator($c->db); |
| 83 | 83 | }; |
| 84 | 84 | |
| 85 | - $gc->query = $gc->factory(function (GlobalContainer $c) { |
|
| 85 | + $gc->query = $gc->factory(function(GlobalContainer $c) { |
|
| 86 | 86 | return new \DbQueryConstructor($c->db); |
| 87 | 87 | }); |
| 88 | 88 | |
| 89 | - $gc->cacheOperator = function (GlobalContainer $gc) { |
|
| 89 | + $gc->cacheOperator = function(GlobalContainer $gc) { |
|
| 90 | 90 | return new \SnDbCachedOperator($gc); |
| 91 | 91 | }; |
| 92 | 92 | |
| 93 | 93 | $gc->snCacheClass = 'SnCache'; |
| 94 | - $gc->snCache = function (GlobalContainer $gc) { |
|
| 94 | + $gc->snCache = function(GlobalContainer $gc) { |
|
| 95 | 95 | return $gc->db->snCache; |
| 96 | 96 | }; |
| 97 | 97 | |
| 98 | 98 | $gc->buddyClass = 'Buddy\BuddyModel'; |
| 99 | - $gc->buddyModel = function (GlobalContainer $c) { |
|
| 99 | + $gc->buddyModel = function(GlobalContainer $c) { |
|
| 100 | 100 | return new $c->buddyClass($c); |
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | - $gc->unitModel = function (GlobalContainer $c) { |
|
| 103 | + $gc->unitModel = function(GlobalContainer $c) { |
|
| 104 | 104 | return new \V2Unit\V2UnitModel($c); |
| 105 | 105 | }; |
| 106 | - $gc->unitList = $this->factory(function (GlobalContainer $c) { |
|
| 106 | + $gc->unitList = $this->factory(function(GlobalContainer $c) { |
|
| 107 | 107 | return new \V2Unit\V2UnitList($c); |
| 108 | 108 | }); |
| 109 | 109 | |
| 110 | - $gc->fleetModel = function (GlobalContainer $c) { |
|
| 110 | + $gc->fleetModel = function(GlobalContainer $c) { |
|
| 111 | 111 | return new V2FleetModel($c); |
| 112 | 112 | }; |
| 113 | 113 | |
| 114 | - $gc->planetRenderer = function (GlobalContainer $c) { |
|
| 114 | + $gc->planetRenderer = function(GlobalContainer $c) { |
|
| 115 | 115 | return new PlanetRenderer($c); |
| 116 | 116 | }; |
| 117 | 117 | |
| 118 | - $gc->fleetRenderer = function (GlobalContainer $c) { |
|
| 118 | + $gc->fleetRenderer = function(GlobalContainer $c) { |
|
| 119 | 119 | return new \FleetRenderer($c); |
| 120 | 120 | }; |
| 121 | 121 | |
| 122 | - $gc->groupFleet = function (GlobalContainer $c) { |
|
| 122 | + $gc->groupFleet = function(GlobalContainer $c) { |
|
| 123 | 123 | return sn_get_groups('fleet'); |
| 124 | 124 | }; |
| 125 | 125 | |
| 126 | - $gc->groupFleetAndMissiles = function (GlobalContainer $c) { |
|
| 126 | + $gc->groupFleetAndMissiles = function(GlobalContainer $c) { |
|
| 127 | 127 | return sn_get_groups(array('fleet', GROUP_STR_MISSILES)); |
| 128 | 128 | }; |
| 129 | 129 | |
| 130 | - $gc->groupRecyclers = function (GlobalContainer $c) { |
|
| 130 | + $gc->groupRecyclers = function(GlobalContainer $c) { |
|
| 131 | 131 | return sn_get_groups('flt_recyclers'); |
| 132 | 132 | }; |
| 133 | 133 | |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | /** |
| 91 | 91 | * @param KeyedContainer $cEntity |
| 92 | 92 | */ |
| 93 | - protected function onSaveUnchanged($cEntity){ |
|
| 93 | + protected function onSaveUnchanged($cEntity) { |
|
| 94 | 94 | // TODO - or just save nothing ????? |
| 95 | 95 | // throw new \Exception('EntityModel isNotEmpty, have dbId and not CHANGED! It can\'t be!'); |
| 96 | 96 | // Do nothing |