From 244649455b09a0a0b6de63329197bc2387492bfe Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Jan 2015 18:15:23 +0300 Subject: eathena: add packet SMSG_PLAYER_CART_EQUIP 0x0994. --- src/net/eathena/inventoryhandler.cpp | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/net/eathena/inventoryhandler.cpp') diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index d297bd7bf..dc134e87f 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -67,6 +67,8 @@ const EquipSlot::Type EQUIP_CONVERT[] = namespace EAthena { +Ea::InventoryItems InventoryHandler::mCartItems; + InventoryHandler::InventoryHandler() : MessageHandler(), Ea::InventoryHandler() @@ -97,10 +99,13 @@ InventoryHandler::InventoryHandler() : SMSG_CART_INFO, SMSG_CART_REMOVE, SMSG_PLAYER_CART_ADD, + SMSG_PLAYER_CART_EQUIP, 0 }; handledMessages = _messages; inventoryHandler = this; + + mCartItems.clear(); } InventoryHandler::~InventoryHandler() @@ -207,6 +212,10 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) processPlayerCartAdd(msg); break; + case SMSG_PLAYER_CART_EQUIP: + processPlayerCartEquip(msg); + break; + default: break; } @@ -797,4 +806,34 @@ void InventoryHandler::processPlayerCartAdd(Net::MessageIn &msg) BLOCK_END("InventoryHandler::processPlayerCartAdd") } +void InventoryHandler::processPlayerCartEquip(Net::MessageIn &msg) +{ + BLOCK_START("InventoryHandler::processPlayerCartEquip") + msg.readInt16("len"); + const int number = (msg.getLength() - 4) / 31; + for (int loop = 0; loop < number; loop++) + { + const int index = msg.readInt16("index") - STORAGE_OFFSET; + const int itemId = msg.readInt16("item id"); + const int itemType = msg.readUInt8("item type"); + const int amount = 1; + msg.readInt32("location"); + msg.readInt32("wear state"); + const uint8_t refine = msg.readUInt8("refine level"); + int cards[4]; + for (int f = 0; f < 4; f++) + cards[f] = msg.readInt16("card"); + msg.readInt32("hire expire date"); + msg.readInt16("bind on equip"); + msg.readInt16("sprite"); + ItemFlags flags; + flags.byte = msg.readUInt8("flags"); + + mCartItems.push_back(Ea::InventoryItem(index, itemId, itemType, + cards, amount, refine, 1, flags.bits.isIdentified, + flags.bits.isDamaged, flags.bits.isFavorite, false)); + } + BLOCK_END("InventoryHandler::processPlayerCartEquip") +} + } // namespace EAthena -- cgit v1.2.3-70-g09d2