ResourceMarket
in package
ResourceMarket Class
Tags
Table of Contents
- $buildings : BuildingEntity
- Contains the current planet buildings
- $planet : PlanetEntity
- Contains the current planet data
- $premium : PremiumEntity
- Contains the current user premium data
- $user : UserEntity
- Contains the current user data
- __construct() : mixed
- Constructor
- calculateBasePriceToRefill() : float
- Calculate the base price
- calculateRefillStoragePrice() : float
- Get the price to refill the storage
- getPriceToFill100Percent() : float
- Get the price to completely refill the storage
- getPriceToFill10Percent() : float
- Get the price to refill the storage a 10%
- getPriceToFill50Percent() : float
- Get the price to refill the storage a 50%
- getProjectedResouces() : float
- Get the amount of resources that we will refill based on the provided percentage
- isCrystalStorageFillable() : bool
- Check if the crystal storage is fillable up to the provided percentage, returns true if it is
- isCrystalStorageFull() : bool
- Check if the crystal storage is full, returns true if full
- isDeuteriumStorageFillable() : bool
- Check if the deuterium storage is fillable up to the provided percentage, returns true if it is
- isDeuteriumStorageFull() : bool
- Check if the deuterium storage is full, returns true if full
- isMetalStorageFillable() : bool
- Check if the metal storage is fillable up to the provided percentage, returns true if it is
- isMetalStorageFull() : bool
- Check if the metal storage is full, returns true if full
- isRefillPayable() : bool
- Check if the user can pay for the storage refill
- createNewBuildingsEntity() : BuildingsEntity
- Create a new instance of BuildingsEntity
- createNewPlanetEntity() : PlanetEntity
- Create a new instance of PlanetEntity
- createNewPremiumEntity() : PremiumEntity
- Create a new instance of PremiumEntity
- createNewUserEntity() : UserEntity
- Create a new instance of UserEntity
- isStorageFillable() : bool
- Check if the storage is fillable up to the provided percentage, returns true if it is
- setUpBuildings() : void
- Set up the plaanet buildings
- setUpPlanet() : void
- Set up the planet
- setUpPremium() : void
- Set up the user premium data
- setUpUser() : void
- Set up the user
Properties
$buildings
Contains the current planet buildings
private
BuildingEntity
$buildings
$planet
Contains the current planet data
private
PlanetEntity
$planet
$premium
Contains the current user premium data
private
PremiumEntity
$premium
$user
Contains the current user data
private
UserEntity
$user
Methods
__construct()
Constructor
public
__construct(array<string|int, mixed> $user, array<string|int, mixed> $planet) : mixed
Parameters
- $user : array<string|int, mixed>
- $planet : array<string|int, mixed>
Return values
mixed —calculateBasePriceToRefill()
Calculate the base price
public
calculateBasePriceToRefill(int $max_storage, int $base_dm) : float
Parameters
- $max_storage : int
- $base_dm : int
Return values
float —calculateRefillStoragePrice()
Get the price to refill the storage
public
calculateRefillStoragePrice(string $resource, int $percentage, float $current_resources) : float
Parameters
- $resource : string
- $percentage : int
- $current_resources : float
Return values
float —getPriceToFill100Percent()
Get the price to completely refill the storage
public
getPriceToFill100Percent(string $resource) : float
Parameters
- $resource : string
Return values
float —getPriceToFill10Percent()
Get the price to refill the storage a 10%
public
getPriceToFill10Percent(string $resource) : float
Parameters
- $resource : string
Return values
float —getPriceToFill50Percent()
Get the price to refill the storage a 50%
public
getPriceToFill50Percent(string $resource) : float
Parameters
- $resource : string
Return values
float —getProjectedResouces()
Get the amount of resources that we will refill based on the provided percentage
public
getProjectedResouces(string $resource, int $percentage) : float
Parameters
- $resource : string
- $percentage : int
Return values
float —isCrystalStorageFillable()
Check if the crystal storage is fillable up to the provided percentage, returns true if it is
public
isCrystalStorageFillable(int $percentage) : bool
Parameters
- $percentage : int
Return values
bool —isCrystalStorageFull()
Check if the crystal storage is full, returns true if full
public
isCrystalStorageFull() : bool
Return values
bool —isDeuteriumStorageFillable()
Check if the deuterium storage is fillable up to the provided percentage, returns true if it is
public
isDeuteriumStorageFillable(int $percentage) : bool
Parameters
- $percentage : int
Return values
bool —isDeuteriumStorageFull()
Check if the deuterium storage is full, returns true if full
public
isDeuteriumStorageFull() : bool
Return values
bool —isMetalStorageFillable()
Check if the metal storage is fillable up to the provided percentage, returns true if it is
public
isMetalStorageFillable(int $percentage) : bool
Parameters
- $percentage : int
Return values
bool —isMetalStorageFull()
Check if the metal storage is full, returns true if full
public
isMetalStorageFull() : bool
Return values
bool —isRefillPayable()
Check if the user can pay for the storage refill
public
isRefillPayable(string $resource, int $percentage) : bool
Parameters
- $resource : string
- $percentage : int
Return values
bool —createNewBuildingsEntity()
Create a new instance of BuildingsEntity
private
createNewBuildingsEntity(array<string|int, mixed> $planet) : BuildingsEntity
Parameters
- $planet : array<string|int, mixed>
Return values
BuildingsEntity —createNewPlanetEntity()
Create a new instance of PlanetEntity
private
createNewPlanetEntity(array<string|int, mixed> $planet) : PlanetEntity
Parameters
- $planet : array<string|int, mixed>
Return values
PlanetEntity —createNewPremiumEntity()
Create a new instance of PremiumEntity
private
createNewPremiumEntity(array<string|int, mixed> $user) : PremiumEntity
Parameters
- $user : array<string|int, mixed>
Return values
PremiumEntity —createNewUserEntity()
Create a new instance of UserEntity
private
createNewUserEntity(array<string|int, mixed> $user) : UserEntity
Parameters
- $user : array<string|int, mixed>
Return values
UserEntity —isStorageFillable()
Check if the storage is fillable up to the provided percentage, returns true if it is
private
isStorageFillable(string $resource, int $percentage) : bool
Parameters
- $resource : string
- $percentage : int
Return values
bool —setUpBuildings()
Set up the plaanet buildings
private
setUpBuildings(array<string|int, mixed> $planet) : void
Parameters
- $planet : array<string|int, mixed>
Return values
void —setUpPlanet()
Set up the planet
private
setUpPlanet(array<string|int, mixed> $planet) : void
Parameters
- $planet : array<string|int, mixed>
Return values
void —setUpPremium()
Set up the user premium data
private
setUpPremium(array<string|int, mixed> $user) : void
Parameters
- $user : array<string|int, mixed>
Return values
void —setUpUser()
Set up the user
private
setUpUser(array<string|int, mixed> $user) : void
Parameters
- $user : array<string|int, mixed>