Alliance
in package
Table of Contents
Constants
- MAXLENGTH_DESCRIPTION = 255
- MAXLENGTH_NAME = 36
- RECRUIT_CLOSED = 'closed'
- RECRUIT_OPEN = 'open'
- RECRUIT_PASSWORD = 'password'
- SQL = 'alliance_id = :alliance_id AND game_id = :game_id'
Properties
- $SQLID : array{alliance_id: int, game_id: int}
- $allianceID : int
- $allianceName : string
- $bank : int
- $CACHE_ALLIANCES : array<int, array<int, self>>
- $deaths : int
- $description : string|null
- $discordChannel : string|null
- $discordServer : string|null
- $flagshipID : int
- $gameID : int
- $imgSrc : string
- $ircChannel : string
- $kills : int
- $leaderID : int
- $memberList : array<string|int, int>
- $motd : string
- $password : string
- $recruiting : bool
- $seedlist : array<string|int, int>
Methods
- allRecruitTypes() : array<string, string>
- List of all recruitment types and their descriptions.
- clearCache() : void
- createAlliance() : self
- Create an alliance and return the new object.
- createDefaultRoles() : void
- Create the default roles for this alliance.
- decreaseBank() : void
- getActiveIDs() : array<string|int, int>
- getAlliance() : self
- getAllianceBBLink() : string
- getAllianceByDiscordChannel() : self
- getAllianceByIrcChannel() : self
- getAllianceByName() : self
- getAllianceDisplayName() : string
- getAllianceID() : int
- getAllianceName() : string
- Returns the alliance name.
- getBank() : int
- Get the total credits in the alliance bank account.
- getDeaths() : int
- getDescription() : string
- Get (HTML-safe) alliance description for display.
- getDiscordChannel() : string|null
- getDiscordServer() : string|null
- getFlagshipID() : int
- Get account ID of the player designated as the alliance flagship.
- getGame() : Game
- getGameID() : int
- getImageURL() : string
- getIrcChannel() : string
- getJoinRestriction() : string|false
- getKills() : int
- getLeader() : AbstractPlayer
- getLeaderID() : int
- getMemberIDs() : array<string|int, int>
- getMembers() : array<int, Player>
- Returns the members of this alliance as an array of Player objects.
- getMotD() : string
- Get (HTML-safe) alliance Message of the Day for display.
- getNumMembers() : int
- getNumVeterans() : int
- getPassword() : string
- getPlanets() : array<string|int, Planet>
- Return all planets owned by members of this alliance.
- getRecruitType() : string
- getSeedlist() : array<string|int, int>
- Return array of sector_id for sectors in the alliance seedlist.
- hasDisbanded() : bool
- hasFlagship() : bool
- hasImageURL() : bool
- hasLeader() : bool
- hasPassword() : bool
- increaseBank() : int
- Increases alliance bank account up to the maximum allowed credits.
- isInSeedlist() : bool
- Is the given sector in the alliance seedlist?
- isNHA() : bool
- Returns true if the alliance is the Newbie Help Alliance.
- isRecruiting() : bool
- setAllianceDescription() : void
- setBank() : void
- setDiscordChannel() : void
- setDiscordServer() : void
- setFlagshipID() : void
- Designate a player as the alliance flagship by their account ID.
- setImageURL() : void
- setIrcChannel() : void
- setLeaderID() : void
- setMotD() : void
- setRecruitType() : void
- Set the password and recruiting attributes.
- update() : void
- __construct() : mixed
Constants
MAXLENGTH_DESCRIPTION
public
mixed
MAXLENGTH_DESCRIPTION
= 255
MAXLENGTH_NAME
public
mixed
MAXLENGTH_NAME
= 36
RECRUIT_CLOSED
public
mixed
RECRUIT_CLOSED
= 'closed'
RECRUIT_OPEN
public
mixed
RECRUIT_OPEN
= 'open'
RECRUIT_PASSWORD
public
mixed
RECRUIT_PASSWORD
= 'password'
SQL
public
mixed
SQL
= 'alliance_id = :alliance_id AND game_id = :game_id'
Properties
$SQLID read-only
public
array{alliance_id: int, game_id: int}
$SQLID
$allianceID read-only
protected
int
$allianceID
$allianceName
protected
string
$allianceName
$bank
protected
int
$bank
$CACHE_ALLIANCES
protected
static array<int, array<int, self>>
$CACHE_ALLIANCES
= []
$deaths
protected
int
$deaths
$description
protected
string|null
$description
$discordChannel
protected
string|null
$discordChannel
$discordServer
protected
string|null
$discordServer
$flagshipID
protected
int
$flagshipID
$gameID read-only
protected
int
$gameID
$imgSrc
protected
string
$imgSrc
$ircChannel
protected
string
$ircChannel
$kills
protected
int
$kills
$leaderID
protected
int
$leaderID
$memberList
protected
array<string|int, int>
$memberList
$motd
protected
string
$motd
$password
protected
string
$password
$recruiting
protected
bool
$recruiting
$seedlist
protected
array<string|int, int>
$seedlist
Methods
allRecruitTypes()
List of all recruitment types and their descriptions.
public
static allRecruitTypes() : array<string, string>
Do not change the order of elements in the list!
Return values
array<string, string>clearCache()
public
static clearCache() : void
createAlliance()
Create an alliance and return the new object.
public
static createAlliance(int $gameID, string $name[, bool $allowNHA = false ]) : self
Starts alliance with "closed" recruitment (for safety).
Parameters
- $gameID : int
- $name : string
- $allowNHA : bool = false
Return values
selfcreateDefaultRoles()
Create the default roles for this alliance.
public
createDefaultRoles([string $newMemberPermission = 'basic' ]) : void
This should only be called once after the alliance is created.
Parameters
- $newMemberPermission : string = 'basic'
decreaseBank()
public
decreaseBank(int $credits) : void
Parameters
- $credits : int
getActiveIDs()
public
getActiveIDs() : array<string|int, int>
Return values
array<string|int, int>getAlliance()
public
static getAlliance(int $allianceID, int $gameID[, bool $forceUpdate = false ][, DatabaseRecord|null $dbRecord = null ]) : self
Parameters
- $allianceID : int
- $gameID : int
- $forceUpdate : bool = false
- $dbRecord : DatabaseRecord|null = null
Return values
selfgetAllianceBBLink()
public
getAllianceBBLink() : string
Return values
stringgetAllianceByDiscordChannel()
public
static getAllianceByDiscordChannel(string $channel[, bool $forceUpdate = false ]) : self
Parameters
- $channel : string
- $forceUpdate : bool = false
Return values
selfgetAllianceByIrcChannel()
public
static getAllianceByIrcChannel(string $channel[, bool $forceUpdate = false ]) : self
Parameters
- $channel : string
- $forceUpdate : bool = false
Return values
selfgetAllianceByName()
public
static getAllianceByName(string $name, int $gameID[, bool $forceUpdate = false ]) : self
Parameters
- $name : string
- $gameID : int
- $forceUpdate : bool = false
Return values
selfgetAllianceDisplayName()
public
getAllianceDisplayName([bool $linked = false ][, bool $includeAllianceID = false ]) : string
Parameters
- $linked : bool = false
- $includeAllianceID : bool = false
Return values
stringgetAllianceID()
public
getAllianceID() : int
Return values
intgetAllianceName()
Returns the alliance name.
public
getAllianceName() : string
Use getAllianceDisplayName for an HTML-safe version.
Return values
stringgetBank()
Get the total credits in the alliance bank account.
public
getBank() : int
Return values
intgetDeaths()
public
getDeaths() : int
Return values
intgetDescription()
Get (HTML-safe) alliance description for display.
public
getDescription() : string
Return values
stringgetDiscordChannel()
public
getDiscordChannel() : string|null
Return values
string|nullgetDiscordServer()
public
getDiscordServer() : string|null
Return values
string|nullgetFlagshipID()
Get account ID of the player designated as the alliance flagship.
public
getFlagshipID() : int
Returns 0 if no flagship.
Return values
intgetGame()
public
getGame() : Game
Return values
GamegetGameID()
public
getGameID() : int
Return values
intgetImageURL()
public
getImageURL() : string
Return values
stringgetIrcChannel()
public
getIrcChannel() : string
Return values
stringgetJoinRestriction()
public
getJoinRestriction(AbstractPlayer $player[, bool $doAllianceCheck = true ][, bool $doRecruitingCheck = true ]) : string|false
Parameters
- $player : AbstractPlayer
- $doAllianceCheck : bool = true
- $doRecruitingCheck : bool = true
Return values
string|falsegetKills()
public
getKills() : int
Return values
intgetLeader()
public
getLeader() : AbstractPlayer
Return values
AbstractPlayergetLeaderID()
public
getLeaderID() : int
Return values
intgetMemberIDs()
public
getMemberIDs() : array<string|int, int>
Return values
array<string|int, int>getMembers()
Returns the members of this alliance as an array of Player objects.
public
getMembers() : array<int, Player>
Return values
array<int, Player>getMotD()
Get (HTML-safe) alliance Message of the Day for display.
public
getMotD() : string
Return values
stringgetNumMembers()
public
getNumMembers() : int
Return values
intgetNumVeterans()
public
getNumVeterans() : int
Return values
intgetPassword()
public
getPassword() : string
Return values
stringgetPlanets()
Return all planets owned by members of this alliance.
public
getPlanets() : array<string|int, Planet>
Return values
array<string|int, Planet>getRecruitType()
public
getRecruitType() : string
Return values
stringgetSeedlist()
Return array of sector_id for sectors in the alliance seedlist.
public
getSeedlist() : array<string|int, int>
Return values
array<string|int, int>hasDisbanded()
public
hasDisbanded() : bool
Return values
boolhasFlagship()
public
hasFlagship() : bool
Return values
boolhasImageURL()
public
hasImageURL() : bool
Return values
boolhasLeader()
public
hasLeader() : bool
Return values
boolhasPassword()
public
hasPassword() : bool
Return values
boolincreaseBank()
Increases alliance 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
intisInSeedlist()
Is the given sector in the alliance seedlist?
public
isInSeedlist(Sector $sector) : bool
Parameters
- $sector : Sector
Return values
boolisNHA()
Returns true if the alliance is the Newbie Help Alliance.
public
isNHA() : bool
Return values
boolisRecruiting()
public
isRecruiting() : bool
Return values
boolsetAllianceDescription()
public
setAllianceDescription(string $description[, AbstractPlayer|null $player = null ]) : void
Parameters
- $description : string
- $player : AbstractPlayer|null = null
setBank()
public
setBank(int $credits) : void
Parameters
- $credits : int
setDiscordChannel()
public
setDiscordChannel(string|null $channelId) : void
Parameters
- $channelId : string|null
setDiscordServer()
public
setDiscordServer(string|null $serverId) : void
Parameters
- $serverId : string|null
setFlagshipID()
Designate a player as the alliance flagship by their account ID.
public
setFlagshipID(int $accountID) : void
Parameters
- $accountID : int
setImageURL()
public
setImageURL(string $url) : void
Parameters
- $url : string
setIrcChannel()
public
setIrcChannel(string $ircChannel) : void
Parameters
- $ircChannel : string
setLeaderID()
public
setLeaderID(int $leaderID) : void
Parameters
- $leaderID : int
setMotD()
public
setMotD(string $motd) : void
Parameters
- $motd : string
setRecruitType()
Set the password and recruiting attributes.
public
setRecruitType(string $type, string $password) : void
The input $password is ignored except for the "password" $type.
Parameters
- $type : string
- $password : string
update()
public
update() : void
__construct()
protected
__construct(int $allianceID, int $gameID[, DatabaseRecord|null $dbRecord = null ]) : mixed
Parameters
- $allianceID : int
- $gameID : int
- $dbRecord : DatabaseRecord|null = null