summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-06 03:22:03 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-06 03:22:03 +0300
commitfe4bd9d594ae6c305c9c51a32fca503dbb2e0771 (patch)
treee0793ac44f6fc596f3a8a7ca1342d65c2e24953b
parent2b019f52da91cb37c00dfa34be6dd3e99e459d47 (diff)
downloadplus-fe4bd9d594ae6c305c9c51a32fca503dbb2e0771.tar.gz
plus-fe4bd9d594ae6c305c9c51a32fca503dbb2e0771.tar.bz2
plus-fe4bd9d594ae6c305c9c51a32fca503dbb2e0771.tar.xz
plus-fe4bd9d594ae6c305c9c51a32fca503dbb2e0771.zip
Move InventoryRecv::getSlot form ea namespace into tmwa and eathena.
-rw-r--r--src/net/ea/inventoryrecv.cpp44
-rw-r--r--src/net/ea/inventoryrecv.h2
-rw-r--r--src/net/eathena/inventoryrecv.cpp56
-rw-r--r--src/net/eathena/inventoryrecv.h2
-rw-r--r--src/net/tmwa/inventoryrecv.cpp59
-rw-r--r--src/net/tmwa/inventoryrecv.h4
6 files changed, 115 insertions, 52 deletions
diff --git a/src/net/ea/inventoryrecv.cpp b/src/net/ea/inventoryrecv.cpp
index f1593bf51..830675a44 100644
--- a/src/net/ea/inventoryrecv.cpp
+++ b/src/net/ea/inventoryrecv.cpp
@@ -50,32 +50,6 @@ namespace Ea
namespace InventoryRecv
{
- const EquipSlot::Type EQUIP_POINTS[EquipSlot::VECTOREND] =
- {
- EquipSlot::LEGS_SLOT, // Lower Headgear
- EquipSlot::FIGHT1_SLOT, // Weapon
- EquipSlot::GLOVES_SLOT, // Garment
- EquipSlot::RING2_SLOT, // Accessory 1
- EquipSlot::RING1_SLOT, // Armor
- EquipSlot::FIGHT2_SLOT, // Shield
- EquipSlot::FEET_SLOT, // Footgear
- EquipSlot::NECK_SLOT, // Accessory 2
- EquipSlot::HEAD_SLOT, // Upper Headgear
- EquipSlot::TORSO_SLOT, // Middle Headgear
- EquipSlot::EVOL_RING1_SLOT, // Costume Top Headgear
- EquipSlot::EVOL_RING2_SLOT, // Costume Mid Headgear
- EquipSlot::PROJECTILE_SLOT, // Costume Low Headgear
- EquipSlot::COSTUME_ROBE_SLOT, // Costume Garment/Robe
- EquipSlot::MISSING1_SLOT, // Missing slot 1
- EquipSlot::MISSING2_SLOT, // Missing slot 2
- EquipSlot::SHADOW_ARMOR_SLOT, // Shadow Armor
- EquipSlot::SHADOW_WEAPON_SLOT, // Shadow Weapon
- EquipSlot::SHADOW_SHIELD_SLOT, // Shadow Shield
- EquipSlot::SHADOW_SHOES_SLOT, // Shadow Shoes
- EquipSlot::SHADOW_ACCESSORY2_SLOT, // Shadow Accessory 2
- EquipSlot::SHADOW_ACCESSORY1_SLOT, // Shadow Accessory 1
- };
-
EquipBackend mEquips;
InventoryItems mInventoryItems;
Inventory *mStorage = nullptr;
@@ -217,22 +191,4 @@ void InventoryRecv::processPlayerArrowEquip(Net::MessageIn &msg)
BLOCK_END("InventoryRecv::processPlayerArrowEquip")
}
-int InventoryRecv::getSlot(const int eAthenaSlot)
-{
- if (eAthenaSlot == 0)
- return EquipSlot::VECTOREND;
-
- if (eAthenaSlot & 0x8000)
- return inventoryHandler->getProjectileSlot();
-
- unsigned int mask = 1;
- int position = 0;
- while (!(eAthenaSlot & mask))
- {
- mask <<= 1;
- position++;
- }
- return CAST_S32(EQUIP_POINTS[position]);
-}
-
} // namespace Ea
diff --git a/src/net/ea/inventoryrecv.h b/src/net/ea/inventoryrecv.h
index 954a5216e..472dc8362 100644
--- a/src/net/ea/inventoryrecv.h
+++ b/src/net/ea/inventoryrecv.h
@@ -58,8 +58,6 @@ namespace Ea
void processPlayerStorageClose(Net::MessageIn &msg);
void processPlayerAttackRange(Net::MessageIn &msg);
void processPlayerArrowEquip(Net::MessageIn &msg);
-
- int getSlot(const int eAthenaSlot) A_WARN_UNUSED;
} // namespace InventoryRecv
} // namespace Ea
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index 68663112e..2fce17be0 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -29,6 +29,8 @@
#include "const/net/inventory.h"
+#include "enums/equipslot.h"
+
#include "enums/resources/notifytypes.h"
#include "enums/net/deleteitemreason.h"
@@ -43,6 +45,7 @@
#include "net/inventoryhandler.h"
+#include "net/inventoryhandler.h"
#include "net/messagein.h"
#include "net/eathena/itemflags.h"
@@ -66,6 +69,32 @@ namespace EAthena
namespace InventoryRecv
{
+ const EquipSlot::Type EQUIP_POINTS[EquipSlot::VECTOREND] =
+ {
+ EquipSlot::LEGS_SLOT, // Lower Headgear
+ EquipSlot::FIGHT1_SLOT, // Weapon
+ EquipSlot::GLOVES_SLOT, // Garment
+ EquipSlot::RING2_SLOT, // Accessory 1
+ EquipSlot::RING1_SLOT, // Armor
+ EquipSlot::FIGHT2_SLOT, // Shield
+ EquipSlot::FEET_SLOT, // Footgear
+ EquipSlot::NECK_SLOT, // Accessory 2
+ EquipSlot::HEAD_SLOT, // Upper Headgear
+ EquipSlot::TORSO_SLOT, // Middle Headgear
+ EquipSlot::EVOL_RING1_SLOT, // Costume Top Headgear
+ EquipSlot::EVOL_RING2_SLOT, // Costume Mid Headgear
+ EquipSlot::PROJECTILE_SLOT, // Costume Low Headgear
+ EquipSlot::COSTUME_ROBE_SLOT, // Costume Garment/Robe
+ EquipSlot::MISSING1_SLOT, // Missing slot 1
+ EquipSlot::MISSING2_SLOT, // Missing slot 2
+ EquipSlot::SHADOW_ARMOR_SLOT, // Shadow Armor
+ EquipSlot::SHADOW_WEAPON_SLOT, // Shadow Weapon
+ EquipSlot::SHADOW_SHIELD_SLOT, // Shadow Shield
+ EquipSlot::SHADOW_SHOES_SLOT, // Shadow Shoes
+ EquipSlot::SHADOW_ACCESSORY2_SLOT, // Shadow Accessory 2
+ EquipSlot::SHADOW_ACCESSORY1_SLOT, // Shadow Accessory 1
+ };
+
Ea::InventoryItems mCartItems;
}
@@ -135,7 +164,8 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
if (equipType)
{
Ea::InventoryRecv::mEquips.setEquipment(
- Ea::InventoryRecv::getSlot(equipType), index);
+ InventoryRecv::getSlot(equipType),
+ index);
}
}
BLOCK_END("InventoryRecv::processPlayerEquipment")
@@ -367,7 +397,8 @@ void InventoryRecv::processPlayerEquip(Net::MessageIn &msg)
{
case 0:
Ea::InventoryRecv::mEquips.setEquipment(
- Ea::InventoryRecv::getSlot(equipType), index);
+ InventoryRecv::getSlot(equipType),
+ index);
break;
case 1:
NotifyManager::notify(NotifyTypes::EQUIP_FAILED_LEVEL);
@@ -395,7 +426,8 @@ void InventoryRecv::processPlayerUnEquip(Net::MessageIn &msg)
else
{
Ea::InventoryRecv::mEquips.setEquipment(
- Ea::InventoryRecv::getSlot(equipType), -1);
+ InventoryRecv::getSlot(equipType),
+ -1);
}
if (equipType & 0x8000)
ArrowsListener::distributeEvent();
@@ -1108,4 +1140,22 @@ void InventoryRecv::processSelectCart(Net::MessageIn &msg)
msg.readUInt8("cart type");
}
+int InventoryRecv::getSlot(const int eAthenaSlot)
+{
+ if (eAthenaSlot == 0)
+ return EquipSlot::VECTOREND;
+
+ if (eAthenaSlot & 0x8000)
+ return inventoryHandler->getProjectileSlot();
+
+ unsigned int mask = 1;
+ int position = 0;
+ while (!(eAthenaSlot & mask))
+ {
+ mask <<= 1;
+ position++;
+ }
+ return CAST_S32(EQUIP_POINTS[position]);
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/inventoryrecv.h b/src/net/eathena/inventoryrecv.h
index 2726f88f7..2050f2338 100644
--- a/src/net/eathena/inventoryrecv.h
+++ b/src/net/eathena/inventoryrecv.h
@@ -71,6 +71,8 @@ namespace EAthena
void processBindItem(Net::MessageIn &msg);
void processPlayerInventoryRemove(Net::MessageIn &msg);
void processSelectCart(Net::MessageIn &msg);
+
+ int getSlot(const int eAthenaSlot) A_WARN_UNUSED;
} // namespace InventoryRecv
} // namespace EAthena
diff --git a/src/net/tmwa/inventoryrecv.cpp b/src/net/tmwa/inventoryrecv.cpp
index 2ba71b73d..fbada97cf 100644
--- a/src/net/tmwa/inventoryrecv.cpp
+++ b/src/net/tmwa/inventoryrecv.cpp
@@ -28,10 +28,13 @@
#include "const/net/inventory.h"
+#include "enums/equipslot.h"
+
#include "enums/resources/notifytypes.h"
#include "listeners/arrowslistener.h"
+#include "net/inventoryhandler.h"
#include "net/messagein.h"
#include "net/ea/equipbackend.h"
@@ -42,6 +45,35 @@
namespace TmwAthena
{
+namespace InventoryRecv
+{
+ const EquipSlot::Type EQUIP_POINTS[EquipSlot::VECTOREND] =
+ {
+ EquipSlot::LEGS_SLOT, // Lower Headgear
+ EquipSlot::FIGHT1_SLOT, // Weapon
+ EquipSlot::GLOVES_SLOT, // Garment
+ EquipSlot::RING2_SLOT, // Accessory 1
+ EquipSlot::RING1_SLOT, // Armor
+ EquipSlot::FIGHT2_SLOT, // Shield
+ EquipSlot::FEET_SLOT, // Footgear
+ EquipSlot::NECK_SLOT, // Accessory 2
+ EquipSlot::HEAD_SLOT, // Upper Headgear
+ EquipSlot::TORSO_SLOT, // Middle Headgear
+ EquipSlot::EVOL_RING1_SLOT, // Costume Top Headgear
+ EquipSlot::EVOL_RING2_SLOT, // Costume Mid Headgear
+ EquipSlot::PROJECTILE_SLOT, // Costume Low Headgear
+ EquipSlot::COSTUME_ROBE_SLOT, // Costume Garment/Robe
+ EquipSlot::MISSING1_SLOT, // Missing slot 1
+ EquipSlot::MISSING2_SLOT, // Missing slot 2
+ EquipSlot::SHADOW_ARMOR_SLOT, // Shadow Armor
+ EquipSlot::SHADOW_WEAPON_SLOT, // Shadow Weapon
+ EquipSlot::SHADOW_SHIELD_SLOT, // Shadow Shield
+ EquipSlot::SHADOW_SHOES_SLOT, // Shadow Shoes
+ EquipSlot::SHADOW_ACCESSORY2_SLOT, // Shadow Accessory 2
+ EquipSlot::SHADOW_ACCESSORY1_SLOT, // Shadow Accessory 1
+ };
+}
+
void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
{
BLOCK_START("InventoryRecv::processPlayerEquipment")
@@ -97,7 +129,8 @@ void InventoryRecv::processPlayerEquipment(Net::MessageIn &msg)
if (equipType)
{
Ea::InventoryRecv::mEquips.setEquipment(
- Ea::InventoryRecv::getSlot(equipType), index);
+ InventoryRecv::getSlot(equipType),
+ index);
}
}
BLOCK_END("InventoryRecv::processPlayerEquipment")
@@ -332,7 +365,8 @@ void InventoryRecv::processPlayerEquip(Net::MessageIn &msg)
else
{
Ea::InventoryRecv::mEquips.setEquipment(
- Ea::InventoryRecv::getSlot(equipType), index);
+ InventoryRecv::getSlot(equipType),
+ index);
}
BLOCK_END("InventoryRecv::processPlayerEquip")
}
@@ -347,7 +381,8 @@ void InventoryRecv::processPlayerUnEquip(Net::MessageIn &msg)
if (flag)
{
Ea::InventoryRecv::mEquips.setEquipment(
- Ea::InventoryRecv::getSlot(equipType), -1);
+ InventoryRecv::getSlot(equipType),
+ -1);
}
if (equipType & 0x8000)
ArrowsListener::distributeEvent();
@@ -480,4 +515,22 @@ void InventoryRecv::processPlayerInventoryRemove(Net::MessageIn &msg)
BLOCK_END("InventoryRecv::processPlayerInventoryRemove")
}
+int InventoryRecv::getSlot(const int eAthenaSlot)
+{
+ if (eAthenaSlot == 0)
+ return EquipSlot::VECTOREND;
+
+ if (eAthenaSlot & 0x8000)
+ return inventoryHandler->getProjectileSlot();
+
+ unsigned int mask = 1;
+ int position = 0;
+ while (!(eAthenaSlot & mask))
+ {
+ mask <<= 1;
+ position++;
+ }
+ return CAST_S32(EQUIP_POINTS[position]);
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/inventoryrecv.h b/src/net/tmwa/inventoryrecv.h
index 1e15d0a19..4408e00d3 100644
--- a/src/net/tmwa/inventoryrecv.h
+++ b/src/net/tmwa/inventoryrecv.h
@@ -23,6 +23,8 @@
#ifndef NET_TMWA_INVENTORYRECV_H
#define NET_TMWA_INVENTORYRECV_H
+#include "localconsts.h"
+
namespace Net
{
class MessageIn;
@@ -42,6 +44,8 @@ namespace TmwAthena
void processPlayerStorageAdd(Net::MessageIn &msg);
void processPlayerStorageRemove(Net::MessageIn &msg);
void processPlayerInventoryRemove(Net::MessageIn &msg);
+
+ int getSlot(const int eAthenaSlot) A_WARN_UNUSED;
} // namespace InventoryRecv
} // namespace TmwAthena