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'
LINK_DIR_MAPPING
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
$battles
protected
int
$battles
$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
$links
protected
array<string, int>
$links
= []
$sectorID read-only
protected
int
$sectorID
$visited
protected
array<int, bool>
$visited
= []
$warp
protected
int
$warp
Methods
addLinkedLocations()
public
addLinkedLocations(Location $location) : void
Parameters
- $location : Location
addLocation()
public
addLocation(Location $location) : void
Parameters
- $location : Location
clearCache()
public
static clearCache() : void
createPlanet()
public
createPlanet([int $type = 1 ]) : Planet
Parameters
- $type : int = 1
Return values
PlanetcreatePort()
public
createPort() : Port
Return values
PortcreateSector()
public
static createSector(int $gameID, int $sectorID) : self
Parameters
- $gameID : int
- $sectorID : int
Return values
selfdecreaseBattles()
public
decreaseBattles(int $amount) : void
Parameters
- $amount : int
diedHere()
public
diedHere(AbstractPlayer $player) : void
Parameters
- $player : AbstractPlayer
disableLink()
Cannot be used for Warps
public
disableLink(string $dir) : void
Parameters
- $dir : string
enableLink()
Cannot be used for Warps
public
enableLink(string $dir) : void
Parameters
- $dir : string
enteringSector()
public
enteringSector(AbstractPlayer $player, MovementType $movementType) : void
Parameters
- $player : AbstractPlayer
- $movementType : MovementType
equals()
public
equals(Sector $otherSector) : bool
Parameters
- $otherSector : Sector
Return values
boolgetBattles()
public
getBattles() : int
Return values
intgetCachedPort()
public
getCachedPort(AbstractPlayer $player) : Port
Parameters
- $player : AbstractPlayer
Return values
PortgetCurrentSectorMoveHREF()
public
getCurrentSectorMoveHREF(AbstractPlayer $player) : string
Parameters
- $player : AbstractPlayer
Return values
stringgetEnemyForces()
public
getEnemyForces(AbstractPlayer $player) : array<string|int, Force>
Parameters
- $player : AbstractPlayer
Return values
array<string|int, Force>getFedRaceIDs()
public
getFedRaceIDs() : array<int, int>
Return values
array<int, int>getFightingTraders()
public
getFightingTraders(AbstractPlayer $attackingPlayer, AbstractPlayer $defendingPlayer[, bool $checkForCloak = false ][, bool $allEligible = false ]) : array<string, array<int, AbstractPlayer>>
Parameters
- $attackingPlayer : AbstractPlayer
- $defendingPlayer : AbstractPlayer
- $checkForCloak : bool = false
- $allEligible : bool = false
Return values
array<string, array<int, AbstractPlayer>>getFightingTradersAgainstForces()
public
getFightingTradersAgainstForces(AbstractPlayer $attackingPlayer, bool $bump) : array<string|int, AbstractPlayer>
Parameters
- $attackingPlayer : AbstractPlayer
- $bump : bool
Return values
array<string|int, AbstractPlayer>getFightingTradersAgainstPlanet()
public
getFightingTradersAgainstPlanet(AbstractPlayer $attackingPlayer, Planet $defendingPlanet[, bool $allEligible = false ]) : array<int, AbstractPlayer>
Parameters
- $attackingPlayer : AbstractPlayer
- $defendingPlanet : Planet
- $allEligible : bool = false
Return values
array<int, AbstractPlayer>getFightingTradersAgainstPort()
public
getFightingTradersAgainstPort(AbstractPlayer $attackingPlayer, Port $defendingPort[, bool $allEligible = false ]) : array<int, AbstractPlayer>
Parameters
- $attackingPlayer : AbstractPlayer
- $defendingPort : Port
- $allEligible : bool = false
Return values
array<int, AbstractPlayer>getForces()
public
getForces() : array<int, Force>
Return values
array<int, Force>getFriendlyForces()
public
getFriendlyForces(AbstractPlayer $player) : array<string|int, Force>
Parameters
- $player : AbstractPlayer
Return values
array<string|int, Force>getGalaxy()
public
getGalaxy() : Galaxy
Return values
GalaxygetGalaxyID()
public
getGalaxyID() : int
Return values
intgetGalaxyMapHREF()
public
getGalaxyMapHREF() : string
Return values
stringgetGalaxySectors()
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
intgetLink()
public
getLink(string $name) : int
Parameters
- $name : string
Return values
intgetLinkDown()
public
getLinkDown() : int
Return values
intgetLinkLeft()
public
getLinkLeft() : int
Return values
intgetLinkRight()
public
getLinkRight() : int
Return values
intgetLinks()
public
getLinks() : array<string, int>
Return values
array<string, int>getLinkSector()
public
getLinkSector(string $name) : self
Parameters
- $name : string
Return values
selfgetLinkUp()
public
getLinkUp() : int
Return values
intgetLocalMapMoveHREF()
public
getLocalMapMoveHREF(AbstractPlayer $player) : string
Parameters
- $player : AbstractPlayer
Return values
stringgetLocations()
public
getLocations() : array<int, Location>
Return values
array<int, Location>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
intgetNeighbourSector()
public
getNeighbourSector(string $dir) : self
Parameters
- $dir : string
Return values
selfgetNumberOfConnections()
Returns the number of linked sectors (including warps)
public
getNumberOfConnections() : int
Return values
intgetNumberOfLinks()
Returns the number of linked sectors (excluding warps)
public
getNumberOfLinks() : int
Return values
intgetOtherTraders()
public
getOtherTraders(AbstractPlayer $player) : array<int, Player>
Parameters
- $player : AbstractPlayer
Return values
array<int, Player>getPlanet()
public
getPlanet() : Planet
Return values
PlanetgetPlayers()
public
getPlayers() : array<int, Player>
Return values
array<int, Player>getPort()
public
getPort() : Port
Return values
PortgetPotentialFightingTraders()
public
getPotentialFightingTraders(AbstractPlayer $attackingPlayer) : array<string, array<int, AbstractPlayer>>
Parameters
- $attackingPlayer : AbstractPlayer
Return values
array<string, array<int, AbstractPlayer>>getSector()
public
static getSector(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
selfgetSectorDirection()
public
getSectorDirection(int $sectorID) : string
Parameters
- $sectorID : int
Return values
stringgetSectorID()
public
getSectorID() : int
Return values
intgetSectorScanHREF()
public
getSectorScanHREF(AbstractPlayer $player) : string
Parameters
- $player : AbstractPlayer
Return values
stringgetWarp()
Returns the warp sector if the sector has a warp; returns 0 otherwise.
public
getWarp() : int
Return values
intgetWarpSector()
public
getWarpSector() : self
Return values
selfhasAllianceFlagship()
Is the $player's alliance flagship in this sector?
public
hasAllianceFlagship([AbstractPlayer|null $player = null ]) : bool
Parameters
- $player : AbstractPlayer|null = null
Return values
boolhasAnyLocationsWithAction()
public
hasAnyLocationsWithAction() : bool
Return values
boolhasCachedPort()
public
hasCachedPort([AbstractPlayer|null $player = null ]) : bool
Parameters
- $player : AbstractPlayer|null = null
Tags
Return values
boolhasEnemyForces()
public
hasEnemyForces([AbstractPlayer|null $player = null ]) : bool
Parameters
- $player : AbstractPlayer|null = null
Return values
boolhasEnemyTraders()
public
hasEnemyTraders([AbstractPlayer|null $player = null ]) : bool
Parameters
- $player : AbstractPlayer|null = null
Return values
boolhasForces()
public
hasForces() : bool
Return values
boolhasFriendlyForces()
public
hasFriendlyForces([AbstractPlayer|null $player = null ]) : bool
Parameters
- $player : AbstractPlayer|null = null
Tags
Return values
boolhasFriendlyTraders()
public
hasFriendlyTraders([AbstractPlayer|null $player = null ]) : bool
Parameters
- $player : AbstractPlayer|null = null
Return values
boolhasLink()
public
hasLink(string $name) : bool
Parameters
- $name : string
Return values
boolhasLinkDown()
public
hasLinkDown() : bool
Return values
boolhasLinkLeft()
public
hasLinkLeft() : bool
Return values
boolhasLinkRight()
public
hasLinkRight() : bool
Return values
boolhasLinkUp()
public
hasLinkUp() : bool
Return values
boolhasLocation()
public
hasLocation([int|null $locationTypeID = null ]) : bool
Parameters
- $locationTypeID : int|null = null
Return values
boolhasOtherTraders()
public
hasOtherTraders(AbstractPlayer $player) : bool
Parameters
- $player : AbstractPlayer
Return values
boolhasPlanet()
public
hasPlanet() : bool
Return values
boolhasPlayerForces()
Returns true if any forces in this sector belong to $player.
public
hasPlayerForces(AbstractPlayer $player) : bool
Parameters
- $player : AbstractPlayer
Return values
boolhasPlayers()
public
hasPlayers() : bool
Return values
boolhasPort()
public
hasPort() : bool
Return values
boolhasProtectedTraders()
public
hasProtectedTraders([AbstractPlayer|null $player = null ]) : bool
Parameters
- $player : AbstractPlayer|null = null
Return values
boolhasWarp()
public
hasWarp() : bool
Return values
boolhasX()
public
hasX(mixed $x[, AbstractPlayer|null $player = null ]) : bool
Parameters
- $x : mixed
- $player : AbstractPlayer|null = null
Return values
boolincreaseBattles()
public
increaseBattles(int $amount) : void
Parameters
- $amount : int
isLinked()
public
isLinked(int $sectorID) : bool
Parameters
- $sectorID : int
Return values
boolisLinkedSector()
public
isLinkedSector(Sector $otherSector) : bool
Parameters
- $otherSector : Sector
Return values
boolisVisited()
public
isVisited([AbstractPlayer|null $player = null ]) : bool
Parameters
- $player : AbstractPlayer|null = null
Return values
boolleavingSector()
public
leavingSector(AbstractPlayer $player, MovementType $movementType) : void
Parameters
- $player : AbstractPlayer
- $movementType : MovementType
limitFightingTraders()
public
static limitFightingTraders(array<int, AbstractPlayer> $fightingPlayers, AbstractPlayer $keepPlayer, int $maximumFleetSize) : array<int, AbstractPlayer>
Parameters
- $fightingPlayers : array<int, AbstractPlayer>
- $keepPlayer : AbstractPlayer
- $maximumFleetSize : int
Return values
array<int, AbstractPlayer>markVisited()
public
markVisited(AbstractPlayer $player) : void
Parameters
- $player : AbstractPlayer
offersFederalProtection()
public
offersFederalProtection() : bool
Return values
booloppositeDir()
public
static oppositeDir(string $dir) : string
Parameters
- $dir : string
Return values
stringremoveAllFixtures()
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
boolsetBattles()
public
setBattles(int $amount) : void
Parameters
- $amount : int
setGalaxyID()
public
setGalaxyID(int $galaxyID) : void
Parameters
- $galaxyID : int
setLink()
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
toggleLink()
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|null $dbRecord = null ]) : mixed
Parameters
- $gameID : int
- $sectorID : int
- $create : bool = false
- $dbRecord : DatabaseRecord|null = null