From 0d990d032d98ea26da479b6378087d0d7dd2a91e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Sep 2014 19:22:29 +0300 Subject: Move processPlayerStorageEquip from ea namespace into eathena and tmwa. --- src/net/ea/inventoryhandler.cpp | 40 ------------------------------------ src/net/ea/inventoryhandler.h | 2 -- src/net/eathena/inventoryhandler.cpp | 40 ++++++++++++++++++++++++++++++++++++ src/net/eathena/inventoryhandler.h | 2 ++ src/net/tmwa/inventoryhandler.cpp | 40 ++++++++++++++++++++++++++++++++++++ src/net/tmwa/inventoryhandler.h | 2 ++ 6 files changed, 84 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 2accd70b5..5c4d2796c 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -182,46 +182,6 @@ int InventoryHandler::getSlot(const int eAthenaSlot) return static_cast(EQUIP_POINTS[position]); } -void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) -{ - BLOCK_START("InventoryHandler::processPlayerStorageEquip") - msg.readInt16(); // length - const int number = (msg.getLength() - 4) / 20; - - for (int loop = 0; loop < number; loop++) - { - int cards[4]; - const int index = msg.readInt16() - STORAGE_OFFSET; - const int itemId = msg.readInt16(); - const uint8_t itemType = msg.readUInt8(); - uint8_t identified = msg.readUInt8(); - const int amount = 1; - msg.readInt16(); // Equip Point? - msg.readInt16(); // Another Equip Point? - msg.readUInt8(); // Attribute (broken) - const uint8_t refine = msg.readUInt8(); - for (int i = 0; i < 4; i++) - cards[i] = msg.readInt16(); - - if (mDebugInventory) - { - logger->log("Index: %d, ID: %d, Type: %d, Identified: %u, " - "Qty: %d, Cards: %d, %d, %d, %d, Refine: %u", - index, itemId, itemType, - static_cast(identified), amount, - cards[0], cards[1], cards[2], cards[3], - static_cast(refine)); - } - - if (serverVersion < 1 && identified > 1U) - identified = 1U; - - mInventoryItems.push_back(Ea::InventoryItem(index, - itemId, amount, refine, identified, false)); - } - BLOCK_END("InventoryHandler::processPlayerStorageEquip") -} - void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg) { BLOCK_START("InventoryHandler::processPlayerInventoryRemove") diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index 0ba52e564..607ccdc0e 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -80,8 +80,6 @@ class InventoryHandler notfinal : public Net::InventoryHandler static int getSlot(const int eAthenaSlot) A_WARN_UNUSED; - void processPlayerStorageEquip(Net::MessageIn &msg); - static void processPlayerInventoryRemove(Net::MessageIn &msg); static void processPlayerInventoryUse(Net::MessageIn &msg); diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index fa6379caa..63cf388c9 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -457,4 +457,44 @@ void InventoryHandler::processPlayerInventoryRemove2(Net::MessageIn &msg) BLOCK_END("InventoryHandler::processPlayerInventoryRemove2") } +void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) +{ + BLOCK_START("InventoryHandler::processPlayerStorageEquip") + msg.readInt16(); // length + const int number = (msg.getLength() - 4) / 20; + + for (int loop = 0; loop < number; loop++) + { + int cards[4]; + const int index = msg.readInt16() - STORAGE_OFFSET; + const int itemId = msg.readInt16(); + const uint8_t itemType = msg.readUInt8(); + uint8_t identified = msg.readUInt8(); + const int amount = 1; + msg.readInt16(); // Equip Point? + msg.readInt16(); // Another Equip Point? + msg.readUInt8(); // Attribute (broken) + const uint8_t refine = msg.readUInt8(); + for (int i = 0; i < 4; i++) + cards[i] = msg.readInt16(); + + if (mDebugInventory) + { + logger->log("Index: %d, ID: %d, Type: %d, Identified: %u, " + "Qty: %d, Cards: %d, %d, %d, %d, Refine: %u", + index, itemId, itemType, + static_cast(identified), amount, + cards[0], cards[1], cards[2], cards[3], + static_cast(refine)); + } + + if (serverVersion < 1 && identified > 1U) + identified = 1U; + + mInventoryItems.push_back(Ea::InventoryItem(index, + itemId, amount, refine, identified, false)); + } + BLOCK_END("InventoryHandler::processPlayerStorageEquip") +} + } // namespace EAthena diff --git a/src/net/eathena/inventoryhandler.h b/src/net/eathena/inventoryhandler.h index 652a864de..399806a2f 100644 --- a/src/net/eathena/inventoryhandler.h +++ b/src/net/eathena/inventoryhandler.h @@ -70,6 +70,8 @@ class InventoryHandler final : public MessageHandler, void processPlayerUnEquip(Net::MessageIn &msg); void processPlayerInventoryRemove2(Net::MessageIn &msg); + + void processPlayerStorageEquip(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 3feccd1fa..062dca7a0 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -428,4 +428,44 @@ void InventoryHandler::processPlayerUnEquip(Net::MessageIn &msg) BLOCK_END("InventoryHandler::processPlayerUnEquip") } +void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) +{ + BLOCK_START("InventoryHandler::processPlayerStorageEquip") + msg.readInt16(); // length + const int number = (msg.getLength() - 4) / 20; + + for (int loop = 0; loop < number; loop++) + { + int cards[4]; + const int index = msg.readInt16() - STORAGE_OFFSET; + const int itemId = msg.readInt16(); + const uint8_t itemType = msg.readUInt8(); + uint8_t identified = msg.readUInt8(); + const int amount = 1; + msg.readInt16(); // Equip Point? + msg.readInt16(); // Another Equip Point? + msg.readUInt8(); // Attribute (broken) + const uint8_t refine = msg.readUInt8(); + for (int i = 0; i < 4; i++) + cards[i] = msg.readInt16(); + + if (mDebugInventory) + { + logger->log("Index: %d, ID: %d, Type: %d, Identified: %u, " + "Qty: %d, Cards: %d, %d, %d, %d, Refine: %u", + index, itemId, itemType, + static_cast(identified), amount, + cards[0], cards[1], cards[2], cards[3], + static_cast(refine)); + } + + if (serverVersion < 1 && identified > 1U) + identified = 1U; + + mInventoryItems.push_back(Ea::InventoryItem(index, + itemId, amount, refine, identified, false)); + } + BLOCK_END("InventoryHandler::processPlayerStorageEquip") +} + } // namespace TmwAthena diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index b1172ef81..6eef0c3de 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -68,6 +68,8 @@ class InventoryHandler final : public MessageHandler, void processPlayerEquip(Net::MessageIn &msg); void processPlayerUnEquip(Net::MessageIn &msg); + + void processPlayerStorageEquip(Net::MessageIn &msg); }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2