World items
packets2 packets
World items (WorldItems.WorldItemsXtCommManager and WorldItemsManager): the gift objects placed around Jamaa's rooms, each clicked once, ever, for what it holds. Their defs come from def pack 1064, and whether the account has taken each one is a bit of user var 439, which the server sets as it hands the gift over.
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 |
|---|---|---|---|
WorldItemGiftRequest | wig | game → server | The player takes a world item’s gift. |
WorldItemGiftResult | wig | server → game | The server says whether a world item’s gift was given. |
WorldItemGiftRequest
Takes a world item's gift (WorldItemsXtCommManager.sendAcceptGift, from WorldItemsManager.onKeepGift once the player keeps what the popup offers):
%xt%o%wig%<room>%<defId>%<version>%<colorIndex>%
version is the den item's own version for a den item gift and colorIndex the colour the client picked at random for a clothing gift; both are 0 otherwise.
Fields
| Field | Type | |
|---|---|---|
defId | number | The world item, by its def id (WorldItemDef.defId). |
version | number | The den item's version, for a den item gift; 0 otherwise. |
colorIndex | number | Which of the item's colours, for a clothing gift; 0 otherwise. |
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.WorldItemGiftRequest, (packet) => {
console.log(packet.defId, packet.version, packet.colorIndex);
});WorldItemGiftResult
Whether the gift was given (WorldItemsXtCommManager.handleXtReply, then WorldItemsManager.onGiftResponse(status, currency)):
%xt%wig%<room>%<ok>%<balance>%
For a gems or diamonds gift, balance is the new balance of that currency, which the client sets; below 0 when there is none to set. A refusal shows the client's "something went wrong" popup (string 28159), which is also the answer for a gift already taken.
Fields
| Field | Type | |
|---|---|---|
ok | boolean | Whether the gift was given: 1. |
balance | number | The new gems or diamonds balance for a currency gift; below 0 when there is none, and -1 when the answer carries none. |
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.WorldItemGiftResult, (packet) => {
console.log(packet.ok, packet.balance, packet.extra);
});