diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-24 17:41:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-24 17:41:19 +0300 |
commit | d5815c17a3008e68fec20192977139209c9a14ca (patch) | |
tree | 510a0d5ff078fae386c397ef0055d0391d566b61 /src/net/eathena | |
parent | 7dc4dea6109eb8592db5bfc2ab81a6b59fdd83f7 (diff) | |
download | plus-d5815c17a3008e68fec20192977139209c9a14ca.tar.gz plus-d5815c17a3008e68fec20192977139209c9a14ca.tar.bz2 plus-d5815c17a3008e68fec20192977139209c9a14ca.tar.xz plus-d5815c17a3008e68fec20192977139209c9a14ca.zip |
eathena: add packet SMSG_PLAYER_CART_ADD 0x01c5.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/inventoryhandler.cpp | 48 | ||||
-rw-r--r-- | src/net/eathena/inventoryhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 1 |
3 files changed, 51 insertions, 0 deletions
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index d8001b74f..d297bd7bf 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -96,6 +96,7 @@ InventoryHandler::InventoryHandler() : SMSG_PLAYER_ITEM_RENTAL_EXPIRED, SMSG_CART_INFO, SMSG_CART_REMOVE, + SMSG_PLAYER_CART_ADD, 0 }; handledMessages = _messages; @@ -202,6 +203,10 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) processCartRemove(msg); break; + case SMSG_PLAYER_CART_ADD: + processPlayerCartAdd(msg); + break; + default: break; } @@ -749,4 +754,47 @@ void InventoryHandler::processCartRemove(Net::MessageIn &msg A_UNUSED) //+++ need close or clear cart? } +void InventoryHandler::processPlayerCartAdd(Net::MessageIn &msg) +{ + BLOCK_START("InventoryHandler::processPlayerCartAdd") + Inventory *const inventory = localPlayer + ? PlayerInfo::getCartInventory() : nullptr; + + const int index = msg.readInt16("index") - INVENTORY_OFFSET; + int amount = msg.readInt32("count"); + const int itemId = msg.readInt16("item id"); + const int itemType = msg.readUInt8("item type"); + uint8_t identified = msg.readUInt8("identified"); + msg.readUInt8("attribute"); + const uint8_t refine = msg.readUInt8("refine"); + int cards[4]; + for (int f = 0; f < 4; f++) + cards[f] = msg.readInt16("card"); + + const ItemInfo &itemInfo = ItemDB::get(itemId); + int floorId; + if (mSentPickups.empty()) + { + floorId = 0; + } + else + { + floorId = mSentPickups.front(); + mSentPickups.pop(); + } + + if (inventory) + { + const Item *const item = inventory->getItem(index); + + if (item && item->getId() == itemId) + amount += item->getQuantity(); + + inventory->setItem(index, itemId, itemType, amount, refine, + 1, identified != 0, false, false, false, false); + inventory->setCards(index, cards, 4); + } + BLOCK_END("InventoryHandler::processPlayerCartAdd") +} + } // namespace EAthena diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h index 740b9c0c4..c8c497b06 100644 --- a/src/net/eathena/inventoryhandler.h +++ b/src/net/eathena/inventoryhandler.h @@ -106,6 +106,8 @@ class InventoryHandler final : public MessageHandler, static void processCartInfo(Net::MessageIn &msg); static void processCartRemove(Net::MessageIn &msg); + + static void processPlayerCartAdd(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 29743c4c2..5f3b326fc 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -72,6 +72,7 @@ #define SMSG_PLAYER_INVENTORY_REMOVE 0x00af #define SMSG_PLAYER_INVENTORY_REMOVE2 0x07fa #define SMSG_PLAYER_INVENTORY_USE 0x01c8 +#define SMSG_PLAYER_CART_ADD 0x01c5 #define SMSG_PLAYER_ITEM_RENTAL_TIME 0x0298 #define SMSG_PLAYER_ITEM_RENTAL_EXPIRED 0x0299 #define SMSG_PLAYER_EQUIPMENT 0x0992 |