Documentation

Galaxy
in package

Table of Contents

Constants

SQL  = 'game_id = :game_id AND galaxy_id = :galaxy_id'
TYPE_NEUTRAL  = 'Neutral'
TYPE_PLANET  = 'Planet'
TYPE_RACIAL  = 'Racial'
TYPES  = [self::TYPE_RACIAL, self::TYPE_NEUTRAL, self::TYPE_PLANET]

Properties

$SQLID  : array{game_id: int, galaxy_id: int}
$CACHE_GALAXIES  : array<int, array<int, self>>
$CACHE_GAME_GALAXIES  : array<int, array<int, self>>
$galaxyID  : int
$galaxyType  : string
$gameID  : int
$hasChanged  : bool
$height  : int
$isNew  : bool
$maxForceTime  : int
$name  : string
$startSector  : int
$width  : int

Methods

clearCache()  : void
contains()  : bool
Check if the galaxy contains a specific sector.
createGalaxy()  : self
equals()  : bool
generateSectors()  : void
getConnectivity()  : float
Returns the sector connectivity of the galaxy as a percent.
getDisplayName()  : string
Returns the galaxy name, suitable for HTML display.
getEndSector()  : int
getForces()  : array<int, array<int, Force>>
getGalaxy()  : self
getGalaxyContaining()  : self
getGalaxyID()  : int
getGalaxyMapHREF()  : string
getGalaxyType()  : string
getGameGalaxies()  : array<int, self>
getGameID()  : int
getHeight()  : int
getLocations()  : array<int, array<int, Location>>
getMapSectors()  : array<int, array<int, Sector>>
Returns a 2D array of sectors in the galaxy.
getMaxForceTime()  : int
getName()  : string
Returns the galaxy name.
getPlanets()  : array<int, Planet>
getPlayers()  : array<int, array<int, Player>>
getPorts()  : array<int, Port>
getSectors()  : array<int, Sector>
getSize()  : int
getStartSector()  : int
getWidth()  : int
save()  : void
saveGalaxies()  : void
setConnectivity()  : bool
Randomly set the connections between all galaxy sectors.
setGalaxyType()  : void
setHeight()  : void
setMaxForceTime()  : void
setName()  : void
setWidth()  : void
__construct()  : mixed

Constants

SQL

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

TYPE_NEUTRAL

public mixed TYPE_NEUTRAL = 'Neutral'

TYPE_PLANET

public mixed TYPE_PLANET = 'Planet'

TYPE_RACIAL

public mixed TYPE_RACIAL = 'Racial'

TYPES

public mixed TYPES = [self::TYPE_RACIAL, self::TYPE_NEUTRAL, self::TYPE_PLANET]

Properties

$SQLID read-only

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

$CACHE_GALAXIES

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

$CACHE_GAME_GALAXIES

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

$galaxyID read-only

protected int $galaxyID

$galaxyType

protected string $galaxyType

$gameID read-only

protected int $gameID

$hasChanged

protected bool $hasChanged = false

$isNew

protected bool $isNew = true

$maxForceTime

protected int $maxForceTime

$startSector

protected int $startSector

Methods

clearCache()

public static clearCache() : void

contains()

Check if the galaxy contains a specific sector.

public contains(int|Sector $sectorID) : bool
Parameters
$sectorID : int|Sector
Return values
bool

createGalaxy()

public static createGalaxy(int $gameID, int $galaxyID) : self
Parameters
$gameID : int
$galaxyID : int
Return values
self

equals()

public equals(Galaxy $otherGalaxy) : bool
Parameters
$otherGalaxy : Galaxy
Return values
bool

generateSectors()

public generateSectors() : void

getConnectivity()

Returns the sector connectivity of the galaxy as a percent.

public getConnectivity() : float
Return values
float

getDisplayName()

Returns the galaxy name, suitable for HTML display.

public getDisplayName() : string
Return values
string

getEndSector()

public getEndSector() : int
Return values
int

getForces()

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

getGalaxy()

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

getGalaxyContaining()

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

getGalaxyID()

public getGalaxyID() : int
Return values
int

getGalaxyMapHREF()

public getGalaxyMapHREF() : string
Return values
string

getGalaxyType()

public getGalaxyType() : string
Return values
string

getGameGalaxies()

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

getGameID()

public getGameID() : int
Return values
int

getHeight()

public getHeight() : int
Return values
int

getLocations()

public getLocations() : array<int, array<int, Location>>
Return values
array<int, array<int, Location>>

getMapSectors()

Returns a 2D array of sectors in the galaxy.

public getMapSectors([int $centerSectorID = null ][, int $dist = null ]) : array<int, array<int, Sector>>

If $centerSectorID is specified, it will be in the center of the array. If $dist is also specified, only include sectors $dist away from center.

NOTE: This routine queries sectors inefficiently. You may want to construct the cache efficiently before calling this.

Parameters
$centerSectorID : int = null
$dist : int = null
Return values
array<int, array<int, Sector>>

getMaxForceTime()

public getMaxForceTime() : int
Return values
int

getName()

Returns the galaxy name.

public getName() : string

Use getDisplayName for an HTML-safe version.

Return values
string

getPlayers()

public getPlayers() : array<int, array<int, Player>>
Return values
array<int, array<int, Player>>

getPorts()

public getPorts() : array<int, Port>
Return values
array<int, Port>

getSize()

public getSize() : int
Return values
int

getStartSector()

public getStartSector() : int
Return values
int

getWidth()

public getWidth() : int
Return values
int

saveGalaxies()

public static saveGalaxies() : void

setConnectivity()

Randomly set the connections between all galaxy sectors.

public setConnectivity(float $connectivity) : bool

$connectivity = (average) percent of connections to enable.

Parameters
$connectivity : float
Return values
bool

setGalaxyType()

public setGalaxyType(string $galaxyType) : void
Parameters
$galaxyType : string

setHeight()

public setHeight(int $height) : void
Parameters
$height : int

setMaxForceTime()

public setMaxForceTime(int $maxForceTime) : void
Parameters
$maxForceTime : int

setName()

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

setWidth()

public setWidth(int $width) : void
Parameters
$width : int

__construct()

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

        
On this page

Search results