From 575b5ce55b40ab3c923230299b893909ac0ab59e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Sep 2014 19:49:15 +0300 Subject: Move processPlayerStorageAdd from ea namespace into eathena and tmwa. --- src/net/ea/inventoryhandler.cpp | 32 -------------------------------- src/net/ea/inventoryhandler.h | 2 -- src/net/eathena/inventoryhandler.cpp | 32 ++++++++++++++++++++++++++++++++ src/net/eathena/inventoryhandler.h | 2 ++ src/net/tmwa/inventoryhandler.cpp | 32 ++++++++++++++++++++++++++++++++ src/net/tmwa/inventoryhandler.h | 2 ++ 6 files changed, 68 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 5c4d2796c..488863a0d 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -286,38 +286,6 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg) BLOCK_END("InventoryHandler::processPlayerStorageStatus") } -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") -} - void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg) { BLOCK_START("InventoryHandler::processPlayerStorageRemove") diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index 607ccdc0e..e0bfb6a1f 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -88,8 +88,6 @@ class InventoryHandler notfinal : public Net::InventoryHandler void processPlayerStorageStatus(Net::MessageIn &msg); - void processPlayerStorageAdd(Net::MessageIn &msg); - void processPlayerStorageRemove(Net::MessageIn &msg); void processPlayerStorageClose(Net::MessageIn &msg); diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index bcef71974..a87573980 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -490,4 +490,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 EAthena diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h index 399806a2f..15aaa85f3 100644 --- a/src/net/eathena/inventoryhandler.h +++ b/src/net/eathena/inventoryhandler.h @@ -72,6 +72,8 @@ class InventoryHandler final : public MessageHandler, void processPlayerInventoryRemove2(Net::MessageIn &msg); void processPlayerStorageEquip(Net::MessageIn &msg); + + void processPlayerStorageAdd(Net::MessageIn &msg); }; } // namespace EAthena 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 -- cgit v1.2.3-60-g2f50