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/net/eathena/inventoryhandler.cpp | |
parent | d5815c17a3008e68fec20192977139209c9a14ca (diff) | |
download | plus-244649455b09a0a0b6de63329197bc2387492bfe.tar.gz plus-244649455b09a0a0b6de63329197bc2387492bfe.tar.bz2 plus-244649455b09a0a0b6de63329197bc2387492bfe.tar.xz plus-244649455b09a0a0b6de63329197bc2387492bfe.zip |
eathena: add packet SMSG_PLAYER_CART_EQUIP 0x0994.
Diffstat (limited to 'src/net/eathena/inventoryhandler.cpp')
-rw-r--r-- | src/net/eathena/inventoryhandler.cpp | 39 |
1 files changed, 39 insertions, 0 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 |