Buddies
phantom.aj.buddiesOther players
The player's buddies, requests and the buddy card.
Scripts and plugins
A script has all of it, as phantom.aj.buddies, 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 |
|---|---|---|
add() | Asks someone to be a buddy, as the buddy card's add button does (addRemoveBuddy), and resolves with the request once the client has sent it. | game:act |
all() | Every buddy, online first then by name, in one read; none before the client has the list. | game:read |
block() | Blocks someone (sendBuddyBlockRequest), once the server has. | game:act |
blocked() | Everyone the player has blocked, by account name in lower case as the client keys them (BuddyManager.blockedList), in one read; none before the client has the list. | game:read |
capacity() | How full the list is, as the client counts it: adding past the limit only shows a popup. | game:read |
get() | One buddy by account name, in any case; null for someone who is not one. | game:read |
isBlocked() | Whether the player has blocked someone (BuddyManager.isBlocked), in any case. | game:read |
isBlockingMe() | Whether someone has blocked the player, which only the server knows (bi). | game:read |
isBuddy() | Whether the client counts someone as a buddy (BuddyManager.isBuddy), in any case. | game:read |
locate() | Where a buddy is (sendBuddyRoomRequest, br). | game:act |
names() | Every buddy's account name, in lower case, for telling at a glance whether someone is one. | game:read |
online() | The buddies online now. | game:read |
refresh() | Asks the server for the buddy list again (sendBuddyListRequest), and resolves with it once the client holds the answer. | game:act |
remove() | Removes a buddy, as the buddy card does, once the server has. | game:act |
unblock() | Unblocks someone (sendBuddyUnblockRequest), once the server has. | game:act |
onBlockChange() | Hears each block and unblock the server made, however it was asked for. | game:read |
onBlockInfo() | Hears every answer to whether someone blocks the player (bi), whoever asked. | game:read |
onChange() | Hears the client's buddy or blocked list change: either list arriving, a buddy added, renamed, signing in or out, removed, someone blocked or unblocked. | game:read |
onLocated() | Hears every answer to where a buddy is (br), whoever asked (locate, an open buddy card's timer), matched to the buddy it was asked about by the order the questions went out in. | game:read |
onOnlineChange() | Who of the buddies is online: at once, then whenever someone signs in or out, with who came and went. | game:read |
onSeen() | Hears one person turn up wherever the game mentions them: walking into the player's room, signing in as a buddy, or placed in a room by a location answer. | game:read |
onUpdate() | Hears each change the server announces to one buddy: added, signed in or out, renamed, removed. | game:read |
buddies.requests: Buddy requests, both ways: phantom.aj.buddies.requests.
| Member | What it does | Plugins |
|---|---|---|
accept() | Accepts someone's buddy request, as the OK on its popup does (buddyAddRequestCallback, which puts the popup away and sends bc), and resolves once the server has made them a buddy. | game:act |
decline() | Declines someone's buddy request, as the cancel on its popup does, and resolves once the client has put the popup away. | game:act |
incoming() | Everyone asking the player to be their buddy, while the client's popup for it is up. | game:read |
sent() | The requests the player has sent that the client is holding off on repeating, for 30 seconds each (_buddyRequestList). | game:read |
onAnswer() | Hears everything the server says about a buddy request (ba), both ways: someone asking, the other player taking no requests from the player, a full list, and the notices. | game:read |
onIncoming() | Hears someone ask the player to be their buddy (ba with status 0). | game:read |
buddies.card: The buddy card: phantom.aj.buddies.card.
| Member | What it does | Plugins |
|---|---|---|
addTab() | Adds a side tab of your own to the buddy card, of the game's own kind: a button on the card's left edge between (or below) its Buddy Games and Trade List buttons, with your icon on it, and pressed, a panel sliding out as theirs do, with your title and what you give it to show. | game:act |
close() | Closes the buddy card (BuddyManager.destroyBuddyCard); nothing happens with none open. | game:act |
copyTab() | A second instance of one of the open card's own side tabs, for a feature to add a tab of its own beside the game's, looking as theirs do: the tab's clip, and its ear, out of a fresh copy of the card's own art (assets.copy of the asset the open card was made from), built in the game's memory as the card itself was. | game:read |
current() | Who the open card is about, in one read; null with no card open, or one still loading. | game:read |
open() | Opens someone's buddy card (BuddyManager.showBuddyCard), and resolves with it once the card knows whose it is (its art loaded). | game:act |
showTab() | Pulls out one of the open card's side tabs, or pushes the open one back (null), by pressing its button as the player does, and resolves with the card once it shows it. | game:act |
tab() | The side tab the open card has pulled out, or null for none (or no card). | game:read |
tradeList() | The trade list the open card shows (BuddyCard._tradeList), filled once its trade tab is opened. | game:read |
onChange() | Hears the card open, change to someone else, close, or change what it shows (blocked, online, a tab pulled out, where they are): the card now, or null as it closes. | game:read |
buddies.window: The buddy list popup the HUD's buddy button opens, and the player search inside it: phantom.aj.buddies.window (buddy.BuddyList).
| Member | What it does | Plugins |
|---|---|---|
close() | Closes the buddy list popup and the player search with it (closeBuddyList). | game:act |
closeSearch() | Closes the player search, as its close button does (onPlayerSearchClose). | game:act |
flashButton() | Lights up the HUD's buddy button for five seconds, with the buddy sound, as a buddy signing in does (BuddyList.startBuddyListBtnGlow). | game:act |
isOpen() | Whether the buddy list popup is up (BuddyList.visible); false before the HUD is built. | game:read |
isSearchOpen() | Whether the player search is up (BuddyList._playerSearch). | game:read |
open() | Opens the buddy list popup, as the HUD's buddy button does (buddyListBtnHandler), and resolves once it is up. | game:act |
openSearch() | Opens the player search, as the list's magnifying glass does (BuddyList.onSearchBtn), where the player types a name to find that player's card. | game:act |
search() | Looks a player up, as typing their name in the search box and pressing search does, and resolves with what the server answered. | game:act |
onSearchResult() | Hears each player search's answer. | game:read |
Methods
add
add(userName: string, options?: ActOptions) => Promise<SentBuddyRequest>Asks someone to be a buddy, as the buddy card's add button does (addRemoveBuddy), and resolves with the request once the client has sent it. They then have 30 seconds to accept, which onUpdate hears as added; requests.onAnswer hears the server's other answers. REFUSED for a buddy already, a full list, someone blocked (unblock with thenAdd), or someone asked within the last 30 seconds.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
options optional | ActOptions |
Returns
Promise<SentBuddyRequest>
Types
all
all() => Promise<Buddy[]>Every buddy, online first then by name, in one read; none before the client has the list.
Returns
Promise<Buddy[]>
Types
block
block(userName: string, options?: ActOptions) => Promise<void>Blocks someone (sendBuddyBlockRequest), once the server has. Nothing for one blocked.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
options optional | ActOptions |
Returns
Promise<void>
Types
blocked
blocked() => Promise<string[]>Everyone the player has blocked, by account name in lower case as the client keys them (BuddyManager.blockedList), in one read; none before the client has the list. The client keeps them in a Dictionary, whose keys only the game's own JSON.stringify writes out.
Returns
Promise<string[]>
capacity
capacity() => Promise<BuddyCapacity>How full the list is, as the client counts it: adding past the limit only shows a popup.
Returns
Promise<BuddyCapacity>
Types
get
get(userName: string) => Promise<Buddy | null>One buddy by account name, in any case; null for someone who is not one.
Parameters
| Name | Type | |
|---|---|---|
userName | string |
Returns
Promise<Buddy \| null>
Types
isBlocked
isBlocked(userName: string) => Promise<boolean>Whether the player has blocked someone (BuddyManager.isBlocked), in any case.
Parameters
| Name | Type | |
|---|---|---|
userName | string |
Returns
Promise<boolean>
isBlockingMe
isBlockingMe(userName: string, options?: ActOptions) => Promise<boolean>Whether someone has blocked the player, which only the server knows (bi). The client asks one of these at a time and drops a second, so this waits for one in flight first.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
options optional | ActOptions |
Returns
Promise<boolean>
Types
isBuddy
isBuddy(userName: string) => Promise<boolean>Whether the client counts someone as a buddy (BuddyManager.isBuddy), in any case.
Parameters
| Name | Type | |
|---|---|---|
userName | string |
Returns
Promise<boolean>
locate
locate(userName: string, options?: ActOptions) => Promise<BuddyWhereabouts>Where a buddy is (sendBuddyRoomRequest, br). The answer names nobody, so it is paired with its question by order, as the server answers them: every question seen going out from the moment this asks is lined up, an open buddy card's own included, and this takes the answer that comes in this question's turn rather than the next one to arrive.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
options optional | ActOptions |
Returns
Promise<BuddyWhereabouts>
Types
names
names() => Promise<Set<string>>Every buddy's account name, in lower case, for telling at a glance whether someone is one.
Returns
Promise<Set<string>>
online
online() => Promise<Buddy[]>The buddies online now.
Returns
Promise<Buddy[]>
Types
refresh
refresh(options?: ActOptions) => Promise<Buddy[]>Asks the server for the buddy list again (sendBuddyListRequest), and resolves with it once the client holds the answer.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<Buddy[]>
Types
remove
remove(userName: string, options?: ActOptions) => Promise<void>Removes a buddy, as the buddy card does, once the server has. REFUSED for no buddy.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
options optional | ActOptions |
Returns
Promise<void>
Types
unblock
unblock(userName: string, options?: ActOptions & { thenAdd?: boolean | undefined; }) => Promise<void>Unblocks someone (sendBuddyUnblockRequest), once the server has. With thenAdd, the client asks them to be a buddy as soon as it has, as the card's "unblock and add" does.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
options optional | ActOptions & { thenAdd?: boolean | undefined; } |
Returns
Promise<void>
Types
Events
onBlockChange
onBlockChange(listener: (change: BuddyBlockChange) => void) => () => voidHears each block and unblock the server made, however it was asked for.
Parameters
| Name | Type | |
|---|---|---|
listener | (change: BuddyBlockChange) => void |
Returns
() => void. Call it to stop listening.
Types
onBlockInfo
onBlockInfo(listener: (info: { userName: string; blockingMe: boolean; }) => void) => () => voidHears every answer to whether someone blocks the player (bi), whoever asked.
Parameters
| Name | Type | |
|---|---|---|
listener | (info: { userName: string; blockingMe: boolean; }) => void |
Returns
() => void. Call it to stop listening.
onChange
onChange(listener: () => void) => () => voidHears the client's buddy or blocked list change: either list arriving, a buddy added, renamed, signing in or out, removed, someone blocked or unblocked. Read the lists again to see how.
Parameters
| Name | Type | |
|---|---|---|
listener | () => void |
Returns
() => void. Call it to stop listening.
onLocated
onLocated(listener: (where: BuddyWhereabouts) => void) => () => voidHears every answer to where a buddy is (br), whoever asked (locate, an open buddy card's timer), matched to the buddy it was asked about by the order the questions went out in.
Parameters
| Name | Type | |
|---|---|---|
listener | (where: BuddyWhereabouts) => void |
Returns
() => void. Call it to stop listening.
Types
onOnlineChange
onOnlineChange(listener: (change: BuddiesOnline) => void) => () => voidWho of the buddies is online: at once, then whenever someone signs in or out, with who came and went. The first telling names nobody as come, so arrivals are not all announced at once.
Parameters
| Name | Type | |
|---|---|---|
listener | (change: BuddiesOnline) => void |
Returns
() => void. Call it to stop listening.
Types
Example
const stop = phantom.aj.buddies.onOnlineChange(({ online, cameOnline }) => {
for (const buddy of cameOnline) console.log(buddy.userName, 'signed in');
});onSeen
onSeen(userName: string, listener: (seen: PersonSeen) => void, options?: { quietMs?: number | undefined; }) => () => voidHears one person turn up wherever the game mentions them: walking into the player's room, signing in as a buddy, or placed in a room by a location answer. Nothing is asked of the server. Each way is told at most once every quietMs (30 seconds by default), so an open card asking every few seconds is not a torrent.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
listener | (seen: PersonSeen) => void | |
options optional | { quietMs?: number | undefined; } |
Returns
() => void. Call it to stop listening.
Types
onUpdate
onUpdate(listener: (update: BuddyUpdate) => void) => () => voidHears each change the server announces to one buddy: added, signed in or out, renamed, removed.
Parameters
| Name | Type | |
|---|---|---|
listener | (update: BuddyUpdate) => void |
Returns
() => void. Call it to stop listening.
Types
buddies.requests
Buddy requests, both ways: phantom.aj.buddies.requests. Who is asking the player, read from the client's own popups for them (BuddyManager._confirmBuddyRequestPopups), and who the player has asked (_buddyRequestList). Each is held by the client for 30 seconds. Asking someone is buddies.add.
accept
accept(userName: string, options?: ActOptions) => Promise<BuddyUpdate>Accepts someone's buddy request, as the OK on its popup does (buddyAddRequestCallback, which puts the popup away and sends bc), and resolves once the server has made them a buddy. Throws NOT_READY when no request from them is waiting, REFUSED when the list is full.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
options optional | ActOptions |
Returns
Promise<BuddyUpdate>
Types
decline
decline(userName: string, options?: ActOptions) => Promise<void>Declines someone's buddy request, as the cancel on its popup does, and resolves once the client has put the popup away. The server says nothing back. NOT_READY when no request from them is waiting.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
options optional | ActOptions |
Returns
Promise<void>
Types
incoming
incoming() => Promise<IncomingBuddyRequest[]>Everyone asking the player to be their buddy, while the client's popup for it is up.
Returns
Promise<IncomingBuddyRequest[]>
Types
sent
sent() => Promise<SentBuddyRequest[]>The requests the player has sent that the client is holding off on repeating, for 30 seconds each (_buddyRequestList). This sitting only.
Returns
Promise<SentBuddyRequest[]>
Types
onAnswer
onAnswer(listener: (answer: BuddyRequestAnswer) => void) => () => voidHears everything the server says about a buddy request (ba), both ways: someone asking, the other player taking no requests from the player, a full list, and the notices.
Parameters
| Name | Type | |
|---|---|---|
listener | (answer: BuddyRequestAnswer) => void |
Returns
() => void. Call it to stop listening.
Types
onIncoming
onIncoming(listener: (request: IncomingBuddyRequest) => void) => () => voidHears someone ask the player to be their buddy (ba with status 0). One from somebody who is already a buddy, which the client ignores, is not told. Answer with accept or decline.
Parameters
| Name | Type | |
|---|---|---|
listener | (request: IncomingBuddyRequest) => void |
Returns
() => void. Call it to stop listening.
Types
buddies.card
The buddy card: phantom.aj.buddies.card. The panel the player gets by clicking a name, with its buttons for trading, following and the rest, read from the card itself (BuddyManager._buddyCard) however it was opened. Opening, closing and its tabs change only this screen, except the trade tab, which asks for the buddy's trade list as it does for the player.
addTab
addTab(spec: CardTabSpec, options?: ActOptions) => Promise<CardTab>Adds a side tab of your own to the buddy card, of the game's own kind: a button on the card's left edge between (or below) its Buddy Games and Trade List buttons, with your icon on it, and pressed, a panel sliding out as theirs do, with your title and what you give it to show. Each call adds one; every tab added goes down the card's edge by order.
Where the host's content origin can (the desktop's, in any game the tab may go in), the tab is drawn into the card's art as the client loads it, a copy of the Buddy Games tab's own symbols with your title and your picture drawn into its button, so it is the game's own button, panel and font; the SDK wires it up. Where it cannot, the tab is made at run time from the card's art instead (look says which). Either way it slides with the game's tween and sounds, and the game's tabs and yours close each other as they open. The changed art is made in memory as it is served; nothing of the client or its art is shipped.
content may be a function of the card, for what depends on whose it is (it may take its time: placeholder shows meanwhile), and show changes what the open card's tab shows, with for to drop an answer about a card that has moved on. What goes wrong on a card is told to onError (console.error by default), never thrown. REFUSED for an id added already. The handle takes the tab off for good.
Parameters
| Name | Type | |
|---|---|---|
spec | CardTabSpec | |
options optional | ActOptions |
Returns
Promise<CardTab>
Types
CardTabSpec · CardTabContent · CardTab · CardTabView · CardTabLook · ActOptions
Example
const myNotes = new Map<string, string>();
const notes = await phantom.aj.buddies.card.addTab({
id: 'notes',
title: 'Notes',
icon: { draw: 'info' },
content: (card) => myNotes.get(card.userName) ?? { text: 'No notes yet', muted: true },
});close
close(options?: ActOptions) => Promise<void>Closes the buddy card (BuddyManager.destroyBuddyCard); nothing happens with none open.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
copyTab
copyTab(tab: BuddyCardTab, options?: ActOptions & { ahead?: boolean | undefined; }) => Promise<BuddyCardTabCopy>A second instance of one of the open card's own side tabs, for a feature to add a tab of its own beside the game's, looking as theirs do: the tab's clip, and its ear, out of a fresh copy of the card's own art (assets.copy of the asset the open card was made from), built in the game's memory as the card itself was. It is on no display list: put it on the card (_buddyCardMC.addChildAt) and move, relabel or fill it there. The copy's ear is the client's own button, with its own rollover and press; the card's handlers are not on it, so pressing it does nothing of the card's. NOT_READY with no card open, REFUSED when the art has no such tab. ahead makes one before any card is open, from the art the client builds its cards from, so a feature can have one ready and a card opened later is not kept waiting for the load.
Parameters
| Name | Type | |
|---|---|---|
tab | BuddyCardTab | |
options optional | ActOptions & { ahead?: boolean | undefined; } |
Returns
Promise<BuddyCardTabCopy>
Types
BuddyCardTab · BuddyCardTabCopy · ActOptions
Example
const copy = await phantom.aj.buddies.card.copyTab('games');
const mc = phantom.flash.bridge.definition('buddy.BuddyManager').at('_buddyCard', '_buddyCardMC');
await mc.at('addChildAt').call(copy.clip, 0);
await copy.release();current
current() => Promise<OpenBuddyCard | null>Who the open card is about, in one read; null with no card open, or one still loading.
Returns
Promise<OpenBuddyCard \| null>
Types
open
open(userName: string, options?: OpenCardOptions) => Promise<OpenBuddyCard>Opens someone's buddy card (BuddyManager.showBuddyCard), and resolves with it once the card knows whose it is (its art loaded). An open card on someone else is put away first, as the client does. TIMEOUT when the card does not come.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
options optional | OpenCardOptions |
Returns
Promise<OpenBuddyCard>
Types
OpenCardOptions · OpenBuddyCard
Example
const card = await phantom.aj.buddies.card.open('friend', { online: true });showTab
showTab(tab: BuddyCardTab | null, options?: ActOptions) => Promise<OpenBuddyCard>Pulls out one of the open card's side tabs, or pushes the open one back (null), by pressing its button as the player does, and resolves with the card once it shows it. The trade tab asks the server for the buddy's trade list, as it does for the player. NOT_READY with no card open, REFUSED for a tab the card does not let this account use.
Parameters
| Name | Type | |
|---|---|---|
tab | BuddyCardTab | null | |
options optional | ActOptions |
Returns
Promise<OpenBuddyCard>
Types
tab
tab() => Promise<BuddyCardTab | null>The side tab the open card has pulled out, or null for none (or no card).
Returns
Promise<BuddyCardTab \| null>
tradeList
tradeList() => Promise<BuddyCardTradeItem[]>The trade list the open card shows (BuddyCard._tradeList), filled once its trade tab is opened. None with no card open or before then. phantom.aj.trades asks for anyone's.
Returns
Promise<BuddyCardTradeItem[]>
Types
onChange
onChange(listener: (card: OpenBuddyCard | null) => void) => () => voidHears the card open, change to someone else, close, or change what it shows (blocked, online, a tab pulled out, where they are): the card now, or null as it closes. The card as it is when listening starts is not told; current() reads it.
Parameters
| Name | Type | |
|---|---|---|
listener | (card: OpenBuddyCard | null) => void |
Returns
() => void. Call it to stop listening.
Types
buddies.window
The buddy list popup the HUD's buddy button opens, and the player search inside it: phantom.aj.buddies.window (buddy.BuddyList). The list itself, not the buddy card. All of it changes only this screen, except that opening the list asks for the buddy list the first time, as the client's button does.
close
close(options?: ActOptions) => Promise<void>Closes the buddy list popup and the player search with it (closeBuddyList).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
closeSearch
closeSearch(options?: ActOptions) => Promise<void>Closes the player search, as its close button does (onPlayerSearchClose).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
flashButton
flashButton(options?: ActOptions) => Promise<void>Lights up the HUD's buddy button for five seconds, with the buddy sound, as a buddy signing in does (BuddyList.startBuddyListBtnGlow).
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
isOpen
isOpen() => Promise<boolean>Whether the buddy list popup is up (BuddyList.visible); false before the HUD is built.
Returns
Promise<boolean>
isSearchOpen
isSearchOpen() => Promise<boolean>Whether the player search is up (BuddyList._playerSearch).
Returns
Promise<boolean>
open
open(options?: ActOptions) => Promise<void>Opens the buddy list popup, as the HUD's buddy button does (buddyListBtnHandler), and resolves once it is up. REFUSED for an account that may not have buddies (the button does not listen) or a greyed button.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
openSearch
openSearch(options?: ActOptions) => Promise<void>Opens the player search, as the list's magnifying glass does (BuddyList.onSearchBtn), where the player types a name to find that player's card. Nothing happens when it is already up.
Parameters
| Name | Type | |
|---|---|---|
options optional | ActOptions |
Returns
Promise<void>
Types
search
search(userName: string, options?: ActOptions) => Promise<PlayerSearchResult>Looks a player up, as typing their name in the search box and pressing search does, and resolves with what the server answered. The search box has to be open.
Parameters
| Name | Type | |
|---|---|---|
userName | string | |
options optional | ActOptions |
Returns
Promise<PlayerSearchResult>
Types
onSearchResult
onSearchResult(listener: (result: PlayerSearchResult) => void) => () => voidHears each player search's answer.
Parameters
| Name | Type | |
|---|---|---|
listener | (result: PlayerSearchResult) => void |
Returns
() => void. Call it to stop listening.
Types
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.
Buddy
One buddy, as the client's own record of them has it (buddy.Buddy).
| Field | Type | |
|---|---|---|
userName | string | Their account name, as written. |
shownName | string | null | The name the game shows for them: their own once it passed moderation, the game's stock name before (Buddy.userNameModerated). Null before the client has worked it out. |
nameApproved | boolean | Whether their own name may be shown (userNameModeratedFlag above 0). |
uuid | string | null | |
online | boolean | |
accountType | number | null | The account type; 2 and above is a member (Utility.isMember). Null when not known. |
member | boolean | |
partySecondsLeft | number | Seconds left on the custom party they host, 0 for none. |
BuddyCapacity
How full the buddy list is, as the client counts it.
| Field | Type | |
|---|---|---|
count | number | |
max | number | 1000 for a member, 200 otherwise (getMaxBuddyCount). |
remaining | number | |
full | boolean | |
nearlyFull | boolean | Five or fewer left, when the client starts warning the player. |
anyOnline | boolean |
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 |
SentBuddyRequest
A buddy request the player sent that the client is holding off on repeating.
| Field | Type | |
|---|---|---|
userName | string | |
expiresAt | number | When the client lets the player ask again, in epoch milliseconds. |
accepting | boolean | False once the other player said they take no requests from the player. |
BuddyWhereabouts
Where a buddy is, as the server answered a location request (br).
| Field | Type | |
|---|---|---|
userName | string | The buddy asked about, by account name. |
online | boolean | In a room: the answer named one, and not Choosing Server. |
choosingServer | boolean | Between servers: the answer said Choosing Server. |
roomName | string | null | The room, without the server node; null when offline. |
displayName | string | null | The room's name as the game shows it; null when offline. |
displayNameId | number | null | A translation id for the name, or null for none. |
node | string | null | The server node they are on, when it is another than the player's; null otherwise. |
locked | boolean | The buddy card would not follow them there. |
seenAt | number | When the answer came, in epoch milliseconds. |
BuddyUpdate
One change to a buddy the server announced: a request accepted either way (added), a buddy signing in or out (online, offline, also told for other news of a buddy who stays so), a rename, or a removal by either side.
| Field | Type | |
|---|---|---|
kind | "added" | "removed" | "online" | "offline" | "renamed" | |
userName | string | The buddy's name now: the new one for a rename. |
previousUserName | string | null | The old name, for a rename; null otherwise. |
online | boolean | |
avatarName | string | null | The animal they are playing, when the server said; null otherwise. |
BuddiesOnline
Who of the buddies is online, and who came and went since the last telling.
| Field | Type | |
|---|---|---|
online | Buddy[] | |
cameOnline | Buddy[] | Empty on the first telling. |
wentOffline | Buddy[] | Empty on the first telling; a buddy removed while online is here too. |
BuddyBlockChange
A block or an unblock the server made.
| Field | Type | |
|---|---|---|
userName | string | |
blocked | boolean |
PersonSeen
Someone turning up, as onSeen tells it.
| Field | Type | |
|---|---|---|
userName | string | |
how | "room" | "online" | "located" | Walked into the player's room, signed in as a buddy, or placed in a room by a location answer. |
userId | number | null | Their id in the room, for room; null otherwise. |
avatarName | string | null | Their animal's name, for room; null otherwise. |
where | BuddyWhereabouts | null | Where they were said to be, for located; null otherwise. |
at | number | Epoch milliseconds. |
IncomingBuddyRequest
Someone asking the player to be their buddy, while the client's popup for it is up.
| Field | Type | |
|---|---|---|
userName | string |
BuddyRequestAnswer
What the server said about a buddy request (ba): someone asking the player (incoming), the other player taking no requests from the player (notAccepting), the player's list being full (listFull), or a notice the client only shows (notice, statuses 1, 2 and 5).
| Field | Type | |
|---|---|---|
userName | string | |
nameApproved | boolean | |
outcome | "incoming" | "notAccepting" | "listFull" | "notice" | |
status | number | The server's own number for it. |
OpenBuddyCard
Who the open buddy card is about, as the card holds it.
| Field | Type | |
|---|---|---|
userName | string | |
shownName | string | null | The name the card shows: the game's stock name for one not yet approved. |
accountType | number | null | |
buddy | boolean | How the card draws them. |
blocked | boolean | |
online | boolean | |
archived | boolean | The card is showing an account no longer about. |
roomName | string | null | Where the card last heard they were, without the node; null for nowhere. |
roomDisplayName | string | null | |
node | string | null | Their server node, when not the player's; null otherwise. |
tab | BuddyCardTab | null | The side tab pulled out, or null. |
OpenCardOptions
What opening a card may say beyond ActOptions.
type OpenCardOptions = ActOptions & {
/** Draw them as online, as a click on someone in the room does. False by default. */
online?: boolean;
}BuddyCardTab
A side tab of the buddy card.
type BuddyCardTab = 'trade' | 'games'BuddyCardTabCopy
A second instance of one of the buddy card's own side tabs, from card.copyTab: the tab's clip out of a fresh copy of the card's own art, on no display list yet, with its ear (a gui.GuiSoundButton of the client's) and the place it has on the card with the tab pushed in.
| Field | Type | |
|---|---|---|
tab | BuddyCardTab | |
clip | FlashHandle | The tab's clip, for the caller to put on the card (_buddyCardMC.addChildAt). |
ear | FlashHandle | Its ear, inside clip. |
x | number | Where the card's art puts it, in the card clip's space, pushed in. |
y | number | |
release | () => Promise<void> | Lets go of the handles; the clip stays wherever it was put. Safe to call twice. |
CardTabSpec
A tab of a feature's own on the buddy card, as card.addTab takes it.
| Field | Type | |
|---|---|---|
id | string | Tells it from every other tab added; adding a second with the same id is REFUSED. |
title | string | Its title bar, in the game's own format, where the Buddy Games tab says "Buddy Games". |
icon optional | CardTabIcon | undefined | The picture on its ear. The Buddy Games tab's own picture is covered over either way. |
content optional | CardTabContentSource | undefined | What it shows on each card. A function is called as a card opens on somebody (or changes to somebody else): where the loader builds the tab, as soon as it says it has, in the frame the card went up (the tab is already there, empty, so what it shows can take its time); where it is drawn, while it is being built. Its signal aborts when the card moves on; show changes it after. |
placeholder optional | CardTabContent | undefined | What it shows while content is still working; nothing by default. |
order optional | number | undefined | Where it goes among the tabs added, lowest first down the card's left edge (the first between the game's Buddy Games and Trade List buttons, the rest below); 100 by default, ties in the order they were added. |
privateServerOnly optional | boolean | undefined | Says the tab is for private server games only. A tab is made in the game that added it and no other (by the loader in that game), so this changes nothing about where it goes; it is kept for the card's art, which is no longer changed, and for callers that already say it. |
onOpen optional | ((card: OpenBuddyCard) => void) | undefined | Called as it slides out, and as it slides back in. |
onClose optional | ((card: OpenBuddyCard) => void) | undefined | |
onError optional | ((error: unknown) => void) | undefined | Told of anything that went wrong while the tab was being built or used on a card, which is never thrown at anyone (it happens as the player opens a card). console.error by default. |
onBuilt optional | ((built: { card: OpenBuddyCard; look: CardTabLook; }) => void) | undefined | Called each time it is built on a card, with how it was made there (look). |
CardTabContent
What a tab's panel shows: words, as plain text in the game's own font (never markup, so nothing a player typed becomes a link), greyed with muted (for "nothing here"); or a display object of yours, put in the panel's window and scaled down to fit, and taken off again when the tab goes.
type CardTabContent = string | { text: string; muted?: boolean } | { display: FlashPlaceLike }CardTab
A tab added to the buddy card: call it (or remove) to take it off every card for good.
type CardTab = (() => Promise<void>) & {
readonly id: string;
/** The tab on the card open now; null with no card open, or while it is being built. */
current(): CardTabView | null;
/**
* Shows `content` on the card open now, or on the next one built for the same player while this
* one is still being built. With `for`, only while the card is on that player (in any case):
* an answer about somebody the card has moved on from is dropped.
*/
show(content: CardTabContent, options?: { for?: string }): Promise<void>;
/** Asks `content` again for the card open now. */
refresh(): Promise<void>;
remove(): Promise<void>;
}CardTabView
The tab on the card open now, as a feature reaches it.
| Field | Type | |
|---|---|---|
card | OpenBuddyCard | Whose card it is on. |
look | CardTabLook | How it was made on this card: in the card's art, out of it, or at run time. |
show | (content: CardTabContent) => Promise<void> | Shows something else in its panel. |
open | () => Promise<void> | Slides it out, as a press of its ear does. |
close | () => Promise<void> | Slides it back in, if it is out. |
isOpen | () => boolean | Whether it is out, or on its way out. |
CardTabLook
How a tab was made on the card open now:
native: Phantom's loader made it in the game by itself, in the frame the card went up, of the card's own classes: a new instance of the Buddy Games tab's button, so it is the game's own button with the game's hover, press and sounds, its picture swapped for the tab's on each of its states, and the games tab's panel, title and font copied beside it; the loader slides it;native-copy: no longer made (the tab drawn into the card's art, which is retired); kept so a plugin that compares with it still compiles;drawn: the loader has no card tabs (an older loader, a test), or the card was not as it expects, so the games tab is copied at run time over the bridge and a look laid over its button.
type CardTabLook = 'native' | 'native-copy' | 'drawn'BuddyCardTradeItem
One item on the open buddy card's trade list.
| Field | Type | |
|---|---|---|
defId | number | |
invIdx | number | Its place in the buddy's inventory, which a trade names it by. |
itemType | number | As TRADE_ITEM_TYPE numbers it. |
name | string | null |
PlayerSearchResult
What a player search found (gui.PlayerSearch.onUserLookUpReceived).
| Field | Type | |
|---|---|---|
userName | string | |
found | boolean | |
onlineStatus | number | |
shown | boolean | Whether the client went on to show their card. |