diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-06 19:49:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-06 19:49:15 +0300 |
commit | 575b5ce55b40ab3c923230299b893909ac0ab59e (patch) | |
tree | d0818a446aaa51054be6131407edf42897b93348 /src/net/tmwa | |
parent | bd194dcc0f06959322253c91761a93d53c468ca0 (diff) | |
download | manaverse-575b5ce55b40ab3c923230299b893909ac0ab59e.tar.gz manaverse-575b5ce55b40ab3c923230299b893909ac0ab59e.tar.bz2 manaverse-575b5ce55b40ab3c923230299b893909ac0ab59e.tar.xz manaverse-575b5ce55b40ab3c923230299b893909ac0ab59e.zip |
Move processPlayerStorageAdd from ea namespace into eathena and tmwa.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 32 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.h | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 062dca7a0..ccf4e6074 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -468,4 +468,36 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) BLOCK_END("InventoryHandler::processPlayerStorageEquip") } +void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) +{ + BLOCK_START("InventoryHandler::processPlayerStorageAdd") + // Move an item into storage + const int index = msg.readInt16() - STORAGE_OFFSET; + const int amount = msg.readInt32(); + const int itemId = msg.readInt16(); + unsigned char identified = msg.readUInt8(); + msg.readUInt8(); // attribute + const uint8_t refine = msg.readUInt8(); + for (int i = 0; i < 4; i++) + msg.readInt16(); // card i + + if (Item *const item = mStorage->getItem(index)) + { + item->setId(itemId, identified); + item->increaseQuantity(amount); + } + else + { + if (mStorage) + { + if (serverVersion < 1 && identified > 1) + identified = 1; + + mStorage->setItem(index, itemId, amount, + refine, identified, false); + } + } + BLOCK_END("InventoryHandler::processPlayerStorageAdd") +} + } // namespace TmwAthena diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index 6eef0c3de..b19e388ac 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -70,6 +70,8 @@ class InventoryHandler final : public MessageHandler, void processPlayerUnEquip(Net::MessageIn &msg); void processPlayerStorageEquip(Net::MessageIn &msg); + + void processPlayerStorageAdd(Net::MessageIn &msg); }; } // namespace TmwAthena |