Documentation

Sector
in package

Table of Contents

Constants

SQL  = 'game_id = :game_id AND sector_id = :sector_id'
LINK_DIR_MAPPING  = ['Up' => 'link_up', 'Down' => 'link_down', 'Left' => 'link_left', 'Right' => 'link_right']
Maps the Sector link direction names to database columns.

Properties

$SQLID  : array{game_id: int, sector_id: int}
$battles  : int
$CACHE_GALAXY_SECTORS  : array<int, array<int, array<int, self>>>
$CACHE_LOCATION_SECTORS  : array<int, array<int, array<int, self>>>
$CACHE_SECTORS  : array<int, array<int, self>>
$galaxyID  : int
$gameID  : int
$hasChanged  : bool
$isNew  : bool
$links  : array<string, int>
$sectorID  : int
$visited  : array<int, bool>
$warp  : int

Methods

addLinkedLocations()  : void
addLocation()  : void
clearCache()  : void
createPlanet()  : Planet
createPort()  : Port
createSector()  : self
decreaseBattles()  : void
diedHere()  : void
disableLink()  : void
Cannot be used for Warps
enableLink()  : void
Cannot be used for Warps
enteringSector()  : void
equals()  : bool
getBattles()  : int
getCachedPort()  : Port
getCurrentSectorMoveHREF()  : string
getEnemyForces()  : array<string|int, Force>
getFedRaceIDs()  : array<int, int>
getFightingTraders()  : array<string, array<int, AbstractPlayer>>
getFightingTradersAgainstForces()  : array<string|int, AbstractPlayer>
getFightingTradersAgainstPlanet()  : array<int, AbstractPlayer>
getFightingTradersAgainstPort()  : array<int, AbstractPlayer>
getForces()  : array<int, Force>
getFriendlyForces()  : array<string|int, Force>
getGalaxy()  : Galaxy
getGalaxyID()  : int
getGalaxyMapHREF()  : string
getGalaxySectors()  : array<int, self>
getGameID()  : int
getLink()  : int
getLinkDown()  : int
getLinkLeft()  : int
getLinkRight()  : int
getLinks()  : array<string, int>
getLinkSector()  : self
getLinkUp()  : int
getLocalMapMoveHREF()  : string
getLocations()  : array<int, Location>
getLocationSectors()  : array<int, self>
getNeighbourID()  : int
getNeighbourSector()  : self
getNumberOfConnections()  : int
Returns the number of linked sectors (including warps)
getNumberOfLinks()  : int
Returns the number of linked sectors (excluding warps)
getOtherTraders()  : array<int, Player>
getPlanet()  : Planet
getPlayers()  : array<int, Player>
getPort()  : Port
getPotentialFightingTraders()  : array<string, array<int, AbstractPlayer>>
getSector()  : self
getSectorDirection()  : string
getSectorID()  : int
getSectorScanHREF()  : string
getWarp()  : int
Returns the warp sector if the sector has a warp; returns 0 otherwise.
getWarpSector()  : self
hasAllianceFlagship()  : bool
Is the $player's alliance flagship in this sector?
hasAnyLocationsWithAction()  : bool
hasCachedPort()  : bool
hasEnemyForces()  : bool
hasEnemyTraders()  : bool
hasForces()  : bool
hasFriendlyForces()  : bool
hasFriendlyTraders()  : bool
hasLink()  : bool
hasLinkDown()  : bool
hasLinkLeft()  : bool
hasLinkRight()  : bool
hasLinkUp()  : bool
hasLocation()  : bool
hasOtherTraders()  : bool
hasPlanet()  : bool
hasPlayerForces()  : bool
Returns true if any forces in this sector belong to $player.
hasPlayers()  : bool
hasPort()  : bool
hasProtectedTraders()  : bool
hasWarp()  : bool
hasX()  : bool
increaseBattles()  : void
isLinked()  : bool
isLinkedSector()  : bool
isVisited()  : bool
leavingSector()  : void
limitFightingTraders()  : array<int, AbstractPlayer>
markVisited()  : void
offersFederalProtection()  : bool
oppositeDir()  : string
removeAllFixtures()  : void
Removes ports, planets, locations, and warps from this sector.
removeAllLocations()  : void
removePlanet()  : void
removePort()  : void
removeWarp()  : void
Remove the warp sector for both sides of the warp.
saveSectors()  : void
sectorExists()  : bool
Constructs the sector to determine if it exists.
setBattles()  : void
setGalaxyID()  : void
setLink()  : void
Cannot be used for Warps
setLinkDown()  : void
setLinkLeft()  : void
setLinkRight()  : void
setLinkSector()  : void
Cannot be used for Warps
setLinkUp()  : void
setWarp()  : void
Set the warp sector for both $this and $warp to ensure a consistent 2-way warp.
toggleLink()  : void
Cannot be used for Warps
update()  : void
__construct()  : mixed

Constants

SQL

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

Maps the Sector link direction names to database columns.

protected mixed LINK_DIR_MAPPING = ['Up' => 'link_up', 'Down' => 'link_down', 'Left' => 'link_left', 'Right' => 'link_right']

Properties

$SQLID read-only

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

$CACHE_GALAXY_SECTORS

protected static array<int, array<int, array<int, self>>> $CACHE_GALAXY_SECTORS = []

$CACHE_LOCATION_SECTORS

protected static array<int, array<int, array<int, self>>> $CACHE_LOCATION_SECTORS = []

$CACHE_SECTORS

protected static array<int, array<int, self>> $CACHE_SECTORS = []

$galaxyID

protected int $galaxyID

$gameID read-only

protected int $gameID

$hasChanged

protected bool $hasChanged = false

$isNew

protected bool $isNew = false
protected array<string, int> $links = []

$sectorID read-only

protected int $sectorID

$visited

protected array<int, bool> $visited = []

Methods

clearCache()

public static clearCache() : void

createPlanet()

public createPlanet([int $type = 1 ]) : Planet
Parameters
$type : int = 1
Return values
Planet

createSector()

public static createSector(int $gameID, int $sectorID) : self
Parameters
$gameID : int
$sectorID : int
Return values
self

decreaseBattles()

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

Cannot be used for Warps

public disableLink(string $dir) : void
Parameters
$dir : string

Cannot be used for Warps

public enableLink(string $dir) : void
Parameters
$dir : string

equals()

public equals(Sector $otherSector) : bool
Parameters
$otherSector : Sector
Return values
bool

getBattles()

public getBattles() : int
Return values
int

getFedRaceIDs()

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

getForces()

public getForces() : array<int, Force>
Return values
array<int, Force>

getGalaxyID()

public getGalaxyID() : int
Return values
int

getGalaxyMapHREF()

public getGalaxyMapHREF() : string
Return values
string

getGalaxySectors()

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

getGameID()

public getGameID() : int
Return values
int
public getLink(string $name) : int
Parameters
$name : string
Return values
int

getLinkDown()

public getLinkDown() : int
Return values
int

getLinkLeft()

public getLinkLeft() : int
Return values
int

getLinkRight()

public getLinkRight() : int
Return values
int
public getLinks() : array<string, int>
Return values
array<string, int>

getLinkSector()

public getLinkSector(string $name) : self
Parameters
$name : string
Return values
self

getLinkUp()

public getLinkUp() : int
Return values
int

getLocationSectors()

public static getLocationSectors(int $gameID, int $locationTypeID[, bool $forceUpdate = false ]) : array<int, self>
Parameters
$gameID : int
$locationTypeID : int
$forceUpdate : bool = false
Return values
array<int, self>

getNeighbourID()

public getNeighbourID(string $dir) : int
Parameters
$dir : string
Return values
int

getNeighbourSector()

public getNeighbourSector(string $dir) : self
Parameters
$dir : string
Return values
self

getNumberOfConnections()

Returns the number of linked sectors (including warps)

public getNumberOfConnections() : int
Return values
int

Returns the number of linked sectors (excluding warps)

public getNumberOfLinks() : int
Return values
int

getSector()

public static getSector(int $gameID, int $sectorID[, bool $forceUpdate = false ][, DatabaseRecord $dbRecord = null ]) : self
Parameters
$gameID : int
$sectorID : int
$forceUpdate : bool = false
$dbRecord : DatabaseRecord = null
Return values
self

getSectorDirection()

public getSectorDirection(int $sectorID) : string
Parameters
$sectorID : int
Return values
string

getSectorID()

public getSectorID() : int
Return values
int

getWarp()

Returns the warp sector if the sector has a warp; returns 0 otherwise.

public getWarp() : int
Return values
int

getWarpSector()

public getWarpSector() : self
Return values
self

hasAllianceFlagship()

Is the $player's alliance flagship in this sector?

public hasAllianceFlagship([AbstractPlayer $player = null ]) : bool
Parameters
$player : AbstractPlayer = null
Return values
bool

hasAnyLocationsWithAction()

public hasAnyLocationsWithAction() : bool
Return values
bool

hasCachedPort()

public hasCachedPort([AbstractPlayer $player = null ]) : bool
Parameters
$player : AbstractPlayer = null
Tags
phpstan-assert-if-true

=AbstractPlayer $player

Return values
bool

hasForces()

public hasForces() : bool
Return values
bool

hasFriendlyForces()

public hasFriendlyForces([AbstractPlayer $player = null ]) : bool
Parameters
$player : AbstractPlayer = null
Tags
phpstan-assert-if-true

=AbstractPlayer $player

Return values
bool
public hasLink(string $name) : bool
Parameters
$name : string
Return values
bool

hasLinkDown()

public hasLinkDown() : bool
Return values
bool

hasLinkLeft()

public hasLinkLeft() : bool
Return values
bool

hasLinkRight()

public hasLinkRight() : bool
Return values
bool

hasLinkUp()

public hasLinkUp() : bool
Return values
bool

hasLocation()

public hasLocation([int $locationTypeID = null ]) : bool
Parameters
$locationTypeID : int = null
Return values
bool

hasPlanet()

public hasPlanet() : bool
Return values
bool

hasPlayerForces()

Returns true if any forces in this sector belong to $player.

public hasPlayerForces(AbstractPlayer $player) : bool
Parameters
$player : AbstractPlayer
Return values
bool

hasPlayers()

public hasPlayers() : bool
Return values
bool

hasPort()

public hasPort() : bool
Return values
bool

hasWarp()

public hasWarp() : bool
Return values
bool

increaseBattles()

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

isLinked()

public isLinked(int $sectorID) : bool
Parameters
$sectorID : int
Return values
bool

isLinkedSector()

public isLinkedSector(Sector $otherSector) : bool
Parameters
$otherSector : Sector
Return values
bool

offersFederalProtection()

public offersFederalProtection() : bool
Return values
bool

oppositeDir()

public static oppositeDir(string $dir) : string
Parameters
$dir : string
Return values
string

removeAllFixtures()

Removes ports, planets, locations, and warps from this sector.

public removeAllFixtures() : void

NOTE: This should only be used by the universe generator!

removeAllLocations()

public removeAllLocations() : void

removePlanet()

public removePlanet() : void

removePort()

public removePort() : void

removeWarp()

Remove the warp sector for both sides of the warp.

public removeWarp() : void

saveSectors()

public static saveSectors() : void

sectorExists()

Constructs the sector to determine if it exists.

public static sectorExists(int $gameID, int $sectorID) : bool

Returns a boolean value.

Parameters
$gameID : int
$sectorID : int
Return values
bool

setBattles()

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

setGalaxyID()

public setGalaxyID(int $galaxyID) : void
Parameters
$galaxyID : int

Cannot be used for Warps

public setLink(string $name, int $linkID) : void
Parameters
$name : string
$linkID : int

setLinkDown()

public setLinkDown(int $linkID) : void
Parameters
$linkID : int

setLinkLeft()

public setLinkLeft(int $linkID) : void
Parameters
$linkID : int

setLinkRight()

public setLinkRight(int $linkID) : void
Parameters
$linkID : int

setLinkSector()

Cannot be used for Warps

public setLinkSector(string $dir, Sector $linkSector) : void
Parameters
$dir : string
$linkSector : Sector

setLinkUp()

public setLinkUp(int $linkID) : void
Parameters
$linkID : int

setWarp()

Set the warp sector for both $this and $warp to ensure a consistent 2-way warp.

public setWarp(Sector $warp) : void
Parameters
$warp : Sector

Cannot be used for Warps

public toggleLink(string $dir) : void
Parameters
$dir : string

update()

public update() : void

__construct()

protected __construct(int $gameID, int $sectorID[, bool $create = false ][, DatabaseRecord $dbRecord = null ]) : mixed
Parameters
$gameID : int
$sectorID : int
$create : bool = false
$dbRecord : DatabaseRecord = null

        
On this page

Search results