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 ++++++++++++++++++++++++++++++++++++ src/net/eathena/inventoryhandler.h | 4 ++++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + 4 files changed, 45 insertions(+), 1 deletion(-) (limited to 'src/net/eathena') 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 diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h index c8c497b06..4af09ed94 100644 --- a/src/net/eathena/inventoryhandler.h +++ b/src/net/eathena/inventoryhandler.h @@ -108,6 +108,10 @@ class InventoryHandler final : public MessageHandler, static void processCartRemove(Net::MessageIn &msg); static void processPlayerCartAdd(Net::MessageIn &msg); + + static void processPlayerCartEquip(Net::MessageIn &msg); + + static Ea::InventoryItems mCartItems; }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index fb6b788e7..416ffe682 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -248,7 +248,7 @@ int16_t packet_lengths[] = 31, 0, 0, 0, 0, 0, 0, 14, 0, 0, -1, 0, 0, 288, 0, 0, // #0x0980 0, 0, 0, 29, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 31, -1, -1, 0, 0, -1, -1, 0, 0, 11, 9, 8, 0, 0, 0, 0, + 31, -1, -1, 0, -1, -1, -1, 0, 0, 11, 9, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 16, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // #0x09C0 diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 5f3b326fc..70588e165 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -73,6 +73,7 @@ #define SMSG_PLAYER_INVENTORY_REMOVE2 0x07fa #define SMSG_PLAYER_INVENTORY_USE 0x01c8 #define SMSG_PLAYER_CART_ADD 0x01c5 +#define SMSG_PLAYER_CART_EQUIP 0x0994 #define SMSG_PLAYER_ITEM_RENTAL_TIME 0x0298 #define SMSG_PLAYER_ITEM_RENTAL_EXPIRED 0x0299 #define SMSG_PLAYER_EQUIPMENT 0x0992 -- cgit v1.2.3-70-g09d2