Documentation

AbstractPlayer
in package
Uses RaceID

AbstractYes
Tags
phpstan-type

TickerData array{Type: string, Time: int, Expires: int, Recent: string}

phpstan-type

MissionData array{'On Step': int, Progress: int, Unread: bool, Expires: int, Sector: int, 'Starting Sector': int, Task: mixed}

Table of Contents

Constants

SQL  = 'account_id = :account_id AND game_id = :game_id'
HOF_CHANGED  = 1
HOF_NEW  = 2
SHIP_INSURANCE_FRACTION  = 0.25
TIME_FOR_ALLIANCE_SWITCH  = 0
TIME_FOR_FEDERAL_BOUNTY_ON_PR  = 10800

Properties

$SQLID  : array{account_id: int, game_id: int}
$accountID  : int
$alignment  : int
$allianceID  : int
$allianceJoinable  : int
$allianceRoles  : array<int, int>
$assists  : int
$bank  : int
$bounties  : array<int, Bounty>
$CACHE_ALLIANCE_PLAYERS  : array<int, array<int, array<int, Player>>>
$CACHE_PLANET_PLAYERS  : array<int, array<int, array<int, Player>>>
$CACHE_PLAYERS  : array<int, array<int, Player>>
$CACHE_SECTOR_PLAYERS  : array<int, array<int, array<int, Player>>>
$canFed  : array<int, bool>
$combatDronesKamikazeOnMines  : bool
$credits  : int
$customShipName  : string|false
$dead  : bool
$deaths  : int
$displayMissions  : bool
$displayWeapons  : bool
$draftLeader  : bool
$experience  : int
$forceDropMessages  : bool
$gameID  : int
$gpWriter  : string|false
$hasChanged  : bool
$hasHOFChanged  : array<string, int>
$hasHOFVisChanged  : array<string, int>
$HOF  : array<string, float>
$HOFVis  : array<string, string>
$ignoreGlobals  : bool
$kills  : int
$landedOnPlanet  : bool
$lastActive  : int
$lastCPLAction  : int
$lastNewsUpdate  : int
$lastPort  : int
$lastSectorID  : int
$lastTurnUpdate  : int
$level  : PlayerLevel|null
$militaryPayment  : int
$missions  : array<int, MissionData>
$nameChanged  : bool
$newbieStatus  : bool
$newbieTurns  : int
$newbieWarning  : bool
$npc  : bool
$personalRelations  : array<int, int>
$playerID  : int
$playerName  : string
$plottedCourse  : Path|false
$raceChanged  : bool
$raceID  : int
$relations  : array<int, int>
$scoutMessageGroupType  : ScoutMessageGroupType
$sectorID  : int
$shipID  : int
$storedDestinations  : array<int, StoredDestination>
$tickers  : array<string, TickerData>
$turns  : int
$underAttack  : bool
$unvisitedSectors  : array<string|int, int>
$zoom  : int

Methods

__sleep()  : mixed
actionTaken()  : void
addDestinationButton()  : void
addMission()  : void
canBeProtectedByRace()  : bool
canChangeRace()  : bool
canFight()  : bool
Returns a boolean identifying if the player can currently participate in battles.
canSee()  : bool
canSeeAny()  : bool
changePlayerName()  : void
Change a player's name, with name validation.
changePlayerNameByPlayer()  : void
Use this method when the player is changing their own name.
claimMissionReward()  : string
clearCache()  : void
createPlayer()  : self
Insert a new player into the database. Returns the new player object.
declineMission()  : void
Declining a mission will permanently hide it from the player by adding it in its completed state.
decreaseAlignment()  : void
decreaseBank()  : void
decreaseCredits()  : void
decreaseExperience()  : void
decreaseHOF()  : void
decreaseMilitaryPayment()  : void
decreaseRelations()  : void
Decrease personal relations.
decreaseRelationsByTrade()  : void
Decreases personal relations from trading failures, e.g. rejected bargaining and getting caught stealing.
decreaseZoom()  : void
deleteDestinationButton()  : void
deleteMission()  : void
deletePlottedCourse()  : void
equals()  : bool
forceNAPAlliance()  : bool
getAccount()  : Account
getAccountID()  : int
getActiveBounty()  : Bounty
getActiveMissions()  : array<int, MissionData>
getAlignment()  : int
getAlliance()  : Alliance
getAllianceBBLink()  : string
getAllianceDisplayName()  : string
getAllianceID()  : int
getAllianceJoinable()  : int
getAlliancePlayers()  : array<int, Player>
getAllianceRole()  : int
getAllianceRosterHREF()  : string
getAssists()  : int
getAttackTraderHREF()  : string
getAvailableMissions()  : array<int, array<string, mixed>>
getBank()  : int
getBBLink()  : string
getBounties()  : array<int, Bounty>
getClaimableBounties()  : array<string|int, Bounty>
Get bounties that can be claimed by this player.
getColouredRaceName()  : string
getColouredRaceNameOrDefault()  : string
getCredits()  : int
getCustomShipName()  : string|false
getDeaths()  : int
getDisplayName()  : string
Returns the decorated player name, suitable for HTML display.
getExamineTraderHREF()  : string
getExperience()  : int
getGalaxyPlayers()  : array<int, array<int, Player>>
Returns the same players as getSectorPlayers (e.g. not on planets), but for an entire galaxy rather than a single sector. This is useful for reducing the number of queries in galaxy-wide processing.
getGame()  : Game
getGameID()  : int
getGPWriter()  : string|false
getHOF()  : float
getHOFVis()  : array<string, string>
getHome()  : int
getJumpInfo()  : array<string, int>
Computes the turn cost and max misjump between current and target sector
getKills()  : int
getLastActive()  : int
getLastCPLAction()  : int
getLastNewsUpdate()  : int
getLastPort()  : int
getLastSectorID()  : int
getLastTurnUpdate()  : int
getLeaveNewbieProtectionHREF()  : string
getLevel()  : PlayerLevel
getLevelID()  : int
Returns the numerical level of the player (e.g. 1-50).
getLevelName()  : string
getLinkedDisplayName()  : string
getMaxLevel()  : int
getMaxTurns()  : int
getMilitaryPayment()  : int
getMissions()  : array<int, MissionData>
getNewbieTurns()  : int
getNewbieWarning()  : bool
getNextLevelPercentAcquired()  : int
Returns the percent progress towards the next level.
getNextLevelPercentRemaining()  : int
getPersonalRelation()  : int
Get personal relations with a race
getPersonalRelations()  : array<int, int>
getPlanet()  : Planet|null
Get planet owned by this player.
getPlanetKickHREF()  : string
getPlanetPlayers()  : array<int, Player>
getPlayer()  : Player
getPlayerByPlayerID()  : Player
getPlayerByPlayerName()  : Player
getPlayerID()  : int
getPlayerName()  : string
Returns the player name.
getPlottedCourse()  : Path|false
getRaceID()  : int
getRaceName()  : string
getRelation()  : int
Get total relations with a race (personal + political)
getRelations()  : array<int, int>
Get total relations with all races (personal + political)
getSafeAttackRating()  : int
getScoutMessageGroupLimit()  : int
getScoutMessageGroupType()  : ScoutMessageGroupType
getSector()  : Sector
getSectorID()  : int
getSectorPlanet()  : Planet
getSectorPlayers()  : array<int, Player>
getSectorPlayersByAlliances()  : array<int, Player>
getSectorPort()  : Port
getSharingPlayers()  : array<string|int, AbstractPlayer>
Get array of players whose info can be accessed by this player.
getShip()  : AbstractShip
getShipTypeID()  : int
getStoredDestinations()  : array<int, StoredDestination>
getTicker()  : TickerData|false
getTickers()  : array<string, TickerData>
getTimeUntilMaxTurns()  : int
Calculate the time in seconds between the given time and when the player will be at max turns.
getTimeUntilNextTurn()  : int
Calculate the time in seconds until the next turn is awarded.
getToggleWeaponHidingHREF()  : string
getTraderSearchHREF()  : string
getTurns()  : int
getTurnsGained()  : int
getTurnsLevel()  : TurnsLevel
getUnvisitedSectors()  : array<string|int, int>
Returns an array of all unvisited sectors.
getVisibleGoods()  : array<int, TradeGood>
Get an array of goods that are visible to the player
getZoom()  : int
giveStartingRelations()  : void
Set any starting personal relations bonuses or penalties.
giveStartingTurns()  : void
Grant the player their starting turns.
giveTurns()  : void
hasActiveBounty()  : bool
hasAlliance()  : bool
hasBounties()  : bool
hasCustomShipName()  : bool
hasEvilAlignment()  : bool
hasFederalProtection()  : bool
hasGoodAlignment()  : bool
hasMilitaryPayment()  : bool
hasNeutralAlignment()  : bool
hasNewbieStatus()  : bool
Does the player have Newbie status?
hasNewbieTurns()  : bool
hasPlottedCourse()  : bool
hasTicker()  : bool
hasTickers()  : bool
hasTurns()  : bool
hasVisitedSector()  : bool
Check if player has visited the input sector.
increaseAlignment()  : void
increaseAssists()  : void
increaseBank()  : int
Increases personal bank account up to the maximum allowed credits.
increaseCredits()  : int
Increases onboard credits up to the maximum allowed credits.
increaseDeaths()  : void
increaseExperience()  : void
increaseHOF()  : void
increaseKills()  : void
increaseMilitaryPayment()  : void
increaseRelations()  : void
Increase personal relations.
increaseRelationsByTrade()  : void
Increases personal relations from trading $numGoods units with the race of the port given by $raceID.
increaseZoom()  : void
incrementAllianceVsDeaths()  : void
incrementAllianceVsKills()  : void
isAllianceLeader()  : bool
isCombatDronesKamikazeOnMines()  : bool
isDead()  : bool
isDisplayMissions()  : bool
isDisplayWeapons()  : bool
isDraftLeader()  : bool
isFlagship()  : bool
Has this player been designated as the alliance flagship?
isForceDropMessages()  : bool
isGPEditor()  : bool
isIgnoreGlobals()  : bool
isLandedOnPlanet()  : bool
isNameChanged()  : bool
isNewbieCombatant()  : bool
Does this player qualify for new player protections?
isNPC()  : bool
isObserver()  : bool
Is player a non-interacting observer (hidden to other players)?
isOnCouncil()  : bool
isPartOfCourse()  : bool
isPresident()  : bool
isRaceChanged()  : bool
isUnderAttack()  : bool
joinAlliance()  : void
Join an alliance (used for both Leader and New Member roles)
killPlayer()  : void
killPlayerByForces()  : array{DeadExp: int, LostCredits: int}
killPlayerByPlanet()  : array{DeadExp: int, LostCredits: int}
killPlayerByPlayer()  : array{DeadExp: int, KillerExp: int, KillerCredits: int}
killPlayerByPort()  : array{DeadExp: int, LostCredits: int}
leaveAlliance()  : void
log()  : void
Log a player action in the current sector to the admin log console.
markMissionsRead()  : array<string|int, int>
meetsAlignmentRestriction()  : bool
moveDestinationButton()  : void
planetNAPAlliance()  : bool
sameAlliance()  : bool
save()  : void
saveHOF()  : void
savePlayers()  : void
sendAllianceInvitation()  : void
Invites player with $accountID to this player's alliance.
sendGlobalMessage()  : void
sendMessage()  : mixed
sendMessageFromAdmin()  : void
sendMessageFromAllianceAmbassador()  : void
sendMessageFromAllianceCommand()  : void
sendMessageFromCasino()  : void
sendMessageFromFedClerk()  : void
sendMessageFromOpAnnounce()  : void
sendMessageFromPlanet()  : void
sendMessageFromPort()  : void
sendMessageFromRace()  : void
sendMessageToBox()  : void
setAlignment()  : void
setBank()  : void
setBountiesClaimable()  : void
Mark all active bounties on this player as claimable by $claimer
setCombatDronesKamikazeOnMines()  : void
setCredits()  : void
setCustomShipName()  : void
setDead()  : void
setDeaths()  : void
setDisplayMissions()  : void
setDisplayWeapons()  : void
Should weapons be displayed in the right panel? This updates the player database directly because it is used with AJAX, which does not acquire a sector lock.
setExperience()  : void
setForceDropMessages()  : void
setHOF()  : void
setIgnoreGlobals()  : void
setKills()  : void
setLandedOnPlanet()  : void
setLastActive()  : void
setLastCPLAction()  : void
setLastPort()  : void
setLastSectorID()  : void
setLastTurnUpdate()  : void
setMessagesRead()  : void
setMilitaryPayment()  : void
setNameChanged()  : void
setNewbieTurns()  : void
setNewbieWarning()  : void
setPlayerName()  : void
setPlottedCourse()  : void
setRaceChanged()  : void
setRaceID()  : void
setRelations()  : void
Set personal relations.
setScoutMessageGroupType()  : void
setSectorID()  : void
setShipTypeID()  : void
Do not call directly. Use Ship::setTypeID instead.
setTurns()  : void
setUnderAttack()  : void
sharedForceAlliance()  : bool
takeTurns()  : void
traderAttackForceAlliance()  : bool
traderAttackPlanetAlliance()  : bool
traderAttackPortAlliance()  : bool
traderAttackTraderAlliance()  : bool
traderDefendTraderAlliance()  : bool
traderMAPAlliance()  : bool
traderNAPAlliance()  : bool
update()  : void
updateLastCPLAction()  : void
updateLastNewsUpdate()  : void
updateNewbieStatus()  : void
Update the player's newbie status if it has changed.
updateTurns()  : void
__construct()  : mixed
createBounty()  : Bounty
doMessageSending()  : int
getHOFData()  : void
getMission()  : MissionData|false
getNextBountyID()  : int
getPersonalRelationsData()  : void
hasMission()  : bool
setAllianceID()  : void
Not called directly. See joinAlliance and leaveAlliance.
setZoom()  : void
updateMission()  : bool
rebuildMission()  : void
setAllianceJoinable()  : void
setLastNewsUpdate()  : void
setupMissionStep()  : void

Constants

SQL

public mixed SQL = 'account_id = :account_id AND game_id = :game_id'

SHIP_INSURANCE_FRACTION

protected mixed SHIP_INSURANCE_FRACTION = 0.25

TIME_FOR_ALLIANCE_SWITCH

protected mixed TIME_FOR_ALLIANCE_SWITCH = 0

TIME_FOR_FEDERAL_BOUNTY_ON_PR

protected mixed TIME_FOR_FEDERAL_BOUNTY_ON_PR = 10800

Properties

$SQLID read-only

public array{account_id: int, game_id: int} $SQLID

$allianceRoles

protected array<int, int> $allianceRoles = [0 => 0]

$CACHE_ALLIANCE_PLAYERS

protected static array<int, array<int, array<int, Player>>> $CACHE_ALLIANCE_PLAYERS = []

$CACHE_PLANET_PLAYERS

protected static array<int, array<int, array<int, Player>>> $CACHE_PLANET_PLAYERS = []

$CACHE_SECTOR_PLAYERS

protected static array<int, array<int, array<int, Player>>> $CACHE_SECTOR_PLAYERS = []

$combatDronesKamikazeOnMines

protected bool $combatDronesKamikazeOnMines

$hasHOFChanged

protected array<string, int> $hasHOFChanged = []

$hasHOFVisChanged

protected static array<string, int> $hasHOFVisChanged = []

$unvisitedSectors

protected array<string|int, int> $unvisitedSectors

Methods

actionTaken()

public actionTaken(string $actionID, array<string, mixed> $values) : void
Parameters
$actionID : string
$values : array<string, mixed>

addDestinationButton()

public addDestinationButton(int $sectorID, string $label) : void
Parameters
$sectorID : int
$label : string

addMission()

public addMission(int $missionID[, int $step = 0 ]) : void
Parameters
$missionID : int
$step : int = 0

canBeProtectedByRace()

public canBeProtectedByRace(int $raceID) : bool
Parameters
$raceID : int
Return values
bool

canChangeRace()

public canChangeRace() : bool
Return values
bool

canFight()

Returns a boolean identifying if the player can currently participate in battles.

public canFight() : bool
Return values
bool

canSee()

public canSee(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

canSeeAny()

public canSeeAny(array<string|int, Player$otherPlayerArray) : bool
Parameters
$otherPlayerArray : array<string|int, Player>
Return values
bool

changePlayerName()

Change a player's name, with name validation.

public changePlayerName(string $name) : void
Parameters
$name : string
Tags
throws
UserError

When the new name is not permitted.

changePlayerNameByPlayer()

Use this method when the player is changing their own name.

public changePlayerNameByPlayer(string $playerName) : void

This will flag the player as having used their free name change.

Parameters
$playerName : string

claimMissionReward()

public claimMissionReward(int $missionID) : string
Parameters
$missionID : int
Return values
string

createPlayer()

Insert a new player into the database. Returns the new player object.

public static createPlayer(int $accountID, int $gameID, string $playerName, int $raceID, bool $isNewbie[, bool $npc = false ]) : self
Parameters
$accountID : int
$gameID : int
$playerName : string
$raceID : int
$isNewbie : bool
$npc : bool = false
Return values
self

declineMission()

Declining a mission will permanently hide it from the player by adding it in its completed state.

public declineMission(int $missionID) : void
Parameters
$missionID : int

decreaseAlignment()

public decreaseAlignment(int $align) : void
Parameters
$align : int

decreaseBank()

public decreaseBank(int $credits) : void
Parameters
$credits : int

decreaseCredits()

public decreaseCredits(int $credits) : void
Parameters
$credits : int

decreaseExperience()

public decreaseExperience(int $experience) : void
Parameters
$experience : int

decreaseHOF()

public decreaseHOF(float $amount, array<string|int, string> $typeList, string $visibility) : void
Parameters
$amount : float
$typeList : array<string|int, string>
$visibility : string

decreaseMilitaryPayment()

public decreaseMilitaryPayment(int $amount) : void
Parameters
$amount : int

decreaseRelations()

Decrease personal relations.

public decreaseRelations(int $relations, int $raceID) : void
Parameters
$relations : int
$raceID : int

decreaseRelationsByTrade()

Decreases personal relations from trading failures, e.g. rejected bargaining and getting caught stealing.

public decreaseRelationsByTrade(int $numGoods, int $raceID) : void
Parameters
$numGoods : int
$raceID : int

decreaseZoom()

public decreaseZoom(int $zoom) : void
Parameters
$zoom : int

deleteDestinationButton()

public deleteDestinationButton(int $sectorID) : void
Parameters
$sectorID : int

deleteMission()

public deleteMission(int $missionID) : void
Parameters
$missionID : int

equals()

public equals(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

forceNAPAlliance()

public forceNAPAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

getActiveMissions()

public getActiveMissions() : array<int, MissionData>
Return values
array<int, MissionData>
public getAllianceBBLink() : string
Return values
string

getAllianceDisplayName()

public getAllianceDisplayName([bool $linked = false ][, bool $includeAllianceID = false ]) : string
Parameters
$linked : bool = false
$includeAllianceID : bool = false
Return values
string

getAllianceID()

public getAllianceID() : int
Return values
int

getAllianceJoinable()

public getAllianceJoinable() : int
Return values
int

getAlliancePlayers()

public static getAlliancePlayers(int $gameID, int $allianceID[, bool $forceUpdate = false ]) : array<int, Player>
Parameters
$gameID : int
$allianceID : int
$forceUpdate : bool = false
Return values
array<int, Player>

getAllianceRole()

public getAllianceRole([int $allianceID = null ]) : int
Parameters
$allianceID : int = null
Return values
int

getAllianceRosterHREF()

public getAllianceRosterHREF() : string
Return values
string

getAttackTraderHREF()

public getAttackTraderHREF() : string
Return values
string

getAvailableMissions()

public getAvailableMissions() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getClaimableBounties()

Get bounties that can be claimed by this player.

public getClaimableBounties([BountyType|null $type = null ]) : array<string|int, Bounty>
Parameters
$type : BountyType|null = null
Return values
array<string|int, Bounty>

getColouredRaceName()

public getColouredRaceName(int $otherRaceID[, bool $linked = false ]) : string
Parameters
$otherRaceID : int
$linked : bool = false
Return values
string

getColouredRaceNameOrDefault()

public static getColouredRaceNameOrDefault(int $otherRaceID[, self $player = null ][, bool $linked = false ]) : string
Parameters
$otherRaceID : int
$player : self = null
$linked : bool = false
Return values
string

getCustomShipName()

public getCustomShipName() : string|false
Return values
string|false

getDisplayName()

Returns the decorated player name, suitable for HTML display.

public getDisplayName([bool $includeAlliance = false ]) : string
Parameters
$includeAlliance : bool = false
Return values
string

getExamineTraderHREF()

public getExamineTraderHREF() : string
Return values
string

getExperience()

public getExperience() : int
Return values
int

getGalaxyPlayers()

Returns the same players as getSectorPlayers (e.g. not on planets), but for an entire galaxy rather than a single sector. This is useful for reducing the number of queries in galaxy-wide processing.

public static getGalaxyPlayers(int $gameID, int $galaxyID[, bool $forceUpdate = false ]) : array<int, array<int, Player>>
Parameters
$gameID : int
$galaxyID : int
$forceUpdate : bool = false
Return values
array<int, array<int, Player>>

getGame()

public getGame([bool $forceUpdate = false ]) : Game
Parameters
$forceUpdate : bool = false
Return values
Game

getGPWriter()

public getGPWriter() : string|false
Return values
string|false

getHOF()

public getHOF(array<string|int, string> $typeList) : float
Parameters
$typeList : array<string|int, string>
Return values
float

getHOFVis()

public static getHOFVis() : array<string, string>
Return values
array<string, string>

getJumpInfo()

Computes the turn cost and max misjump between current and target sector

public getJumpInfo(Sector $targetSector) : array<string, int>
Parameters
$targetSector : Sector
Tags
throws
PathNotFound
Return values
array<string, int>

getLastActive()

public getLastActive() : int
Return values
int

getLastCPLAction()

public getLastCPLAction() : int
Return values
int

getLastNewsUpdate()

public getLastNewsUpdate() : int
Return values
int

getLastSectorID()

public getLastSectorID() : int
Return values
int

getLastTurnUpdate()

public getLastTurnUpdate() : int
Return values
int

getLeaveNewbieProtectionHREF()

public getLeaveNewbieProtectionHREF() : string
Return values
string

getLevelID()

Returns the numerical level of the player (e.g. 1-50).

public getLevelID() : int
Return values
int

getLevelName()

public getLevelName() : string
Return values
string

getLinkedDisplayName()

public getLinkedDisplayName([bool $includeAlliance = true ]) : string
Parameters
$includeAlliance : bool = true
Return values
string

getMilitaryPayment()

public getMilitaryPayment() : int
Return values
int

getMissions()

public getMissions() : array<int, MissionData>
Return values
array<int, MissionData>

getNewbieTurns()

public getNewbieTurns() : int
Return values
int

getNewbieWarning()

public getNewbieWarning() : bool
Return values
bool

getNextLevelPercentAcquired()

Returns the percent progress towards the next level.

public getNextLevelPercentAcquired() : int

This value is rounded because it is used primarily in HTML img widths.

Return values
int

getNextLevelPercentRemaining()

public getNextLevelPercentRemaining() : int
Return values
int

getPersonalRelation()

Get personal relations with a race

public getPersonalRelation(int $raceID) : int
Parameters
$raceID : int
Return values
int

getPersonalRelations()

public getPersonalRelations() : array<int, int>
Return values
array<int, int>

getPlanet()

Get planet owned by this player.

public getPlanet() : Planet|null

Returns null if this player does not own a planet.

Return values
Planet|null

getPlanetKickHREF()

public getPlanetKickHREF() : string
Return values
string

getPlanetPlayers()

public static getPlanetPlayers(int $gameID, int $sectorID[, bool $forceUpdate = false ]) : array<int, Player>
Parameters
$gameID : int
$sectorID : int
$forceUpdate : bool = false
Return values
array<int, Player>

getPlayer()

public static getPlayer(int $accountID, int $gameID[, bool $forceUpdate = false ][, DatabaseRecord $dbRecord = null ]) : Player
Parameters
$accountID : int
$gameID : int
$forceUpdate : bool = false
$dbRecord : DatabaseRecord = null
Return values
Player

getPlayerByPlayerID()

public static getPlayerByPlayerID(int $playerID, int $gameID[, bool $forceUpdate = false ]) : Player
Parameters
$playerID : int
$gameID : int
$forceUpdate : bool = false
Return values
Player

getPlayerByPlayerName()

public static getPlayerByPlayerName(string $playerName, int $gameID[, bool $forceUpdate = false ]) : Player
Parameters
$playerName : string
$gameID : int
$forceUpdate : bool = false
Return values
Player

getPlayerName()

Returns the player name.

public getPlayerName() : string

Use getDisplayName or getLinkedDisplayName for HTML-safe versions.

Return values
string

getRaceID()

public getRaceID() : int
Return values
int

getRaceName()

public getRaceName() : string
Return values
string

getRelation()

Get total relations with a race (personal + political)

public getRelation(int $raceID) : int
Parameters
$raceID : int
Return values
int

getRelations()

Get total relations with all races (personal + political)

public getRelations() : array<int, int>
Return values
array<int, int>

getSafeAttackRating()

public getSafeAttackRating() : int
Return values
int

getScoutMessageGroupLimit()

public getScoutMessageGroupLimit() : int
Return values
int

getSectorPlayers()

public static getSectorPlayers(int $gameID, int $sectorID[, bool $forceUpdate = false ]) : array<int, Player>
Parameters
$gameID : int
$sectorID : int
$forceUpdate : bool = false
Return values
array<int, Player>

getSectorPlayersByAlliances()

public static getSectorPlayersByAlliances(int $gameID, int $sectorID, array<string|int, int> $allianceIDs[, bool $forceUpdate = false ]) : array<int, Player>
Parameters
$gameID : int
$sectorID : int
$allianceIDs : array<string|int, int>
$forceUpdate : bool = false
Return values
array<int, Player>

getSharingPlayers()

Get array of players whose info can be accessed by this player.

public getSharingPlayers([bool $forceUpdate = false ]) : array<string|int, AbstractPlayer>

Skips players who are not in the same alliance as this player.

Parameters
$forceUpdate : bool = false
Return values
array<string|int, AbstractPlayer>

getTicker()

public getTicker(string $tickerType) : TickerData|false
Parameters
$tickerType : string
Return values
TickerData|false

getTickers()

public getTickers() : array<string, TickerData>
Return values
array<string, TickerData>

getTimeUntilMaxTurns()

Calculate the time in seconds between the given time and when the player will be at max turns.

public getTimeUntilMaxTurns(int $time[, bool $forceUpdate = false ]) : int
Parameters
$time : int
$forceUpdate : bool = false
Return values
int

getTimeUntilNextTurn()

Calculate the time in seconds until the next turn is awarded.

public getTimeUntilNextTurn() : int
Return values
int

getToggleWeaponHidingHREF()

public getToggleWeaponHidingHREF([bool $ajax = false ]) : string
Parameters
$ajax : bool = false
Return values
string

getTraderSearchHREF()

public getTraderSearchHREF() : string
Return values
string

getTurnsGained()

public getTurnsGained(int $time[, bool $forceUpdate = false ]) : int
Parameters
$time : int
$forceUpdate : bool = false
Return values
int

getUnvisitedSectors()

Returns an array of all unvisited sectors.

public getUnvisitedSectors() : array<string|int, int>
Return values
array<string|int, int>

getVisibleGoods()

Get an array of goods that are visible to the player

public getVisibleGoods() : array<int, TradeGood>
Return values
array<int, TradeGood>

giveStartingRelations()

Set any starting personal relations bonuses or penalties.

public giveStartingRelations() : void

giveStartingTurns()

Grant the player their starting turns.

public giveStartingTurns() : void

giveTurns()

public giveTurns(int $give[, int $giveNewbie = 0 ]) : void
Parameters
$give : int
$giveNewbie : int = 0

hasCustomShipName()

public hasCustomShipName() : bool
Tags
phpstan-assert-if-true

!false $this->getCustomShipName()

Return values
bool

hasEvilAlignment()

public hasEvilAlignment() : bool
Return values
bool

hasFederalProtection()

public hasFederalProtection() : bool
Return values
bool

hasGoodAlignment()

public hasGoodAlignment() : bool
Return values
bool

hasMilitaryPayment()

public hasMilitaryPayment() : bool
Return values
bool

hasNeutralAlignment()

public hasNeutralAlignment() : bool
Return values
bool

hasNewbieStatus()

Does the player have Newbie status?

public hasNewbieStatus() : bool
Return values
bool

hasNewbieTurns()

public hasNewbieTurns() : bool
Return values
bool

hasPlottedCourse()

public hasPlottedCourse() : bool
Tags
phpstan-assert-if-true

!false $this->getPlottedCourse()

Return values
bool

hasTicker()

public hasTicker(string $tickerType) : bool
Parameters
$tickerType : string
Return values
bool

hasVisitedSector()

Check if player has visited the input sector.

public hasVisitedSector(int $sectorID) : bool

Note that this populates the list of all unvisited sectors!

Parameters
$sectorID : int
Return values
bool

increaseAlignment()

public increaseAlignment(int $align) : void
Parameters
$align : int

increaseAssists()

public increaseAssists(int $assists) : void
Parameters
$assists : int

increaseBank()

Increases personal bank account up to the maximum allowed credits.

public increaseBank(int $credits) : int

Returns the amount that was actually added to handle overflow.

Parameters
$credits : int
Return values
int

increaseCredits()

Increases onboard credits up to the maximum allowed credits.

public increaseCredits(int $credits) : int

Returns the amount that was actually added to handle overflow.

Parameters
$credits : int
Return values
int

increaseDeaths()

public increaseDeaths(int $deaths) : void
Parameters
$deaths : int

increaseExperience()

public increaseExperience(int $experience) : void
Parameters
$experience : int

increaseHOF()

public increaseHOF(float $amount, array<string|int, string> $typeList, string $visibility) : void
Parameters
$amount : float
$typeList : array<string|int, string>
$visibility : string

increaseKills()

public increaseKills(int $kills) : void
Parameters
$kills : int

increaseMilitaryPayment()

public increaseMilitaryPayment(int $amount) : void
Parameters
$amount : int

increaseRelations()

Increase personal relations.

public increaseRelations(int $relations, int $raceID) : void
Parameters
$relations : int
$raceID : int

increaseRelationsByTrade()

Increases personal relations from trading $numGoods units with the race of the port given by $raceID.

public increaseRelationsByTrade(int $numGoods, int $raceID) : void
Parameters
$numGoods : int
$raceID : int

increaseZoom()

public increaseZoom(int $zoom) : void
Parameters
$zoom : int

incrementAllianceVsDeaths()

public incrementAllianceVsDeaths(int $otherID) : void
Parameters
$otherID : int

incrementAllianceVsKills()

public incrementAllianceVsKills(int $otherID) : void
Parameters
$otherID : int

isAllianceLeader()

public isAllianceLeader([bool $forceUpdate = false ]) : bool
Parameters
$forceUpdate : bool = false
Return values
bool

isCombatDronesKamikazeOnMines()

public isCombatDronesKamikazeOnMines() : bool
Return values
bool

isDisplayMissions()

public isDisplayMissions() : bool
Return values
bool

isDisplayWeapons()

public isDisplayWeapons() : bool
Return values
bool

isDraftLeader()

public isDraftLeader() : bool
Return values
bool

isFlagship()

Has this player been designated as the alliance flagship?

public isFlagship() : bool
Return values
bool

isForceDropMessages()

public isForceDropMessages() : bool
Return values
bool

isIgnoreGlobals()

public isIgnoreGlobals() : bool
Return values
bool

isLandedOnPlanet()

public isLandedOnPlanet() : bool
Return values
bool

isNameChanged()

public isNameChanged() : bool
Return values
bool

isNewbieCombatant()

Does this player qualify for new player protections?

public isNewbieCombatant([self|null $other = null ]) : bool
Parameters
$other : self|null = null
Return values
bool

isObserver()

Is player a non-interacting observer (hidden to other players)?

public isObserver() : bool
Return values
bool

isRaceChanged()

public isRaceChanged() : bool
Return values
bool

isUnderAttack()

public isUnderAttack() : bool
Return values
bool

joinAlliance()

Join an alliance (used for both Leader and New Member roles)

public joinAlliance(int $allianceID) : void
Parameters
$allianceID : int

killPlayer()

public killPlayer(int $sectorID) : void
Parameters
$sectorID : int

killPlayerByForces()

public killPlayerByForces(Force $forces) : array{DeadExp: int, LostCredits: int}
Parameters
$forces : Force
Return values
array{DeadExp: int, LostCredits: int}

killPlayerByPlanet()

public killPlayerByPlanet(Planet $planet) : array{DeadExp: int, LostCredits: int}
Parameters
$planet : Planet
Return values
array{DeadExp: int, LostCredits: int}

killPlayerByPlayer()

public killPlayerByPlayer(self $killer) : array{DeadExp: int, KillerExp: int, KillerCredits: int}
Parameters
$killer : self
Return values
array{DeadExp: int, KillerExp: int, KillerCredits: int}

killPlayerByPort()

public killPlayerByPort(Port $port) : array{DeadExp: int, LostCredits: int}
Parameters
$port : Port
Return values
array{DeadExp: int, LostCredits: int}

leaveAlliance()

public leaveAlliance([self $kickedBy = null ]) : void
Parameters
$kickedBy : self = null

log()

Log a player action in the current sector to the admin log console.

public log(int $log_type_id, string $msg) : void
Parameters
$log_type_id : int
$msg : string

markMissionsRead()

public markMissionsRead() : array<string|int, int>
Return values
array<string|int, int>

meetsAlignmentRestriction()

public meetsAlignmentRestriction(int $restriction) : bool
Parameters
$restriction : int
Return values
bool

moveDestinationButton()

public moveDestinationButton(int $sectorID, int $offsetTop, int $offsetLeft) : void
Parameters
$sectorID : int
$offsetTop : int
$offsetLeft : int

planetNAPAlliance()

public planetNAPAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

sameAlliance()

public sameAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

sendAllianceInvitation()

Invites player with $accountID to this player's alliance.

public sendAllianceInvitation(int $accountID, string $message, int $expires) : void
Parameters
$accountID : int
$message : string
$expires : int

sendGlobalMessage()

public sendGlobalMessage(string $message[, bool $canBeIgnored = true ]) : void
Parameters
$message : string
$canBeIgnored : bool = true

sendMessage()

public sendMessage(int $receiverID, int $messageTypeID, string $message[, bool $canBeIgnored = true ][, bool $unread = true ][, int $expires = null ][, bool $senderDelete = false ]) : mixed
Parameters
$receiverID : int
$messageTypeID : int
$message : string
$canBeIgnored : bool = true
$unread : bool = true
$expires : int = null
$senderDelete : bool = false
Return values
mixed

Message ID

sendMessageFromAdmin()

public static sendMessageFromAdmin(int $gameID, int $receiverID, string $message[, int $expires = null ]) : void
Parameters
$gameID : int
$receiverID : int
$message : string
$expires : int = null

sendMessageFromAllianceAmbassador()

public static sendMessageFromAllianceAmbassador(int $gameID, int $receiverID, string $message[, int $expires = null ]) : void
Parameters
$gameID : int
$receiverID : int
$message : string
$expires : int = null

sendMessageFromAllianceCommand()

public sendMessageFromAllianceCommand(int $receiverID, string $message) : void
Parameters
$receiverID : int
$message : string

sendMessageFromCasino()

public sendMessageFromCasino(string $message[, int $expires = null ]) : void
Parameters
$message : string
$expires : int = null

sendMessageFromFedClerk()

public static sendMessageFromFedClerk(int $gameID, int $receiverID, string $message) : void
Parameters
$gameID : int
$receiverID : int
$message : string

sendMessageFromOpAnnounce()

public sendMessageFromOpAnnounce(int $receiverID, string $message[, int $expires = null ]) : void
Parameters
$receiverID : int
$message : string
$expires : int = null

sendMessageFromPlanet()

public static sendMessageFromPlanet(int $gameID, int $receiverID, string $message) : void
Parameters
$gameID : int
$receiverID : int
$message : string

sendMessageFromPort()

public static sendMessageFromPort(int $gameID, int $receiverID, string $message) : void
Parameters
$gameID : int
$receiverID : int
$message : string

sendMessageFromRace()

public static sendMessageFromRace(int $raceID, int $gameID, int $receiverID, string $message[, int $expires = null ]) : void
Parameters
$raceID : int
$gameID : int
$receiverID : int
$message : string
$expires : int = null

sendMessageToBox()

public sendMessageToBox(int $boxTypeID, string $message) : void
Parameters
$boxTypeID : int
$message : string

setAlignment()

public setAlignment(int $align) : void
Parameters
$align : int

setBank()

public setBank(int $credits) : void
Parameters
$credits : int

setBountiesClaimable()

Mark all active bounties on this player as claimable by $claimer

public setBountiesClaimable(self $claimer) : void
Parameters
$claimer : self

setCombatDronesKamikazeOnMines()

public setCombatDronesKamikazeOnMines(bool $bool) : void
Parameters
$bool : bool

setCredits()

public setCredits(int $credits) : void
Parameters
$credits : int

setCustomShipName()

public setCustomShipName(string $name) : void
Parameters
$name : string

setDead()

public setDead(bool $bool) : void
Parameters
$bool : bool

setDeaths()

public setDeaths(int $deaths) : void
Parameters
$deaths : int

setDisplayMissions()

public setDisplayMissions(bool $bool) : void
Parameters
$bool : bool

setDisplayWeapons()

Should weapons be displayed in the right panel? This updates the player database directly because it is used with AJAX, which does not acquire a sector lock.

public setDisplayWeapons(bool $bool) : void
Parameters
$bool : bool

setExperience()

public setExperience(int $experience) : void
Parameters
$experience : int

setForceDropMessages()

public setForceDropMessages(bool $bool) : void
Parameters
$bool : bool

setHOF()

public setHOF(float $amount, array<string|int, string> $typeList, string $visibility) : void
Parameters
$amount : float
$typeList : array<string|int, string>
$visibility : string

setIgnoreGlobals()

public setIgnoreGlobals(bool $bool) : void
Parameters
$bool : bool

setKills()

public setKills(int $kills) : void
Parameters
$kills : int

setLandedOnPlanet()

public setLandedOnPlanet(bool $bool) : void
Parameters
$bool : bool

setLastActive()

public setLastActive(int $lastActive) : void
Parameters
$lastActive : int

setLastCPLAction()

public setLastCPLAction(int $time) : void
Parameters
$time : int

setLastPort()

public setLastPort(int $lastPort) : void
Parameters
$lastPort : int

setLastSectorID()

public setLastSectorID(int $lastSectorID) : void
Parameters
$lastSectorID : int

setLastTurnUpdate()

public setLastTurnUpdate(int $time) : void
Parameters
$time : int

setMessagesRead()

public setMessagesRead(int $messageTypeID) : void
Parameters
$messageTypeID : int

setMilitaryPayment()

public setMilitaryPayment(int $amount) : void
Parameters
$amount : int

setNameChanged()

public setNameChanged(bool $bool) : void
Parameters
$bool : bool

setNewbieTurns()

public setNewbieTurns(int $newbieTurns) : void
Parameters
$newbieTurns : int

setNewbieWarning()

public setNewbieWarning(bool $bool) : void
Parameters
$bool : bool

setPlayerName()

public setPlayerName(string $name) : void
Parameters
$name : string

setPlottedCourse()

public setPlottedCourse(Path $plottedCourse) : void
Parameters
$plottedCourse : Path

setRaceChanged()

public setRaceChanged(bool $raceChanged) : void
Parameters
$raceChanged : bool

setRaceID()

public setRaceID(int $raceID) : void
Parameters
$raceID : int

setRelations()

Set personal relations.

public setRelations(int $relations, int $raceID) : void
Parameters
$relations : int
$raceID : int

setSectorID()

public setSectorID(int $sectorID) : void
Parameters
$sectorID : int

setShipTypeID()

Do not call directly. Use Ship::setTypeID instead.

public setShipTypeID(int $shipID) : void
Parameters
$shipID : int

setTurns()

public setTurns(int $turns) : void
Parameters
$turns : int

setUnderAttack()

public setUnderAttack(bool $value) : void
Parameters
$value : bool

sharedForceAlliance()

public sharedForceAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

takeTurns()

public takeTurns(int $take[, int $takeNewbie = 0 ]) : void
Parameters
$take : int
$takeNewbie : int = 0

traderAttackForceAlliance()

public traderAttackForceAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

traderAttackPlanetAlliance()

public traderAttackPlanetAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

traderAttackPortAlliance()

public traderAttackPortAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

traderAttackTraderAlliance()

public traderAttackTraderAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

traderDefendTraderAlliance()

public traderDefendTraderAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

traderMAPAlliance()

public traderMAPAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

traderNAPAlliance()

public traderNAPAlliance(self $otherPlayer) : bool
Parameters
$otherPlayer : self
Return values
bool

updateNewbieStatus()

Update the player's newbie status if it has changed.

public updateNewbieStatus() : void

This function queries the account, so use sparingly.

doMessageSending()

protected static doMessageSending(int $senderID, int $receiverID, int $gameID, int $messageTypeID, string $message, int $expires[, bool $senderDelete = false ][, bool $unread = true ]) : int
Parameters
$senderID : int
$receiverID : int
$gameID : int
$messageTypeID : int
$message : string
$expires : int
$senderDelete : bool = false
$unread : bool = true
Return values
int

Message ID

getMission()

protected getMission(int $missionID) : MissionData|false
Parameters
$missionID : int
Return values
MissionData|false

getNextBountyID()

protected getNextBountyID() : int
Return values
int

getPersonalRelationsData()

protected getPersonalRelationsData() : void

hasMission()

protected hasMission(int $missionID) : bool
Parameters
$missionID : int
Return values
bool

setAllianceID()

Not called directly. See joinAlliance and leaveAlliance.

protected setAllianceID(int $ID) : void
Parameters
$ID : int

setZoom()

protected setZoom(int $zoom) : void
Parameters
$zoom : int

updateMission()

protected updateMission(int $missionID) : bool
Parameters
$missionID : int
Return values
bool

rebuildMission()

private rebuildMission(int $missionID) : void
Parameters
$missionID : int

setAllianceJoinable()

private setAllianceJoinable(int $time) : void
Parameters
$time : int

setLastNewsUpdate()

private setLastNewsUpdate(int $time) : void
Parameters
$time : int

setupMissionStep()

private setupMissionStep(int $missionID) : void
Parameters
$missionID : int

        
On this page

Search results