Building
in package
Buildings Class
Tags
Table of Contents
- $_build_level : int
- $_build_time : int
- $_building : int
- $_objects : array<string|int, mixed>
- $_planet : array<string|int, mixed>
- $_queue : string
- $_user : array<string|int, mixed>
- __construct() : mixed
- Init the class with some values
- addBuilding() : void
- Add a new building to the queue, that will be build
- cancelBuilding() : void
- Cancel current building
- getCountElementsOnQueue() : int
- Count current elements in the queue
- getNewQueueAsArray() : string
- Get the updated queue as an array
- getNewQueueAsString() : string
- Get the updated queue as a string
- isQueueFull() : bool
- Check if the queue is full
- removeBuilding() : void
- Remove building from list
- tearDownBuilding() : void
- Add a new building to the queue, that will be destroyed
- buildQueueElementsBlock() : QueueElements
- Create a new QueueElements block
- calculateBuildEndTime() : int
- Calculate the building time for each element depending if it's the first element in the queue or there's something before.
- calculateBuildLevel() : int
- Set the level based on if we are going to build or destroy
- calculateBuildTime() : int
- Set the time based on if we are going to build or destroy
- getBuildingCurrentLevel() : int
- Get building current level
- queueElementToBuild() : void
- Queue an element to be build
- queueElementToTearDown() : void
- Queue an element to tear down
- removeElementFromBuildingQueue() : void
- Remove an element from the queue
- removeFirstElementFromBuildingQueue() : void
- Remove the first element from the queue, cancel action
Properties
$_build_level
private
int
$_build_level
= 0
$_build_time
private
int
$_build_time
= 0
$_building
private
int
$_building
= 0
$_objects
private
array<string|int, mixed>
$_objects
= ''
$_planet
private
array<string|int, mixed>
$_planet
= ''
$_queue
private
string
$_queue
= ''
$_user
private
array<string|int, mixed>
$_user
= ''
Methods
__construct()
Init the class with some values
public
__construct(array<string|int, mixed> $planet, array<string|int, mixed> $user, array<string|int, mixed> $objects) : mixed
Parameters
- $planet : array<string|int, mixed>
-
Planet
- $user : array<string|int, mixed>
-
User
- $objects : array<string|int, mixed>
-
Objects
Return values
mixed —addBuilding()
Add a new building to the queue, that will be build
public
addBuilding(int $building_id) : void
Parameters
- $building_id : int
-
Building ID
Return values
void —cancelBuilding()
Cancel current building
public
cancelBuilding() : void
Return values
void —getCountElementsOnQueue()
Count current elements in the queue
public
getCountElementsOnQueue() : int
Return values
int —getNewQueueAsArray()
Get the updated queue as an array
public
getNewQueueAsArray() : string
Return values
string —getNewQueueAsString()
Get the updated queue as a string
public
getNewQueueAsString() : string
Return values
string —isQueueFull()
Check if the queue is full
public
isQueueFull() : bool
Return values
bool —removeBuilding()
Remove building from list
public
removeBuilding(type $element_id) : void
Parameters
- $element_id : type
Return values
void —tearDownBuilding()
Add a new building to the queue, that will be destroyed
public
tearDownBuilding(int $building_id) : void
Parameters
- $building_id : int
-
Building ID
Return values
void —buildQueueElementsBlock()
Create a new QueueElements block
private
buildQueueElementsBlock(string $build_mode) : QueueElements
Parameters
- $build_mode : string
-
Build mode
Return values
QueueElements —calculateBuildEndTime()
Calculate the building time for each element depending if it's the first element in the queue or there's something before.
private
calculateBuildEndTime() : int
Return values
int —calculateBuildLevel()
Set the level based on if we are going to build or destroy
private
calculateBuildLevel(string $build_mode) : int
Parameters
- $build_mode : string
-
Build Mode
Return values
int —calculateBuildTime()
Set the time based on if we are going to build or destroy
private
calculateBuildTime(string $build_mode) : int
Parameters
- $build_mode : string
-
Build Mode
Return values
int —getBuildingCurrentLevel()
Get building current level
private
getBuildingCurrentLevel() : int
Return values
int —queueElementToBuild()
Queue an element to be build
private
queueElementToBuild() : void
Return values
void —queueElementToTearDown()
Queue an element to tear down
private
queueElementToTearDown() : void
Return values
void —removeElementFromBuildingQueue()
Remove an element from the queue
private
removeElementFromBuildingQueue(mixed $element_id) : void
Parameters
- $element_id : mixed
Return values
void —removeFirstElementFromBuildingQueue()
Remove the first element from the queue, cancel action
private
removeFirstElementFromBuildingQueue() : void