Minigames
phantom.aj.minigamesPlaying
Minigames: playing, lobbies, PvP, scores, and each of the 64 games by name.
Scripts and plugins
A script has all of it, as phantom.aj.minigames, and so does a plugin, from ctx.phantom(): the SDK runs in the plugin's own frame. Each call is marked with what it needs: game:read for what the area knows and hears, which "game": "read" in the manifest grants, and game:act for doing things in it as the player, which needs "game": "act" (see Permissions).
Overview
| Member | What it does | Plugins |
|---|---|---|
chat() | Says something in the game's chat (MinigameManager.sendChatMsg). | game:act |
current() | The game on screen, whichever it is, read from its GameBase; null when there is none. | game:read |
end() | Ends the game on screen as the server's me would (GameBase.end(null)): the game shows how it ended and stays until left. | game:act |
feed() | Hands the game on screen a message as if the server had sent it (messageGame). | game:act |
isPlaying() | Whether the player is in a minigame, as the client reckons it (inMinigame): two player games, custom games and adventure combat are not counted. | game:read |
keepAwake() | Keeps a long game from timing out: the client's own keepAlive, called in the game about once a second while a game runs (always for every moment). | game:act |
leave() | Leaves the game the way every close button does (MinigameManager.leave): back to the room the player came from. | game:act |
play() | Opens a game as clicking it in the world does (handleGameClick): its game card, or with skipGameCard the game itself. | game:act |
playerInfo() | What the client tells every game about the player: the active pet's name, membership. | game:read |
quit() | Tells the server the player left an in-room game (sendMinigameLeaveRequest, ml) without the client closing it, and resolves once it has gone out. | game:act |
send() | Sends the game's own message to the server, as the game does (MinigameManager.msg, which puts the game's id in front: %xt%o%mm%<room>%<gameDefId>%<data>…), once it has gone out. | game:act |
status() | Where the client stands with minigames, and the game it has lined up. | game:read |
whenPlaying() | Waits for the player to be in a minigame (or, with playing: false, out of one), and resolves once they are. | game:read |
onEnd() | Hears the server end the game (me). | game:read |
onGameClosed() | Hears the game closed (MinigameManager.leave), with the gems it paid. | game:read |
onGameCreated() | Hears the game's class built and put on screen (startGameLoaded). | game:read |
onGameLoaded() | Hears the game's scene finish loading. | game:read |
onGameOver() | Hears the server end the game (minigameEndResponse), with what it sent and the gems paid. | game:read |
onGameStarting() | Hears the client start building a game (startGame), with its players and data. | game:read |
onMessage() | Hears the server's messages to the game (mm), as it sent them. | game:read |
onPlayerLeft() | Hears a player leave the game (ml). | game:read |
onPlaying() | Hears the player go into a minigame and come out of one, as isPlaying reckons it. | game:read |
onRoomRemoved() | Hears the game's room removed (mr). | game:read |
onStart() | Hears a game start (ms): its room and players, and the game's own data. | game:read |
minigames.lobby: Asking for a seat and waiting for players: phantom.aj.minigames.lobby.
| Member | What it does | Plugins |
|---|---|---|
current() | The waiting list as the client holds it: who waits, how many a game needs, where to go back. | game:read |
join() | Asks the server for a seat (sendMinigameJoinRequest, mj), and resolves with the seat and who waits with the player. | game:act |
startNow() | Starts a waiting game now, without waiting for more players (sendMinigameStartRequest), and resolves with the players once the server starts it. | game:act |
onButton() | Hears the waiting list's own buttons pressed: one player, many, start now, close. | game:read |
onChange() | Hears the waiting list change, as the client fills it from the server's answer. | game:read |
onJoinRequest() | Hears the client ask for a seat (mj going out), however it was asked. | game:read |
onJoinResult() | Hears the server's answer to a request for a seat (mj). | game:read |
minigames.pvp: Two player games: phantom.aj.minigames.pvp.
| Member | What it does | Plugins |
|---|---|---|
current() | The two player game the client is lined up for, or null for none. | game:read |
invite() | Challenges a player to a two player game (mp, action 0), once the challenge has gone out. | game:act |
isOffering() | Whether the player's own offer to play is up on their animal (isMyUserInCustomPVPState). | game:read |
joinOffered() | Takes up another player's offer to play (sendMinigameCustomPvpJoinMsg), once it has gone out. | game:act |
offer() | Puts the player's own offer to play up on their animal, or takes it down (open: false), and resolves once the client shows it so. | game:act |
ready() | Lines the client up for a two player game against userName (readySelfForPvpGame), or stands it down with ready: false. | game:act |
respond() | Accepts a challenge, or turns it down (mp, action 0 or 1), once the answer has gone out. | game:act |
onButton() | Hears the challenge popup's buttons, and the "play again?" after a two player game. | game:read |
onChange() | Hears the client line up for a two player game, or stand down (null). | game:read |
onInvite() | Hears a challenge, or the answer to one (mp). | game:read |
minigames.scores: Scores, gem and pet mastery awards, and leaderboards: phantom.aj.minigames.scores.
| Member | What it does | Plugins |
|---|---|---|
awardGems() | Awards gems for a game (MinigameManager.awardGems), and resolves once the award has gone out. | game:act |
awardPetMastery() | Awards the active pet mastery points (awardPetMasteryPoints), once the award has gone out. | game:act |
cached() | A game's leaderboards as the client cached them for its game card, or null for none. | game:read |
commit() | Has the game on screen send the score it tracked (GameBase.valueTrackerCommit). | game:act |
leaderboard() | Asks for a game's three leaderboards (sendMinigameLeaderboardRequest, mlb), and resolves with them; REFUSED when the server has none for it. | game:act |
pending() | The client's serials, and the awards it holds until a serial comes. | game:read |
submit() | Sends a score for a game, folded as MinigameManager.sendScore folds it with the client's score serial, onto the game's leaderboard (its leaderboardUserVarRef, from the catalog unless given). | game:act |
onGemAward() | Hears a gem award go out, unfolded with the serial last heard. | game:read |
onGemsEarned() | Hears a game pay gems (GameBase.addGemsToBalance), with the run's total. | game:read |
onGemSerial() | Hears the server hand out the serial the next gem award goes with (mg). | game:read |
onLeaderboard() | Hears a game's leaderboards arrive (mlb), however they were asked for. | game:read |
onMasterySerial() | Hears the server hand out the serial the next pet mastery award goes with (ma). | game:read |
onPetMasteryAward() | Hears a pet mastery award go out, unfolded with the serial last heard. | game:read |
onPetMasteryEarned() | Hears a game pay pet mastery (GameBase.addToPetMastery). | game:read |
onRound() | Hears a run of a game finish, with what it came to: the score sent, the gems claimed, and the server's end, gathered as they arrive within settleMs (a second) of each other. | game:read |
onScore() | Hears a score go out (msv), unfolded with the score serial last heard. | game:read |
minigames.catalog: What the client knows of each game: phantom.aj.minigames.catalog.
| Member | What it does | Plugins |
|---|---|---|
describe() | Asks the server to describe games (sendMinigameInfoRequest, mi), and resolves with them once it has; the client keeps them in its cache as ever. | game:act |
get() | One game as the client's cache holds it, by definition id, or by the name of its server extension or movie (getMinigameInfoByExtName, BySwfName). | game:read |
name() | A game's title in the player's own language (getGameName); empty when the client has none. | game:read |
nameId() | The localization string id of a game's title (getGameNameId), or null. | game:read |
pvpGames() | The games two players can play against each other (getAllReadyForPvpGameDefs). | game:read |
signClass() | The class the client builds the games' world signs from (MinigameManager.GameTotem). | game:read |
onDescribed() | Hears the server describe games (mi). | game:read |
minigames.screen: Any game on screen, the same way for every game: phantom.aj.minigames.screen.
| Member | What it does | Plugins |
|---|---|---|
fieldNames() | The plain fields of the game on screen's own class (numbers, strings, flags), the ones a Sprite has left out, or null when no game is on screen. | game:read |
fields() | The values of the game on screen's fields, by name: the ones named, or all its plain fields. | game:read |
onButton() | Hears any game's button pressed (GuiButton.mouseClick), with what the button is for. | game:read |
onDialog() | Hears any game put up one of its dialogs (GameBase.showDlg) or take it down (hideDlg). | game:read |
onFields() | Hears fields of the game on screen change (at most 62), read in the game every few frames, with the values before and which changed. | game:read |
onGameCardButton() | Hears the game card's buttons: play, pro, instructions, its pages and its leaderboards. | game:read |
onIdleWarningDismissed() | Hears the player dismiss the three-minute idle warning (onKickWarningPopup). | game:read |
onPause() | Hears any game pause or play on (GameBase._pauseGame), as its dialogs come and go. | game:read |
onPress() | Hears the player press anywhere in a game (the stage's mouseDown, which every game hears). | game:read |
minigames.joinGames: The games list: phantom.aj.minigames.joinGames.
| Member | What it does | Plugins |
|---|---|---|
all() | The games the list offers, in its order; none when it is not open. | game:read |
press() | Presses one of the games, as the player does, which asks to join it. | game:act |
setGames() | Fills the list with games of your own choosing, by definition id, as the server's list would (onGameListLoaded). | game:act |
onReady() | Hears the list drawn, with how many games it offers. | game:read |
minigames.bowling: Bowling.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
bowl() | Bowls, as Enter does (onKeyDown), on the player's turn; resolves once the turn has passed. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
emote() | Shows an emote over the player's lane (the scene's emoteClicked, which its script sends). | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.bradyChemistrySet: Brady’s Chemistry Set.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.bradyExpeditions: Brady Barr’s Expeditions.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
answerPrize() | Keeps or turns down the prize offered (keptItem, rejectedItem), once it has gone. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
begin() | Starts the story from its first screen. | game:act |
chapters() | The chapters the chapter window lists, with their titles; none when it has none. | game:read |
choose() | Takes one of the paths a part offers (1 to 3, as its windows number them). | game:act |
chooseChapter() | Opens a chapter from the chapter window, by its place in chapters(); not a locked one. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Closes the game with its close button, once it is gone. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
toggleSound() | Turns the sound on or off, as its button does. | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.candyCatcher: Candy Catcher.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeInstructions() | Closes the instructions (onInstructions). | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
play() | Answers the play dialog or the results' play again: play (onStart_Yes, which pays the gems) or not (onStart_No, which leaves). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setHighScore() | Writes the high score and its counter. | game:act |
setScore() | Writes the score and its counter. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.connectFour: Connect Four.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
board() | The board as the server has filled it this round; empty when no round has been heard. | game:read |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
drop() | Drops a counter down a column (0 to 6), on the player's turn, and resolves with the row it landed in once the server says. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
seats() | The two seats: each player's animal name and kind, and whether it is drawn. | game:read |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onDropped() | Hears a counter dropped (mark), by either player, with the row it landed in. | game:read |
onRoundEnd() | Hears a round end: won, lost or tied on a drop, or won when the opponent leaves (ml). | game:read |
onRoundStart() | Hears a round begin (round): who the opponent is and whether the player goes first. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.cottonCandy: Cotton Candy.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.distanceChallenge: Long Shot.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
finish() | Takes the gems and leaves once a throw's results are up (onGreatJob_No). | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepSpeed() | Holds the forward speed, every frame, until the handle is stopped. | game:act |
launch() | Lets go, as the player's click does (mouseClickHandler); resolves once the throw is in the air. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Throws again once a throw's results are up (onGreatJob_Yes); resolves with the new throw. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setVelocity() | Sets the flier's speed in flight, held to the launcher's own limits; resolves with the throw. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.dolphinRace: Dolphin Race.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeError() | Closes the error dialog, which leaves the race. | game:act |
computers() | The computer racers' three profiles, and how many lanes they fill. | game:read |
data() | The race's own data: its facts, the room's ids, its randomizers. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
dismissError() | Closes the error dialog, which leaves the race (onErrorExit). | game:act |
dolphins() | Every dolphin, the players' and the computers'. | game:read |
emote() | Shows an emote over the player's racer, as its button does (emoteButton). | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
steer() | Steers the player's dolphin, as the arrow keys do: up or down held, or null to let go. | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onEmoteButton() | Hears the player press one of the emote buttons (onEmote<Name>Button). | game:read |
onGameMessage() | Hears the server's messages reach the race (message). | game:read |
onInput() | Hears the race's keys and clicks (keyHandleDown, keyHandleUp, mouseHandleDown). | game:read |
onLifecycle() | Hears the race's own steps (start, resetGame, playerLeftGame, end, …). | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
onWater() | Hears the water drawn (inMotionEffects, boost, updatePearl, …). | game:read |
minigames.dunkAPhantom: Dunk a Phantom.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeInstructions() | Closes the instructions, which starts the game (onInstructions). | game:act |
decline() | Turns the booth down (onStart_No), which leaves it; resolves once it is gone. | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
play() | Plays a game, as the booth's yes does (onStart_Yes, which sends pg). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.eagleFlap: Eagle Flap.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
flap() | Flaps, as clicking does (the scene's fl_MouseClickHandler); not under a dialog. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves: straight out from a game over dialog, otherwise by asking as the close button does. | game:act |
playAgain() | Plays again from either game over dialog (onRetry), once it has gone. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.fallingPhantoms: Falling Phantoms.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
gemMultiplier() | What the race's gems are multiplied by (getGemMultiplier); null off screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
leaveAtOnce() | Leaves at once, as the game's error popup does (onErrorExit); resolves once it is gone. | game:act |
move() | Runs left, right or stops, as the arrows do: the arrows are written and the move sent to the other racers (messageMoveState). | game:act |
newGame() | Starts another race, as the "new game" button does (startNewGame); only while it shows. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
removePlayer() | Takes a runner out of the race, as the game does when one leaves (playerLeftGame). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setComputerProfiles() | Has the computer runners run to these profiles (_aiProfiles), in order. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onMessage() | Hears the server's messages to the race (message), by their first part. | game:read |
onMove() | Hears the runner's moves: sent to the others, and the arrows going down and up. | game:read |
onPhantom() | Hears the phantoms: one dropped (getPhantom), the gem multiplier asked for, and one in every 60 hit tests (boxCollisionTest), with how many are falling. | game:read |
onPhase() | Hears the race move from one phase to the next (setGameState), with the state before. | game:read |
onSession() | Hears the steps of the game's life: a runner leaving, a new race, a reset, the end. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.fashionShow: Best Dressed.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeDressingRoom() | Closes the dressing room: at once, or as its close button (or the demo's) does. | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
emote() | Emotes (1 to 4) with the emote buttons, while they show. | game:act |
endRound() | Ends the round for the player (clientEndsRound). | game:act |
endVoting() | Ends voting for the player (clientEndsVoting), with a vote for a place or none. | game:act |
finishOutfit() | Says the outfit is done (onFinished_Yes), while dressing with the dressing room open. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepDressing() | Goes on from "keep dressing?" or "leave?" by staying (onFinished_No, onExit_No). | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
leaveAtOnce() | Leaves at once, without asking (exit); resolves once the game is gone. | game:act |
openDialog() | Puts up one of the show's dialogs. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
practice() | Starts practice from its card (onPracticeOK). | game:act |
removePlayer() | Takes a player off the stage (playerLeftGame), by place. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
vote() | Votes for the player at a place (1 to 10), as its vote button does; only while voting. | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onDressing() | Hears the dressing room and the stage being made up, step by step. | game:read |
onMessage() | Hears the server's messages to the show (message), by their kind. | game:read |
onMove() | Hears the player's own moves: a round ended, a vote given, an emote. | game:read |
onResult() | Hears the results shown, and each trophy given. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.fastFoodies: Fast Foodies.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
afterStage() | From a stage's results: play it again, go on to the next, or back to the stage select. | game:act |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
begin() | Starts the stage picked, from its start card (or the how to play before it). | game:act |
chooseLocation() | Picks a place on the place select (gotoJuiceHut, gotoTheater); the theater once it is open. | game:act |
chooseStage() | Picks a stage (1 to 20) on the stage select, once the one before it has been played. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
leaveAtOnce() | Leaves at once, without the gem multiplier (onStart_No). | game:act |
makeRandomCustomer() | Has the game make a customer (getRandomAvatar). | game:act |
open() | Shows the place select, the stage select or how to play. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
restart() | Starts the game afresh from its first screen (startGame). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onCustomer() | Hears the game dress a customer, step by step. | game:read |
onResult() | Hears a stage's results shown, and a three-paw stage counted. | game:read |
onScreen() | Hears the game's screens and their buttons. | game:read |
onStage() | Hears a stage picked, chosen, started, replayed or moved on from. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.feedingFrenzy: Feeding Frenzy.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
chooseDifficulty() | Picks a difficulty on the title screen, and resolves once the game has gone on from it. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepLives() | Holds the lives, the counter drawn each frame with them, until the handle is stopped. | game:act |
leave() | Leaves from the result cards (onExit_Yes) as from anywhere else. | game:act |
playAgain() | Plays again from the result cards: from the first, on to the last (showGameOverDlg2), then its no (onExit_No). | game:act |
previousLevel() | Goes back a level (checkGrowthTarget(true, true)). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setGrowth() | Sets the growth toward the next size, and redraws it (updateGrowth). | game:act |
setLives() | Sets the lives and draws the counter. | game:act |
setSize() | Makes the fish a size (1 to 7), drawn as growing into it is. | game:act |
skipLevel() | Skips to the next size target, as the game's own cheat does (checkGrowthTarget(true)). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
steerTo() | Steers the fish toward a point, as moving the mouse does (mouseMove, then _mouseX/_mouseY on the player), or lets it drift with null (mouseLeave). | game:act |
tables() | The tables the waters are played from; null when the game is not on screen. | game:read |
water() | The water's working parts; null when Feeding Frenzy is not on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onDialog() | Hears the game's level, result and leave dialogs come up and get answered. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.fortSmasher: Fort Smasher.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave a match, as the close button does then (showExitConfirmationDlg). | game:act |
chooseGround() | Picks a ground in the picker (chooseTerrain, 0 to 4). | game:act |
chooseLevel() | Picks a level of the ground (1 to 10) from the level select (chooseFort). | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeOptions() | Closes the options and plays on (onExit_No). | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
finish() | Leaves from any of the game's dialogs, as their exit does (onExit_Yes); resolves once gone. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
level() | The level being played and the tables behind it; null off screen. | game:read |
levelSelect() | Goes back to the level select from the options (onBtnLevelSelect). | game:act |
load() | Loads or empties the player's own slingshot (_launcherLoaded). | game:act |
materials() | The material and fruit tables (_materials, _projectiles) and the cluster's split. | game:read |
openOptions() | Opens the options, as the close button does when playing alone (showOptionsDlg). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
players() | The players, in one message; none off screen. | game:read |
restartLevel() | Plays the level again, from the options or the game over (onBtnRestartLevel). | game:act |
selectFruit() | Loads a fruit into the slingshot, as clicking it on the fruit row does (setProjectileType, setFruitHighlight). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setAmmo() | Sets a fruit's ammo and the counter that shows it on the fruit row. | game:act |
setClusterParams() | How the cluster fruit splits (_clusterParams): its speed kept (0 to 7) and its spread (0 to 700). | game:act |
setGravity() | Sets the world's pull (1 to 500), the world's own included (_world.SetGravity). | game:act |
setInput() | Lets the player act or stops them, as the game does between turns (enableInput / disableInput). | game:act |
setMaterial() | Changes a row of the material table (_materials, 0 to 5). | game:act |
setProjectile() | Changes a row of the fruit table (_projectiles, 0 to 5). | game:act |
setScore() | Sets the score of the player whose turn it is, theirs only, and the score on screen. | game:act |
shoot() | Shoots, as letting go of the slingshot does: the pull (20 to 80) and the angle are written to the player and shoot lets fly, sent to the other player in a match. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
toggleZoom() | Zooms in or out, as the magnifier does (zoomToggle); refused while the camera is moving. | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onArt() | Hears the game's art and sounds load, and its designer sliders set up, by name. | game:read |
onBall() | Hears a fruit made ready to fly (createBall), or a cluster fruit split (createCluster), with its fruit and the cluster's steps. | game:read |
onButton() | Hears the game's buttons and the dialogs they open, by name (start, options, restart, gameOver and the rest). | game:read |
onChoice() | Hears the level and ground pickers: a level or ground picked, the list of unlocked levels set, or a level button hovered. | game:read |
onDrag() | Hears a fort piece picked up (true) or let go (false) while building. | game:read |
onFruit() | Hears the fruit row: the pointer over a fruit, off the row, or a fruit picked, with the fruit and the ammo. | game:read |
onHit() | Hears a fruit or a piece do damage (doDamage), with the impulse, whose turn it is and whether the cluster can be split now. | game:read |
onInput() | Hears the game let the player act or stop them (enableInput, disableInput), with true when they may act. | game:read |
onKey() | Hears a key let go in the game or pressed on one of its cards, with the card and the key code. | game:read |
onLevel() | Hears a level being set up, step by step (startNextLevel, buildForts, resetForts, the materials, the physics world), with the level and the ground. | game:read |
onMessage() | Hears a message between the two players of a match (message), split into its parts. | game:read |
onPhase() | Hears the game change phase (setGameState), with the phase, its number and the one before. | game:read |
onPowerup() | Hears a power-up appear (spawnPowerup), with where it is and whose turn it is. | game:read |
onResult() | Hears a level end (endLevel), with the score, gems, level, ammo left and phantoms left. | game:read |
onSession() | Hears a match start, its players heard from, and its end (start, heartbeatPlayers, end), with the player's own id and how many play. | game:read |
onShot() | Hears a fruit leave the slingshot (launchBall): its pull, angle and fruit, whether it went to the other player, the ammo left and whose turn it was. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
onTurn() | Hears a turn end, in its three steps (checkEndTurn, endTurn, endTurnPart2), with the player's score, phantoms left and whether they are out of ammo. | game:read |
minigames.gameCard: GameCardApi.
| Member | What it does | Plugins |
|---|---|---|
closeLeaderboards() | Closes the leaderboards panel, as its X does. | game:act |
current() | The card open, or null. | game:read |
enableLeaderboards() | Turns on a card's leaderboards where the card's art has the panel but the client left it off: _showLeaderBoard, then the card's own addEventListeners. | game:act |
leaderboard() | The leaderboards as the card shows them, or null with no card up. | game:read |
openLeaderboards() | Opens the leaderboards panel, as its button does. | game:act |
press() | Presses one of the card's buttons, on the second game's half with second. | game:act |
refreshLeaderboard() | Has the card draw the board showing again (onLeaderBoardSelected). | game:act |
showLeaderboard() | Shows one of the three boards, as its tab does. | game:act |
minigames.gemBreaker: Gem Breaker.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
aim() | Aims the player's cannon (_serverRotation), clamped to -170..-10 degrees. | game:act |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeTutorial() | Closes the how-to-play (hideTut). | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepAim() | Holds the player's cannon at an angle every frame, until the handle is stopped. | game:act |
leave() | Leaves from a game over or the end of a two player game (onExit_Yes), or as any game. | game:act |
nextLevel() | Goes on to the next level from the level's results (doNextRound). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setScore() | Sets the player's own score, through incrementScore as the game adds to it. | game:act |
shoot() | Shoots, as a click does (mouseClickHandler), and resolves once the shot is counted. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.hedgeHog: Hedgehog.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
continueLevel() | Goes on from a finished level: its fact, then "great job", then the next level. | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
face() | Faces the hedgehog a way at once (changeDirection); resolves once it runs that way. | game:act |
facts() | The level's facts (_facts): each image and its text's string id. | game:read |
finish() | Leaves from the game over card (onExit_Yes), once the game is gone. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepPoweredUp() | Powers the hedgehog up and holds it powered (_energizerTimer, more than 2 seconds) until the handle is stopped, which lets it run out. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
maze() | The level's maze: its squares (_levels), pellets, crystals and where the hedgehog is. | game:read |
open() | Shows one of the game's screens (the countdown, the controls, the fact, the next level, exit). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
resetPlayer() | Puts the hedgehog back on its start square (setPlayerIJ). | game:act |
respawnPhantoms() | Sends the phantoms back to their start without a new level (setupLevel(false)). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setHighScore() | Sets the high score, and the high score shown. | game:act |
setLives() | Sets the lives left (at least 1), and redraws the lives shown. | game:act |
setScore() | Sets the score as the game does (setScore, without the extra life check). | game:act |
showScore() | Adds a score where the game shows one (doScorePopup), as eating a phantom does. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
turn() | Runs the hedgehog one way, as holding its arrow does (the others let go first), or stops holding any with null. | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onFact() | Hears a fact's picture asked for (loadNextFactImage) and loaded (mediaObjectLoaded). | game:read |
onMaze() | Hears the maze change: a level set up, pellets laid, a bonus, phantoms spawning, portals. | game:read |
onScore() | Hears the score change (setScore) and the scores shown in the maze (doScorePopup). | game:read |
onScreen() | Hears the game show one of its screens. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
onTurn() | Hears the hedgehog turn (changeDirection) and its arrow keys (onKeyDown, onKeyUp). | game:read |
minigames.horseRace: Horse Race.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
boost() | Uses a carrot boost, as its button does (onBoostButton, which sends boo). | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeError() | Closes the error dialog, which leaves the race. | game:act |
computers() | The computer racers' three profiles, and how many lanes they fill. | game:read |
data() | The race's own data: its facts, the room's ids, its randomizers. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
dismissError() | Closes the error dialog, which leaves the race (onErrorExit). | game:act |
emote() | Shows an emote over the player's racer, as its button does (emoteButton). | game:act |
horses() | Every horse, the players' and the computers'. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
jump() | Jumps, as the jump button does (onJumpButton); resolves once the horse is in the air. | game:act |
jumpKey() | Holds the jump key down, or lets it go (keyHandleDown / keyHandleUp with space). | game:act |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setBoosts() | Sets the boosts left, and redraws their button as the game does (_boostButton.carrots). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onDialog() | Hears the error dialog closed or the gem bonus done (onErrorExit, onGemMultiplierDone). | game:read |
onEmoteButton() | Hears the player press one of the emote buttons (onEmote<Name>Button). | game:read |
onGameMessage() | Hears the server's messages reach the race (message). | game:read |
onInput() | Hears the race's keys and clicks (keyHandleDown, keyHandleUp, mouseHandleDown). | game:read |
onLifecycle() | Hears the race's own steps (start, resetGame, playerLeftGame, end, …). | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.marbles: Marbles.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
detail() | How the round stands underneath (see MarblesDetail); null off screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepSecondsLeft() | Holds the shot clock at seconds (at most 15) while a shot is being taken. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
pieces() | Every marble, shooter and obstacle on the table (_layerMain). | game:read |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
ready() | Says the player is ready, from the how-to-play screen (sendReady). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setReportedAim() | Changes the aim the game reports to the other player (_serverPosition, the one before kept). | game:act |
shoot() | Takes the player's shot, as the mouse does: the shooter stood from degrees round the ring, pressed (mouseDownHandler), pulled away from towards by power, and let go (mouseUpHandler). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onButton() | Hears the game's buttons: ready, and the leave question's. | game:read |
onMouse() | Hears the player press and let go on the table, and whether the game took it (a shot when let go past the least pull). | game:read |
onResult() | Hears the game end, once: the outcome, and the gems it pays. | game:read |
onScore() | Hears the score change, as a marble fades out of the ring (fadedOut). | game:read |
onShot() | Hears a shot taken: the player's (shoot), or the opponent's (the server's shoot message). | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
onTurn() | Hears a turn announced: whose, and whether it is the last. | game:read |
minigames.memory: Memory.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
cards() | The cards on the board, in one message; none when the game is not on screen. | game:read |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
quit() | Leaves once the round is over, as its "no" does (onRetry_No); resolves once it is gone. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setScore() | Writes the score and redraws it (updateScore). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
turn() | Turns a card over, as clicking it does (mouseClickHandler_Back), and resolves with the cards. | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onButton() | Hears the game's own buttons pressed, by their handlers. | game:read |
onCardClick() | Hears a card clicked (mouseClickHandler_Back), taken or not. | game:read |
onDeal() | Hears the cards dealt for a new round (restart). | game:read |
onGameOver() | Hears the round end, won or out of time (showGameOverDlg). | game:read |
onMatch() | Hears a pair matched (MemoryCard.matched, once for each of the two). | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
onTurned() | Hears a card turned face up by the player (MemoryCard.select, not the reveal). | game:read |
minigames.microBambooHarvest: Bamboo Harvest.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microCrane: Claw Machine.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
answerPrize() | Keeps or turns down the prize, as its popup does (keptItem / rejectedItem, which send cd); resolves once the popup has gone. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
decline() | Turns the offer down, as its no does (onNo, which ends the game); resolves once it is gone. | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
drop() | Drops the claw (pressDropButton); resolves once it has. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
move() | Starts the claw moving, as holding an arrow does (pressMoveButtons). | game:act |
moveTo() | Puts the claw straight at position (0 to 200): stops it, and writes where it is and where its art is drawn, as moving it there would. | game:act |
play() | Pays for a go, as the offer's yes does (onYes, which sends cp); resolves once it starts. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
stop() | Stops the claw, as letting go of the arrow does (releaseMoveButtons). | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microDucky: Ducky Hop.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
hop() | Hops one way, as the arrow key does (keyboardHandler); resolves with the round after. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
quit() | Leaves from the game over dialog, as its no does (onExit); resolves once it is gone. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setPoints() | Sets the points and the counter the scene shows for them (points.text). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microGameInvasion: Game Invasion.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
answerPrize() | Keeps or turns down the prize offered (keptItem, rejectedItem), once it has gone. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
decline() | Declines, as Escape does (keyHandleDown). | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
fire() | Fires, as Enter does (keyHandleDown). | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
play() | Pays and starts a game, as the machine's start button does (machine.clickedStart). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microGoldPanning: Gold Panning.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microHotCocoa: Hot Cocoa.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microMiraSays: Mira Says.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
finish() | Leaves from the game over question (onFail_No), paying what the round earned. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
markPrizeTaken() | Marks one of the five prizes (0 to 4) as paid, so the game does not pay it. | game:act |
pause() | Pauses or unpauses the round, with the scene's own pauseGame / unpauseGame. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microOatHarvest: Oat Harvest.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microPetSalon: Pet Salon.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
confirm() | Answers the confirm dialog: buy (onDone_Yes) or not (onDone_No), once it has gone. | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
dismiss() | Closes the cost or error dialog (onCostClose, onError_OK), once it has gone. | game:act |
done() | Asks to buy the look, as the done button does (showDoneDlg): the confirm or cost dialog. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
reset() | Puts the pet back as it came, as the reset button does (onResetDlg). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setLook() | Puts a look on the pet: its three slots, written as the salon's own pickers write them. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microPetWash: Pet Wash.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microPhantom: Phantom Vortex.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
answerPrize() | Keeps the prize on offer or turns it down (keptItem, rejectedItem), and resolves with the state after; the popup may stay up until closePrize. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
board() | The field: candy, torch, phantoms and lights; null when the game or its scene is not there. | game:read |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closePrize() | Closes the prize popup (destroyPrizePopup), and resolves once it has gone. | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
endRound() | Ends the round as won or lost (onWin, onLose), and resolves once its dialog is up. | game:act |
holdPhantomsInShaft() | Holds every phantom in shaft shaft (1 to 6), its light on, so each round is caught: what a bot does. | game:act |
holdTorch() | Holds the torch at a point, written after the scene's own frame so it is where the scene reads it. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves from a round lost (onLose_No) as from anywhere else (onCloseButton). | game:act |
nextRound() | Goes on from a round won (onWinnerNextLevel). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microPopcorn: Popcorn.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setCaught() | Sets the popcorn caught (below 15) and redraws the meter (updatePopcornMeter). | game:act |
start() | Starts the round from its first dialog (onStart), once the dialog has gone. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microPuppy: Puppy Frisbee.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
pause() | Pauses or unpauses the round (gamePaused on the scene); resolves with the round. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microSmoothie: Smoothie.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
chooseFlavor() | Picks the flavour from its dialog (onFlavorGrape…), once the dialog has gone. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setCaught() | Sets the fruit caught (below 10) and redraws the meter (updateFruitMeter). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microSnake: Pet Snake.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
quit() | Leaves from the game over dialog, as its "no" does (onExit); resolves once it is gone. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
turn() | Turns the snake as an arrow key does (keyboardHandler), and resolves once it heads that way. | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microStoneMining: Stone Mining.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.microWoodGather: Wood Gather.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.moatMadness: Moat Madness.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
chooseDifficulty() | Picks the difficulty on the level picker, as its buttons do; resolves once it has closed. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isConnected() | Whether the moat as laid joins up, as the game checks it (verifyPath); false off screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
next() | Goes on from the verdict: the next puzzle when solved (onNextLevel), else again (onRetry_Yes). | game:act |
pieces() | The pieces of the moat, in one message; none when the game is not on screen. | game:read |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
releaseWater() | Lets the water in, as the start button does (startWater); resolves once it runs. | game:act |
rotate() | Turns a piece a quarter, as clicking it does (MoatPath.handleClick), and resolves with the pieces. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.pachinko: Pachinko.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
launch() | Launches a ball with the spring pulled pull (0 to 100) of the way, as holding and letting go of the launcher does (startPullSpring, releaseSpring). | game:act |
leave() | Leaves from the game over dialog (onExit_Yes) as from anywhere else. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setBallsLeft() | Writes the balls left (at most 9) and redraws them (refreshBallIcons). | game:act |
setScore() | Writes the score and redraws it (updateScore). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.parachuteGlider: Parachute Glider.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
addPhantom() | Puts a phantom on the course (createPhantom), moving at a speed from a row and column. | game:act |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
finish() | Leaves once the drop is over, as its "great job" yes does; resolves once the game is gone. | game:act |
gliders() | Every glider of the drop, in one message. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepFallSpeed() | Holds the player's own glider's fall speed (_serverVelocity.y) until the handle is stopped. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
steer() | Presses or lets go of an arrow, as the keyboard does; resolves once the game counts it. | game:act |
takeGem() | Picks up one of the course's gems by its id (gemPickup). | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.phantomFighter: Phantom Fighter.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
board() | The field of play; null off screen. | game:read |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
holdKey() | Presses or lets go of a key, as the keyboard does (keyboardPressed, keyboardReleased). | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves: straight out from game over (onExit_Yes), otherwise by asking first. | game:act |
nextLevel() | Goes on from a finished level (onNextLevel), once its dialog has gone. | game:act |
playAgain() | Plays again from game over (onRetry_Yes), once its dialog has gone. | game:act |
restartLevel() | Restarts the level being played (restartGame). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setScore() | Sets the score the game's own way (IncrementScore by the difference), which pays its gems. | game:act |
setWeapon() | Gives the ship a weapon, as a powerup does (_player1.upgrade). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onKey() | Hears the player's keys: pressed, let go, and on the level and game over cards. | game:read |
onResult() | Hears a level end: game over (with whether it was won) or the next level. | game:read |
onScore() | Hears points scored (IncrementScore): how many, the score before, and the gems paid. | game:read |
onShip() | Hears the ship spawned, revived or lost, a wave laid out, and a powerup dropped. | game:read |
onShot() | Hears shots: a phantom hit, a shot spent, the player's or a phantom's shot fired. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.phantomsTreasure: Phantom's Treasure.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave from the options (opened first), as their exit does. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeOptions() | Closes the options and plays on (onUnpause). | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
hint() | Uses a hint, as its button does (hintButtonPressed); resolves once it shows. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
levelSelect() | Back to the level select, from the options or a finished level (onLevelSelect). | game:act |
nextLevel() | Goes on to the next level once one is done, through its fact and "great job". | game:act |
objects() | The level's hidden objects (_hiddenObjects), in one message; none off screen. | game:read |
openOptions() | Opens the options, as the close button does (showOptions); the level pauses under them. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
selectStage() | Picks a stage (0 or 1) from the title screen or the level select; resolves as the level starts. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setHintsUsed() | Sets how many hints the level has used (0 to 3), and redraws the hint button to match. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.pillBugs: Pill Bugs.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
chooseDifficulty() | Chooses the difficulty on its dialog (onDifficultySelect_*). | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeOptions() | Closes the options: back to play, or to the level select (onExit_LevelSelect). | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepAim() | Holds the launcher's aim until stopped. | game:act |
keepBalls() | Holds the balls left, and their counter, until stopped. | game:act |
launch() | Launches a ball, as a click does (onMouseClick): only with no dialog up and no ball in play. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
next() | Goes on from the dialog up: how to play, a result, a level done, the game won or lost. | game:act |
openScreen() | Puts up one of the game's screens with its own method (showLevelSelectPopup…). | game:act |
pageLevels() | Turns the level select to the next or the last set of six. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
restartLevel() | Restarts the level, from play or the options (onExit_RestartLevel). | game:act |
selectLevel() | Picks a level (1 to 30) on the level select, turning to its set of six first. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setAim() | Aims the launcher (-73 to 73 degrees); resolves with the state. | game:act |
setBalls() | Sets the balls left during a level, and the counter that shows them. | game:act |
setLevelScore() | Sets the level's score during a level, and the counter that shows it. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onAim() | Hears the aim guide drawn again (updateAimReference). | game:read |
onHit() | Hears the ball hit something (processCollision), or a golden bug (pegType1Hit). | game:read |
onLaunch() | Hears a ball launched: the click (onMouseClick) and the ball made (createBall). | game:read |
onLevel() | Hears a level set up, started, moved on from (setNextLevel) and ended. | game:read |
onResult() | Hears a level's result: cleared (showGreatJobDlg) or lost (showGameOverDlg). | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.pvpMemory: Two player Memory.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
emote() | Shows an emote over the player's side (the scene's emoteClicked). | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
pick() | Turns a card (0 to 15, row by row) as clicking it does (the scene's cardPicked), on the player's turn; resolves once the game has counted it. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.questParachuteGlider: Parachute Glider (adventure).
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
steer() | Steers as the arrow keys do (_leftArrowDown, _rightArrowDown); resolves with the state. | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.riverRace: River Race.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
finish() | Leaves from the results card, as its OK does (onExit_Yes); resolves once the game is gone. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepMaxSpeed() | Holds the top speed of the player's own raft, whichever it is, until the handle stops. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
rafts() | The rafts in the race, in one message. | game:read |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
steer() | Holds or lets go of an arrow, as the keyboard does (keyHandleDown / keyHandleUp). | game:act |
turbo() | Boosts the player's raft, as passing through a turbo buoy does (insideBuoy). | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onGameMessage() | Hears the server's messages reach the game (message). | game:read |
onInput() | Hears the keys the game takes: arrows down and up, and the results card's keys. | game:read |
onLifecycle() | Hears the steps of the game's life: built, courses laid, race started, results, ended. | game:read |
onPhase() | Hears the race move from one phase to the next (setGameState). | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.rockPaperScissors: Rock Paper Scissors.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
choose() | Plays a hand, sending it as the game's clock does (time), once it has gone out. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
leaveNow() | Leaves at once (onExitButton), with no question. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onReveal() | Hears the hands revealed (mark), with how the round went; the other player leaving wins. | game:read |
onRoundStart() | Hears a round start (round), with the other player's id. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.safetyQuiz: Safety Quiz.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answer() | Chooses and submits an answer. | game:act |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
next() | Moves on to the next question at once, rather than waiting for the game to. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
select() | Chooses an answer (0 to 2) as clicking it does: the circle, and the vote button lit. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
showRules() | Shows the rules (onRulesDown). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
submit() | Submits the answer chosen (onSubmitBtnDown), and resolves once the game has judged it. | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.scooped: Scooped.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
add() | Adds a piece to the cone, as clicking its button does (a mouseUp on flav<n> or top<n>). | game:act |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
ready() | Says the player is ready, from the instructions (sendReady, which sends ready). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onButton() | Hears the player press ready (sendReady) or the close button (showExitConfirmationDlg). | game:read |
onCone() | Hears a cone finished, by either player. | game:read |
onDropped() | Hears a cone dropped for a wrong piece, by either player. | game:read |
onPiece() | Hears a piece added, by either player. | game:read |
onPieceClick() | Hears the player click a piece (mouseClick), and whether the game would take it. | game:read |
onResult() | Hears the round end (setGameState to over). | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.shellGame: Shell Game.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepRoundTimer() | Holds the pick clock at seconds (6 by default) until the handle is stopped. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
leaveNow() | Leaves at once, as the match's own exit button does (onExitButton). | game:act |
pick() | Picks a shell (0 to 2), sending the game's own time with it; resolves once it has gone out. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
seats() | The two seats: each player's name and animal, and whether the animal is drawn yet. | game:read |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onReveal() | Hears the picks revealed (mm mark), and the round's outcome for the player. | game:read |
onRoundStart() | Hears a round start (mm round): the opponent and the shell the pearl is under. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.shootingGallery: Shooting Gallery.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
fire() | Fires a dart (shoot), as space does: only while a level is being played, with a dart loaded and the reload done. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepDarts() | Holds the darts left at darts, the belt redrawn each frame, until stopped. | game:act |
leave() | Leaves: straight away from the menu, the results or the leave question (onStart_No). | game:act |
levels() | The levels as the game's data has them; none when it is not on screen. | game:read |
play() | Starts a game from the menu or the results (onStart_Yes), once its card is gone. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
pressKey() | Presses or lets go of a key, as the keyboard does (onKeyDown / onKeyUp). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setDarts() | Sets the darts left mid-game and redraws the belt (_numDarts, ammoBelt.ammo). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onInput() | Hears the keys the game is handed (onKeyDown, onKeyUp, and the menu's onCarnPlayKeyDown). | game:read |
onNextLevel() | Hears the game go on to the next level (doNextLevel), by the level reached, from 1. | game:read |
onPopup() | Hears a score pop up where a target was hit (doScorePopup). | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.skeeball: Skee-Ball.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
laneEdges() | Where the lane's walls are (getLeftX, getRightX); null when the game is not on screen. | game:act |
leave() | Leaves: straight away from the menu, the results or the leave question (onStart_No). | game:act |
play() | Starts a game from the menu or the results (onStart_Yes), once its card is gone. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
roll() | Rolls a ball: the arrow set to angle (-45 to 45), a press, the meter set to power (0 to 100, full by default) and a second press, in one frame as the bridge batches them. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setBallsLeft() | Sets the balls left mid-game (_numBalls) and redraws them (loadBalls). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onGlowHole() | Hears a hole lit for the bonus (chooseGlowHole), by its number. | game:read |
onHoleCheck() | Hears the game check the holes: as the ball rolls (preCheckHoles) and once settled. | game:read |
onPopup() | Hears a score pop up over a hole (doScorePopup). | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.spiderShooter: Spider Shooter.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
nextWave() | Goes on to the next wave from the wave's results (onResults_Next, Great_Job). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setShotRadius() | Makes the player's own shot hit wider (_shotRadius); resolves with the state after. | game:act |
shoot() | Shoots where the pointer is, as a click does (mouseClickHandler). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.spotOn: Spot On.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
decline() | Turns down the game at its start (onStart_No), once the game is gone. | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
pause() | Pauses or unpauses, with the scene's flag and its clock (pausingWithTheTimer). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.superSort: Super Sort.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
facts() | The game's facts (_facts), in the order it holds them; none when it is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
nextFact() | Shows the next fact (loadNextRecycleImage). | game:act |
nextLevel() | Goes on from a level's "great job" (onNextLevel). | game:act |
pause() | Pauses or unpauses the scene (pauseGame / unpauseGame on it). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
tip() | Tips the paddle left or right, as the arrow key does (keyHandleDown). | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.ticTacToe: Tic Tac Toe.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
board() | The board as marked this round, rows of three, from the player's side. | game:read |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepTurnTime() | Holds the turn clock at seconds (at most 15) while a round is played. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
mark() | Marks a square (mark, 0 to 2 each way), once the move has gone to the server. | game:act |
opponent() | The other player's id in the room, or null before a round. | game:read |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onMarked() | Hears a square marked (mark), by the player or the opponent. | game:read |
onRoundEnd() | Hears a round end: a win, a loss or a tie by the mark that ended it, or a win when the other player left. | game:read |
onRoundStart() | Hears a round start (round): the opponent, and whether the player goes first. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.touchPool: Touch Pool.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
answerPrize() | Keeps or turns down the prize on offer (keptItem / rejectedItem). | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeFact() | Closes the open fact (doneButtonClick). | game:act |
closeLog() | Closes the log book (closeLog). | game:act |
closePrize() | Takes the prize popup down (destroyPrizePopup). | game:act |
closeTutorial() | Closes the tutorial, as its button does (onExit_No). | game:act |
creatures() | The creatures in the pool (_creatures), with where each is drawn. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
fact() | The fact shown or last shown, with its strings by id. | game:read |
flee() | Makes one creature (0–11) flee (creatureFlee). | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
logBook() | The log book: each kind's colours found, its count and its present. | game:read |
openPresent() | Opens a kind's present in the log book (1–6): awardGift, which offers its prize. | game:act |
pickFact() | Shows a colour's fact (1–5) on the open fact (setFactButtons). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
queueFact() | Queues the fact for a creature kind (0–5) and colour (1–5), shown at the next chance. | game:act |
respawn() | Brings one creature (0–11) back somewhere else (respawnCreature). | game:act |
scrollTo() | Scrolls the pool, kept inside its edges as dragging it is. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setFactPage() | Turns the open fact to a kind's page (1–6). | game:act |
spawnPoints() | Where creatures can surface (_poolPoints), and which are taken. | game:read |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
toggleLog() | Opens or closes the log book, as its button does (logClick). | game:act |
touch() | Finishes the touch being made at once (touchCreature). | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.towerDefense: Tower Defense.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
board() | The board: the paths, the obstacles, the squares taken, and the level's waves. | game:read |
cancelDrag() | Drops the tower being dragged instead of putting it down (killCurrentDrag). | game:act |
chooseMode() | Picks the difficulty, as its button does (onBtnTutorial, onBtnEasy, …). | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
dismiss() | Closes a hint (hintClose) or a pest's fact (hideNGFact). | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves, asking first unless the difficulty is still being chosen (which leaves at once). | game:act |
placeTower() | Puts down the tower being dragged (placeTower), or drops it (killCurrentDrag). | game:act |
playAgain() | Plays again from the game over (onRetry) or a win (onExit_No, the endless run on). | game:act |
quit() | Leaves from the game over or a win (onExit_Yes); the close button's way is leave. | game:act |
run() | The run's bookkeeping: its clock, what it stopped, its gems, the tutorial, its loading. | game:read |
sellTower() | Sells a placed tower (by its place in towers()); resolves once it is off the board. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setFast() | Runs the game fast or at its own pace, as the fast forward button does (fastForward). | game:act |
setLives() | Sets the lives, and the counter on the board (healthText). | game:act |
setMuted() | Mutes or unmutes the game, as its button does (toggleMute). | game:act |
setScore() | Sets the score, and the counter on the board (scoreText). | game:act |
setTowerRange() | How far a kind of tower reaches, in squares (_attackRange). | game:act |
showHint() | Shows the hint, as its button does (showHintDlg). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
towers() | The towers on the board. | game:read |
tuning() | The game's balance: every tower's damage, rate and range, the pests' hit points and speeds. | game:read |
upgradeTower() | Upgrades a placed tower (by its place in towers()), as its options do (upgrade). | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onAttack() | Hears a kind of tower attack (attack). | game:read |
onButton() | Hears the game's buttons, by what they do. | game:read |
onFact() | Hears a pest's fact shown (showNGFact). | game:read |
onKey() | Hears a key pressed on one of the game's cards. | game:read |
onPestStopped() | Hears a pest stopped (enemyKilled), with what it paid. | game:read |
onResult() | Hears a game won or lost, with what it came to. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
onStep() | Hears the game's own steps, sounds and sums run, by name: start, init, validate, data, startGame, reset, gemMultiplier, end, message; mute, unmute, play, loop, load, stop, plantDone…snakeDone; hitpoints, sellPrice, overlap, worldCoords. | game:read |
onTower() | Hears towers placed, loaded, dragged, upgraded and sold. | game:read |
minigames.trivia: Trivia.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answer() | Sends an answer (1 to 3) straight to the server (sa), once it has gone out. | game:act |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
choose() | Chooses an answer (1 to 3) as clicking it on the board does; resolves once it is chosen. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
emote() | Shows an emote as its button on the board does (0 happy, 1 sad, 2 confused, 3 mad). | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
players() | The players at the shrine; none off screen. | game:read |
react() | Sends an emote straight to the server (se), once it has gone out. | game:act |
scoreboard() | The scoreboard: each player's stars, streaks and payout; null off screen. | game:read |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setBoard() | Puts a question on the board, by its localization ids, and draws it as the game does (LocalizationManager.translateId into the board's fields). | game:act |
setClock() | Sets the round's clock (above 0, at most 60). | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onBoard() | Hears the board: up and down, an avatar placed, an answer pressed and sent, an emote pressed. | game:read |
onDialog() | Hears the game's dialogs: the leave question and its answers, the gem bonus, game over. | game:read |
onQuestion() | Hears each question the server puts up (its mm), as plain ids. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.trueFalse: True or False.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answer() | Answers the statement straight away (sa: 1, 2 or 3), once the answer has gone out. | game:act |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
chooseSide() | Walks the player's animal to the middle of a side, as clicking there does. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
dismiss() | Dismisses the tutorial or the "still there?" popup, whichever is up. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
players() | Every player on the stage, in one message. | game:read |
react() | Shows an emote to the room (se), once it has gone out. | game:act |
reportPosition() | Tells the room where the player stands (updatePosition), as the game does each step. | game:act |
scoreboard() | The round's stars, streaks and gem payout; null when the game is not on screen. | game:read |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
steer() | Presses or lets go of an arrow key, as the keyboard does (onKeyDownEvt, onKeyUpEvt). | game:act |
walkTo() | Walks the player's animal to a point on the stage (940 by 580). | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onDialog() | Hears the game's popups come up and get answered. | game:read |
onJudged() | Hears a statement judged (handleEndOfQuestion): what it was, and the player's streak. | game:read |
onQuestion() | Hears a new statement put to the room (_question changing). | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.twister: Twister.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
continueResult() | Goes on from the first result card to the last (showGameCompleteDlg2, showGameOverDlg2). | game:act |
course() | Where the course stands; null when Twister is not on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
leave() | Leaves from the last result card (onExit_Yes) as from anywhere else. | game:act |
playAgain() | Flies again from the last result card (onExit_No). | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onDialog() | Hears the game's result and leave dialogs come up and get answered. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.whackPhantom: Whack a Phantom.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
closeInstructions() | Closes the instructions (onInstructions), once they have gone. | game:act |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
holes() | Every hole: whether a phantom is up in it, and of which kind. | game:read |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepSecondsLeft() | Holds the clock at seconds (above 0, at most 45) while the game is on screen. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
play() | Starts a round from the menu or the results (onStart_Yes), once the dialog has gone. | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
setHighScore() | Sets the high score and its counter on screen. | game:act |
setScore() | Sets the round's score and its counter on screen; not once the round is over. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
whack() | Whacks a hole (0 to 13), as clicking it does; resolves with the score after. | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
minigames.windRider: Wind Rider.
| Member | What it does | Plugins |
|---|---|---|
className | The game's class, as the client names it. | game:read |
answerLeave() | Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on. | game:act |
answerPrize() | Keeps or turns down the prize on offer (keptItem / rejectedItem). | game:act |
askToLeave() | Asks to leave, as the game's close button does: the game puts up its question and pauses. | game:act |
client() | The game's own class, typed, reached through the manager each time, so it is always the game on screen. | game:read |
dialog() | The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen. | game:read |
finish() | Leaves from a finished climb's card, won or lost (onExit_Yes), once the game is gone. | game:act |
isRunning() | Whether this game is the one on screen. | game:read |
keep() | Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there. | game:act |
keepRiseSpeed() | Holds the player's own rider rising at speed (_currentVelocity.y), until stopped. | game:act |
leave() | Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). | game:act |
playAgain() | Plays another round once one is over, as the game's own "play again" does. | game:act |
riders() | Every rider, the player's own flagged local; none when the game is not on screen. | game:read |
set() | Writes the game's writable fields once, and resolves with the state after. | game:act |
state() | The game's state, read in one message; null unless this game is on screen. | game:read |
steer() | Presses or lets go of an arrow, as the keyboard does (keyHandleDown / keyHandleUp). | game:act |
takeGem() | Picks up one of the loose gems by its index (gemPickup). | game:act |
whenState() | Waits for the game's state to pass test, and resolves with it. | game:read |
onState() | Hears the game's state change, with the state before. | game:read |
Methods
chat
chat(message: string, options?: ActOptions) => Promise<void>Says something in the game's chat (MinigameManager.sendChatMsg).
Parameters
| Name | Type | |
|---|---|---|
message | string | |
options optional | ActOptions |
Returns
Promise<void>
Types
current
current() => Promise<RunningMinigame | null>The game on screen, whichever it is, read from its GameBase; null when there is none.
Returns
Promise<RunningMinigame \| null>
Types
end
end(options?: ActOptions) => Promise<void>Ends the game on screen as the server's me would (GameBase.end(null)): the game shows how it ended and stays until left. Only once its scene has loaded.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
feed
feed(data: readonly (string | number)[], options?: ActOptions) => Promise<void>Hands the game on screen a message as if the server had sent it (messageGame). Local only.
Parameters
| Name | Type | |
|---|---|---|
data | readonly (string | number)[] | |
options optional | ActOptions |
Returns
Promise<void>
Types
isPlaying
isPlaying() => Promise<boolean>Whether the player is in a minigame, as the client reckons it (inMinigame): two player games, custom games and adventure combat are not counted.
Returns
Promise<boolean>
keepAwake
keepAwake(options?: ActOptions & { everyFrames?: number | undefined; always?: boolean | undefined; }) => Promise<Running>Keeps a long game from timing out: the client's own keepAlive, called in the game about once a second while a game runs (always for every moment). Stop the handle to end it.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions & { everyFrames?: number | undefined; always?: boolean | undefined; } |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions & { rejoin?: boolean | undefined; }) => Promise<void>Leaves the game the way every close button does (MinigameManager.leave): back to the room the player came from. Resolves once the client is out of it.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions & { rejoin?: boolean | undefined; } |
Returns
Promise<void>
Types
play
play(gameDefId: number, options?: ActOptions & { skipGameCard?: boolean | undefined; }) => Promise<PendingMinigame>Opens a game as clicking it in the world does (handleGameClick): its game card, or with skipGameCard the game itself. Resolves with the game once the client has it lined up; throws TIMEOUT when the client puts up a refusal instead (no pet for a pet game, not a member).
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number | |
options optional | ActOptions & { skipGameCard?: boolean | undefined; } |
Returns
Promise<PendingMinigame>
Types
playerInfo
playerInfo() => Promise<MinigamePlayerInfo>What the client tells every game about the player: the active pet's name, membership.
Returns
Promise<MinigamePlayerInfo>
Types
quit
quit(options?: ActOptions) => Promise<void>Tells the server the player left an in-room game (sendMinigameLeaveRequest, ml) without the client closing it, and resolves once it has gone out.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
send
send(data: readonly (string | number)[], options?: ActOptions) => Promise<void>Sends the game's own message to the server, as the game does (MinigameManager.msg, which puts the game's id in front: %xt%o%mm%<room>%<gameDefId>%<data>…), once it has gone out.
Parameters
| Name | Type | |
|---|---|---|
data | readonly (string | number)[] | |
options optional | ActOptions |
Returns
Promise<void>
Types
status
status() => Promise<MinigameStatus>Where the client stands with minigames, and the game it has lined up.
Returns
Promise<MinigameStatus>
Types
whenPlaying
whenPlaying(options?: ActOptions & { playing?: boolean | undefined; }) => Promise<void>Waits for the player to be in a minigame (or, with playing: false, out of one), and resolves once they are. 30 seconds by default.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions & { playing?: boolean | undefined; } |
Returns
Promise<void>
Types
Events
onEnd
onEnd(listener: (data: string[]) => void) => () => voidHears the server end the game (me).
Parameters
| Name | Type | |
|---|---|---|
listener | (data: string[]) => void |
Returns
() => void. Call it to stop listening.
onGameClosed
onGameClosed(listener: (closed: MinigameClosed) => void) => () => voidHears the game closed (MinigameManager.leave), with the gems it paid.
Parameters
| Name | Type | |
|---|---|---|
listener | (closed: MinigameClosed) => void |
Returns
() => void. Call it to stop listening.
Types
onGameCreated
onGameCreated(listener: (created: MinigameMoment) => void) => () => voidHears the game's class built and put on screen (startGameLoaded).
Parameters
| Name | Type | |
|---|---|---|
listener | (created: MinigameMoment) => void |
Returns
() => void. Call it to stop listening.
Types
onGameLoaded
onGameLoaded(listener: (loaded: MinigameMoment) => void) => () => voidHears the game's scene finish loading.
Parameters
| Name | Type | |
|---|---|---|
listener | (loaded: MinigameMoment) => void |
Returns
() => void. Call it to stop listening.
Types
onGameOver
onGameOver(listener: (over: MinigameOver) => void) => () => voidHears the server end the game (minigameEndResponse), with what it sent and the gems paid.
Parameters
| Name | Type | |
|---|---|---|
listener | (over: MinigameOver) => void |
Returns
() => void. Call it to stop listening.
Types
onGameStarting
onGameStarting(listener: (starting: MinigameStarting) => void) => () => voidHears the client start building a game (startGame), with its players and data.
Parameters
| Name | Type | |
|---|---|---|
listener | (starting: MinigameStarting) => void |
Returns
() => void. Call it to stop listening.
Types
onMessage
onMessage(listener: (data: string[]) => void) => () => voidHears the server's messages to the game (mm), as it sent them.
Parameters
| Name | Type | |
|---|---|---|
listener | (data: string[]) => void |
Returns
() => void. Call it to stop listening.
onPlayerLeft
onPlayerLeft(listener: (data: string[]) => void) => () => voidHears a player leave the game (ml).
Parameters
| Name | Type | |
|---|---|---|
listener | (data: string[]) => void |
Returns
() => void. Call it to stop listening.
onPlaying
onPlaying(listener: (playing: { playing: boolean; inRoomGame: boolean; }) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the player go into a minigame and come out of one, as isPlaying reckons it.
Parameters
| Name | Type | |
|---|---|---|
listener | (playing: { playing: boolean; inRoomGame: boolean; }) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
onRoomRemoved
onRoomRemoved(listener: (room: number) => void) => () => voidHears the game's room removed (mr).
Parameters
| Name | Type | |
|---|---|---|
listener | (room: number) => void |
Returns
() => void. Call it to stop listening.
onStart
onStart(listener: (start: { room: number; playerIds: number[]; data: string[]; }) => void) => () => voidHears a game start (ms): its room and players, and the game's own data.
Parameters
| Name | Type | |
|---|---|---|
listener | (start: { room: number; playerIds: number[]; data: string[]; }) => void |
Returns
() => void. Call it to stop listening.
minigames.lobby
Asking for a seat and waiting for players: phantom.aj.minigames.lobby. The waiting list is read from MinigameManager's own fields; the requests go through MinigameXtCommManager and are confirmed by the server's answer.
current
current() => Promise<MinigameLobby>The waiting list as the client holds it: who waits, how many a game needs, where to go back.
Returns
Promise<MinigameLobby>
Types
join
join(gameDefId: number, options?: ActOptions & MinigameJoinOptions) => Promise<MinigameSeat>Asks the server for a seat (sendMinigameJoinRequest, mj), and resolves with the seat and who waits with the player. Throws REFUSED with the server's reason (pf a pet the game needs, mo an ocean animal, as another animal, hc, ul).
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number | |
options optional | ActOptions & MinigameJoinOptions |
Returns
Promise<MinigameSeat>
Types
startNow
startNow(gameDefId: number, options?: ActOptions & { subRoom?: boolean | undefined; }) => Promise<{ playerIds: number[]; }>Starts a waiting game now, without waiting for more players (sendMinigameStartRequest), and resolves with the players once the server starts it.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number | |
options optional | ActOptions & { subRoom?: boolean | undefined; } |
Returns
Promise<{ playerIds: number[]; }>
Types
onButton
onButton(listener: (press: MinigameLobbyPress) => void) => () => voidHears the waiting list's own buttons pressed: one player, many, start now, close.
Parameters
| Name | Type | |
|---|---|---|
listener | (press: MinigameLobbyPress) => void |
Returns
() => void. Call it to stop listening.
Types
onChange
onChange(listener: (lobby: MinigameLobbyChange) => void) => () => voidHears the waiting list change, as the client fills it from the server's answer.
Parameters
| Name | Type | |
|---|---|---|
listener | (lobby: MinigameLobbyChange) => void |
Returns
() => void. Call it to stop listening.
Types
onJoinRequest
onJoinRequest(listener: (join: { gameDefId: number; multiplayer: boolean; proModeId: number; hostUserId: number; }) => void) => () => voidHears the client ask for a seat (mj going out), however it was asked.
Parameters
| Name | Type | |
|---|---|---|
listener | (join: { gameDefId: number; multiplayer: boolean; proModeId: number; hostUserId: number; }) => void |
Returns
() => void. Call it to stop listening.
onJoinResult
onJoinResult(listener: (answer: { joined: boolean; refusal: string | null; waitingUserIds: number[]; }) => void) => () => voidHears the server's answer to a request for a seat (mj).
Parameters
| Name | Type | |
|---|---|---|
listener | (answer: { joined: boolean; refusal: string | null; waitingUserIds: number[]; }) => void |
Returns
() => void. Call it to stop listening.
minigames.pvp
Two player games: phantom.aj.minigames.pvp. Challenges sent and answered through MinigameXtCommManager.sendMinigamePvpMsg (mp), offers to play put up on the player's own animal (UserCommXtCommManager.sendCustomPVPMessage), and the game the client is lined up for, read from MinigameManager._pvp*.
current
current() => Promise<MinigamePvpState | null>The two player game the client is lined up for, or null for none.
Returns
Promise<MinigamePvpState \| null>
Types
invite
invite(gameDefId: number, userName: string, options?: ActOptions) => Promise<void>Challenges a player to a two player game (mp, action 0), once the challenge has gone out.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number | |
userName | string | |
options optional | ActOptions |
Returns
Promise<void>
Types
isOffering
isOffering() => Promise<boolean>Whether the player's own offer to play is up on their animal (isMyUserInCustomPVPState).
Returns
Promise<boolean>
joinOffered
joinOffered(gameDefId: number, userName: string, options?: ActOptions) => Promise<void>Takes up another player's offer to play (sendMinigameCustomPvpJoinMsg), once it has gone out.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number | |
userName | string | |
options optional | ActOptions |
Returns
Promise<void>
Types
offer
offer(gameDefId: number, options?: ActOptions & { open?: boolean | undefined; }) => Promise<void>Puts the player's own offer to play up on their animal, or takes it down (open: false), and resolves once the client shows it so.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number | |
options optional | ActOptions & { open?: boolean | undefined; } |
Returns
Promise<void>
Types
ready
ready(gameDefId: number, userName: string | null, options?: ActOptions & { ready?: boolean | undefined; }) => Promise<MinigamePvpState | null>Lines the client up for a two player game against userName (readySelfForPvpGame), or stands it down with ready: false. Resolves with what the client is lined up for after.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number | |
userName | string | null | |
options optional | ActOptions & { ready?: boolean | undefined; } |
Returns
Promise<MinigamePvpState \| null>
Types
respond
respond(gameDefId: number, accept: boolean, options?: ActOptions) => Promise<void>Accepts a challenge, or turns it down (mp, action 0 or 1), once the answer has gone out.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number | |
accept | boolean | |
options optional | ActOptions |
Returns
Promise<void>
Types
onButton
onButton(listener: (press: MinigamePvpPress) => void) => () => voidHears the challenge popup's buttons, and the "play again?" after a two player game.
Parameters
| Name | Type | |
|---|---|---|
listener | (press: MinigamePvpPress) => void |
Returns
() => void. Call it to stop listening.
Types
onChange
onChange(listener: (pvp: MinigamePvpState | null) => void) => () => voidHears the client line up for a two player game, or stand down (null).
Parameters
| Name | Type | |
|---|---|---|
listener | (pvp: MinigamePvpState | null) => void |
Returns
() => void. Call it to stop listening.
Types
onInvite
onInvite(listener: (invite: MinigamePvpInvite) => void) => () => voidHears a challenge, or the answer to one (mp).
Parameters
| Name | Type | |
|---|---|---|
listener | (invite: MinigamePvpInvite) => void |
Returns
() => void. Call it to stop listening.
Types
minigames.scores
Scores, gem and pet mastery awards, and leaderboards: phantom.aj.minigames.scores.
Awards and scores go to the server folded with serials the server hands out (mg, ma), which the client throws away as it uses them. So the last serials heard are the one thing this area keeps, from the server's mg and ma as they arrive, to unfold what the client sends (onGemAward, onScore). Everything else is read from MinigameManager.
awardGems
awardGems(amount: number, gameDefId: number, options?: ActOptions) => Promise<void>Awards gems for a game (MinigameManager.awardGems), and resolves once the award has gone out. The client holds it until the server hands it a serial.
Parameters
| Name | Type | |
|---|---|---|
amount | number | |
gameDefId | number | |
options optional | ActOptions |
Returns
Promise<void>
Types
awardPetMastery
awardPetMastery(amount: number, options?: ActOptions) => Promise<void>Awards the active pet mastery points (awardPetMasteryPoints), once the award has gone out.
Parameters
| Name | Type | |
|---|---|---|
amount | number | |
options optional | ActOptions |
Returns
Promise<void>
Types
cached
cached(gameDefId: number) => Promise<CachedMinigameLeaderboard | null>A game's leaderboards as the client cached them for its game card, or null for none.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number |
Returns
Promise<CachedMinigameLeaderboard \| null>
Types
commit
commit(options?: ActOptions) => Promise<void>Has the game on screen send the score it tracked (GameBase.valueTrackerCommit).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
leaderboard
leaderboard(gameDefId: number, options?: ActOptions) => Promise<MinigameLeaderboard>Asks for a game's three leaderboards (sendMinigameLeaderboardRequest, mlb), and resolves with them; REFUSED when the server has none for it.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number | |
options optional | ActOptions |
Returns
Promise<MinigameLeaderboard>
Types
pending
pending() => Promise<MinigamePendingAwards>The client's serials, and the awards it holds until a serial comes.
Returns
Promise<MinigamePendingAwards>
Types
submit
submit(gameDefId: number, score: number, options?: ActOptions & { leaderboardUserVarRef?: number | undefined; }) => Promise<MinigameScore>Sends a score for a game, folded as MinigameManager.sendScore folds it with the client's score serial, onto the game's leaderboard (its leaderboardUserVarRef, from the catalog unless given). Resolves with the score once it has gone out; NOT_READY with no serial, REFUSED for a game with no leaderboard.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number | |
score | number | |
options optional | ActOptions & { leaderboardUserVarRef?: number | undefined; } |
Returns
Promise<MinigameScore>
Types
onGemAward
onGemAward(listener: (sent: MinigameAwardSent) => void) => () => voidHears a gem award go out, unfolded with the serial last heard.
Parameters
| Name | Type | |
|---|---|---|
listener | (sent: MinigameAwardSent) => void |
Returns
() => void. Call it to stop listening.
Types
onGemsEarned
onGemsEarned(listener: (payout: MinigamePayout) => void) => () => voidHears a game pay gems (GameBase.addGemsToBalance), with the run's total.
Parameters
| Name | Type | |
|---|---|---|
listener | (payout: MinigamePayout) => void |
Returns
() => void. Call it to stop listening.
Types
onGemSerial
onGemSerial(listener: (serial: MinigameGemSerial) => void) => () => voidHears the server hand out the serial the next gem award goes with (mg).
Parameters
| Name | Type | |
|---|---|---|
listener | (serial: MinigameGemSerial) => void |
Returns
() => void. Call it to stop listening.
Types
onLeaderboard
onLeaderboard(listener: (board: MinigameLeaderboard) => void) => () => voidHears a game's leaderboards arrive (mlb), however they were asked for.
Parameters
| Name | Type | |
|---|---|---|
listener | (board: MinigameLeaderboard) => void |
Returns
() => void. Call it to stop listening.
Types
onMasterySerial
onMasterySerial(listener: (serial: MinigameMasterySerial) => void) => () => voidHears the server hand out the serial the next pet mastery award goes with (ma).
Parameters
| Name | Type | |
|---|---|---|
listener | (serial: MinigameMasterySerial) => void |
Returns
() => void. Call it to stop listening.
Types
onPetMasteryAward
onPetMasteryAward(listener: (sent: MinigameAwardSent) => void) => () => voidHears a pet mastery award go out, unfolded with the serial last heard.
Parameters
| Name | Type | |
|---|---|---|
listener | (sent: MinigameAwardSent) => void |
Returns
() => void. Call it to stop listening.
Types
onPetMasteryEarned
onPetMasteryEarned(listener: (payout: MinigamePayout) => void) => () => voidHears a game pay pet mastery (GameBase.addToPetMastery).
Parameters
| Name | Type | |
|---|---|---|
listener | (payout: MinigamePayout) => void |
Returns
() => void. Call it to stop listening.
Types
onRound
onRound(listener: (round: MinigameRound) => void, options?: { settleMs?: number | undefined; }) => () => voidHears a run of a game finish, with what it came to: the score sent, the gems claimed, and the server's end, gathered as they arrive within settleMs (a second) of each other.
Parameters
| Name | Type | |
|---|---|---|
listener | (round: MinigameRound) => void | |
options optional | { settleMs?: number | undefined; } |
Returns
() => void. Call it to stop listening.
Types
onScore
onScore(listener: (sent: MinigameScoreSent) => void) => () => voidHears a score go out (msv), unfolded with the score serial last heard.
Parameters
| Name | Type | |
|---|---|---|
listener | (sent: MinigameScoreSent) => void |
Returns
() => void. Call it to stop listening.
Types
minigames.catalog
What the client knows of each game: phantom.aj.minigames.catalog. Games are described by the server (mi) and kept in MinigameManager.minigameInfoCache; a definition is read off the cache in one chain (the lookup and its fields together), so nothing is held.
describe
describe(gameDefIds: readonly number[], options?: ActOptions) => Promise<MinigameInfo[]>Asks the server to describe games (sendMinigameInfoRequest, mi), and resolves with them once it has; the client keeps them in its cache as ever.
Parameters
| Name | Type | |
|---|---|---|
gameDefIds | readonly number[] | |
options optional | ActOptions |
Returns
Promise<MinigameInfo[]>
Types
get
get(game: string | number) => Promise<MinigameInfo | null>One game as the client's cache holds it, by definition id, or by the name of its server extension or movie (getMinigameInfoByExtName, BySwfName). Null when the client has not been told of it.
Parameters
| Name | Type | |
|---|---|---|
game | string | number |
Returns
Promise<MinigameInfo \| null>
Types
name
name(gameDefId: number) => Promise<string>A game's title in the player's own language (getGameName); empty when the client has none.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number |
Returns
Promise<string>
nameId
nameId(gameDefId: number) => Promise<number | null>The localization string id of a game's title (getGameNameId), or null.
Parameters
| Name | Type | |
|---|---|---|
gameDefId | number |
Returns
Promise<number \| null>
pvpGames
pvpGames() => Promise<MinigameInfo[]>The games two players can play against each other (getAllReadyForPvpGameDefs).
Returns
Promise<MinigameInfo[]>
Types
signClass
signClass() => Promise<string | null>The class the client builds the games' world signs from (MinigameManager.GameTotem).
Returns
Promise<string \| null>
onDescribed
onDescribed(listener: (games: MinigameInfo[]) => void) => () => voidHears the server describe games (mi).
Parameters
| Name | Type | |
|---|---|---|
listener | (games: MinigameInfo[]) => void |
Returns
() => void. Call it to stop listening.
Types
minigames.screen
Any game on screen, the same way for every game: phantom.aj.minigames.screen. Its own plain fields, its dialogs, its buttons and the player's presses, for a game with no area of its own and for what every game shares.
fieldNames
fieldNames() => Promise<MinigameField[] | null>The plain fields of the game on screen's own class (numbers, strings, flags), the ones a Sprite has left out, or null when no game is on screen.
Returns
Promise<MinigameField[] \| null>
Types
fields
fields(names?: readonly string[] | undefined) => Promise<MinigameFields | null>The values of the game on screen's fields, by name: the ones named, or all its plain fields. Null when no game is on screen.
Parameters
| Name | Type | |
|---|---|---|
names optional | readonly string[] | undefined |
Returns
Promise<MinigameFields \| null>
Types
onButton
onButton(listener: (press: MinigameButtonPress) => void) => () => voidHears any game's button pressed (GuiButton.mouseClick), with what the button is for.
Parameters
| Name | Type | |
|---|---|---|
listener | (press: MinigameButtonPress) => void |
Returns
() => void. Call it to stop listening.
Types
onDialog
onDialog(listener: (dialog: MinigameDialog) => void) => () => voidHears any game put up one of its dialogs (GameBase.showDlg) or take it down (hideDlg).
Parameters
| Name | Type | |
|---|---|---|
listener | (dialog: MinigameDialog) => void |
Returns
() => void. Call it to stop listening.
Types
onFields
onFields(names: readonly string[], listener: (change: MinigameFieldsChange) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears fields of the game on screen change (at most 62), read in the game every few frames, with the values before and which changed. A game starting and ending is told too (className null once it has gone).
Parameters
| Name | Type | |
|---|---|---|
names | readonly string[] | |
listener | (change: MinigameFieldsChange) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
Types
onGameCardButton
onGameCardButton(listener: (press: MinigameCardPress) => void) => () => voidHears the game card's buttons: play, pro, instructions, its pages and its leaderboards.
Parameters
| Name | Type | |
|---|---|---|
listener | (press: MinigameCardPress) => void |
Returns
() => void. Call it to stop listening.
Types
onIdleWarningDismissed
onIdleWarningDismissed(listener: (game: { className: string | null; }) => void) => () => voidHears the player dismiss the three-minute idle warning (onKickWarningPopup).
Parameters
| Name | Type | |
|---|---|---|
listener | (game: { className: string | null; }) => void |
Returns
() => void. Call it to stop listening.
onPause
onPause(listener: (pause: { className: string; paused: boolean; }) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears any game pause or play on (GameBase._pauseGame), as its dialogs come and go.
Parameters
| Name | Type | |
|---|---|---|
listener | (pause: { className: string; paused: boolean; }) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
onPress
onPress(listener: (press: MinigamePress) => void) => () => voidHears the player press anywhere in a game (the stage's mouseDown, which every game hears).
Parameters
| Name | Type | |
|---|---|---|
listener | (press: MinigamePress) => void |
Returns
() => void. Call it to stop listening.
Types
minigames.joinGames
The games list: phantom.aj.minigames.joinGames.
all
all() => Promise<GameOnOffer[]>The games the list offers, in its order; none when it is not open.
Returns
Promise<GameOnOffer[]>
Types
press
press(index: number, options?: ActOptions) => Promise<GameOnOffer>Presses one of the games, as the player does, which asks to join it.
Parameters
| Name | Type | |
|---|---|---|
index | number | |
options optional | ActOptions |
Returns
Promise<GameOnOffer>
Types
setGames
setGames(defIds: readonly number[], options?: ActOptions) => Promise<number[]>Fills the list with games of your own choosing, by definition id, as the server's list would (onGameListLoaded). Only games the client knows are kept; resolves with them.
Parameters
| Name | Type | |
|---|---|---|
defIds | readonly number[] | |
options optional | ActOptions |
Returns
Promise<number[]>
Types
onReady
onReady(listener: (games: number) => void) => () => voidHears the list drawn, with how many games it offers.
Parameters
| Name | Type | |
|---|---|---|
listener | (games: number) => void |
Returns
() => void. Call it to stop listening.
minigames.bowling
Bowling.
className
className: "game.pVP_Bowling.PVP_Bowling"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<BowlingState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<BowlingState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<BowlingState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<BowlingState>
Types
bowl
bowl(options?: ActOptions) => Promise<BowlingState>Bowls, as Enter does (onKeyDown), on the player's turn; resolves once the turn has passed.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<BowlingState>
Types
client
client() => TypedFlash<PVP_Bowling>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PVP_Bowling>
Types
TypedFlash · FlashRead · FlashWrite · HoldOptions · HookTest · FlashArgumentLike · FlashPlace · FlashValue · FlashArgument · FlashData · AnyFlash · FlashMethod · FlashConstructor
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
emote
emote(emote: number, options?: ActOptions) => Promise<BowlingState>Shows an emote over the player's lane (the scene's emoteClicked, which its script sends).
Parameters
| Name | Type | |
|---|---|---|
emote | number | |
options optional | ActOptions |
Returns
Promise<BowlingState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
KeepOptions · ActOptions · Running
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<BowlingState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<BowlingState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<BowlingState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<BowlingState>
Types
state
state() => Promise<BowlingState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<BowlingState \| null>
Types
whenState
whenState(test: (state: BowlingState) => boolean, options?: ActOptions) => Promise<BowlingState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: BowlingState) => boolean | |
options optional | ActOptions |
Returns
Promise<BowlingState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: BowlingState | null, previous: BowlingState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: BowlingState | null, previous: BowlingState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
Types
minigames.bradyChemistrySet
Brady’s Chemistry Set.
className
className: "game.bradyChemistrySet.BradyChemistrySet"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<BradyChemistrySetState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<BradyChemistrySetState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<BradyChemistrySetState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<BradyChemistrySetState>
Types
client
client() => TypedFlash<BradyChemistrySet>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<BradyChemistrySet>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<BradyChemistrySetState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<BradyChemistrySetState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<BradyChemistrySetState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<BradyChemistrySetState>
Types
state
state() => Promise<BradyChemistrySetState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<BradyChemistrySetState \| null>
Types
whenState
whenState(test: (state: BradyChemistrySetState) => boolean, options?: ActOptions) => Promise<BradyChemistrySetState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: BradyChemistrySetState) => boolean | |
options optional | ActOptions |
Returns
Promise<BradyChemistrySetState>
Types
ActOptions · BradyChemistrySetState
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: BradyChemistrySetState | null, previous: BradyChemistrySetState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: BradyChemistrySetState | null, previous: BradyChemistrySetState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
Types
minigames.bradyExpeditions
Brady Barr’s Expeditions.
className
className: "game.bradyExpeditions.BradyExpeditions"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<BradyExpeditionsState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<BradyExpeditionsState \| null>
Types
answerPrize
answerPrize(keep: boolean, options?: ActOptions) => Promise<BradyExpeditionsState>Keeps or turns down the prize offered (keptItem, rejectedItem), once it has gone.
Parameters
| Name | Type | |
|---|---|---|
keep | boolean | |
options optional | ActOptions |
Returns
Promise<BradyExpeditionsState>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<BradyExpeditionsState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<BradyExpeditionsState>
Types
begin
begin(options?: ActOptions) => Promise<BradyExpeditionsState>Starts the story from its first screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<BradyExpeditionsState>
Types
chapters
chapters() => Promise<BradyExpeditionsChapter[]>The chapters the chapter window lists, with their titles; none when it has none.
Returns
Promise<BradyExpeditionsChapter[]>
choose
choose(choice: number, options?: ActOptions) => Promise<BradyExpeditionsState>Takes one of the paths a part offers (1 to 3, as its windows number them).
Parameters
| Name | Type | |
|---|---|---|
choice | number | |
options optional | ActOptions |
Returns
Promise<BradyExpeditionsState>
Types
chooseChapter
chooseChapter(index: number, options?: ActOptions) => Promise<BradyExpeditionsState>Opens a chapter from the chapter window, by its place in chapters(); not a locked one.
Parameters
| Name | Type | |
|---|---|---|
index | number | |
options optional | ActOptions |
Returns
Promise<BradyExpeditionsState>
Types
client
client() => TypedFlash<BradyExpeditions>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<BradyExpeditions>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Closes the game with its close button, once it is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<BradyExpeditionsState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<BradyExpeditionsState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<BradyExpeditionsState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<BradyExpeditionsState>
Types
state
state() => Promise<BradyExpeditionsState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<BradyExpeditionsState \| null>
toggleSound
toggleSound(options?: ActOptions) => Promise<BradyExpeditionsState>Turns the sound on or off, as its button does.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<BradyExpeditionsState>
Types
whenState
whenState(test: (state: BradyExpeditionsState) => boolean, options?: ActOptions) => Promise<BradyExpeditionsState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: BradyExpeditionsState) => boolean | |
options optional | ActOptions |
Returns
Promise<BradyExpeditionsState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: BradyExpeditionsState | null, previous: BradyExpeditionsState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: BradyExpeditionsState | null, previous: BradyExpeditionsState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.candyCatcher
Candy Catcher.
className
className: "game.candyCatcher.CandyCatcher"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<CandyCatcherState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<CandyCatcherState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<CandyCatcherState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<CandyCatcherState>
Types
client
client() => TypedFlash<CandyCatcher>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<CandyCatcher>
Types
Example
closeInstructions
closeInstructions(options?: ActOptions) => Promise<CandyCatcherState>Closes the instructions (onInstructions).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<CandyCatcherState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"tickets" | "score" | "secondsLeft" | "highScore" | "scoreText" | "highScoreText", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"tickets" | "score" | "secondsLeft" | "highScore" | "scoreText" | "highScoreText", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
play
play(play?: boolean, options?: ActOptions) => Promise<CandyCatcherState | null>Answers the play dialog or the results' play again: play (onStart_Yes, which pays the gems) or not (onStart_No, which leaves). With too few gems only "not" is open.
Parameters
| Name | Type | |
|---|---|---|
play optional | boolean | |
options optional | ActOptions |
Returns
Promise<CandyCatcherState \| null>
Types
playAgain
playAgain(options?: ActOptions) => Promise<CandyCatcherState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<CandyCatcherState>
Types
set
set(values: Partial<Record<"tickets" | "score" | "secondsLeft" | "highScore" | "scoreText" | "highScoreText", FieldValue>>, options?: ActOptions) => Promise<CandyCatcherState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"tickets" | "score" | "secondsLeft" | "highScore" | "scoreText" | "highScoreText", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<CandyCatcherState>
Types
setHighScore
setHighScore(score: number, options?: ActOptions) => Promise<CandyCatcherState>Writes the high score and its counter.
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<CandyCatcherState>
Types
setScore
setScore(score: number, options?: ActOptions) => Promise<CandyCatcherState>Writes the score and its counter.
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<CandyCatcherState>
Types
state
state() => Promise<CandyCatcherState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<CandyCatcherState \| null>
whenState
whenState(test: (state: CandyCatcherState) => boolean, options?: ActOptions) => Promise<CandyCatcherState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: CandyCatcherState) => boolean | |
options optional | ActOptions |
Returns
Promise<CandyCatcherState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: CandyCatcherState | null, previous: CandyCatcherState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: CandyCatcherState | null, previous: CandyCatcherState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.connectFour
Connect Four.
className
className: "game.pVP_ConnectFour.PVP_ConnectFour"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<ConnectFourState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<ConnectFourState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<ConnectFourState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ConnectFourState>
Types
board
board() => Promise<ConnectFourBoard>The board as the server has filled it this round; empty when no round has been heard.
Returns
Promise<ConnectFourBoard>
client
client() => TypedFlash<PVP_ConnectFour>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PVP_ConnectFour>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
drop
drop(column: number, options?: ActOptions) => Promise<ConnectFourDropped>Drops a counter down a column (0 to 6), on the player's turn, and resolves with the row it landed in once the server says. Throws REFUSED when the server calls the move invalid.
Parameters
| Name | Type | |
|---|---|---|
column | number | |
options optional | ActOptions |
Returns
Promise<ConnectFourDropped>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"turnLeft", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"turnLeft", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<ConnectFourState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ConnectFourState>
Types
seats
seats() => Promise<[ConnectFourSeat, ConnectFourSeat] | null>The two seats: each player's animal name and kind, and whether it is drawn.
Returns
Promise<[ConnectFourSeat, ConnectFourSeat] \| null>
set
set(values: Partial<Record<"turnLeft", FieldValue>>, options?: ActOptions) => Promise<ConnectFourState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"turnLeft", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<ConnectFourState>
Types
state
state() => Promise<ConnectFourState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<ConnectFourState \| null>
whenState
whenState(test: (state: ConnectFourState) => boolean, options?: ActOptions) => Promise<ConnectFourState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: ConnectFourState) => boolean | |
options optional | ActOptions |
Returns
Promise<ConnectFourState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onDropped
onDropped(listener: (dropped: ConnectFourDropped) => void) => () => voidHears a counter dropped (mark), by either player, with the row it landed in.
Parameters
| Name | Type | |
|---|---|---|
listener | (dropped: ConnectFourDropped) => void |
Returns
() => void. Call it to stop listening.
onRoundEnd
onRoundEnd(listener: (outcome: ConnectFourOutcome) => void) => () => voidHears a round end: won, lost or tied on a drop, or won when the opponent leaves (ml).
Parameters
| Name | Type | |
|---|---|---|
listener | (outcome: ConnectFourOutcome) => void |
Returns
() => void. Call it to stop listening.
onRoundStart
onRoundStart(listener: (round: ConnectFourRound) => void) => () => voidHears a round begin (round): who the opponent is and whether the player goes first.
Parameters
| Name | Type | |
|---|---|---|
listener | (round: ConnectFourRound) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: ConnectFourState | null, previous: ConnectFourState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: ConnectFourState | null, previous: ConnectFourState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.cottonCandy
Cotton Candy.
className
className: "game.cottonCandy.CottonCandy"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<CottonCandyState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<CottonCandyState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<CottonCandyState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<CottonCandyState>
Types
client
client() => TypedFlash<CottonCandy>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<CottonCandy>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<CottonCandyState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<CottonCandyState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<CottonCandyState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<CottonCandyState>
Types
state
state() => Promise<CottonCandyState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<CottonCandyState \| null>
whenState
whenState(test: (state: CottonCandyState) => boolean, options?: ActOptions) => Promise<CottonCandyState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: CottonCandyState) => boolean | |
options optional | ActOptions |
Returns
Promise<CottonCandyState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: CottonCandyState | null, previous: CottonCandyState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: CottonCandyState | null, previous: CottonCandyState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.distanceChallenge
Long Shot.
className
className: "game.distanceChallenge.DistanceChallenge"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<DistanceChallengeState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<DistanceChallengeState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<DistanceChallengeState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<DistanceChallengeState>
Types
client
client() => TypedFlash<DistanceChallenge>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<DistanceChallenge>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
finish
finish(options?: ActOptions) => Promise<void>Takes the gems and leaves once a throw's results are up (onGreatJob_No).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"speedX" | "speedY", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"speedX" | "speedY", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepSpeed
keepSpeed(x: number, options?: KeepOptions & ActOptions) => Promise<Running>Holds the forward speed, every frame, until the handle is stopped.
Parameters
| Name | Type | |
|---|---|---|
x | number | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
launch
launch(options?: ActOptions) => Promise<DistanceChallengeState>Lets go, as the player's click does (mouseClickHandler); resolves once the throw is in the air.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<DistanceChallengeState>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<DistanceChallengeState>Throws again once a throw's results are up (onGreatJob_Yes); resolves with the new throw.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<DistanceChallengeState>
Types
set
set(values: Partial<Record<"speedX" | "speedY", FieldValue>>, options?: ActOptions) => Promise<DistanceChallengeState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"speedX" | "speedY", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<DistanceChallengeState>
Types
setVelocity
setVelocity(x: number, y: number, options?: ActOptions) => Promise<DistanceChallengeState>Sets the flier's speed in flight, held to the launcher's own limits; resolves with the throw.
Parameters
| Name | Type | |
|---|---|---|
x | number | |
y | number | |
options optional | ActOptions |
Returns
Promise<DistanceChallengeState>
Types
state
state() => Promise<DistanceChallengeState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<DistanceChallengeState \| null>
whenState
whenState(test: (state: DistanceChallengeState) => boolean, options?: ActOptions) => Promise<DistanceChallengeState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: DistanceChallengeState) => boolean | |
options optional | ActOptions |
Returns
Promise<DistanceChallengeState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: DistanceChallengeState | null, previous: DistanceChallengeState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: DistanceChallengeState | null, previous: DistanceChallengeState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.dolphinRace
Dolphin Race.
className
className: "game.dolphinRace.DolphinRace"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<DolphinRaceState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<DolphinRaceState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<DolphinRaceState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<DolphinRaceState>
Types
client
client() => TypedFlash<DolphinRace>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<DolphinRace>
Types
Example
closeError
closeError(options?: ActOptions) => Promise<void>Closes the error dialog, which leaves the race.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
computers
computers() => Promise<{ easy: ComputerProfile; medium: ComputerProfile; hard: ComputerProfile; lanes: number; } | null>The computer racers' three profiles, and how many lanes they fill. Null off screen.
Returns
Promise<{ easy: ComputerProfile; medium: ComputerProfile; hard: ComputerProfile; lanes: number; } \| null>
data
data() => Promise<RaceData | null>The race's own data: its facts, the room's ids, its randomizers.
Returns
Promise<RaceData \| null>
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
dismissError
dismissError(errorDialog: string, options?: ActOptions) => Promise<void>Closes the error dialog, which leaves the race (onErrorExit).
Parameters
| Name | Type | |
|---|---|---|
errorDialog | string | |
options optional | ActOptions |
Returns
Promise<void>
Types
dolphins
dolphins() => Promise<DolphinRaceDolphin[]>Every dolphin, the players' and the computers'. None off screen.
Returns
Promise<DolphinRaceDolphin[]>
emote
emote(emote: "sleep" | "cool" | "sneaky" | "wink" | "tongue" | "surprise", options?: ActOptions) => Promise<DolphinRaceState>Shows an emote over the player's racer, as its button does (emoteButton).
Parameters
| Name | Type | |
|---|---|---|
emote | "sleep" | "cool" | "sneaky" | "wink" | "tongue" | "surprise" | |
options optional | ActOptions |
Returns
Promise<DolphinRaceState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"fact" | "down" | "up" | "gemsEarned" | "topSpeed" | "joinersWaiting" | "startingLineX" | "trackLength" | "nextHurdle" | "factLoading", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"fact" | "down" | "up" | "gemsEarned" | "topSpeed" | "joinersWaiting" | "startingLineX" | "trackLength" | "nextHurdle" | "factLoading", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<DolphinRaceState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<DolphinRaceState>
Types
set
set(values: Partial<Record<"fact" | "down" | "up" | "gemsEarned" | "topSpeed" | "joinersWaiting" | "startingLineX" | "trackLength" | "nextHurdle" | "factLoading", FieldValue>>, options?: ActOptions) => Promise<DolphinRaceState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"fact" | "down" | "up" | "gemsEarned" | "topSpeed" | "joinersWaiting" | "startingLineX" | "trackLength" | "nextHurdle" | "factLoading", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<DolphinRaceState>
Types
state
state() => Promise<DolphinRaceState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<DolphinRaceState \| null>
steer
steer(direction: "down" | "up" | null, options?: ActOptions) => Promise<DolphinRaceState>Steers the player's dolphin, as the arrow keys do: up or down held, or null to let go. Resolves once the game reads the arrows so.
Parameters
| Name | Type | |
|---|---|---|
direction | "down" | "up" | null | |
options optional | ActOptions |
Returns
Promise<DolphinRaceState>
Types
whenState
whenState(test: (state: DolphinRaceState) => boolean, options?: ActOptions) => Promise<DolphinRaceState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: DolphinRaceState) => boolean | |
options optional | ActOptions |
Returns
Promise<DolphinRaceState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onEmoteButton
onEmoteButton(listener: (emote: "sleep" | "cool" | "sneaky" | "wink" | "tongue" | "surprise") => void) => () => voidHears the player press one of the emote buttons (onEmote<Name>Button).
Parameters
| Name | Type | |
|---|---|---|
listener | (emote: "sleep" | "cool" | "sneaky" | "wink" | "tongue" | "surprise") => void |
Returns
() => void. Call it to stop listening.
onGameMessage
onGameMessage(listener: () => void) => () => voidHears the server's messages reach the race (message).
Parameters
| Name | Type | |
|---|---|---|
listener | () => void |
Returns
() => void. Call it to stop listening.
onInput
onInput(listener: (input: RaceInput) => void) => () => voidHears the race's keys and clicks (keyHandleDown, keyHandleUp, mouseHandleDown).
Parameters
| Name | Type | |
|---|---|---|
listener | (input: RaceInput) => void |
Returns
() => void. Call it to stop listening.
onLifecycle
onLifecycle(listener: (step: string) => void) => () => voidHears the race's own steps (start, resetGame, playerLeftGame, end, …).
Parameters
| Name | Type | |
|---|---|---|
listener | (step: string) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: DolphinRaceState | null, previous: DolphinRaceState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: DolphinRaceState | null, previous: DolphinRaceState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
onWater
onWater(listener: (event: DolphinRaceWaterEvent) => void) => () => voidHears the water drawn (inMotionEffects, boost, updatePearl, …).
Parameters
| Name | Type | |
|---|---|---|
listener | (event: DolphinRaceWaterEvent) => void |
Returns
() => void. Call it to stop listening.
minigames.dunkAPhantom
Dunk a Phantom.
className
className: "game.dunkAPhantom.DunkAPhantom"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<DunkAPhantomState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<DunkAPhantomState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<DunkAPhantomState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<DunkAPhantomState>
Types
client
client() => TypedFlash<DunkAPhantom>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<DunkAPhantom>
Types
Example
closeInstructions
closeInstructions(options?: ActOptions) => Promise<DunkAPhantomState>Closes the instructions, which starts the game (onInstructions).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<DunkAPhantomState>
Types
decline
decline(options?: ActOptions) => Promise<void>Turns the booth down (onStart_No), which leaves it; resolves once it is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"paused" | "highScore" | "ticketsWon" | "showInstructions", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"paused" | "highScore" | "ticketsWon" | "showInstructions", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
play
play(options?: ActOptions) => Promise<void>Plays a game, as the booth's yes does (onStart_Yes, which sends pg). Only while the booth offers one; resolves once the request has gone to the server.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<DunkAPhantomState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<DunkAPhantomState>
Types
set
set(values: Partial<Record<"paused" | "highScore" | "ticketsWon" | "showInstructions", FieldValue>>, options?: ActOptions) => Promise<DunkAPhantomState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"paused" | "highScore" | "ticketsWon" | "showInstructions", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<DunkAPhantomState>
Types
state
state() => Promise<DunkAPhantomState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<DunkAPhantomState \| null>
whenState
whenState(test: (state: DunkAPhantomState) => boolean, options?: ActOptions) => Promise<DunkAPhantomState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: DunkAPhantomState) => boolean | |
options optional | ActOptions |
Returns
Promise<DunkAPhantomState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: DunkAPhantomState | null, previous: DunkAPhantomState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: DunkAPhantomState | null, previous: DunkAPhantomState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.eagleFlap
Eagle Flap.
className
className: "game.eagleFlap.EagleFlap"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<EagleFlapState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<EagleFlapState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<EagleFlapState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<EagleFlapState>
Types
client
client() => TypedFlash<EagleFlap>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<EagleFlap>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
flap
flap(options?: ActOptions) => Promise<EagleFlapState>Flaps, as clicking does (the scene's fl_MouseClickHandler); not under a dialog.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<EagleFlapState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"paused", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"paused", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves: straight out from a game over dialog, otherwise by asking as the close button does.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<EagleFlapState>Plays again from either game over dialog (onRetry), once it has gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<EagleFlapState>
Types
set
set(values: Partial<Record<"paused", FieldValue>>, options?: ActOptions) => Promise<EagleFlapState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"paused", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<EagleFlapState>
Types
state
state() => Promise<EagleFlapState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<EagleFlapState \| null>
whenState
whenState(test: (state: EagleFlapState) => boolean, options?: ActOptions) => Promise<EagleFlapState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: EagleFlapState) => boolean | |
options optional | ActOptions |
Returns
Promise<EagleFlapState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: EagleFlapState | null, previous: EagleFlapState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: EagleFlapState | null, previous: EagleFlapState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.fallingPhantoms
Falling Phantoms.
className
className: "game.fallingPhantoms.FallingPhantoms"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<FallingPhantomsState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<FallingPhantomsState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<FallingPhantomsState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FallingPhantomsState>
Types
client
client() => TypedFlash<FallingPhantoms>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<FallingPhantoms>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
gemMultiplier
gemMultiplier() => Promise<number | null>What the race's gems are multiplied by (getGemMultiplier); null off screen.
Returns
Promise<number \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"startingLineX" | "trackLength" | "played" | "invincible" | "showHitBoxes" | "largeWeight" | "minAngle" | "maxAngle" | "minScale" | "maxScale" | "minFallTime" | "maxFallTime" | "tutorialEnabled" | "jumpHeld" | "newPlayersJoined" | "factIndex", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"startingLineX" | "trackLength" | "played" | "invincible" | "showHitBoxes" | "largeWeight" | "minAngle" | "maxAngle" | "minScale" | "maxScale" | "minFallTime" | "maxFallTime" | "tutorialEnabled" | "jumpHeld" | "newPlayersJoined" | "factIndex", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
leaveAtOnce
leaveAtOnce(options?: ActOptions) => Promise<void>Leaves at once, as the game's error popup does (onErrorExit); resolves once it is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
move
move(move: FallingPhantomsMove, options?: ActOptions) => Promise<FallingPhantomsState>Runs left, right or stops, as the arrows do: the arrows are written and the move sent to the other racers (messageMoveState).
Parameters
| Name | Type | |
|---|---|---|
move | FallingPhantomsMove | |
options optional | ActOptions |
Returns
Promise<FallingPhantomsState>
Types
newGame
newGame(options?: ActOptions) => Promise<FallingPhantomsState>Starts another race, as the "new game" button does (startNewGame); only while it shows.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FallingPhantomsState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<FallingPhantomsState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FallingPhantomsState>
Types
removePlayer
removePlayer(place: number, options?: ActOptions) => Promise<FallingPhantomsState>Takes a runner out of the race, as the game does when one leaves (playerLeftGame).
Parameters
| Name | Type | |
|---|---|---|
place | number | |
options optional | ActOptions |
Returns
Promise<FallingPhantomsState>
Types
set
set(values: Partial<Record<"startingLineX" | "trackLength" | "played" | "invincible" | "showHitBoxes" | "largeWeight" | "minAngle" | "maxAngle" | "minScale" | "maxScale" | "minFallTime" | "maxFallTime" | "tutorialEnabled" | "jumpHeld" | "newPlayersJoined" | "factIndex", FieldValue>>, options?: ActOptions) => Promise<FallingPhantomsState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"startingLineX" | "trackLength" | "played" | "invincible" | "showHitBoxes" | "largeWeight" | "minAngle" | "maxAngle" | "minScale" | "maxScale" | "minFallTime" | "maxFallTime" | "tutorialEnabled" | "jumpHeld" | "newPlayersJoined" | "factIndex", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<FallingPhantomsState>
Types
setComputerProfiles
setComputerProfiles(profiles: readonly ("medium" | "easy" | "hard")[], options?: ActOptions) => Promise<FallingPhantomsState>Has the computer runners run to these profiles (_aiProfiles), in order.
Parameters
| Name | Type | |
|---|---|---|
profiles | readonly ("medium" | "easy" | "hard")[] | |
options optional | ActOptions |
Returns
Promise<FallingPhantomsState>
Types
state
state() => Promise<FallingPhantomsState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<FallingPhantomsState \| null>
whenState
whenState(test: (state: FallingPhantomsState) => boolean, options?: ActOptions) => Promise<FallingPhantomsState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: FallingPhantomsState) => boolean | |
options optional | ActOptions |
Returns
Promise<FallingPhantomsState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onMessage
onMessage(listener: (message: { kind: string; parts: string[]; }) => void) => () => voidHears the server's messages to the race (message), by their first part.
Parameters
| Name | Type | |
|---|---|---|
listener | (message: { kind: string; parts: string[]; }) => void |
Returns
() => void. Call it to stop listening.
onMove
onMove(listener: (move: { what: "keyDown" | "keyUp" | "sent"; left: boolean; right: boolean; code: number; }) => void) => () => voidHears the runner's moves: sent to the others, and the arrows going down and up.
Parameters
| Name | Type | |
|---|---|---|
listener | (move: { what: "keyDown" | "keyUp" | "sent"; left: boolean; right: boolean; code: number; }) => void |
Returns
() => void. Call it to stop listening.
onPhantom
onPhantom(listener: (phantom: { what: "hitTest" | "dropped" | "multiplier"; falling: number; spare: number; secondsLeft: number; }) => void) => () => voidHears the phantoms: one dropped (getPhantom), the gem multiplier asked for, and one in every 60 hit tests (boxCollisionTest), with how many are falling.
Parameters
| Name | Type | |
|---|---|---|
listener | (phantom: { what: "hitTest" | "dropped" | "multiplier"; falling: number; spare: number; secondsLeft: number; }) => void |
Returns
() => void. Call it to stop listening.
onPhase
onPhase(listener: (now: { phase: FallingPhantomsPhase; gameState: number; was: number; }) => void) => () => voidHears the race move from one phase to the next (setGameState), with the state before.
Parameters
| Name | Type | |
|---|---|---|
listener | (now: { phase: FallingPhantomsPhase; gameState: number; was: number; }) => void |
Returns
() => void. Call it to stop listening.
onSession
onSession(listener: (step: FallingPhantomsSessionStep) => void) => () => voidHears the steps of the game's life: a runner leaving, a new race, a reset, the end.
Parameters
| Name | Type | |
|---|---|---|
listener | (step: FallingPhantomsSessionStep) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: FallingPhantomsState | null, previous: FallingPhantomsState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: FallingPhantomsState | null, previous: FallingPhantomsState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.fashionShow
Best Dressed.
className
className: "game.fashionShow.FashionShow"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<FashionShowState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<FashionShowState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<FashionShowState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
client
client() => TypedFlash<FashionShow>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<FashionShow>
Types
Example
closeDressingRoom
closeDressingRoom(how?: "button" | "now" | "demoButton", options?: ActOptions) => Promise<FashionShowState>Closes the dressing room: at once, or as its close button (or the demo's) does.
Parameters
| Name | Type | |
|---|---|---|
how optional | "button" | "now" | "demoButton" | |
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
emote
emote(emote: number, options?: ActOptions) => Promise<FashionShowState>Emotes (1 to 4) with the emote buttons, while they show.
Parameters
| Name | Type | |
|---|---|---|
emote | number | |
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
endRound
endRound(options?: ActOptions) => Promise<FashionShowState>Ends the round for the player (clientEndsRound).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
endVoting
endVoting(place?: number | undefined, options?: ActOptions) => Promise<FashionShowState>Ends voting for the player (clientEndsVoting), with a vote for a place or none.
Parameters
| Name | Type | |
|---|---|---|
place optional | number | undefined | |
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
finishOutfit
finishOutfit(options?: ActOptions) => Promise<FashionShowState>Says the outfit is done (onFinished_Yes), while dressing with the dressing room open.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"elapsed" | "stageTimer" | "votingTime" | "roundTimer" | "lastTimerValue" | "timerBlinking" | "lastTime" | "quitting" | "fillerEmote" | "waitingForPlace" | "resultsRow" | "idleAnimation" | "celebrateAnimation", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"elapsed" | "stageTimer" | "votingTime" | "roundTimer" | "lastTimerValue" | "timerBlinking" | "lastTime" | "quitting" | "fillerEmote" | "waitingForPlace" | "resultsRow" | "idleAnimation" | "celebrateAnimation", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepDressing
keepDressing(which?: "exit" | "outfit", options?: ActOptions) => Promise<FashionShowState>Goes on from "keep dressing?" or "leave?" by staying (onFinished_No, onExit_No).
Parameters
| Name | Type | |
|---|---|---|
which optional | "exit" | "outfit" | |
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
leaveAtOnce
leaveAtOnce(options?: ActOptions) => Promise<void>Leaves at once, without asking (exit); resolves once the game is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
openDialog
openDialog(dialog: "exit" | "waiting" | "finished" | "practice" | "waitingForOthers" | "nextRound", options?: ActOptions) => Promise<FashionShowState>Puts up one of the show's dialogs.
Parameters
| Name | Type | |
|---|---|---|
dialog | "exit" | "waiting" | "finished" | "practice" | "waitingForOthers" | "nextRound" | |
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<FashionShowState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
practice
practice(options?: ActOptions) => Promise<FashionShowState>Starts practice from its card (onPracticeOK).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
removePlayer
removePlayer(place: number, options?: ActOptions) => Promise<FashionShowState>Takes a player off the stage (playerLeftGame), by place.
Parameters
| Name | Type | |
|---|---|---|
place | number | |
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
set
set(values: Partial<Record<"elapsed" | "stageTimer" | "votingTime" | "roundTimer" | "lastTimerValue" | "timerBlinking" | "lastTime" | "quitting" | "fillerEmote" | "waitingForPlace" | "resultsRow" | "idleAnimation" | "celebrateAnimation", FieldValue>>, options?: ActOptions) => Promise<FashionShowState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"elapsed" | "stageTimer" | "votingTime" | "roundTimer" | "lastTimerValue" | "timerBlinking" | "lastTime" | "quitting" | "fillerEmote" | "waitingForPlace" | "resultsRow" | "idleAnimation" | "celebrateAnimation", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
state
state() => Promise<FashionShowState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<FashionShowState \| null>
vote
vote(place: number, options?: ActOptions) => Promise<FashionShowState>Votes for the player at a place (1 to 10), as its vote button does; only while voting.
Parameters
| Name | Type | |
|---|---|---|
place | number | |
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
whenState
whenState(test: (state: FashionShowState) => boolean, options?: ActOptions) => Promise<FashionShowState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: FashionShowState) => boolean | |
options optional | ActOptions |
Returns
Promise<FashionShowState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onDressing
onDressing(listener: (step: FashionShowDressingStep) => void) => () => voidHears the dressing room and the stage being made up, step by step.
Parameters
| Name | Type | |
|---|---|---|
listener | (step: FashionShowDressingStep) => void |
Returns
() => void. Call it to stop listening.
onMessage
onMessage(listener: (message: { kind: string; parts: string[]; }) => void) => () => voidHears the server's messages to the show (message), by their kind.
Parameters
| Name | Type | |
|---|---|---|
listener | (message: { kind: string; parts: string[]; }) => void |
Returns
() => void. Call it to stop listening.
onMove
onMove(listener: (move: FashionShowMove) => void) => () => voidHears the player's own moves: a round ended, a vote given, an emote.
Parameters
| Name | Type | |
|---|---|---|
listener | (move: FashionShowMove) => void |
Returns
() => void. Call it to stop listening.
onResult
onResult(listener: (result: FashionShowResult) => void) => () => voidHears the results shown, and each trophy given.
Parameters
| Name | Type | |
|---|---|---|
listener | (result: FashionShowResult) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: FashionShowState | null, previous: FashionShowState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: FashionShowState | null, previous: FashionShowState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.fastFoodies
Fast Foodies.
className
className: "game.fastFoodies.FastFoodies"The game's class, as the client names it.
afterStage
afterStage(choice: "next" | "replay" | "stages", options?: ActOptions) => Promise<FastFoodiesState>From a stage's results: play it again, go on to the next, or back to the stage select.
Parameters
| Name | Type | |
|---|---|---|
choice | "next" | "replay" | "stages" | |
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<FastFoodiesState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<FastFoodiesState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<FastFoodiesState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
begin
begin(options?: ActOptions) => Promise<FastFoodiesState>Starts the stage picked, from its start card (or the how to play before it).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
chooseLocation
chooseLocation(location: "juiceHut" | "theater", options?: ActOptions) => Promise<FastFoodiesState>Picks a place on the place select (gotoJuiceHut, gotoTheater); the theater once it is open.
Parameters
| Name | Type | |
|---|---|---|
location | "juiceHut" | "theater" | |
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
chooseStage
chooseStage(stage: number, options?: ActOptions) => Promise<FastFoodiesState>Picks a stage (1 to 20) on the stage select, once the one before it has been played.
Parameters
| Name | Type | |
|---|---|---|
stage | number | |
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
client
client() => TypedFlash<FastFoodies>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<FastFoodies>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"score" | "elapsed" | "lastTime" | "frameTime" | "watching" | "soundIndex", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"score" | "elapsed" | "lastTime" | "frameTime" | "watching" | "soundIndex", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
leaveAtOnce
leaveAtOnce(options?: ActOptions) => Promise<void>Leaves at once, without the gem multiplier (onStart_No).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
makeRandomCustomer
makeRandomCustomer(options?: ActOptions) => Promise<FastFoodiesState>Has the game make a customer (getRandomAvatar).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
open
open(screen: "stages" | "locations" | "howToPlay", options?: ActOptions) => Promise<FastFoodiesState>Shows the place select, the stage select or how to play.
Parameters
| Name | Type | |
|---|---|---|
screen | "stages" | "locations" | "howToPlay" | |
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<FastFoodiesState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
restart
restart(options?: ActOptions) => Promise<FastFoodiesState>Starts the game afresh from its first screen (startGame).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
set
set(values: Partial<Record<"score" | "elapsed" | "lastTime" | "frameTime" | "watching" | "soundIndex", FieldValue>>, options?: ActOptions) => Promise<FastFoodiesState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"score" | "elapsed" | "lastTime" | "frameTime" | "watching" | "soundIndex", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
state
state() => Promise<FastFoodiesState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<FastFoodiesState \| null>
whenState
whenState(test: (state: FastFoodiesState) => boolean, options?: ActOptions) => Promise<FastFoodiesState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: FastFoodiesState) => boolean | |
options optional | ActOptions |
Returns
Promise<FastFoodiesState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onCustomer
onCustomer(listener: (step: FastFoodiesCustomerStep) => void) => () => voidHears the game dress a customer, step by step.
Parameters
| Name | Type | |
|---|---|---|
listener | (step: FastFoodiesCustomerStep) => void |
Returns
() => void. Call it to stop listening.
onResult
onResult(listener: (result: FastFoodiesResult) => void) => () => voidHears a stage's results shown, and a three-paw stage counted.
Parameters
| Name | Type | |
|---|---|---|
listener | (result: FastFoodiesResult) => void |
Returns
() => void. Call it to stop listening.
onScreen
onScreen(listener: (screen: FastFoodiesScreenStep) => void) => () => voidHears the game's screens and their buttons.
Parameters
| Name | Type | |
|---|---|---|
listener | (screen: FastFoodiesScreenStep) => void |
Returns
() => void. Call it to stop listening.
onStage
onStage(listener: (stage: FastFoodiesStage) => void) => () => voidHears a stage picked, chosen, started, replayed or moved on from.
Parameters
| Name | Type | |
|---|---|---|
listener | (stage: FastFoodiesStage) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: FastFoodiesState | null, previous: FastFoodiesState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: FastFoodiesState | null, previous: FastFoodiesState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.feedingFrenzy
Feeding Frenzy.
className
className: "game.feedingFrenzy.FeedingFrenzy"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<FeedingFrenzyState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<FeedingFrenzyState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
chooseDifficulty
chooseDifficulty(difficulty: "medium" | "easy" | "hard", options?: ActOptions) => Promise<FeedingFrenzyState>Picks a difficulty on the title screen, and resolves once the game has gone on from it.
Parameters
| Name | Type | |
|---|---|---|
difficulty | "medium" | "easy" | "hard" | |
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
client
client() => TypedFlash<FeedingFrenzy>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<FeedingFrenzy>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"difficulty" | "level" | "score" | "highScore" | "factIndex" | "lives" | "wave" | "spawnInterval" | "nextBonus" | "factStringId" | "running", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"difficulty" | "level" | "score" | "highScore" | "factIndex" | "lives" | "wave" | "spawnInterval" | "nextBonus" | "factStringId" | "running", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepLives
keepLives(lives: number, options?: ActOptions) => Promise<Running>Holds the lives, the counter drawn each frame with them, until the handle is stopped.
Parameters
| Name | Type | |
|---|---|---|
lives | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves from the result cards (onExit_Yes) as from anywhere else.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<FeedingFrenzyState>Plays again from the result cards: from the first, on to the last (showGameOverDlg2), then its no (onExit_No).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
previousLevel
previousLevel(options?: ActOptions) => Promise<FeedingFrenzyState>Goes back a level (checkGrowthTarget(true, true)).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
set
set(values: Partial<Record<"difficulty" | "level" | "score" | "highScore" | "factIndex" | "lives" | "wave" | "spawnInterval" | "nextBonus" | "factStringId" | "running", FieldValue>>, options?: ActOptions) => Promise<FeedingFrenzyState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"difficulty" | "level" | "score" | "highScore" | "factIndex" | "lives" | "wave" | "spawnInterval" | "nextBonus" | "factStringId" | "running", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
setGrowth
setGrowth(points: number, options?: ActOptions) => Promise<FeedingFrenzyState>Sets the growth toward the next size, and redraws it (updateGrowth).
Parameters
| Name | Type | |
|---|---|---|
points | number | |
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
setLives
setLives(lives: number, options?: ActOptions) => Promise<FeedingFrenzyState>Sets the lives and draws the counter.
Parameters
| Name | Type | |
|---|---|---|
lives | number | |
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
setSize
setSize(size: number, options?: ActOptions) => Promise<FeedingFrenzyState>Makes the fish a size (1 to 7), drawn as growing into it is.
Parameters
| Name | Type | |
|---|---|---|
size | number | |
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
skipLevel
skipLevel(options?: ActOptions) => Promise<FeedingFrenzyState>Skips to the next size target, as the game's own cheat does (checkGrowthTarget(true)).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
state
state() => Promise<FeedingFrenzyState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<FeedingFrenzyState \| null>
steerTo
steerTo(x: number | null, y?: number, options?: ActOptions) => Promise<FeedingFrenzyState>Steers the fish toward a point, as moving the mouse does (mouseMove, then _mouseX/_mouseY on the player), or lets it drift with null (mouseLeave).
Parameters
| Name | Type | |
|---|---|---|
x | number | null | |
y optional | number | |
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
tables
tables() => Promise<FeedingFrenzyTables | null>The tables the waters are played from; null when the game is not on screen.
Returns
Promise<FeedingFrenzyTables \| null>
water
water() => Promise<FeedingFrenzyWater | null>The water's working parts; null when Feeding Frenzy is not on screen.
Returns
Promise<FeedingFrenzyWater \| null>
whenState
whenState(test: (state: FeedingFrenzyState) => boolean, options?: ActOptions) => Promise<FeedingFrenzyState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: FeedingFrenzyState) => boolean | |
options optional | ActOptions |
Returns
Promise<FeedingFrenzyState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onDialog
onDialog(listener: (event: FeedingFrenzyDialogEvent) => void) => () => voidHears the game's level, result and leave dialogs come up and get answered.
Parameters
| Name | Type | |
|---|---|---|
listener | (event: FeedingFrenzyDialogEvent) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: FeedingFrenzyState | null, previous: FeedingFrenzyState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: FeedingFrenzyState | null, previous: FeedingFrenzyState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.fortSmasher
Fort Smasher.
className
className: "game.fortSmasher.FortSmasher"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<FortSmasherState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<FortSmasherState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<FortSmasherState>Asks to leave a match, as the close button does then (showExitConfirmationDlg).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
chooseGround
chooseGround(terrain: number, options?: ActOptions) => Promise<FortSmasherState>Picks a ground in the picker (chooseTerrain, 0 to 4).
Parameters
| Name | Type | |
|---|---|---|
terrain | number | |
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
chooseLevel
chooseLevel(level: number, options?: ActOptions) => Promise<FortSmasherState>Picks a level of the ground (1 to 10) from the level select (chooseFort).
Parameters
| Name | Type | |
|---|---|---|
level | number | |
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
client
client() => TypedFlash<FortSmasher>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<FortSmasher>
Types
Example
closeOptions
closeOptions(options?: ActOptions) => Promise<FortSmasherState>Closes the options and plays on (onExit_No).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
finish
finish(options?: ActOptions) => Promise<void>Leaves from any of the game's dialogs, as their exit does (onExit_Yes); resolves once gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"scale" | "elapsed" | "terrain" | "pickClock" | "launchForce" | "damageThreshold" | "timeStep" | "iterations" | "materialOverride" | "buildMode" | "destruction" | "designMode" | "clusterAllowed" | "clusterSteps" | "clusterQueued" | "nextTurnQueued" | "fortResetQueued" | "zoomed" | "zoomChanging" | "pivotX" | "pivotY" | "zoomRight" | "panLeft" | "powerupPlace", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"scale" | "elapsed" | "terrain" | "pickClock" | "launchForce" | "damageThreshold" | "timeStep" | "iterations" | "materialOverride" | "buildMode" | "destruction" | "designMode" | "clusterAllowed" | "clusterSteps" | "clusterQueued" | "nextTurnQueued" | "fortResetQueued" | "zoomed" | "zoomChanging" | "pivotX" | "pivotY" | "zoomRight" | "panLeft" | "powerupPlace", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
level
level() => Promise<FortSmasherLevel | null>The level being played and the tables behind it; null off screen.
Returns
Promise<FortSmasherLevel \| null>
levelSelect
levelSelect(options?: ActOptions) => Promise<FortSmasherState>Goes back to the level select from the options (onBtnLevelSelect).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
load
load(loaded?: boolean, options?: ActOptions) => Promise<FortSmasherPlayer[]>Loads or empties the player's own slingshot (_launcherLoaded).
Parameters
| Name | Type | |
|---|---|---|
loaded optional | boolean | |
options optional | ActOptions |
Returns
Promise<FortSmasherPlayer[]>
Types
materials
materials() => Promise<{ materials: FortSmasherMaterial[]; projectiles: FortSmasherMaterial[]; cluster: { velocity: number; spread: number; }; } | null>The material and fruit tables (_materials, _projectiles) and the cluster's split.
Returns
Promise<{ materials: FortSmasherMaterial[]; projectiles: FortSmasherMaterial[]; cluster: { velocity: number; spread: number; }; } \| null>
openOptions
openOptions(options?: ActOptions) => Promise<FortSmasherState>Opens the options, as the close button does when playing alone (showOptionsDlg).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<FortSmasherState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
players
players() => Promise<FortSmasherPlayer[]>The players, in one message; none off screen.
Returns
Promise<FortSmasherPlayer[]>
restartLevel
restartLevel(options?: ActOptions) => Promise<FortSmasherState>Plays the level again, from the options or the game over (onBtnRestartLevel).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
selectFruit
selectFruit(fruit: number, options?: ActOptions) => Promise<FortSmasherState>Loads a fruit into the slingshot, as clicking it on the fruit row does (setProjectileType, setFruitHighlight). Only on the player's own turn, with that fruit left.
Parameters
| Name | Type | |
|---|---|---|
fruit | number | |
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
set
set(values: Partial<Record<"scale" | "elapsed" | "terrain" | "pickClock" | "launchForce" | "damageThreshold" | "timeStep" | "iterations" | "materialOverride" | "buildMode" | "destruction" | "designMode" | "clusterAllowed" | "clusterSteps" | "clusterQueued" | "nextTurnQueued" | "fortResetQueued" | "zoomed" | "zoomChanging" | "pivotX" | "pivotY" | "zoomRight" | "panLeft" | "powerupPlace", FieldValue>>, options?: ActOptions) => Promise<FortSmasherState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"scale" | "elapsed" | "terrain" | "pickClock" | "launchForce" | "damageThreshold" | "timeStep" | "iterations" | "materialOverride" | "buildMode" | "destruction" | "designMode" | "clusterAllowed" | "clusterSteps" | "clusterQueued" | "nextTurnQueued" | "fortResetQueued" | "zoomed" | "zoomChanging" | "pivotX" | "pivotY" | "zoomRight" | "panLeft" | "powerupPlace", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
setAmmo
setAmmo(fruit: number, ammo: number, options?: ActOptions) => Promise<FortSmasherState>Sets a fruit's ammo and the counter that shows it on the fruit row.
Parameters
| Name | Type | |
|---|---|---|
fruit | number | |
ammo | number | |
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
setClusterParams
setClusterParams(velocity: number, spread: number, options?: ActOptions) => Promise<{ materials: FortSmasherMaterial[]; projectiles: FortSmasherMaterial[]; cluster: { velocity: number; spread: number; }; } | null>How the cluster fruit splits (_clusterParams): its speed kept (0 to 7) and its spread (0 to 700).
Parameters
| Name | Type | |
|---|---|---|
velocity | number | |
spread | number | |
options optional | ActOptions |
Returns
Promise<{ materials: FortSmasherMaterial[]; projectiles: FortSmasherMaterial[]; cluster: { velocity: number; spread: number; }; } \| null>
Types
setGravity
setGravity(gravity: number, options?: ActOptions) => Promise<FortSmasherState>Sets the world's pull (1 to 500), the world's own included (_world.SetGravity).
Parameters
| Name | Type | |
|---|---|---|
gravity | number | |
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
setInput
setInput(enabled: boolean, options?: ActOptions) => Promise<FortSmasherState>Lets the player act or stops them, as the game does between turns (enableInput / disableInput).
Parameters
| Name | Type | |
|---|---|---|
enabled | boolean | |
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
setMaterial
setMaterial(material: number, changes: Partial<FortSmasherMaterial>, options?: ActOptions) => Promise<{ materials: FortSmasherMaterial[]; projectiles: FortSmasherMaterial[]; cluster: { velocity: number; spread: number; }; } | null>Changes a row of the material table (_materials, 0 to 5).
Parameters
| Name | Type | |
|---|---|---|
material | number | |
changes | Partial<FortSmasherMaterial> | |
options optional | ActOptions |
Returns
Promise<{ materials: FortSmasherMaterial[]; projectiles: FortSmasherMaterial[]; cluster: { velocity: number; spread: number; }; } \| null>
Types
setProjectile
setProjectile(fruit: number, changes: Partial<FortSmasherMaterial>, options?: ActOptions) => Promise<{ materials: FortSmasherMaterial[]; projectiles: FortSmasherMaterial[]; cluster: { velocity: number; spread: number; }; } | null>Changes a row of the fruit table (_projectiles, 0 to 5).
Parameters
| Name | Type | |
|---|---|---|
fruit | number | |
changes | Partial<FortSmasherMaterial> | |
options optional | ActOptions |
Returns
Promise<{ materials: FortSmasherMaterial[]; projectiles: FortSmasherMaterial[]; cluster: { velocity: number; spread: number; }; } \| null>
Types
setScore
setScore(score: number, options?: ActOptions) => Promise<FortSmasherState>Sets the score of the player whose turn it is, theirs only, and the score on screen.
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
shoot
shoot(pull: number, angle: number, options?: ActOptions) => Promise<FortSmasherPlayer[]>Shoots, as letting go of the slingshot does: the pull (20 to 80) and the angle are written to the player and shoot lets fly, sent to the other player in a match. Resolves once the shot is away. Only on the player's own turn, loaded, while the level plays.
Parameters
| Name | Type | |
|---|---|---|
pull | number | |
angle | number | |
options optional | ActOptions |
Returns
Promise<FortSmasherPlayer[]>
Types
state
state() => Promise<FortSmasherState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<FortSmasherState \| null>
toggleZoom
toggleZoom(options?: ActOptions) => Promise<FortSmasherState>Zooms in or out, as the magnifier does (zoomToggle); refused while the camera is moving.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
whenState
whenState(test: (state: FortSmasherState) => boolean, options?: ActOptions) => Promise<FortSmasherState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: FortSmasherState) => boolean | |
options optional | ActOptions |
Returns
Promise<FortSmasherState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onArt
onArt(listener: (payload: "soundsLoaded" | "init" | "soundsUnloaded" | "fruitArt" | "clusterSliders" | "slider") => void) => () => voidHears the game's art and sounds load, and its designer sliders set up, by name. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: "soundsLoaded" | "init" | "soundsUnloaded" | "fruitArt" | "clusterSliders" | "slider") => void |
Returns
() => void. Call it to stop listening.
onBall
onBall(listener: (payload: { kind: "split" | "loaded"; fruit: number; clusterSteps: number; }) => void) => () => voidHears a fruit made ready to fly (createBall), or a cluster fruit split (createCluster), with its fruit and the cluster's steps. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: { kind: "split" | "loaded"; fruit: number; clusterSteps: number; }) => void |
Returns
() => void. Call it to stop listening.
onButton
onButton(listener: (payload: "stay" | "exit" | "zoom" | "fact" | "options" | "waiting" | "start" | "leave" | "trophy" | "gameOver" | "levelSelect" | "gemMultiplierDone" | "restart" | "greatJob" | "youWin" | "matchWon" | "matchLost" | "factWin" | "factLose" | "factTie" | "resultsNext" | "gameOverYes" | "magnify" | "arrow" | "fortPicker" | "groundPicker" | "levelPicker" | "matchTied") => void) => () => voidHears the game's buttons and the dialogs they open, by name (start, options, restart, gameOver and the rest). Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: "stay" | "exit" | "zoom" | "fact" | "options" | "waiting" | "start" | "leave" | "trophy" | "gameOver" | "levelSelect" | "gemMultiplierDone" | "restart" | "greatJob" | "youWin" | "matchWon" | "matchLost" | "factWin" | "factLose" | "factTie" | "resultsNext" | "gameOverYes" | "magnify" | "arrow" | "fortPicker" | "groundPicker" | "levelPicker" | "matchTied") => void |
Returns
() => void. Call it to stop listening.
onChoice
onChoice(listener: (payload: { what: "level" | "list" | "hover" | "ground"; which: number; levelsUnlocked: number; }) => void) => () => voidHears the level and ground pickers: a level or ground picked, the list of unlocked levels set, or a level button hovered. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: { what: "level" | "list" | "hover" | "ground"; which: number; levelsUnlocked: number; }) => void |
Returns
() => void. Call it to stop listening.
onDrag
onDrag(listener: (payload: boolean) => void) => () => voidHears a fort piece picked up (true) or let go (false) while building. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: boolean) => void |
Returns
() => void. Call it to stop listening.
onFruit
onFruit(listener: (payload: { what: "out"; fruit: number; ammo: number[]; } | { what: "click"; fruit: number; ammo: number[]; } | { what: "over"; fruit: number; ammo: number[]; }) => void) => () => voidHears the fruit row: the pointer over a fruit, off the row, or a fruit picked, with the fruit and the ammo. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: { what: "out"; fruit: number; ammo: number[]; } | { what: "click"; fruit: number; ammo: number[]; } | { what: "over"; fruit: number; ammo: number[]; }) => void |
Returns
() => void. Call it to stop listening.
onHit
onHit(listener: (payload: FortSmasherHit) => void) => () => voidHears a fruit or a piece do damage (doDamage), with the impulse, whose turn it is and whether the cluster can be split now. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: FortSmasherHit) => void |
Returns
() => void. Call it to stop listening.
onInput
onInput(listener: (payload: boolean) => void) => () => voidHears the game let the player act or stop them (enableInput, disableInput), with true when they may act. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: boolean) => void |
Returns
() => void. Call it to stop listening.
onKey
onKey(listener: (payload: { card: FortSmasherCard; code: number; }) => void) => () => voidHears a key let go in the game or pressed on one of its cards, with the card and the key code. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: { card: FortSmasherCard; code: number; }) => void |
Returns
() => void. Call it to stop listening.
onLevel
onLevel(listener: (payload: { step: "world" | "built" | "reset" | "materials" | "starting"; level: number; terrain: number; restart: boolean; }) => void) => () => voidHears a level being set up, step by step (startNextLevel, buildForts, resetForts, the materials, the physics world), with the level and the ground. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: { step: "world" | "built" | "reset" | "materials" | "starting"; level: number; terrain: number; restart: boolean; }) => void |
Returns
() => void. Call it to stop listening.
onMessage
onMessage(listener: (payload: FortSmasherMessage) => void) => () => voidHears a message between the two players of a match (message), split into its parts. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: FortSmasherMessage) => void |
Returns
() => void. Call it to stop listening.
onPhase
onPhase(listener: (payload: { phase: "ready" | "choosing" | "playing" | "ended" | "level" | "title" | "waiting" | "scene" | "loading" | "cointoss" | "switching"; gameState: number; was: number; }) => void) => () => voidHears the game change phase (setGameState), with the phase, its number and the one before. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: { phase: "ready" | "choosing" | "playing" | "ended" | "level" | "title" | "waiting" | "scene" | "loading" | "cointoss" | "switching"; gameState: number; was: number; }) => void |
Returns
() => void. Call it to stop listening.
onPowerup
onPowerup(listener: (payload: { place: number; turn: number; }) => void) => () => voidHears a power-up appear (spawnPowerup), with where it is and whose turn it is. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: { place: number; turn: number; }) => void |
Returns
() => void. Call it to stop listening.
onResult
onResult(listener: (payload: FortSmasherResult) => void) => () => voidHears a level end (endLevel), with the score, gems, level, ammo left and phantoms left. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: FortSmasherResult) => void |
Returns
() => void. Call it to stop listening.
onSession
onSession(listener: (payload: { step: "end" | "start" | "players"; myId: number; players: number; }) => void) => () => voidHears a match start, its players heard from, and its end (start, heartbeatPlayers, end), with the player's own id and how many play. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: { step: "end" | "start" | "players"; myId: number; players: number; }) => void |
Returns
() => void. Call it to stop listening.
onShot
onShot(listener: (payload: FortSmasherShot) => void) => () => voidHears a fruit leave the slingshot (launchBall): its pull, angle and fruit, whether it went to the other player, the ammo left and whose turn it was. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: FortSmasherShot) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: FortSmasherState | null, previous: FortSmasherState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: FortSmasherState | null, previous: FortSmasherState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
onTurn
onTurn(listener: (payload: { step: "next" | "ended" | "checking"; turn: number; score: number; phantoms: number; outOfAmmo: boolean; }) => void) => () => voidHears a turn end, in its three steps (checkEndTurn, endTurn, endTurnPart2), with the player's score, phantoms left and whether they are out of ammo. Returns a function that stops listening.
Parameters
| Name | Type | |
|---|---|---|
listener | (payload: { step: "next" | "ended" | "checking"; turn: number; score: number; phantoms: number; outOfAmmo: boolean; }) => void |
Returns
() => void. Call it to stop listening.
minigames.gameCard
GameCardApi.
closeLeaderboards
closeLeaderboards(options?: ActOptions) => Promise<GameCardLeaderboard>Closes the leaderboards panel, as its X does.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<GameCardLeaderboard>
Types
current
current() => Promise<GameCard | null>The card open, or null.
Returns
Promise<GameCard \| null>
enableLeaderboards
enableLeaderboards(options?: ActOptions) => Promise<GameCardLeaderboard>Turns on a card's leaderboards where the card's art has the panel but the client left it off: _showLeaderBoard, then the card's own addEventListeners. Throws REFUSED when the art has no panel to show.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<GameCardLeaderboard>
Types
leaderboard
leaderboard() => Promise<GameCardLeaderboard | null>The leaderboards as the card shows them, or null with no card up.
Returns
Promise<GameCardLeaderboard \| null>
openLeaderboards
openLeaderboards(options?: ActOptions) => Promise<GameCardLeaderboard>Opens the leaderboards panel, as its button does.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<GameCardLeaderboard>
Types
press
press(button: GameCardButton, options?: ActOptions & { second?: boolean | undefined; }) => Promise<GameCard>Presses one of the card's buttons, on the second game's half with second. A game with no instructions has no instructions button that works, and is refused.
Parameters
| Name | Type | |
|---|---|---|
button | GameCardButton | |
options optional | ActOptions & { second?: boolean | undefined; } |
Returns
Promise<GameCard>
Types
refreshLeaderboard
refreshLeaderboard(options?: ActOptions) => Promise<GameCardLeaderboard>Has the card draw the board showing again (onLeaderBoardSelected).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<GameCardLeaderboard>
Types
showLeaderboard
showLeaderboard(board: "buddies" | "thisWeek" | "allTime", options?: ActOptions) => Promise<GameCardLeaderboard>Shows one of the three boards, as its tab does.
Parameters
| Name | Type | |
|---|---|---|
board | "buddies" | "thisWeek" | "allTime" | |
options optional | ActOptions |
Returns
Promise<GameCardLeaderboard>
Types
minigames.gemBreaker
Gem Breaker.
className
className: "game.gemBreaker.GemBreaker"The game's class, as the client names it.
aim
aim(degrees: number, options?: ActOptions) => Promise<GemBreakerState>Aims the player's cannon (_serverRotation), clamped to -170..-10 degrees.
Parameters
| Name | Type | |
|---|---|---|
degrees | number | |
options optional | ActOptions |
Returns
Promise<GemBreakerState>
Types
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<GemBreakerState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<GemBreakerState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<GemBreakerState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<GemBreakerState>
Types
client
client() => TypedFlash<GemBreaker>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<GemBreaker>
Types
Example
closeTutorial
closeTutorial(options?: ActOptions) => Promise<GemBreakerState>Closes the how-to-play (hideTut).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<GemBreakerState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepAim
keepAim(degrees: number, options?: ActOptions) => Promise<Running>Holds the player's cannon at an angle every frame, until the handle is stopped.
Parameters
| Name | Type | |
|---|---|---|
degrees | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves from a game over or the end of a two player game (onExit_Yes), or as any game.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
nextLevel
nextLevel(options?: ActOptions) => Promise<GemBreakerState>Goes on to the next level from the level's results (doNextRound).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<GemBreakerState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<GemBreakerState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<GemBreakerState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<GemBreakerState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<GemBreakerState>
Types
setScore
setScore(score: number, options?: ActOptions) => Promise<GemBreakerState>Sets the player's own score, through incrementScore as the game adds to it.
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<GemBreakerState>
Types
shoot
shoot(options?: ActOptions) => Promise<GemBreakerState>Shoots, as a click does (mouseClickHandler), and resolves once the shot is counted.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<GemBreakerState>
Types
state
state() => Promise<GemBreakerState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<GemBreakerState \| null>
whenState
whenState(test: (state: GemBreakerState) => boolean, options?: ActOptions) => Promise<GemBreakerState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: GemBreakerState) => boolean | |
options optional | ActOptions |
Returns
Promise<GemBreakerState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: GemBreakerState | null, previous: GemBreakerState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: GemBreakerState | null, previous: GemBreakerState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.hedgeHog
Hedgehog.
className
className: "game.hedgeHog.HedgeHog"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<HedgeHogState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<HedgeHogState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<HedgeHogState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
client
client() => TypedFlash<HedgeHog>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<HedgeHog>
Types
Example
continueLevel
continueLevel(options?: ActOptions) => Promise<HedgeHogState>Goes on from a finished level: its fact, then "great job", then the next level.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
face
face(direction: "left" | "right" | "down" | "up", options?: ActOptions) => Promise<HedgeHogState>Faces the hedgehog a way at once (changeDirection); resolves once it runs that way.
Parameters
| Name | Type | |
|---|---|---|
direction | "left" | "right" | "down" | "up" | |
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
facts
facts() => Promise<{ imageId: number; text: number; }[]>The level's facts (_facts): each image and its text's string id.
Returns
Promise<{ imageId: number; text: number; }[]>
finish
finish(options?: ActOptions) => Promise<void>Leaves from the game over card (onExit_Yes), once the game is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"elapsed" | "speed" | "factIndex" | "lastTime" | "frameTime" | "phantomSpeed" | "modeSwitchTime" | "respawnTime" | "powerUpWarningTime" | "phantomsInARow" | "scoreMultiplier" | "extraLifeIndex" | "nextExtraLife" | "scoreThisLevel" | "inputOverride" | "leftArrow" | "upArrow" | "rightArrow" | "downArrow" | "tutorialShown" | "offsetX" | "offsetY" | "gridX" | "gridY" | "nextBonusSquare" | "bonusCollected" | "nextSpawnSquare" | "gameOver" | "serverStarted", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"elapsed" | "speed" | "factIndex" | "lastTime" | "frameTime" | "phantomSpeed" | "modeSwitchTime" | "respawnTime" | "powerUpWarningTime" | "phantomsInARow" | "scoreMultiplier" | "extraLifeIndex" | "nextExtraLife" | "scoreThisLevel" | "inputOverride" | "leftArrow" | "upArrow" | "rightArrow" | "downArrow" | "tutorialShown" | "offsetX" | "offsetY" | "gridX" | "gridY" | "nextBonusSquare" | "bonusCollected" | "nextSpawnSquare" | "gameOver" | "serverStarted", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepPoweredUp
keepPoweredUp(seconds?: number, options?: ActOptions) => Promise<Running>Powers the hedgehog up and holds it powered (_energizerTimer, more than 2 seconds) until the handle is stopped, which lets it run out. The phantoms run, as for a crystal.
Parameters
| Name | Type | |
|---|---|---|
seconds optional | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
maze
maze() => Promise<HedgeHogMaze | null>The level's maze: its squares (_levels), pellets, crystals and where the hedgehog is.
Returns
Promise<HedgeHogMaze \| null>
open
open(screen: "exit" | "fact" | "countdown" | "nextLevel" | "controls", options?: ActOptions) => Promise<HedgeHogState>Shows one of the game's screens (the countdown, the controls, the fact, the next level, exit).
Parameters
| Name | Type | |
|---|---|---|
screen | "exit" | "fact" | "countdown" | "nextLevel" | "controls" | |
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<HedgeHogState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
resetPlayer
resetPlayer(options?: ActOptions) => Promise<HedgeHogState>Puts the hedgehog back on its start square (setPlayerIJ).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
respawnPhantoms
respawnPhantoms(options?: ActOptions) => Promise<HedgeHogState>Sends the phantoms back to their start without a new level (setupLevel(false)).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
set
set(values: Partial<Record<"elapsed" | "speed" | "factIndex" | "lastTime" | "frameTime" | "phantomSpeed" | "modeSwitchTime" | "respawnTime" | "powerUpWarningTime" | "phantomsInARow" | "scoreMultiplier" | "extraLifeIndex" | "nextExtraLife" | "scoreThisLevel" | "inputOverride" | "leftArrow" | "upArrow" | "rightArrow" | "downArrow" | "tutorialShown" | "offsetX" | "offsetY" | "gridX" | "gridY" | "nextBonusSquare" | "bonusCollected" | "nextSpawnSquare" | "gameOver" | "serverStarted", FieldValue>>, options?: ActOptions) => Promise<HedgeHogState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"elapsed" | "speed" | "factIndex" | "lastTime" | "frameTime" | "phantomSpeed" | "modeSwitchTime" | "respawnTime" | "powerUpWarningTime" | "phantomsInARow" | "scoreMultiplier" | "extraLifeIndex" | "nextExtraLife" | "scoreThisLevel" | "inputOverride" | "leftArrow" | "upArrow" | "rightArrow" | "downArrow" | "tutorialShown" | "offsetX" | "offsetY" | "gridX" | "gridY" | "nextBonusSquare" | "bonusCollected" | "nextSpawnSquare" | "gameOver" | "serverStarted", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
setHighScore
setHighScore(score: number, options?: ActOptions) => Promise<HedgeHogState>Sets the high score, and the high score shown.
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
setLives
setLives(lives: number, options?: ActOptions) => Promise<HedgeHogState>Sets the lives left (at least 1), and redraws the lives shown.
Parameters
| Name | Type | |
|---|---|---|
lives | number | |
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
setScore
setScore(score: number, options?: ActOptions) => Promise<HedgeHogState>Sets the score as the game does (setScore, without the extra life check).
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
showScore
showScore(score: number, at: { x: number; y: number; }, options?: ActOptions) => Promise<HedgeHogState>Adds a score where the game shows one (doScorePopup), as eating a phantom does.
Parameters
| Name | Type | |
|---|---|---|
score | number | |
at | { x: number; y: number; } | |
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
state
state() => Promise<HedgeHogState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<HedgeHogState \| null>
turn
turn(direction: "left" | "right" | "down" | "up" | null, options?: ActOptions) => Promise<HedgeHogState>Runs the hedgehog one way, as holding its arrow does (the others let go first), or stops holding any with null. Resolves once the game holds that arrow.
Parameters
| Name | Type | |
|---|---|---|
direction | "left" | "right" | "down" | "up" | null | |
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
whenState
whenState(test: (state: HedgeHogState) => boolean, options?: ActOptions) => Promise<HedgeHogState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: HedgeHogState) => boolean | |
options optional | ActOptions |
Returns
Promise<HedgeHogState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onFact
onFact(listener: (fact: { what: "loaded" | "wanted"; index: number; }) => void) => () => voidHears a fact's picture asked for (loadNextFactImage) and loaded (mediaObjectLoaded).
Parameters
| Name | Type | |
|---|---|---|
listener | (fact: { what: "loaded" | "wanted"; index: number; }) => void |
Returns
() => void. Call it to stop listening.
onMaze
onMaze(listener: (event: HedgeHogMazeEvent) => void) => () => voidHears the maze change: a level set up, pellets laid, a bonus, phantoms spawning, portals.
Parameters
| Name | Type | |
|---|---|---|
listener | (event: HedgeHogMazeEvent) => void |
Returns
() => void. Call it to stop listening.
onScore
onScore(listener: (score: HedgeHogScore) => void) => () => voidHears the score change (setScore) and the scores shown in the maze (doScorePopup).
Parameters
| Name | Type | |
|---|---|---|
listener | (score: HedgeHogScore) => void |
Returns
() => void. Call it to stop listening.
onScreen
onScreen(listener: (screen: HedgeHogScreen) => void) => () => voidHears the game show one of its screens.
Parameters
| Name | Type | |
|---|---|---|
listener | (screen: HedgeHogScreen) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: HedgeHogState | null, previous: HedgeHogState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: HedgeHogState | null, previous: HedgeHogState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
onTurn
onTurn(listener: (turn: HedgeHogTurn) => void) => () => voidHears the hedgehog turn (changeDirection) and its arrow keys (onKeyDown, onKeyUp).
Parameters
| Name | Type | |
|---|---|---|
listener | (turn: HedgeHogTurn) => void |
Returns
() => void. Call it to stop listening.
minigames.horseRace
Horse Race.
className
className: "game.horseRace.HorseRace"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<HorseRaceState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<HorseRaceState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<HorseRaceState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<HorseRaceState>
Types
boost
boost(options?: ActOptions) => Promise<HorseRaceState>Uses a carrot boost, as its button does (onBoostButton, which sends boo). Only while racing with a boost left (REFUSED otherwise).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<HorseRaceState>
Types
client
client() => TypedFlash<HorseRace>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<HorseRace>
Types
Example
closeError
closeError(options?: ActOptions) => Promise<void>Closes the error dialog, which leaves the race.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
computers
computers() => Promise<{ easy: ComputerProfile; medium: ComputerProfile; hard: ComputerProfile; lanes: number; } | null>The computer racers' three profiles, and how many lanes they fill. Null off screen.
Returns
Promise<{ easy: ComputerProfile; medium: ComputerProfile; hard: ComputerProfile; lanes: number; } \| null>
data
data() => Promise<RaceData | null>The race's own data: its facts, the room's ids, its randomizers.
Returns
Promise<RaceData \| null>
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
dismissError
dismissError(errorDialog: string, options?: ActOptions) => Promise<void>Closes the error dialog, which leaves the race (onErrorExit).
Parameters
| Name | Type | |
|---|---|---|
errorDialog | string | |
options optional | ActOptions |
Returns
Promise<void>
Types
emote
emote(emote: "sleep" | "cool" | "sneaky" | "wink" | "tongue" | "surprise", options?: ActOptions) => Promise<HorseRaceState>Shows an emote over the player's racer, as its button does (emoteButton).
Parameters
| Name | Type | |
|---|---|---|
emote | "sleep" | "cool" | "sneaky" | "wink" | "tongue" | "surprise" | |
options optional | ActOptions |
Returns
Promise<HorseRaceState>
Types
horses
horses() => Promise<HorseRaceHorse[]>Every horse, the players' and the computers'. None off screen.
Returns
Promise<HorseRaceHorse[]>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
jump
jump(options?: ActOptions) => Promise<HorseRaceState>Jumps, as the jump button does (onJumpButton); resolves once the horse is in the air.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<HorseRaceState>
Types
jumpKey
jumpKey(down: boolean, options?: ActOptions) => Promise<HorseRaceState>Holds the jump key down, or lets it go (keyHandleDown / keyHandleUp with space).
Parameters
| Name | Type | |
|---|---|---|
down | boolean | |
options optional | ActOptions |
Returns
Promise<HorseRaceState>
Types
keep
keep(values: Partial<Record<"fact" | "gemsEarned" | "joinersWaiting" | "startingLineX" | "trackLength" | "nextHurdle" | "factLoading" | "jumpHeld" | "hoofSounds" | "splashSounds", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"fact" | "gemsEarned" | "joinersWaiting" | "startingLineX" | "trackLength" | "nextHurdle" | "factLoading" | "jumpHeld" | "hoofSounds" | "splashSounds", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<HorseRaceState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<HorseRaceState>
Types
set
set(values: Partial<Record<"fact" | "gemsEarned" | "joinersWaiting" | "startingLineX" | "trackLength" | "nextHurdle" | "factLoading" | "jumpHeld" | "hoofSounds" | "splashSounds", FieldValue>>, options?: ActOptions) => Promise<HorseRaceState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"fact" | "gemsEarned" | "joinersWaiting" | "startingLineX" | "trackLength" | "nextHurdle" | "factLoading" | "jumpHeld" | "hoofSounds" | "splashSounds", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<HorseRaceState>
Types
setBoosts
setBoosts(boosts: number, options?: ActOptions) => Promise<HorseRaceState>Sets the boosts left, and redraws their button as the game does (_boostButton.carrots).
Parameters
| Name | Type | |
|---|---|---|
boosts | number | |
options optional | ActOptions |
Returns
Promise<HorseRaceState>
Types
state
state() => Promise<HorseRaceState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<HorseRaceState \| null>
whenState
whenState(test: (state: HorseRaceState) => boolean, options?: ActOptions) => Promise<HorseRaceState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: HorseRaceState) => boolean | |
options optional | ActOptions |
Returns
Promise<HorseRaceState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onDialog
onDialog(listener: (event: "errorExit" | "gemBonusDone") => void) => () => voidHears the error dialog closed or the gem bonus done (onErrorExit, onGemMultiplierDone).
Parameters
| Name | Type | |
|---|---|---|
listener | (event: "errorExit" | "gemBonusDone") => void |
Returns
() => void. Call it to stop listening.
onEmoteButton
onEmoteButton(listener: (emote: "sleep" | "cool" | "sneaky" | "wink" | "tongue" | "surprise") => void) => () => voidHears the player press one of the emote buttons (onEmote<Name>Button).
Parameters
| Name | Type | |
|---|---|---|
listener | (emote: "sleep" | "cool" | "sneaky" | "wink" | "tongue" | "surprise") => void |
Returns
() => void. Call it to stop listening.
onGameMessage
onGameMessage(listener: () => void) => () => voidHears the server's messages reach the race (message).
Parameters
| Name | Type | |
|---|---|---|
listener | () => void |
Returns
() => void. Call it to stop listening.
onInput
onInput(listener: (input: RaceInput) => void) => () => voidHears the race's keys and clicks (keyHandleDown, keyHandleUp, mouseHandleDown).
Parameters
| Name | Type | |
|---|---|---|
listener | (input: RaceInput) => void |
Returns
() => void. Call it to stop listening.
onLifecycle
onLifecycle(listener: (step: string) => void) => () => voidHears the race's own steps (start, resetGame, playerLeftGame, end, …).
Parameters
| Name | Type | |
|---|---|---|
listener | (step: string) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: HorseRaceState | null, previous: HorseRaceState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: HorseRaceState | null, previous: HorseRaceState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.marbles
Marbles.
className
className: "game.pVP_Marbles.PVP_Marbles"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MarblesState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MarblesState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MarblesState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MarblesState>
Types
client
client() => TypedFlash<PVP_Marbles>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PVP_Marbles>
Types
Example
detail
detail() => Promise<MarblesDetail | null>How the round stands underneath (see MarblesDetail); null off screen.
Returns
Promise<MarblesDetail \| null>
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"secondsLeft" | "timeStep" | "iterations" | "marblesToReturn" | "queueEndTurn" | "queueNextTurn" | "trailingX" | "trailingY" | "soundEnabled", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"secondsLeft" | "timeStep" | "iterations" | "marblesToReturn" | "queueEndTurn" | "queueNextTurn" | "trailingX" | "trailingY" | "soundEnabled", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepSecondsLeft
keepSecondsLeft(seconds: number, options?: ActOptions) => Promise<Running>Holds the shot clock at seconds (at most 15) while a shot is being taken.
Parameters
| Name | Type | |
|---|---|---|
seconds | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
pieces
pieces() => Promise<MarblesPiece[]>Every marble, shooter and obstacle on the table (_layerMain).
Returns
Promise<MarblesPiece[]>
playAgain
playAgain(options?: ActOptions) => Promise<MarblesState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MarblesState>
Types
ready
ready(options?: ActOptions) => Promise<MarblesState>Says the player is ready, from the how-to-play screen (sendReady).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MarblesState>
Types
set
set(values: Partial<Record<"secondsLeft" | "timeStep" | "iterations" | "marblesToReturn" | "queueEndTurn" | "queueNextTurn" | "trailingX" | "trailingY" | "soundEnabled", FieldValue>>, options?: ActOptions) => Promise<MarblesState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"secondsLeft" | "timeStep" | "iterations" | "marblesToReturn" | "queueEndTurn" | "queueNextTurn" | "trailingX" | "trailingY" | "soundEnabled", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MarblesState>
Types
setReportedAim
setReportedAim(x: number, y: number, options?: ActOptions) => Promise<MarblesState>Changes the aim the game reports to the other player (_serverPosition, the one before kept).
Parameters
| Name | Type | |
|---|---|---|
x | number | |
y | number | |
options optional | ActOptions |
Returns
Promise<MarblesState>
Types
shoot
shoot(shot: MarblesShot, options?: ActOptions) => Promise<MarblesState>Takes the player's shot, as the mouse does: the shooter stood from degrees round the ring, pressed (mouseDownHandler), pulled away from towards by power, and let go (mouseUpHandler). Resolves once the shooter is rolling.
Parameters
| Name | Type | |
|---|---|---|
shot | MarblesShot | |
options optional | ActOptions |
Returns
Promise<MarblesState>
Types
state
state() => Promise<MarblesState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MarblesState \| null>
whenState
whenState(test: (state: MarblesState) => boolean, options?: ActOptions) => Promise<MarblesState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MarblesState) => boolean | |
options optional | ActOptions |
Returns
Promise<MarblesState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onButton
onButton(listener: (button: MarblesButton) => void) => () => voidHears the game's buttons: ready, and the leave question's.
Parameters
| Name | Type | |
|---|---|---|
listener | (button: MarblesButton) => void |
Returns
() => void. Call it to stop listening.
onMouse
onMouse(listener: (mouse: MarblesMouse) => void) => () => voidHears the player press and let go on the table, and whether the game took it (a shot when let go past the least pull).
Parameters
| Name | Type | |
|---|---|---|
listener | (mouse: MarblesMouse) => void |
Returns
() => void. Call it to stop listening.
onResult
onResult(listener: (result: MarblesResult) => void) => () => voidHears the game end, once: the outcome, and the gems it pays.
Parameters
| Name | Type | |
|---|---|---|
listener | (result: MarblesResult) => void |
Returns
() => void. Call it to stop listening.
onScore
onScore(listener: (score: { score: number; opponentScore: number; }) => void) => () => voidHears the score change, as a marble fades out of the ring (fadedOut).
Parameters
| Name | Type | |
|---|---|---|
listener | (score: { score: number; opponentScore: number; }) => void |
Returns
() => void. Call it to stop listening.
onShot
onShot(listener: (shot: MarblesShotTaken) => void) => () => voidHears a shot taken: the player's (shoot), or the opponent's (the server's shoot message).
Parameters
| Name | Type | |
|---|---|---|
listener | (shot: MarblesShotTaken) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: MarblesState | null, previous: MarblesState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MarblesState | null, previous: MarblesState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
onTurn
onTurn(listener: (turn: { mine: boolean; last: boolean; }) => void) => () => voidHears a turn announced: whose, and whether it is the last.
Parameters
| Name | Type | |
|---|---|---|
listener | (turn: { mine: boolean; last: boolean; }) => void |
Returns
() => void. Call it to stop listening.
minigames.memory
Memory.
className
className: "game.miniGame_Memory.MiniGame_Memory"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MemoryState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MemoryState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MemoryState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MemoryState>
Types
cards
cards() => Promise<MemoryCard[]>The cards on the board, in one message; none when the game is not on screen.
Returns
Promise<MemoryCard[]>
client
client() => TypedFlash<MiniGame_Memory>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MiniGame_Memory>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"started" | "score" | "seconds", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"started" | "score" | "seconds", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MemoryState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MemoryState>
Types
quit
quit(options?: ActOptions) => Promise<void>Leaves once the round is over, as its "no" does (onRetry_No); resolves once it is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
set
set(values: Partial<Record<"started" | "score" | "seconds", FieldValue>>, options?: ActOptions) => Promise<MemoryState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"started" | "score" | "seconds", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MemoryState>
Types
setScore
setScore(score: number, options?: ActOptions) => Promise<MemoryState>Writes the score and redraws it (updateScore).
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<MemoryState>
Types
state
state() => Promise<MemoryState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MemoryState \| null>
turn
turn(slot: number, options?: ActOptions) => Promise<MemoryCard[]>Turns a card over, as clicking it does (mouseClickHandler_Back), and resolves with the cards. Throws REFUSED when the game would not turn it (revealing, paused, over, or face up).
Parameters
| Name | Type | |
|---|---|---|
slot | number | |
options optional | ActOptions |
Returns
Promise<MemoryCard[]>
Types
whenState
whenState(test: (state: MemoryState) => boolean, options?: ActOptions) => Promise<MemoryState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MemoryState) => boolean | |
options optional | ActOptions |
Returns
Promise<MemoryState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onButton
onButton(listener: (button: MemoryButton) => void) => () => voidHears the game's own buttons pressed, by their handlers.
Parameters
| Name | Type | |
|---|---|---|
listener | (button: MemoryButton) => void |
Returns
() => void. Call it to stop listening.
onCardClick
onCardClick(listener: (click: MemoryClick) => void) => () => voidHears a card clicked (mouseClickHandler_Back), taken or not.
Parameters
| Name | Type | |
|---|---|---|
listener | (click: MemoryClick) => void |
Returns
() => void. Call it to stop listening.
onDeal
onDeal(listener: () => void) => () => voidHears the cards dealt for a new round (restart).
Parameters
| Name | Type | |
|---|---|---|
listener | () => void |
Returns
() => void. Call it to stop listening.
onGameOver
onGameOver(listener: (over: MemoryGameOver) => void) => () => voidHears the round end, won or out of time (showGameOverDlg).
Parameters
| Name | Type | |
|---|---|---|
listener | (over: MemoryGameOver) => void |
Returns
() => void. Call it to stop listening.
onMatch
onMatch(listener: (match: MemoryMatch) => void) => () => voidHears a pair matched (MemoryCard.matched, once for each of the two).
Parameters
| Name | Type | |
|---|---|---|
listener | (match: MemoryMatch) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: MemoryState | null, previous: MemoryState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MemoryState | null, previous: MemoryState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
onTurned
onTurned(listener: (card: Omit<MemoryCard, "faceUp" | "matched">) => void) => () => voidHears a card turned face up by the player (MemoryCard.select, not the reveal).
Parameters
| Name | Type | |
|---|---|---|
listener | (card: Omit<MemoryCard, "faceUp" | "matched">) => void |
Returns
() => void. Call it to stop listening.
minigames.microBambooHarvest
Bamboo Harvest.
className
className: "game.microBambooHarvest.MicroBambooHarvest"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroBambooHarvestState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroBambooHarvestState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroBambooHarvestState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroBambooHarvestState>
Types
client
client() => TypedFlash<MicroBambooHarvest>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroBambooHarvest>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroBambooHarvestState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroBambooHarvestState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MicroBambooHarvestState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroBambooHarvestState>
Types
state
state() => Promise<MicroBambooHarvestState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroBambooHarvestState \| null>
whenState
whenState(test: (state: MicroBambooHarvestState) => boolean, options?: ActOptions) => Promise<MicroBambooHarvestState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroBambooHarvestState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroBambooHarvestState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroBambooHarvestState | null, previous: MicroBambooHarvestState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroBambooHarvestState | null, previous: MicroBambooHarvestState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microCrane
Claw Machine.
className
className: "game.microCrane.MicroCrane"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroCraneState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroCraneState \| null>
Types
answerPrize
answerPrize(keep: boolean, options?: ActOptions) => Promise<MicroCraneState>Keeps or turns down the prize, as its popup does (keptItem / rejectedItem, which send cd); resolves once the popup has gone.
Parameters
| Name | Type | |
|---|---|---|
keep | boolean | |
options optional | ActOptions |
Returns
Promise<MicroCraneState>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroCraneState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroCraneState>
Types
client
client() => TypedFlash<MicroCrane>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroCrane>
Types
Example
decline
decline(options?: ActOptions) => Promise<void>Turns the offer down, as its no does (onNo, which ends the game); resolves once it is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
drop
drop(options?: ActOptions) => Promise<MicroCraneState>Drops the claw (pressDropButton); resolves once it has. Refused before the "go" is over.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroCraneState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"dropped" | "countdown" | "origin", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"dropped" | "countdown" | "origin", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
move
move(direction: MicroCraneDirection, options?: ActOptions) => Promise<MicroCraneState>Starts the claw moving, as holding an arrow does (pressMoveButtons).
Parameters
| Name | Type | |
|---|---|---|
direction | MicroCraneDirection | |
options optional | ActOptions |
Returns
Promise<MicroCraneState>
Types
moveTo
moveTo(position: number, options?: ActOptions) => Promise<MicroCraneState>Puts the claw straight at position (0 to 200): stops it, and writes where it is and where its art is drawn, as moving it there would.
Parameters
| Name | Type | |
|---|---|---|
position | number | |
options optional | ActOptions |
Returns
Promise<MicroCraneState>
Types
play
play(options?: ActOptions) => Promise<MicroCraneState>Pays for a go, as the offer's yes does (onYes, which sends cp); resolves once it starts.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroCraneState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroCraneState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroCraneState>
Types
set
set(values: Partial<Record<"dropped" | "countdown" | "origin", FieldValue>>, options?: ActOptions) => Promise<MicroCraneState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"dropped" | "countdown" | "origin", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroCraneState>
Types
state
state() => Promise<MicroCraneState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroCraneState \| null>
stop
stop(options?: ActOptions) => Promise<MicroCraneState>Stops the claw, as letting go of the arrow does (releaseMoveButtons).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroCraneState>
Types
whenState
whenState(test: (state: MicroCraneState) => boolean, options?: ActOptions) => Promise<MicroCraneState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroCraneState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroCraneState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroCraneState | null, previous: MicroCraneState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroCraneState | null, previous: MicroCraneState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microDucky
Ducky Hop.
className
className: "game.microDucky.MicroDucky"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroDuckyState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroDuckyState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroDuckyState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroDuckyState>
Types
client
client() => TypedFlash<MicroDucky>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroDucky>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
hop
hop(direction: "left" | "right" | "down" | "up", options?: ActOptions) => Promise<MicroDuckyState>Hops one way, as the arrow key does (keyboardHandler); resolves with the round after.
Parameters
| Name | Type | |
|---|---|---|
direction | "left" | "right" | "down" | "up" | |
options optional | ActOptions |
Returns
Promise<MicroDuckyState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"seconds" | "points" | "goldenDuckies" | "scrollSpeed" | "hopSeconds", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"seconds" | "points" | "goldenDuckies" | "scrollSpeed" | "hopSeconds", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroDuckyState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroDuckyState>
Types
quit
quit(options?: ActOptions) => Promise<void>Leaves from the game over dialog, as its no does (onExit); resolves once it is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
set
set(values: Partial<Record<"seconds" | "points" | "goldenDuckies" | "scrollSpeed" | "hopSeconds", FieldValue>>, options?: ActOptions) => Promise<MicroDuckyState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"seconds" | "points" | "goldenDuckies" | "scrollSpeed" | "hopSeconds", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroDuckyState>
Types
setPoints
setPoints(points: number, options?: ActOptions) => Promise<MicroDuckyState>Sets the points and the counter the scene shows for them (points.text).
Parameters
| Name | Type | |
|---|---|---|
points | number | |
options optional | ActOptions |
Returns
Promise<MicroDuckyState>
Types
state
state() => Promise<MicroDuckyState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroDuckyState \| null>
whenState
whenState(test: (state: MicroDuckyState) => boolean, options?: ActOptions) => Promise<MicroDuckyState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroDuckyState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroDuckyState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroDuckyState | null, previous: MicroDuckyState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroDuckyState | null, previous: MicroDuckyState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microGameInvasion
Game Invasion.
className
className: "game.microGameInvasion.MicroGameInvasion"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroGameInvasionState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroGameInvasionState \| null>
Types
answerPrize
answerPrize(keep: boolean, options?: ActOptions) => Promise<MicroGameInvasionState>Keeps or turns down the prize offered (keptItem, rejectedItem), once it has gone.
Parameters
| Name | Type | |
|---|---|---|
keep | boolean | |
options optional | ActOptions |
Returns
Promise<MicroGameInvasionState>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroGameInvasionState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroGameInvasionState>
Types
client
client() => TypedFlash<MicroGameInvasion>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroGameInvasion>
Types
Example
decline
decline(options?: ActOptions) => Promise<MicroGameInvasionState>Declines, as Escape does (keyHandleDown).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroGameInvasionState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
fire
fire(options?: ActOptions) => Promise<MicroGameInvasionState>Fires, as Enter does (keyHandleDown).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroGameInvasionState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
play
play(options?: ActOptions) => Promise<MicroGameInvasionState>Pays and starts a game, as the machine's start button does (machine.clickedStart).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroGameInvasionState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroGameInvasionState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroGameInvasionState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MicroGameInvasionState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroGameInvasionState>
Types
state
state() => Promise<MicroGameInvasionState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroGameInvasionState \| null>
whenState
whenState(test: (state: MicroGameInvasionState) => boolean, options?: ActOptions) => Promise<MicroGameInvasionState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroGameInvasionState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroGameInvasionState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroGameInvasionState | null, previous: MicroGameInvasionState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroGameInvasionState | null, previous: MicroGameInvasionState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microGoldPanning
Gold Panning.
className
className: "game.microGoldPanning.MicroGoldPanning"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroGoldPanningState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroGoldPanningState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroGoldPanningState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroGoldPanningState>
Types
client
client() => TypedFlash<MicroGoldPanning>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroGoldPanning>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroGoldPanningState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroGoldPanningState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MicroGoldPanningState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroGoldPanningState>
Types
state
state() => Promise<MicroGoldPanningState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroGoldPanningState \| null>
whenState
whenState(test: (state: MicroGoldPanningState) => boolean, options?: ActOptions) => Promise<MicroGoldPanningState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroGoldPanningState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroGoldPanningState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroGoldPanningState | null, previous: MicroGoldPanningState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroGoldPanningState | null, previous: MicroGoldPanningState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microHotCocoa
Hot Cocoa.
className
className: "game.microHotCocoa.MicroHotCocoa"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroHotCocoaState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroHotCocoaState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroHotCocoaState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroHotCocoaState>
Types
client
client() => TypedFlash<MicroHotCocoa>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroHotCocoa>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroHotCocoaState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroHotCocoaState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MicroHotCocoaState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroHotCocoaState>
Types
state
state() => Promise<MicroHotCocoaState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroHotCocoaState \| null>
whenState
whenState(test: (state: MicroHotCocoaState) => boolean, options?: ActOptions) => Promise<MicroHotCocoaState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroHotCocoaState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroHotCocoaState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroHotCocoaState | null, previous: MicroHotCocoaState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroHotCocoaState | null, previous: MicroHotCocoaState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microMiraSays
Mira Says.
className
className: "game.microMiraSays.MicroMiraSays"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroMiraSaysState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroMiraSaysState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroMiraSaysState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroMiraSaysState>
Types
client
client() => TypedFlash<MicroMiraSays>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroMiraSays>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
finish
finish(options?: ActOptions) => Promise<void>Leaves from the game over question (onFail_No), paying what the round earned.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"prize0" | "prize1" | "prize2" | "prize3" | "prize4", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"prize0" | "prize1" | "prize2" | "prize3" | "prize4", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
markPrizeTaken
markPrizeTaken(prize: 0 | 1 | 2 | 3 | 4, options?: ActOptions) => Promise<MicroMiraSaysState>Marks one of the five prizes (0 to 4) as paid, so the game does not pay it. A prize cannot be unmarked: the game would pay it a second time.
Parameters
| Name | Type | |
|---|---|---|
prize | 0 | 1 | 2 | 3 | 4 | |
options optional | ActOptions |
Returns
Promise<MicroMiraSaysState>
Types
pause
pause(paused?: boolean, options?: ActOptions) => Promise<MicroMiraSaysState>Pauses or unpauses the round, with the scene's own pauseGame / unpauseGame.
Parameters
| Name | Type | |
|---|---|---|
paused optional | boolean | |
options optional | ActOptions |
Returns
Promise<MicroMiraSaysState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroMiraSaysState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroMiraSaysState>
Types
set
set(values: Partial<Record<"prize0" | "prize1" | "prize2" | "prize3" | "prize4", FieldValue>>, options?: ActOptions) => Promise<MicroMiraSaysState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"prize0" | "prize1" | "prize2" | "prize3" | "prize4", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroMiraSaysState>
Types
state
state() => Promise<MicroMiraSaysState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroMiraSaysState \| null>
whenState
whenState(test: (state: MicroMiraSaysState) => boolean, options?: ActOptions) => Promise<MicroMiraSaysState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroMiraSaysState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroMiraSaysState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroMiraSaysState | null, previous: MicroMiraSaysState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroMiraSaysState | null, previous: MicroMiraSaysState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microOatHarvest
Oat Harvest.
className
className: "game.microOatHarvest.MicroOatHarvest"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroOatHarvestState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroOatHarvestState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroOatHarvestState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroOatHarvestState>
Types
client
client() => TypedFlash<MicroOatHarvest>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroOatHarvest>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroOatHarvestState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroOatHarvestState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MicroOatHarvestState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroOatHarvestState>
Types
state
state() => Promise<MicroOatHarvestState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroOatHarvestState \| null>
whenState
whenState(test: (state: MicroOatHarvestState) => boolean, options?: ActOptions) => Promise<MicroOatHarvestState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroOatHarvestState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroOatHarvestState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroOatHarvestState | null, previous: MicroOatHarvestState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroOatHarvestState | null, previous: MicroOatHarvestState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microPetSalon
Pet Salon.
className
className: "game.microPetSalon.MicroPetSalon"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroPetSalonState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroPetSalonState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroPetSalonState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPetSalonState>
Types
client
client() => TypedFlash<MicroPetSalon>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroPetSalon>
Types
Example
confirm
confirm(buy: boolean, options?: ActOptions) => Promise<MicroPetSalonState>Answers the confirm dialog: buy (onDone_Yes) or not (onDone_No), once it has gone.
Parameters
| Name | Type | |
|---|---|---|
buy | boolean | |
options optional | ActOptions |
Returns
Promise<MicroPetSalonState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
dismiss
dismiss(options?: ActOptions) => Promise<MicroPetSalonState>Closes the cost or error dialog (onCostClose, onError_OK), once it has gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPetSalonState>
Types
done
done(options?: ActOptions) => Promise<MicroPetSalonState>Asks to buy the look, as the done button does (showDoneDlg): the confirm or cost dialog.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPetSalonState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"cat9" | "cat10" | "cat11", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"cat9" | "cat10" | "cat11", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroPetSalonState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPetSalonState>
Types
reset
reset(options?: ActOptions) => Promise<MicroPetSalonState>Puts the pet back as it came, as the reset button does (onResetDlg).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPetSalonState>
Types
set
set(values: Partial<Record<"cat9" | "cat10" | "cat11", FieldValue>>, options?: ActOptions) => Promise<MicroPetSalonState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"cat9" | "cat10" | "cat11", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroPetSalonState>
Types
setLook
setLook(look: readonly [number, number, number], options?: ActOptions) => Promise<MicroPetSalonState>Puts a look on the pet: its three slots, written as the salon's own pickers write them.
Parameters
| Name | Type | |
|---|---|---|
look | readonly [number, number, number] | |
options optional | ActOptions |
Returns
Promise<MicroPetSalonState>
Types
state
state() => Promise<MicroPetSalonState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroPetSalonState \| null>
whenState
whenState(test: (state: MicroPetSalonState) => boolean, options?: ActOptions) => Promise<MicroPetSalonState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroPetSalonState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroPetSalonState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroPetSalonState | null, previous: MicroPetSalonState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroPetSalonState | null, previous: MicroPetSalonState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microPetWash
Pet Wash.
className
className: "game.microPetWash.MicroPetWash"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroPetWashState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroPetWashState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroPetWashState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPetWashState>
Types
client
client() => TypedFlash<MicroPetWash>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroPetWash>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroPetWashState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPetWashState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MicroPetWashState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroPetWashState>
Types
state
state() => Promise<MicroPetWashState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroPetWashState \| null>
whenState
whenState(test: (state: MicroPetWashState) => boolean, options?: ActOptions) => Promise<MicroPetWashState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroPetWashState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroPetWashState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroPetWashState | null, previous: MicroPetWashState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroPetWashState | null, previous: MicroPetWashState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microPhantom
Phantom Vortex.
className
className: "game.microPhantom.MicroPhantom"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroPhantomState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroPhantomState \| null>
Types
answerPrize
answerPrize(keep: boolean, options?: ActOptions) => Promise<MicroPhantomState>Keeps the prize on offer or turns it down (keptItem, rejectedItem), and resolves with the state after; the popup may stay up until closePrize.
Parameters
| Name | Type | |
|---|---|---|
keep | boolean | |
options optional | ActOptions |
Returns
Promise<MicroPhantomState>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroPhantomState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPhantomState>
Types
board
board() => Promise<MicroPhantomBoard | null>The field: candy, torch, phantoms and lights; null when the game or its scene is not there.
Returns
Promise<MicroPhantomBoard \| null>
client
client() => TypedFlash<MicroPhantom>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroPhantom>
Types
Example
closePrize
closePrize(options?: ActOptions) => Promise<MicroPhantomState>Closes the prize popup (destroyPrizePopup), and resolves once it has gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPhantomState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
endRound
endRound(won: boolean, options?: ActOptions) => Promise<MicroPhantomState>Ends the round as won or lost (onWin, onLose), and resolves once its dialog is up.
Parameters
| Name | Type | |
|---|---|---|
won | boolean | |
options optional | ActOptions |
Returns
Promise<MicroPhantomState>
Types
holdPhantomsInShaft
holdPhantomsInShaft(shaft: number, options?: ActOptions) => Promise<Running>Holds every phantom in shaft shaft (1 to 6), its light on, so each round is caught: what a bot does. Stop the handle to let them go.
Parameters
| Name | Type | |
|---|---|---|
shaft | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
holdTorch
holdTorch(x: number, y: number, options?: ActOptions) => Promise<Running>Holds the torch at a point, written after the scene's own frame so it is where the scene reads it. Stop the handle to let go (the torch stays where it was put).
Parameters
| Name | Type | |
|---|---|---|
x | number | |
y | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves from a round lost (onLose_No) as from anywhere else (onCloseButton).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
nextRound
nextRound(options?: ActOptions) => Promise<MicroPhantomState>Goes on from a round won (onWinnerNextLevel).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPhantomState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroPhantomState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPhantomState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MicroPhantomState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroPhantomState>
Types
state
state() => Promise<MicroPhantomState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroPhantomState \| null>
whenState
whenState(test: (state: MicroPhantomState) => boolean, options?: ActOptions) => Promise<MicroPhantomState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroPhantomState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroPhantomState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroPhantomState | null, previous: MicroPhantomState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroPhantomState | null, previous: MicroPhantomState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microPopcorn
Popcorn.
className
className: "game.microPopcorn.MicroPopcorn"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroPopcornState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroPopcornState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroPopcornState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPopcornState>
Types
client
client() => TypedFlash<MicroPopcorn>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroPopcorn>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"readySetGo", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"readySetGo", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroPopcornState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPopcornState>
Types
set
set(values: Partial<Record<"readySetGo", FieldValue>>, options?: ActOptions) => Promise<MicroPopcornState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"readySetGo", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroPopcornState>
Types
setCaught
setCaught(caught: number, options?: ActOptions) => Promise<MicroPopcornState>Sets the popcorn caught (below 15) and redraws the meter (updatePopcornMeter).
Parameters
| Name | Type | |
|---|---|---|
caught | number | |
options optional | ActOptions |
Returns
Promise<MicroPopcornState>
Types
start
start(options?: ActOptions) => Promise<MicroPopcornState>Starts the round from its first dialog (onStart), once the dialog has gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPopcornState>
Types
state
state() => Promise<MicroPopcornState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroPopcornState \| null>
whenState
whenState(test: (state: MicroPopcornState) => boolean, options?: ActOptions) => Promise<MicroPopcornState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroPopcornState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroPopcornState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroPopcornState | null, previous: MicroPopcornState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroPopcornState | null, previous: MicroPopcornState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microPuppy
Puppy Frisbee.
className
className: "game.microPuppy.MicroPuppy"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroPuppyState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroPuppyState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroPuppyState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPuppyState>
Types
client
client() => TypedFlash<MicroPuppy>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroPuppy>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"paused", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"paused", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
pause
pause(paused?: boolean, options?: ActOptions) => Promise<MicroPuppyState>Pauses or unpauses the round (gamePaused on the scene); resolves with the round.
Parameters
| Name | Type | |
|---|---|---|
paused optional | boolean | |
options optional | ActOptions |
Returns
Promise<MicroPuppyState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroPuppyState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroPuppyState>
Types
set
set(values: Partial<Record<"paused", FieldValue>>, options?: ActOptions) => Promise<MicroPuppyState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"paused", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroPuppyState>
Types
state
state() => Promise<MicroPuppyState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroPuppyState \| null>
whenState
whenState(test: (state: MicroPuppyState) => boolean, options?: ActOptions) => Promise<MicroPuppyState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroPuppyState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroPuppyState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroPuppyState | null, previous: MicroPuppyState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroPuppyState | null, previous: MicroPuppyState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microSmoothie
Smoothie.
className
className: "game.microSmoothie.MicroSmoothie"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroSmoothieState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroSmoothieState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroSmoothieState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroSmoothieState>
Types
chooseFlavor
chooseFlavor(flavor: "grape" | "orange" | "strawberry" | "banana", options?: ActOptions) => Promise<MicroSmoothieState>Picks the flavour from its dialog (onFlavorGrape…), once the dialog has gone.
Parameters
| Name | Type | |
|---|---|---|
flavor | "grape" | "orange" | "strawberry" | "banana" | |
options optional | ActOptions |
Returns
Promise<MicroSmoothieState>
Types
client
client() => TypedFlash<MicroSmoothie>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroSmoothie>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroSmoothieState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroSmoothieState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MicroSmoothieState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroSmoothieState>
Types
setCaught
setCaught(caught: number, options?: ActOptions) => Promise<MicroSmoothieState>Sets the fruit caught (below 10) and redraws the meter (updateFruitMeter).
Parameters
| Name | Type | |
|---|---|---|
caught | number | |
options optional | ActOptions |
Returns
Promise<MicroSmoothieState>
Types
state
state() => Promise<MicroSmoothieState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroSmoothieState \| null>
whenState
whenState(test: (state: MicroSmoothieState) => boolean, options?: ActOptions) => Promise<MicroSmoothieState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroSmoothieState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroSmoothieState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroSmoothieState | null, previous: MicroSmoothieState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroSmoothieState | null, previous: MicroSmoothieState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microSnake
Pet Snake.
className
className: "game.microSnake.MicroSnake"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroSnakeState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroSnakeState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroSnakeState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroSnakeState>
Types
client
client() => TypedFlash<MicroSnake>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroSnake>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"left" | "right" | "down" | "up" | "speed" | "points", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "down" | "up" | "speed" | "points", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroSnakeState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroSnakeState>
Types
quit
quit(options?: ActOptions) => Promise<void>Leaves from the game over dialog, as its "no" does (onExit); resolves once it is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
set
set(values: Partial<Record<"left" | "right" | "down" | "up" | "speed" | "points", FieldValue>>, options?: ActOptions) => Promise<MicroSnakeState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "down" | "up" | "speed" | "points", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroSnakeState>
Types
state
state() => Promise<MicroSnakeState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroSnakeState \| null>
turn
turn(direction: "left" | "right" | "down" | "up", options?: ActOptions) => Promise<MicroSnakeState>Turns the snake as an arrow key does (keyboardHandler), and resolves once it heads that way. Throws TIMEOUT when the game would not turn: before it moves, or straight back on itself.
Parameters
| Name | Type | |
|---|---|---|
direction | "left" | "right" | "down" | "up" | |
options optional | ActOptions |
Returns
Promise<MicroSnakeState>
Types
whenState
whenState(test: (state: MicroSnakeState) => boolean, options?: ActOptions) => Promise<MicroSnakeState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroSnakeState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroSnakeState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroSnakeState | null, previous: MicroSnakeState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroSnakeState | null, previous: MicroSnakeState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microStoneMining
Stone Mining.
className
className: "game.microStoneMining.MicroStoneMining"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroStoneMiningState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroStoneMiningState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroStoneMiningState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroStoneMiningState>
Types
client
client() => TypedFlash<MicroStoneMining>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroStoneMining>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroStoneMiningState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroStoneMiningState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MicroStoneMiningState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroStoneMiningState>
Types
state
state() => Promise<MicroStoneMiningState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroStoneMiningState \| null>
whenState
whenState(test: (state: MicroStoneMiningState) => boolean, options?: ActOptions) => Promise<MicroStoneMiningState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroStoneMiningState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroStoneMiningState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroStoneMiningState | null, previous: MicroStoneMiningState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroStoneMiningState | null, previous: MicroStoneMiningState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.microWoodGather
Wood Gather.
className
className: "game.microWoodGather.MicroWoodGather"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MicroWoodGatherState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MicroWoodGatherState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MicroWoodGatherState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroWoodGatherState>
Types
client
client() => TypedFlash<MicroWoodGather>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MicroWoodGather>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<MicroWoodGatherState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MicroWoodGatherState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MicroWoodGatherState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MicroWoodGatherState>
Types
state
state() => Promise<MicroWoodGatherState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MicroWoodGatherState \| null>
whenState
whenState(test: (state: MicroWoodGatherState) => boolean, options?: ActOptions) => Promise<MicroWoodGatherState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MicroWoodGatherState) => boolean | |
options optional | ActOptions |
Returns
Promise<MicroWoodGatherState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MicroWoodGatherState | null, previous: MicroWoodGatherState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MicroWoodGatherState | null, previous: MicroWoodGatherState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.moatMadness
Moat Madness.
className
className: "game.moatMadness.MoatMadness"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<MoatMadnessState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<MoatMadnessState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<MoatMadnessState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MoatMadnessState>
Types
chooseDifficulty
chooseDifficulty(difficulty: "medium" | "easy" | "hard", options?: ActOptions) => Promise<MoatMadnessState>Picks the difficulty on the level picker, as its buttons do; resolves once it has closed.
Parameters
| Name | Type | |
|---|---|---|
difficulty | "medium" | "easy" | "hard" | |
options optional | ActOptions |
Returns
Promise<MoatMadnessState>
Types
client
client() => TypedFlash<MoatMadness>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<MoatMadness>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isConnected
isConnected() => Promise<boolean>Whether the moat as laid joins up, as the game checks it (verifyPath); false off screen.
Returns
Promise<boolean>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
next
next(options?: ActOptions) => Promise<MoatMadnessState>Goes on from the verdict: the next puzzle when solved (onNextLevel), else again (onRetry_Yes).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MoatMadnessState>
Types
pieces
pieces() => Promise<MoatMadnessPiece[]>The pieces of the moat, in one message; none when the game is not on screen.
Returns
Promise<MoatMadnessPiece[]>
playAgain
playAgain(options?: ActOptions) => Promise<MoatMadnessState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MoatMadnessState>
Types
releaseWater
releaseWater(options?: ActOptions) => Promise<MoatMadnessState>Lets the water in, as the start button does (startWater); resolves once it runs.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<MoatMadnessState>
Types
rotate
rotate(slot: number, options?: ActOptions) => Promise<MoatMadnessPiece[]>Turns a piece a quarter, as clicking it does (MoatPath.handleClick), and resolves with the pieces. Throws REFUSED when the game would not: water running, or the piece still turning.
Parameters
| Name | Type | |
|---|---|---|
slot | number | |
options optional | ActOptions |
Returns
Promise<MoatMadnessPiece[]>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<MoatMadnessState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<MoatMadnessState>
Types
state
state() => Promise<MoatMadnessState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<MoatMadnessState \| null>
whenState
whenState(test: (state: MoatMadnessState) => boolean, options?: ActOptions) => Promise<MoatMadnessState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: MoatMadnessState) => boolean | |
options optional | ActOptions |
Returns
Promise<MoatMadnessState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: MoatMadnessState | null, previous: MoatMadnessState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: MoatMadnessState | null, previous: MoatMadnessState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.pachinko
Pachinko.
className
className: "game.pachinko.Pachinko"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<PachinkoState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<PachinkoState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<PachinkoState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PachinkoState>
Types
client
client() => TypedFlash<Pachinko>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<Pachinko>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"score" | "ballsLeft", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"score" | "ballsLeft", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();launch
launch(pull: number, options?: ActOptions) => Promise<PachinkoState>Launches a ball with the spring pulled pull (0 to 100) of the way, as holding and letting go of the launcher does (startPullSpring, releaseSpring). Resolves once the ball is rolling; REFUSED while a ball is still in play or none are left.
Parameters
| Name | Type | |
|---|---|---|
pull | number | |
options optional | ActOptions |
Returns
Promise<PachinkoState>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves from the game over dialog (onExit_Yes) as from anywhere else.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<PachinkoState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PachinkoState>
Types
set
set(values: Partial<Record<"score" | "ballsLeft", FieldValue>>, options?: ActOptions) => Promise<PachinkoState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"score" | "ballsLeft", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<PachinkoState>
Types
setBallsLeft
setBallsLeft(balls: number, options?: ActOptions) => Promise<PachinkoState>Writes the balls left (at most 9) and redraws them (refreshBallIcons).
Parameters
| Name | Type | |
|---|---|---|
balls | number | |
options optional | ActOptions |
Returns
Promise<PachinkoState>
Types
setScore
setScore(score: number, options?: ActOptions) => Promise<PachinkoState>Writes the score and redraws it (updateScore).
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<PachinkoState>
Types
state
state() => Promise<PachinkoState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<PachinkoState \| null>
whenState
whenState(test: (state: PachinkoState) => boolean, options?: ActOptions) => Promise<PachinkoState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: PachinkoState) => boolean | |
options optional | ActOptions |
Returns
Promise<PachinkoState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: PachinkoState | null, previous: PachinkoState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: PachinkoState | null, previous: PachinkoState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.parachuteGlider
Parachute Glider.
className
className: "game.parachuteGlider.ParachuteGlider"The game's class, as the client names it.
addPhantom
addPhantom(speed: { x: number; y: number; }, at: { row: number; column: number; }, options?: ActOptions) => Promise<ParachuteGliderState>Puts a phantom on the course (createPhantom), moving at a speed from a row and column.
Parameters
| Name | Type | |
|---|---|---|
speed | { x: number; y: number; } | |
at | { row: number; column: number; } | |
options optional | ActOptions |
Returns
Promise<ParachuteGliderState>
Types
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<ParachuteGliderState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<ParachuteGliderState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<ParachuteGliderState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ParachuteGliderState>
Types
client
client() => TypedFlash<ParachuteGlider>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<ParachuteGlider>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
finish
finish(options?: ActOptions) => Promise<void>Leaves once the drop is over, as its "great job" yes does; resolves once the game is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
gliders
gliders() => Promise<ParachuteGliderGlider[]>Every glider of the drop, in one message.
Returns
Promise<ParachuteGliderGlider[]>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"left" | "right" | "course" | "row" | "depth" | "scroll" | "controlsSeen", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "course" | "row" | "depth" | "scroll" | "controlsSeen", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepFallSpeed
keepFallSpeed(speed: number, options?: ActOptions) => Promise<Running>Holds the player's own glider's fall speed (_serverVelocity.y) until the handle is stopped.
Parameters
| Name | Type | |
|---|---|---|
speed | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<ParachuteGliderState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ParachuteGliderState>
Types
set
set(values: Partial<Record<"left" | "right" | "course" | "row" | "depth" | "scroll" | "controlsSeen", FieldValue>>, options?: ActOptions) => Promise<ParachuteGliderState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "course" | "row" | "depth" | "scroll" | "controlsSeen", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<ParachuteGliderState>
Types
state
state() => Promise<ParachuteGliderState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<ParachuteGliderState \| null>
steer
steer(arrow: "left" | "right" | "down" | "up", down: boolean, options?: ActOptions) => Promise<ParachuteGliderState>Presses or lets go of an arrow, as the keyboard does; resolves once the game counts it.
Parameters
| Name | Type | |
|---|---|---|
arrow | "left" | "right" | "down" | "up" | |
down | boolean | |
options optional | ActOptions |
Returns
Promise<ParachuteGliderState>
Types
takeGem
takeGem(id: number, options?: ActOptions) => Promise<ParachuteGliderState>Picks up one of the course's gems by its id (gemPickup).
Parameters
| Name | Type | |
|---|---|---|
id | number | |
options optional | ActOptions |
Returns
Promise<ParachuteGliderState>
Types
whenState
whenState(test: (state: ParachuteGliderState) => boolean, options?: ActOptions) => Promise<ParachuteGliderState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: ParachuteGliderState) => boolean | |
options optional | ActOptions |
Returns
Promise<ParachuteGliderState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: ParachuteGliderState | null, previous: ParachuteGliderState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: ParachuteGliderState | null, previous: ParachuteGliderState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.phantomFighter
Phantom Fighter.
className
className: "game.phantomFighter.PhantomFighter"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<PhantomFighterState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<PhantomFighterState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<PhantomFighterState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomFighterState>
Types
board
board() => Promise<PhantomFighterField | null>The field of play; null off screen.
Returns
Promise<PhantomFighterField \| null>
client
client() => TypedFlash<PhantomFighter>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PhantomFighter>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
holdKey
holdKey(key: "left" | "right" | "down" | "up" | "fire", held: boolean, options?: ActOptions) => Promise<PhantomFighterState>Presses or lets go of a key, as the keyboard does (keyboardPressed, keyboardReleased).
Parameters
| Name | Type | |
|---|---|---|
key | "left" | "right" | "down" | "up" | "fire" | |
held | boolean | |
options optional | ActOptions |
Returns
Promise<PhantomFighterState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"left" | "right" | "down" | "up" | "elapsed" | "lives" | "round" | "destroyed" | "fire" | "canShoot" | "controlsRemoved" | "targetX" | "targetY" | "respawnIn" | "inFormation" | "attackIndex" | "levelTextShown" | "backgroundBoost" | "backgroundY" | "cloudsY", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "down" | "up" | "elapsed" | "lives" | "round" | "destroyed" | "fire" | "canShoot" | "controlsRemoved" | "targetX" | "targetY" | "respawnIn" | "inFormation" | "attackIndex" | "levelTextShown" | "backgroundBoost" | "backgroundY" | "cloudsY", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves: straight out from game over (onExit_Yes), otherwise by asking first.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
nextLevel
nextLevel(options?: ActOptions) => Promise<PhantomFighterState>Goes on from a finished level (onNextLevel), once its dialog has gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomFighterState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<PhantomFighterState>Plays again from game over (onRetry_Yes), once its dialog has gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomFighterState>
Types
restartLevel
restartLevel(options?: ActOptions) => Promise<PhantomFighterState>Restarts the level being played (restartGame).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomFighterState>
Types
set
set(values: Partial<Record<"left" | "right" | "down" | "up" | "elapsed" | "lives" | "round" | "destroyed" | "fire" | "canShoot" | "controlsRemoved" | "targetX" | "targetY" | "respawnIn" | "inFormation" | "attackIndex" | "levelTextShown" | "backgroundBoost" | "backgroundY" | "cloudsY", FieldValue>>, options?: ActOptions) => Promise<PhantomFighterState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "down" | "up" | "elapsed" | "lives" | "round" | "destroyed" | "fire" | "canShoot" | "controlsRemoved" | "targetX" | "targetY" | "respawnIn" | "inFormation" | "attackIndex" | "levelTextShown" | "backgroundBoost" | "backgroundY" | "cloudsY", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<PhantomFighterState>
Types
setScore
setScore(score: number, options?: ActOptions) => Promise<PhantomFighterState>Sets the score the game's own way (IncrementScore by the difference), which pays its gems.
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<PhantomFighterState>
Types
setWeapon
setWeapon(weapon: "normal" | "powerful" | "triple" | "explosive" | "rapid", options?: ActOptions) => Promise<PhantomFighterState>Gives the ship a weapon, as a powerup does (_player1.upgrade).
Parameters
| Name | Type | |
|---|---|---|
weapon | "normal" | "powerful" | "triple" | "explosive" | "rapid" | |
options optional | ActOptions |
Returns
Promise<PhantomFighterState>
Types
state
state() => Promise<PhantomFighterState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<PhantomFighterState \| null>
whenState
whenState(test: (state: PhantomFighterState) => boolean, options?: ActOptions) => Promise<PhantomFighterState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: PhantomFighterState) => boolean | |
options optional | ActOptions |
Returns
Promise<PhantomFighterState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onKey
onKey(listener: (key: { what: "down" | "up" | "dialog" | "nextLevelCard" | "gameOverCard"; keyCode: number; }) => void) => () => voidHears the player's keys: pressed, let go, and on the level and game over cards.
Parameters
| Name | Type | |
|---|---|---|
listener | (key: { what: "down" | "up" | "dialog" | "nextLevelCard" | "gameOverCard"; keyCode: number; }) => void |
Returns
() => void. Call it to stop listening.
onResult
onResult(listener: (result: PhantomFighterResult) => void) => () => voidHears a level end: game over (with whether it was won) or the next level.
Parameters
| Name | Type | |
|---|---|---|
listener | (result: PhantomFighterResult) => void |
Returns
() => void. Call it to stop listening.
onScore
onScore(listener: (score: { added: number; score: number; gemsPaid: number; }) => void) => () => voidHears points scored (IncrementScore): how many, the score before, and the gems paid.
Parameters
| Name | Type | |
|---|---|---|
listener | (score: { added: number; score: number; gemsPaid: number; }) => void |
Returns
() => void. Call it to stop listening.
onShip
onShip(listener: (ship: { what: "spawned" | "wave" | "lost" | "powerup" | "revived"; lives: number; wave: number; phantoms: number; }) => void) => () => voidHears the ship spawned, revived or lost, a wave laid out, and a powerup dropped.
Parameters
| Name | Type | |
|---|---|---|
listener | (ship: { what: "spawned" | "wave" | "lost" | "powerup" | "revived"; lives: number; wave: number; phantoms: number; }) => void |
Returns
() => void. Call it to stop listening.
onShot
onShot(listener: (shot: { what: "player" | "phantom" | "done" | "hit"; phantoms: number; playerShots: number; destroyed: number; }) => void) => () => voidHears shots: a phantom hit, a shot spent, the player's or a phantom's shot fired.
Parameters
| Name | Type | |
|---|---|---|
listener | (shot: { what: "player" | "phantom" | "done" | "hit"; phantoms: number; playerShots: number; destroyed: number; }) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: PhantomFighterState | null, previous: PhantomFighterState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: PhantomFighterState | null, previous: PhantomFighterState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.phantomsTreasure
Phantom's Treasure.
className
className: "game.phantomsTreasure.PhantomsTreasure"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<PhantomsTreasureState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<PhantomsTreasureState>Asks to leave from the options (opened first), as their exit does.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
client
client() => TypedFlash<PhantomsTreasure>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PhantomsTreasure>
Types
Example
closeOptions
closeOptions(options?: ActOptions) => Promise<PhantomsTreasureState>Closes the options and plays on (onUnpause).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
hint
hint(options?: ActOptions) => Promise<PhantomsTreasureState>Uses a hint, as its button does (hintButtonPressed); resolves once it shows.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"seconds", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"seconds", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
levelSelect
levelSelect(options?: ActOptions) => Promise<PhantomsTreasureState>Back to the level select, from the options or a finished level (onLevelSelect).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
nextLevel
nextLevel(options?: ActOptions) => Promise<PhantomsTreasureState>Goes on to the next level once one is done, through its fact and "great job".
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
objects
objects() => Promise<PhantomsTreasureObject[]>The level's hidden objects (_hiddenObjects), in one message; none off screen.
Returns
Promise<PhantomsTreasureObject[]>
openOptions
openOptions(options?: ActOptions) => Promise<PhantomsTreasureState>Opens the options, as the close button does (showOptions); the level pauses under them.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<PhantomsTreasureState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
selectStage
selectStage(stage: 0 | 1, options?: ActOptions) => Promise<PhantomsTreasureState>Picks a stage (0 or 1) from the title screen or the level select; resolves as the level starts.
Parameters
| Name | Type | |
|---|---|---|
stage | 0 | 1 | |
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
set
set(values: Partial<Record<"seconds", FieldValue>>, options?: ActOptions) => Promise<PhantomsTreasureState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"seconds", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
setHintsUsed
setHintsUsed(used: number, options?: ActOptions) => Promise<PhantomsTreasureState>Sets how many hints the level has used (0 to 3), and redraws the hint button to match.
Parameters
| Name | Type | |
|---|---|---|
used | number | |
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
state
state() => Promise<PhantomsTreasureState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<PhantomsTreasureState \| null>
whenState
whenState(test: (state: PhantomsTreasureState) => boolean, options?: ActOptions) => Promise<PhantomsTreasureState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: PhantomsTreasureState) => boolean | |
options optional | ActOptions |
Returns
Promise<PhantomsTreasureState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: PhantomsTreasureState | null, previous: PhantomsTreasureState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: PhantomsTreasureState | null, previous: PhantomsTreasureState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.pillBugs
Pill Bugs.
className
className: "game.pillBugs.PillBugs"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<PillBugsState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<PillBugsState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<PillBugsState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
chooseDifficulty
chooseDifficulty(difficulty: "medium" | "easy" | "hard", options?: ActOptions) => Promise<PillBugsState>Chooses the difficulty on its dialog (onDifficultySelect_*).
Parameters
| Name | Type | |
|---|---|---|
difficulty | "medium" | "easy" | "hard" | |
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
client
client() => TypedFlash<PillBugs>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PillBugs>
Types
Example
closeOptions
closeOptions(toLevelSelect?: boolean, options?: ActOptions) => Promise<PillBugsState>Closes the options: back to play, or to the level select (onExit_LevelSelect).
Parameters
| Name | Type | |
|---|---|---|
toLevelSelect optional | boolean | |
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"gems" | "length" | "set" | "height" | "mouseX" | "mouseY" | "width" | "scale" | "elapsed" | "factIndex" | "lastTime" | "gravity" | "timeStep" | "iterations" | "tutorialShown" | "aim" | "ballSpeed" | "bounce1" | "bounce2" | "bounce3" | "bounce4" | "bounce5" | "bonusBounce" | "wallBounce" | "drawnAt" | "guideAim" | "resetting" | "leftHeld" | "rightHeld" | "turning", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"gems" | "length" | "set" | "height" | "mouseX" | "mouseY" | "width" | "scale" | "elapsed" | "factIndex" | "lastTime" | "gravity" | "timeStep" | "iterations" | "tutorialShown" | "aim" | "ballSpeed" | "bounce1" | "bounce2" | "bounce3" | "bounce4" | "bounce5" | "bonusBounce" | "wallBounce" | "drawnAt" | "guideAim" | "resetting" | "leftHeld" | "rightHeld" | "turning", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepAim
keepAim(degrees: number, options?: ActOptions) => Promise<Running>Holds the launcher's aim until stopped.
Parameters
| Name | Type | |
|---|---|---|
degrees | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
keepBalls
keepBalls(balls: number, options?: ActOptions) => Promise<Running>Holds the balls left, and their counter, until stopped.
Parameters
| Name | Type | |
|---|---|---|
balls | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
launch
launch(options?: ActOptions) => Promise<PillBugsState>Launches a ball, as a click does (onMouseClick): only with no dialog up and no ball in play. Resolves once the ball is in play.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
next
next(options?: ActOptions) => Promise<PillBugsState>Goes on from the dialog up: how to play, a result, a level done, the game won or lost.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
openScreen
openScreen(screen: "ready" | "difficulty" | "options" | "result" | "levelSelect" | "howToPlay", options?: ActOptions) => Promise<PillBugsState>Puts up one of the game's screens with its own method (showLevelSelectPopup…).
Parameters
| Name | Type | |
|---|---|---|
screen | "ready" | "difficulty" | "options" | "result" | "levelSelect" | "howToPlay" | |
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
pageLevels
pageLevels(direction: "next" | "last", options?: ActOptions) => Promise<PillBugsState>Turns the level select to the next or the last set of six.
Parameters
| Name | Type | |
|---|---|---|
direction | "next" | "last" | |
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<PillBugsState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
restartLevel
restartLevel(options?: ActOptions) => Promise<PillBugsState>Restarts the level, from play or the options (onExit_RestartLevel).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
selectLevel
selectLevel(level: number, options?: ActOptions) => Promise<PillBugsState>Picks a level (1 to 30) on the level select, turning to its set of six first. Throws REFUSED for a level not unlocked yet (no stars on it).
Parameters
| Name | Type | |
|---|---|---|
level | number | |
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
set
set(values: Partial<Record<"gems" | "length" | "set" | "height" | "mouseX" | "mouseY" | "width" | "scale" | "elapsed" | "factIndex" | "lastTime" | "gravity" | "timeStep" | "iterations" | "tutorialShown" | "aim" | "ballSpeed" | "bounce1" | "bounce2" | "bounce3" | "bounce4" | "bounce5" | "bonusBounce" | "wallBounce" | "drawnAt" | "guideAim" | "resetting" | "leftHeld" | "rightHeld" | "turning", FieldValue>>, options?: ActOptions) => Promise<PillBugsState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"gems" | "length" | "set" | "height" | "mouseX" | "mouseY" | "width" | "scale" | "elapsed" | "factIndex" | "lastTime" | "gravity" | "timeStep" | "iterations" | "tutorialShown" | "aim" | "ballSpeed" | "bounce1" | "bounce2" | "bounce3" | "bounce4" | "bounce5" | "bonusBounce" | "wallBounce" | "drawnAt" | "guideAim" | "resetting" | "leftHeld" | "rightHeld" | "turning", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
setAim
setAim(degrees: number, options?: ActOptions) => Promise<PillBugsState>Aims the launcher (-73 to 73 degrees); resolves with the state.
Parameters
| Name | Type | |
|---|---|---|
degrees | number | |
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
setBalls
setBalls(balls: number, options?: ActOptions) => Promise<PillBugsState>Sets the balls left during a level, and the counter that shows them.
Parameters
| Name | Type | |
|---|---|---|
balls | number | |
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
setLevelScore
setLevelScore(score: number, options?: ActOptions) => Promise<PillBugsState>Sets the level's score during a level, and the counter that shows it.
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
state
state() => Promise<PillBugsState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<PillBugsState \| null>
whenState
whenState(test: (state: PillBugsState) => boolean, options?: ActOptions) => Promise<PillBugsState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: PillBugsState) => boolean | |
options optional | ActOptions |
Returns
Promise<PillBugsState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onAim
onAim(listener: (aim: { aim: number; guideAim: number; balls: number; }) => void) => () => voidHears the aim guide drawn again (updateAimReference).
Parameters
| Name | Type | |
|---|---|---|
listener | (aim: { aim: number; guideAim: number; balls: number; }) => void |
Returns
() => void. Call it to stop listening.
onHit
onHit(listener: (hit: PillBugsHit) => void) => () => voidHears the ball hit something (processCollision), or a golden bug (pegType1Hit).
Parameters
| Name | Type | |
|---|---|---|
listener | (hit: PillBugsHit) => void |
Returns
() => void. Call it to stop listening.
onLaunch
onLaunch(listener: (launch: PillBugsLaunch) => void) => () => voidHears a ball launched: the click (onMouseClick) and the ball made (createBall).
Parameters
| Name | Type | |
|---|---|---|
listener | (launch: PillBugsLaunch) => void |
Returns
() => void. Call it to stop listening.
onLevel
onLevel(listener: (level: PillBugsLevelStep) => void) => () => voidHears a level set up, started, moved on from (setNextLevel) and ended.
Parameters
| Name | Type | |
|---|---|---|
listener | (level: PillBugsLevelStep) => void |
Returns
() => void. Call it to stop listening.
onResult
onResult(listener: (result: PillBugsResult) => void) => () => voidHears a level's result: cleared (showGreatJobDlg) or lost (showGameOverDlg).
Parameters
| Name | Type | |
|---|---|---|
listener | (result: PillBugsResult) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: PillBugsState | null, previous: PillBugsState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: PillBugsState | null, previous: PillBugsState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.pvpMemory
Two player Memory.
className
className: "game.pVP_Memory.PVP_Memory"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<PvpMemoryState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<PvpMemoryState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<PvpMemoryState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PvpMemoryState>
Types
client
client() => TypedFlash<PVP_Memory>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PVP_Memory>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
emote
emote(emote: number, options?: ActOptions) => Promise<PvpMemoryState>Shows an emote over the player's side (the scene's emoteClicked).
Parameters
| Name | Type | |
|---|---|---|
emote | number | |
options optional | ActOptions |
Returns
Promise<PvpMemoryState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
pick
pick(card: number, options?: ActOptions) => Promise<PvpMemoryState>Turns a card (0 to 15, row by row) as clicking it does (the scene's cardPicked), on the player's turn; resolves once the game has counted it.
Parameters
| Name | Type | |
|---|---|---|
card | number | |
options optional | ActOptions |
Returns
Promise<PvpMemoryState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<PvpMemoryState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<PvpMemoryState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<PvpMemoryState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<PvpMemoryState>
Types
state
state() => Promise<PvpMemoryState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<PvpMemoryState \| null>
whenState
whenState(test: (state: PvpMemoryState) => boolean, options?: ActOptions) => Promise<PvpMemoryState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: PvpMemoryState) => boolean | |
options optional | ActOptions |
Returns
Promise<PvpMemoryState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: PvpMemoryState | null, previous: PvpMemoryState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: PvpMemoryState | null, previous: PvpMemoryState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.questParachuteGlider
Parachute Glider (adventure).
className
className: "game.questParachuteGlider.QuestParachuteGlider"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<QuestParachuteGliderState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<QuestParachuteGliderState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<QuestParachuteGliderState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<QuestParachuteGliderState>
Types
client
client() => TypedFlash<QuestParachuteGlider>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<QuestParachuteGlider>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<QuestParachuteGliderState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<QuestParachuteGliderState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<QuestParachuteGliderState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<QuestParachuteGliderState>
Types
state
state() => Promise<QuestParachuteGliderState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<QuestParachuteGliderState \| null>
steer
steer(direction: QuestParachuteGliderSteer, options?: ActOptions) => Promise<QuestParachuteGliderState>Steers as the arrow keys do (_leftArrowDown, _rightArrowDown); resolves with the state.
Parameters
| Name | Type | |
|---|---|---|
direction | QuestParachuteGliderSteer | |
options optional | ActOptions |
Returns
Promise<QuestParachuteGliderState>
Types
whenState
whenState(test: (state: QuestParachuteGliderState) => boolean, options?: ActOptions) => Promise<QuestParachuteGliderState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: QuestParachuteGliderState) => boolean | |
options optional | ActOptions |
Returns
Promise<QuestParachuteGliderState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: QuestParachuteGliderState | null, previous: QuestParachuteGliderState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: QuestParachuteGliderState | null, previous: QuestParachuteGliderState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.riverRace
River Race.
className
className: "game.riverRace.RiverRace"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<RiverRaceState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<RiverRaceState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<RiverRaceState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<RiverRaceState>
Types
client
client() => TypedFlash<RiverRace>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<RiverRace>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
finish
finish(options?: ActOptions) => Promise<void>Leaves from the results card, as its OK does (onExit_Yes); resolves once the game is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"left" | "right" | "length" | "down" | "up" | "countdown" | "controlsSeen" | "nextSlot" | "resultsTotal", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "length" | "down" | "up" | "countdown" | "controlsSeen" | "nextSlot" | "resultsTotal", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepMaxSpeed
keepMaxSpeed(speed: number, options?: ActOptions) => Promise<Running>Holds the top speed of the player's own raft, whichever it is, until the handle stops.
Parameters
| Name | Type | |
|---|---|---|
speed | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<RiverRaceState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<RiverRaceState>
Types
rafts
rafts() => Promise<RiverRaceRaft[]>The rafts in the race, in one message.
Returns
Promise<RiverRaceRaft[]>
set
set(values: Partial<Record<"left" | "right" | "length" | "down" | "up" | "countdown" | "controlsSeen" | "nextSlot" | "resultsTotal", FieldValue>>, options?: ActOptions) => Promise<RiverRaceState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "length" | "down" | "up" | "countdown" | "controlsSeen" | "nextSlot" | "resultsTotal", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<RiverRaceState>
Types
state
state() => Promise<RiverRaceState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<RiverRaceState \| null>
steer
steer(arrow: "left" | "right" | "down" | "up", down: boolean, options?: ActOptions) => Promise<RiverRaceState>Holds or lets go of an arrow, as the keyboard does (keyHandleDown / keyHandleUp).
Parameters
| Name | Type | |
|---|---|---|
arrow | "left" | "right" | "down" | "up" | |
down | boolean | |
options optional | ActOptions |
Returns
Promise<RiverRaceState>
Types
turbo
turbo(options?: ActOptions) => Promise<RiverRaceRaft[]>Boosts the player's raft, as passing through a turbo buoy does (insideBuoy).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<RiverRaceRaft[]>
Types
whenState
whenState(test: (state: RiverRaceState) => boolean, options?: ActOptions) => Promise<RiverRaceState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: RiverRaceState) => boolean | |
options optional | ActOptions |
Returns
Promise<RiverRaceState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onGameMessage
onGameMessage(listener: () => void) => () => voidHears the server's messages reach the game (message).
Parameters
| Name | Type | |
|---|---|---|
listener | () => void |
Returns
() => void. Call it to stop listening.
onInput
onInput(listener: (input: RiverRaceInput) => void) => () => voidHears the keys the game takes: arrows down and up, and the results card's keys.
Parameters
| Name | Type | |
|---|---|---|
listener | (input: RiverRaceInput) => void |
Returns
() => void. Call it to stop listening.
onLifecycle
onLifecycle(listener: (step: RiverRaceLifecycleStep) => void) => () => voidHears the steps of the game's life: built, courses laid, race started, results, ended.
Parameters
| Name | Type | |
|---|---|---|
listener | (step: RiverRaceLifecycleStep) => void |
Returns
() => void. Call it to stop listening.
onPhase
onPhase(listener: (now: { phase: RiverRacePhase; gameState: number; }) => void) => () => voidHears the race move from one phase to the next (setGameState).
Parameters
| Name | Type | |
|---|---|---|
listener | (now: { phase: RiverRacePhase; gameState: number; }) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: RiverRaceState | null, previous: RiverRaceState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: RiverRaceState | null, previous: RiverRaceState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.rockPaperScissors
Rock Paper Scissors.
className
className: "game.pVP_RockPaperScissor.PVP_RockPaperScissor"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<RockPaperScissorsState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<RockPaperScissorsState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<RockPaperScissorsState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<RockPaperScissorsState>
Types
choose
choose(hand: number, options?: ActOptions) => Promise<void>Plays a hand, sending it as the game's clock does (time), once it has gone out.
Parameters
| Name | Type | |
|---|---|---|
hand | number | |
options optional | ActOptions |
Returns
Promise<void>
Types
client
client() => TypedFlash<PVP_RockPaperScissor>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PVP_RockPaperScissor>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"secondsLeft", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"secondsLeft", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
leaveNow
leaveNow(options?: ActOptions) => Promise<void>Leaves at once (onExitButton), with no question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<RockPaperScissorsState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<RockPaperScissorsState>
Types
set
set(values: Partial<Record<"secondsLeft", FieldValue>>, options?: ActOptions) => Promise<RockPaperScissorsState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"secondsLeft", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<RockPaperScissorsState>
Types
state
state() => Promise<RockPaperScissorsState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<RockPaperScissorsState \| null>
whenState
whenState(test: (state: RockPaperScissorsState) => boolean, options?: ActOptions) => Promise<RockPaperScissorsState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: RockPaperScissorsState) => boolean | |
options optional | ActOptions |
Returns
Promise<RockPaperScissorsState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onReveal
onReveal(listener: (reveal: RockPaperScissorsReveal) => void) => () => voidHears the hands revealed (mark), with how the round went; the other player leaving wins.
Parameters
| Name | Type | |
|---|---|---|
listener | (reveal: RockPaperScissorsReveal) => void |
Returns
() => void. Call it to stop listening.
onRoundStart
onRoundStart(listener: (round: { opponent: number; }) => void) => () => voidHears a round start (round), with the other player's id.
Parameters
| Name | Type | |
|---|---|---|
listener | (round: { opponent: number; }) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: RockPaperScissorsState | null, previous: RockPaperScissorsState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: RockPaperScissorsState | null, previous: RockPaperScissorsState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.safetyQuiz
Safety Quiz.
className
className: "game.safetyQuiz.SafetyQuiz"The game's class, as the client names it.
answer
answer(choice: number, options?: ActOptions) => Promise<SafetyQuizState>Chooses and submits an answer.
Parameters
| Name | Type | |
|---|---|---|
choice | number | |
options optional | ActOptions |
Returns
Promise<SafetyQuizState>
Types
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<SafetyQuizState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<SafetyQuizState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<SafetyQuizState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SafetyQuizState>
Types
client
client() => TypedFlash<SafetyQuiz>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<SafetyQuiz>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"question" | "correct", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"question" | "correct", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
next
next(options?: ActOptions) => Promise<SafetyQuizState>Moves on to the next question at once, rather than waiting for the game to.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SafetyQuizState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<SafetyQuizState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SafetyQuizState>
Types
select
select(choice: number, options?: ActOptions) => Promise<SafetyQuizState>Chooses an answer (0 to 2) as clicking it does: the circle, and the vote button lit.
Parameters
| Name | Type | |
|---|---|---|
choice | number | |
options optional | ActOptions |
Returns
Promise<SafetyQuizState>
Types
set
set(values: Partial<Record<"question" | "correct", FieldValue>>, options?: ActOptions) => Promise<SafetyQuizState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"question" | "correct", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<SafetyQuizState>
Types
showRules
showRules(options?: ActOptions) => Promise<SafetyQuizState>Shows the rules (onRulesDown).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SafetyQuizState>
Types
state
state() => Promise<SafetyQuizState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<SafetyQuizState \| null>
submit
submit(options?: ActOptions) => Promise<SafetyQuizState>Submits the answer chosen (onSubmitBtnDown), and resolves once the game has judged it.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SafetyQuizState>
Types
whenState
whenState(test: (state: SafetyQuizState) => boolean, options?: ActOptions) => Promise<SafetyQuizState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: SafetyQuizState) => boolean | |
options optional | ActOptions |
Returns
Promise<SafetyQuizState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: SafetyQuizState | null, previous: SafetyQuizState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: SafetyQuizState | null, previous: SafetyQuizState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.scooped
Scooped.
className
className: "game.pVP_Scooped.PVP_Scooped"The game's class, as the client names it.
add
add(piece: number, options?: ActOptions) => Promise<ScoopedState>Adds a piece to the cone, as clicking its button does (a mouseUp on flav<n> or top<n>). Only while playing and not busy (REFUSED otherwise); resolves with the round once the game has taken it.
Parameters
| Name | Type | |
|---|---|---|
piece | number | |
options optional | ActOptions |
Returns
Promise<ScoopedState>
Types
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<ScoopedState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<ScoopedState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<ScoopedState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ScoopedState>
Types
client
client() => TypedFlash<PVP_Scooped>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PVP_Scooped>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<ScoopedState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ScoopedState>
Types
ready
ready(options?: ActOptions) => Promise<void>Says the player is ready, from the instructions (sendReady, which sends ready).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<ScoopedState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<ScoopedState>
Types
state
state() => Promise<ScoopedState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<ScoopedState \| null>
whenState
whenState(test: (state: ScoopedState) => boolean, options?: ActOptions) => Promise<ScoopedState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: ScoopedState) => boolean | |
options optional | ActOptions |
Returns
Promise<ScoopedState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onButton
onButton(listener: (button: "ready" | "exit") => void) => () => voidHears the player press ready (sendReady) or the close button (showExitConfirmationDlg).
Parameters
| Name | Type | |
|---|---|---|
listener | (button: "ready" | "exit") => void |
Returns
() => void. Call it to stop listening.
onCone
onCone(listener: (cone: ScoopedCone) => void) => () => voidHears a cone finished, by either player.
Parameters
| Name | Type | |
|---|---|---|
listener | (cone: ScoopedCone) => void |
Returns
() => void. Call it to stop listening.
onDropped
onDropped(listener: (cone: ScoopedCone) => void) => () => voidHears a cone dropped for a wrong piece, by either player.
Parameters
| Name | Type | |
|---|---|---|
listener | (cone: ScoopedCone) => void |
Returns
() => void. Call it to stop listening.
onPiece
onPiece(listener: (piece: ScoopedPiece) => void) => () => voidHears a piece added, by either player.
Parameters
| Name | Type | |
|---|---|---|
listener | (piece: ScoopedPiece) => void |
Returns
() => void. Call it to stop listening.
onPieceClick
onPieceClick(listener: (click: { piece: number; name: string; accepted: boolean; }) => void) => () => voidHears the player click a piece (mouseClick), and whether the game would take it.
Parameters
| Name | Type | |
|---|---|---|
listener | (click: { piece: number; name: string; accepted: boolean; }) => void |
Returns
() => void. Call it to stop listening.
onResult
onResult(listener: (result: ScoopedResult) => void) => () => voidHears the round end (setGameState to over).
Parameters
| Name | Type | |
|---|---|---|
listener | (result: ScoopedResult) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: ScoopedState | null, previous: ScoopedState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: ScoopedState | null, previous: ScoopedState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.shellGame
Shell Game.
className
className: "game.pVP_ShellGame.PVP_ShellGame"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<ShellGameState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<ShellGameState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<ShellGameState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ShellGameState>
Types
client
client() => TypedFlash<PVP_ShellGame>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PVP_ShellGame>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"roundLeft", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"roundLeft", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepRoundTimer
keepRoundTimer(seconds?: number, options?: KeepOptions & ActOptions) => Promise<Running>Holds the pick clock at seconds (6 by default) until the handle is stopped.
Parameters
| Name | Type | |
|---|---|---|
seconds optional | number | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
leaveNow
leaveNow(options?: ActOptions) => Promise<void>Leaves at once, as the match's own exit button does (onExitButton).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
pick
pick(shell: number, options?: ActOptions) => Promise<void>Picks a shell (0 to 2), sending the game's own time with it; resolves once it has gone out.
Parameters
| Name | Type | |
|---|---|---|
shell | number | |
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<ShellGameState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ShellGameState>
Types
seats
seats() => Promise<[ShellGameSeat, ShellGameSeat] | null>The two seats: each player's name and animal, and whether the animal is drawn yet.
Returns
Promise<[ShellGameSeat, ShellGameSeat] \| null>
set
set(values: Partial<Record<"roundLeft", FieldValue>>, options?: ActOptions) => Promise<ShellGameState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"roundLeft", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<ShellGameState>
Types
state
state() => Promise<ShellGameState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<ShellGameState \| null>
whenState
whenState(test: (state: ShellGameState) => boolean, options?: ActOptions) => Promise<ShellGameState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: ShellGameState) => boolean | |
options optional | ActOptions |
Returns
Promise<ShellGameState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onReveal
onReveal(listener: (reveal: ShellGameReveal) => void) => () => voidHears the picks revealed (mm mark), and the round's outcome for the player.
Parameters
| Name | Type | |
|---|---|---|
listener | (reveal: ShellGameReveal) => void |
Returns
() => void. Call it to stop listening.
onRoundStart
onRoundStart(listener: (round: ShellGameRound) => void) => () => voidHears a round start (mm round): the opponent and the shell the pearl is under.
Parameters
| Name | Type | |
|---|---|---|
listener | (round: ShellGameRound) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: ShellGameState | null, previous: ShellGameState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: ShellGameState | null, previous: ShellGameState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.shootingGallery
Shooting Gallery.
className
className: "game.shootingGallery.ShootingGallery"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<ShootingGalleryState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<ShootingGalleryState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<ShootingGalleryState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ShootingGalleryState>
Types
client
client() => TypedFlash<ShootingGallery>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<ShootingGallery>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
fire
fire(options?: ActOptions) => Promise<ShootingGalleryState>Fires a dart (shoot), as space does: only while a level is being played, with a dart loaded and the reload done. Resolves once the dart is gone from the belt.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ShootingGalleryState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"tickets" | "left" | "right" | "up" | "highScore" | "tutorialShown" | "cannonX" | "phantomsOnly" | "attackers" | "letterIndex" | "space" | "cannonSpeed" | "reload" | "dartSpeed" | "targetSpeed" | "rowEvery", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"tickets" | "left" | "right" | "up" | "highScore" | "tutorialShown" | "cannonX" | "phantomsOnly" | "attackers" | "letterIndex" | "space" | "cannonSpeed" | "reload" | "dartSpeed" | "targetSpeed" | "rowEvery", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepDarts
keepDarts(darts: number, options?: ActOptions) => Promise<Running>Holds the darts left at darts, the belt redrawn each frame, until stopped.
Parameters
| Name | Type | |
|---|---|---|
darts | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves: straight away from the menu, the results or the leave question (onStart_No).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
levels
levels() => Promise<ShootingGalleryLevel[]>The levels as the game's data has them; none when it is not on screen.
Returns
Promise<ShootingGalleryLevel[]>
play
play(options?: ActOptions) => Promise<ShootingGalleryState>Starts a game from the menu or the results (onStart_Yes), once its card is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ShootingGalleryState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<ShootingGalleryState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<ShootingGalleryState>
Types
pressKey
pressKey(key: "left" | "right" | "up" | "space", down: boolean, options?: ActOptions) => Promise<ShootingGalleryState>Presses or lets go of a key, as the keyboard does (onKeyDown / onKeyUp).
Parameters
| Name | Type | |
|---|---|---|
key | "left" | "right" | "up" | "space" | |
down | boolean | |
options optional | ActOptions |
Returns
Promise<ShootingGalleryState>
Types
set
set(values: Partial<Record<"tickets" | "left" | "right" | "up" | "highScore" | "tutorialShown" | "cannonX" | "phantomsOnly" | "attackers" | "letterIndex" | "space" | "cannonSpeed" | "reload" | "dartSpeed" | "targetSpeed" | "rowEvery", FieldValue>>, options?: ActOptions) => Promise<ShootingGalleryState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"tickets" | "left" | "right" | "up" | "highScore" | "tutorialShown" | "cannonX" | "phantomsOnly" | "attackers" | "letterIndex" | "space" | "cannonSpeed" | "reload" | "dartSpeed" | "targetSpeed" | "rowEvery", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<ShootingGalleryState>
Types
setDarts
setDarts(darts: number, options?: ActOptions) => Promise<ShootingGalleryState>Sets the darts left mid-game and redraws the belt (_numDarts, ammoBelt.ammo).
Parameters
| Name | Type | |
|---|---|---|
darts | number | |
options optional | ActOptions |
Returns
Promise<ShootingGalleryState>
Types
state
state() => Promise<ShootingGalleryState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<ShootingGalleryState \| null>
whenState
whenState(test: (state: ShootingGalleryState) => boolean, options?: ActOptions) => Promise<ShootingGalleryState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: ShootingGalleryState) => boolean | |
options optional | ActOptions |
Returns
Promise<ShootingGalleryState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onInput
onInput(listener: (input: ShootingGalleryInput) => void) => () => voidHears the keys the game is handed (onKeyDown, onKeyUp, and the menu's onCarnPlayKeyDown).
Parameters
| Name | Type | |
|---|---|---|
listener | (input: ShootingGalleryInput) => void |
Returns
() => void. Call it to stop listening.
onNextLevel
onNextLevel(listener: (level: number) => void) => () => voidHears the game go on to the next level (doNextLevel), by the level reached, from 1.
Parameters
| Name | Type | |
|---|---|---|
listener | (level: number) => void |
Returns
() => void. Call it to stop listening.
onPopup
onPopup(listener: (popup: ShootingGalleryPopup) => void) => () => voidHears a score pop up where a target was hit (doScorePopup).
Parameters
| Name | Type | |
|---|---|---|
listener | (popup: ShootingGalleryPopup) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: ShootingGalleryState | null, previous: ShootingGalleryState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: ShootingGalleryState | null, previous: ShootingGalleryState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.skeeball
Skee-Ball.
className
className: "game.skeeball.Skeeball"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<SkeeballState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<SkeeballState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<SkeeballState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SkeeballState>
Types
client
client() => TypedFlash<Skeeball>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<Skeeball>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"tickets" | "highScore" | "timeStep" | "iterations" | "meterDirection" | "ringsLayered" | "startY" | "textureX" | "textureY" | "directionX" | "directionY" | "arrowSpeed" | "meterSpeed" | "slowest" | "fastest", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"tickets" | "highScore" | "timeStep" | "iterations" | "meterDirection" | "ringsLayered" | "startY" | "textureX" | "textureY" | "directionX" | "directionY" | "arrowSpeed" | "meterSpeed" | "slowest" | "fastest", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();laneEdges
laneEdges() => Promise<{ left: number; right: number; } | null>Where the lane's walls are (getLeftX, getRightX); null when the game is not on screen.
Returns
Promise<{ left: number; right: number; } \| null>
leave
leave(options?: ActOptions) => Promise<void>Leaves: straight away from the menu, the results or the leave question (onStart_No).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
play
play(options?: ActOptions) => Promise<SkeeballState>Starts a game from the menu or the results (onStart_Yes), once its card is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SkeeballState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<SkeeballState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SkeeballState>
Types
roll
roll(roll: { angle: number; power?: number | undefined; }, options?: ActOptions) => Promise<SkeeballState>Rolls a ball: the arrow set to angle (-45 to 45), a press, the meter set to power (0 to 100, full by default) and a second press, in one frame as the bridge batches them. Only while aiming; resolves once the ball is rolling.
Parameters
| Name | Type | |
|---|---|---|
roll | { angle: number; power?: number | undefined; } | |
options optional | ActOptions |
Returns
Promise<SkeeballState>
Types
set
set(values: Partial<Record<"tickets" | "highScore" | "timeStep" | "iterations" | "meterDirection" | "ringsLayered" | "startY" | "textureX" | "textureY" | "directionX" | "directionY" | "arrowSpeed" | "meterSpeed" | "slowest" | "fastest", FieldValue>>, options?: ActOptions) => Promise<SkeeballState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"tickets" | "highScore" | "timeStep" | "iterations" | "meterDirection" | "ringsLayered" | "startY" | "textureX" | "textureY" | "directionX" | "directionY" | "arrowSpeed" | "meterSpeed" | "slowest" | "fastest", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<SkeeballState>
Types
setBallsLeft
setBallsLeft(balls: number, options?: ActOptions) => Promise<SkeeballState>Sets the balls left mid-game (_numBalls) and redraws them (loadBalls).
Parameters
| Name | Type | |
|---|---|---|
balls | number | |
options optional | ActOptions |
Returns
Promise<SkeeballState>
Types
state
state() => Promise<SkeeballState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<SkeeballState \| null>
whenState
whenState(test: (state: SkeeballState) => boolean, options?: ActOptions) => Promise<SkeeballState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: SkeeballState) => boolean | |
options optional | ActOptions |
Returns
Promise<SkeeballState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onGlowHole
onGlowHole(listener: (hole: number) => void) => () => voidHears a hole lit for the bonus (chooseGlowHole), by its number.
Parameters
| Name | Type | |
|---|---|---|
listener | (hole: number) => void |
Returns
() => void. Call it to stop listening.
onHoleCheck
onHoleCheck(listener: (check: SkeeballHoleCheck) => void) => () => voidHears the game check the holes: as the ball rolls (preCheckHoles) and once settled.
Parameters
| Name | Type | |
|---|---|---|
listener | (check: SkeeballHoleCheck) => void |
Returns
() => void. Call it to stop listening.
onPopup
onPopup(listener: (popup: SkeeballPopup) => void) => () => voidHears a score pop up over a hole (doScorePopup).
Parameters
| Name | Type | |
|---|---|---|
listener | (popup: SkeeballPopup) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: SkeeballState | null, previous: SkeeballState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: SkeeballState | null, previous: SkeeballState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.spiderShooter
Spider Shooter.
className
className: "game.spiderShooter.SpiderShooter"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<SpiderShooterState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<SpiderShooterState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<SpiderShooterState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SpiderShooterState>
Types
client
client() => TypedFlash<SpiderShooter>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<SpiderShooter>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"gems" | "radius0" | "radius1", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"gems" | "radius0" | "radius1", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
nextWave
nextWave(options?: ActOptions) => Promise<SpiderShooterState>Goes on to the next wave from the wave's results (onResults_Next, Great_Job).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SpiderShooterState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<SpiderShooterState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SpiderShooterState>
Types
set
set(values: Partial<Record<"gems" | "radius0" | "radius1", FieldValue>>, options?: ActOptions) => Promise<SpiderShooterState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"gems" | "radius0" | "radius1", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<SpiderShooterState>
Types
setShotRadius
setShotRadius(radius: number, options?: ActOptions) => Promise<SpiderShooterState>Makes the player's own shot hit wider (_shotRadius); resolves with the state after.
Parameters
| Name | Type | |
|---|---|---|
radius | number | |
options optional | ActOptions |
Returns
Promise<SpiderShooterState>
Types
shoot
shoot(options?: ActOptions) => Promise<SpiderShooterState>Shoots where the pointer is, as a click does (mouseClickHandler). Only while a wave is being played and nothing is paused; resolves with the state after the shot.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SpiderShooterState>
Types
state
state() => Promise<SpiderShooterState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<SpiderShooterState \| null>
whenState
whenState(test: (state: SpiderShooterState) => boolean, options?: ActOptions) => Promise<SpiderShooterState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: SpiderShooterState) => boolean | |
options optional | ActOptions |
Returns
Promise<SpiderShooterState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: SpiderShooterState | null, previous: SpiderShooterState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: SpiderShooterState | null, previous: SpiderShooterState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.spotOn
Spot On.
className
className: "game.spotOn.SpotOn"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<SpotOnState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<SpotOnState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<SpotOnState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SpotOnState>
Types
client
client() => TypedFlash<SpotOn>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<SpotOn>
Types
Example
decline
decline(options?: ActOptions) => Promise<void>Turns down the game at its start (onStart_No), once the game is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<never, FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
pause
pause(paused?: boolean, options?: ActOptions) => Promise<SpotOnState>Pauses or unpauses, with the scene's flag and its clock (pausingWithTheTimer).
Parameters
| Name | Type | |
|---|---|---|
paused optional | boolean | |
options optional | ActOptions |
Returns
Promise<SpotOnState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<SpotOnState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SpotOnState>
Types
set
set(values: Partial<Record<never, FieldValue>>, options?: ActOptions) => Promise<SpotOnState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<never, FieldValue>> | |
options optional | ActOptions |
Returns
Promise<SpotOnState>
Types
state
state() => Promise<SpotOnState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<SpotOnState \| null>
whenState
whenState(test: (state: SpotOnState) => boolean, options?: ActOptions) => Promise<SpotOnState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: SpotOnState) => boolean | |
options optional | ActOptions |
Returns
Promise<SpotOnState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: SpotOnState | null, previous: SpotOnState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: SpotOnState | null, previous: SpotOnState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.superSort
Super Sort.
className
className: "game.superSort.SuperSort"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<SuperSortState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<SuperSortState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<SuperSortState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SuperSortState>
Types
client
client() => TypedFlash<SuperSort>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<SuperSort>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
facts
facts() => Promise<SuperSortFact[]>The game's facts (_facts), in the order it holds them; none when it is not on screen.
Returns
Promise<SuperSortFact[]>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"fact", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"fact", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
nextFact
nextFact(options?: ActOptions) => Promise<SuperSortState>Shows the next fact (loadNextRecycleImage).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SuperSortState>
Types
nextLevel
nextLevel(options?: ActOptions) => Promise<SuperSortState>Goes on from a level's "great job" (onNextLevel).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SuperSortState>
Types
pause
pause(paused?: boolean, options?: ActOptions) => Promise<SuperSortState>Pauses or unpauses the scene (pauseGame / unpauseGame on it).
Parameters
| Name | Type | |
|---|---|---|
paused optional | boolean | |
options optional | ActOptions |
Returns
Promise<SuperSortState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<SuperSortState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<SuperSortState>
Types
set
set(values: Partial<Record<"fact", FieldValue>>, options?: ActOptions) => Promise<SuperSortState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"fact", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<SuperSortState>
Types
state
state() => Promise<SuperSortState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<SuperSortState \| null>
tip
tip(side: "left" | "right", options?: ActOptions) => Promise<SuperSortState>Tips the paddle left or right, as the arrow key does (keyHandleDown).
Parameters
| Name | Type | |
|---|---|---|
side | "left" | "right" | |
options optional | ActOptions |
Returns
Promise<SuperSortState>
Types
whenState
whenState(test: (state: SuperSortState) => boolean, options?: ActOptions) => Promise<SuperSortState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: SuperSortState) => boolean | |
options optional | ActOptions |
Returns
Promise<SuperSortState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: SuperSortState | null, previous: SuperSortState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: SuperSortState | null, previous: SuperSortState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.ticTacToe
Tic Tac Toe.
className
className: "game.pVP_TicTacToe.PVP_TicTacToe"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<TicTacToeState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<TicTacToeState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<TicTacToeState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TicTacToeState>
Types
board
board() => Promise<TicTacToeBoard | null>The board as marked this round, rows of three, from the player's side. Null off screen.
Returns
Promise<TicTacToeBoard \| null>
client
client() => TypedFlash<PVP_TicTacToe>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<PVP_TicTacToe>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"timer", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"timer", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepTurnTime
keepTurnTime(seconds: number, options?: ActOptions) => Promise<Running>Holds the turn clock at seconds (at most 15) while a round is played.
Parameters
| Name | Type | |
|---|---|---|
seconds | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
mark
mark(x: number, y: number, options?: ActOptions) => Promise<void>Marks a square (mark, 0 to 2 each way), once the move has gone to the server.
Parameters
| Name | Type | |
|---|---|---|
x | number | |
y | number | |
options optional | ActOptions |
Returns
Promise<void>
Types
opponent
opponent() => Promise<number | null>The other player's id in the room, or null before a round.
Returns
Promise<number \| null>
playAgain
playAgain(options?: ActOptions) => Promise<TicTacToeState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TicTacToeState>
Types
set
set(values: Partial<Record<"timer", FieldValue>>, options?: ActOptions) => Promise<TicTacToeState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"timer", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<TicTacToeState>
Types
state
state() => Promise<TicTacToeState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<TicTacToeState \| null>
whenState
whenState(test: (state: TicTacToeState) => boolean, options?: ActOptions) => Promise<TicTacToeState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: TicTacToeState) => boolean | |
options optional | ActOptions |
Returns
Promise<TicTacToeState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onMarked
onMarked(listener: (mark: TicTacToeMarked) => void) => () => voidHears a square marked (mark), by the player or the opponent.
Parameters
| Name | Type | |
|---|---|---|
listener | (mark: TicTacToeMarked) => void |
Returns
() => void. Call it to stop listening.
onRoundEnd
onRoundEnd(listener: (outcome: TicTacToeOutcome) => void) => () => voidHears a round end: a win, a loss or a tie by the mark that ended it, or a win when the other player left.
Parameters
| Name | Type | |
|---|---|---|
listener | (outcome: TicTacToeOutcome) => void |
Returns
() => void. Call it to stop listening.
onRoundStart
onRoundStart(listener: (round: TicTacToeRound) => void) => () => voidHears a round start (round): the opponent, and whether the player goes first.
Parameters
| Name | Type | |
|---|---|---|
listener | (round: TicTacToeRound) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: TicTacToeState | null, previous: TicTacToeState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: TicTacToeState | null, previous: TicTacToeState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.touchPool
Touch Pool.
className
className: "game.touchPool.TouchPool"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<TouchPoolState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<TouchPoolState \| null>
Types
answerPrize
answerPrize(keep: boolean, options?: ActOptions) => Promise<TouchPoolState>Keeps or turns down the prize on offer (keptItem / rejectedItem).
Parameters
| Name | Type | |
|---|---|---|
keep | boolean | |
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<TouchPoolState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
client
client() => TypedFlash<TouchPool>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<TouchPool>
Types
Example
closeFact
closeFact(options?: ActOptions) => Promise<TouchPoolState>Closes the open fact (doneButtonClick).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
closeLog
closeLog(options?: ActOptions) => Promise<TouchPoolState>Closes the log book (closeLog).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
closePrize
closePrize(options?: ActOptions) => Promise<TouchPoolState>Takes the prize popup down (destroyPrizePopup).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
closeTutorial
closeTutorial(options?: ActOptions) => Promise<TouchPoolState>Closes the tutorial, as its button does (onExit_No).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
creatures
creatures() => Promise<TouchPoolCreature[]>The creatures in the pool (_creatures), with where each is drawn.
Returns
Promise<TouchPoolCreature[]>
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
fact
fact() => Promise<TouchPoolFact | null>The fact shown or last shown, with its strings by id. Null off screen.
Returns
Promise<TouchPoolFact \| null>
flee
flee(index: number, options?: ActOptions) => Promise<TouchPoolState>Makes one creature (0–11) flee (creatureFlee).
Parameters
| Name | Type | |
|---|---|---|
index | number | |
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"x" | "y" | "queued" | "factType" | "factColour" | "factPage" | "touchTime", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"x" | "y" | "queued" | "factType" | "factColour" | "factPage" | "touchTime", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
logBook
logBook() => Promise<TouchPoolLogBook | null>The log book: each kind's colours found, its count and its present. Null off screen.
Returns
Promise<TouchPoolLogBook \| null>
openPresent
openPresent(kind: number, options?: ActOptions) => Promise<TouchPoolState>Opens a kind's present in the log book (1–6): awardGift, which offers its prize.
Parameters
| Name | Type | |
|---|---|---|
kind | number | |
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
pickFact
pickFact(colour: number, options?: ActOptions) => Promise<TouchPoolState>Shows a colour's fact (1–5) on the open fact (setFactButtons).
Parameters
| Name | Type | |
|---|---|---|
colour | number | |
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<TouchPoolState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
queueFact
queueFact(type: number, colour: number, options?: ActOptions) => Promise<TouchPoolState>Queues the fact for a creature kind (0–5) and colour (1–5), shown at the next chance.
Parameters
| Name | Type | |
|---|---|---|
type | number | |
colour | number | |
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
respawn
respawn(index: number, options?: ActOptions) => Promise<TouchPoolState>Brings one creature (0–11) back somewhere else (respawnCreature).
Parameters
| Name | Type | |
|---|---|---|
index | number | |
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
scrollTo
scrollTo(x: number, y: number, options?: ActOptions) => Promise<TouchPoolState>Scrolls the pool, kept inside its edges as dragging it is.
Parameters
| Name | Type | |
|---|---|---|
x | number | |
y | number | |
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
set
set(values: Partial<Record<"x" | "y" | "queued" | "factType" | "factColour" | "factPage" | "touchTime", FieldValue>>, options?: ActOptions) => Promise<TouchPoolState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"x" | "y" | "queued" | "factType" | "factColour" | "factPage" | "touchTime", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
setFactPage
setFactPage(page: number, options?: ActOptions) => Promise<TouchPoolState>Turns the open fact to a kind's page (1–6).
Parameters
| Name | Type | |
|---|---|---|
page | number | |
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
spawnPoints
spawnPoints() => Promise<{ x: number; y: number; used: boolean; }[]>Where creatures can surface (_poolPoints), and which are taken.
Returns
Promise<{ x: number; y: number; used: boolean; }[]>
state
state() => Promise<TouchPoolState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<TouchPoolState \| null>
toggleLog
toggleLog(options?: ActOptions) => Promise<TouchPoolState>Opens or closes the log book, as its button does (logClick). Not under a dialog.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
touch
touch(options?: ActOptions) => Promise<TouchPoolState>Finishes the touch being made at once (touchCreature). Only while touching one.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
whenState
whenState(test: (state: TouchPoolState) => boolean, options?: ActOptions) => Promise<TouchPoolState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: TouchPoolState) => boolean | |
options optional | ActOptions |
Returns
Promise<TouchPoolState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: TouchPoolState | null, previous: TouchPoolState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: TouchPoolState | null, previous: TouchPoolState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.towerDefense
Tower Defense.
className
className: "game.towerDefense.TowerDefense"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<TowerDefenseState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<TowerDefenseState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<TowerDefenseState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
board
board() => Promise<{ pathIndex: number; path: number[]; pathIndices: number[]; paths: number[][]; obstacles: number[][]; taken: number[]; level: number; levels: number; waves: number; waveUsedHitpoints: number; waitingForNextLevel: boolean; sparePests: number; } | null>The board: the paths, the obstacles, the squares taken, and the level's waves.
Returns
Promise<{ pathIndex: number; path: number[]; pathIndices: number[]; paths: number[][]; obstacles: number[][]; taken: number[]; level: number; levels: number; waves: number; waveUsedHitpoints: number; waitingForNextLevel: boolean; sparePests: number; } \| null>
cancelDrag
cancelDrag(options?: ActOptions) => Promise<TowerDefenseState>Drops the tower being dragged instead of putting it down (killCurrentDrag). Resolves with the state once no tower is held; throws NOT_READY when none is being dragged.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
chooseMode
chooseMode(mode: "normal" | "easy" | "hard" | "tutorial", options?: ActOptions) => Promise<TowerDefenseState>Picks the difficulty, as its button does (onBtnTutorial, onBtnEasy, …).
Parameters
| Name | Type | |
|---|---|---|
mode | "normal" | "easy" | "hard" | "tutorial" | |
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
client
client() => TypedFlash<TowerDefense>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<TowerDefense>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
dismiss
dismiss(options?: ActOptions) => Promise<TowerDefenseState>Closes a hint (hintClose) or a pest's fact (hideNGFact).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"score" | "highScore" | "elapsed" | "speed" | "lastTime" | "frameTime" | "lives" | "modeIndex" | "tokens" | "endless" | "pathIndex" | "tutorialStep" | "tutorialLivesLostShown" | "waitingForNextLevel", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"score" | "highScore" | "elapsed" | "speed" | "lastTime" | "frameTime" | "lives" | "modeIndex" | "tokens" | "endless" | "pathIndex" | "tutorialStep" | "tutorialLivesLostShown" | "waitingForNextLevel", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves, asking first unless the difficulty is still being chosen (which leaves at once).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
placeTower
placeTower(options?: ActOptions) => Promise<TowerDefenseState>Puts down the tower being dragged (placeTower), or drops it (killCurrentDrag).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<TowerDefenseState>Plays again from the game over (onRetry) or a win (onExit_No, the endless run on).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
quit
quit(options?: ActOptions) => Promise<void>Leaves from the game over or a win (onExit_Yes); the close button's way is leave.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
run
run() => Promise<{ pestsStopped: number; tarantulasStopped: number; bankedGems: number; factsShown: number[]; attackSounds: number[]; sceneLoaded: boolean; dataLoaded: boolean; started: boolean; waitingForData: boolean; openTower: "plant" | "frog" | "lizard" | "snake"; myId: number; playerIds: number[]; dbIds: number[]; pestNames: number[]; pestFacts: { image: string; text: number; }[]; } | null>The run's bookkeeping: its clock, what it stopped, its gems, the tutorial, its loading.
Returns
Promise<{ pestsStopped: number; tarantulasStopped: number; bankedGems: number; factsShown: number[]; attackSounds: number[]; sceneLoaded: boolean; dataLoaded: boolean; started: boolean; waitingForData: boolean; openTower: "plant" \| "frog" \| "lizard" \| "snake"; myId: number; playerIds: number[]; dbIds: number[]; pestNames: number[]; pestFacts: { image: string; text: number; }[]; } \| null>
sellTower
sellTower(index: number, options?: ActOptions) => Promise<TowerDefenseState>Sells a placed tower (by its place in towers()); resolves once it is off the board.
Parameters
| Name | Type | |
|---|---|---|
index | number | |
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
set
set(values: Partial<Record<"score" | "highScore" | "elapsed" | "speed" | "lastTime" | "frameTime" | "lives" | "modeIndex" | "tokens" | "endless" | "pathIndex" | "tutorialStep" | "tutorialLivesLostShown" | "waitingForNextLevel", FieldValue>>, options?: ActOptions) => Promise<TowerDefenseState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"score" | "highScore" | "elapsed" | "speed" | "lastTime" | "frameTime" | "lives" | "modeIndex" | "tokens" | "endless" | "pathIndex" | "tutorialStep" | "tutorialLivesLostShown" | "waitingForNextLevel", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
setFast
setFast(fast: boolean, options?: ActOptions) => Promise<TowerDefenseState>Runs the game fast or at its own pace, as the fast forward button does (fastForward).
Parameters
| Name | Type | |
|---|---|---|
fast | boolean | |
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
setLives
setLives(lives: number, options?: ActOptions) => Promise<TowerDefenseState>Sets the lives, and the counter on the board (healthText).
Parameters
| Name | Type | |
|---|---|---|
lives | number | |
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
setMuted
setMuted(muted: boolean, options?: ActOptions) => Promise<TowerDefenseState>Mutes or unmutes the game, as its button does (toggleMute).
Parameters
| Name | Type | |
|---|---|---|
muted | boolean | |
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
setScore
setScore(score: number, options?: ActOptions) => Promise<TowerDefenseState>Sets the score, and the counter on the board (scoreText).
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
setTowerRange
setTowerRange(tower: "plant" | "frog" | "lizard" | "snake", squares: number, options?: ActOptions) => Promise<TowerDefenseState>How far a kind of tower reaches, in squares (_attackRange).
Parameters
| Name | Type | |
|---|---|---|
tower | "plant" | "frog" | "lizard" | "snake" | |
squares | number | |
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
showHint
showHint(options?: ActOptions) => Promise<TowerDefenseState>Shows the hint, as its button does (showHintDlg). Not under another dialog.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
state
state() => Promise<TowerDefenseState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<TowerDefenseState \| null>
towers
towers() => Promise<TowerDefenseTower[]>The towers on the board. None off screen.
Returns
Promise<TowerDefenseTower[]>
tuning
tuning() => Promise<{ damage: number[][]; rate: number[][]; range: number[]; damageModifier: number[][]; damageModifier2: number[][]; damageModifier3: number[][]; priority: number[][]; hitpoints: number[]; speeds: number[]; towerCost: number[][]; startingTokens: number[]; tokenAwards: number[]; scoreAwards: number[]; } | null>The game's balance: every tower's damage, rate and range, the pests' hit points and speeds.
Returns
Promise<{ damage: number[][]; rate: number[][]; range: number[]; damageModifier: number[][]; damageModifier2: number[][]; damageModifier3: number[][]; priority: number[][]; hitpoints: number[]; speeds: number[]; towerCost: number[][]; startingTokens: number[]; tokenAwards: number[]; scoreAwards: number[]; } \| null>
upgradeTower
upgradeTower(index: number, options?: ActOptions) => Promise<TowerDefenseTower>Upgrades a placed tower (by its place in towers()), as its options do (upgrade). REFUSED when it is at its last upgrade or the tokens are short (getUpgradeCost).
Parameters
| Name | Type | |
|---|---|---|
index | number | |
options optional | ActOptions |
Returns
Promise<TowerDefenseTower>
Types
whenState
whenState(test: (state: TowerDefenseState) => boolean, options?: ActOptions) => Promise<TowerDefenseState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: TowerDefenseState) => boolean | |
options optional | ActOptions |
Returns
Promise<TowerDefenseState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onAttack
onAttack(listener: (tower: "plant" | "frog" | "lizard" | "snake" | null) => void) => () => voidHears a kind of tower attack (attack).
Parameters
| Name | Type | |
|---|---|---|
listener | (tower: "plant" | "frog" | "lizard" | "snake" | null) => void |
Returns
() => void. Call it to stop listening.
onButton
onButton(listener: (button: string) => void) => () => voidHears the game's buttons, by what they do.
Parameters
| Name | Type | |
|---|---|---|
listener | (button: string) => void |
Returns
() => void. Call it to stop listening.
onFact
onFact(listener: (fact: { pest: "ant" | "fly" | "grasshopper" | "dragonfly" | "beetle" | "scorpion" | "tarantula" | "mouse" | null; type: number; score: number; }) => void) => () => voidHears a pest's fact shown (showNGFact).
Parameters
| Name | Type | |
|---|---|---|
listener | (fact: { pest: "ant" | "fly" | "grasshopper" | "dragonfly" | "beetle" | "scorpion" | "tarantula" | "mouse" | null; type: number; score: number; }) => void |
Returns
() => void. Call it to stop listening.
onKey
onKey(listener: (key: { card: "fact" | "complete" | "gameOver" | "hint"; code: number; }) => void) => () => voidHears a key pressed on one of the game's cards.
Parameters
| Name | Type | |
|---|---|---|
listener | (key: { card: "fact" | "complete" | "gameOver" | "hint"; code: number; }) => void |
Returns
() => void. Call it to stop listening.
onPestStopped
onPestStopped(listener: (pest: { pest: "ant" | "fly" | "grasshopper" | "dragonfly" | "beetle" | "scorpion" | "tarantula" | "mouse" | null; type: number; atPath: number; score: number; tokens: number; stoppedThisRound: number; }) => void) => () => voidHears a pest stopped (enemyKilled), with what it paid.
Parameters
| Name | Type | |
|---|---|---|
listener | (pest: { pest: "ant" | "fly" | "grasshopper" | "dragonfly" | "beetle" | "scorpion" | "tarantula" | "mouse" | null; type: number; atPath: number; score: number; tokens: number; stoppedThisRound: number; }) => void |
Returns
() => void. Call it to stop listening.
onResult
onResult(listener: (result: TowerDefenseResult) => void) => () => voidHears a game won or lost, with what it came to.
Parameters
| Name | Type | |
|---|---|---|
listener | (result: TowerDefenseResult) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: TowerDefenseState | null, previous: TowerDefenseState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: TowerDefenseState | null, previous: TowerDefenseState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
onStep
onStep(listener: (step: string) => void) => () => voidHears the game's own steps, sounds and sums run, by name: start, init, validate, data, startGame, reset, gemMultiplier, end, message; mute, unmute, play, loop, load, stop, plantDone…snakeDone; hitpoints, sellPrice, overlap, worldCoords.
Parameters
| Name | Type | |
|---|---|---|
listener | (step: string) => void |
Returns
() => void. Call it to stop listening.
onTower
onTower(listener: (event: TowerDefenseTowerEvent) => void) => () => voidHears towers placed, loaded, dragged, upgraded and sold.
Parameters
| Name | Type | |
|---|---|---|
listener | (event: TowerDefenseTowerEvent) => void |
Returns
() => void. Call it to stop listening.
minigames.trivia
Trivia.
className
className: "game.trivia.Trivia"The game's class, as the client names it.
answer
answer(choice: 1 | 2 | 3, options?: ActOptions) => Promise<void>Sends an answer (1 to 3) straight to the server (sa), once it has gone out.
Parameters
| Name | Type | |
|---|---|---|
choice | 1 | 2 | 3 | |
options optional | ActOptions |
Returns
Promise<void>
Types
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<TriviaState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<TriviaState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<TriviaState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TriviaState>
Types
choose
choose(choice: 1 | 2 | 3, options?: ActOptions) => Promise<TriviaState>Chooses an answer (1 to 3) as clicking it on the board does; resolves once it is chosen.
Parameters
| Name | Type | |
|---|---|---|
choice | 1 | 2 | 3 | |
options optional | ActOptions |
Returns
Promise<TriviaState>
Types
client
client() => TypedFlash<Trivia>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<Trivia>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
emote
emote(emote: TriviaEmote, options?: ActOptions) => Promise<TriviaState>Shows an emote as its button on the board does (0 happy, 1 sad, 2 confused, 3 mad).
Parameters
| Name | Type | |
|---|---|---|
emote | TriviaEmote | |
options optional | ActOptions |
Returns
Promise<TriviaState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"gameState" | "seconds" | "choice" | "canAnswer" | "redraw" | "dancing" | "doneDancing" | "waitingForRound" | "firstRound" | "idleCount", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"gameState" | "seconds" | "choice" | "canAnswer" | "redraw" | "dancing" | "doneDancing" | "waitingForRound" | "firstRound" | "idleCount", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<TriviaState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TriviaState>
Types
players
players() => Promise<TriviaPlayer[]>The players at the shrine; none off screen.
Returns
Promise<TriviaPlayer[]>
react
react(emote: TriviaEmote, options?: ActOptions) => Promise<void>Sends an emote straight to the server (se), once it has gone out.
Parameters
| Name | Type | |
|---|---|---|
emote | TriviaEmote | |
options optional | ActOptions |
Returns
Promise<void>
Types
scoreboard
scoreboard() => Promise<TriviaScoreboard | null>The scoreboard: each player's stars, streaks and payout; null off screen.
Returns
Promise<TriviaScoreboard \| null>
set
set(values: Partial<Record<"gameState" | "seconds" | "choice" | "canAnswer" | "redraw" | "dancing" | "doneDancing" | "waitingForRound" | "firstRound" | "idleCount", FieldValue>>, options?: ActOptions) => Promise<TriviaState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"gameState" | "seconds" | "choice" | "canAnswer" | "redraw" | "dancing" | "doneDancing" | "waitingForRound" | "firstRound" | "idleCount", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<TriviaState>
Types
setBoard
setBoard(board: { questionId?: number | undefined; answers?: readonly [number, number, number] | undefined; previousCorrectAnswer?: number | undefined; }, options?: ActOptions) => Promise<TriviaState>Puts a question on the board, by its localization ids, and draws it as the game does (LocalizationManager.translateId into the board's fields). Local to this screen.
Parameters
| Name | Type | |
|---|---|---|
board | { questionId?: number | undefined; answers?: readonly [number, number, number] | undefined; previousCorrectAnswer?: number | undefined; } | |
options optional | ActOptions |
Returns
Promise<TriviaState>
Types
setClock
setClock(seconds: number, options?: ActOptions) => Promise<TriviaState>Sets the round's clock (above 0, at most 60).
Parameters
| Name | Type | |
|---|---|---|
seconds | number | |
options optional | ActOptions |
Returns
Promise<TriviaState>
Types
state
state() => Promise<TriviaState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<TriviaState \| null>
whenState
whenState(test: (state: TriviaState) => boolean, options?: ActOptions) => Promise<TriviaState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: TriviaState) => boolean | |
options optional | ActOptions |
Returns
Promise<TriviaState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onBoard
onBoard(listener: (event: TriviaBoardEvent) => void) => () => voidHears the board: up and down, an avatar placed, an answer pressed and sent, an emote pressed.
Parameters
| Name | Type | |
|---|---|---|
listener | (event: TriviaBoardEvent) => void |
Returns
() => void. Call it to stop listening.
onDialog
onDialog(listener: (event: TriviaDialogEvent) => void) => () => voidHears the game's dialogs: the leave question and its answers, the gem bonus, game over.
Parameters
| Name | Type | |
|---|---|---|
listener | (event: TriviaDialogEvent) => void |
Returns
() => void. Call it to stop listening.
onQuestion
onQuestion(listener: (question: TriviaQuestion) => void) => () => voidHears each question the server puts up (its mm), as plain ids.
Parameters
| Name | Type | |
|---|---|---|
listener | (question: TriviaQuestion) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: TriviaState | null, previous: TriviaState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: TriviaState | null, previous: TriviaState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.trueFalse
True or False.
className
className: "game.trueFalse.TrueFalse"The game's class, as the client names it.
answer
answer(choice: 1 | 2 | 3, options?: ActOptions) => Promise<void>Answers the statement straight away (sa: 1, 2 or 3), once the answer has gone out.
Parameters
| Name | Type | |
|---|---|---|
choice | 1 | 2 | 3 | |
options optional | ActOptions |
Returns
Promise<void>
Types
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<TrueFalseState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<TrueFalseState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<TrueFalseState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TrueFalseState>
Types
chooseSide
chooseSide(side: TrueFalseSide, options?: ActOptions) => Promise<TrueFalsePlayer>Walks the player's animal to the middle of a side, as clicking there does.
Parameters
| Name | Type | |
|---|---|---|
side | TrueFalseSide | |
options optional | ActOptions |
Returns
Promise<TrueFalsePlayer>
Types
client
client() => TypedFlash<TrueFalse>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<TrueFalse>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
dismiss
dismiss(options?: ActOptions) => Promise<TrueFalseState>Dismisses the tutorial or the "still there?" popup, whichever is up.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TrueFalseState>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"left" | "right" | "down" | "up" | "secondsLeft" | "choice" | "canAnswer" | "waitingForRound" | "clockRunning" | "answersCorrect" | "gemsThisRound" | "roundQuestion" | "freshPhase" | "mouseDown", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "down" | "up" | "secondsLeft" | "choice" | "canAnswer" | "waitingForRound" | "clockRunning" | "answersCorrect" | "gemsThisRound" | "roundQuestion" | "freshPhase" | "mouseDown", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<TrueFalseState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TrueFalseState>
Types
players
players() => Promise<TrueFalsePlayer[]>Every player on the stage, in one message.
Returns
Promise<TrueFalsePlayer[]>
react
react(emote: TrueFalseEmote, options?: ActOptions) => Promise<void>Shows an emote to the room (se), once it has gone out.
Parameters
| Name | Type | |
|---|---|---|
emote | TrueFalseEmote | |
options optional | ActOptions |
Returns
Promise<void>
Types
reportPosition
reportPosition(x: number, y: number, options?: ActOptions) => Promise<TrueFalseState>Tells the room where the player stands (updatePosition), as the game does each step.
Parameters
| Name | Type | |
|---|---|---|
x | number | |
y | number | |
options optional | ActOptions |
Returns
Promise<TrueFalseState>
Types
scoreboard
scoreboard() => Promise<TrueFalseScoreboard | null>The round's stars, streaks and gem payout; null when the game is not on screen.
Returns
Promise<TrueFalseScoreboard \| null>
set
set(values: Partial<Record<"left" | "right" | "down" | "up" | "secondsLeft" | "choice" | "canAnswer" | "waitingForRound" | "clockRunning" | "answersCorrect" | "gemsThisRound" | "roundQuestion" | "freshPhase" | "mouseDown", FieldValue>>, options?: ActOptions) => Promise<TrueFalseState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "down" | "up" | "secondsLeft" | "choice" | "canAnswer" | "waitingForRound" | "clockRunning" | "answersCorrect" | "gemsThisRound" | "roundQuestion" | "freshPhase" | "mouseDown", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<TrueFalseState>
Types
state
state() => Promise<TrueFalseState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<TrueFalseState \| null>
steer
steer(arrow: "left" | "right" | "down" | "up", down: boolean, options?: ActOptions) => Promise<TrueFalseState>Presses or lets go of an arrow key, as the keyboard does (onKeyDownEvt, onKeyUpEvt).
Parameters
| Name | Type | |
|---|---|---|
arrow | "left" | "right" | "down" | "up" | |
down | boolean | |
options optional | ActOptions |
Returns
Promise<TrueFalseState>
Types
walkTo
walkTo(x: number, y: number, options?: ActOptions) => Promise<TrueFalsePlayer>Walks the player's animal to a point on the stage (940 by 580).
Parameters
| Name | Type | |
|---|---|---|
x | number | |
y | number | |
options optional | ActOptions |
Returns
Promise<TrueFalsePlayer>
Types
whenState
whenState(test: (state: TrueFalseState) => boolean, options?: ActOptions) => Promise<TrueFalseState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: TrueFalseState) => boolean | |
options optional | ActOptions |
Returns
Promise<TrueFalseState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onDialog
onDialog(listener: (event: TrueFalseDialogEvent) => void) => () => voidHears the game's popups come up and get answered.
Parameters
| Name | Type | |
|---|---|---|
listener | (event: TrueFalseDialogEvent) => void |
Returns
() => void. Call it to stop listening.
onJudged
onJudged(listener: (judged: TrueFalseJudged) => void) => () => voidHears a statement judged (handleEndOfQuestion): what it was, and the player's streak.
Parameters
| Name | Type | |
|---|---|---|
listener | (judged: TrueFalseJudged) => void |
Returns
() => void. Call it to stop listening.
onQuestion
onQuestion(listener: (question: TrueFalseQuestion) => void) => () => voidHears a new statement put to the room (_question changing).
Parameters
| Name | Type | |
|---|---|---|
listener | (question: TrueFalseQuestion) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: TrueFalseState | null, previous: TrueFalseState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: TrueFalseState | null, previous: TrueFalseState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.twister
Twister.
className
className: "game.twister.Twister"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<TwisterState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<TwisterState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<TwisterState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TwisterState>
Types
client
client() => TypedFlash<Twister>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<Twister>
Types
Example
continueResult
continueResult(options?: ActOptions) => Promise<TwisterState>Goes on from the first result card to the last (showGameCompleteDlg2, showGameOverDlg2).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TwisterState>
Types
course
course() => Promise<TwisterCourse | null>Where the course stands; null when Twister is not on screen.
Returns
Promise<TwisterCourse \| null>
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"score" | "highScore" | "speed" | "running" | "birdHoldsStation" | "layoutRow" | "layoutOffset" | "cloudIndex" | "cloudDistance" | "ringIndex" | "starTrailIndex" | "whooshIndex", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"score" | "highScore" | "speed" | "running" | "birdHoldsStation" | "layoutRow" | "layoutOffset" | "cloudIndex" | "cloudDistance" | "ringIndex" | "starTrailIndex" | "whooshIndex", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();leave
leave(options?: ActOptions) => Promise<void>Leaves from the last result card (onExit_Yes) as from anywhere else.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<TwisterState>Flies again from the last result card (onExit_No).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<TwisterState>
Types
set
set(values: Partial<Record<"score" | "highScore" | "speed" | "running" | "birdHoldsStation" | "layoutRow" | "layoutOffset" | "cloudIndex" | "cloudDistance" | "ringIndex" | "starTrailIndex" | "whooshIndex", FieldValue>>, options?: ActOptions) => Promise<TwisterState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"score" | "highScore" | "speed" | "running" | "birdHoldsStation" | "layoutRow" | "layoutOffset" | "cloudIndex" | "cloudDistance" | "ringIndex" | "starTrailIndex" | "whooshIndex", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<TwisterState>
Types
state
state() => Promise<TwisterState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<TwisterState \| null>
whenState
whenState(test: (state: TwisterState) => boolean, options?: ActOptions) => Promise<TwisterState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: TwisterState) => boolean | |
options optional | ActOptions |
Returns
Promise<TwisterState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onDialog
onDialog(listener: (event: TwisterDialogEvent) => void) => () => voidHears the game's result and leave dialogs come up and get answered.
Parameters
| Name | Type | |
|---|---|---|
listener | (event: TwisterDialogEvent) => void |
Returns
() => void. Call it to stop listening.
onState
onState(listener: (state: TwisterState | null, previous: TwisterState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: TwisterState | null, previous: TwisterState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.whackPhantom
Whack a Phantom.
className
className: "game.whackPhantom.WhackPhantom"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<WhackPhantomState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<WhackPhantomState \| null>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<WhackPhantomState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<WhackPhantomState>
Types
client
client() => TypedFlash<WhackPhantom>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<WhackPhantom>
Types
Example
closeInstructions
closeInstructions(options?: ActOptions) => Promise<WhackPhantomState>Closes the instructions (onInstructions), once they have gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<WhackPhantomState>
Types
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
holes
holes() => Promise<WhackPhantomHole[]>Every hole: whether a phantom is up in it, and of which kind. None off screen.
Returns
Promise<WhackPhantomHole[]>
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"tickets" | "timer", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"tickets" | "timer", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepSecondsLeft
keepSecondsLeft(seconds: number, options?: ActOptions) => Promise<Running>Holds the clock at seconds (above 0, at most 45) while the game is on screen.
Parameters
| Name | Type | |
|---|---|---|
seconds | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
play
play(options?: ActOptions) => Promise<WhackPhantomState>Starts a round from the menu or the results (onStart_Yes), once the dialog has gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<WhackPhantomState>
Types
playAgain
playAgain(options?: ActOptions) => Promise<WhackPhantomState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<WhackPhantomState>
Types
set
set(values: Partial<Record<"tickets" | "timer", FieldValue>>, options?: ActOptions) => Promise<WhackPhantomState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"tickets" | "timer", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<WhackPhantomState>
Types
setHighScore
setHighScore(score: number, options?: ActOptions) => Promise<WhackPhantomState>Sets the high score and its counter on screen.
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<WhackPhantomState>
Types
setScore
setScore(score: number, options?: ActOptions) => Promise<WhackPhantomState>Sets the round's score and its counter on screen; not once the round is over.
Parameters
| Name | Type | |
|---|---|---|
score | number | |
options optional | ActOptions |
Returns
Promise<WhackPhantomState>
Types
state
state() => Promise<WhackPhantomState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<WhackPhantomState \| null>
whack
whack(hole: number, options?: ActOptions) => Promise<WhackPhantomState>Whacks a hole (0 to 13), as clicking it does; resolves with the score after.
Parameters
| Name | Type | |
|---|---|---|
hole | number | |
options optional | ActOptions |
Returns
Promise<WhackPhantomState>
Types
whenState
whenState(test: (state: WhackPhantomState) => boolean, options?: ActOptions) => Promise<WhackPhantomState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: WhackPhantomState) => boolean | |
options optional | ActOptions |
Returns
Promise<WhackPhantomState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: WhackPhantomState | null, previous: WhackPhantomState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: WhackPhantomState | null, previous: WhackPhantomState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
minigames.windRider
Wind Rider.
className
className: "game.windRider.WindRider"The game's class, as the client names it.
answerLeave
answerLeave(leave: boolean, options?: ActOptions) => Promise<WindRiderState | null>Answers the question askToLeave put up: leave, which resolves with null once the game is gone, or stay, which resolves with the state as play goes on.
Parameters
| Name | Type | |
|---|---|---|
leave | boolean | |
options optional | ActOptions |
Returns
Promise<WindRiderState \| null>
Types
answerPrize
answerPrize(keep: boolean, options?: ActOptions) => Promise<WindRiderState>Keeps or turns down the prize on offer (keptItem / rejectedItem).
Parameters
| Name | Type | |
|---|---|---|
keep | boolean | |
options optional | ActOptions |
Returns
Promise<WindRiderState>
Types
askToLeave
askToLeave(options?: ActOptions) => Promise<WindRiderState>Asks to leave, as the game's close button does: the game puts up its question and pauses. Only while the close button is showing. Resolves with the state under the question.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<WindRiderState>
Types
client
client() => TypedFlash<WindRider>The game's own class, typed, reached through the manager each time, so it is always the game on screen. For anything this area does not wrap; nothing checks that this game is the one there.
Returns
TypedFlash<WindRider>
Types
Example
dialog
dialog() => Promise<string | null>The name of the game's own dialog that is up (GameBase.activeDlgMC, made by showDlg from the class of that name: ExitConfirmationDlg), or null when none is or the game is not on screen.
Returns
Promise<string \| null>
finish
finish(options?: ActOptions) => Promise<void>Leaves from a finished climb's card, won or lost (onExit_Yes), once the game is gone.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
isRunning
isRunning() => Promise<boolean>Whether this game is the one on screen.
Returns
Promise<boolean>
keep
keep(values: Partial<Record<"left" | "right" | "background" | "foreground" | "down" | "up" | "countdown" | "course" | "row" | "controlsSeen" | "cloudRow" | "prizeIn", FieldValue>>, options?: KeepOptions & ActOptions) => Promise<Running>Holds the game's writable fields at these values, written in the game every frame while this game is on screen, until the handle is stopped, which puts back what was there.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "background" | "foreground" | "down" | "up" | "countdown" | "course" | "row" | "controlsSeen" | "cloudRow" | "prizeIn", FieldValue>> | |
options optional | KeepOptions & ActOptions |
Returns
Promise<Running>
Types
ActOptions · Running · KeepOptions
Example
const stay = await phantom.aj.minigames.candyCatcher.keep({ secondsLeft: 60 });
await stay.stop();keepRiseSpeed
keepRiseSpeed(speed: number, options?: ActOptions) => Promise<Running>Holds the player's own rider rising at speed (_currentVelocity.y), until stopped.
Parameters
| Name | Type | |
|---|---|---|
speed | number | |
options optional | ActOptions |
Returns
Promise<Running>
Types
leave
leave(options?: ActOptions) => Promise<void>Leaves the game by its own route: asks and answers yes where the game asks, or straight away; a game with no route of its own is left as the client leaves any (MinigameManager.leave). Resolves once the game is off screen.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
playAgain
playAgain(options?: ActOptions) => Promise<WindRiderState>Plays another round once one is over, as the game's own "play again" does. Only while that dialog is up, for a game that has one. Resolves with the new round's state.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<WindRiderState>
Types
riders
riders() => Promise<WindRiderRider[]>Every rider, the player's own flagged local; none when the game is not on screen.
Returns
Promise<WindRiderRider[]>
set
set(values: Partial<Record<"left" | "right" | "background" | "foreground" | "down" | "up" | "countdown" | "course" | "row" | "controlsSeen" | "cloudRow" | "prizeIn", FieldValue>>, options?: ActOptions) => Promise<WindRiderState>Writes the game's writable fields once, and resolves with the state after. Throws REFUSED when the game would not take a value. A value the game works out again each frame needs keep.
Parameters
| Name | Type | |
|---|---|---|
values | Partial<Record<"left" | "right" | "background" | "foreground" | "down" | "up" | "countdown" | "course" | "row" | "controlsSeen" | "cloudRow" | "prizeIn", FieldValue>> | |
options optional | ActOptions |
Returns
Promise<WindRiderState>
Types
state
state() => Promise<WindRiderState | null>The game's state, read in one message; null unless this game is on screen.
Returns
Promise<WindRiderState \| null>
steer
steer(arrow: "left" | "right" | "down" | "up", down: boolean, options?: ActOptions) => Promise<WindRiderState>Presses or lets go of an arrow, as the keyboard does (keyHandleDown / keyHandleUp).
Parameters
| Name | Type | |
|---|---|---|
arrow | "left" | "right" | "down" | "up" | |
down | boolean | |
options optional | ActOptions |
Returns
Promise<WindRiderState>
Types
takeGem
takeGem(index: number, options?: ActOptions) => Promise<WindRiderState>Picks up one of the loose gems by its index (gemPickup).
Parameters
| Name | Type | |
|---|---|---|
index | number | |
options optional | ActOptions |
Returns
Promise<WindRiderState>
Types
whenState
whenState(test: (state: WindRiderState) => boolean, options?: ActOptions) => Promise<WindRiderState>Waits for the game's state to pass test, and resolves with it. Throws TIMEOUT when it does not in time, and NOT_READY when the game leaves the screen first.
Parameters
| Name | Type | |
|---|---|---|
test | (state: WindRiderState) => boolean | |
options optional | ActOptions |
Returns
Promise<WindRiderState>
Types
Example
const over = await phantom.aj.minigames.microPuppy.whenState((round) => round.over, { timeoutMs: 120_000 });onState
onState(listener: (state: WindRiderState | null, previous: WindRiderState | null) => void, options?: { everyFrames?: number | undefined; }) => () => voidHears the game's state change, with the state before. Null while the game is not on screen, so a listener hears it start and end too. Comes back after a reload.
Parameters
| Name | Type | |
|---|---|---|
listener | (state: WindRiderState | null, previous: WindRiderState | null) => void | |
options optional | { everyFrames?: number | undefined; } |
Returns
() => void. Call it to stop listening.
Types
The types the calls above take and give, with every field. Import any of them in a plugin from @phantomclient/plugin/sdk, or use them as they are in a script.
RunningMinigame
The game on screen, whichever it is (MinigameManager._currentMinigameNonSwf).
| Field | Type | |
|---|---|---|
className | string | The game's class: game.microPuppy.MicroPuppy. |
gameDefId | number | null | Its definition id (GameBase._miniGameDefID), or null when the game has none. |
swfName | string | The movie the client lined it up as (joinGameObj.swfName); empty for none. |
phase | MinigamePhase | |
inRoom | boolean | Whether it is played inside the room (GameBase._inRoomGame). |
gems | number | Gems the game has paid this run (_totalGemsEarned). |
trackedScore | number | null | The score the game last tracked (valueTrackerCurrent), which scores.commit reports. |
idleSeconds | number | Seconds since the player last pressed anything (_gameIdleTimer). |
startedAt | number | null | When the game started, in the client's milliseconds (_gameStartTime). |
sceneName | string | The scene the game loaded (_sceneName); empty for none. |
state | number | null | The game's own state number, for the games that keep one (_gameState). |
dialog | string | null | The game's dialog up (activeDlgMC), by its class; null for none. |
MinigamePhase
Where a running game stands, as far as GameBase and MinigameManager say for any game.
type MinigamePhase = | 'loading'
/** Loaded and running. */
| 'playing'
/** Loaded, with `GameBase._pauseGame` up: a dialog of the game's own is open. */
| 'paused'
/** The server has ended it (`me`): it stays on screen until the player leaves. */
| 'over'MinigameStatus
Where the client stands with minigames (MinigameManager).
| Field | Type | |
|---|---|---|
playing | boolean | inMinigame(): the client's own reckoning, which leaves out two player games and combat. |
armed | boolean | isInReadyModeForPVP(): true as soon as the client is armed for any game. |
inRoomGame | boolean | Whether it is a game played inside the room (inInRoomGame()). |
fullRoomGame | boolean | Whether it is a game with a room of its own (inFullRoomGame). |
roomName | string | The game room's name as the server knows it; empty outside one. |
pending | PendingMinigame | null | The game lined up (joinGameObj), or null for none. |
roomEnvironment | number | null | The room's environment as the games are told it (roomEnviroType); null before a room. |
PendingMinigame
The game the client has lined up (MinigameManager.joinGameObj).
| Field | Type | |
|---|---|---|
gameDefId | number | |
name | string | Its title, translated as the client shows it. |
swfName | string | |
isPvp | boolean | Lined up as a two player challenge. |
isCustom | boolean | A two player game offered from a player's own animal. |
ActOptions
How long something that acts may take, and what may end it first.
| Field | Type | |
|---|---|---|
timeoutMs optional | number | undefined | 10 seconds by default. |
signal optional | AbortSignal | undefined |
MinigamePlayerInfo
What the client tells every game about the player.
| Field | Type | |
|---|---|---|
activePetName | string | The active pet's name as the games show it (getActivePetName); empty for none. |
member | boolean | Whether the player is a member, as the games are told (getIsPlayerMember). |
Running
What anything long-running gives back (an auto-play, a painter, a watch kept on the wall): a handle that is itself the function that stops it, with stop under its own name too, and whatever else the thing has to say (onProgress, done). Every area's long-running act returns one of these.
const answering = await phantom.aj.adventures.dialogue.autoAccept();
await answering();
await answering.stop();Stopping twice is stopping once.
type Running<Extra extends object = object> = (() => Promise<void>) & {
stop(): Promise<void>;
/** Whether it has been stopped, by the caller or by itself. */
readonly stopped: boolean;
} & ExtraMinigameStarting
type MinigameStarting = MinigameMoment & { playerIds: number[]; data: string[] }MinigameMoment
Which game a moment of the client's is about, read off MinigameManager as it happens.
| Field | Type | |
|---|---|---|
className | string | null | |
gameDefId | number | null | |
name | string | |
swfName | string | |
isPvp | boolean | |
inRoom | boolean |
MinigameOver
type MinigameOver = MinigameMoment & { data: string[]; gems: number }MinigameClosed
type MinigameClosed = MinigameMoment & { gems: number; rejoin: boolean }MinigameLobby
The waiting list (MinigameManager's lobby fields).
| Field | Type | |
|---|---|---|
waiting | boolean | Waiting for players (_frgWaiting). |
open | boolean | The waiting list window showing. |
waitingIds | number[] | |
minPlayers | number | |
maxPlayers | number | |
proModeId | number | |
returnRoom | string | The room the player goes back to (_primaryRoomName). |
rejoin | boolean | |
heldMessages | number | Game messages held until the game's movie has loaded. |
MinigameJoinOptions
How a seat is asked for.
| Field | Type | |
|---|---|---|
multiplayer optional | boolean | undefined | |
proModeId optional | number | undefined | The pro mode, which the client only ever sends for game 82. |
hostUserId optional | number | undefined | Whose in-room game to join, by their id in the room. |
subRoom optional | boolean | undefined | Send it to the game's sub room. |
MinigameSeat
A seat the server gave.
| Field | Type | |
|---|---|---|
gameDefId | number | |
waitingUserIds | number[] |
MinigameLobbyChange
type MinigameLobbyChange = MinigameMoment & {
waiting: boolean;
waitingIds: number[];
minPlayers: number;
maxPlayers: number;
}MinigameLobbyPress
type MinigameLobbyPress = MinigameMoment & {
button: 'singlePlayer' | 'multiplayer' | 'startNow' | 'close';
enabled: boolean;
}MinigamePvpState
A two player game the client is lined up for (MinigameManager._pvp*).
| Field | Type | |
|---|---|---|
gameDefId | number | |
userName | string | |
shownName | string | The name as shown: "a Jammer" for a hidden one. |
sentByMe | boolean | |
promptReplay | boolean |
MinigamePvpInvite
| Field | Type | |
|---|---|---|
gameDefId | number | |
action | number | 0 a challenge, 1 a no or a cancel. |
userName | string | |
nameVisible | boolean |
MinigamePvpPress
| Field | Type | |
|---|---|---|
button | "cancel" | "accept" | "refuse" | "dismiss" | "playAgain" | "notAgain" | |
gameDefId | number | null | |
userName | string |
MinigamePendingAwards
The client's serials and the awards waiting on one.
| Field | Type | |
|---|---|---|
gemSerial | number | null | |
scoreSerial | number | null | |
masterySerial | number | null | |
queuedGems | MinigameQueuedAward[] | |
queuedMastery | MinigameQueuedAward[] | |
masteryPopupDue | boolean |
MinigameQueuedAward
An award waiting for its serial (MinigameManager._award*Queue).
| Field | Type | |
|---|---|---|
amount | number | |
gameDefId | number |
MinigameScore
A score as the game meant it, before folding.
| Field | Type | |
|---|---|---|
score | number | The score. |
leaderboardUserVarRef | number | The game's leaderboard variable (MinigameInfo.lbUseVarRef), which the sums fold in. |
gameDefId | number | The game, by definition id. |
MinigameLeaderboard
A game's three leaderboards.
| Field | Type | |
|---|---|---|
gameDefId | number | |
allTime | LeaderboardEntry[] | |
thisWeek | LeaderboardEntry[] | |
buddies | LeaderboardEntry[] |
LeaderboardEntry
A name and score on a leaderboard.
| Field | Type | |
|---|---|---|
name | string | The player's name as the board shows it. |
score | number | Their score. |
CachedMinigameLeaderboard
A leaderboard as the client keeps it (getLeaderBoardCache), with when it kept it.
type CachedMinigameLeaderboard = MinigameLeaderboard & {
/** The client's milliseconds (`_cacheTime`); its card asks again after a minute. */
cachedAt: number;
}MinigameGemSerial
| Field | Type | |
|---|---|---|
serial | number | |
forScore | boolean |
MinigameMasterySerial
| Field | Type | |
|---|---|---|
serial | number | |
showPopup | boolean |
MinigameAwardSent
A gem or pet mastery award the client sent, unfolded as far as the serial allows.
| Field | Type | |
|---|---|---|
serial | number | null | |
award | MinigameAward | null | |
sums | MinigameAwardSums |
MinigameAward
An award as the client meant it, before folding.
| Field | Type | |
|---|---|---|
amount | number | How many gems, or mastery points, are awarded. |
gameDefId | number | The game it is for: the one the game named for a gem award, the one being played (MinigameInfoCache.currMinigameId, -1 outside one) for mastery. |
userId | number | The player's SmartFox user id (MinigameManager.userId). |
MinigameAwardSums
The three sums an award goes to the server as (sendGemAward and sendMasteryPoints, which fold them alike), in the order they are sent.
| Field | Type | |
|---|---|---|
amountSum | number | (amount + 29) * 7 + (userId + 99) * 3 + (serial + 49) * 5. |
gameSum | number | (gameDefId + 49) * 3 + (serial + 83) * 5. |
checkSum | number | (serial + userId + amount) * 3 + amount * 3. |
MinigameScoreSent
A score the client sent, unfolded as far as the score serial allows.
| Field | Type | |
|---|---|---|
serial | number | null | |
score | MinigameScore | null | |
sums | MinigameScoreSums |
MinigameScoreSums
The five sums a score goes to the server as (MinigameManager.sendScore), in the order they are sent. trackerMain, trackerVal and trackerNum are the game's own three running numbers (GameBase._trackerMain, _trackerVal and _trackerNum), each folded again here.
| Field | Type | |
|---|---|---|
mainSum | number | trackerMain + 3 * varRef. |
valueSum | number | trackerVal - 8 * varRef. |
numSum | number | trackerNum + 5 * varRef. |
varRefSum | number | varRef * 5 + 7 * serial. |
gameSum | number | gameDefId * 3 + serial. |
MinigamePayout
A payout as a game made it (GameBase.addGemsToBalance, addToPetMastery).
| Field | Type | |
|---|---|---|
className | string | null | |
gameDefId | number | null | |
amount | number | |
total | number |
MinigameRound
A run of a game that finished, and what it came to.
| Field | Type | |
|---|---|---|
gameDefId | number | null | |
name | string | |
score | number | null | |
gems | number | null | |
ended | boolean | Whether the server ended it (me). |
data | readonly string[] | |
at | number |
MinigameInfo
A game the server describes (MinigameInfo.init, in the order handleMinigameInfo reads).
| Field | Type | |
|---|---|---|
gameDefId | number | The game's definition id. |
titleStrId | number | The game's title, as a localization string id. |
extName | string | The name of the server extension that runs the game. |
swfName | string | The name of the game's movie. |
minPlayers | number | How few players the game starts with. |
maxPlayers | number | How many players it seats. |
maxSpectators | number | How many may watch. |
type | number | 0 for a game played inside the room (MinigameInfo.isInRoomGame), otherwise a full room. |
gameCardMediaId | number | The media id of the game's card. |
gameCountUserVarRef | number | The user variable that counts the games played (achievement.user-vars), or 0. |
custom1UserVarRef | number | A user variable the game keeps for itself, or 0. What it holds depends on the game. |
custom2UserVarRef | number | A second user variable the game keeps for itself, or 0. |
readyForPvp | boolean | The game can be played by two players against each other. |
gemMultiplier | number | How the game's gem awards are multiplied, as the server sends it. |
petDefId | number | A pet def id tied to the game, or 0. How the client uses it is not recorded here. |
proModeUserVarRefId | number | The user variable that holds the game's pro mode, or 0. |
leaderboardUserVarRef | number | The user variable the game's leaderboard ranks by, or 0. |
gameLibraryIconMediaId | number | The media id of the game's icon in the game library. |
requiredAvatarType | number | The avatar type the game needs, as the server sends it. What its values mean is unknown. |
MinigameField
A plain member of a game's class, as describe lists it.
| Field | Type | |
|---|---|---|
name | string | |
type | "int" | "uint" | "Number" | "Boolean" | "String" | |
hidden | boolean | |
writable | boolean |
MinigameFields
| Field | Type | |
|---|---|---|
className | string | |
values | Record<string, MinigameFieldValue> |
MinigameFieldsChange
| Field | Type | |
|---|---|---|
className | string | null | |
values | Record<string, MinigameFieldValue> | |
previous | Record<string, MinigameFieldValue> | null | |
changed | string[] |
MinigameDialog
| Field | Type | |
|---|---|---|
className | string | null | |
open | boolean | |
name | string | null | |
modal | boolean | null |
MinigameButtonPress
| Field | Type | |
|---|---|---|
name | string | |
className | string | null | |
role | MinigameButtonRole | |
dialog | string | null | |
enabled | boolean | |
x | number | |
y | number |
MinigameButtonRole
type MinigameButtonRole = | 'exit'
| 'yes'
| 'no'
| 'close'
| 'continue'
| 'nextLevel'
| 'levelSelect'
| 'done'
| 'replay'
| 'other'MinigamePress
| Field | Type | |
|---|---|---|
className | string | null | |
target | string | |
targetClass | string | null | |
x | number | |
y | number |
MinigameCardPress
| Field | Type | |
|---|---|---|
button | "play" | "back" | "next" | "buddies" | "close" | "instructions" | "backToCard" | "playPro" | "leaderboards" | "leaderboardsClose" | "thisWeek" | "allTime" | |
gameDefId | number | null | |
enabled | boolean | |
second | boolean | On the card's second page. |
GameOnOffer
One game the games list offers (gui.GameJoinPopup).
| Field | Type | |
|---|---|---|
index | number | |
defId | number | |
name | string | null | |
readyForPvp | boolean | |
waiting | boolean | The player is waiting for others to join it. |
BowlingState
| Field | Type | |
|---|---|---|
phase | "playing" | "over" | "waiting" | "loading" | |
frame | number | The frame, from 1 (_currentFrame, two a frame). |
ball | number | The ball in the frame (_currentBowl). |
myTurn | boolean | The lane's own localTurn. |
score | number | |
opponentScore | number | |
secondsLeft | number | |
result | "tie" | "lose" | "win" | null |
TypedFlash
A place in Flash whose declared type is T.
type TypedFlash<T> = FlashPlace<T> &
FlashConstructor<T> &
(unknown extends T
? unknown
: {
readonly [Key in keyof T as Key extends `$${string}` ? never : Key]: T[Key] extends (
...args: infer Args
) => infer Result
? FlashMethod<Args, Result>
: TypedFlash<T[Key]>;
})FlashRead
What reading a place of type T resolves with.
type FlashRead<T> = unknown extends T
? FlashData
: T extends Primitive
? T
: T extends readonly (infer Item)[]
? FlashRead<Item>[]
: T extends (...args: never[]) => unknown
? TypedFlash<unknown>
: TypedFlash<T>FlashWrite
What may be given where Flash expects T.
type FlashWrite<T> = unknown extends T
? FlashArgumentLike
: T extends Primitive
? T
: T extends readonly (infer Item)[]
? FlashWrite<Item>[]
: T extends (...args: never[]) => unknown
? ((...args: FlashData[]) => void) | FlashCallback
: TypedFlash<T> | FlashHandle | FlashArgumentLikeHoldOptions
How a hold behaves.
| Field | Type | |
|---|---|---|
everyFrames optional | number | undefined | Write on every nth frame. Every frame by default, which is what a value the client resets needs. |
when optional | "enter" | "exit" | undefined | Which half of the frame to write in. 'enter' by default, before the frame is read. Use 'exit' for a member the game writes every frame of its own, such as a thing it pins to the pointer. Two objects' enter-frame listeners have no order between them, so an ordinary hold on one of those stands only on the frames the loader happens to run second, and the value flickers or never takes at all. Exit-frame work runs after every enter-frame listener, so what is held is what is drawn and what the next frame reads. |
while optional | HookWhen | undefined | Only while this holds, in the same rules as a hook's when, read between calls. |
once optional | boolean | undefined | Write once, on the first frame the condition holds, then stop. |
restore optional | boolean | undefined | Put back what was there before the first write when the hold ends. On by default. |
onFailed optional | ((error: string) => void) | undefined | Called if the game turns the hold off because a write failed. |
HookTest
A condition. Made by phantom.flash.rules.
| Field | Type | |
|---|---|---|
__@TEST@169973 | RawTest |
FlashArgumentLike
Anything the bridge carries, typed places included.
type FlashArgumentLike = FlashArgument | TypedFlash<unknown> | FlashArgumentLike[] | { [key: string]: FlashArgumentLike }FlashPlace
The operations every place has, whatever its type.
| Field | Type | |
|---|---|---|
$get | () => Promise<FlashRead<T>> | Reads the value here: plain data as it is, an object as a typed place held by handle. |
$set | (value: FlashWrite<T>) => Promise<void> | Writes the value here, once. The client may put its own back a frame later: a member it sets every frame, or on every redraw, or an object it builds again for the next room. For a change that has to stay, use $keep. |
$keep | (value: FlashWrite<T>, options?: HoldOptions | undefined) => Promise<() => Promise<void>> | Writes the value here and keeps it here, until the function it gives back is called, which puts back what was there. It is $set for a change that has to last. The game writes it itself, every frame, so a value the client puts back is overwritten before Flash draws it. The place is followed rather than pinned: nothing is lost when the object is not there yet (it is written as soon as it is) or when the client builds it again (the new one is written too). It is phantom.flash.hold on this place, and takes the same options. ts const hud = phantom.flash.use('gui.GuiManager').mainHud; const faded = await hud.alpha.$keep(0.5); |
$call | (...args: FlashArgumentLike[]) => Promise<FlashData> | Calls what is here, whatever the declarations say is at this place. A place is callable in its own right (avatars.createAvatar(id, x, y, name)), which is how to write a call the declarations describe: the arguments and the answer are both checked. This is the same call for the places they cannot describe, and it saves casting one to reach it: - a class whose instance side declares nothing, because every member of it is static (gui.EmoticonUtility), so $as and a hook's self give a place with no members; - an object the client typed as Object or *, or one reached with $at; - a member holding a function, such as a callback the client keeps in a field. It answers FlashData, since there is no declared return to read it as. ts const emotes = phantom.flash.use('gui.EmoticonUtility'); console.log(await emotes.stringForId(3)); console.log(await emotes.$at('stringForId').$call(3)); |
$listen | (event: string, listener: (event: FlashData, keep: <Kept>(value: Kept) => Kept) => void, options?: { read?: readonly (readonly string[])[] | undefined; capture?: boolean | undefined; } | undefined) => Promise<() => Promise<void>> | Listens for an event on the object here. Resolves with what stops listening. Without read, the event is its readable members, objects among them as typed places held by handle, and every one of them is released once the listener returns, except those passed to keep before then (release those with $release when done). read names the paths to read as the event is dispatched instead: the event is then { className, type, read } with the values in that order, and nothing is held. A listener that ignores the event passes read: []. capture listens on the way down. Both are FlashBridge.listen's options. ts await stage.$listen('mouseMove', (event) => console.log((event as { read: number[] }).read), { read: [['stageX'], ['stageY']], }); |
$describe | () => Promise<FlashValue> | The public members of what is here, as Flash's describeType lists them. |
$at | (...path: string[]) => AnyFlash | Further along, by names the types do not know: untyped from here on. |
$as | { <Name extends keyof ClientInstances & string>(name: Name): TypedFlash<ClientInstances[Name]>; (name: string): AnyFlash; } | The same place, read as the client's name from here on. Nothing is sent and nothing is checked in the game: it says what the object here is, so the editor completes and checks its members again after a step the declarations could not follow ($at, a hook's capture, anything the client typed as Object or *). Naming the wrong class is not caught here; the read or call that follows is what fails. ts const grid = phantom.flash .use('gui.AvatarEditor') .$at('_colorTableColor1') .$as('gui.ColorTable'); console.log(await grid._numCols.$get(), 'by', await grid._numRows.$get()); |
$release | () => Promise<void> | Releases the object this place is held by, when it is one; nothing otherwise. |
$reference | FlashReference | The untyped reference underneath. |
FlashValue
A value on the TypeScript side: plain data, undefined, or a handle to an object in Flash.
type FlashValue = | null
| undefined
| boolean
| number
| string
| FlashValue[]
| { [key: string]: FlashValue }
| FlashHandleFlashArgument
What may be passed to Flash: a value, a function Flash may call, or an object to make there.
type FlashArgument = | FlashValue
| FlashArgument[]
| { [key: string]: FlashArgument }
| ((...args: FlashValue[]) => void)
| FlashNewFlashData
Plain data read from Flash, with objects that live there as typed places.
type FlashData = | null
| undefined
| boolean
| number
| string
| FlashData[]
| { [key: string]: FlashData }
| TypedFlash<unknown>AnyFlash
A place whose class the declarations do not describe: phantom.flash.use('a.Class') for a class the client has no declaration for, $at, $as with a name, or anything read back from one.
Every member is another place of the same kind, and every place can be called, which is what reflection allows and what a place does at run time. Nothing is checked, because there is nothing to check it against: a name the game does not have fails when it is used, not here. then is left out, so awaiting a place is still the mistake it always was.
type AnyFlash = FlashPlace<unknown> &
FlashMethod<unknown[], unknown> & {
readonly [member: string]: AnyFlash;
} & { then?: undefined }FlashMethod
A method of the client, called with checked arguments.
type FlashMethod<Args extends readonly unknown[], Result> = (
...args: { [Index in keyof Args]: FlashWrite<Args[Index]> }
) => Promise<FlashRead<Result>>FlashConstructor
A class's constructor, from its declared $new.
type FlashConstructor<T> = T extends { $new(...args: infer Args): infer Instance }
? { $new: FlashMethod<Args, Instance> }
: unknownKeepOptions
How a keep holds its values.
| Field | Type | |
|---|---|---|
everyFrames optional | number | undefined | Write on every nth frame: every frame by default, which is what a value the game resets needs. |
while optional | HookWhen | undefined | Only on the frames this also holds, on top of the game being on screen. |
then optional | readonly { method: string; args?: readonly unknown[] | undefined; }[] | undefined | The game's own methods to call after each write, in the same frame (a redraw). |
BradyChemistrySetState
The chemistry set as it stands.
| Field | Type | |
|---|---|---|
finished | boolean | Whether the mix is done (finished on the scene). |
secretFound | boolean | Whether the secret mix was found (secretActivated). |
emote | string | number | null | The emote the scene asks the animal to make (emoticonInfo), or null. |
seconds | number | Seconds since the game started (_gameTime). |