Buy Inventory

From Club Penguin Protocol
Jump to: navigation, search
Buy Inventory
Handler i
Name ai

This packet is sent by the client to the server requesting an item be added to their inventory. In response, the server can either deny the client the item because it doesn’t exist, the client doesn’t have enough coins, the client is not a member and the item they requested was for members only, or the item requested is patched.

The requested item’s id will always be the second-to-last section of the packet, and the item’s cost will be the last. In the following example(s), the item’s id is 413, and costs 0 coins.

If the client meets all the requirements to purchase the item, the server will send back the ‘buy inventory’ packet, this time it has the item’s cost, and still contains the item’s id. The item’s id is sent back to the client to let them know which item they have successfully purchased, so they can look up information (i.e name, sprite file) of the item via crumbs. The item’s cost is sent back so the client will know how many coins to deduct from the interface.

Examples

Client side %xt%s%i#ai%1%413%
Server side %xt%ai%1%413%0%


Variables

Variable Type Used In? Example Description
internal_room_id integer Both 1 See Internal Room ID.
item_id integer Both 413 All item ids can be found in paper_items.json
cost integer Response 0 The amount of coins deducted from the penguin.

Possible Errors

ID Description
402 Item not available
400 Already purchased
401 Not enough coins
805 Item with this ID doesn’t exist / membership required

See also