diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-24 18:15:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-24 18:15:23 +0300 |
commit | 244649455b09a0a0b6de63329197bc2387492bfe (patch) | |
tree | 586a42e7f0801fbf8dfa85d3356173e27b6330bc /src | |
parent | d5815c17a3008e68fec20192977139209c9a14ca (diff) | |
download | mv-244649455b09a0a0b6de63329197bc2387492bfe.tar.gz mv-244649455b09a0a0b6de63329197bc2387492bfe.tar.bz2 mv-244649455b09a0a0b6de63329197bc2387492bfe.tar.xz mv-244649455b09a0a0b6de63329197bc2387492bfe.zip |
eathena: add packet SMSG_PLAYER_CART_EQUIP 0x0994.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/eathena/inventoryhandler.cpp | 39 | ||||
-rw-r--r-- | src/net/eathena/inventoryhandler.h | 4 | ||||
-rw-r--r-- | src/net/eathena/packets.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 1 |
4 files changed, 45 insertions, 1 deletions
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 |