Planet
in package
Table of Contents
Constants
- DAMAGE_NEEDED_FOR_DOWNGRADE_CHANCE = 100
- MAX_STOCKPILE = 600
- SQL = 'game_id = :game_id AND sector_id = :sector_id'
- CHANCE_TO_DOWNGRADE = 15
- TIME_ATTACK_NEWS_COOLDOWN = 3600
- TIME_TO_CREDIT_BUST = 10800
Properties
- $SQLID : array{game_id: int, sector_id: int}
- $armour : int
- $bonds : int
- $buildings : array<int, int>
- $CACHE_PLANETS : array<int, array<int, self>>
- $credits : int
- $currentlyBuilding : array<int, array<string, int>>
- $drones : int
- $exists : bool
- $gameID : int
- $hasChanged : bool
- $hasChangedBuildings : array<int, bool>
- $hasChangedFinancial : bool
- $hasChangedStockpile : bool
- $hasChangedWeapons : array<int, bool>
- $hasStoppedBuilding : array<string|int, int>
- $inhabitableTime : int
- $maturity : int
- $mountedWeapons : array<int, Weapon>
- $ownerID : int
- $password : string
- $planetName : string
- $sectorID : int
- $shields : int
- $stockpile : array<int, int>
- $typeID : int
- $typeInfo : PlanetType
Methods
- __sleep() : mixed
- addMountedWeapon() : void
- attackedBy() : void
- bond() : void
- checkBondMaturity() : void
- checkForDowngrade() : array<int, int>
- Returns an array of structure losses due to damage taken.
- checkForExcessDefense() : void
- clearCache() : void
- countPlayers() : int
- createPlanet() : self
- creditCurrentAttackersForKill() : void
- decreaseArmour() : void
- decreaseBonds() : void
- decreaseCDs() : void
- decreaseCredits() : void
- decreaseShields() : void
- decreaseStockpile() : void
- destroyBuilding() : void
- exists() : bool
- getAccuracyBonus() : int
- Returns the accuracy bonus for mounted weaons (as a percent)
- getArmour() : int
- getAttackHREF() : string
- getBondConfirmationHREF() : string
- getBonds() : int
- getBondTime() : int
- getBuildHREF() : string
- getBuilding() : int
- getBuildings() : array<int, int>
- getBuildRestriction() : string|false
- Returns the reason a build cannot be performed, or false if there is no restriction.
- getCancelHREF() : string
- getCDs() : int
- getCombatName() : string
- Returns the name of the planet, intended for combat messages.
- getConstructionTime() : int
- getCredits() : int
- getCurrentlyBuilding() : array<int, array<string, int>>
- getDisplayName() : string
- Returns the name of the planet, suitably escaped for HTML display.
- getExamineHREF() : string
- getFinancesHREF() : string
- getGalaxy() : Galaxy
- getGalaxyPlanets() : array<int, self>
- getGame() : Game
- getGameID() : int
- getInhabitableTime() : int
- getInterestRate() : float
- getLandHREF() : string
- getLevel() : float
- getMaturity() : int
- getMaxArmour() : int
- getMaxAttackers() : int
- getMaxBuildings() : mixed
- getMaxCDs() : int
- getMaxLanded() : int
- getMaxLevel() : float
- getMaxMountedWeapons() : int
- getMaxShields() : int
- getMountedWeapons() : array<int, Weapon>
- getOtherTraders() : array<int, Player>
- getOwner() : AbstractPlayer
- getOwnerID() : int
- getPassword() : string
- getPlanet() : self
- getPlayers() : array<int, Player>
- getRemainingStockpile() : int
- getSectorID() : int
- getShields() : int
- getStockpile() : mixed
- getStructureTypes() : mixed
- getTurretAccuracy() : float
- Returns the modified accuracy of turrets on this planet.
- getTypeDescription() : string
- getTypeID() : int
- getTypeImage() : string
- getTypeName() : string
- getWeapons() : array<string|int, Weapon>
- hasArmour() : bool
- hasBuilding() : bool
- hasCDs() : bool
- hasCurrentlyBuilding() : bool
- Returns true if there is a building in progress
- hasEnemyTraders() : bool
- hasFriendlyTraders() : bool
- hasMenuOption() : bool
- Specifies which menu options the planet has.
- hasMountedWeapon() : bool
- hasOtherTraders() : bool
- hasOwner() : bool
- hasPlayers() : bool
- hasShields() : bool
- hasStockpile() : bool
- hasStructureType() : bool
- increaseArmour() : void
- increaseBonds() : void
- increaseBuilding() : void
- increaseCDs() : void
- increaseCredits() : int
- Increases planet credits up to the maximum allowed credits.
- increaseShields() : void
- increaseStockpile() : void
- isBusted() : bool
- isInhabitable() : bool
- killPlanetByPlayer() : array{}
- moveMountedWeaponDown() : void
- moveMountedWeaponUp() : void
- removeMountedWeapon() : void
- removeOwner() : void
- removePassword() : void
- removePlanet() : void
- savePlanets() : void
- setArmour() : void
- setBonds() : void
- setBuilding() : void
- setCDs() : void
- setCredits() : void
- setMaturity() : void
- setName() : void
- setOwnerID() : void
- setPassword() : void
- setShields() : void
- setStockpile() : void
- setTypeID() : void
- shootPlayers() : PlanetCombatResults
- startBuilding() : void
- stopBuilding() : bool
- takeDamage() : TakenDamageData
- update() : void
- __construct() : mixed
- takeDamageToArmour() : int
- takeDamageToCDs() : int
- takeDamageToShields() : int
- getCompletionModifier() : float
- getConstructionExp() : int
- swapMountedWeapons() : void
Constants
DAMAGE_NEEDED_FOR_DOWNGRADE_CHANCE
public
mixed
DAMAGE_NEEDED_FOR_DOWNGRADE_CHANCE
= 100
MAX_STOCKPILE
public
mixed
MAX_STOCKPILE
= 600
SQL
public
mixed
SQL
= 'game_id = :game_id AND sector_id = :sector_id'
CHANCE_TO_DOWNGRADE
protected
mixed
CHANCE_TO_DOWNGRADE
= 15
TIME_ATTACK_NEWS_COOLDOWN
protected
mixed
TIME_ATTACK_NEWS_COOLDOWN
= 3600
TIME_TO_CREDIT_BUST
protected
mixed
TIME_TO_CREDIT_BUST
= 10800
Properties
$SQLID read-only
public
array{game_id: int, sector_id: int}
$SQLID
$armour
protected
int
$armour
$bonds
protected
int
$bonds
$buildings
protected
array<int, int>
$buildings
$CACHE_PLANETS
protected
static array<int, array<int, self>>
$CACHE_PLANETS
= []
$credits
protected
int
$credits
$currentlyBuilding
protected
array<int, array<string, int>>
$currentlyBuilding
$drones
protected
int
$drones
$exists
protected
bool
$exists
= false
$gameID read-only
protected
int
$gameID
$hasChanged
protected
bool
$hasChanged
= false
$hasChangedBuildings
protected
array<int, bool>
$hasChangedBuildings
= []
$hasChangedFinancial
protected
bool
$hasChangedFinancial
= false
$hasChangedStockpile
protected
bool
$hasChangedStockpile
= false
$hasChangedWeapons
protected
array<int, bool>
$hasChangedWeapons
= []
$hasStoppedBuilding
protected
array<string|int, int>
$hasStoppedBuilding
= []
$inhabitableTime
protected
int
$inhabitableTime
$maturity
protected
int
$maturity
$mountedWeapons
protected
array<int, Weapon>
$mountedWeapons
$ownerID
protected
int
$ownerID
$password
protected
string
$password
$planetName
protected
string
$planetName
$sectorID read-only
protected
int
$sectorID
$shields
protected
int
$shields
$stockpile
protected
array<int, int>
$stockpile
$typeID
protected
int
$typeID
$typeInfo
protected
PlanetType
$typeInfo
Methods
__sleep()
public
__sleep() : mixed
addMountedWeapon()
public
addMountedWeapon(Weapon $weapon, int $orderID) : void
Parameters
- $weapon : Weapon
- $orderID : int
attackedBy()
public
attackedBy(AbstractPlayer $trigger, array<string|int, AbstractPlayer> $attackers) : void
Parameters
- $trigger : AbstractPlayer
- $attackers : array<string|int, AbstractPlayer>
bond()
public
bond() : void
checkBondMaturity()
public
checkBondMaturity([bool $partial = false ]) : void
Parameters
- $partial : bool = false
checkForDowngrade()
Returns an array of structure losses due to damage taken.
public
checkForDowngrade(int $damage) : array<int, int>
Parameters
- $damage : int
Return values
array<int, int>checkForExcessDefense()
public
checkForExcessDefense() : void
clearCache()
public
static clearCache() : void
countPlayers()
public
countPlayers() : int
Return values
intcreatePlanet()
public
static createPlanet(int $gameID, int $sectorID[, int $typeID = 1 ][, int|null $inhabitableTime = null ]) : self
Parameters
- $gameID : int
- $sectorID : int
- $typeID : int = 1
- $inhabitableTime : int|null = null
Return values
selfcreditCurrentAttackersForKill()
public
creditCurrentAttackersForKill() : void
decreaseArmour()
public
decreaseArmour(int $number) : void
Parameters
- $number : int
decreaseBonds()
public
decreaseBonds(int $num) : void
Parameters
- $num : int
decreaseCDs()
public
decreaseCDs(int $number) : void
Parameters
- $number : int
decreaseCredits()
public
decreaseCredits(int $num) : void
Parameters
- $num : int
decreaseShields()
public
decreaseShields(int $number) : void
Parameters
- $number : int
decreaseStockpile()
public
decreaseStockpile(int $goodID, int $amount) : void
Parameters
- $goodID : int
- $amount : int
destroyBuilding()
public
destroyBuilding(int $buildingTypeID, int $number) : void
Parameters
- $buildingTypeID : int
- $number : int
exists()
public
exists() : bool
Return values
boolgetAccuracyBonus()
Returns the accuracy bonus for mounted weaons (as a percent)
public
getAccuracyBonus() : int
Return values
intgetArmour()
public
getArmour() : int
Return values
intgetAttackHREF()
public
getAttackHREF() : string
Return values
stringgetBondConfirmationHREF()
public
getBondConfirmationHREF() : string
Return values
stringgetBonds()
public
getBonds() : int
Return values
intgetBondTime()
public
getBondTime() : int
Return values
intgetBuildHREF()
public
getBuildHREF(int $structureID) : string
Parameters
- $structureID : int
Return values
stringgetBuilding()
public
getBuilding(int $buildingTypeID) : int
Parameters
- $buildingTypeID : int
Return values
intgetBuildings()
public
getBuildings() : array<int, int>
Return values
array<int, int>getBuildRestriction()
Returns the reason a build cannot be performed, or false if there is no restriction.
public
getBuildRestriction(AbstractPlayer $constructor, int $constructionID) : string|false
Parameters
- $constructor : AbstractPlayer
- $constructionID : int
Return values
string|falsegetCancelHREF()
public
getCancelHREF(int $structureID) : string
Parameters
- $structureID : int
Return values
stringgetCDs()
public
getCDs() : int
Return values
intgetCombatName()
Returns the name of the planet, intended for combat messages.
public
getCombatName() : string
Return values
stringgetConstructionTime()
public
getConstructionTime(int $constructionID) : int
Parameters
- $constructionID : int
Return values
intgetCredits()
public
getCredits() : int
Return values
intgetCurrentlyBuilding()
public
getCurrentlyBuilding() : array<int, array<string, int>>
Return values
array<int, array<string, int>>getDisplayName()
Returns the name of the planet, suitably escaped for HTML display.
public
getDisplayName() : string
Return values
stringgetExamineHREF()
public
getExamineHREF() : string
Return values
stringgetFinancesHREF()
public
getFinancesHREF() : string
Return values
stringgetGalaxy()
public
getGalaxy() : Galaxy
Return values
GalaxygetGalaxyPlanets()
public
static getGalaxyPlanets(int $gameID, int $galaxyID[, bool $forceUpdate = false ]) : array<int, self>
Parameters
- $gameID : int
- $galaxyID : int
- $forceUpdate : bool = false
Return values
array<int, self>getGame()
public
getGame() : Game
Return values
GamegetGameID()
public
getGameID() : int
Return values
intgetInhabitableTime()
public
getInhabitableTime() : int
Return values
intgetInterestRate()
public
getInterestRate() : float
Return values
floatgetLandHREF()
public
getLandHREF() : string
Return values
stringgetLevel()
public
getLevel() : float
Return values
floatgetMaturity()
public
getMaturity() : int
Return values
intgetMaxArmour()
public
getMaxArmour() : int
Return values
intgetMaxAttackers()
public
getMaxAttackers() : int
Return values
intgetMaxBuildings()
public
getMaxBuildings([int|null $buildingTypeID = null ]) : mixed
Parameters
- $buildingTypeID : int|null = null
getMaxCDs()
public
getMaxCDs() : int
Return values
intgetMaxLanded()
public
getMaxLanded() : int
Return values
intgetMaxLevel()
public
getMaxLevel() : float
Return values
floatgetMaxMountedWeapons()
public
getMaxMountedWeapons() : int
Return values
intgetMaxShields()
public
getMaxShields() : int
Return values
intgetMountedWeapons()
public
getMountedWeapons() : array<int, Weapon>
Return values
array<int, Weapon>getOtherTraders()
public
getOtherTraders(AbstractPlayer $player) : array<int, Player>
Parameters
- $player : AbstractPlayer
Return values
array<int, Player>getOwner()
public
getOwner() : AbstractPlayer
Return values
AbstractPlayergetOwnerID()
public
getOwnerID() : int
Return values
intgetPassword()
public
getPassword() : string
Return values
stringgetPlanet()
public
static getPlanet(int $gameID, int $sectorID[, bool $forceUpdate = false ][, DatabaseRecord|null $dbRecord = null ]) : self
Parameters
- $gameID : int
- $sectorID : int
- $forceUpdate : bool = false
- $dbRecord : DatabaseRecord|null = null
Return values
selfgetPlayers()
public
getPlayers() : array<int, Player>
Return values
array<int, Player>getRemainingStockpile()
public
getRemainingStockpile(int $id) : int
Parameters
- $id : int
Return values
intgetSectorID()
public
getSectorID() : int
Return values
intgetShields()
public
getShields() : int
Return values
intgetStockpile()
public
getStockpile([int|null $goodID = null ]) : mixed
Parameters
- $goodID : int|null = null
getStructureTypes()
public
getStructureTypes([int|null $structureID = null ]) : mixed
Parameters
- $structureID : int|null = null
getTurretAccuracy()
Returns the modified accuracy of turrets on this planet.
public
getTurretAccuracy() : float
Only used for display purposes.
Return values
floatgetTypeDescription()
public
getTypeDescription() : string
Return values
stringgetTypeID()
public
getTypeID() : int
Return values
intgetTypeImage()
public
getTypeImage() : string
Return values
stringgetTypeName()
public
getTypeName() : string
Return values
stringgetWeapons()
public
getWeapons() : array<string|int, Weapon>
Return values
array<string|int, Weapon>hasArmour()
public
hasArmour() : bool
Return values
boolhasBuilding()
public
hasBuilding(int $buildingTypeID) : bool
Parameters
- $buildingTypeID : int
Return values
boolhasCDs()
public
hasCDs() : bool
Return values
boolhasCurrentlyBuilding()
Returns true if there is a building in progress
public
hasCurrentlyBuilding() : bool
Return values
boolhasEnemyTraders()
public
hasEnemyTraders(AbstractPlayer $player) : bool
Parameters
- $player : AbstractPlayer
Return values
boolhasFriendlyTraders()
public
hasFriendlyTraders(AbstractPlayer $player) : bool
Parameters
- $player : AbstractPlayer
Return values
boolhasMenuOption()
Specifies which menu options the planet has.
public
hasMenuOption(PlanetMenuOption $option) : bool
Parameters
- $option : PlanetMenuOption
Return values
boolhasMountedWeapon()
public
hasMountedWeapon(int $orderID) : bool
Parameters
- $orderID : int
Return values
boolhasOtherTraders()
public
hasOtherTraders(AbstractPlayer $player) : bool
Parameters
- $player : AbstractPlayer
Return values
boolhasOwner()
public
hasOwner() : bool
Return values
boolhasPlayers()
public
hasPlayers() : bool
Return values
boolhasShields()
public
hasShields() : bool
Return values
boolhasStockpile()
public
hasStockpile([int|null $goodID = null ]) : bool
Parameters
- $goodID : int|null = null
Return values
boolhasStructureType()
public
hasStructureType(int $structureID) : bool
Parameters
- $structureID : int
Return values
boolincreaseArmour()
public
increaseArmour(int $number) : void
Parameters
- $number : int
increaseBonds()
public
increaseBonds(int $num) : void
Parameters
- $num : int
increaseBuilding()
public
increaseBuilding(int $buildingTypeID, int $number) : void
Parameters
- $buildingTypeID : int
- $number : int
increaseCDs()
public
increaseCDs(int $number) : void
Parameters
- $number : int
increaseCredits()
Increases planet credits up to the maximum allowed credits.
public
increaseCredits(int $num) : int
Returns the amount that was actually added to handle overflow.
Parameters
- $num : int
Return values
intincreaseShields()
public
increaseShields(int $number) : void
Parameters
- $number : int
increaseStockpile()
public
increaseStockpile(int $goodID, int $amount) : void
Parameters
- $goodID : int
- $amount : int
isBusted()
public
isBusted() : bool
Return values
boolisInhabitable()
public
isInhabitable() : bool
Return values
boolkillPlanetByPlayer()
public
killPlanetByPlayer(AbstractPlayer $killer) : array{}
Parameters
- $killer : AbstractPlayer
Return values
array{}moveMountedWeaponDown()
public
moveMountedWeaponDown(int $orderID) : void
Parameters
- $orderID : int
moveMountedWeaponUp()
public
moveMountedWeaponUp(int $orderID) : void
Parameters
- $orderID : int
removeMountedWeapon()
public
removeMountedWeapon(int $orderID) : void
Parameters
- $orderID : int
removeOwner()
public
removeOwner() : void
removePassword()
public
removePassword() : void
removePlanet()
public
static removePlanet(int $gameID, int $sectorID) : void
Parameters
- $gameID : int
- $sectorID : int
savePlanets()
public
static savePlanets() : void
setArmour()
public
setArmour(int $armour) : void
Parameters
- $armour : int
setBonds()
public
setBonds(int $num) : void
Parameters
- $num : int
setBuilding()
public
setBuilding(int $buildingTypeID, int $number) : void
Parameters
- $buildingTypeID : int
- $number : int
setCDs()
public
setCDs(int $combatDrones) : void
Parameters
- $combatDrones : int
setCredits()
public
setCredits(int $num) : void
Parameters
- $num : int
setMaturity()
public
setMaturity(int $num) : void
Parameters
- $num : int
setName()
public
setName(string $name) : void
Parameters
- $name : string
setOwnerID()
public
setOwnerID(int $claimerID) : void
Parameters
- $claimerID : int
setPassword()
public
setPassword(string $password) : void
Parameters
- $password : string
setShields()
public
setShields(int $shields) : void
Parameters
- $shields : int
setStockpile()
public
setStockpile(int $goodID, int $amount) : void
Parameters
- $goodID : int
- $amount : int
setTypeID()
public
setTypeID(int $num) : void
Parameters
- $num : int
shootPlayers()
public
shootPlayers(array<string|int, AbstractPlayer> $targetPlayers) : PlanetCombatResults
Parameters
- $targetPlayers : array<string|int, AbstractPlayer>
Return values
PlanetCombatResultsstartBuilding()
public
startBuilding(AbstractPlayer $constructor, int $constructionID) : void
Parameters
- $constructor : AbstractPlayer
- $constructionID : int
Tags
stopBuilding()
public
stopBuilding(int $constructionID) : bool
Parameters
- $constructionID : int
Return values
booltakeDamage()
public
takeDamage(WeaponDamageData $damage) : TakenDamageData
Parameters
- $damage : WeaponDamageData
Return values
TakenDamageDataupdate()
public
update() : void
__construct()
protected
__construct(int $gameID, int $sectorID[, DatabaseRecord|null $dbRecord = null ]) : mixed
Parameters
- $gameID : int
- $sectorID : int
- $dbRecord : DatabaseRecord|null = null
takeDamageToArmour()
protected
takeDamageToArmour(int $damage) : int
Parameters
- $damage : int
Return values
inttakeDamageToCDs()
protected
takeDamageToCDs(int $damage) : int
Parameters
- $damage : int
Return values
inttakeDamageToShields()
protected
takeDamageToShields(int $damage) : int
Parameters
- $damage : int
Return values
intgetCompletionModifier()
private
getCompletionModifier(int $constructionID) : float
Parameters
- $constructionID : int
Return values
floatgetConstructionExp()
private
getConstructionExp(int $constructionID) : int
Parameters
- $constructionID : int
Return values
intswapMountedWeapons()
private
swapMountedWeapons(int $orderID1, int $orderID2) : void
Parameters
- $orderID1 : int
- $orderID2 : int