Skip to content

Commit

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

// 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($Fleet['Speed'], $SpeedsAvailable))
{
if (!in_array($Fleet['Speed'], $availableSpeeds)) {
messageRed($_Lang['fl_bad_fleet_speed'], $ErrorTitle);
}

Expand Down

0 comments on commit 0438c8a

Please sign in to comment.