Adopt a Pet
packets5 packets
Adopt a Pet: the checklist of cards whose codes come printed on real-world toys (adoptAPet.AdoptAPetXtCommManager and AdoptAPetManager in the client).
A card is not a pet. Redeeming its code on the website puts an entry in the player's checklist, which the buddy card's checklist button opens. The player's own cards arrive with their login; these packets ask about another player's, and tell the server which of the player's own have been looked at.
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 |
|---|---|---|---|
AdoptAPetDataRequest | pad | game → server | The client asks for another player’s Adopt a Pet cards. |
AdoptAPetData | pad | server → game | The server lists a player’s Adopt a Pet cards. |
AdoptAPetCountRequest | padc | game → server | The client asks how many Adopt a Pet cards another player has. |
AdoptAPetCount | padc | server → game | The server says how many Adopt a Pet cards a player has. |
AdoptAPetSeenRequest | pads | game → server | The player marks Adopt a Pet cards as seen. |
AdoptAPetDataRequest
Asks for another player's Adopt a Pet cards (AdoptAPetXtCommManager.requestPetAdoptUsableData(userName, callback), sent by gui.jazwares.CheckListPopup when it opens on someone else's buddy card).
Fields
| Field | Type | |
|---|---|---|
userName | string | The player whose cards 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.AdoptAPetDataRequest, (packet) => {
console.log(packet.userName);
});AdoptAPetData
A player's Adopt a Pet cards (AdoptAPetXtCommManager.handlePetAdoptData, which hands the whole message to the checklist's onOtherUserUsableAdoptAPetData):
%xt%pad%<room>%1%<count>%<defId>%<invId>%...%
%xt%pad%<room>%0% is a refusal, which the checklist shows as an error and reads nothing more of.
Fields
| Field | Type | |
|---|---|---|
success | boolean | The server sent the list: the field after the room is not 0. |
cards | AdoptAPetCard[] | Every card the player has, after their count, in the server's order; empty on a refusal. |
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.AdoptAPetData, (packet) => {
console.log(packet.success, packet.cards);
});AdoptAPetCountRequest
Asks how many Adopt a Pet cards another player has (AdoptAPetXtCommManager.requestPetAdoptUsableCount(userName, callback), sent by buddy.BuddyCard, which shows its checklist button only when the answer is above 0).
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.AdoptAPetCountRequest, (packet) => {
console.log(packet.userName);
});AdoptAPetCount
How many Adopt a Pet cards a player has (AdoptAPetXtCommManager.handlePetAdoptDataCount):
%xt%padc%<room>%<count>%
Fields
| Field | Type | |
|---|---|---|
count | number | How many cards the player has; the buddy card hides its checklist button at 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.AdoptAPetCount, (packet) => {
console.log(packet.count);
});AdoptAPetSeenRequest
Tells the server which of the player's own Adopt a Pet cards have now been seen (AdoptAPetXtCommManager.requestPetAdoptUsableSeenSet(defIds), sent by gui.jazwares.CheckListPopup as it closes):
%xt%o%pads%<room>%<defId>%<defId>%...%
The def ids follow one after another with no count before them. Nothing answers it.
Fields
| Field | Type | |
|---|---|---|
defIds | number[] | The cards now seen, by def id; every field after the room. |
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.AdoptAPetSeenRequest, (packet) => {
console.log(packet.defIds);
});