Buildings
extends BaseController
in package
Buildings Class
Table of Contents
- MODULE_ID = 3
- $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_buildings : array<string|int, mixed>
- List of currently available buildings
- $_building : Buildings
- $_commander_active : bool
- Status of the commander officer
- __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
- addToQueue() : mixed
- method addToQueue param $building param $AddMode return (int) the queue ID
- buildButton() : string
- Get the properties for each button type
- buildCountDownClock() : string
- Build the countdown clock for that usually appears
- buildListOfBuildings() : string
- Build the list of buildings
- buildPage() : void
- Build the page
- buildQueueBlock() : array<string|int, mixed>
- Build the list of queued elements
- cancelCurrent() : mixed
- method cancelCurrent param return (bool) confirmation
- canInitBuildAction() : bool
- getActionButton() : string
- Expects a building ID, runs several validations and then returns a button, based on the validations
- getAllowedBuildings() : array<string|int, mixed>
- Get an array with an allowed set of items for the current page, filtering by page and available technologies
- getBuildingLevel() : int
- Expects a building ID to calculate the building level
- getBuildingLevelWithFormat() : string
- Expects a building ID to calculate and format the level
- getBuildingPriceWithFormat() : string
- Expects a building ID to calculate and format the price
- getBuildingTime() : int
- Expects a building ID to calculate the building time
- getBuildingTimeWithFormat() : string
- Expects a building ID to calculate and format the time
- getCurrentPage() : array<string|int, mixed>
- Determine the current page and validate it
- isWorkInProgress() : bool
- Determine if there's any work in progress
- removeFromQueue() : mixed
- method removeFromQueue param $QueueID return (int) the queue ID
- runAction() : void
- Run an action
- setListOfBuildingsItem() : array<string|int, mixed>
- Build each building block
- setUpBuildings() : void
- Creates a new building object that will handle all the building creation methods and actions
- showQueue() : mixed
- method showQueue param $Sprice return (array) the queue to build data
Constants
MODULE_ID
public
mixed
MODULE_ID
= 3
Properties
$objects
Contains the whole set of objects by request
protected
Objects
$objects
$page
Contains the Page object
protected
Page
$page
= null
$planet
Contains the current planet data
protected
array<string|int, mixed>
$planet
= []
$template
Contains the Template object
protected
Template
$template
= null
$user
Contains the current user data
protected
array<string|int, mixed>
$user
= []
$userLibrary
Contains the User object
protected
User
$userLibrary
= null
$_allowed_buildings
List of currently available buildings
private
array<string|int, mixed>
$_allowed_buildings
= []
$_building
private
Buildings
$_building
= null
$_commander_active
Status of the commander officer
private
bool
$_commander_active
= false
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
Return values
void —getObjects()
Will be removed
protected
getObjects() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getPlanetData()
Will be removed
protected
getPlanetData() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getTemplate()
Will be removed
protected
getTemplate() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getUserData()
Will be removed
protected
getUserData() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —addToQueue()
method addToQueue param $building param $AddMode return (int) the queue ID
private
addToQueue(mixed $building[, mixed $AddMode = true ]) : mixed
Parameters
- $building : mixed
- $AddMode : mixed = true
Return values
mixed —buildButton()
Get the properties for each button type
private
buildButton(string $button_code) : string
Parameters
- $button_code : string
-
Button code
Return values
string —buildCountDownClock()
Build the countdown clock for that usually appears
private
buildCountDownClock(int $building_id) : string
Parameters
- $building_id : int
-
Building ID
Return values
string —buildListOfBuildings()
Build the list of buildings
private
buildListOfBuildings() : string
Return values
string —buildPage()
Build the page
private
buildPage() : void
Return values
void —buildQueueBlock()
Build the list of queued elements
private
buildQueueBlock() : array<string|int, mixed>
Return values
array<string|int, mixed> —cancelCurrent()
method cancelCurrent param return (bool) confirmation
private
cancelCurrent() : mixed
Return values
mixed —canInitBuildAction()
private
canInitBuildAction(int $building_id, int $list_id) : bool
Parameters
- $building_id : int
-
Building ID
- $list_id : int
-
List ID
Return values
bool —getActionButton()
Expects a building ID, runs several validations and then returns a button, based on the validations
private
getActionButton(int $building_id) : string
Parameters
- $building_id : int
-
Building ID
Return values
string —getAllowedBuildings()
Get an array with an allowed set of items for the current page, filtering by page and available technologies
private
getAllowedBuildings() : array<string|int, mixed>
Return values
array<string|int, mixed> —getBuildingLevel()
Expects a building ID to calculate the building level
private
getBuildingLevel(int $building_id) : int
Parameters
- $building_id : int
-
Building ID
Return values
int —getBuildingLevelWithFormat()
Expects a building ID to calculate and format the level
private
getBuildingLevelWithFormat(int $building_id) : string
Parameters
- $building_id : int
-
Building ID
Return values
string —getBuildingPriceWithFormat()
Expects a building ID to calculate and format the price
private
getBuildingPriceWithFormat(int $building_id) : string
Parameters
- $building_id : int
-
Building ID
Return values
string —getBuildingTime()
Expects a building ID to calculate the building time
private
getBuildingTime(int $building_id) : int
Parameters
- $building_id : int
-
Building ID
Return values
int —getBuildingTimeWithFormat()
Expects a building ID to calculate and format the time
private
getBuildingTimeWithFormat(int $building_id) : string
Parameters
- $building_id : int
-
Building ID
Return values
string —getCurrentPage()
Determine the current page and validate it
private
getCurrentPage() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —isWorkInProgress()
Determine if there's any work in progress
private
isWorkInProgress(int $building_id) : bool
Parameters
- $building_id : int
-
Building ID
Return values
bool —removeFromQueue()
method removeFromQueue param $QueueID return (int) the queue ID
private
removeFromQueue(mixed $QueueID) : mixed
Parameters
- $QueueID : mixed
Return values
mixed —runAction()
Run an action
private
runAction() : void
Return values
void —setListOfBuildingsItem()
Build each building block
private
setListOfBuildingsItem(int $building_id) : array<string|int, mixed>
Parameters
- $building_id : int
-
Building ID
Return values
array<string|int, mixed> —setUpBuildings()
Creates a new building object that will handle all the building creation methods and actions
private
setUpBuildings() : void
Return values
void —showQueue()
method showQueue param $Sprice return (array) the queue to build data
private
showQueue([mixed &$Sprice = false ]) : mixed
Parameters
- $Sprice : mixed = false