Buddies
packets16 packets
Buddies. Animal Jam keeps its own buddy list in extension messages (buddy.BuddyXtCommManager), not SmartFox's bList and bUpd, which the client can read but the game does not use. Buddies are named by username; the server answers each request with a message of the same command.
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 |
|---|---|---|---|
BuddyListRequest | bl | game → server | The player asks for their buddy and blocked lists. |
BuddyList | bl | server → game | The server sends the buddy list or the blocked list. |
BuddyAddRequest | ba | game → server | The player asks someone to be their buddy. |
BuddyAddResult | ba | server → game | Someone asks to be a buddy, or the server answers the player’s request. |
BuddyConfirm | bc | game → server | The player accepts or declines a buddy request. |
BuddyStatus | bs | server → game | A buddy comes online or goes offline, is added, or is renamed. |
BuddyRemoveRequest | bd | game → server | The player removes a buddy. |
BuddyRemoved | bd | server → game | A buddy is no longer a buddy. |
BuddyLocationRequest | br | game → server | The player asks where a buddy is. |
BuddyLocation | br | server → game | The server says where a buddy is. |
BuddyBlockRequest | bb | game → server | The player blocks someone. |
BuddyBlockResult | bb | server → game | The server says whether someone was blocked. |
BuddyUnblockRequest | bu | game → server | The player unblocks someone. |
BuddyUnblockResult | bu | server → game | The server says whether someone was unblocked. |
BuddyBlockInfoRequest | bi | game → server | The player asks whether someone is blocking them. |
BuddyBlockInfo | bi | server → game | The server says whether someone is blocking the player. |
BuddyListRequest
Asks for the buddy list and the blocked list (sendBuddyListRequest).
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.BuddyListRequest, (packet) => {
console.log('buddy.list-request');
});BuddyList
The buddy list or the blocked list (buddyListblockedListResponse), told apart by the first field: 0 for buddies, anything else for the blocked list.
The buddy list (BuddyManager.buddyListResponseHandler) gives the online buddies, then the offline ones:
%xt%bl%<room>%0%<online>%<userName>%<uuid>%<moderation>%<accountType>%<partyTimeLeft>%... %<offline>%<userName>%<uuid>%<moderation>%<accountType>%...%
The blocked list (blockedListResponseHandler) is a count and that many usernames. Buddies are read here in one list, online first, and written back the same way.
Fields
| Field | Type | |
|---|---|---|
blocked | boolean | This is the blocked list: the first field was not 0. |
buddies | BuddyEntry[] | The buddies, online ones first; empty for the blocked list. |
blockedUserNames | string[] | The usernames the player blocks; empty for the buddy list. |
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.BuddyList, (packet) => {
console.log(packet.blocked, packet.buddies, packet.blockedUserNames);
});BuddyAddRequest
Asks someone to be a buddy (sendBuddyAddRequest, from BuddyManager.addRemoveBuddy).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player to ask, 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.BuddyAddRequest, (packet) => {
console.log(packet.userName);
});BuddyAddResult
About a buddy request (buddyAddRequestResponse, BuddyManager.buddyAddRequestResponseHandler):
%xt%ba%<room>%<status>%<userName>%<moderation>%
Status 0 is someone asking the player to be their buddy, which the client shows as a request to accept or decline for 30 seconds. 4 is the player's list being full. 3 marks the player's own request to that user as no longer accepted. The others (1, 2 and 5) only show a message.
Fields
| Field | Type | |
|---|---|---|
status | number | What happened: 0 someone asks to be the player's buddy, 3 the player's own request is no longer accepted, 4 the player's list is full; 1, 2 and 5 only show a message. |
userName | string | The other player, by username. |
userNameModerationFlag | number | Above 0 when the username may be shown; otherwise the client shows a stock name. |
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.BuddyAddResult, (packet) => {
console.log(packet.status, packet.userName, packet.userNameModerationFlag);
});BuddyConfirm
Accepts or declines a buddy request (sendBuddyConfirmRequest).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player who asked, by username. |
accept | boolean | True accepts the request, false declines it. |
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.BuddyConfirm, (packet) => {
console.log(packet.userName, packet.accept);
});BuddyStatus
A buddy changed (buddyStatusResponse, BuddyManager.buddyStatusResponseHandler): came online or went offline, became a buddy, or was renamed.
%xt%bs%<room>%<withAvatar>%<userName>%<uuid>%<moderation>%<online>%<accountType>%<change>%...%
With withAvatar set, the avatar they are playing follows: its name, its per user id and the seconds left hosting a custom party. Otherwise their new username follows.
change is what happened: 1 the player's request was accepted and 2 the player accepted one (both add the buddy with a notice), 3 and 4 a rename to newUserName. Anything else is an update to a buddy already listed, or adds one quietly.
Fields
| Field | Type | |
|---|---|---|
newUserName | string | null | The buddy's new username, when withAvatar is false; otherwise null. |
avatarName | string | null | The name of the avatar the buddy is playing, when withAvatar; otherwise null. |
perUserAvatarId | number | null | That avatar's per user id, when withAvatar; otherwise null. |
partyTimeLeft | number | null | Seconds left hosting a custom party, when withAvatar; otherwise null. |
userName | string | The buddy's username (the old one, for a rename). |
uuid | string | The buddy's account uuid. |
userNameModerationFlag | number | Above 0 when the username may be shown; otherwise the client shows a stock name. |
online | boolean | The buddy is online: the field is 1. |
accountType | number | The account type; 2 and above is a member (Utility.isMember). |
change | number | What happened: 1 the player's request was accepted, 2 the player accepted one, 3 and 4 a rename. Anything else updates a listed buddy, or adds one quietly. |
withAvatar | boolean | The avatar the buddy is playing follows, rather than a new 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.BuddyStatus, (packet) => {
console.log(packet.newUserName, packet.avatarName, packet.perUserAvatarId);
});BuddyRemoveRequest
Removes a buddy (sendBuddyDeleteRequest, from BuddyManager.addRemoveBuddy).
Fields
| Field | Type | |
|---|---|---|
userName | string | The buddy to remove, 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.BuddyRemoveRequest, (packet) => {
console.log(packet.userName);
});BuddyRemoved
A buddy was removed, by either side (buddyDeleteResponse).
Fields
| Field | Type | |
|---|---|---|
userName | string | The buddy who is no longer a buddy, 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.BuddyRemoved, (packet) => {
console.log(packet.userName);
});BuddyLocationRequest
Asks where a buddy is (sendBuddyRoomRequest), as the buddy card does while it is open. The answer does not name the buddy, so answers are matched to requests by order.
Fields
| Field | Type | |
|---|---|---|
userName | string | The buddy to find, 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.BuddyLocationRequest, (packet) => {
console.log(packet.userName);
});BuddyLocation
Where a buddy is (buddyRoomResponse, BuddyCard.buddyRoomResponseHandler):
%xt%br%<room>%<roomName>%<displayName>%<displayNameId>%<locked>%
roomName is the room to join, with @<server> after it when the buddy is on another server. An empty displayName means the buddy is offline, and Choosing Server that they are between servers. displayNameId is a translation id for the name, when not 0. With locked set the buddy card greys its go button.
Fields
| Field | Type | |
|---|---|---|
roomName | string | The room to join to reach the buddy, with @<server> after it when on another server. |
displayName | string | The room's name as shown: empty when the buddy is offline, Choosing Server in between. |
displayNameId | number | A translation id for the name, or 0 for none. |
locked | boolean | The buddy cannot be joined there: the buddy card greys its go button. |
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.BuddyLocation, (packet) => {
console.log(packet.roomName, packet.displayName, packet.displayNameId);
});BuddyBlockRequest
Blocks someone (sendBuddyBlockRequest).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player to block, 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.BuddyBlockRequest, (packet) => {
console.log(packet.userName);
});BuddyBlockResult
Whether a block worked (buddyBlockResponse): %xt%bb%<room>%<userName>%<success>%.
Fields
| Field | Type | |
|---|---|---|
userName | string | The player blocked, by username. |
success | boolean | The block worked: the field is 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.BuddyBlockResult, (packet) => {
console.log(packet.userName, packet.success);
});BuddyUnblockRequest
Unblocks someone (sendBuddyUnblockRequest).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player to unblock, 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.BuddyUnblockRequest, (packet) => {
console.log(packet.userName);
});BuddyUnblockResult
Whether an unblock worked (buddyUnblockResponse): %xt%bu%<room>%<userName>%<success>%.
Fields
| Field | Type | |
|---|---|---|
userName | string | The player unblocked, by username. |
success | boolean | The unblock worked: the field is 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.BuddyUnblockResult, (packet) => {
console.log(packet.userName, packet.success);
});BuddyBlockInfoRequest
Asks whether someone is blocking the player (sendBuddyBlockInfoRequest).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player to ask about, 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.BuddyBlockInfoRequest, (packet) => {
console.log(packet.userName);
});BuddyBlockInfo
Whether someone is blocking the player (buddyIsBlockingMeResponse).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player asked about, by username. |
blockingPlayer | boolean | That player is blocking the player: the field is 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.BuddyBlockInfo, (packet) => {
console.log(packet.userName, packet.blockingPlayer);
});