summaryrefslogtreecommitdiff
path: root/src/net/tmwa/inventoryrecv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa/inventoryrecv.cpp')
-rw-r--r--src/net/tmwa/inventoryrecv.cpp59
1 files changed, 56 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