Jam-a-grams
packets17 packets
Jam-a-grams (ecard.ECardXtCommManager): cards players send each other, which may carry a gift. The client calls them e-cards.
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 |
|---|---|---|---|
JamAGramListRequest | el | game → server | The player asks for their jam-a-grams. |
JamAGramList | el | server → game | The server sends the player’s jam-a-grams. |
JamAGramReceived | ep | server → game | The player receives a jam-a-gram. |
JamAGramSend | es | game → server | The player sends a jam-a-gram. |
JamAGramSendResult | es | server → game | The server says whether a jam-a-gram was sent. |
JamAGramRead | er | game → server | The player opens a jam-a-gram. |
JamAGramReadResult | er | server → game | The server says whether a jam-a-gram was marked read. |
JamAGramDelete | ed | game → server | The player deletes a jam-a-gram. |
JamAGramDeleteResult | ed | server → game | The server says which jam-a-grams were deleted. |
JamAGramGift | eg | game → server | The player accepts or discards a jam-a-gram’s gift. |
JamAGramGiftResult | eg | server → game | The server says whether a jam-a-gram’s gift was accepted or discarded. |
JamAGramUpdate | eu | server → game | The server changes a jam-a-gram’s message. |
JamAGramPrivacy | ei | game → server | The player changes who may send them jam-a-grams. |
JamAGramPrivacyResult | ei | server → game | The server says whether the jam-a-gram privacy setting changed. |
JamAGramBuddyAnswer | eb | game → server | The player accepts or declines the buddy request a jam-a-gram carries. |
JamAGramBuddyAnswerResult | eb | server → game | The server answers the player’s reply to a jam-a-gram’s buddy request. |
JamAGramClearCache | ec | game → server | The player asks the server to drop its cached jam-a-gram inbox. |
JamAGramListRequest
Asks for the player's jam-a-grams (sendECardListRequest). interactive is set when the client waits on the answer, as opening the inbox does.
Fields
| Field | Type | |
|---|---|---|
interactive | boolean | The client waits on the answer, as opening the inbox does. |
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.JamAGramListRequest, (packet) => {
console.log(packet.interactive);
});JamAGramList
The player's jam-a-grams (eCardListResponse): a count, -1 for none, then each card. The client shows them in the reverse of the order they are sent.
Fields
| Field | Type | |
|---|---|---|
cards | JamAGram[] | The jam-a-grams, after their count; empty when the count is -1 (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.JamAGramList, (packet) => {
console.log(packet.cards);
});JamAGramReceived
A jam-a-gram arrives while the player is online (eCardPushHandler): one card.
Fields
| Field | Type | |
|---|---|---|
card | JamAGram | The jam-a-gram received. |
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.JamAGramReceived, (packet) => {
console.log(packet.card);
});JamAGramSend
Sends a jam-a-gram (sendECardSendRequest, from ECardCreation.sendECard). messageType is ECard.MESSAGE_TYPE_BUBBLECHAT (1) or MESSAGE_TYPE_LIMITEDCHAT (2); giftInvIdx is the gift's place in the player's inventory, or -1 for none.
Fields
| Field | Type | |
|---|---|---|
userName | string | Who to send it to, by username. |
cardMediaId | number | The card's media id. |
stampMediaId | number | The stamp's media id. |
messageType | number | How the message was written: 1 MESSAGE_TYPE_BUBBLECHAT, 2 MESSAGE_TYPE_LIMITEDCHAT. |
message | string | What it says: typed text, or a predefined phrase's code such as 12,3. |
type | number | What it carries (ECard.TYPE_...): 0 nothing, 1 clothing, 2 a buddy request, 4 gems... |
giftInvIdx | number | The gift's place in the player's inventory, or -1 for none. |
specialType | number | 1 for a valentine, otherwise 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.JamAGramSend, (packet) => {
console.log(packet.userName, packet.cardMediaId, packet.stampMediaId);
});JamAGramSendResult
Whether a jam-a-gram was sent (eCardSendResponse, ECardCreation.onSentResponseCallback): 1 and above is sent; below 1 it failed: -1 "this Jammer's inbox is full" (24507), -2 "<name> is not accepting Jam-A-Grams right now" (25038), anything else "Jam-A-Grams cannot be sent to that user" (14717).
Fields
| Field | Type | |
|---|---|---|
result | number | 1 and above is sent; below 1 it failed, and -2 names the receiver in the message shown. |
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.JamAGramSendResult, (packet) => {
console.log(packet.result);
});JamAGramRead
Marks a jam-a-gram read (sendECardReadRequest).
Fields
| Field | Type | |
|---|---|---|
messageId | number | The jam-a-gram to mark read, by 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.JamAGramRead, (packet) => {
console.log(packet.messageId);
});JamAGramReadResult
Whether a jam-a-gram was marked read (eCardReadResponse).
Fields
| Field | Type | |
|---|---|---|
messageId | number | The jam-a-gram, by id. |
success | boolean | It was marked read: 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.JamAGramReadResult, (packet) => {
console.log(packet.messageId, packet.success);
});JamAGramDelete
Deletes a jam-a-gram (sendECardDeleteRequest).
Fields
| Field | Type | |
|---|---|---|
messageId | number | The jam-a-gram to delete, by 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.JamAGramDelete, (packet) => {
console.log(packet.messageId);
});JamAGramDeleteResult
What was deleted (eCardDeleteResponse): whether it worked, then a count and the ids.
Fields
| Field | Type | |
|---|---|---|
success | boolean | The delete worked: the field is 1. |
messageIds | number[] | The ids of the jam-a-grams deleted, after their count. |
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.JamAGramDeleteResult, (packet) => {
console.log(packet.success, packet.messageIds);
});JamAGramGift
Accepts or discards a jam-a-gram's gift (sendECardAcceptDiscardGiftRequest). The client adds a third value only when its caller passes one; null when there is none.
Fields
| Field | Type | |
|---|---|---|
messageId | number | The jam-a-gram whose gift it is, by id. |
accept | boolean | True accepts the gift, false discards it. |
option | number | null | A third value the client adds only when its caller passes one; null when there is none. What it means is unknown. |
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.JamAGramGift, (packet) => {
console.log(packet.messageId, packet.accept, packet.option);
});JamAGramGiftResult
Whether a gift was taken (eCardGiftResponse).
Fields
| Field | Type | |
|---|---|---|
messageId | number | The jam-a-gram whose gift it was, by id. |
success | boolean | The gift was accepted or discarded as asked: 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.JamAGramGiftResult, (packet) => {
console.log(packet.messageId, packet.success);
});JamAGramUpdate
A jam-a-gram's message changed (eCardUpdateHandler, ECardManager.processECardUpdate).
Fields
| Field | Type | |
|---|---|---|
messageId | number | The jam-a-gram that changed, by id. |
message | string | Its new message. |
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.JamAGramUpdate, (packet) => {
console.log(packet.messageId, packet.message);
});JamAGramPrivacy
Changes who may send the player jam-a-grams (sendECardPrivacySettingUpdateRequest).
Fields
| Field | Type | |
|---|---|---|
setting | number | Who may send the player jam-a-grams, as the login reply's eCardPrivacySettings holds it (JamAGramPrivacySetting: 0 no one, 1 buddies, 2 everyone). |
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.JamAGramPrivacy, (packet) => {
console.log(packet.setting);
});JamAGramPrivacyResult
Whether the privacy setting changed (eCardIsolationHandler).
Fields
| Field | Type | |
|---|---|---|
success | boolean | The setting changed: 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.JamAGramPrivacyResult, (packet) => {
console.log(packet.success);
});JamAGramBuddyAnswer
Answers the buddy request a jam-a-gram carries (sendECardBuddyRequest), as the inbox's accept and reject buttons do (ECardInbox.onAcceptBtn, onRejectBtn). The client drops the card from its own inbox straight after, without waiting for an answer.
Fields
| Field | Type | |
|---|---|---|
messageId | number | The jam-a-gram carrying the buddy request (type 2), by id. |
accept | boolean | True accepts the sender as a buddy, false declines 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.JamAGramBuddyAnswer, (packet) => {
console.log(packet.messageId, packet.accept);
});JamAGramBuddyAnswerResult
The server's answer to a jam-a-gram's buddy request (eCardBuddyResponse). The client looks only for -1, which it answers with a popup saying the buddy could not be added (translation 14692). The answer names no card, so it can only be matched to the request by its order.
Fields
| Field | Type | |
|---|---|---|
result | number | -1 when the buddy could not be added; the client does nothing with any other value. |
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.JamAGramBuddyAnswerResult, (packet) => {
console.log(packet.result);
});JamAGramClearCache
Tells the server to drop the inbox it has cached for the player (sendECardClearCache), which the client sends as the inbox closes when a card was deleted while it was open (ECardInbox.destroy). It carries nothing, and nothing answers it.
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.JamAGramClearCache, (packet) => {
console.log('ecard.clear-cache');
});