From 5b3354c4a84ff2c4223ec4a2f5b97685d777d615 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Jan 2015 19:06:48 +0300 Subject: eathena: add packet SMSG_PLAYER_CART_ITEMS 0x0993. --- src/net/eathena/inventoryhandler.cpp | 34 ++++++++++++++++++++++++++++++++++ src/net/eathena/inventoryhandler.h | 2 ++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + 4 files changed, 38 insertions(+), 1 deletion(-) (limited to 'src/net') diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index f29638829..edba33ce9 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -100,6 +100,7 @@ InventoryHandler::InventoryHandler() : SMSG_CART_REMOVE, SMSG_PLAYER_CART_ADD, SMSG_PLAYER_CART_EQUIP, + SMSG_PLAYER_CART_ITEMS, 0 }; handledMessages = _messages; @@ -216,6 +217,10 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) processPlayerCartEquip(msg); break; + case SMSG_PLAYER_CART_ITEMS: + processPlayerCartItems(msg); + break; + default: break; } @@ -860,4 +865,33 @@ void InventoryHandler::processPlayerCartEquip(Net::MessageIn &msg) BLOCK_END("InventoryHandler::processPlayerCartEquip") } +void InventoryHandler::processPlayerCartItems(Net::MessageIn &msg) +{ + BLOCK_START("InventoryHandler::processPlayerCartItems") + mInventoryItems.clear(); + + msg.readInt16("len"); + const int number = (msg.getLength() - 4) / 23; + + for (int loop = 0; loop < number; loop++) + { + const int index = msg.readInt16("item index") - STORAGE_OFFSET; + const int itemId = msg.readInt16("item id"); + const int itemType = msg.readUInt8("item type"); + const int amount = msg.readInt16("count"); + msg.readInt32("wear state / equip"); + int cards[4]; + for (int f = 0; f < 4; f++) + cards[f] = msg.readInt16("card"); + msg.readInt32("hire expire date (?)"); + ItemFlags flags; + flags.byte = msg.readUInt8("flags"); + + mCartItems.push_back(Ea::InventoryItem(index, itemId, itemType, + cards, amount, 0, 1, flags.bits.isIdentified, + flags.bits.isDamaged, flags.bits.isFavorite, false)); + } + BLOCK_END("InventoryHandler::processPlayerCartItems") +} + } // namespace EAthena diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h index 4af09ed94..50d5e68b2 100644 --- a/src/net/eathena/inventoryhandler.h +++ b/src/net/eathena/inventoryhandler.h @@ -111,6 +111,8 @@ class InventoryHandler final : public MessageHandler, static void processPlayerCartEquip(Net::MessageIn &msg); + static void processPlayerCartItems(Net::MessageIn &msg); + static Ea::InventoryItems mCartItems; }; diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 416ffe682..1f5e6211d 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, -1, -1, -1, 0, 0, 11, 9, 8, 0, 0, 0, 0, + 31, -1, -1, -1, -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 70588e165..4d9b07601 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_ITEMS 0x0993 #define SMSG_PLAYER_CART_EQUIP 0x0994 #define SMSG_PLAYER_ITEM_RENTAL_TIME 0x0298 #define SMSG_PLAYER_ITEM_RENTAL_EXPIRED 0x0299 -- cgit v1.2.3-60-g2f50