Skip to content

Commit

Permalink
GH-139 Create helper function to get fleet slots count
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Dec 21, 2020
1 parent 66ad162 commit 6dd6de5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/flightControl/_includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
include($includePath . './utils/helpers/getAvailableHoldTimes.helper.php');
include($includePath . './utils/helpers/getAvailableSpeeds.helper.php');
include($includePath . './utils/helpers/getFleetUnionJoinData.helper.php');
include($includePath . './utils/helpers/getUserFleetSlotsCount.helper.php');
include($includePath . './utils/validators/fleetArray.validator.php');
include($includePath . './utils/validators/joinUnion.validator.php');
include($includePath . './utils/validators/missionHold.validator.php');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace UniEngine\Engine\Modules\FlightControl\Utils\Helpers;

use UniEngine\Engine\Includes\Helpers\Users;

/**
* @param array $props
* @param ref $props['user']
* @param number $props['timestamp']
*/
function getUserFleetSlotsCount ($props) {
$user = &$props['user'];
$timestamp = $props['timestamp'];

$computerTechLevel = Users\getUsersTechLevel(108, $user);
$isAdmiralActive = ($user['admiral_time'] > $timestamp);

// return 0;

return (
1 +
$computerTechLevel +
($isAdmiralActive ? 2 : 0)
);
}

?>

0 comments on commit 6dd6de5

Please sign in to comment.