Account
in package
Table of Contents
Constants
- SQL = 'account_id = :account_id'
- DEFAULT_HOTKEYS = ['MoveUp' => ['w', 'up'], 'ScanUp' => ['shift+w', 'shift+up'], 'MoveLeft' => ['a', 'left'], 'ScanLeft' => ['shift+a', 'shift+left'], 'MoveRight' => ['d', 'right'], 'ScanRight' => ['shift+d', 'shift+right'], 'MoveDown' => ['s', 'down'], 'ScanDown' => ['shift+s', 'shift+down'], 'MoveWarp' => ['e', '0'], 'ScanWarp' => ['shift+e', 'shift+0'], 'ScanCurrent' => ['shift+1'], 'CurrentSector' => ['1'], 'LocalMap' => ['2'], 'PlotCourse' => ['3'], 'CurrentPlayers' => ['4'], 'EnterPort' => ['q'], 'AttackTrader' => ['f']]
- USER_RANKINGS_EACH_STAT_POW = 0.9
- USER_RANKINGS_SCORE = [ // [Stat, a, b] // Used as: pow(Stat * a, USER_RANKINGS_EACH_STAT_POW) * b [['Trade', 'Experience', 'Total'], 0.1, 0.5], [['Trade', 'Money', 'Profit'], 5.0E-5, 0.5], [['Killing', 'Kills'], 1000, 1], ]
Properties
- $accountID : int
- $CACHE_ACCOUNTS : array<int, self>
- $centerGalaxyMapOnPlayer : bool
- $colourScheme : string
- $credits : int
- $cssLink : string|null
- $dateFormat : string
- $defaultCSSEnabled : bool
- $discordId : string|null
- $email : string
- $enemyColour : string
- $fontSize : int
- $friendlyColour : string
- $hasChanged : bool
- $HOF : array<string, float>
- $hofName : string
- $hotkeys : array<string, array<string|int, string>>
- $images : bool
- $individualScores : array<int, array<string|int, array{Stat: string[], Score: float}>>
- $ircNick : string|null
- $last_login : int
- $logging : bool
- $login : string
- $mailBanned : int
- $maxRankAchieved : int
- $messageNotifications : array<int, int>|null
- $neutralColour : string
- $npc : bool
- $offset : int
- $oldAccountIDs : array<string, int|null>
- $passwordHash : string
- $passwordReset : string|null
- $permissions : array<int, bool>
- $points : int
- $referrerID : int
- $rewardCredits : int
- $score : int
- $SQLID : array{account_id: int}
- $template : string
- $timeFormat : string
- $useAJAX : bool
- $validated : bool
- $validation_code : string
- $veteranForced : bool
Methods
- addAuthMethod() : void
- addPoints() : int|false
- banAccount() : void
- changeEmail() : void
- Change e-mail address, unvalidate the account, and resend validation code
- checkEmail() : void
- Perform basic sanity checks on the usability of an email address.
- checkPassword() : bool
- Check if the given (plain-text) password is correct.
- clearCache() : void
- createAccount() : self
- decreaseMessageNotifications() : void
- decreaseSmrCredits() : void
- decreaseTotalSmrCredits() : void
- doMessageSendingToBox() : void
- equals() : bool
- generatePasswordReset() : void
- getAccount() : self
- getAccountByDiscordId() : self
- getAccountByEmail() : self
- getAccountByHofName() : self
- getAccountByIrcNick() : self
- getAccountByLogin() : self
- getAccountBySocialId() : self
- getAccountID() : int
- getColourScheme() : string
- getCssColourUrl() : string
- getCssLink() : string|null
- getCssUrl() : string
- getDateFormat() : string
- getDateTimeFormat() : string
- Get the epoch format string including both date and time.
- getDateTimeFormatSplit() : string
- Get the (HTML-only) epoch format string including both date and time, split across two lines.
- getDefaultHotkeys() : array<string, array<string|int, string>>
- getDiscordId() : string|null
- getEmail() : string
- getEnemyColour() : string
- getFontSize() : int
- getFriendlyColour() : string
- getHOF() : float
- getHofDisplayName() : string
- The Hall Of Fame name is not html-escaped in the database, so to display it correctly we must escape html entities.
- getHofName() : string
- getHotkeys() : mixed
- getIndividualScores() : array<string|int, array{Stat: string[], Score: float}>
- getIrcNick() : string|null
- getLastLogin() : int
- getLogin() : string
- getMailBanned() : int
- getMessageNotifications() : int
- getNeutralColour() : string
- getOffset() : int
- getOldAccountID() : int
- Return the ID associated with this account in the given history database.
- getPasswordReset() : string
- getPermissions() : array<int, bool>
- getPersonalHofHREF() : string
- getPoints() : int
- getRank() : UserRanking
- getReferralLink() : string
- getReferrer() : self
- getReferrerID() : int
- getScore() : int
- getSmrCredits() : int
- getSmrRewardCredits() : int
- getTemplate() : string
- getTimeFormat() : string
- getTotalSmrCredits() : int
- getUserScoreCaseStatement() : array{CASE: string, IN: string[]}
- getValidationCode() : string
- hasPermission() : bool
- hasReferrer() : bool
- increaseMailBanned() : void
- increaseMessageNotifications() : void
- increaseSmrCredits() : void
- increaseSmrRewardCredits() : void
- isActive() : bool
- isCenterGalaxyMapOnPlayer() : bool
- isDefaultCSSEnabled() : bool
- isDisabled() : array{Time: int, Reason: string, ReasonID: int}|false
- Check if the account is disabled.
- isDisplayShipImages() : bool
- isLoggingEnabled() : bool
- isMailBanned() : bool
- isNPC() : bool
- isReceivingMessageNotifications() : bool
- isUseAJAX() : bool
- isValidated() : bool
- isVeteran() : bool
- isVeteranForced() : bool
- log() : void
- removePoints() : void
- sendMessageToBox() : void
- sendValidationEmail() : void
- setCenterGalaxyMapOnPlayer() : void
- setColourScheme() : void
- setCssLink() : void
- setDateFormat() : void
- setDefaultCSSEnabled() : void
- setDiscordId() : void
- setDisplayShipImages() : void
- setEnemyColour() : void
- setFontSize() : void
- setFriendlyColour() : void
- setHofName() : void
- setHotkey() : void
- setIrcNick() : void
- setLoggingEnabled() : void
- setMailBanned() : void
- setMessageNotifications() : void
- setNeutralColour() : void
- setPassword() : void
- Set the (plain-text) password for this account.
- setPoints() : void
- setSmrCredits() : void
- setSmrRewardCredits() : void
- setTemplate() : void
- setTimeFormat() : void
- setUseAJAX() : void
- setValidated() : void
- unbanAccount() : void
- update() : void
- updateIP() : void
- updateLastLogin() : void
- __construct() : mixed
- getHOFData() : void
- getSmrCreditsData() : void
- setEmail() : void
- setPasswordReset() : void
- setValidationCode() : void
- updateMaxRankAchieved() : void
Constants
SQL
public
mixed
SQL
= 'account_id = :account_id'
DEFAULT_HOTKEYS
protected
mixed
DEFAULT_HOTKEYS
= ['MoveUp' => ['w', 'up'], 'ScanUp' => ['shift+w', 'shift+up'], 'MoveLeft' => ['a', 'left'], 'ScanLeft' => ['shift+a', 'shift+left'], 'MoveRight' => ['d', 'right'], 'ScanRight' => ['shift+d', 'shift+right'], 'MoveDown' => ['s', 'down'], 'ScanDown' => ['shift+s', 'shift+down'], 'MoveWarp' => ['e', '0'], 'ScanWarp' => ['shift+e', 'shift+0'], 'ScanCurrent' => ['shift+1'], 'CurrentSector' => ['1'], 'LocalMap' => ['2'], 'PlotCourse' => ['3'], 'CurrentPlayers' => ['4'], 'EnterPort' => ['q'], 'AttackTrader' => ['f']]
USER_RANKINGS_EACH_STAT_POW
protected
mixed
USER_RANKINGS_EACH_STAT_POW
= 0.9
USER_RANKINGS_SCORE
protected
mixed
USER_RANKINGS_SCORE
= [
// [Stat, a, b]
// Used as: pow(Stat * a, USER_RANKINGS_EACH_STAT_POW) * b
[['Trade', 'Experience', 'Total'], 0.1, 0.5],
[['Trade', 'Money', 'Profit'], 5.0E-5, 0.5],
[['Killing', 'Kills'], 1000, 1],
]
Properties
$accountID read-only
protected
int
$accountID
$CACHE_ACCOUNTS
protected
static array<int, self>
$CACHE_ACCOUNTS
= []
$centerGalaxyMapOnPlayer
protected
bool
$centerGalaxyMapOnPlayer
$colourScheme
protected
string
$colourScheme
$credits
protected
int
$credits
$cssLink
protected
string|null
$cssLink
$dateFormat
protected
string
$dateFormat
$defaultCSSEnabled
protected
bool
$defaultCSSEnabled
$discordId
protected
string|null
$discordId
protected
string
$email
$enemyColour
protected
string
$enemyColour
$fontSize
protected
int
$fontSize
$friendlyColour
protected
string
$friendlyColour
$hasChanged
protected
bool
$hasChanged
$HOF
protected
array<string, float>
$HOF
$hofName
protected
string
$hofName
$hotkeys
protected
array<string, array<string|int, string>>
$hotkeys
$images
protected
bool
$images
$individualScores
protected
array<int, array<string|int, array{Stat: string[], Score: float}>>
$individualScores
$ircNick
protected
string|null
$ircNick
$last_login
protected
int
$last_login
$logging
protected
bool
$logging
$login
protected
string
$login
$mailBanned
protected
int
$mailBanned
$maxRankAchieved
protected
int
$maxRankAchieved
$messageNotifications
protected
array<int, int>|null
$messageNotifications
$neutralColour
protected
string
$neutralColour
$npc
protected
bool
$npc
$offset
protected
int
$offset
$oldAccountIDs
protected
array<string, int|null>
$oldAccountIDs
= []
$passwordHash
protected
string
$passwordHash
$passwordReset
protected
string|null
$passwordReset
$permissions
protected
array<int, bool>
$permissions
$points
protected
int
$points
$referrerID
protected
int
$referrerID
$rewardCredits
protected
int
$rewardCredits
$score
protected
int
$score
$SQLID read-only
protected
array{account_id: int}
$SQLID
$template
protected
string
$template
$timeFormat
protected
string
$timeFormat
$useAJAX
protected
bool
$useAJAX
$validated
protected
bool
$validated
$validation_code
protected
string
$validation_code
$veteranForced
protected
bool
$veteranForced
Methods
addAuthMethod()
public
addAuthMethod(SocialIdentity $socialId) : void
Parameters
- $socialId : SocialIdentity
addPoints()
public
addPoints(int $numPoints, self $admin, int $reasonID, string $suspicion) : int|false
Parameters
- $numPoints : int
- $admin : self
- $reasonID : int
- $suspicion : string
Return values
int|falsebanAccount()
public
banAccount(int $expireTime, self $admin, int $reasonID, string $suspicion[, bool $removeExceptions = false ]) : void
Parameters
- $expireTime : int
- $admin : self
- $reasonID : int
- $suspicion : string
- $removeExceptions : bool = false
changeEmail()
Change e-mail address, unvalidate the account, and resend validation code
public
changeEmail(string $email) : void
Parameters
- $email : string
checkEmail()
Perform basic sanity checks on the usability of an email address.
public
static checkEmail(string $email[, self|null $owner = null ]) : void
Parameters
- $email : string
- $owner : self|null = null
checkPassword()
Check if the given (plain-text) password is correct.
public
checkPassword(string $password) : bool
Updates the password hash if necessary.
Parameters
- $password : string
Return values
boolclearCache()
public
static clearCache() : void
createAccount()
public
static createAccount(string $login, string $password, string $email, int $timez, int $referral) : self
Parameters
- $login : string
- $password : string
- $email : string
- $timez : int
- $referral : int
Return values
selfdecreaseMessageNotifications()
public
decreaseMessageNotifications(int $messageTypeID, int $num) : void
Parameters
- $messageTypeID : int
- $num : int
decreaseSmrCredits()
public
decreaseSmrCredits(int $credits) : void
Parameters
- $credits : int
decreaseTotalSmrCredits()
public
decreaseTotalSmrCredits(int $totalCredits) : void
Parameters
- $totalCredits : int
doMessageSendingToBox()
public
static doMessageSendingToBox(int $senderID, int $boxTypeID, string $message[, int $gameID = 0 ]) : void
Parameters
- $senderID : int
- $boxTypeID : int
- $message : string
- $gameID : int = 0
equals()
public
equals(self $other) : bool
Parameters
- $other : self
Return values
boolgeneratePasswordReset()
public
generatePasswordReset() : void
getAccount()
public
static getAccount(int $accountID[, bool $forceUpdate = false ]) : self
Parameters
- $accountID : int
- $forceUpdate : bool = false
Return values
selfgetAccountByDiscordId()
public
static getAccountByDiscordId(string|null $id[, bool $forceUpdate = false ]) : self
Parameters
- $id : string|null
- $forceUpdate : bool = false
Return values
selfgetAccountByEmail()
public
static getAccountByEmail(string|null $email[, bool $forceUpdate = false ]) : self
Parameters
- $email : string|null
- $forceUpdate : bool = false
Return values
selfgetAccountByHofName()
public
static getAccountByHofName(string $hofName[, bool $forceUpdate = false ]) : self
Parameters
- $hofName : string
- $forceUpdate : bool = false
Return values
selfgetAccountByIrcNick()
public
static getAccountByIrcNick(string|null $nick[, bool $forceUpdate = false ]) : self
Parameters
- $nick : string|null
- $forceUpdate : bool = false
Return values
selfgetAccountByLogin()
public
static getAccountByLogin(string $login[, bool $forceUpdate = false ]) : self
Parameters
- $login : string
- $forceUpdate : bool = false
Return values
selfgetAccountBySocialId()
public
static getAccountBySocialId(SocialIdentity $social[, bool $forceUpdate = false ]) : self
Parameters
- $social : SocialIdentity
- $forceUpdate : bool = false
Return values
selfgetAccountID()
public
getAccountID() : int
Return values
intgetColourScheme()
public
getColourScheme() : string
Return values
stringgetCssColourUrl()
public
getCssColourUrl() : string
Return values
stringgetCssLink()
public
getCssLink() : string|null
Return values
string|nullgetCssUrl()
public
getCssUrl() : string
Return values
stringgetDateFormat()
public
getDateFormat() : string
Return values
stringgetDateTimeFormat()
Get the epoch format string including both date and time.
public
getDateTimeFormat() : string
Return values
stringgetDateTimeFormatSplit()
Get the (HTML-only) epoch format string including both date and time, split across two lines.
public
getDateTimeFormatSplit() : string
Return values
stringgetDefaultHotkeys()
public
static getDefaultHotkeys() : array<string, array<string|int, string>>
Return values
array<string, array<string|int, string>>getDiscordId()
public
getDiscordId() : string|null
Return values
string|nullgetEmail()
public
getEmail() : string
Return values
stringgetEnemyColour()
public
getEnemyColour() : string
Return values
stringgetFontSize()
public
getFontSize() : int
Return values
intgetFriendlyColour()
public
getFriendlyColour() : string
Return values
stringgetHOF()
public
getHOF(array<string|int, string> $typeList) : float
Parameters
- $typeList : array<string|int, string>
Return values
floatgetHofDisplayName()
The Hall Of Fame name is not html-escaped in the database, so to display it correctly we must escape html entities.
public
getHofDisplayName([bool $linked = false ]) : string
Parameters
- $linked : bool = false
Return values
stringgetHofName()
public
getHofName() : string
Return values
stringgetHotkeys()
public
getHotkeys([string|null $hotkeyType = null ]) : mixed
Parameters
- $hotkeyType : string|null = null
getIndividualScores()
public
getIndividualScores([Player|null $player = null ]) : array<string|int, array{Stat: string[], Score: float}>
Parameters
- $player : Player|null = null
Return values
array<string|int, array{Stat: string[], Score: float}>getIrcNick()
public
getIrcNick() : string|null
Return values
string|nullgetLastLogin()
public
getLastLogin() : int
Return values
intgetLogin()
public
getLogin() : string
Return values
stringgetMailBanned()
public
getMailBanned() : int
Return values
intgetMessageNotifications()
public
getMessageNotifications(int $messageTypeID) : int
Parameters
- $messageTypeID : int
Return values
intgetNeutralColour()
public
getNeutralColour() : string
Return values
stringgetOffset()
public
getOffset() : int
Return values
intgetOldAccountID()
Return the ID associated with this account in the given history database.
public
getOldAccountID(string $dbName) : int
Parameters
- $dbName : string
Return values
intgetPasswordReset()
public
getPasswordReset() : string
Return values
stringgetPermissions()
public
getPermissions() : array<int, bool>
Return values
array<int, bool>getPersonalHofHREF()
public
getPersonalHofHREF() : string
Return values
stringgetPoints()
public
getPoints() : int
Return values
intgetRank()
public
getRank() : UserRanking
Return values
UserRankinggetReferralLink()
public
getReferralLink() : string
Return values
stringgetReferrer()
public
getReferrer() : self
Return values
selfgetReferrerID()
public
getReferrerID() : int
Return values
intgetScore()
public
getScore() : int
Return values
intgetSmrCredits()
public
getSmrCredits() : int
Return values
intgetSmrRewardCredits()
public
getSmrRewardCredits() : int
Return values
intgetTemplate()
public
getTemplate() : string
Return values
stringgetTimeFormat()
public
getTimeFormat() : string
Return values
stringgetTotalSmrCredits()
public
getTotalSmrCredits() : int
Return values
intgetUserScoreCaseStatement()
public
static getUserScoreCaseStatement() : array{CASE: string, IN: string[]}
Return values
array{CASE: string, IN: string[]}getValidationCode()
public
getValidationCode() : string
Return values
stringhasPermission()
public
hasPermission([int|null $permissionID = null ]) : bool
Parameters
- $permissionID : int|null = null
Return values
boolhasReferrer()
public
hasReferrer() : bool
Return values
boolincreaseMailBanned()
public
increaseMailBanned(int $increaseTime) : void
Parameters
- $increaseTime : int
increaseMessageNotifications()
public
increaseMessageNotifications(int $messageTypeID, int $num) : void
Parameters
- $messageTypeID : int
- $num : int
increaseSmrCredits()
public
increaseSmrCredits(int $credits) : void
Parameters
- $credits : int
increaseSmrRewardCredits()
public
increaseSmrRewardCredits(int $credits) : void
Parameters
- $credits : int
isActive()
public
isActive() : bool
Return values
boolisCenterGalaxyMapOnPlayer()
public
isCenterGalaxyMapOnPlayer() : bool
Return values
boolisDefaultCSSEnabled()
public
isDefaultCSSEnabled() : bool
Return values
boolisDisabled()
Check if the account is disabled.
public
isDisabled() : array{Time: int, Reason: string, ReasonID: int}|false
Return values
array{Time: int, Reason: string, ReasonID: int}|falseisDisplayShipImages()
public
isDisplayShipImages() : bool
Return values
boolisLoggingEnabled()
public
isLoggingEnabled() : bool
Return values
boolisMailBanned()
public
isMailBanned() : bool
Return values
boolisNPC()
public
isNPC() : bool
Return values
boolisReceivingMessageNotifications()
public
isReceivingMessageNotifications(int $messageTypeID) : bool
Parameters
- $messageTypeID : int
Return values
boolisUseAJAX()
public
isUseAJAX() : bool
Return values
boolisValidated()
public
isValidated() : bool
Return values
boolisVeteran()
public
isVeteran() : bool
Return values
boolisVeteranForced()
public
isVeteranForced() : bool
Return values
boollog()
public
log(int $log_type_id, string $msg[, int $sector_id = 0 ]) : void
Parameters
- $log_type_id : int
- $msg : string
- $sector_id : int = 0
removePoints()
public
removePoints(int $numPoints[, int|null $lastUpdate = null ]) : void
Parameters
- $numPoints : int
- $lastUpdate : int|null = null
sendMessageToBox()
public
sendMessageToBox(int $boxTypeID, string $message) : void
Parameters
- $boxTypeID : int
- $message : string
sendValidationEmail()
public
sendValidationEmail() : void
setCenterGalaxyMapOnPlayer()
public
setCenterGalaxyMapOnPlayer(bool $bool) : void
Parameters
- $bool : bool
setColourScheme()
public
setColourScheme(string $colourScheme) : void
Parameters
- $colourScheme : string
setCssLink()
public
setCssLink(string $link) : void
Parameters
- $link : string
setDateFormat()
public
setDateFormat(string $format) : void
Parameters
- $format : string
setDefaultCSSEnabled()
public
setDefaultCSSEnabled(bool $bool) : void
Parameters
- $bool : bool
setDiscordId()
public
setDiscordId(string|null $id) : void
Parameters
- $id : string|null
setDisplayShipImages()
public
setDisplayShipImages(bool $bool) : void
Parameters
- $bool : bool
setEnemyColour()
public
setEnemyColour(string $colour) : void
Parameters
- $colour : string
setFontSize()
public
setFontSize(int $size) : void
Parameters
- $size : int
setFriendlyColour()
public
setFriendlyColour(string $colour) : void
Parameters
- $colour : string
setHofName()
public
setHofName(string $name) : void
Parameters
- $name : string
setHotkey()
public
setHotkey(string $hotkeyType, array<string|int, string> $bindings) : void
Parameters
- $hotkeyType : string
- $bindings : array<string|int, string>
setIrcNick()
public
setIrcNick(string|null $nick) : void
Parameters
- $nick : string|null
setLoggingEnabled()
public
setLoggingEnabled(bool $bool) : void
Parameters
- $bool : bool
setMailBanned()
public
setMailBanned(int $time) : void
Parameters
- $time : int
setMessageNotifications()
public
setMessageNotifications(int $messageTypeID, int $num) : void
Parameters
- $messageTypeID : int
- $num : int
setNeutralColour()
public
setNeutralColour(string $colour) : void
Parameters
- $colour : string
setPassword()
Set the (plain-text) password for this account.
public
setPassword(string $password) : void
Parameters
- $password : string
setPoints()
public
setPoints(int $numPoints[, int|null $lastUpdate = null ]) : void
Parameters
- $numPoints : int
- $lastUpdate : int|null = null
setSmrCredits()
public
setSmrCredits(int $credits) : void
Parameters
- $credits : int
setSmrRewardCredits()
public
setSmrRewardCredits(int $credits) : void
Parameters
- $credits : int
setTemplate()
public
setTemplate(string $template) : void
Parameters
- $template : string
setTimeFormat()
public
setTimeFormat(string $format) : void
Parameters
- $format : string
setUseAJAX()
public
setUseAJAX(bool $bool) : void
Parameters
- $bool : bool
setValidated()
public
setValidated(bool $bool) : void
Parameters
- $bool : bool
unbanAccount()
public
unbanAccount([self|null $admin = null ][, string|null $currException = null ]) : void
Parameters
- $admin : self|null = null
- $currException : string|null = null
update()
public
update() : void
updateIP()
public
updateIP() : void
updateLastLogin()
public
updateLastLogin() : void
__construct()
protected
__construct(int $accountID) : mixed
Parameters
- $accountID : int
getHOFData()
protected
getHOFData() : void
getSmrCreditsData()
protected
getSmrCreditsData() : void
setEmail()
protected
setEmail(string $email) : void
Parameters
- $email : string
setPasswordReset()
protected
setPasswordReset(string $passwordReset) : void
Parameters
- $passwordReset : string
setValidationCode()
protected
setValidationCode(string $code) : void
Parameters
- $code : string
updateMaxRankAchieved()
protected
updateMaxRankAchieved(int $rank) : void
Parameters
- $rank : int