API Documentation
Table of Contents
Namespaces
Constants
- MISSION_ACTIONS = ['LeaveSector', 'EnterSector', 'WalkSector', 'JoinAlliance', 'LeaveAlliance', 'DisbandAlliance', 'KickPlayer', 'PlayerKicked', 'BuyDrink']
- MISSIONS = [0 => ['Name' => 'Drunk Guy', 'Offerer' => 'Drunk', 'Time Limit' => 0, 'HasX' => ['Type' => \Smr\PlotGroup::Locations, 'X' => 'Bar'], 'Steps' => [['Step' => 'EnterSector', 'PickSector' => ['Type' => \Smr\PlotGroup::Locations, 'X' => \RACE_SALVENE + \LOCATION_GROUP_RACIAL_HQS], 'Detail' => ['SectorID' => '<Sector>'], 'Text' => '*Hiccup* Hey! I need you to...*Hiccup* do me a favor. All the ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ' in this bar is awful! Go to the Sal...*Hiccup*...the Salvene HQ, they\'ll know a good bar.', 'Task' => 'Go to the Salvene HQ at [sector=<Sector>]'], ['Step' => 'EnterSector', 'PickSector' => ['Type' => \Smr\PlotGroup::Locations, 'X' => 'Bar'], 'Detail' => ['SectorID' => '<Sector>'], 'Text' => 'Here we are! The Salvene HQ! You ask around a bit and find that the bar in [sector=<Sector>] does the best ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ' around!', 'Task' => 'Go to the bar at [sector=<Sector>] and buy a ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ' from the bartender. This may take many tries.'], ['Step' => 'BuyDrink', 'Detail' => ['SectorID' => '<Sector>', 'Drink' => \Smr\BarDrink::SALVENE_SWAMP_SODA], 'Text' => 'Here we are! Now let\'s get this ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . '.', 'Task' => 'Go to the bar at [sector=<Sector>] and buy a ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ' from the bartender. This may take many tries.'], ['Step' => 'EnterSector', 'Detail' => ['SectorID' => '<Starting Sector>'], 'Text' => 'Finally! A true ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ', let\'s return to that drunk!', 'Task' => 'Return to [sector=<Starting Sector>] to claim your reward.'], ['Step' => 'Claim', 'Rewards' => ['Credits' => 500000, 'Experience' => 1000, 'Text' => '*Hiccup* For your...service *Hiccup* to me, take these *Hiccup* 500,000 credits and 1,000 experience *Hiccup*!'], 'Detail' => ['SectorID' => '<Starting Sector>'], 'Text' => 'You hand the ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ' to the drunk!']]]]
Functions
- get_draft_teams() : array<int, array<string, mixed>>
- Returns an array with all relevant information about draft teams, including their current size and if the leader can pick teammates.
- course_plot_forward() : never
- This function is called by "Conventional" and "Plot To Nearest" pages.
- echo_nav() : void
- echo_content() : void
- echo_subsection() : void
- echo_menu() : void
- get_numbering() : string
- replaceMissionTemplate() : void
- Callback for array_walk_recursive in Player::rebuildMission.
- checkMissionRequirements() : bool
- createNHA() : void
- Create the Newbie Help Alliance and populate its Message Board
- hit_sector_mines() : void
- parseBoolean() : bool
- linkCombatLog() : string
- smrBBCode() : bool|string
- Converts a BBCode tag into some other text depending on the tag and value.
- inify() : string
- bbify() : string
- create_error() : never
- handleUserError() : never
- create_link() : string
- create_submit_link() : string
- get_colored_text_range() : string
- get_colored_text() : string
- word_filter() : string
- pluralise() : string
- do_voodoo() : never
- This function is a hack around the old style http forward mechanism.
- saveAllAndReleaseLock() : void
- doTickerAssigns() : void
- doSkeletonAssigns() : void
- format_list() : string
- Join a list of items into a grammatically-correct sentence fragment.
- in_time_or_now() : string
- Convert an integer number of seconds into a human-readable time for grammatically-correct use in a sentence, i.e. prefixed with "in" when the amount is positive.
- format_time() : string
- Convert an integer number of seconds into a human-readable time.
- number_colour_format() : string
- getWeightedRandom() : T
- Randomly choose an array key weighted by the array values.
Constants
MISSION_ACTIONS
public
mixed
MISSION_ACTIONS
= ['LeaveSector', 'EnterSector', 'WalkSector', 'JoinAlliance', 'LeaveAlliance', 'DisbandAlliance', 'KickPlayer', 'PlayerKicked', 'BuyDrink']
MISSIONS
public
mixed
MISSIONS
= [0 => ['Name' => 'Drunk Guy', 'Offerer' => 'Drunk', 'Time Limit' => 0, 'HasX' => ['Type' => \Smr\PlotGroup::Locations, 'X' => 'Bar'], 'Steps' => [['Step' => 'EnterSector', 'PickSector' => ['Type' => \Smr\PlotGroup::Locations, 'X' => \RACE_SALVENE + \LOCATION_GROUP_RACIAL_HQS], 'Detail' => ['SectorID' => '<Sector>'], 'Text' => '*Hiccup* Hey! I need you to...*Hiccup* do me a favor. All the ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ' in this bar is awful! Go to the Sal...*Hiccup*...the Salvene HQ, they\'ll know a good bar.', 'Task' => 'Go to the Salvene HQ at [sector=<Sector>]'], ['Step' => 'EnterSector', 'PickSector' => ['Type' => \Smr\PlotGroup::Locations, 'X' => 'Bar'], 'Detail' => ['SectorID' => '<Sector>'], 'Text' => 'Here we are! The Salvene HQ! You ask around a bit and find that the bar in [sector=<Sector>] does the best ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ' around!', 'Task' => 'Go to the bar at [sector=<Sector>] and buy a ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ' from the bartender. This may take many tries.'], ['Step' => 'BuyDrink', 'Detail' => ['SectorID' => '<Sector>', 'Drink' => \Smr\BarDrink::SALVENE_SWAMP_SODA], 'Text' => 'Here we are! Now let\'s get this ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . '.', 'Task' => 'Go to the bar at [sector=<Sector>] and buy a ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ' from the bartender. This may take many tries.'], ['Step' => 'EnterSector', 'Detail' => ['SectorID' => '<Starting Sector>'], 'Text' => 'Finally! A true ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ', let\'s return to that drunk!', 'Task' => 'Return to [sector=<Starting Sector>] to claim your reward.'], ['Step' => 'Claim', 'Rewards' => ['Credits' => 500000, 'Experience' => 1000, 'Text' => '*Hiccup* For your...service *Hiccup* to me, take these *Hiccup* 500,000 credits and 1,000 experience *Hiccup*!'], 'Detail' => ['SectorID' => '<Starting Sector>'], 'Text' => 'You hand the ' . \Smr\BarDrink::SALVENE_SWAMP_SODA . ' to the drunk!']]]]
Functions
get_draft_teams()
Returns an array with all relevant information about draft teams, including their current size and if the leader can pick teammates.
get_draft_teams(int $gameId) : array<int, array<string, mixed>>
Parameters
- $gameId : int
Return values
array<int, array<string, mixed>>course_plot_forward()
This function is called by "Conventional" and "Plot To Nearest" pages.
course_plot_forward(AbstractPlayer $player, Path $path) : never
Parameters
- $player : AbstractPlayer
- $path : Path
Return values
neverecho_nav()
echo_nav(int $topic_id) : void
Parameters
- $topic_id : int
echo_content()
echo_content(int $topic_id) : void
Parameters
- $topic_id : int
echo_subsection()
echo_subsection(int $topic_id) : void
Parameters
- $topic_id : int
echo_menu()
echo_menu(int $topic_id) : void
Parameters
- $topic_id : int
get_numbering()
get_numbering(int $topic_id) : string
Parameters
- $topic_id : int
Return values
stringreplaceMissionTemplate()
Callback for array_walk_recursive in Player::rebuildMission.
replaceMissionTemplate(string|int|PlotGroup &$template, string $key, array<string, int> $replacements) : void
Searches for placeholders in template and replaces them with values derived from the supplied data.
Parameters
- $template : string|int|PlotGroup
- $key : string
- $replacements : array<string, int>
checkMissionRequirements()
checkMissionRequirements(array<string, mixed> $values, array<string, mixed> $requirements) : bool
Parameters
- $values : array<string, mixed>
- $requirements : array<string, mixed>
Return values
boolcreateNHA()
Create the Newbie Help Alliance and populate its Message Board
createNHA(int $gameID) : void
Parameters
- $gameID : int
hit_sector_mines()
hit_sector_mines(AbstractPlayer $player) : void
Parameters
- $player : AbstractPlayer
parseBoolean()
parseBoolean(mixed $check) : bool
Parameters
- $check : mixed
Return values
boollinkCombatLog()
linkCombatLog(int $logID) : string
Parameters
- $logID : int
Return values
stringsmrBBCode()
Converts a BBCode tag into some other text depending on the tag and value.
smrBBCode(BBCode $bbParser, int $action, string $tagName, string $default, array<string, string> $tagParams, string $tagContent) : bool|string
This is called in two stages: first with action BBCODE_CHECK (where the returned value must be a boolean) and second, if the first check passes, with action BBCODE_OUTPUT.
Parameters
- $bbParser : BBCode
- $action : int
- $tagName : string
- $default : string
- $tagParams : array<string, string>
- $tagContent : string
Return values
bool|stringinify()
inify(string $text) : string
Parameters
- $text : string
Return values
stringbbify()
bbify(string $message[, int|null $gameID = null ][, bool $noLinks = false ]) : string
Parameters
- $message : string
- $gameID : int|null = null
- $noLinks : bool = false
Return values
stringcreate_error()
create_error(string $message) : never
Parameters
- $message : string
Return values
neverhandleUserError()
handleUserError(string $message) : never
Parameters
- $message : string
Return values
nevercreate_link()
create_link(Page|string $container, string $text[, string|null $class = null ]) : string
Parameters
- $container : Page|string
- $text : string
- $class : string|null = null
Return values
stringcreate_submit_link()
create_submit_link(Page $container, string $text) : string
Parameters
- $container : Page
- $text : string
Return values
stringget_colored_text_range()
get_colored_text_range(float $value, int $maxValue[, string|null $text = null ][, int $minValue = 0 ]) : string
Parameters
- $value : float
- $maxValue : int
- $text : string|null = null
- $minValue : int = 0
Return values
stringget_colored_text()
get_colored_text(float $value[, string|null $text = null ]) : string
Parameters
- $value : float
- $text : string|null = null
Return values
stringword_filter()
word_filter(string $string) : string
Parameters
- $string : string
Return values
stringpluralise()
pluralise(int|float $amount, string $word[, bool $includeAmount = true ]) : string
Parameters
- $amount : int|float
- $word : string
- $includeAmount : bool = true
Return values
stringdo_voodoo()
This function is a hack around the old style http forward mechanism.
do_voodoo() : never
It is also responsible for setting most of the global variables (see loader.php for the initialization of the globals).
Return values
neversaveAllAndReleaseLock()
saveAllAndReleaseLock([bool $updateSession = true ]) : void
Parameters
- $updateSession : bool = true
doTickerAssigns()
doTickerAssigns(Template $template, AbstractPlayer $player, Database $db) : void
Parameters
- $template : Template
- $player : AbstractPlayer
- $db : Database
doSkeletonAssigns()
doSkeletonAssigns(Template $template) : void
Parameters
- $template : Template
format_list()
Join a list of items into a grammatically-correct sentence fragment.
format_list(array<string|int, string> $items) : string
Parameters
- $items : array<string|int, string>
Return values
stringin_time_or_now()
Convert an integer number of seconds into a human-readable time for grammatically-correct use in a sentence, i.e. prefixed with "in" when the amount is positive.
in_time_or_now(int $seconds[, bool $short = false ]) : string
Parameters
- $seconds : int
- $short : bool = false
Return values
stringformat_time()
Convert an integer number of seconds into a human-readable time.
format_time(int $seconds[, bool $short = false ]) : string
Seconds are omitted to avoid frequent and disruptive ajax updates. Use short=true to use 1-letter units (e.g. "1h and 3m"). If seconds is negative, will append "ago" to the result. If seconds is zero, will return only "now". If seconds is <60, will prefix "less than" or "<" (HTML-safe).
Parameters
- $seconds : int
- $short : bool = false
Return values
stringnumber_colour_format()
number_colour_format(float $number[, bool $justSign = false ]) : string
Parameters
- $number : float
- $justSign : bool = false
Return values
stringgetWeightedRandom()
Randomly choose an array key weighted by the array values.
getWeightedRandom(array<string|int, mixed> $choices) : T
Probabilities are relative to the total weight. For example:
array( 'A' => 1, // 10% chance 'B' => 3, // 30% chance 'C' => 6, // 60% chance );
Parameters
- $choices : array<string|int, mixed>