Avatars
packets31 packets
A point in a room, in the room's world coordinates.
Hearing and sending packets
What the game sends is heard on phantom.packets.client, and what the server sends on phantom.packets.server. watch hears a packet after it has gone through; on hears it first and may change or drop it; send sends one to that end. See Packets.
Overview
| Packet | Command | Way | What it is |
|---|---|---|---|
AvatarMove | au | game → server | The player walks or is placed somewhere in the room. |
AvatarMoved | au | server → game | Avatars in the room walked or were placed. |
AvatarPaint | ap | game → server | The player changes their avatar’s colours. |
AvatarPaintResult | ap | server → game | The server says whether the player’s colours changed. |
AvatarSwitchRequest | as | game → server | The player switches to another of their avatars. |
AvatarSwitched | as | server → game | Someone in the room switched avatars. |
AvatarListRequest | al | game → server | The client asks for a player’s avatars. |
AvatarList | al | server → game | The server lists a player’s avatars. |
AvatarDataRequest | ad | game → server | The client asks for one of a player’s avatars. |
AvatarData | ad | server → game | The server describes one of a player’s avatars. |
AvatarLookupRequest | ag | game → server | The client looks a player up by name. |
AvatarLookup | ag | server → game | The server describes a player looked up by name. |
AvatarJoined | ac | server → game | An avatar appears in the room. |
AvatarKillRequest | ak | game → server | The player deletes one of their avatars for good. |
AvatarKilled | ak | server → game | The server says whether an avatar was deleted for good. |
AvatarLeft | ar | server → game | An avatar leaves the room. |
AvatarAddRequest | aa | game → server | The player adds a new animal to their account. |
AvatarAdded | aa | server → game | The server says whether a new animal was added to the account. |
AvatarSlotBuyRequest | ab | game → server | The player buys another avatar slot. |
AvatarSlotBought | ab | server → game | The server says whether another avatar slot was bought. |
AvatarPendingFlag | af | game → server | The client sets one of the account’s pending flags. |
AvatarFastPassAddRequest | afp | game → server | The player adds the first animal to an account made without one. |
AvatarFastPassAdded | afp | server → game | The server says whether the first animal of an account was added. |
AvatarLookupByIdRequest | ags | game → server | The client looks a player up by their id in the room. |
AvatarNameBarChanged | an | server → game | Someone in the room changed their name bar. |
AvatarOrdainRequest | ao | game → server | The player chooses which of their avatars stay usable without a membership. |
AvatarOrdained | ao | server → game | The server says whether the avatars chosen to stay usable were taken. |
AvatarPhotoRequest | apb | game → server | The player pays for a photo booth picture they saved. |
AvatarPhotoTaken | apb | server → game | The server says what the player has left after paying for a photo. |
AvatarPhotoCheckRequest | apc | game → server | The client asks whether the player can pay for a photo booth picture. |
AvatarPhotoChecked | apc | server → game | The server says whether the player can pay for a photo booth picture. |
AvatarMove
The player moves (AvatarManager.updateAvatar and processQueuedPositions). Positions are queued while the client throttles and sent together:
%xt%o%au%<room>%<count>%<x>%<y>%...%<animation>%<immediate>%
animation is the idle animation, with FLIP_BIT set when facing left. immediate is set when the avatar was placed rather than walked.
Fields
| Field | Type | |
|---|---|---|
points | { x: number; y: number; }[] | The positions queued, in order, each in the room's world coordinates. |
animation | number | The idle animation, with FLIP_BIT set when facing left. Unsigned. |
immediate | boolean | The avatar was placed rather than walked. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarMove, (packet) => {
console.log(packet.points, packet.animation, packet.immediate);
});AvatarMoved
Other avatars moved (AvatarManager.avatarUpdateResponse):
%xt%au%<room>%<users>%<userId>%<count>%<x>%<y>%...%<teleport>%...%
A teleported avatar is placed at its last point; the others walk the path.
Fields
| Field | Type | |
|---|---|---|
avatars | { userId: number; path: { x: number; y: number; }[]; teleport: boolean; }[] | Each avatar that moved, after their count: userId (its SmartFox user id), path (the points it walks, in the room's world coordinates) and teleport (placed at the last point rather than walked). |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarMoved, (packet) => {
console.log(packet.avatars);
});AvatarPaint
The player's colours change (AvatarXtCommManager.requestColorChange(colors, nameBarData)): three packed colour values, as Avatar.colors holds them, and one more number.
That last number is named avatarId here for the plugins already using it, but the client sends the player's name bar data in it (gui.AvatarEditor.sendChangesRequest passes playerUserInfo.nameBarData, or the name bar just picked), not an avatar.
Fields
| Field | Type | |
|---|---|---|
colors | readonly [number, number, number] | The three new colours, packed as Avatar.colors holds them. |
avatarId | number | Despite its name, the player's name bar data (playerUserInfo.nameBarData, or the name bar just picked), not an avatar id. See above. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarPaint, (packet) => {
console.log(packet.colors, packet.avatarId);
});AvatarPaintResult
Whether the player's colour change was taken (AvatarManager.avatarPaintResponse, or the avatar editor's own callback): %xt%ap%<room>%1%. The client reads nothing past the result.
Fields
| Field | Type | |
|---|---|---|
success | boolean | The change was taken: the field is 1. |
extra | string[] | Whatever follows, which the client does not read. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarPaintResult, (packet) => {
console.log(packet.success, packet.extra);
});AvatarSwitchRequest
Switches the player to another of their avatars (AvatarXtCommManager.requestAvatarSwitch, called by AvatarSwitch.switchAvatars): the avatar's perUserAvId.
Fields
| Field | Type | |
|---|---|---|
perUserAvId | number | The avatar to switch to, by its per user id. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarSwitchRequest, (packet) => {
console.log(packet.perUserAvId);
});AvatarSwitched
Someone in the room switched avatars (AvatarSwitch.avatarSwitchResponse, then read when the transform animation hides the avatar):
%xt%as%<room>%1%<userId>%<perUserAvId>%<avInvId>%<customAvId>%<avTypeId>%<c1>%<c2>%<c3>%<avName>% <activePetInvId>%<questLevel>% to the player who switched <lBits>%<uBits>%<eBits>%<petName>%<createdTs>%<personality>%<food>%<toy>%<questLevel>% to everyone else
The client tells the two apart by whether userId is its own; the message does not say, so the packet goes by how many fields follow the avatar. %xt%as%<room>%0% is a refused switch.
Fields
| Field | Type | |
|---|---|---|
success | boolean | The switch went through: the field after the room is not 0. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarSwitched, (packet) => {
console.log(packet.success);
});AvatarListRequest
Asks for a player's avatars (AvatarXtCommManager.requestAvatarList([userName])). The player's own list is asked for on joining the world and after adding or redeeming an avatar; a buddy card asks for someone else's.
Fields
| Field | Type | |
|---|---|---|
userName | string | The player whose avatars to list, by username. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarListRequest, (packet) => {
console.log(packet.userName);
});AvatarList
A player's avatars (AvatarXtCommManager.avatarListResponse). The player's own list says more:
%xt%al%<room>%<userName>%<slotFlags>%<uuid>%<count>%<perUserAvId>%<avInvId>%<avName>%<type>%<customAvId>%...% %xt%al%<room>%<userName>%<count>%<perUserAvId>%...% someone else's
The client tells them apart by comparing the name with its own. The packet goes by the shape: someone else's list is a count and exactly that many integers, which the player's own never is, because its third field is the account's uuid.
Fields
| Field | Type | |
|---|---|---|
own | boolean | The list is the player's own, which says more; false for someone else's. |
userName | string | The player whose avatars they are, by username. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarList, (packet) => {
console.log(packet.own, packet.userName);
});AvatarDataRequest
Asks for one of a player's avatars (AvatarXtCommManager.requestADForAvatar, sending [userName, perUserAvId, items]).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player whose avatar it is, by username. |
perUserAvId | number | Which of the player's avatars, by its per user id. |
items | AvatarDataItems | How much of the avatar's items to send with it: 0 none, 1 the full list, 2 the items worn (when the full list was already asked for). |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarDataRequest, (packet) => {
console.log(packet.userName, packet.perUserAvId, packet.items);
});AvatarData
One of a player's avatars (AvatarXtCommManager.avatarDataResponse):
%xt%ad%<room>%<userName>%<uuid>%<nameBar>%<enviroType>%<moderated>%<partyTime>%<daysAway>% <perUserAvId>%<type>%<customAvId>%<c1>%<c2>%<c3>%<avName>%<questLevel>% <avInvId>%<landPet>%<oceanPet>%<attack>%<attackMax>%<defense>%<defenseMax>%<health>% own <lBits>%<uBits>%<eBits>%<petName>% someone else's
The client tells the two apart by the name; the packet by how many fields follow, eight or four.
Fields
| Field | Type | |
|---|---|---|
userName | string | The player's username. |
uuid | string | The player's account uuid. |
nameBarData | number | The player's name bar, as nameBarData holds it. |
enviroType | number | The avatar's environment: whether it is a land or an ocean avatar. |
userNameModeratedFlag | number | Above 0 when the username may be shown; otherwise the client shows a stock name. |
timeLeftHostingCustomParty | number | Seconds left hosting a custom party. |
daysSinceLastLogin | number | Days since the player last logged in. |
perUserAvId | number | Which of the player's avatars, by its per user id. |
avTypeId | number | The avatar's animal type, by its def id. |
customAvId | number | The avatar's customAvId, which names a custom avatar where it is one. |
colors | AvatarColors | The avatar's three colours, packed as Avatar.colors holds them. |
avName | string | The avatar's name. |
questLevel | number | The avatar's adventure level. |
player | { avInvId: number; landPetInvId: number; oceanPetInvId: number; attackBase: number; attackMax: number; defenseBase: number; defenseMax: number; healthBase: number; } | null | Only in the player's own avatars: its slot, pets out on land and in the ocean, and stats. |
other | { lBits: number; uBits: number; eBits: number; petName: string; } | null | Only in someone else's: the pet the avatar has out (lBits 0 for none). |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarData, (packet) => {
console.log(packet.userName, packet.uuid, packet.nameBarData);
});AvatarLookupRequest
Looks a player up by name (AvatarXtCommManager.requestAvatarGet(userName, callback, userLookup)). userLookup is set by the screens that only look a name up (player search, mail, masterpieces, the volume selector's buddy search) and clear for buddy requests, trades and cards.
Fields
| Field | Type | |
|---|---|---|
userName | string | The player to look up, by username. |
userLookup | boolean | Set by screens that only look a name up (player search, mail, masterpieces, the buddy search); clear for buddy requests, trades and cards. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarLookupRequest, (packet) => {
console.log(packet.userName, packet.userLookup);
});AvatarLookup
A player looked up by name (AvatarXtCommManager.avatarGetResponse):
%xt%ag%<room>%<userName>%<uuid>%<status>%<accountType>%<isGuide>%<daysAway>%<perUserAvId>%<avInvId>% <nameBar>%<type>%<customAvId>%<c1>%<c2>%<c3>%<avName>%<eyes>%<pattern>%<questLevel>%<count>% <userId>%<moderated>%<lBits>%<uBits>%<eBits>%<petName>%<defId>%<color>%...%
The avatar follows only when status is 0 (offline) or 1 (playing). The client counts a player with a status under 3 as existing, and reads 2 as an account gone (a buddy's status -1, the card's archived look).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player looked up, by username. |
uuid | string | The player's account uuid. |
status | number | When the player's avatar follows: 1 playing, 0 offline (a card that is not a buddy's greys its trade and games tabs). Without one: 2 an account gone (-1, the card's archived look, a grey silhouette), 3 and above no such player (the card closes). |
avatar | LookedUpAvatar | null | The player's current avatar, or null when status is not 0 or 1. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarLookup, (packet) => {
console.log(packet.userName, packet.uuid, packet.status);
});AvatarJoined
An avatar appears in the room (AvatarManager.avatarCreateResponse), the player's own included:
%xt%ac%<room>%<userId>%<x>%<y>%<animation>%<userName>%<uuid>%<perUserAvId>%<avName>%<type>% <customAvId>%<c1>%<c2>%<c3>%<questLevel>%<details>...%
animation is the idle animation with FLIP_BIT for facing left (createAvatar). What follows the level depends on the room: adventure rooms put two more fields first, and the client knows which room it is in while the message does not. So the rest is kept in details, and readAvatarJoinDetails reads it once the caller says which kind of room this is.
Fields
| Field | Type | |
|---|---|---|
userId | number | The avatar's SmartFox user id, which later messages name it by. |
x | number | Where it appears, across, in the room's world coordinates. |
y | number | Where it appears, down, in the room's world coordinates. |
animation | number | The idle animation, with FLIP_BIT set when facing left. Unsigned. |
userName | string | The player's username. |
uuid | string | The player's account uuid. |
perUserAvId | number | Which of the player's avatars, by its per user id. |
avName | string | The avatar's name. |
avTypeId | number | The avatar's animal type, by its def id. |
customAvId | number | The avatar's customAvId, which names a custom avatar where it is one. |
colors | AvatarColors | The avatar's three colours, packed as Avatar.colors holds them. |
questLevel | number | The avatar's adventure level. |
details | string[] | The rest, unread, whose layout depends on the room: see readAvatarJoinDetails. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarJoined, (packet) => {
console.log(packet.userId, packet.x, packet.y);
});AvatarKillRequest
Deletes one of the player's avatars for good (AvatarXtCommManager.requestAvatarKill, called by AvatarSwitch.removeAvatar once the player confirms): the avatar's perUserAvId. The client refuses to ask when only one avatar is left.
Fields
| Field | Type | |
|---|---|---|
perUserAvId | number | The avatar to delete, by its per user id. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarKillRequest, (packet) => {
console.log(packet.perUserAvId);
});AvatarKilled
Whether an avatar was deleted (AvatarXtCommManager.avatarKillResponse, then AvatarSwitch.avatarKillResponse(success, extra)): %xt%ak%<room>%<success>%<extra>%. The client's own extra is read but never explained past being handed back to the caller.
Fields
| Field | Type | |
|---|---|---|
success | boolean | The avatar was deleted: the field is 1. |
extra | number | A number the client passes on to its own caller without reading further. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarKilled, (packet) => {
console.log(packet.success, packet.extra);
});AvatarLeft
An avatar leaves the room (AvatarManager.avatarRemoveResponse): %xt%ar%<room>%<userId>%, or, for one that walks out first, %xt%ar%<room>%<userId>%<walkOut>%<x>%<y>%, where a walkOut above 0 sends the avatar to the point before it is removed.
Fields
| Field | Type | |
|---|---|---|
userId | number | The SmartFox user id of the avatar leaving. |
walkOut | number | Above 0 when the avatar walks to walkTo before it is removed; 0 when left out. |
walkTo | RoomPoint | null | Where it walks to, or null when it does not walk out. |
extra | string[] | Whatever follows, as it came. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarLeft, (packet) => {
console.log(packet.userId, packet.walkOut, packet.walkTo);
});AvatarAddRequest
Adds a new animal to the player's account (AvatarXtCommManager.requestAvatarAdd, called by AvatarSwitch.addNewWorldAvatar once the avatar creator is done):
%xt%o%aa%<room>%<nameId1>%<nameId2>%<nameId3>%<avTypeId>%<customAvId>%<diamondDefId>%<shopId>%
The avatar switcher charges 1000 gems for it; a diamond animal or one bought in a shop names the diamond item and the shop.
Fields
| Field | Type | |
|---|---|---|
nameIds | AvatarNameIds | The name's three parts, as localisation ids, in the order the server keeps them. |
avTypeId | number | The kind of animal, by its def id. |
customAvId | number | The custom avatar it is, or -1 for the kind's own look (AvatarSwitch._addAvatar.customAvId). |
diamondDefId | number | The diamond shop item a diamond animal is bought as (avatarDiamondDefId), or -1. |
shopId | number | The shop the animal is bought in (AvatarSwitch._shopId), or -1 from the avatar switcher. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarAddRequest, (packet) => {
console.log(packet.nameIds, packet.avTypeId, packet.customAvId);
});AvatarAdded
Whether a new animal was added (AvatarXtCommManager.avatarAddResponse, then AvatarSwitch.addAvatarResponse(status, perUserAvId, avInvId)):
%xt%aa%<room>%<status>%<perUserAvId>%<avInvId>%
A status of 1 is an animal added. A shop reads -1 as the animal no longer on sale and says so by name (Shop.onAvatarAdded); anything else is a refusal the switcher shows as its "oops".
Fields
| Field | Type | |
|---|---|---|
status | number | 1 when the animal was added; -1 when a shop's animal is no longer on sale; else refused. |
perUserAvId | number | The new avatar's per user id, which as and ak name it by. |
avInvId | number | The new avatar's slot among the player's avatars. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarAdded, (packet) => {
console.log(packet.status, packet.perUserAvId, packet.avInvId);
});AvatarSlotBuyRequest
Buys the player another avatar slot (AvatarXtCommManager.requestAvatarBuy, called by AvatarSwitch.addSlot when a new animal needs a slot first). Nothing follows the room.
Fields
| Field | Type | |
|---|---|---|
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarSlotBuyRequest, (packet) => {
console.log('avatar.slot-buy-request');
});AvatarSlotBought
Whether the slot was bought (AvatarXtCommManager.avatarBuyResponse, then AvatarSwitch.showNewAvatarPopup(success)): %xt%ab%<room>%<success>%.
Fields
| Field | Type | |
|---|---|---|
success | boolean | The slot was bought: the field is not 0. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarSlotBought, (packet) => {
console.log(packet.success);
});AvatarPendingFlag
Sets one of the account's pending flags (AvatarXtCommManager.sendAvatarPendingFlagsUpdate), which the client also sets on userInfo.pendingFlags itself. The new player's tutorial, the "first five minutes", sends bit 0 when it is finished or skipped (QuestManager. guiElementsSkipBtnPress, QuestActor), and the client then sets userInfo.firstFiveMinutes. The server does not answer.
Fields
| Field | Type | |
|---|---|---|
flag | number | Which flag, by its bit: 1 << flag is set on userInfo.pendingFlags. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarPendingFlag, (packet) => {
console.log(packet.flag);
});AvatarFastPassAddRequest
Adds the first animal to an account made without one, the "fast pass" (AvatarXtCommManager.requestAvatarFastPassAdd, from AvatarSwitch.addNewWorldAvatar while userInfo.needFastPass is set):
%xt%o%afp%<room>%<avTypeId>%<nameId1>%<nameId2>%<nameId3>%
Fields
| Field | Type | |
|---|---|---|
avTypeId | number | The kind of animal, by its def id. |
nameIds | AvatarNameIds | The name's three parts, as localisation ids, in the order the server keeps them. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarFastPassAddRequest, (packet) => {
console.log(packet.avTypeId, packet.nameIds);
});AvatarFastPassAdded
Whether the fast pass animal was added (AvatarXtCommManager.avatarFastPassResponse, then AvatarSwitch.addFastPassAvatarResponse(success), which asks for the avatar list again and joins the world): %xt%afp%<room>%<success>%.
Fields
| Field | Type | |
|---|---|---|
success | boolean | The animal was added: the field is not 0. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarFastPassAdded, (packet) => {
console.log(packet.success);
});AvatarLookupByIdRequest
Looks a player up by their id in the room (AvatarXtCommManager.requestAvatarGetBySfsId, from a buddy card's list of players or an adventure's join screen): %xt%o%ags%<room>%<userId>%0%. The server answers with an ag, as it does requestAvatarGet, and the client matches it by the userId in it.
Fields
| Field | Type | |
|---|---|---|
userId | number | The player to look up, by their id in the room. |
userLookup | boolean | The same flag ag sends; the client always sends 0. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarLookupByIdRequest, (packet) => {
console.log(packet.userId, packet.userLookup);
});AvatarNameBarChanged
Someone in the room changed their name bar (AvatarXtCommManager.avatarNamebarUpdateResponse): %xt%an%<room>%<userId>%<nameBarData>%. The client sets it on the player's UserInfo and redraws their avatar. The client never asks for it.
Fields
| Field | Type | |
|---|---|---|
userId | number | Whose name bar, by their id in the room. |
nameBarData | number | The new name bar, as nameBarData holds it. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarNameBarChanged, (packet) => {
console.log(packet.userId, packet.nameBarData);
});AvatarOrdainRequest
Chooses which of the player's avatars stay usable once a membership has run out (AvatarXtCommManager.requestAvatarOrdain, from AvatarSwitch.chooseTwo, which the avatar switcher and the membership-ended messages call): the chosen avatars' slots, one or two of them.
%xt%o%ao%<room>%<avInvId>%<avInvId>%
Fields
| Field | Type | |
|---|---|---|
avInvIds | number[] | The chosen avatars, by their slots (avInvId), in the order chosen. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarOrdainRequest, (packet) => {
console.log(packet.avInvIds);
});AvatarOrdained
Whether the choice was taken (AvatarXtCommManager.avatarOrdainResponse, then the caller's own callback with the result): %xt%ao%<room>%<success>%.
Fields
| Field | Type | |
|---|---|---|
success | boolean | The choice was taken: the field is not 0. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarOrdained, (packet) => {
console.log(packet.success);
});AvatarPhotoRequest
Pays for a photo booth picture once the player has saved it (AvatarXtCommManager.sendAvatarPhotoTake, from PhotoBooth.onSaveImage). Nothing follows the room.
Fields
| Field | Type | |
|---|---|---|
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarPhotoRequest, (packet) => {
console.log('avatar.photo-request');
});AvatarPhotoTaken
The photo was paid for (AvatarXtCommManager.handleXtReply, which hands it to PhotoBooth.onPhotoGemsSpent): %xt%apb%<room>%<gems>%. The client takes gems as the player's new balance (UserCurrency.setCurrency(gems, 0)).
Fields
| Field | Type | |
|---|---|---|
gems | number | The player's gems now the photo is paid for. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarPhotoTaken, (packet) => {
console.log(packet.gems);
});AvatarPhotoCheckRequest
Asks whether the player can pay for a photo booth picture before it is taken (AvatarXtCommManager.sendAvatarPhotoTakeCheck, from PhotoBooth.onSaveForGems). Nothing follows the room.
Fields
| Field | Type | |
|---|---|---|
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the game sends it to the server, after it has gone through.
const stop = phantom.packets.client.watch(packets.AvatarPhotoCheckRequest, (packet) => {
console.log('avatar.photo-check-request');
});AvatarPhotoChecked
Whether the player can pay for the photo (AvatarXtCommManager.handleXtReply, which hands it to PhotoBooth.onGemsSpent): %xt%apc%<room>%<gems>%. At 0 or above the booth takes the picture; below 0 it tells the player they cannot pay for it.
Fields
| Field | Type | |
|---|---|---|
gems | number | 0 or above when the player can pay for the photo; below 0 when they cannot. |
room | number | The room the message was sent in, as the SmartFox room id; -1 when it names none. |
Example
// Each time the server sends it to the game, after it has gone through.
const stop = phantom.packets.server.watch(packets.AvatarPhotoChecked, (packet) => {
console.log(packet.gems);
});