summaryrefslogtreecommitdiff
path: root/src/net/tmwa
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 /src/net/tmwa
parent2b019f52da91cb37c00dfa34be6dd3e99e459d47 (diff)
downloadmv-fe4bd9d594ae6c305c9c51a32fca503dbb2e0771.tar.gz
mv-fe4bd9d594ae6c305c9c51a32fca503dbb2e0771.tar.bz2
mv-fe4bd9d594ae6c305c9c51a32fca503dbb2e0771.tar.xz
mv-fe4bd9d594ae6c305c9c51a32fca503dbb2e0771.zip
Move InventoryRecv::getSlot form ea namespace into tmwa and eathena.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/inventoryrecv.cpp59
-rw-r--r--src/net/tmwa/inventoryrecv.h4
2 files changed, 60 insertions, 3 deletions
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