49 namespace InventoryRecv
80 BLOCK_START(
"InventoryRecv::processPlayerEquipment")
86 if ((equipment !=
nullptr) && (equipment->
getBackend() ==
nullptr))
91 const int number = (
msg.getLength() - 4) / 20;
93 for (
int loop = 0; loop < number; loop++)
96 const int itemId =
msg.readInt16(
"item id");
98 msg.readUInt8(
"item type"));
99 const uint8_t identified =
msg.readUInt8(
"identify");
100 msg.readInt16(
"equip type?");
101 const int equipType =
msg.readInt16(
"equip type");
102 msg.readUInt8(
"attribute");
103 const uint8_t refine =
msg.readUInt8(
"refine");
106 cards[f] =
msg.readUInt16(
"card");
110 logger->
log(
"Index: %d, ID: %d, Type: %d, Identified: %d",
111 index, itemId,
CAST_S32(itemType), identified);
114 if (inventory !=
nullptr)
137 BLOCK_END(
"InventoryRecv::processPlayerEquipment")
142 BLOCK_START(
"InventoryRecv::processPlayerInventoryAdd")
153 int amount =
msg.readInt16(
"amount");
154 const int itemId =
msg.readInt16(
"item id");
155 const uint8_t identified =
msg.readUInt8(
"identified");
156 msg.readUInt8(
"attribute");
157 const uint8_t refine =
msg.readUInt8(
"refine");
160 cards[f] =
msg.readUInt16(
"card");
161 const int equipType =
msg.readInt16(
"equip type");
163 const unsigned char err =
msg.readUInt8(
"status");
245 if (inventory !=
nullptr)
247 const Item *
const item = inventory->
getItem(index);
249 if ((item !=
nullptr) && item->
getId() == itemId)
267 BLOCK_END(
"InventoryRecv::processPlayerInventoryAdd")
272 BLOCK_START(
"InventoryRecv::processPlayerInventory")
283 if (inventory !=
nullptr)
286 msg.readInt16(
"len");
287 const int number = (
msg.getLength() - 4) / 18;
289 for (
int loop = 0; loop < number; loop++)
293 const int itemId =
msg.readInt16(
"item id");
295 msg.readUInt8(
"item type"));
296 const uint8_t identified =
msg.readUInt8(
"identified");
297 const int amount =
msg.readInt16(
"amount");
298 const int arrow =
msg.readInt16(
"arrow");
300 cards[i] =
msg.readUInt16(
"card");
304 logger->
log(
"Index: %d, ID: %d, Type: %d, Identified: %d, "
305 "Qty: %d, Cards: %d, %d, %d, %d",
306 index, itemId,
CAST_S32(itemType), identified, amount,
307 cards[0], cards[1], cards[2], cards[3]);
311 const bool isEquipment = (arrow & 0x8000) != 0;
313 if (inventory !=
nullptr)
329 BLOCK_END(
"InventoryRecv::processPlayerInventory")
334 BLOCK_START(
"InventoryRecv::processPlayerInventory")
337 msg.readInt16(
"len");
338 const int number = (
msg.getLength() - 4) / 18;
340 for (
int loop = 0; loop < number; loop++)
344 const int itemId =
msg.readInt16(
"item id");
346 msg.readUInt8(
"item type"));
347 const uint8_t identified =
msg.readUInt8(
"identified");
348 const int amount =
msg.readInt16(
"amount");
349 msg.readInt16(
"arrow");
351 cards[i] =
msg.readUInt16(
"card");
355 logger->
log(
"Index: %d, ID: %d, Type: %d, Identified: %d, "
356 "Qty: %d, Cards: %d, %d, %d, %d",
357 index, itemId,
CAST_S32(itemType), identified, amount,
358 cards[0], cards[1], cards[2], cards[3]);
376 BLOCK_END(
"InventoryRecv::processPlayerInventory")
383 const int equipType =
msg.readInt16(
"equip type");
384 const uint8_t flag =
msg.readUInt8(
"flag");
396 BLOCK_END(
"InventoryRecv::processPlayerEquip")
402 msg.readInt16(
"index");
403 const int equipType =
msg.readInt16(
"equip type");
404 const uint8_t flag =
msg.readUInt8(
"flag");
412 if ((equipType & 0x8000) != 0)
414 BLOCK_END(
"InventoryRecv::processPlayerUnEquip")
419 BLOCK_START(
"InventoryRecv::processPlayerStorageEquip")
420 msg.readInt16(
"len");
421 const int number = (
msg.getLength() - 4) / 20;
423 for (
int loop = 0; loop < number; loop++)
427 const int itemId =
msg.readInt16(
"item id");
429 msg.readUInt8(
"item type"));
430 const uint8_t identified =
msg.readUInt8(
"identified");
431 const int amount = 1;
432 msg.readInt16(
"equip point?");
433 msg.readInt16(
"another equip point?");
434 msg.readUInt8(
"attribute (broken)");
435 const uint8_t refine =
msg.readUInt8(
"refine");
437 cards[i] =
msg.readUInt16(
"card");
441 logger->
log(
"Index: %d, ID: %d, Type: %d, Identified: %u, "
442 "Qty: %d, Cards: %d, %d, %d, %d, Refine: %u",
445 cards[0], cards[1], cards[2], cards[3],
464 BLOCK_END(
"InventoryRecv::processPlayerStorageEquip")
469 BLOCK_START(
"InventoryRecv::processPlayerStorageAdd")
472 const int amount =
msg.readInt32(
"amount");
473 const int itemId =
msg.readInt16(
"item id");
474 const unsigned char identified =
msg.readUInt8(
"identified");
475 msg.readUInt8(
"attribute");
476 const uint8_t refine =
msg.readUInt8(
"refine");
479 cards[f] =
msg.readUInt16(
"card");
484 item->increaseQuantity(amount);
504 BLOCK_END(
"InventoryRecv::processPlayerStorageAdd")
509 BLOCK_START(
"InventoryRecv::processPlayerStorageRemove")
512 const int amount =
msg.readInt32(
"amount");
517 item->increaseQuantity(-amount);
518 if (item->getQuantity() == 0)
522 BLOCK_END(
"InventoryRecv::processPlayerStorageRemove")
527 BLOCK_START(
"InventoryRecv::processPlayerInventoryRemove")
532 const int amount =
msg.readInt16(
"amount");
533 if (inventory !=
nullptr)
537 item->increaseQuantity(-amount);
538 if (item->getQuantity() == 0)
543 BLOCK_END(
"InventoryRecv::processPlayerInventoryRemove")
548 if (eAthenaSlot == 0)
551 if ((eAthenaSlot & 0x8000) != 0)
554 unsigned int mask = 1;
556 while ((eAthenaSlot & mask) == 0U)
568 BLOCK_START(
"InventoryRecv::processPlayerInventoryUse")
573 msg.readItemId(
"item id");
574 msg.readInt32(
"id?");
575 const int amount =
msg.readInt16(
"amount");
576 msg.readUInt8(
"type");
578 if (inventory !=
nullptr)
583 item->setQuantity(amount);
588 BLOCK_END(
"InventoryRecv::processPlayerInventoryUse")
const BeingId BeingId_zero
#define fromBool(val, name)
static void distributeEvent()
void setEquipment(const int index, const int inventoryIndex)
const Backend * getBackend() const
void setBackend(Backend *const backend)
void setCards(const int index, const int *const cards, const int size) const
void removeItemAt(const int index)
Item * getItem(const int index) const
virtual void setItem(const int index, const int id, const ItemTypeT type, const int quantity, const uint8_t refine, const ItemColor color, const Identified identified, const Damaged damaged, const Favorite favorite, const Equipm equipment, const Equipped equipped)
void pickedUp(const ItemInfo &itemInfo, const int amount, const ItemColor color, const BeingId floorItemId, const PickupT fail)
void log(const char *const log_text,...)
virtual int getProjectileSlot() const =0
static const int STORAGE_OFFSET
static const int INVENTORY_OFFSET
const bool Equipped_false
const bool Favorite_false
Net::InventoryHandler * inventoryHandler
const ItemColor ItemColor_one
LocalPlayer * localPlayer
#define UNIMPLEMENTEDPACKETFIELD(field)
bool msg(InputEvent &event)
bool pickup(InputEvent &event)
InventoryItems mStorageItems
const ItemInfo & getEmpty()
const ItemInfo & get(const int id)
void notify(const unsigned int message)
Inventory * getInventory()
Equipment * getEquipment()
void processPlayerStorageAdd(Net::MessageIn &msg)
int getSlot(const int eAthenaSlot)
void processPlayerInventoryUse(Net::MessageIn &msg)
void processPlayerStorage(Net::MessageIn &msg)
void processPlayerStorageEquip(Net::MessageIn &msg)
void processPlayerUnEquip(Net::MessageIn &msg)
const EquipSlot::Type EQUIP_POINTS[EquipSlot::VECTOREND]
void processPlayerStorageRemove(Net::MessageIn &msg)
void processPlayerEquip(Net::MessageIn &msg)
void processPlayerEquipment(Net::MessageIn &msg)
void processPlayerInventoryAdd(Net::MessageIn &msg)
void processPlayerInventory(Net::MessageIn &msg)
void processPlayerInventoryRemove(Net::MessageIn &msg)
#define BLOCK_START(name)