Chat
packets24 packets
How a chat message was made. The client appends the kind to the text (sendChatMessage): free chat is 0, or 9 on a SafeChat account, and the server echoes other kinds for predefined phrases and emotes. CHAT_KIND names each one.
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 |
|---|---|---|---|
PublicChat | pubMsg | game → server | The player says something in the room. |
RoomChat | uc | server → game | Someone in the room said something. |
RoomChatHostedGame | uc | server → game | A player hosts a two player game over their head, or no longer. |
AdminMessage | ua | server → game | Animal Jam shows the player a message. |
AdminMessageMarked | ua | server → game | Animal Jam shows the player a message, marked for Phantom. |
ModerationNotice | fd | server → game | A moderator bans, silences, kicks, warns or messages the player. |
ModerationBan | fd | server → game | A moderator bans the player. |
ModerationSilence | fd | server → game | A moderator silences the player, or lifts it. |
ModerationKick | fd | server → game | A moderator kicks the player. |
InvisModeResult | fi | server → game | The server confirms the player's ghost mode. |
InvisModeRequest | fi | game → server | A moderator asks to go about unseen, or to be seen again. |
ReportRequest | fr | game → server | The player reports someone. |
ReportResult | fr | server → game | The server confirms a report. |
ReportWithDataRequest | fra | game → server | The player reports someone over something specific they sent. |
ReportWithDataResult | fra | server → game | The server confirms a report with content attached. |
BanRequest | fb | game → server | A moderator bans a player. |
SilenceRequest | fs | game → server | A moderator silences a player’s chat. |
MuteRequest | fm | game → server | A moderator mutes a player. |
KickRequest | fk | game → server | A moderator kicks a player off the server. |
BanResult | fb | server → game | |
SilenceResult | fs | server → game | |
MuteResult | fm | server → game | |
KickResult | fk | server → game | |
IdleTimeout | ft | game → server | The client says the player has been idle too long. |
PublicChat
A public chat message (SmartFoxClient.sendPublicMessage). The text is entity encoded inside CDATA, with its kind after a %, and for a dance or a hosted game one more field after that:
<msg t='sys'><body action='pubMsg' r='<room>'><txt><![CDATA[hello%0]]></txt></body></msg> <msg t='sys'><body action='pubMsg' r='<room>'><txt><![CDATA[dance%3%14]]></txt></body></msg>
The client strips % from what a player types (UserCommXtCommManager.onSendMessage), but text written by a script may hold one, so the kind is read from the end: the last field, or the one before it when that is a kind that carries an extra field and something comes before both.
Fields
| Field | Type | |
|---|---|---|
text | string | What was said, decoded, without the kind after it. What it holds depends on kind. |
kind | number | How the message was made (CHAT_KIND): 0 or 9 for free chat. |
extra optional | string | undefined | The field after the kind, for the kinds that send one (a dance's idle animation, a game's id). Absent for every other kind. |
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.PublicChat, (packet) => {
console.log(packet.text, packet.kind, packet.extra);
});RoomChat
A chat message someone in the room said (UserCommXtCommManager.userCommChatResponse):
%xt%uc%<room>%<userId>%<text>%<kind>%<level>%
level is how the balloon shows it (AvatarWorldView.setMessage): above 1 the text is highlighted, and at 2 it is a translation id followed by | and its values. Most messages send 0, and some leave it out, which the client reads as 0; it is null here when it was left out. Anything after it is kept as it came.
Fields
| Field | Type | |
|---|---|---|
userId | number | The SmartFox user id of the player who said it. |
text | string | What was said. What it holds depends on kind. |
kind | number | How the message was made (CHAT_KIND). |
level | number | null | How the balloon shows it: 0 plainly, above 1 highlighted, 2 a translation id then | and its values. Null when the message leaves it out, which the client reads as 0. |
extra | string[] | Anything after level, kept 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.RoomChat, (packet) => {
console.log(packet.userId, packet.text, packet.kind);
});RoomChatHostedGame
A game a player hosts over their head, said back to the room (uc kind 12, UserCommXtCommManager.userCommChatResponse, which their own client waits for before it lets the HUD go): a variant of chat.room, its text read as the game.
%xt%uc%<room>%<userId>%on|<gameDefId>%12%<level>%
Fields
| Field | Type | |
|---|---|---|
level | number | How the balloon shows it, as chat.room's. |
hosting | boolean | Hosting it (on), or no longer (off). |
gameDefId | number | The game, by its def id; for off, the one hosted until now, or 0. |
userId | number | The player hosting it, by SmartFox id. |
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.RoomChatHostedGame, (packet) => {
console.log(packet.level, packet.hosting, packet.gameDefId);
});AdminMessage
A message from Animal Jam itself, shown in a popup (userCommAdminMessageResponse). Unlike other extension messages it names no room: the client reads the text at data[1], where a room would be, and whether it is a system message at data[2] (missing or 1):
%xt%ua%<text>%<system>%
So it is read here from the message's own fields, and its room is always -1.
Fields
| Field | Type | |
|---|---|---|
text | string | The message. __FORCE_RELOGIN__ makes the client move to another server; <id>|<value>|... is a translation id and the values put into it. |
system | boolean | Whether it is a system message, shown in a popup wherever the player is. A broadcast (false) is kept as the last broadcast and not shown in minigames or adventures. |
extra | string[] | Anything after, kept 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.AdminMessage, (packet) => {
console.log(packet.text, packet.system, packet.extra);
});AdminMessageMarked
A message from Animal Jam itself with a mark after the two fields the client reads, which the game never looks at: a variant of chat.admin, which reads every ua.
%xt%ua%<text>%<system>%<marker>%
Fields
| Field | Type | |
|---|---|---|
text | string | The message, as AdminMessage's. |
system | boolean | Whether it is a system message, as AdminMessage's. |
marker | string | What the message is, for a client that looks past what the game reads: Phantom's private server marks its answer to !help so, which Phantom takes out of the game's way. |
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.AdminMessageMarked, (packet) => {
console.log(packet.text, packet.system, packet.marker);
});ModerationNotice
A moderation notice (FacilitatorXtCommManager.facilitatorDisciplineResponse):
%xt%fd%<room>%<action>%...%
What follows depends on the action, and is kept as it came:
fba ban:1, then its length in seconds, or -1 for good.fsa silence: a count above 0 silences for that long, below 0 without end, 0 lifts it.fka kick: the reason; 0 disconnects the player.fpa moderator's private message: its text, then0. Anything else shows a stock notice.fwa warning: the id of the warning to show.fgandfc:1, then how long in seconds.
Fields
| Field | Type | |
|---|---|---|
action | string | What the moderator did: fb, fs, fk, fp, fw, fg or fc (see above). |
extra | string[] | The action's details, which depend on it (see above), as they 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.ModerationNotice, (packet) => {
console.log(packet.action, packet.extra);
});ModerationBan
A ban, as a moderation notice (fd, action fb): 1, then how long it lasts in seconds, or -1 for good. A variant of chat.moderation, which reads every notice:
%xt%fd%<room>%fb%1%<seconds>%
Fields
| Field | Type | |
|---|---|---|
banned | boolean | Always 1 on the wire: the client reads it as a ban being on. |
seconds | number | How long the ban lasts, in seconds; -1 for good. |
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.ModerationBan, (packet) => {
console.log(packet.banned, packet.seconds);
});ModerationSilence
A silence, as a moderation notice (fd, action fs): a count above 0 silences for that many minutes, below 0 without end, and 0 lifts it. A variant of chat.moderation:
%xt%fd%<room>%fs%<minutes>%
Fields
| Field | Type | |
|---|---|---|
minutes | number | The minutes left, which the client puts in its "silenced for" message; -1 for no end, 0 lifts 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.ModerationSilence, (packet) => {
console.log(packet.minutes);
});ModerationKick
A kick, as a moderation notice (fd, action fk): its reason, where 0 disconnects the player. A variant of chat.moderation:
%xt%fd%<room>%fk%<reason>%
Fields
| Field | Type | |
|---|---|---|
reason | number | Why: 0 disconnects the player. |
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.ModerationKick, (packet) => {
console.log(packet.reason);
});InvisModeResult
The server confirms the player's ghost mode, on or off (FacilitatorXtCommManager.facilitatorInvisModeResponse):
%xt%fi%<room>%<invisible>%
Sent back for FacilitatorXtCommManager.sendInvisModeRequest, the fi a moderator or guide account sends to browse without appearing online. The client stores the flag it is given here, not the one it asked for.
Fields
| Field | Type | |
|---|---|---|
invisible | boolean | Whether the player is invisible now. |
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.InvisModeResult, (packet) => {
console.log(packet.invisible);
});InvisModeRequest
A moderator or guide asks to go about unseen, or to be seen again (FacilitatorXtCommManager.sendInvisModeRequest(shouldGoInvisible)):
%xt%o%fi%<room>% go unseen %xt%o%fi%<room>%1%<x>%<y>%<animation>%0% be seen again, standing here
Coming back carries where the avatar stands, so the server can show it to the room in place.
Fields
| Field | Type | |
|---|---|---|
invisible | boolean | Whether the moderator asks to be unseen: the message carries nothing. |
at | { x: number; y: number; animation: number; } | null | Where the avatar stands as it is seen again, with its idle animation; null going unseen. |
extra | string[] | The field after the animation (always 0 from the client), and anything after 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.InvisModeRequest, (packet) => {
console.log(packet.invisible, packet.at, packet.extra);
});ReportRequest
Reports a player (FacilitatorXtCommManager.sendReportAPlayerRequest(userName, reasonId), fr, sent by gui/ReportAPlayer.as once the player confirms). reasonId is one of FacilitatorXtCommManager's RULE_* constants. The client refuses to ask twice about the same player in one sitting, except in an adventure room, where it answers success at once without asking the server at all.
Fields
| Field | Type | |
|---|---|---|
userName | string | The account name reported. |
reasonId | number | Why, one of FacilitatorXtCommManager's RULE_* constants. |
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.ReportRequest, (packet) => {
console.log(packet.userName, packet.reasonId);
});ReportResult
Whether a report was taken (FacilitatorXtCommManager.facilitatorReportAPlayerResponse).
Fields
| Field | Type | |
|---|---|---|
success | boolean | The report was taken: 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.ReportResult, (packet) => {
console.log(packet.success);
});ReportWithDataRequest
Reports a player over something specific they sent: a jam-a-gram, a jammer wall post or a masterpiece (FacilitatorXtCommManager.sendReportWithAdditionalDataRequest(userName, dataType, reasonId, data), fra, sent by gui/ReportAPlayer.as). dataType is 7 for a wall post, 8 for a jam-a-gram or a masterpiece; data names the thing itself, such as a wall post's msgId.
Fields
| Field | Type | |
|---|---|---|
userName | string | The account name reported. |
reasonId | number | Why, one of FacilitatorXtCommManager's RULE_* constants. |
dataType | number | What kind of content this is about: 7 a wall post, 8 a jam-a-gram or a masterpiece. |
data | string | Names the thing itself, such as a wall post's msgId. |
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.ReportWithDataRequest, (packet) => {
console.log(packet.userName, packet.reasonId, packet.dataType);
});ReportWithDataResult
Whether a report with content attached was taken (FacilitatorXtCommManager.facilitatorReportWithAdditionalDataResponse).
Fields
| Field | Type | |
|---|---|---|
success | boolean | The report was taken: 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.ReportWithDataResult, (packet) => {
console.log(packet.success);
});BanRequest
A moderator bans a player (sendBanRequest(userName, duration, reasonId, note)).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player, by username. |
duration | number | How long, as the moderator's tool gave it. The client sends it as a Number and says nothing of its unit; a server reads it the way it decided to. |
reasonId | number | Why, one of FacilitatorXtCommManager's RULE_* constants. |
note | string | The moderator's note. |
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.BanRequest, (packet) => {
console.log(packet.userName, packet.duration, packet.reasonId);
});SilenceRequest
A moderator silences a player's free chat (sendSilenceRequest, laid out as a ban is).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player, by username. |
duration | number | How long, as the moderator's tool gave it. The client sends it as a Number and says nothing of its unit; a server reads it the way it decided to. |
reasonId | number | Why, one of FacilitatorXtCommManager's RULE_* constants. |
note | string | The moderator's note. |
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.SilenceRequest, (packet) => {
console.log(packet.userName, packet.duration, packet.reasonId);
});MuteRequest
A moderator mutes a player (sendMuteRequest(userName, duration, note)), with no reason.
Fields
| Field | Type | |
|---|---|---|
userName | string | The player, by username. |
duration | number | How long, as the moderator's tool gave it (see DisciplineRequestFields.duration). |
note | string | The moderator's note. |
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.MuteRequest, (packet) => {
console.log(packet.userName, packet.duration, packet.note);
});KickRequest
A moderator kicks a player off the server (sendKickRequest(userName, note)).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player, by username. |
note | string | The moderator's note. |
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.KickRequest, (packet) => {
console.log(packet.userName, packet.note);
});BanResult
Whether a ban worked (facilitatorBanResponse): %xt%fb%<room>%<success>%.
Fields
| Field | Type | |
|---|---|---|
success | boolean | It worked: the client compares the field with == 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.BanResult, (packet) => {
console.log(packet.success);
});SilenceResult
Whether a silence worked (facilitatorSilenceResponse).
Fields
| Field | Type | |
|---|---|---|
success | boolean | It worked: the client compares the field with == 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.SilenceResult, (packet) => {
console.log(packet.success);
});MuteResult
Whether a mute worked (facilitatorMuteResponse).
Fields
| Field | Type | |
|---|---|---|
success | boolean | It worked: the client compares the field with == 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.MuteResult, (packet) => {
console.log(packet.success);
});KickResult
Whether a kick worked (facilitatorKickResponse).
Fields
| Field | Type | |
|---|---|---|
success | boolean | It worked: the client compares the field with == 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.KickResult, (packet) => {
console.log(packet.success);
});IdleTimeout
The client gave up waiting for the player (FacilitatorXtCommManager.sendIdleTimeOut, which KeepAlive calls once seven minutes have passed with nothing sent):
%xt%o%ft%<room>%
Nothing comes back. The client expects the server to close the connection, which it then reports as lost.
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.IdleTimeout, (packet) => {
console.log('facilitator.idle-timeout');
});