diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-13 19:42:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-13 19:42:43 +0300 |
commit | fc9391444b92f8334cbf9918e97cc3563dc52997 (patch) | |
tree | 196fb3416963ad38c62ac57ae60fe450237bded4 /src/net/eathena | |
parent | 7e6d1a6e03052a08fd80ad2589295236ba40a3f1 (diff) | |
download | manaverse-fc9391444b92f8334cbf9918e97cc3563dc52997.tar.gz manaverse-fc9391444b92f8334cbf9918e97cc3563dc52997.tar.bz2 manaverse-fc9391444b92f8334cbf9918e97cc3563dc52997.tar.xz manaverse-fc9391444b92f8334cbf9918e97cc3563dc52997.zip |
Move processPlayerStorageRemove from ea namespace into eathena and tmwa.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/inventoryhandler.cpp | 18 | ||||
-rw-r--r-- | src/net/eathena/inventoryhandler.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index ec2ba5b3c..cb4c6051c 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -706,4 +706,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 EAthena diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h index 794f9ca7a..7ab8bb42e 100644 --- a/src/net/eathena/inventoryhandler.h +++ b/src/net/eathena/inventoryhandler.h @@ -100,6 +100,8 @@ class InventoryHandler final : public MessageHandler, static void processPlayerItemRentalTime(Net::MessageIn &msg); static void processPlayerItemRentalExpired(Net::MessageIn &msg); + + static void processPlayerStorageRemove(Net::MessageIn &msg); }; } // namespace EAthena |