diff options
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 18 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 5f89e3ebc..545c00b71 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -637,4 +637,22 @@ int InventoryHandler::convertFromServerSlot(const int serverSlot) const return static_cast<int>(EQUIP_CONVERT[serverSlot]); } +void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg) +{ + BLOCK_START("InventoryHandler::processPlayerStorageRemove") + // Move an item out of storage + const int index = msg.readInt16("index") - STORAGE_OFFSET; + const int amount = msg.readInt16("amount"); + if (mStorage) + { + if (Item *const item = mStorage->getItem(index)) + { + item->increaseQuantity(-amount); + if (item->getQuantity() == 0) + mStorage->removeItemAt(index); + } + } + BLOCK_END("InventoryHandler::processPlayerStorageRemove") +} + } // namespace TmwAthena diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index d8caf7a84..5b3a48172 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -90,6 +90,8 @@ class InventoryHandler final : public MessageHandler, static void processPlayerStorageEquip(Net::MessageIn &msg); static void processPlayerStorageAdd(Net::MessageIn &msg); + + static void processPlayerStorageRemove(Net::MessageIn &msg); }; } // namespace TmwAthena |