diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-08-06 21:13:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-08-06 21:13:56 +0300 |
commit | 3b5390eee9c3e031867d3acfce574f1993d46b76 (patch) | |
tree | 733dc11695c0a71e4725f97b28222cf9eaf435d3 /src | |
parent | 1604ad0c8bd2d770f350cf88e469b4c810b6457f (diff) | |
download | plus-3b5390eee9c3e031867d3acfce574f1993d46b76.tar.gz plus-3b5390eee9c3e031867d3acfce574f1993d46b76.tar.bz2 plus-3b5390eee9c3e031867d3acfce574f1993d46b76.tar.xz plus-3b5390eee9c3e031867d3acfce574f1993d46b76.zip |
Move InventoryRecv::processPlayerInventoryUse from ea namespace into tmwa and eathena.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/ea/inventoryrecv.cpp | 25 | ||||
-rw-r--r-- | src/net/ea/inventoryrecv.h | 1 | ||||
-rw-r--r-- | src/net/eathena/inventoryrecv.cpp | 25 | ||||
-rw-r--r-- | src/net/eathena/inventoryrecv.h | 1 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 4 | ||||
-rw-r--r-- | src/net/tmwa/inventoryrecv.cpp | 25 | ||||
-rw-r--r-- | src/net/tmwa/inventoryrecv.h | 1 | ||||
-rw-r--r-- | src/net/tmwa/packetsin.inc | 2 |
8 files changed, 55 insertions, 29 deletions
diff --git a/src/net/ea/inventoryrecv.cpp b/src/net/ea/inventoryrecv.cpp index 5dd4075d6..2e6a7e2ac 100644 --- a/src/net/ea/inventoryrecv.cpp +++ b/src/net/ea/inventoryrecv.cpp @@ -56,31 +56,6 @@ namespace InventoryRecv bool mDebugInventory = true; } // namespace InventoryRecv -void InventoryRecv::processPlayerInventoryUse(Net::MessageIn &msg) -{ - BLOCK_START("InventoryRecv::processPlayerInventoryUse") - Inventory *const inventory = localPlayer != nullptr - ? PlayerInfo::getInventory() : nullptr; - - const int index = msg.readInt16("index") - INVENTORY_OFFSET; - msg.readItemId("item id"); - msg.readInt32("id?"); - const int amount = msg.readInt16("amount"); - msg.readUInt8("type"); - - if (inventory != nullptr) - { - if (Item *const item = inventory->getItem(index)) - { - if (amount != 0) - item->setQuantity(amount); - else - inventory->removeItemAt(index); - } - } - BLOCK_END("InventoryRecv::processPlayerInventoryUse") -} - void InventoryRecv::processItemUseResponse(Net::MessageIn &msg) { BLOCK_START("InventoryRecv::processItemUseResponse") diff --git a/src/net/ea/inventoryrecv.h b/src/net/ea/inventoryrecv.h index f3d0ae442..3330e6fd1 100644 --- a/src/net/ea/inventoryrecv.h +++ b/src/net/ea/inventoryrecv.h @@ -52,7 +52,6 @@ namespace Ea extern PickupQueue mSentPickups; extern bool mDebugInventory; - void processPlayerInventoryUse(Net::MessageIn &msg); void processItemUseResponse(Net::MessageIn &msg); void processPlayerStorageStatus(Net::MessageIn &msg); void processPlayerStorageClose(Net::MessageIn &msg); diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index d1351229c..17e79b4da 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -1449,4 +1449,29 @@ void InventoryRecv::processMergeItemResponse(Net::MessageIn &msg) msg.readUInt8("result"); } +void InventoryRecv::processPlayerInventoryUse(Net::MessageIn &msg) +{ + BLOCK_START("InventoryRecv::processPlayerInventoryUse") + Inventory *const inventory = localPlayer != nullptr + ? PlayerInfo::getInventory() : nullptr; + + const int index = msg.readInt16("index") - INVENTORY_OFFSET; + msg.readItemId("item id"); + msg.readInt32("id?"); + const int amount = msg.readInt16("amount"); + msg.readUInt8("type"); + + if (inventory != nullptr) + { + if (Item *const item = inventory->getItem(index)) + { + if (amount != 0) + item->setQuantity(amount); + else + inventory->removeItemAt(index); + } + } + BLOCK_END("InventoryRecv::processPlayerInventoryUse") +} + } // namespace EAthena diff --git a/src/net/eathena/inventoryrecv.h b/src/net/eathena/inventoryrecv.h index 5104d9043..544c6a817 100644 --- a/src/net/eathena/inventoryrecv.h +++ b/src/net/eathena/inventoryrecv.h @@ -73,6 +73,7 @@ namespace EAthena void processSelectCart(Net::MessageIn &msg); void processMergeItem(Net::MessageIn &msg); void processMergeItemResponse(Net::MessageIn &msg); + void processPlayerInventoryUse(Net::MessageIn &msg); int getSlot(const int eAthenaSlot) A_WARN_UNUSED; } // namespace InventoryRecv diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index 91e4e3cba..0ea950d92 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -300,7 +300,7 @@ packet(SMSG_FORMAT_COLOR_MESSAGE, 0x09cd, 8, &ChatRecv::processFormat // 3 if (packetVersion >= 3) { - packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 13, &Ea::InventoryRecv::processPlayerInventoryUse, 3); + packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 13, &InventoryRecv::processPlayerInventoryUse, 3); packet(SMSG_SKILL_DAMAGE, 0x01de, 33, &BeingRecv::processSkillDamage, 3); } @@ -1140,7 +1140,7 @@ if (packetVersionRe >= 20180704) packet(SMSG_SKILL_FAILED, 0x0110, 14, &SkillRecv::processSkillFailed, 20180704); packet(SMSG_PLAYER_SKILL_PRODUCE_EFFECT, 0x018f, 8, &SkillRecv::processSkillProduceEffect, 20180704); packet(SMSG_PET_FOOD, 0x01a3, 7, &PetRecv::processPetFood, 20180704); - packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 15, &Ea::InventoryRecv::processPlayerInventoryUse, 20180704); + packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 15, &InventoryRecv::processPlayerInventoryUse, 20180704); packet(SMSG_BEING_CHANGE_LOOKS2, 0x01d7, 15, &BeingRecv::processBeingChangeLook2, 20180704); packet(SMSG_PLAYER_UPGRADE_MESSAGE, 0x0223, 10, &PlayerRecv::processPlayerUpgradeMessage, 20180704); packet(SMSG_HOMUNCULUS_FOOD, 0x022f, 7, &HomunculusRecv::processHomunculusFood, 20180704); diff --git a/src/net/tmwa/inventoryrecv.cpp b/src/net/tmwa/inventoryrecv.cpp index 1bb1ee9f2..68521bfa4 100644 --- a/src/net/tmwa/inventoryrecv.cpp +++ b/src/net/tmwa/inventoryrecv.cpp @@ -560,4 +560,29 @@ int InventoryRecv::getSlot(const int eAthenaSlot) return CAST_S32(EQUIP_POINTS[position]); } +void InventoryRecv::processPlayerInventoryUse(Net::MessageIn &msg) +{ + BLOCK_START("InventoryRecv::processPlayerInventoryUse") + Inventory *const inventory = localPlayer != nullptr + ? PlayerInfo::getInventory() : nullptr; + + const int index = msg.readInt16("index") - INVENTORY_OFFSET; + msg.readItemId("item id"); + msg.readInt32("id?"); + const int amount = msg.readInt16("amount"); + msg.readUInt8("type"); + + if (inventory != nullptr) + { + if (Item *const item = inventory->getItem(index)) + { + if (amount != 0) + item->setQuantity(amount); + else + inventory->removeItemAt(index); + } + } + BLOCK_END("InventoryRecv::processPlayerInventoryUse") +} + } // namespace TmwAthena diff --git a/src/net/tmwa/inventoryrecv.h b/src/net/tmwa/inventoryrecv.h index da1d6bda9..bf3db3681 100644 --- a/src/net/tmwa/inventoryrecv.h +++ b/src/net/tmwa/inventoryrecv.h @@ -44,6 +44,7 @@ namespace TmwAthena void processPlayerStorageAdd(Net::MessageIn &msg); void processPlayerStorageRemove(Net::MessageIn &msg); void processPlayerInventoryRemove(Net::MessageIn &msg); + void processPlayerInventoryUse(Net::MessageIn &msg); int getSlot(const int eAthenaSlot) A_WARN_UNUSED; } // namespace InventoryRecv diff --git a/src/net/tmwa/packetsin.inc b/src/net/tmwa/packetsin.inc index d218db659..5681a2792 100644 --- a/src/net/tmwa/packetsin.inc +++ b/src/net/tmwa/packetsin.inc @@ -94,7 +94,7 @@ packet(SMSG_PLAYER_GUILD_PARTY_INFO, 0x0195, 102, &BeingRecv::processPlaye packet(SMSG_PLAYER_INVENTORY, 0x01ee, -1, &InventoryRecv::processPlayerInventory, 0); packet(SMSG_PLAYER_INVENTORY_ADD, 0x00a0, 23, &InventoryRecv::processPlayerInventoryAdd, 0); packet(SMSG_PLAYER_INVENTORY_REMOVE, 0x00af, 6, &InventoryRecv::processPlayerInventoryRemove, 0); -packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 13, &Ea::InventoryRecv::processPlayerInventoryUse, 0); +packet(SMSG_PLAYER_INVENTORY_USE, 0x01c8, 13, &InventoryRecv::processPlayerInventoryUse, 0); packet(SMSG_PLAYER_MOVE, 0x01da, 60, &BeingRecv::processPlayerMove, 0); packet(SMSG_PLAYER_MOVE_TO_ATTACK, 0x0139, 16, &Ea::BeingRecv::processPlayerMoveToAttack, 0); packet(SMSG_PLAYER_SKILLS, 0x010f, -1, &SkillRecv::processPlayerSkills, 0); |