Skip to content

Commit

Permalink
GH-139 Use getAvailableSpeeds in fleet2
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Dec 9, 2020
1 parent 219559b commit 665d7b9
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions fleet2.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,30 +138,12 @@
message($_Lang['fl2_targeterror'], $ErrorTitle, 'fleet.php', 3);
}

// Create SpeedsArray
$SpeedsAvailable = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
$availableSpeeds = FlightControl\Utils\Helpers\getAvailableSpeeds([
'user' => &$_User,
'timestamp' => $Now,
]);

if($_User['admiral_time'] > $Now)
{
$SpeedsAvailable[] = 12;
$SpeedsAvailable[] = 11;
$SpeedsAvailable[] = 0.5;
$SpeedsAvailable[] = 0.25;
}
if(MORALE_ENABLED)
{
$MaxAvailableSpeed = max($SpeedsAvailable);
if($_User['morale_level'] >= MORALE_BONUS_FLEETSPEEDUP1)
{
$SpeedsAvailable[] = $MaxAvailableSpeed + (MORALE_BONUS_FLEETSPEEDUP1_VALUE / 10);
}
if($_User['morale_level'] >= MORALE_BONUS_FLEETSPEEDUP2)
{
$SpeedsAvailable[] = $MaxAvailableSpeed + (MORALE_BONUS_FLEETSPEEDUP2_VALUE / 10);
}
}
if(!in_array($_POST['speed'], $SpeedsAvailable))
{
if (!in_array($_POST['speed'], $availableSpeeds)) {
message($_Lang['fl_bad_fleet_speed'], $ErrorTitle, 'fleet.php', 3);
}

Expand Down

0 comments on commit 665d7b9

Please sign in to comment.