XG Proyect

Shipyard extends BaseController
in package

Shipyard Class

Table of Contents

MODULE_ID  = 7
The module ID
$objects  : Objects
Contains the whole set of objects by request
$page  : Page
Contains the Page object
$planet  : array<string|int, mixed>
Contains the current planet data
$template  : Template
Contains the Template object
$user  : array<string|int, mixed>
Contains the current user data
$userLibrary  : User
Contains the User object
$allowed_items  : array<string|int, mixed>
List of currently available buildings
$building_in_progress  : bool
Store if we are currently building or not
$missiles  : array<string|int, mixed>
Count variable that we'll use to build the missile queue
$resources_consumed  : array<string|int, mixed>
The amount of resources that will need to decrease
__construct()  : mixed
Constructor
index()  : void
Users land here
loadLang()  : void
Load a language file using CI Library
loadModel()  : void
Load the provided model, support a dir path
getObjects()  : array<string|int, mixed>
Will be removed
getPlanetData()  : array<string|int, mixed>
Will be removed
getTemplate()  : array<string|int, mixed>
Will be removed
getUserData()  : array<string|int, mixed>
Will be removed
buildItemsQueue()  : string
Build the block that will display the queue of items
buildListOfItems()  : array<string|int, mixed>
Build the list of ships and defenses
buildPage()  : void
Build the page
calculateMissilesAmount()  : array<string|int, mixed>
Calculate missiles amount considering the planet current storage and queue
getBuildItemsButton()  : string
Get build items button, if the shipyard is not being improved
getCurrentPage()  : array<string|int, mixed>
Determine the current page and validate it
getItemAmount()  : int
Expects an item ID to calculate the item current amount
getItemAmountWithFormat()  : string
Expects an item ID to calculate and format the item current amount
getItemDescription()  : string
Return the item short description
getItemInsertBlock()  : string
Insert the item box that allows new item inserts
getItemNeededResourcesByAmount()  : array<string|int, mixed>
Get the maximum amount of items that can be build
getItemPriceWithFormat()  : string
Expects a item ID (ship or defense) to calculate and format the price
getItemTime()  : int
Expects a item ID (ship or defense) to calculate the construction time
getItemTimeWithFormat()  : string
Expects a item ID (ship or defense) to calculate and format the time
getMaxBuildableItems()  : int
Get the maximum amount of items that can be build
getMaxBuildableItemsByResource()  : int
Get max amount of buildable items based on the planet current resources
getMaxBuildableItemsBySystemLimit()  : int
Get max amount of buildable items based on the system configuration
getMissilesItemLimit()  : int
Return the max amount of buildable missiles
getShieldDomeItemLimit()  : int
Return the max amount of buildable shield domes
isAnyFacilityWorking()  : void
Check if the robot factory, nanobots factory or hangar is being built
isShieldDomeAvailable()  : bool
Check if any of the shield domes are currently available in the planet
processQueueToArray()  : array<string|int, mixed>
Convert the queue from string to array
runAction()  : void
Run an action
setAllowedItems()  : array<string|int, mixed>
Get an array with an allowed set of items for the current page, filtering by page and available technologies
setListOfShipyardItem()  : array<string|int, mixed>
Build each item block
setUpShipyard()  : void
Creates a new building object that will handle all the building creation methods and actions
showShipyardRequiredMessage()  : void
Display a message that indicating that the shipyard building is required
showShipyardUpgradeMessage()  : string
Show a message that indicates that the shipyard is being upgraded

Constants

MODULE_ID

The module ID

public int MODULE_ID = 7

Properties

$planet

Contains the current planet data

protected array<string|int, mixed> $planet = []

$user

Contains the current user data

protected array<string|int, mixed> $user = []

$userLibrary

Contains the User object

protected User $userLibrary = null

$allowed_items

List of currently available buildings

private array<string|int, mixed> $allowed_items = []

$building_in_progress

Store if we are currently building or not

private bool $building_in_progress = false

$missiles

Count variable that we'll use to build the missile queue

private array<string|int, mixed> $missiles = [AppcoreenumeratorsDefensesEnumerator::defense_anti_ballistic_missile => 0, AppcoreenumeratorsDefensesEnumerator::defense_interplanetary_missile => 0]

$resources_consumed

The amount of resources that will need to decrease

private array<string|int, mixed> $resources_consumed = ['metal' => 0, 'crystal' => 0, 'deuterium' => 0]

Methods

__construct()

Constructor

public __construct() : mixed
Return values
mixed

index()

Users land here

public index() : void
Return values
void

loadLang()

Load a language file using CI Library

public loadLang(string|array<string|int, mixed> $language_file) : void
Parameters
$language_file : string|array<string|int, mixed>
Return values
void

loadModel()

Load the provided model, support a dir path

public loadModel(string $class) : void
Parameters
$class : string

Mandatory field, if not will throw an exception

Tags
throws
Exception
Return values
void

getObjects()

Will be removed

protected getObjects() : array<string|int, mixed>
Tags
deprecated

since 3.2.0 will be removed on 4.0.0

Return values
array<string|int, mixed>

getPlanetData()

Will be removed

protected getPlanetData() : array<string|int, mixed>
Tags
deprecated

since 3.2.0 will be removed on 4.0.0

Return values
array<string|int, mixed>

getTemplate()

Will be removed

protected getTemplate() : array<string|int, mixed>
Tags
deprecated

since 3.2.0 will be removed on 4.0.0

Return values
array<string|int, mixed>

getUserData()

Will be removed

protected getUserData() : array<string|int, mixed>
Tags
deprecated

since 3.2.0 will be removed on 4.0.0

Return values
array<string|int, mixed>

buildItemsQueue()

Build the block that will display the queue of items

private buildItemsQueue() : string
Return values
string

buildListOfItems()

Build the list of ships and defenses

private buildListOfItems() : array<string|int, mixed>
Return values
array<string|int, mixed>

buildPage()

Build the page

private buildPage() : void
Return values
void

calculateMissilesAmount()

Calculate missiles amount considering the planet current storage and queue

private calculateMissilesAmount() : array<string|int, mixed>
Return values
array<string|int, mixed>

getBuildItemsButton()

Get build items button, if the shipyard is not being improved

private getBuildItemsButton() : string
Return values
string

getCurrentPage()

Determine the current page and validate it

private getCurrentPage() : array<string|int, mixed>
Tags
throws
Exception
Return values
array<string|int, mixed>

getItemAmount()

Expects an item ID to calculate the item current amount

private getItemAmount(int $item_id) : int
Parameters
$item_id : int

Item ID

Return values
int

getItemAmountWithFormat()

Expects an item ID to calculate and format the item current amount

private getItemAmountWithFormat(int $item_id) : string
Parameters
$item_id : int

Item ID

Return values
string

getItemDescription()

Return the item short description

private getItemDescription(int $item_id) : string
Parameters
$item_id : int
Return values
string

getItemInsertBlock()

Insert the item box that allows new item inserts

private getItemInsertBlock(int $item_id) : string
Parameters
$item_id : int

Item ID

Return values
string

getItemNeededResourcesByAmount()

Get the maximum amount of items that can be build

private getItemNeededResourcesByAmount(int $item_id, mixed $amount) : array<string|int, mixed>
Parameters
$item_id : int

Item ID

$amount : mixed
Return values
array<string|int, mixed>

getItemPriceWithFormat()

Expects a item ID (ship or defense) to calculate and format the price

private getItemPriceWithFormat(int $item_id) : string
Parameters
$item_id : int

Building ID

Return values
string

getItemTime()

Expects a item ID (ship or defense) to calculate the construction time

private getItemTime(int $item_id) : int
Parameters
$item_id : int

Item ID

Return values
int

getItemTimeWithFormat()

Expects a item ID (ship or defense) to calculate and format the time

private getItemTimeWithFormat(int $item_id) : string
Parameters
$item_id : int

Item ID

Return values
string

getMaxBuildableItems()

Get the maximum amount of items that can be build

private getMaxBuildableItems(int $item_id, int $amount_requested) : int
Parameters
$item_id : int

Item ID

$amount_requested : int

Amount of items requested

Return values
int

The max amount of buildable items

getMaxBuildableItemsByResource()

Get max amount of buildable items based on the planet current resources

private getMaxBuildableItemsByResource(int $item_id) : int
Parameters
$item_id : int

Item ID

Return values
int

getMaxBuildableItemsBySystemLimit()

Get max amount of buildable items based on the system configuration

private getMaxBuildableItemsBySystemLimit() : int
Return values
int

getMissilesItemLimit()

Return the max amount of buildable missiles

private getMissilesItemLimit(int $item_id, mixed $amount_requested) : int
Parameters
$item_id : int

Item ID

$amount_requested : mixed
Return values
int

getShieldDomeItemLimit()

Return the max amount of buildable shield domes

private getShieldDomeItemLimit(int $item_id) : int
Parameters
$item_id : int

Item ID

Return values
int

isAnyFacilityWorking()

Check if the robot factory, nanobots factory or hangar is being built

private isAnyFacilityWorking() : void
Return values
void

isShieldDomeAvailable()

Check if any of the shield domes are currently available in the planet

private isShieldDomeAvailable(int $item_id) : bool
Parameters
$item_id : int

Item ID

Return values
bool

processQueueToArray()

Convert the queue from string to array

private processQueueToArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

runAction()

Run an action

private runAction() : void
Return values
void

setAllowedItems()

Get an array with an allowed set of items for the current page, filtering by page and available technologies

private setAllowedItems() : array<string|int, mixed>
Return values
array<string|int, mixed>

setListOfShipyardItem()

Build each item block

private setListOfShipyardItem(int $item_id) : array<string|int, mixed>
Parameters
$item_id : int

Building ID

Return values
array<string|int, mixed>

setUpShipyard()

Creates a new building object that will handle all the building creation methods and actions

private setUpShipyard() : void
Return values
void

showShipyardRequiredMessage()

Display a message that indicating that the shipyard building is required

private showShipyardRequiredMessage() : void
Return values
void

showShipyardUpgradeMessage()

Show a message that indicates that the shipyard is being upgraded

private showShipyardUpgradeMessage() : string
Return values
string

Search results