Merge branch 'inv_possessions_rework' of https://github.com/EQEmu/Server into inv_possessions_rework

This commit is contained in:
Uleat 2018-09-03 20:58:47 -04:00
commit 5867a3147a
9 changed files with 1017 additions and 983 deletions

View File

@ -263,134 +263,139 @@ int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
return _PutItem(slot_id, inst.Clone()); return _PutItem(slot_id, inst.Clone());
} }
int16 EQEmu::InventoryProfile::PushCursor(const ItemInstance& inst) int16 EQEmu::InventoryProfile::PushCursor(const ItemInstance &inst) {
{
m_cursor.push(inst.Clone()); m_cursor.push(inst.Clone());
return invslot::slotCursor; return invslot::slotCursor;
} }
EQEmu::ItemInstance* EQEmu::InventoryProfile::GetCursorItem() EQEmu::ItemInstance* EQEmu::InventoryProfile::GetCursorItem() {
{
return m_cursor.peek_front(); return m_cursor.peek_front();
} }
// Swap items in inventory // Swap items in inventory
bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailState& fail_state, uint16 race_id, uint8 class_id, uint16 deity_id, uint8 level) bool EQEmu::InventoryProfile::SwapItem(
{ int16 source_slot,
int16 destination_slot,
SwapItemFailState &fail_state,
uint16 race_id,
uint8 class_id,
uint16 deity_id,
uint8 level
) {
fail_state = swapInvalid; fail_state = swapInvalid;
if (slot_a <= EQEmu::invslot::POSSESSIONS_END && slot_a >= EQEmu::invslot::POSSESSIONS_BEGIN) { if (source_slot <= EQEmu::invslot::POSSESSIONS_END && source_slot >= EQEmu::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << slot_a) & m_lookup->PossessionsBitmask) == 0) { if ((((uint64) 1 << source_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (slot_a <= EQEmu::invbag::GENERAL_BAGS_END && slot_a >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { else if (source_slot <= EQEmu::invbag::GENERAL_BAGS_END && source_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_a - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT); auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((source_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) { if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (slot_a <= EQEmu::invslot::BANK_END && slot_a >= EQEmu::invslot::BANK_BEGIN) { else if (source_slot <= EQEmu::invslot::BANK_END && source_slot >= EQEmu::invslot::BANK_BEGIN) {
if ((slot_a - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) { if ((source_slot - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (slot_a <= EQEmu::invbag::BANK_BAGS_END && slot_a >= EQEmu::invbag::BANK_BAGS_BEGIN) { else if (source_slot <= EQEmu::invbag::BANK_BAGS_END && source_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (slot_a - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT; auto temp_slot = (source_slot - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) { if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
if (slot_b <= EQEmu::invslot::POSSESSIONS_END && slot_b >= EQEmu::invslot::POSSESSIONS_BEGIN) { if (destination_slot <= EQEmu::invslot::POSSESSIONS_END && destination_slot >= EQEmu::invslot::POSSESSIONS_BEGIN) {
if ((((uint64)1 << slot_b) & m_lookup->PossessionsBitmask) == 0) { if ((((uint64)1 << destination_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (slot_b <= EQEmu::invbag::GENERAL_BAGS_END && slot_b >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { else if (destination_slot <= EQEmu::invbag::GENERAL_BAGS_END && destination_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_b - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT); auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((destination_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) { if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (slot_b <= EQEmu::invslot::BANK_END && slot_b >= EQEmu::invslot::BANK_BEGIN) { else if (destination_slot <= EQEmu::invslot::BANK_END && destination_slot >= EQEmu::invslot::BANK_BEGIN) {
if ((slot_b - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) { if ((destination_slot - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
else if (slot_b <= EQEmu::invbag::BANK_BAGS_END && slot_b >= EQEmu::invbag::BANK_BAGS_BEGIN) { else if (destination_slot <= EQEmu::invbag::BANK_BAGS_END && destination_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
auto temp_slot = (slot_b - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT; auto temp_slot = (destination_slot - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) { if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
} }
// Temp holding areas for a and b // Temp holding areas for source and destination
ItemInstance* inst_a = GetItem(slot_a); ItemInstance *source_item_instance = GetItem(source_slot);
ItemInstance* inst_b = GetItem(slot_b); ItemInstance *destination_item_instance = GetItem(destination_slot);
if (inst_a) { if (source_item_instance) {
if (!inst_a->IsSlotAllowed(slot_b)) { if (!source_item_instance->IsSlotAllowed(destination_slot)) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
if ((slot_b >= invslot::EQUIPMENT_BEGIN && slot_b <= invslot::EQUIPMENT_END)) { if ((destination_slot >= invslot::EQUIPMENT_BEGIN && destination_slot <= invslot::EQUIPMENT_END)) {
auto item_a = inst_a->GetItem(); auto source_item = source_item_instance->GetItem();
if (!item_a) { if (!source_item) {
fail_state = swapNullData; fail_state = swapNullData;
return false; return false;
} }
if (race_id && class_id && !item_a->IsEquipable(race_id, class_id)) { if (race_id && class_id && !source_item->IsEquipable(race_id, class_id)) {
fail_state = swapRaceClass; fail_state = swapRaceClass;
return false; return false;
} }
if (deity_id && item_a->Deity && !(deity::ConvertDeityTypeToDeityTypeBit((deity::DeityType)deity_id) & item_a->Deity)) { if (deity_id && source_item->Deity && !(deity::ConvertDeityTypeToDeityTypeBit((deity::DeityType)deity_id) & source_item->Deity)) {
fail_state = swapDeity; fail_state = swapDeity;
return false; return false;
} }
if (level && item_a->ReqLevel && level < item_a->ReqLevel) { if (level && source_item->ReqLevel && level < source_item->ReqLevel) {
fail_state = swapLevel; fail_state = swapLevel;
return false; return false;
} }
} }
} }
if (inst_b) { if (destination_item_instance) {
if (!inst_b->IsSlotAllowed(slot_a)) { if (!destination_item_instance->IsSlotAllowed(source_slot)) {
fail_state = swapNotAllowed; fail_state = swapNotAllowed;
return false; return false;
} }
if ((slot_a >= invslot::EQUIPMENT_BEGIN && slot_a <= invslot::EQUIPMENT_END)) { if ((source_slot >= invslot::EQUIPMENT_BEGIN && source_slot <= invslot::EQUIPMENT_END)) {
auto item_b = inst_b->GetItem(); auto destination_item = destination_item_instance->GetItem();
if (!item_b) { if (!destination_item) {
fail_state = swapNullData; fail_state = swapNullData;
return false; return false;
} }
if (race_id && class_id && !item_b->IsEquipable(race_id, class_id)) { if (race_id && class_id && !destination_item->IsEquipable(race_id, class_id)) {
fail_state = swapRaceClass; fail_state = swapRaceClass;
return false; return false;
} }
if (deity_id && item_b->Deity && !(deity::ConvertDeityTypeToDeityTypeBit((deity::DeityType)deity_id) & item_b->Deity)) { if (deity_id && destination_item->Deity && !(deity::ConvertDeityTypeToDeityTypeBit((deity::DeityType)deity_id) & destination_item->Deity)) {
fail_state = swapDeity; fail_state = swapDeity;
return false; return false;
} }
if (level && item_b->ReqLevel && level < item_b->ReqLevel) { if (level && destination_item->ReqLevel && level < destination_item->ReqLevel) {
fail_state = swapLevel; fail_state = swapLevel;
return false; return false;
} }
} }
} }
_PutItem(slot_a, inst_b); // Assign b->a _PutItem(source_slot, destination_item_instance); // Assign destination -> source
_PutItem(slot_b, inst_a); // Assign a->b _PutItem(destination_slot, source_item_instance); // Assign source -> destination
fail_state = swapPass; fail_state = swapPass;
@ -398,10 +403,9 @@ bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailS
} }
// Remove item from inventory (with memory delete) // Remove item from inventory (with memory delete)
bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity) {
{
// Pop item out of inventory map (or queue) // Pop item out of inventory map (or queue)
ItemInstance* item_to_delete = PopItem(slot_id); ItemInstance *item_to_delete = PopItem(slot_id);
// Determine if object should be fully deleted, or // Determine if object should be fully deleted, or
// just a quantity of charges of the item can be deleted // just a quantity of charges of the item can be deleted
@ -415,7 +419,7 @@ bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity)
// the item is not stackable, and is not a charged item, or is expendable, delete it // the item is not stackable, and is not a charged item, or is expendable, delete it
if (item_to_delete->IsStackable() || if (item_to_delete->IsStackable() ||
(!item_to_delete->IsStackable() && (!item_to_delete->IsStackable() &&
((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable())) ((item_to_delete->GetItem()->MaxCharges == 0) || item_to_delete->IsExpendable()))
) { ) {
// Item can now be destroyed // Item can now be destroyed
InventoryProfile::MarkDirty(item_to_delete); InventoryProfile::MarkDirty(item_to_delete);

View File

@ -126,7 +126,7 @@ namespace EQEmu
// Swap items in inventory // Swap items in inventory
enum SwapItemFailState : int8 { swapInvalid = -1, swapPass = 0, swapNotAllowed, swapNullData, swapRaceClass, swapDeity, swapLevel }; enum SwapItemFailState : int8 { swapInvalid = -1, swapPass = 0, swapNotAllowed, swapNullData, swapRaceClass, swapDeity, swapLevel };
bool SwapItem(int16 slot_a, int16 slot_b, SwapItemFailState& fail_state, uint16 race_id = 0, uint8 class_id = 0, uint16 deity_id = 0, uint8 level = 0); bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = 0, uint8 class_id = 0, uint16 deity_id = 0, uint8 level = 0);
// Remove item from inventory // Remove item from inventory
bool DeleteItem(int16 slot_id, uint8 quantity = 0); bool DeleteItem(int16 slot_id, uint8 quantity = 0);

View File

@ -48,16 +48,16 @@ namespace RoF
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth, ItemPacketType packet_type); void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth, ItemPacketType packet_type);
// server to client inventory location converters // server to client inventory location converters
static inline structs::InventorySlot_Struct ServerToRoFSlot(uint32 serverSlot); static inline structs::InventorySlot_Struct ServerToRoFSlot(uint32 server_slot);
static inline structs::InventorySlot_Struct ServerToRoFCorpseSlot(uint32 serverCorpseSlot); static inline structs::InventorySlot_Struct ServerToRoFCorpseSlot(uint32 server_corpse_slot);
static inline uint32 ServerToRoFCorpseMainSlot(uint32 serverCorpseSlot); static inline uint32 ServerToRoFCorpseMainSlot(uint32 server_corpse_slot);
static inline structs::TypelessInventorySlot_Struct ServerToRoFTypelessSlot(uint32 serverSlot, int16 serverType); static inline structs::TypelessInventorySlot_Struct ServerToRoFTypelessSlot(uint32 server_slot, int16 server_type);
// client to server inventory location converters // client to server inventory location converters
static inline uint32 RoFToServerSlot(structs::InventorySlot_Struct rofSlot); static inline uint32 RoFToServerSlot(structs::InventorySlot_Struct rof_slot);
static inline uint32 RoFToServerCorpseSlot(structs::InventorySlot_Struct rofCorpseSlot); static inline uint32 RoFToServerCorpseSlot(structs::InventorySlot_Struct rof_corpse_slot);
static inline uint32 RoFToServerCorpseMainSlot(uint32 rofCorpseSlot); static inline uint32 RoFToServerCorpseMainSlot(uint32 rof_corpse_slot);
static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rofSlot, int16 rofType); static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof_slot, int16 rof_type);
// server to client say link converter // server to client say link converter
static inline void ServerToRoFSayLink(std::string& rofSayLink, const std::string& serverSayLink); static inline void ServerToRoFSayLink(std::string& rofSayLink, const std::string& serverSayLink);
@ -5545,124 +5545,142 @@ namespace RoF
} }
} }
static inline structs::InventorySlot_Struct ServerToRoFSlot(uint32 serverSlot) static inline structs::InventorySlot_Struct ServerToRoFSlot(uint32 server_slot)
{ {
structs::InventorySlot_Struct RoFSlot; structs::InventorySlot_Struct RoFSlot{};
RoFSlot.Type = invtype::TYPE_INVALID;
RoFSlot.Type = invtype::TYPE_INVALID;
RoFSlot.Unknown02 = INULL; RoFSlot.Unknown02 = INULL;
RoFSlot.Slot = invslot::SLOT_INVALID; RoFSlot.Slot = invslot::SLOT_INVALID;
RoFSlot.SubIndex = invbag::SLOT_INVALID; RoFSlot.SubIndex = invbag::SLOT_INVALID;
RoFSlot.AugIndex = invaug::SOCKET_INVALID; RoFSlot.AugIndex = invaug::SOCKET_INVALID;
RoFSlot.Unknown01 = INULL; RoFSlot.Unknown01 = INULL;
uint32 TempSlot = EQEmu::invslot::SLOT_INVALID; uint32 temp_slot = (uint32) EQEmu::invslot::SLOT_INVALID;
if (serverSlot < EQEmu::invtype::POSSESSIONS_SIZE) { if (server_slot < EQEmu::invtype::POSSESSIONS_SIZE) {
RoFSlot.Type = invtype::typePossessions; RoFSlot.Type = invtype::typePossessions;
RoFSlot.Slot = serverSlot; RoFSlot.Slot = server_slot;
} }
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::CURSOR_BAG_END && server_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
TempSlot = serverSlot - EQEmu::invbag::GENERAL_BAGS_BEGIN; temp_slot = server_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN;
RoFSlot.Type = invtype::typePossessions; RoFSlot.Type = invtype::typePossessions;
RoFSlot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT); RoFSlot.Slot = invslot::GENERAL_BEGIN + (temp_slot / EQEmu::invbag::SLOT_COUNT);
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT); RoFSlot.SubIndex = temp_slot - ((RoFSlot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
} }
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) { else if (server_slot <= EQEmu::invslot::TRIBUTE_END && server_slot >= EQEmu::invslot::TRIBUTE_BEGIN) {
RoFSlot.Type = invtype::typeTribute; RoFSlot.Type = invtype::typeTribute;
RoFSlot.Slot = serverSlot - EQEmu::invslot::TRIBUTE_BEGIN; RoFSlot.Slot = server_slot - EQEmu::invslot::TRIBUTE_BEGIN;
} }
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) { else if (server_slot <= EQEmu::invslot::GUILD_TRIBUTE_END && server_slot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
RoFSlot.Type = invtype::typeGuildTribute; RoFSlot.Type = invtype::typeGuildTribute;
RoFSlot.Slot = serverSlot - EQEmu::invslot::GUILD_TRIBUTE_BEGIN; RoFSlot.Slot = server_slot - EQEmu::invslot::GUILD_TRIBUTE_BEGIN;
} }
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) { else if (server_slot <= EQEmu::invslot::BANK_END && server_slot >= EQEmu::invslot::BANK_BEGIN) {
RoFSlot.Type = invtype::typeBank; RoFSlot.Type = invtype::typeBank;
RoFSlot.Slot = serverSlot - EQEmu::invslot::BANK_BEGIN; RoFSlot.Slot = server_slot - EQEmu::invslot::BANK_BEGIN;
} }
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::BANK_BAGS_END && server_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
TempSlot = serverSlot - EQEmu::invbag::BANK_BAGS_BEGIN; temp_slot = server_slot - EQEmu::invbag::BANK_BAGS_BEGIN;
RoFSlot.Type = invtype::typeBank; RoFSlot.Type = invtype::typeBank;
RoFSlot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT; RoFSlot.Slot = temp_slot / EQEmu::invbag::SLOT_COUNT;
RoFSlot.SubIndex = TempSlot - (RoFSlot.Slot * EQEmu::invbag::SLOT_COUNT); RoFSlot.SubIndex = temp_slot - (RoFSlot.Slot * EQEmu::invbag::SLOT_COUNT);
} }
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) { else if (server_slot <= EQEmu::invslot::SHARED_BANK_END && server_slot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
RoFSlot.Type = invtype::typeSharedBank; RoFSlot.Type = invtype::typeSharedBank;
RoFSlot.Slot = serverSlot - EQEmu::invslot::SHARED_BANK_BEGIN; RoFSlot.Slot = server_slot - EQEmu::invslot::SHARED_BANK_BEGIN;
} }
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::SHARED_BANK_BAGS_END && server_slot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
TempSlot = serverSlot - EQEmu::invbag::SHARED_BANK_BAGS_BEGIN; temp_slot = server_slot - EQEmu::invbag::SHARED_BANK_BAGS_BEGIN;
RoFSlot.Type = invtype::typeSharedBank; RoFSlot.Type = invtype::typeSharedBank;
RoFSlot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT; RoFSlot.Slot = temp_slot / EQEmu::invbag::SLOT_COUNT;
RoFSlot.SubIndex = TempSlot - (RoFSlot.Slot * EQEmu::invbag::SLOT_COUNT); RoFSlot.SubIndex = temp_slot - (RoFSlot.Slot * EQEmu::invbag::SLOT_COUNT);
} }
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) { else if (server_slot <= EQEmu::invslot::TRADE_END && server_slot >= EQEmu::invslot::TRADE_BEGIN) {
RoFSlot.Type = invtype::typeTrade; RoFSlot.Type = invtype::typeTrade;
RoFSlot.Slot = serverSlot - EQEmu::invslot::TRADE_BEGIN; RoFSlot.Slot = server_slot - EQEmu::invslot::TRADE_BEGIN;
} }
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::TRADE_BAGS_END && server_slot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
TempSlot = serverSlot - EQEmu::invbag::TRADE_BAGS_BEGIN; temp_slot = server_slot - EQEmu::invbag::TRADE_BAGS_BEGIN;
RoFSlot.Type = invtype::typeTrade; RoFSlot.Type = invtype::typeTrade;
RoFSlot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT; RoFSlot.Slot = temp_slot / EQEmu::invbag::SLOT_COUNT;
RoFSlot.SubIndex = TempSlot - (RoFSlot.Slot * EQEmu::invbag::SLOT_COUNT); RoFSlot.SubIndex = temp_slot - (RoFSlot.Slot * EQEmu::invbag::SLOT_COUNT);
} }
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) { else if (server_slot <= EQEmu::invslot::WORLD_END && server_slot >= EQEmu::invslot::WORLD_BEGIN) {
RoFSlot.Type = invtype::typeWorld; RoFSlot.Type = invtype::typeWorld;
RoFSlot.Slot = serverSlot - EQEmu::invslot::WORLD_BEGIN; RoFSlot.Slot = server_slot - EQEmu::invslot::WORLD_BEGIN;
} }
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)", Log(Logs::Detail,
serverSlot, RoFSlot.Type, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, RoFSlot.Unknown02, RoFSlot.Unknown01); Logs::Netcode,
"Convert Server Slot %i to RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)",
server_slot,
RoFSlot.Type,
RoFSlot.Slot,
RoFSlot.SubIndex,
RoFSlot.AugIndex,
RoFSlot.Unknown02,
RoFSlot.Unknown01);
return RoFSlot; return RoFSlot;
} }
static inline structs::InventorySlot_Struct ServerToRoFCorpseSlot(uint32 serverCorpseSlot) static inline structs::InventorySlot_Struct ServerToRoFCorpseSlot(uint32 server_corpse_slot)
{ {
structs::InventorySlot_Struct RoFSlot; structs::InventorySlot_Struct RoFSlot{};
RoFSlot.Type = invtype::TYPE_INVALID;
RoFSlot.Type = invtype::TYPE_INVALID;
RoFSlot.Unknown02 = INULL; RoFSlot.Unknown02 = INULL;
RoFSlot.Slot = ServerToRoFCorpseMainSlot(serverCorpseSlot); RoFSlot.Slot = static_cast<int16>(ServerToRoFCorpseMainSlot(server_corpse_slot));
RoFSlot.SubIndex = invbag::SLOT_INVALID; RoFSlot.SubIndex = invbag::SLOT_INVALID;
RoFSlot.AugIndex = invaug::SOCKET_INVALID; RoFSlot.AugIndex = invaug::SOCKET_INVALID;
RoFSlot.Unknown01 = INULL; RoFSlot.Unknown01 = INULL;
if (RoFSlot.Slot != invslot::SLOT_INVALID) if (RoFSlot.Slot != invslot::SLOT_INVALID)
RoFSlot.Type = invtype::typeCorpse; RoFSlot.Type = invtype::typeCorpse;
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF Corpse Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)", Log(Logs::Detail,
serverCorpseSlot, RoFSlot.Type, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, RoFSlot.Unknown02, RoFSlot.Unknown01); Logs::Netcode,
"Convert Server Corpse Slot %i to RoF Corpse Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)",
server_corpse_slot,
RoFSlot.Type,
RoFSlot.Slot,
RoFSlot.SubIndex,
RoFSlot.AugIndex,
RoFSlot.Unknown02,
RoFSlot.Unknown01);
return RoFSlot; return RoFSlot;
} }
static inline uint32 ServerToRoFCorpseMainSlot(uint32 serverCorpseSlot) static inline uint32 ServerToRoFCorpseMainSlot(uint32 server_corpse_slot)
{ {
uint32 RoFSlot = invslot::SLOT_INVALID; uint32 RoFSlot = invslot::SLOT_INVALID;
if (serverCorpseSlot <= EQEmu::invslot::CORPSE_END && serverCorpseSlot >= EQEmu::invslot::CORPSE_BEGIN) { if (server_corpse_slot <= EQEmu::invslot::CORPSE_END && server_corpse_slot >= EQEmu::invslot::CORPSE_BEGIN) {
RoFSlot = serverCorpseSlot; RoFSlot = server_corpse_slot;
} }
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF Corpse Main Slot %i", serverCorpseSlot, RoFSlot); Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF Corpse Main Slot %i", server_corpse_slot, RoFSlot);
return RoFSlot; return RoFSlot;
} }
static inline structs::TypelessInventorySlot_Struct ServerToRoFTypelessSlot(uint32 serverSlot, int16 serverType) static inline structs::TypelessInventorySlot_Struct ServerToRoFTypelessSlot(uint32 server_slot, int16 server_type)
{ {
structs::TypelessInventorySlot_Struct RoFSlot; structs::TypelessInventorySlot_Struct RoFSlot;
RoFSlot.Slot = invslot::SLOT_INVALID; RoFSlot.Slot = invslot::SLOT_INVALID;
@ -5672,13 +5690,13 @@ namespace RoF
uint32 TempSlot = EQEmu::invslot::SLOT_INVALID; uint32 TempSlot = EQEmu::invslot::SLOT_INVALID;
if (serverType == EQEmu::invtype::typePossessions) { if (server_type == EQEmu::invtype::typePossessions) {
if (serverSlot < EQEmu::invtype::POSSESSIONS_SIZE) { if (server_slot < EQEmu::invtype::POSSESSIONS_SIZE) {
RoFSlot.Slot = serverSlot; RoFSlot.Slot = server_slot;
} }
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::CURSOR_BAG_END && server_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
TempSlot = serverSlot - EQEmu::invbag::GENERAL_BAGS_BEGIN; TempSlot = server_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN;
RoFSlot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT); RoFSlot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT);
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT); RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
@ -5686,278 +5704,302 @@ namespace RoF
} }
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i)", Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i)",
serverSlot, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, serverType, RoFSlot.Unknown01); server_slot, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, server_type, RoFSlot.Unknown01);
return RoFSlot; return RoFSlot;
} }
static inline uint32 RoFToServerSlot(structs::InventorySlot_Struct rofSlot) static inline uint32 RoFToServerSlot(structs::InventorySlot_Struct rof_slot) {
{ if (rof_slot.AugIndex < invaug::SOCKET_INVALID || rof_slot.AugIndex >= invaug::SOCKET_COUNT) {
if (rofSlot.AugIndex < invaug::SOCKET_INVALID || rofSlot.AugIndex >= invaug::SOCKET_COUNT) { Log(Logs::Detail,
Log(Logs::Detail, Logs::Netcode, "Convert RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i", Logs::Netcode,
rofSlot.Type, rofSlot.Slot, rofSlot.SubIndex, rofSlot.AugIndex, rofSlot.Unknown02, rofSlot.Unknown01, EQEmu::invslot::SLOT_INVALID); "Convert RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
rof_slot.Type,
rof_slot.Slot,
rof_slot.SubIndex,
rof_slot.AugIndex,
rof_slot.Unknown02,
rof_slot.Unknown01,
EQEmu::invslot::SLOT_INVALID);
return EQEmu::invslot::SLOT_INVALID; return EQEmu::invslot::SLOT_INVALID;
} }
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
uint32 TempSlot = invslot::SLOT_INVALID; uint32 temp_slot = invslot::SLOT_INVALID;
switch (rofSlot.Type) { switch (rof_slot.Type) {
case invtype::typePossessions: { case invtype::typePossessions: {
if (rofSlot.Slot >= invslot::POSSESSIONS_BEGIN && rofSlot.Slot <= invslot::POSSESSIONS_END) { if (rof_slot.Slot >= invslot::POSSESSIONS_BEGIN && rof_slot.Slot <= invslot::POSSESSIONS_END) {
if (rofSlot.SubIndex == invbag::SLOT_INVALID) { if (rof_slot.SubIndex == invbag::SLOT_INVALID) {
ServerSlot = rofSlot.Slot; server_slot = rof_slot.Slot;
} else if (rof_slot.SubIndex >= invbag::SLOT_BEGIN && rof_slot.SubIndex <= invbag::SLOT_END) {
if (rof_slot.Slot < invslot::GENERAL_BEGIN)
return EQEmu::invslot::SLOT_INVALID;
temp_slot = (rof_slot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT;
server_slot = EQEmu::invbag::GENERAL_BAGS_BEGIN + temp_slot + rof_slot.SubIndex;
}
} }
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) { break;
if (rofSlot.Slot < invslot::GENERAL_BEGIN)
return EQEmu::invslot::SLOT_INVALID;
TempSlot = (rofSlot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::GENERAL_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
}
} }
case invtype::typeBank: {
break; if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::BANK_SIZE) {
} if (rof_slot.SubIndex == invbag::SLOT_INVALID) {
case invtype::typeBank: { server_slot = EQEmu::invslot::BANK_BEGIN + rof_slot.Slot;
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::BANK_SIZE) { } else if (rof_slot.SubIndex >= invbag::SLOT_BEGIN && rof_slot.SubIndex <= invbag::SLOT_END) {
if (rofSlot.SubIndex == invbag::SLOT_INVALID) { temp_slot = rof_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invslot::BANK_BEGIN + rofSlot.Slot; server_slot = EQEmu::invbag::BANK_BAGS_BEGIN + temp_slot + rof_slot.SubIndex;
}
} }
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) { break;
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::BANK_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
}
} }
case invtype::typeSharedBank: {
break; if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::SHARED_BANK_SIZE) {
} if (rof_slot.SubIndex == invbag::SLOT_INVALID) {
case invtype::typeSharedBank: { server_slot = EQEmu::invslot::SHARED_BANK_BEGIN + rof_slot.Slot;
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::SHARED_BANK_SIZE) { } else if (rof_slot.SubIndex >= invbag::SLOT_BEGIN && rof_slot.SubIndex <= invbag::SLOT_END) {
if (rofSlot.SubIndex == invbag::SLOT_INVALID) { temp_slot = rof_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rofSlot.Slot; server_slot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + temp_slot + rof_slot.SubIndex;
}
} }
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) { break;
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
}
} }
case invtype::typeTrade: {
break; if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::TRADE_SIZE) {
} if (rof_slot.SubIndex == invbag::SLOT_INVALID) {
case invtype::typeTrade: { server_slot = EQEmu::invslot::TRADE_BEGIN + rof_slot.Slot;
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::TRADE_SIZE) { } else if (rof_slot.SubIndex >= invbag::SLOT_BEGIN && rof_slot.SubIndex <= invbag::SLOT_END) {
if (rofSlot.SubIndex == invbag::SLOT_INVALID) { temp_slot = rof_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invslot::TRADE_BEGIN + rofSlot.Slot; server_slot = EQEmu::invbag::TRADE_BAGS_BEGIN + temp_slot + rof_slot.SubIndex;
}
} }
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) { break;
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT; }
ServerSlot = EQEmu::invbag::TRADE_BAGS_BEGIN + TempSlot + rofSlot.SubIndex; case invtype::typeWorld: {
if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::WORLD_SIZE) {
server_slot = EQEmu::invslot::SHARED_BANK_BEGIN + rof_slot.Slot;
} }
break;
} }
case invtype::typeLimbo: {
if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::LIMBO_SIZE) {
server_slot = EQEmu::invslot::slotCursor;
}
break; break;
}
case invtype::typeWorld: {
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::WORLD_SIZE) {
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rofSlot.Slot;
} }
case invtype::typeTribute: {
if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::TRIBUTE_SIZE) {
server_slot = EQEmu::invslot::TRIBUTE_BEGIN + rof_slot.Slot;
}
break; break;
}
case invtype::typeLimbo: {
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::LIMBO_SIZE) {
ServerSlot = EQEmu::invslot::slotCursor;
} }
case invtype::typeGuildTribute: {
if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::GUILD_TRIBUTE_SIZE) {
server_slot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rof_slot.Slot;
}
break; break;
}
case invtype::typeTribute: {
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::TRIBUTE_SIZE) {
ServerSlot = EQEmu::invslot::TRIBUTE_BEGIN + rofSlot.Slot;
} }
case invtype::typeCorpse: {
if (rof_slot.Slot >= invslot::CORPSE_BEGIN && rof_slot.Slot <= invslot::CORPSE_END) {
server_slot = rof_slot.Slot;
}
break; break;
}
case invtype::typeGuildTribute: {
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::GUILD_TRIBUTE_SIZE) {
ServerSlot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rofSlot.Slot;
} }
default: {
break; break;
}
case invtype::typeCorpse: {
if (rofSlot.Slot >= invslot::CORPSE_BEGIN && rofSlot.Slot <= invslot::CORPSE_END) {
ServerSlot = rofSlot.Slot;
} }
break;
}
default: {
break;
}
} }
Log(Logs::Detail, Logs::Netcode, "Convert RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i", Log(Logs::Detail,
rofSlot.Type, rofSlot.Slot, rofSlot.SubIndex, rofSlot.AugIndex, rofSlot.Unknown02, rofSlot.Unknown01, ServerSlot); Logs::Netcode,
"Convert RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
rof_slot.Type,
rof_slot.Slot,
rof_slot.SubIndex,
rof_slot.AugIndex,
rof_slot.Unknown02,
rof_slot.Unknown01,
server_slot);
return ServerSlot; return server_slot;
} }
static inline uint32 RoFToServerCorpseSlot(structs::InventorySlot_Struct rofCorpseSlot) static inline uint32 RoFToServerCorpseSlot(structs::InventorySlot_Struct rof_corpse_slot)
{ {
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
if (rofCorpseSlot.Type != invtype::typeCorpse || rofCorpseSlot.SubIndex != invbag::SLOT_INVALID || rofCorpseSlot.AugIndex != invaug::SOCKET_INVALID) { if (rof_corpse_slot.Type != invtype::typeCorpse || rof_corpse_slot.SubIndex != invbag::SLOT_INVALID || rof_corpse_slot.AugIndex != invaug::SOCKET_INVALID) {
ServerSlot = EQEmu::invslot::SLOT_INVALID; server_slot = EQEmu::invslot::SLOT_INVALID;
} }
else { else {
ServerSlot = RoFToServerCorpseMainSlot(rofCorpseSlot.Slot); server_slot = RoFToServerCorpseMainSlot(rof_corpse_slot.Slot);
} }
Log(Logs::Detail, Logs::Netcode, "Convert RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i", Log(Logs::Detail,
rofCorpseSlot.Type, rofCorpseSlot.Slot, rofCorpseSlot.SubIndex, rofCorpseSlot.AugIndex, rofCorpseSlot.Unknown02, rofCorpseSlot.Unknown01, ServerSlot); Logs::Netcode,
"Convert RoF Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
rof_corpse_slot.Type,
rof_corpse_slot.Slot,
rof_corpse_slot.SubIndex,
rof_corpse_slot.AugIndex,
rof_corpse_slot.Unknown02,
rof_corpse_slot.Unknown01,
server_slot);
return ServerSlot; return server_slot;
} }
static inline uint32 RoFToServerCorpseMainSlot(uint32 rofCorpseSlot) static inline uint32 RoFToServerCorpseMainSlot(uint32 rof_corpse_slot) {
{ uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
if (rofCorpseSlot <= invslot::CORPSE_END && rofCorpseSlot >= invslot::CORPSE_BEGIN) { if (rof_corpse_slot <= invslot::CORPSE_END && rof_corpse_slot >= invslot::CORPSE_BEGIN) {
ServerSlot = rofCorpseSlot; server_slot = rof_corpse_slot;
} }
Log(Logs::Detail, Logs::Netcode, "Convert RoF Corpse Main Slot %i to Server Corpse Slot %i", rofCorpseSlot, ServerSlot); Log(Logs::Detail,
Logs::Netcode,
"Convert RoF Corpse Main Slot %i to Server Corpse Slot %i",
rof_corpse_slot,
server_slot);
return ServerSlot; return server_slot;
} }
static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rofSlot, int16 rofType) static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof_slot, int16 rof_type) {
{
if (rofSlot.AugIndex < invaug::SOCKET_INVALID || rofSlot.AugIndex >= invaug::SOCKET_COUNT) {
Log(Logs::Detail, Logs::Netcode, "Convert RoF Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i",
rofSlot.Slot, rofSlot.SubIndex, rofSlot.AugIndex, rofType, rofSlot.Unknown01, EQEmu::invslot::SLOT_INVALID);
return EQEmu::invslot::SLOT_INVALID; if (rof_slot.AugIndex < invaug::SOCKET_INVALID || rof_slot.AugIndex >= invaug::SOCKET_COUNT) {
Log(Logs::Detail,
Logs::Netcode,
"Convert RoF Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i",
rof_slot.Slot,
rof_slot.SubIndex,
rof_slot.AugIndex,
rof_type,
rof_slot.Unknown01,
EQEmu::invslot::SLOT_INVALID);
return (uint32) EQEmu::invslot::SLOT_INVALID;
} }
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
uint32 TempSlot = invslot::SLOT_INVALID; uint32 temp_slot = invslot::SLOT_INVALID;
switch (rofType) { switch (rof_type) {
case invtype::typePossessions: { case invtype::typePossessions: {
if (rofSlot.Slot >= invslot::POSSESSIONS_BEGIN && rofSlot.Slot <= invslot::POSSESSIONS_END) { if (rof_slot.Slot >= invslot::POSSESSIONS_BEGIN && rof_slot.Slot <= invslot::POSSESSIONS_END) {
if (rofSlot.SubIndex == invbag::SLOT_INVALID) { if (rof_slot.SubIndex == invbag::SLOT_INVALID) {
ServerSlot = rofSlot.Slot; server_slot = rof_slot.Slot;
} else if (rof_slot.SubIndex >= invbag::SLOT_BEGIN && rof_slot.SubIndex <= invbag::SLOT_END) {
if (rof_slot.Slot < invslot::GENERAL_BEGIN)
return EQEmu::invslot::SLOT_INVALID;
temp_slot = (rof_slot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT;
server_slot = EQEmu::invbag::GENERAL_BAGS_BEGIN + temp_slot + rof_slot.SubIndex;
}
} }
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) { break;
if (rofSlot.Slot < invslot::GENERAL_BEGIN)
return EQEmu::invslot::SLOT_INVALID;
TempSlot = (rofSlot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::GENERAL_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
}
} }
case invtype::typeBank: {
break; if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::BANK_SIZE) {
} if (rof_slot.SubIndex == invbag::SLOT_INVALID) {
case invtype::typeBank: { server_slot = EQEmu::invslot::BANK_BEGIN + rof_slot.Slot;
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::BANK_SIZE) { } else if (rof_slot.SubIndex >= invbag::SLOT_BEGIN && rof_slot.SubIndex <= invbag::SLOT_END) {
if (rofSlot.SubIndex == invbag::SLOT_INVALID) { temp_slot = rof_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invslot::BANK_BEGIN + rofSlot.Slot; server_slot = EQEmu::invbag::BANK_BAGS_BEGIN + temp_slot + rof_slot.SubIndex;
}
} }
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) { break;
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::BANK_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
}
} }
case invtype::typeSharedBank: {
break; if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::SHARED_BANK_SIZE) {
} if (rof_slot.SubIndex == invbag::SLOT_INVALID) {
case invtype::typeSharedBank: { server_slot = EQEmu::invslot::SHARED_BANK_BEGIN + rof_slot.Slot;
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::SHARED_BANK_SIZE) { } else if (rof_slot.SubIndex >= invbag::SLOT_BEGIN && rof_slot.SubIndex <= invbag::SLOT_END) {
if (rofSlot.SubIndex == invbag::SLOT_INVALID) { temp_slot = rof_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rofSlot.Slot; server_slot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + temp_slot + rof_slot.SubIndex;
}
} }
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) { break;
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + TempSlot + rofSlot.SubIndex;
}
} }
case invtype::typeTrade: {
break; if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::TRADE_SIZE) {
} if (rof_slot.SubIndex == invbag::SLOT_INVALID) {
case invtype::typeTrade: { server_slot = EQEmu::invslot::TRADE_BEGIN + rof_slot.Slot;
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::TRADE_SIZE) { } else if (rof_slot.SubIndex >= invbag::SLOT_BEGIN && rof_slot.SubIndex <= invbag::SLOT_END) {
if (rofSlot.SubIndex == invbag::SLOT_INVALID) { temp_slot = rof_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invslot::TRADE_BEGIN + rofSlot.Slot; server_slot = EQEmu::invbag::TRADE_BAGS_BEGIN + temp_slot + rof_slot.SubIndex;
}
} }
else if (rofSlot.SubIndex >= invbag::SLOT_BEGIN && rofSlot.SubIndex <= invbag::SLOT_END) { break;
TempSlot = rofSlot.Slot * invbag::SLOT_COUNT; }
ServerSlot = EQEmu::invbag::TRADE_BAGS_BEGIN + TempSlot + rofSlot.SubIndex; case invtype::typeWorld: {
if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::WORLD_SIZE) {
server_slot = EQEmu::invslot::SHARED_BANK_BEGIN + rof_slot.Slot;
} }
break;
} }
case invtype::typeLimbo: {
if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::LIMBO_SIZE) {
server_slot = EQEmu::invslot::slotCursor;
}
break; break;
}
case invtype::typeWorld: {
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::WORLD_SIZE) {
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rofSlot.Slot;
} }
case invtype::typeTribute: {
if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::TRIBUTE_SIZE) {
server_slot = EQEmu::invslot::TRIBUTE_BEGIN + rof_slot.Slot;
}
break; break;
}
case invtype::typeLimbo: {
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::LIMBO_SIZE) {
ServerSlot = EQEmu::invslot::slotCursor;
} }
case invtype::typeGuildTribute: {
if (rof_slot.Slot >= invslot::SLOT_BEGIN && rof_slot.Slot < invtype::GUILD_TRIBUTE_SIZE) {
server_slot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rof_slot.Slot;
}
break; break;
}
case invtype::typeTribute: {
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::TRIBUTE_SIZE) {
ServerSlot = EQEmu::invslot::TRIBUTE_BEGIN + rofSlot.Slot;
} }
case invtype::typeCorpse: {
if (rof_slot.Slot >= invslot::CORPSE_BEGIN && rof_slot.Slot <= invslot::CORPSE_END) {
server_slot = rof_slot.Slot;
}
break; break;
}
case invtype::typeGuildTribute: {
if (rofSlot.Slot >= invslot::SLOT_BEGIN && rofSlot.Slot < invtype::GUILD_TRIBUTE_SIZE) {
ServerSlot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rofSlot.Slot;
} }
default: {
break; break;
}
case invtype::typeCorpse: {
if (rofSlot.Slot >= invslot::CORPSE_BEGIN && rofSlot.Slot <= invslot::CORPSE_END) {
ServerSlot = rofSlot.Slot;
} }
break;
}
default: {
break;
}
} }
Log(Logs::Detail, Logs::Netcode, "Convert RoF Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i", Log(Logs::Detail,
rofSlot.Slot, rofSlot.SubIndex, rofSlot.AugIndex, rofType, rofSlot.Unknown01, ServerSlot); Logs::Netcode,
"Convert RoF Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i",
rof_slot.Slot,
rof_slot.SubIndex,
rof_slot.AugIndex,
rof_type,
rof_slot.Unknown01,
server_slot);
return ServerSlot; return server_slot;
} }
static inline void ServerToRoFSayLink(std::string& rofSayLink, const std::string& serverSayLink) static inline void ServerToRoFSayLink(std::string& rofSayLink, const std::string& serverSayLink)

View File

@ -48,22 +48,22 @@ namespace RoF2
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth, ItemPacketType packet_type); void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth, ItemPacketType packet_type);
// server to client inventory location converters // server to client inventory location converters
static inline structs::InventorySlot_Struct ServerToRoF2Slot(uint32 serverSlot); static inline structs::InventorySlot_Struct ServerToRoF2Slot(uint32 server_slot);
static inline structs::InventorySlot_Struct ServerToRoF2CorpseSlot(uint32 serverCorpseSlot); static inline structs::InventorySlot_Struct ServerToRoF2CorpseSlot(uint32 server_corpse_slot);
static inline uint32 ServerToRoF2CorpseMainSlot(uint32 serverCorpseSlot); static inline uint32 ServerToRoF2CorpseMainSlot(uint32 server_corpse_slot);
static inline structs::TypelessInventorySlot_Struct ServerToRoF2TypelessSlot(uint32 serverSlot, int16 serverType); static inline structs::TypelessInventorySlot_Struct ServerToRoF2TypelessSlot(uint32 server_slot, int16 server_type);
// client to server inventory location converters // client to server inventory location converters
static inline uint32 RoF2ToServerSlot(structs::InventorySlot_Struct rof2Slot); static inline uint32 RoF2ToServerSlot(structs::InventorySlot_Struct rof2_slot);
static inline uint32 RoF2ToServerCorpseSlot(structs::InventorySlot_Struct rof2CorpseSlot); static inline uint32 RoF2ToServerCorpseSlot(structs::InventorySlot_Struct rof2_corpse_slot);
static inline uint32 RoF2ToServerCorpseMainSlot(uint32 rof2CorpseSlot); static inline uint32 RoF2ToServerCorpseMainSlot(uint32 rof2_corpse_slot);
static inline uint32 RoF2ToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof2Slot, int16 rof2Type); static inline uint32 RoF2ToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof2_slot, int16 rof2_type);
// server to client say link converter // server to client say link converter
static inline void ServerToRoF2SayLink(std::string& rof2SayLink, const std::string& serverSayLink); static inline void ServerToRoF2SayLink(std::string &rof2_saylink, const std::string &server_saylink);
// client to server say link converter // client to server say link converter
static inline void RoF2ToServerSayLink(std::string& serverSayLink, const std::string& rof2SayLink); static inline void RoF2ToServerSayLink(std::string &server_saylink, const std::string &rof2_saylink);
static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot); static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot); static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot);
@ -5852,7 +5852,7 @@ namespace RoF2
} }
} }
static inline structs::InventorySlot_Struct ServerToRoF2Slot(uint32 serverSlot) static inline structs::InventorySlot_Struct ServerToRoF2Slot(uint32 server_slot)
{ {
structs::InventorySlot_Struct RoF2Slot; structs::InventorySlot_Struct RoF2Slot;
RoF2Slot.Type = invtype::TYPE_INVALID; RoF2Slot.Type = invtype::TYPE_INVALID;
@ -5864,85 +5864,85 @@ namespace RoF2
uint32 TempSlot = EQEmu::invslot::SLOT_INVALID; uint32 TempSlot = EQEmu::invslot::SLOT_INVALID;
if (serverSlot < EQEmu::invtype::POSSESSIONS_SIZE) { if (server_slot < EQEmu::invtype::POSSESSIONS_SIZE) {
RoF2Slot.Type = invtype::typePossessions; RoF2Slot.Type = invtype::typePossessions;
RoF2Slot.Slot = serverSlot; RoF2Slot.Slot = server_slot;
} }
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::CURSOR_BAG_END && server_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
TempSlot = serverSlot - EQEmu::invbag::GENERAL_BAGS_BEGIN; TempSlot = server_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN;
RoF2Slot.Type = invtype::typePossessions; RoF2Slot.Type = invtype::typePossessions;
RoF2Slot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT); RoF2Slot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT);
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT); RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
} }
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) { else if (server_slot <= EQEmu::invslot::TRIBUTE_END && server_slot >= EQEmu::invslot::TRIBUTE_BEGIN) {
RoF2Slot.Type = invtype::typeTribute; RoF2Slot.Type = invtype::typeTribute;
RoF2Slot.Slot = serverSlot - EQEmu::invslot::TRIBUTE_BEGIN; RoF2Slot.Slot = server_slot - EQEmu::invslot::TRIBUTE_BEGIN;
} }
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) { else if (server_slot <= EQEmu::invslot::GUILD_TRIBUTE_END && server_slot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
RoF2Slot.Type = invtype::typeGuildTribute; RoF2Slot.Type = invtype::typeGuildTribute;
RoF2Slot.Slot = serverSlot - EQEmu::invslot::GUILD_TRIBUTE_BEGIN; RoF2Slot.Slot = server_slot - EQEmu::invslot::GUILD_TRIBUTE_BEGIN;
} }
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) { else if (server_slot <= EQEmu::invslot::BANK_END && server_slot >= EQEmu::invslot::BANK_BEGIN) {
RoF2Slot.Type = invtype::typeBank; RoF2Slot.Type = invtype::typeBank;
RoF2Slot.Slot = serverSlot - EQEmu::invslot::BANK_BEGIN; RoF2Slot.Slot = server_slot - EQEmu::invslot::BANK_BEGIN;
} }
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::BANK_BAGS_END && server_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
TempSlot = serverSlot - EQEmu::invbag::BANK_BAGS_BEGIN; TempSlot = server_slot - EQEmu::invbag::BANK_BAGS_BEGIN;
RoF2Slot.Type = invtype::typeBank; RoF2Slot.Type = invtype::typeBank;
RoF2Slot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT; RoF2Slot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT;
RoF2Slot.SubIndex = TempSlot - (RoF2Slot.Slot * EQEmu::invbag::SLOT_COUNT); RoF2Slot.SubIndex = TempSlot - (RoF2Slot.Slot * EQEmu::invbag::SLOT_COUNT);
} }
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) { else if (server_slot <= EQEmu::invslot::SHARED_BANK_END && server_slot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
RoF2Slot.Type = invtype::typeSharedBank; RoF2Slot.Type = invtype::typeSharedBank;
RoF2Slot.Slot = serverSlot - EQEmu::invslot::SHARED_BANK_BEGIN; RoF2Slot.Slot = server_slot - EQEmu::invslot::SHARED_BANK_BEGIN;
} }
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::SHARED_BANK_BAGS_END && server_slot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
TempSlot = serverSlot - EQEmu::invbag::SHARED_BANK_BAGS_BEGIN; TempSlot = server_slot - EQEmu::invbag::SHARED_BANK_BAGS_BEGIN;
RoF2Slot.Type = invtype::typeSharedBank; RoF2Slot.Type = invtype::typeSharedBank;
RoF2Slot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT; RoF2Slot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT;
RoF2Slot.SubIndex = TempSlot - (RoF2Slot.Slot * EQEmu::invbag::SLOT_COUNT); RoF2Slot.SubIndex = TempSlot - (RoF2Slot.Slot * EQEmu::invbag::SLOT_COUNT);
} }
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) { else if (server_slot <= EQEmu::invslot::TRADE_END && server_slot >= EQEmu::invslot::TRADE_BEGIN) {
RoF2Slot.Type = invtype::typeTrade; RoF2Slot.Type = invtype::typeTrade;
RoF2Slot.Slot = serverSlot - EQEmu::invslot::TRADE_BEGIN; RoF2Slot.Slot = server_slot - EQEmu::invslot::TRADE_BEGIN;
} }
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::TRADE_BAGS_END && server_slot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
TempSlot = serverSlot - EQEmu::invbag::TRADE_BAGS_BEGIN; TempSlot = server_slot - EQEmu::invbag::TRADE_BAGS_BEGIN;
RoF2Slot.Type = invtype::typeTrade; RoF2Slot.Type = invtype::typeTrade;
RoF2Slot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT; RoF2Slot.Slot = TempSlot / EQEmu::invbag::SLOT_COUNT;
RoF2Slot.SubIndex = TempSlot - (RoF2Slot.Slot * EQEmu::invbag::SLOT_COUNT); RoF2Slot.SubIndex = TempSlot - (RoF2Slot.Slot * EQEmu::invbag::SLOT_COUNT);
} }
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) { else if (server_slot <= EQEmu::invslot::WORLD_END && server_slot >= EQEmu::invslot::WORLD_BEGIN) {
RoF2Slot.Type = invtype::typeWorld; RoF2Slot.Type = invtype::typeWorld;
RoF2Slot.Slot = serverSlot - EQEmu::invslot::WORLD_BEGIN; RoF2Slot.Slot = server_slot - EQEmu::invslot::WORLD_BEGIN;
} }
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)", Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)",
serverSlot, RoF2Slot.Type, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown02, RoF2Slot.Unknown01); server_slot, RoF2Slot.Type, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown02, RoF2Slot.Unknown01);
return RoF2Slot; return RoF2Slot;
} }
static inline structs::InventorySlot_Struct ServerToRoF2CorpseSlot(uint32 serverCorpseSlot) static inline structs::InventorySlot_Struct ServerToRoF2CorpseSlot(uint32 server_corpse_slot)
{ {
structs::InventorySlot_Struct RoF2Slot; structs::InventorySlot_Struct RoF2Slot;
RoF2Slot.Type = invtype::TYPE_INVALID; RoF2Slot.Type = invtype::TYPE_INVALID;
RoF2Slot.Unknown02 = INULL; RoF2Slot.Unknown02 = INULL;
RoF2Slot.Slot = ServerToRoF2CorpseMainSlot(serverCorpseSlot); RoF2Slot.Slot = ServerToRoF2CorpseMainSlot(server_corpse_slot);
RoF2Slot.SubIndex = invbag::SLOT_INVALID; RoF2Slot.SubIndex = invbag::SLOT_INVALID;
RoF2Slot.AugIndex = invaug::SOCKET_INVALID; RoF2Slot.AugIndex = invaug::SOCKET_INVALID;
RoF2Slot.Unknown01 = INULL; RoF2Slot.Unknown01 = INULL;
@ -5951,25 +5951,25 @@ namespace RoF2
RoF2Slot.Type = invtype::typeCorpse; RoF2Slot.Type = invtype::typeCorpse;
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF2 Corpse Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)", Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF2 Corpse Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i)",
serverCorpseSlot, RoF2Slot.Type, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown02, RoF2Slot.Unknown01); server_corpse_slot, RoF2Slot.Type, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown02, RoF2Slot.Unknown01);
return RoF2Slot; return RoF2Slot;
} }
static inline uint32 ServerToRoF2CorpseMainSlot(uint32 serverCorpseSlot) static inline uint32 ServerToRoF2CorpseMainSlot(uint32 server_corpse_slot)
{ {
uint32 RoF2Slot = invslot::SLOT_INVALID; uint32 RoF2Slot = invslot::SLOT_INVALID;
if (serverCorpseSlot <= EQEmu::invslot::CORPSE_END && serverCorpseSlot >= EQEmu::invslot::CORPSE_BEGIN) { if (server_corpse_slot <= EQEmu::invslot::CORPSE_END && server_corpse_slot >= EQEmu::invslot::CORPSE_BEGIN) {
RoF2Slot = serverCorpseSlot; RoF2Slot = server_corpse_slot;
} }
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF2 Corpse Main Slot %i", serverCorpseSlot, RoF2Slot); Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to RoF2 Corpse Main Slot %i", server_corpse_slot, RoF2Slot);
return RoF2Slot; return RoF2Slot;
} }
static inline structs::TypelessInventorySlot_Struct ServerToRoF2TypelessSlot(uint32 serverSlot, int16 serverType) static inline structs::TypelessInventorySlot_Struct ServerToRoF2TypelessSlot(uint32 server_slot, int16 server_type)
{ {
structs::TypelessInventorySlot_Struct RoF2Slot; structs::TypelessInventorySlot_Struct RoF2Slot;
RoF2Slot.Slot = invslot::SLOT_INVALID; RoF2Slot.Slot = invslot::SLOT_INVALID;
@ -5979,13 +5979,13 @@ namespace RoF2
uint32 TempSlot = EQEmu::invslot::SLOT_INVALID; uint32 TempSlot = EQEmu::invslot::SLOT_INVALID;
if (serverType == EQEmu::invtype::typePossessions) { if (server_type == EQEmu::invtype::typePossessions) {
if (serverSlot < EQEmu::invtype::POSSESSIONS_SIZE) { if (server_slot < EQEmu::invtype::POSSESSIONS_SIZE) {
RoF2Slot.Slot = serverSlot; RoF2Slot.Slot = server_slot;
} }
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::CURSOR_BAG_END && server_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
TempSlot = serverSlot - EQEmu::invbag::GENERAL_BAGS_BEGIN; TempSlot = server_slot - EQEmu::invbag::GENERAL_BAGS_BEGIN;
RoF2Slot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT); RoF2Slot.Slot = invslot::GENERAL_BEGIN + (TempSlot / EQEmu::invbag::SLOT_COUNT);
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT); RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot - invslot::GENERAL_BEGIN) * EQEmu::invbag::SLOT_COUNT);
@ -5993,114 +5993,114 @@ namespace RoF2
} }
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF2 Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i)", Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to RoF2 Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i)",
serverSlot, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, serverType, RoF2Slot.Unknown01); server_slot, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, server_type, RoF2Slot.Unknown01);
return RoF2Slot; return RoF2Slot;
} }
static inline uint32 RoF2ToServerSlot(structs::InventorySlot_Struct rof2Slot) static inline uint32 RoF2ToServerSlot(structs::InventorySlot_Struct rof2_slot)
{ {
if (rof2Slot.AugIndex < invaug::SOCKET_INVALID || rof2Slot.AugIndex >= invaug::SOCKET_COUNT) { if (rof2_slot.AugIndex < invaug::SOCKET_INVALID || rof2_slot.AugIndex >= invaug::SOCKET_COUNT) {
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i", Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
rof2Slot.Type, rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Slot.Unknown02, rof2Slot.Unknown01, EQEmu::invslot::SLOT_INVALID); rof2_slot.Type, rof2_slot.Slot, rof2_slot.SubIndex, rof2_slot.AugIndex, rof2_slot.Unknown02, rof2_slot.Unknown01, EQEmu::invslot::SLOT_INVALID);
return EQEmu::invslot::SLOT_INVALID; return EQEmu::invslot::SLOT_INVALID;
} }
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
uint32 TempSlot = invslot::SLOT_INVALID; uint32 temp_slot = invslot::SLOT_INVALID;
switch (rof2Slot.Type) { switch (rof2_slot.Type) {
case invtype::typePossessions: { case invtype::typePossessions: {
if (rof2Slot.Slot >= invslot::POSSESSIONS_BEGIN && rof2Slot.Slot <= invslot::POSSESSIONS_END) { if (rof2_slot.Slot >= invslot::POSSESSIONS_BEGIN && rof2_slot.Slot <= invslot::POSSESSIONS_END) {
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) { if (rof2_slot.SubIndex == invbag::SLOT_INVALID) {
ServerSlot = rof2Slot.Slot; server_slot = rof2_slot.Slot;
} }
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) { else if (rof2_slot.SubIndex >= invbag::SLOT_BEGIN && rof2_slot.SubIndex <= invbag::SLOT_END) {
if (rof2Slot.Slot < invslot::GENERAL_BEGIN) if (rof2_slot.Slot < invslot::GENERAL_BEGIN)
return EQEmu::invslot::SLOT_INVALID; return EQEmu::invslot::SLOT_INVALID;
TempSlot = (rof2Slot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT; temp_slot = (rof2_slot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::GENERAL_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex; server_slot = EQEmu::invbag::GENERAL_BAGS_BEGIN + temp_slot + rof2_slot.SubIndex;
} }
} }
break; break;
} }
case invtype::typeBank: { case invtype::typeBank: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::BANK_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::BANK_SIZE) {
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) { if (rof2_slot.SubIndex == invbag::SLOT_INVALID) {
ServerSlot = EQEmu::invslot::BANK_BEGIN + rof2Slot.Slot; server_slot = EQEmu::invslot::BANK_BEGIN + rof2_slot.Slot;
} }
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) { else if (rof2_slot.SubIndex >= invbag::SLOT_BEGIN && rof2_slot.SubIndex <= invbag::SLOT_END) {
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT; temp_slot = rof2_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::BANK_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex; server_slot = EQEmu::invbag::BANK_BAGS_BEGIN + temp_slot + rof2_slot.SubIndex;
} }
} }
break; break;
} }
case invtype::typeSharedBank: { case invtype::typeSharedBank: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::SHARED_BANK_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::SHARED_BANK_SIZE) {
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) { if (rof2_slot.SubIndex == invbag::SLOT_INVALID) {
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2Slot.Slot; server_slot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2_slot.Slot;
} }
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) { else if (rof2_slot.SubIndex >= invbag::SLOT_BEGIN && rof2_slot.SubIndex <= invbag::SLOT_END) {
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT; temp_slot = rof2_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex; server_slot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + temp_slot + rof2_slot.SubIndex;
} }
} }
break; break;
} }
case invtype::typeTrade: { case invtype::typeTrade: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::TRADE_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::TRADE_SIZE) {
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) { if (rof2_slot.SubIndex == invbag::SLOT_INVALID) {
ServerSlot = EQEmu::invslot::TRADE_BEGIN + rof2Slot.Slot; server_slot = EQEmu::invslot::TRADE_BEGIN + rof2_slot.Slot;
} }
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) { else if (rof2_slot.SubIndex >= invbag::SLOT_BEGIN && rof2_slot.SubIndex <= invbag::SLOT_END) {
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT; temp_slot = rof2_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::TRADE_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex; server_slot = EQEmu::invbag::TRADE_BAGS_BEGIN + temp_slot + rof2_slot.SubIndex;
} }
} }
break; break;
} }
case invtype::typeWorld: { case invtype::typeWorld: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::WORLD_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::WORLD_SIZE) {
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2Slot.Slot; server_slot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2_slot.Slot;
} }
break; break;
} }
case invtype::typeLimbo: { case invtype::typeLimbo: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::LIMBO_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::LIMBO_SIZE) {
ServerSlot = EQEmu::invslot::slotCursor; server_slot = EQEmu::invslot::slotCursor;
} }
break; break;
} }
case invtype::typeTribute: { case invtype::typeTribute: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::TRIBUTE_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::TRIBUTE_SIZE) {
ServerSlot = EQEmu::invslot::TRIBUTE_BEGIN + rof2Slot.Slot; server_slot = EQEmu::invslot::TRIBUTE_BEGIN + rof2_slot.Slot;
} }
break; break;
} }
case invtype::typeGuildTribute: { case invtype::typeGuildTribute: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::GUILD_TRIBUTE_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::GUILD_TRIBUTE_SIZE) {
ServerSlot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rof2Slot.Slot; server_slot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rof2_slot.Slot;
} }
break; break;
} }
case invtype::typeCorpse: { case invtype::typeCorpse: {
if (rof2Slot.Slot >= invslot::CORPSE_BEGIN && rof2Slot.Slot <= invslot::CORPSE_END) { if (rof2_slot.Slot >= invslot::CORPSE_BEGIN && rof2_slot.Slot <= invslot::CORPSE_END) {
ServerSlot = rof2Slot.Slot; server_slot = rof2_slot.Slot;
} }
break; break;
@ -6112,47 +6112,47 @@ namespace RoF2
} }
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i", Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
rof2Slot.Type, rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Slot.Unknown02, rof2Slot.Unknown01, ServerSlot); rof2_slot.Type, rof2_slot.Slot, rof2_slot.SubIndex, rof2_slot.AugIndex, rof2_slot.Unknown02, rof2_slot.Unknown01, server_slot);
return ServerSlot; return server_slot;
} }
static inline uint32 RoF2ToServerCorpseSlot(structs::InventorySlot_Struct rof2CorpseSlot) static inline uint32 RoF2ToServerCorpseSlot(structs::InventorySlot_Struct rof2_corpse_slot)
{ {
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
if (rof2CorpseSlot.Type != invtype::typeCorpse || rof2CorpseSlot.SubIndex != invbag::SLOT_INVALID || rof2CorpseSlot.AugIndex != invaug::SOCKET_INVALID) { if (rof2_corpse_slot.Type != invtype::typeCorpse || rof2_corpse_slot.SubIndex != invbag::SLOT_INVALID || rof2_corpse_slot.AugIndex != invaug::SOCKET_INVALID) {
ServerSlot = EQEmu::invslot::SLOT_INVALID; ServerSlot = EQEmu::invslot::SLOT_INVALID;
} }
else { else {
ServerSlot = RoF2ToServerCorpseMainSlot(rof2CorpseSlot.Slot); ServerSlot = RoF2ToServerCorpseMainSlot(rof2_corpse_slot.Slot);
} }
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i", Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Slot [%i, %i, %i, %i] (unk2: %i, unk1: %i) to Server Slot %i",
rof2CorpseSlot.Type, rof2CorpseSlot.Slot, rof2CorpseSlot.SubIndex, rof2CorpseSlot.AugIndex, rof2CorpseSlot.Unknown02, rof2CorpseSlot.Unknown01, ServerSlot); rof2_corpse_slot.Type, rof2_corpse_slot.Slot, rof2_corpse_slot.SubIndex, rof2_corpse_slot.AugIndex, rof2_corpse_slot.Unknown02, rof2_corpse_slot.Unknown01, ServerSlot);
return ServerSlot; return ServerSlot;
} }
static inline uint32 RoF2ToServerCorpseMainSlot(uint32 rof2CorpseSlot) static inline uint32 RoF2ToServerCorpseMainSlot(uint32 rof2_corpse_slot)
{ {
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
if (rof2CorpseSlot <= invslot::CORPSE_END && rof2CorpseSlot >= invslot::CORPSE_BEGIN) { if (rof2_corpse_slot <= invslot::CORPSE_END && rof2_corpse_slot >= invslot::CORPSE_BEGIN) {
ServerSlot = rof2CorpseSlot; ServerSlot = rof2_corpse_slot;
} }
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Corpse Main Slot %i to Server Corpse Slot %i", rof2CorpseSlot, ServerSlot); Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Corpse Main Slot %i to Server Corpse Slot %i", rof2_corpse_slot, ServerSlot);
return ServerSlot; return ServerSlot;
} }
static inline uint32 RoF2ToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof2Slot, int16 rof2Type) static inline uint32 RoF2ToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof2_slot, int16 rof2_type)
{ {
if (rof2Slot.AugIndex < invaug::SOCKET_INVALID || rof2Slot.AugIndex >= invaug::SOCKET_COUNT) { if (rof2_slot.AugIndex < invaug::SOCKET_INVALID || rof2_slot.AugIndex >= invaug::SOCKET_COUNT) {
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i", Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i",
rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Type, rof2Slot.Unknown01, EQEmu::invslot::SLOT_INVALID); rof2_slot.Slot, rof2_slot.SubIndex, rof2_slot.AugIndex, rof2_type, rof2_slot.Unknown01, EQEmu::invslot::SLOT_INVALID);
return EQEmu::invslot::SLOT_INVALID; return EQEmu::invslot::SLOT_INVALID;
} }
@ -6160,97 +6160,97 @@ namespace RoF2
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
uint32 TempSlot = invslot::SLOT_INVALID; uint32 TempSlot = invslot::SLOT_INVALID;
switch (rof2Type) { switch (rof2_type) {
case invtype::typePossessions: { case invtype::typePossessions: {
if (rof2Slot.Slot >= invslot::POSSESSIONS_BEGIN && rof2Slot.Slot <= invslot::POSSESSIONS_END) { if (rof2_slot.Slot >= invslot::POSSESSIONS_BEGIN && rof2_slot.Slot <= invslot::POSSESSIONS_END) {
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) { if (rof2_slot.SubIndex == invbag::SLOT_INVALID) {
ServerSlot = rof2Slot.Slot; ServerSlot = rof2_slot.Slot;
} }
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) { else if (rof2_slot.SubIndex >= invbag::SLOT_BEGIN && rof2_slot.SubIndex <= invbag::SLOT_END) {
if (rof2Slot.Slot < invslot::GENERAL_BEGIN) if (rof2_slot.Slot < invslot::GENERAL_BEGIN)
return EQEmu::invslot::SLOT_INVALID; return EQEmu::invslot::SLOT_INVALID;
TempSlot = (rof2Slot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT; TempSlot = (rof2_slot.Slot - invslot::GENERAL_BEGIN) * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::GENERAL_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex; ServerSlot = EQEmu::invbag::GENERAL_BAGS_BEGIN + TempSlot + rof2_slot.SubIndex;
} }
} }
break; break;
} }
case invtype::typeBank: { case invtype::typeBank: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::BANK_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::BANK_SIZE) {
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) { if (rof2_slot.SubIndex == invbag::SLOT_INVALID) {
ServerSlot = EQEmu::invslot::BANK_BEGIN + rof2Slot.Slot; ServerSlot = EQEmu::invslot::BANK_BEGIN + rof2_slot.Slot;
} }
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) { else if (rof2_slot.SubIndex >= invbag::SLOT_BEGIN && rof2_slot.SubIndex <= invbag::SLOT_END) {
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT; TempSlot = rof2_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::BANK_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex; ServerSlot = EQEmu::invbag::BANK_BAGS_BEGIN + TempSlot + rof2_slot.SubIndex;
} }
} }
break; break;
} }
case invtype::typeSharedBank: { case invtype::typeSharedBank: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::SHARED_BANK_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::SHARED_BANK_SIZE) {
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) { if (rof2_slot.SubIndex == invbag::SLOT_INVALID) {
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2Slot.Slot; ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2_slot.Slot;
} }
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) { else if (rof2_slot.SubIndex >= invbag::SLOT_BEGIN && rof2_slot.SubIndex <= invbag::SLOT_END) {
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT; TempSlot = rof2_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex; ServerSlot = EQEmu::invbag::SHARED_BANK_BAGS_BEGIN + TempSlot + rof2_slot.SubIndex;
} }
} }
break; break;
} }
case invtype::typeTrade: { case invtype::typeTrade: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::TRADE_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::TRADE_SIZE) {
if (rof2Slot.SubIndex == invbag::SLOT_INVALID) { if (rof2_slot.SubIndex == invbag::SLOT_INVALID) {
ServerSlot = EQEmu::invslot::TRADE_BEGIN + rof2Slot.Slot; ServerSlot = EQEmu::invslot::TRADE_BEGIN + rof2_slot.Slot;
} }
else if (rof2Slot.SubIndex >= invbag::SLOT_BEGIN && rof2Slot.SubIndex <= invbag::SLOT_END) { else if (rof2_slot.SubIndex >= invbag::SLOT_BEGIN && rof2_slot.SubIndex <= invbag::SLOT_END) {
TempSlot = rof2Slot.Slot * invbag::SLOT_COUNT; TempSlot = rof2_slot.Slot * invbag::SLOT_COUNT;
ServerSlot = EQEmu::invbag::TRADE_BAGS_BEGIN + TempSlot + rof2Slot.SubIndex; ServerSlot = EQEmu::invbag::TRADE_BAGS_BEGIN + TempSlot + rof2_slot.SubIndex;
} }
} }
break; break;
} }
case invtype::typeWorld: { case invtype::typeWorld: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::WORLD_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::WORLD_SIZE) {
ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2Slot.Slot; ServerSlot = EQEmu::invslot::SHARED_BANK_BEGIN + rof2_slot.Slot;
} }
break; break;
} }
case invtype::typeLimbo: { case invtype::typeLimbo: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::LIMBO_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::LIMBO_SIZE) {
ServerSlot = EQEmu::invslot::slotCursor; ServerSlot = EQEmu::invslot::slotCursor;
} }
break; break;
} }
case invtype::typeTribute: { case invtype::typeTribute: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::TRIBUTE_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::TRIBUTE_SIZE) {
ServerSlot = EQEmu::invslot::TRIBUTE_BEGIN + rof2Slot.Slot; ServerSlot = EQEmu::invslot::TRIBUTE_BEGIN + rof2_slot.Slot;
} }
break; break;
} }
case invtype::typeGuildTribute: { case invtype::typeGuildTribute: {
if (rof2Slot.Slot >= invslot::SLOT_BEGIN && rof2Slot.Slot < invtype::GUILD_TRIBUTE_SIZE) { if (rof2_slot.Slot >= invslot::SLOT_BEGIN && rof2_slot.Slot < invtype::GUILD_TRIBUTE_SIZE) {
ServerSlot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rof2Slot.Slot; ServerSlot = EQEmu::invslot::GUILD_TRIBUTE_BEGIN + rof2_slot.Slot;
} }
break; break;
} }
case invtype::typeCorpse: { case invtype::typeCorpse: {
if (rof2Slot.Slot >= invslot::CORPSE_BEGIN && rof2Slot.Slot <= invslot::CORPSE_END) { if (rof2_slot.Slot >= invslot::CORPSE_BEGIN && rof2_slot.Slot <= invslot::CORPSE_END) {
ServerSlot = rof2Slot.Slot; ServerSlot = rof2_slot.Slot;
} }
break; break;
@ -6262,24 +6262,24 @@ namespace RoF2
} }
Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i", Log(Logs::Detail, Logs::Netcode, "Convert RoF2 Typeless Slot [%i, %i, %i] (implied type: %i, unk1: %i) to Server Slot %i",
rof2Slot.Slot, rof2Slot.SubIndex, rof2Slot.AugIndex, rof2Type, rof2Slot.Unknown01, ServerSlot); rof2_slot.Slot, rof2_slot.SubIndex, rof2_slot.AugIndex, rof2_type, rof2_slot.Unknown01, ServerSlot);
return ServerSlot; return ServerSlot;
} }
static inline void ServerToRoF2SayLink(std::string& rof2SayLink, const std::string& serverSayLink) static inline void ServerToRoF2SayLink(std::string &rof2_saylink, const std::string &server_saylink)
{ {
if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) { if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (server_saylink.find('\x12') == std::string::npos)) {
rof2SayLink = serverSayLink; rof2_saylink = server_saylink;
return; return;
} }
auto segments = SplitString(serverSayLink, '\x12'); auto segments = SplitString(server_saylink, '\x12');
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) { if (segment_iter & 1) {
if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) { if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) {
rof2SayLink.append(segments[segment_iter]); rof2_saylink.append(segments[segment_iter]);
// TODO: log size mismatch error // TODO: log size mismatch error
continue; continue;
} }
@ -6289,29 +6289,29 @@ namespace RoF2
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
// Diff: // Diff:
rof2SayLink.push_back('\x12'); rof2_saylink.push_back('\x12');
rof2SayLink.append(segments[segment_iter]); rof2_saylink.append(segments[segment_iter]);
rof2SayLink.push_back('\x12'); rof2_saylink.push_back('\x12');
} }
else { else {
rof2SayLink.append(segments[segment_iter]); rof2_saylink.append(segments[segment_iter]);
} }
} }
} }
static inline void RoF2ToServerSayLink(std::string& serverSayLink, const std::string& rof2SayLink) static inline void RoF2ToServerSayLink(std::string &server_saylink, const std::string &rof2_saylink)
{ {
if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (rof2SayLink.find('\x12') == std::string::npos)) { if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (rof2_saylink.find('\x12') == std::string::npos)) {
serverSayLink = rof2SayLink; server_saylink = rof2_saylink;
return; return;
} }
auto segments = SplitString(rof2SayLink, '\x12'); auto segments = SplitString(rof2_saylink, '\x12');
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) { if (segment_iter & 1) {
if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) { if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) {
serverSayLink.append(segments[segment_iter]); server_saylink.append(segments[segment_iter]);
// TODO: log size mismatch error // TODO: log size mismatch error
continue; continue;
} }
@ -6321,12 +6321,12 @@ namespace RoF2
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
// Diff: // Diff:
serverSayLink.push_back('\x12'); server_saylink.push_back('\x12');
serverSayLink.append(segments[segment_iter]); server_saylink.append(segments[segment_iter]);
serverSayLink.push_back('\x12'); server_saylink.push_back('\x12');
} }
else { else {
serverSayLink.append(segments[segment_iter]); server_saylink.append(segments[segment_iter]);
} }
} }
} }

View File

@ -46,18 +46,18 @@ namespace SoD
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth); void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
// server to client inventory location converters // server to client inventory location converters
static inline uint32 ServerToSoDSlot(uint32 ServerSlot); static inline uint32 ServerToSoDSlot(uint32 server_slot);
static inline uint32 ServerToSoDCorpseSlot(uint32 serverCorpseSlot); static inline uint32 ServerToSoDCorpseSlot(uint32 server_corpse_slot);
// client to server inventory location converters // client to server inventory location converters
static inline uint32 SoDToServerSlot(uint32 sodSlot); static inline uint32 SoDToServerSlot(uint32 sod_slot);
static inline uint32 SoDToServerCorpseSlot(uint32 sodCorpseSlot); static inline uint32 SoDToServerCorpseSlot(uint32 sod_corpse_slot);
// server to client say link converter // server to client say link converter
static inline void ServerToSoDSayLink(std::string& sodSayLink, const std::string& serverSayLink); static inline void ServerToSoDSayLink(std::string &sod_saylink, const std::string &server_saylink);
// client to server say link converter // client to server say link converter
static inline void SoDToServerSayLink(std::string& serverSayLink, const std::string& sodSayLink); static inline void SoDToServerSayLink(std::string &server_saylink, const std::string &sod_saylink);
static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot); static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot); static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot);
@ -3841,114 +3841,114 @@ namespace SoD
return SoDSlot; return SoDSlot;
} }
static inline uint32 ServerToSoDCorpseSlot(uint32 serverCorpseSlot) static inline uint32 ServerToSoDCorpseSlot(uint32 server_corpse_slot)
{ {
uint32 SoDSlot = invslot::SLOT_INVALID; uint32 SoDSlot = invslot::SLOT_INVALID;
if (serverCorpseSlot <= EQEmu::invslot::slotGeneral8 && serverCorpseSlot >= EQEmu::invslot::slotGeneral1) { if (server_corpse_slot <= EQEmu::invslot::slotGeneral8 && server_corpse_slot >= EQEmu::invslot::slotGeneral1) {
SoDSlot = serverCorpseSlot; SoDSlot = server_corpse_slot;
} }
else if (serverCorpseSlot <= EQEmu::invslot::CORPSE_END && serverCorpseSlot >= EQEmu::invslot::slotCursor) { else if (server_corpse_slot <= EQEmu::invslot::CORPSE_END && server_corpse_slot >= EQEmu::invslot::slotCursor) {
SoDSlot = serverCorpseSlot - 2; SoDSlot = server_corpse_slot - 2;
} }
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to SoD Corpse Slot %i", serverCorpseSlot, SoDSlot); Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to SoD Corpse Slot %i", server_corpse_slot, SoDSlot);
return SoDSlot; return SoDSlot;
} }
static inline uint32 SoDToServerSlot(uint32 sodSlot) static inline uint32 SoDToServerSlot(uint32 sod_slot)
{ {
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
if (sodSlot <= invslot::slotGeneral8) { if (sod_slot <= invslot::slotGeneral8) {
ServerSlot = sodSlot; server_slot = sod_slot;
} }
else if (sodSlot <= invslot::CORPSE_END && sodSlot >= invslot::slotCursor) { else if (sod_slot <= invslot::CORPSE_END && sod_slot >= invslot::slotCursor) {
ServerSlot = sodSlot + 2; server_slot = sod_slot + 2;
} }
else if (sodSlot <= invbag::GENERAL_BAGS_END && sodSlot >= invbag::GENERAL_BAGS_BEGIN) { else if (sod_slot <= invbag::GENERAL_BAGS_END && sod_slot >= invbag::GENERAL_BAGS_BEGIN) {
ServerSlot = sodSlot - 11; server_slot = sod_slot - 11;
} }
else if (sodSlot <= invbag::CURSOR_BAG_END && sodSlot >= invbag::CURSOR_BAG_BEGIN) { else if (sod_slot <= invbag::CURSOR_BAG_END && sod_slot >= invbag::CURSOR_BAG_BEGIN) {
ServerSlot = sodSlot + 9; server_slot = sod_slot + 9;
} }
else if (sodSlot <= invslot::TRIBUTE_END && sodSlot >= invslot::TRIBUTE_BEGIN) { else if (sod_slot <= invslot::TRIBUTE_END && sod_slot >= invslot::TRIBUTE_BEGIN) {
ServerSlot = sodSlot; server_slot = sod_slot;
} }
else if (sodSlot <= invslot::GUILD_TRIBUTE_END && sodSlot >= invslot::GUILD_TRIBUTE_BEGIN) { else if (sod_slot <= invslot::GUILD_TRIBUTE_END && sod_slot >= invslot::GUILD_TRIBUTE_BEGIN) {
ServerSlot = sodSlot; server_slot = sod_slot;
} }
else if (sodSlot <= invslot::BANK_END && sodSlot >= invslot::BANK_BEGIN) { else if (sod_slot <= invslot::BANK_END && sod_slot >= invslot::BANK_BEGIN) {
ServerSlot = sodSlot; server_slot = sod_slot;
} }
else if (sodSlot <= invbag::BANK_BAGS_END && sodSlot >= invbag::BANK_BAGS_BEGIN) { else if (sod_slot <= invbag::BANK_BAGS_END && sod_slot >= invbag::BANK_BAGS_BEGIN) {
ServerSlot = sodSlot - 1; server_slot = sod_slot - 1;
} }
else if (sodSlot <= invslot::SHARED_BANK_END && sodSlot >= invslot::SHARED_BANK_BEGIN) { else if (sod_slot <= invslot::SHARED_BANK_END && sod_slot >= invslot::SHARED_BANK_BEGIN) {
ServerSlot = sodSlot; server_slot = sod_slot;
} }
else if (sodSlot <= invbag::SHARED_BANK_BAGS_END && sodSlot >= invbag::SHARED_BANK_BAGS_BEGIN) { else if (sod_slot <= invbag::SHARED_BANK_BAGS_END && sod_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
ServerSlot = sodSlot - 1; server_slot = sod_slot - 1;
} }
else if (sodSlot <= invslot::TRADE_END && sodSlot >= invslot::TRADE_BEGIN) { else if (sod_slot <= invslot::TRADE_END && sod_slot >= invslot::TRADE_BEGIN) {
ServerSlot = sodSlot; server_slot = sod_slot;
} }
else if (sodSlot <= invbag::TRADE_BAGS_END && sodSlot >= invbag::TRADE_BAGS_BEGIN) { else if (sod_slot <= invbag::TRADE_BAGS_END && sod_slot >= invbag::TRADE_BAGS_BEGIN) {
ServerSlot = sodSlot; server_slot = sod_slot;
} }
else if (sodSlot <= invslot::WORLD_END && sodSlot >= invslot::WORLD_BEGIN) { else if (sod_slot <= invslot::WORLD_END && sod_slot >= invslot::WORLD_BEGIN) {
ServerSlot = sodSlot; server_slot = sod_slot;
} }
Log(Logs::Detail, Logs::Netcode, "Convert SoD Slot %i to Server Slot %i", sodSlot, ServerSlot); Log(Logs::Detail, Logs::Netcode, "Convert SoD Slot %i to Server Slot %i", sod_slot, server_slot);
return ServerSlot; return server_slot;
} }
static inline uint32 SoDToServerCorpseSlot(uint32 sodCorpseSlot) static inline uint32 SoDToServerCorpseSlot(uint32 sod_corpse_slot)
{ {
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
if (sodCorpseSlot <= invslot::slotGeneral8 && sodCorpseSlot >= invslot::slotGeneral1) { if (sod_corpse_slot <= invslot::slotGeneral8 && sod_corpse_slot >= invslot::slotGeneral1) {
ServerSlot = sodCorpseSlot; server_slot = sod_corpse_slot;
} }
else if (sodCorpseSlot <= invslot::CORPSE_END && sodCorpseSlot >= invslot::slotCursor) { else if (sod_corpse_slot <= invslot::CORPSE_END && sod_corpse_slot >= invslot::slotCursor) {
ServerSlot = sodCorpseSlot + 2; server_slot = sod_corpse_slot + 2;
} }
Log(Logs::Detail, Logs::Netcode, "Convert SoD Corpse Slot %i to Server Corpse Slot %i", sodCorpseSlot, ServerSlot); Log(Logs::Detail, Logs::Netcode, "Convert SoD Corpse Slot %i to Server Corpse Slot %i", sod_corpse_slot, server_slot);
return ServerSlot; return server_slot;
} }
static inline void ServerToSoDSayLink(std::string& sodSayLink, const std::string& serverSayLink) static inline void ServerToSoDSayLink(std::string &sod_saylink, const std::string &server_saylink)
{ {
if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) { if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (server_saylink.find('\x12') == std::string::npos)) {
sodSayLink = serverSayLink; sod_saylink = server_saylink;
return; return;
} }
auto segments = SplitString(serverSayLink, '\x12'); auto segments = SplitString(server_saylink, '\x12');
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) { if (segment_iter & 1) {
if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) { if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) {
sodSayLink.append(segments[segment_iter]); sod_saylink.append(segments[segment_iter]);
// TODO: log size mismatch error // TODO: log size mismatch error
continue; continue;
} }
@ -3958,37 +3958,37 @@ namespace SoD
// SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50)
// Diff: ^^^^^ ^ // Diff: ^^^^^ ^
sodSayLink.push_back('\x12'); sod_saylink.push_back('\x12');
sodSayLink.append(segments[segment_iter].substr(0, 31)); sod_saylink.append(segments[segment_iter].substr(0, 31));
sodSayLink.append(segments[segment_iter].substr(36, 5)); sod_saylink.append(segments[segment_iter].substr(36, 5));
if (segments[segment_iter][41] == '0') if (segments[segment_iter][41] == '0')
sodSayLink.push_back(segments[segment_iter][42]); sod_saylink.push_back(segments[segment_iter][42]);
else else
sodSayLink.push_back('F'); sod_saylink.push_back('F');
sodSayLink.append(segments[segment_iter].substr(43)); sod_saylink.append(segments[segment_iter].substr(43));
sodSayLink.push_back('\x12'); sod_saylink.push_back('\x12');
} }
else { else {
sodSayLink.append(segments[segment_iter]); sod_saylink.append(segments[segment_iter]);
} }
} }
} }
static inline void SoDToServerSayLink(std::string& serverSayLink, const std::string& sodSayLink) static inline void SoDToServerSayLink(std::string &server_saylink, const std::string &sod_saylink)
{ {
if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (sodSayLink.find('\x12') == std::string::npos)) { if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (sod_saylink.find('\x12') == std::string::npos)) {
serverSayLink = sodSayLink; server_saylink = sod_saylink;
return; return;
} }
auto segments = SplitString(sodSayLink, '\x12'); auto segments = SplitString(sod_saylink, '\x12');
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) { if (segment_iter & 1) {
if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) { if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) {
serverSayLink.append(segments[segment_iter]); server_saylink.append(segments[segment_iter]);
// TODO: log size mismatch error // TODO: log size mismatch error
continue; continue;
} }
@ -3998,16 +3998,16 @@ namespace SoD
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
// Diff: ^^^^^ ^ // Diff: ^^^^^ ^
serverSayLink.push_back('\x12'); server_saylink.push_back('\x12');
serverSayLink.append(segments[segment_iter].substr(0, 31)); server_saylink.append(segments[segment_iter].substr(0, 31));
serverSayLink.append("00000"); server_saylink.append("00000");
serverSayLink.append(segments[segment_iter].substr(31, 5)); server_saylink.append(segments[segment_iter].substr(31, 5));
serverSayLink.push_back('0'); server_saylink.push_back('0');
serverSayLink.append(segments[segment_iter].substr(36)); server_saylink.append(segments[segment_iter].substr(36));
serverSayLink.push_back('\x12'); server_saylink.push_back('\x12');
} }
else { else {
serverSayLink.append(segments[segment_iter]); server_saylink.append(segments[segment_iter]);
} }
} }
} }

View File

@ -46,21 +46,21 @@ namespace SoF
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth); void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
// server to client inventory location converters // server to client inventory location converters
static inline uint32 ServerToSoFSlot(uint32 serverSlot); static inline uint32 ServerToSoFSlot(uint32 server_slot);
static inline uint32 ServerToSoFCorpseSlot(uint32 serverCorpseSlot); static inline uint32 ServerToSoFCorpseSlot(uint32 server_corpse_slot);
// client to server inventory location converters // client to server inventory location converters
static inline uint32 SoFToServerSlot(uint32 sofSlot); static inline uint32 SoFToServerSlot(uint32 sof_slot);
static inline uint32 SoFToServerCorpseSlot(uint32 sofCorpseSlot); static inline uint32 SoFToServerCorpseSlot(uint32 sof_corpse_slot);
// server to client say link converter // server to client say link converter
static inline void ServerToSoFSayLink(std::string& sofSayLink, const std::string& serverSayLink); static inline void ServerToSoFSayLink(std::string &sof_saylink, const std::string &server_saylink);
// client to server say link converter // client to server say link converter
static inline void SoFToServerSayLink(std::string& serverSayLink, const std::string& sofSayLink); static inline void SoFToServerSayLink(std::string &server_saylink, const std::string &sof_saylink);
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot); static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation); static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 item_location);
static inline int ServerToSoFBuffSlot(int index); static inline int ServerToSoFBuffSlot(int index);
static inline int SoFToServerBuffSlot(int index); static inline int SoFToServerBuffSlot(int index);
@ -103,8 +103,6 @@ namespace SoF
signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry);
into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy);
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Registered patch %s", name); Log(Logs::General, Logs::Netcode, "[IDENTIFY] Registered patch %s", name);
} }
@ -3173,175 +3171,183 @@ namespace SoF
} }
} }
static inline uint32 ServerToSoFSlot(uint32 serverSlot) static inline uint32 ServerToSoFSlot(uint32 server_slot)
{ {
uint32 SoFSlot = invslot::SLOT_INVALID; uint32 sof_slot = invslot::SLOT_INVALID;
if (serverSlot <= EQEmu::invslot::slotGeneral8) { if (server_slot <= EQEmu::invslot::slotGeneral8) {
SoFSlot = serverSlot; sof_slot = server_slot;
} }
else if (serverSlot <= EQEmu::invslot::CORPSE_END && serverSlot >= EQEmu::invslot::slotCursor) { else if (server_slot <= EQEmu::invslot::CORPSE_END && server_slot >= EQEmu::invslot::slotCursor) {
SoFSlot = serverSlot - 2; sof_slot = server_slot - 2;
} }
else if (serverSlot <= EQEmu::invbag::GENERAL_BAGS_8_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::GENERAL_BAGS_8_END && server_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
SoFSlot = serverSlot + 11; sof_slot = server_slot + 11;
} }
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::CURSOR_BAG_BEGIN) { else if (server_slot <= EQEmu::invbag::CURSOR_BAG_END && server_slot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
SoFSlot = serverSlot - 9; sof_slot = server_slot - 9;
} }
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) { else if (server_slot <= EQEmu::invslot::TRIBUTE_END && server_slot >= EQEmu::invslot::TRIBUTE_BEGIN) {
SoFSlot = serverSlot; sof_slot = server_slot;
} }
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) { else if (server_slot <= EQEmu::invslot::GUILD_TRIBUTE_END && server_slot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
SoFSlot = serverSlot; sof_slot = server_slot;
} }
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) { else if (server_slot <= EQEmu::invslot::BANK_END && server_slot >= EQEmu::invslot::BANK_BEGIN) {
SoFSlot = serverSlot; sof_slot = server_slot;
} }
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::BANK_BAGS_END && server_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
SoFSlot = serverSlot + 1; sof_slot = server_slot + 1;
} }
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) { else if (server_slot <= EQEmu::invslot::SHARED_BANK_END && server_slot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
SoFSlot = serverSlot; sof_slot = server_slot;
} }
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::SHARED_BANK_BAGS_END && server_slot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
SoFSlot = serverSlot + 1; sof_slot = server_slot + 1;
} }
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) { else if (server_slot <= EQEmu::invslot::TRADE_END && server_slot >= EQEmu::invslot::TRADE_BEGIN) {
SoFSlot = serverSlot; sof_slot = server_slot;
} }
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) { else if (server_slot <= EQEmu::invbag::TRADE_BAGS_END && server_slot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
SoFSlot = serverSlot; sof_slot = server_slot;
} }
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) { else if (server_slot <= EQEmu::invslot::WORLD_END && server_slot >= EQEmu::invslot::WORLD_BEGIN) {
SoFSlot = serverSlot; sof_slot = server_slot;
} }
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to SoF Slot %i", serverSlot, SoFSlot); Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to SoF Slot %i", server_slot, sof_slot);
return SoFSlot; return sof_slot;
} }
static inline uint32 ServerToSoFCorpseSlot(uint32 serverCorpseSlot) static inline uint32 ServerToSoFCorpseSlot(uint32 server_corpse_slot)
{ {
uint32 SoFSlot = invslot::SLOT_INVALID; uint32 SoFSlot = invslot::SLOT_INVALID;
if (serverCorpseSlot <= EQEmu::invslot::slotGeneral8 && serverCorpseSlot >= EQEmu::invslot::slotGeneral1) { if (server_corpse_slot <= EQEmu::invslot::slotGeneral8 && server_corpse_slot >= EQEmu::invslot::slotGeneral1) {
SoFSlot = serverCorpseSlot; SoFSlot = server_corpse_slot;
} }
else if (serverCorpseSlot <= EQEmu::invslot::CORPSE_END && serverCorpseSlot >= EQEmu::invslot::slotCursor) { else if (server_corpse_slot <= EQEmu::invslot::CORPSE_END && server_corpse_slot >= EQEmu::invslot::slotCursor) {
SoFSlot = serverCorpseSlot - 2; SoFSlot = server_corpse_slot - 2;
} }
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to SoF Corpse Slot %i", serverCorpseSlot, SoFSlot); Log(Logs::Detail,
Logs::Netcode,
"Convert Server Corpse Slot %i to SoF Corpse Slot %i",
server_corpse_slot,
SoFSlot);
return SoFSlot; return SoFSlot;
} }
static inline uint32 SoFToServerSlot(uint32 sofSlot) static inline uint32 SoFToServerSlot(uint32 sof_slot)
{ {
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
if (sofSlot <= invslot::slotGeneral8) { if (sof_slot <= invslot::slotGeneral8) {
ServerSlot = sofSlot; server_slot = sof_slot;
} }
else if (sofSlot <= invslot::CORPSE_END && sofSlot >= invslot::slotCursor) { else if (sof_slot <= invslot::CORPSE_END && sof_slot >= invslot::slotCursor) {
ServerSlot = sofSlot + 2; server_slot = sof_slot + 2;
} }
else if (sofSlot <= invbag::GENERAL_BAGS_END && sofSlot >= invbag::GENERAL_BAGS_BEGIN) { else if (sof_slot <= invbag::GENERAL_BAGS_END && sof_slot >= invbag::GENERAL_BAGS_BEGIN) {
ServerSlot = sofSlot - 11; server_slot = sof_slot - 11;
} }
else if (sofSlot <= invbag::CURSOR_BAG_END && sofSlot >= invbag::CURSOR_BAG_BEGIN) { else if (sof_slot <= invbag::CURSOR_BAG_END && sof_slot >= invbag::CURSOR_BAG_BEGIN) {
ServerSlot = sofSlot + 9; server_slot = sof_slot + 9;
} }
else if (sofSlot <= invslot::TRIBUTE_END && sofSlot >= invslot::TRIBUTE_BEGIN) { else if (sof_slot <= invslot::TRIBUTE_END && sof_slot >= invslot::TRIBUTE_BEGIN) {
ServerSlot = sofSlot; server_slot = sof_slot;
} }
else if (sofSlot <= invslot::GUILD_TRIBUTE_END && sofSlot >= invslot::GUILD_TRIBUTE_BEGIN) { else if (sof_slot <= invslot::GUILD_TRIBUTE_END && sof_slot >= invslot::GUILD_TRIBUTE_BEGIN) {
ServerSlot = sofSlot; server_slot = sof_slot;
} }
else if (sofSlot <= invslot::BANK_END && sofSlot >= invslot::BANK_BEGIN) { else if (sof_slot <= invslot::BANK_END && sof_slot >= invslot::BANK_BEGIN) {
ServerSlot = sofSlot; server_slot = sof_slot;
} }
else if (sofSlot <= invbag::BANK_BAGS_END && sofSlot >= invbag::BANK_BAGS_BEGIN) { else if (sof_slot <= invbag::BANK_BAGS_END && sof_slot >= invbag::BANK_BAGS_BEGIN) {
ServerSlot = sofSlot - 1; server_slot = sof_slot - 1;
} }
else if (sofSlot <= invslot::SHARED_BANK_END && sofSlot >= invslot::SHARED_BANK_BEGIN) { else if (sof_slot <= invslot::SHARED_BANK_END && sof_slot >= invslot::SHARED_BANK_BEGIN) {
ServerSlot = sofSlot; server_slot = sof_slot;
} }
else if (sofSlot <= invbag::SHARED_BANK_BAGS_END && sofSlot >= invbag::SHARED_BANK_BAGS_BEGIN) { else if (sof_slot <= invbag::SHARED_BANK_BAGS_END && sof_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
ServerSlot = sofSlot - 1; server_slot = sof_slot - 1;
} }
else if (sofSlot <= invslot::TRADE_END && sofSlot >= invslot::TRADE_BEGIN) { else if (sof_slot <= invslot::TRADE_END && sof_slot >= invslot::TRADE_BEGIN) {
ServerSlot = sofSlot; server_slot = sof_slot;
} }
else if (sofSlot <= invbag::TRADE_BAGS_END && sofSlot >= invbag::TRADE_BAGS_BEGIN) { else if (sof_slot <= invbag::TRADE_BAGS_END && sof_slot >= invbag::TRADE_BAGS_BEGIN) {
ServerSlot = sofSlot; server_slot = sof_slot;
} }
else if (sofSlot <= invslot::WORLD_END && sofSlot >= invslot::WORLD_BEGIN) { else if (sof_slot <= invslot::WORLD_END && sof_slot >= invslot::WORLD_BEGIN) {
ServerSlot = sofSlot; server_slot = sof_slot;
} }
Log(Logs::Detail, Logs::Netcode, "Convert SoF Slot %i to Server Slot %i", sofSlot, ServerSlot); Log(Logs::Detail, Logs::Netcode, "Convert SoF Slot %i to Server Slot %i", sof_slot, server_slot);
return ServerSlot; return server_slot;
} }
static inline uint32 SoFToServerCorpseSlot(uint32 sofCorpseSlot) static inline uint32 SoFToServerCorpseSlot(uint32 sof_corpse_slot)
{ {
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
if (sofCorpseSlot <= invslot::slotGeneral8 && sofCorpseSlot >= invslot::slotGeneral1) { if (sof_corpse_slot <= invslot::slotGeneral8 && sof_corpse_slot >= invslot::slotGeneral1) {
ServerSlot = sofCorpseSlot; server_slot = sof_corpse_slot;
} }
else if (sofCorpseSlot <= invslot::CORPSE_END && sofCorpseSlot >= invslot::slotCursor) { else if (sof_corpse_slot <= invslot::CORPSE_END && sof_corpse_slot >= invslot::slotCursor) {
ServerSlot = sofCorpseSlot + 2; server_slot = sof_corpse_slot + 2;
} }
Log(Logs::Detail, Logs::Netcode, "Convert SoF Corpse Slot %i to Server Corpse Slot %i", sofCorpseSlot, ServerSlot); Log(Logs::Detail,
Logs::Netcode,
"Convert SoF Corpse Slot %i to Server Corpse Slot %i",
sof_corpse_slot,
server_slot);
return ServerSlot; return server_slot;
} }
static inline void ServerToSoFSayLink(std::string& sofSayLink, const std::string& serverSayLink) static inline void ServerToSoFSayLink(std::string &sof_saylink, const std::string &server_saylink)
{ {
if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) { if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (server_saylink.find('\x12') == std::string::npos)) {
sofSayLink = serverSayLink; sof_saylink = server_saylink;
return; return;
} }
auto segments = SplitString(serverSayLink, '\x12'); auto segments = SplitString(server_saylink, '\x12');
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) { if (segment_iter & 1) {
if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) { if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) {
sofSayLink.append(segments[segment_iter]); sof_saylink.append(segments[segment_iter]);
// TODO: log size mismatch error // TODO: log size mismatch error
continue; continue;
} }
@ -3351,37 +3357,37 @@ namespace SoF
// SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50) // SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50)
// Diff: ^^^^^ ^ // Diff: ^^^^^ ^
sofSayLink.push_back('\x12'); sof_saylink.push_back('\x12');
sofSayLink.append(segments[segment_iter].substr(0, 31)); sof_saylink.append(segments[segment_iter].substr(0, 31));
sofSayLink.append(segments[segment_iter].substr(36, 5)); sof_saylink.append(segments[segment_iter].substr(36, 5));
if (segments[segment_iter][41] == '0') if (segments[segment_iter][41] == '0')
sofSayLink.push_back(segments[segment_iter][42]); sof_saylink.push_back(segments[segment_iter][42]);
else else
sofSayLink.push_back('F'); sof_saylink.push_back('F');
sofSayLink.append(segments[segment_iter].substr(43)); sof_saylink.append(segments[segment_iter].substr(43));
sofSayLink.push_back('\x12'); sof_saylink.push_back('\x12');
} }
else { else {
sofSayLink.append(segments[segment_iter]); sof_saylink.append(segments[segment_iter]);
} }
} }
} }
static inline void SoFToServerSayLink(std::string& serverSayLink, const std::string& sofSayLink) static inline void SoFToServerSayLink(std::string &server_saylink, const std::string &sof_saylink)
{ {
if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (sofSayLink.find('\x12') == std::string::npos)) { if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (sof_saylink.find('\x12') == std::string::npos)) {
serverSayLink = sofSayLink; server_saylink = sof_saylink;
return; return;
} }
auto segments = SplitString(sofSayLink, '\x12'); auto segments = SplitString(sof_saylink, '\x12');
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) { if (segment_iter & 1) {
if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) { if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) {
serverSayLink.append(segments[segment_iter]); server_saylink.append(segments[segment_iter]);
// TODO: log size mismatch error // TODO: log size mismatch error
continue; continue;
} }
@ -3391,98 +3397,95 @@ namespace SoF
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
// Diff: ^^^^^ ^ // Diff: ^^^^^ ^
serverSayLink.push_back('\x12'); server_saylink.push_back('\x12');
serverSayLink.append(segments[segment_iter].substr(0, 31)); server_saylink.append(segments[segment_iter].substr(0, 31));
serverSayLink.append("00000"); server_saylink.append("00000");
serverSayLink.append(segments[segment_iter].substr(31, 5)); server_saylink.append(segments[segment_iter].substr(31, 5));
serverSayLink.push_back('0'); server_saylink.push_back('0');
serverSayLink.append(segments[segment_iter].substr(36)); server_saylink.append(segments[segment_iter].substr(36));
serverSayLink.push_back('\x12'); server_saylink.push_back('\x12');
} }
else { else {
serverSayLink.append(segments[segment_iter]); server_saylink.append(segments[segment_iter]);
} }
} }
} }
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot) static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot) {
{
switch (slot) { switch (slot) {
case EQEmu::CastingSlot::Gem1: case EQEmu::CastingSlot::Gem1:
return CastingSlot::Gem1; return CastingSlot::Gem1;
case EQEmu::CastingSlot::Gem2: case EQEmu::CastingSlot::Gem2:
return CastingSlot::Gem2; return CastingSlot::Gem2;
case EQEmu::CastingSlot::Gem3: case EQEmu::CastingSlot::Gem3:
return CastingSlot::Gem3; return CastingSlot::Gem3;
case EQEmu::CastingSlot::Gem4: case EQEmu::CastingSlot::Gem4:
return CastingSlot::Gem4; return CastingSlot::Gem4;
case EQEmu::CastingSlot::Gem5: case EQEmu::CastingSlot::Gem5:
return CastingSlot::Gem5; return CastingSlot::Gem5;
case EQEmu::CastingSlot::Gem6: case EQEmu::CastingSlot::Gem6:
return CastingSlot::Gem6; return CastingSlot::Gem6;
case EQEmu::CastingSlot::Gem7: case EQEmu::CastingSlot::Gem7:
return CastingSlot::Gem7; return CastingSlot::Gem7;
case EQEmu::CastingSlot::Gem8: case EQEmu::CastingSlot::Gem8:
return CastingSlot::Gem8; return CastingSlot::Gem8;
case EQEmu::CastingSlot::Gem9: case EQEmu::CastingSlot::Gem9:
return CastingSlot::Gem9; return CastingSlot::Gem9;
case EQEmu::CastingSlot::Item: case EQEmu::CastingSlot::Item:
return CastingSlot::Item; return CastingSlot::Item;
case EQEmu::CastingSlot::PotionBelt: case EQEmu::CastingSlot::PotionBelt:
return CastingSlot::PotionBelt; return CastingSlot::PotionBelt;
case EQEmu::CastingSlot::Discipline: case EQEmu::CastingSlot::Discipline:
return CastingSlot::Discipline; return CastingSlot::Discipline;
case EQEmu::CastingSlot::AltAbility: case EQEmu::CastingSlot::AltAbility:
return CastingSlot::AltAbility; return CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something default: // we shouldn't have any issues with other slots ... just return something
return CastingSlot::Discipline; return CastingSlot::Discipline;
} }
} }
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation) static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 item_location) {
{
switch (slot) { switch (slot) {
case CastingSlot::Gem1: case CastingSlot::Gem1:
return EQEmu::CastingSlot::Gem1; return EQEmu::CastingSlot::Gem1;
case CastingSlot::Gem2: case CastingSlot::Gem2:
return EQEmu::CastingSlot::Gem2; return EQEmu::CastingSlot::Gem2;
case CastingSlot::Gem3: case CastingSlot::Gem3:
return EQEmu::CastingSlot::Gem3; return EQEmu::CastingSlot::Gem3;
case CastingSlot::Gem4: case CastingSlot::Gem4:
return EQEmu::CastingSlot::Gem4; return EQEmu::CastingSlot::Gem4;
case CastingSlot::Gem5: case CastingSlot::Gem5:
return EQEmu::CastingSlot::Gem5; return EQEmu::CastingSlot::Gem5;
case CastingSlot::Gem6: case CastingSlot::Gem6:
return EQEmu::CastingSlot::Gem6; return EQEmu::CastingSlot::Gem6;
case CastingSlot::Gem7: case CastingSlot::Gem7:
return EQEmu::CastingSlot::Gem7; return EQEmu::CastingSlot::Gem7;
case CastingSlot::Gem8: case CastingSlot::Gem8:
return EQEmu::CastingSlot::Gem8; return EQEmu::CastingSlot::Gem8;
case CastingSlot::Gem9: case CastingSlot::Gem9:
return EQEmu::CastingSlot::Gem9; return EQEmu::CastingSlot::Gem9;
case CastingSlot::Ability: case CastingSlot::Ability:
return EQEmu::CastingSlot::Ability; return EQEmu::CastingSlot::Ability;
// Tit uses 10 for item and discipline casting, but items have a valid location // Tit uses 10 for item and discipline casting, but items have a valid location
case CastingSlot::Item: case CastingSlot::Item:
if (itemlocation == INVALID_INDEX) if (item_location == INVALID_INDEX)
return EQEmu::CastingSlot::Discipline;
else
return EQEmu::CastingSlot::Item;
case CastingSlot::PotionBelt:
return EQEmu::CastingSlot::PotionBelt;
case CastingSlot::AltAbility:
return EQEmu::CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return EQEmu::CastingSlot::Discipline; return EQEmu::CastingSlot::Discipline;
else
return EQEmu::CastingSlot::Item;
case CastingSlot::PotionBelt:
return EQEmu::CastingSlot::PotionBelt;
case CastingSlot::AltAbility:
return EQEmu::CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return EQEmu::CastingSlot::Discipline;
} }
} }
static inline int ServerToSoFBuffSlot(int index) static inline int ServerToSoFBuffSlot(int index) {
{
// we're a disc // we're a disc
if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs) if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs)
return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs + return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs +
constants::LongBuffs + constants::ShortBuffs; constants::LongBuffs + constants::ShortBuffs;
// we're a song // we're a song
if (index >= EQEmu::constants::LongBuffs) if (index >= EQEmu::constants::LongBuffs)
return index - EQEmu::constants::LongBuffs + constants::LongBuffs; return index - EQEmu::constants::LongBuffs + constants::LongBuffs;
@ -3502,4 +3505,4 @@ namespace SoF
// we're a normal buff // we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine return index; // as long as we guard against bad slots server side, we should be fine
} }
} /*SoF*/ }

View File

@ -45,21 +45,21 @@ namespace Titanium
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth); void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth);
// server to client inventory location converters // server to client inventory location converters
static inline int16 ServerToTitaniumSlot(uint32 serverSlot); static inline int16 ServerToTitaniumSlot(uint32 server_slot);
static inline int16 ServerToTitaniumCorpseSlot(uint32 serverCorpseSlot); static inline int16 ServerToTitaniumCorpseSlot(uint32 server_corpse_slot);
// client to server inventory location converters // client to server inventory location converters
static inline uint32 TitaniumToServerSlot(int16 titaniumSlot); static inline uint32 TitaniumToServerSlot(int16 titanium_slot);
static inline uint32 TitaniumToServerCorpseSlot(int16 titaniumCorpseSlot); static inline uint32 TitaniumToServerCorpseSlot(int16 titanium_corpse_slot);
// server to client say link converter // server to client say link converter
static inline void ServerToTitaniumSayLink(std::string& titaniumSayLink, const std::string& serverSayLink); static inline void ServerToTitaniumSayLink(std::string &titanium_saylink, const std::string &server_saylink);
// client to server say link converter // client to server say link converter
static inline void TitaniumToServerSayLink(std::string& serverSayLink, const std::string& titaniumSayLink); static inline void TitaniumToServerSayLink(std::string &server_saylink, const std::string &titanium_saylink);
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot); static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation); static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 item_location);
static inline int ServerToTitaniumBuffSlot(int index); static inline int ServerToTitaniumBuffSlot(int index);
static inline int TitaniumToServerBuffSlot(int index); static inline int TitaniumToServerBuffSlot(int index);
@ -2225,13 +2225,16 @@ namespace Titanium
} }
// file scope helper methods // file scope helper methods
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth) void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth) {
{ const char *protection = "\\\\\\\\\\";
const char* protection = "\\\\\\\\\\"; const EQEmu::ItemData *item = inst->GetUnscaledItem();
const EQEmu::ItemData* item = inst->GetUnscaledItem();
ob << StringFormat(
"%.*s%s",
(depth ? (depth - 1) : 0),
protection,
(depth ? "\"" : "")); // For leading quotes (and protection) if a subitem;
ob << StringFormat("%.*s%s", (depth ? (depth - 1) : 0), protection, (depth ? "\"" : "")); // For leading quotes (and protection) if a subitem;
// Instance data // Instance data
ob << itoa((inst->IsStackable() ? inst->GetCharges() : 0)); // stack count ob << itoa((inst->IsStackable() ? inst->GetCharges() : 0)); // stack count
ob << '|' << itoa(0); // unknown ob << '|' << itoa(0); // unknown
@ -2239,9 +2242,11 @@ namespace Titanium
ob << '|' << itoa(inst->GetPrice()); // merchant price ob << '|' << itoa(inst->GetPrice()); // merchant price
ob << '|' << itoa((!inst->GetMerchantSlot() ? 1 : inst->GetMerchantCount())); // inst count/merchant count ob << '|' << itoa((!inst->GetMerchantSlot() ? 1 : inst->GetMerchantCount())); // inst count/merchant count
ob << '|' << itoa((inst->IsScaling() ? (inst->GetExp() / 100) : 0)); // inst experience ob << '|' << itoa((inst->IsScaling() ? (inst->GetExp() / 100) : 0)); // inst experience
ob << '|' << itoa((!inst->GetMerchantSlot() ? inst->GetSerialNumber() : inst->GetMerchantSlot())); // merchant serial number ob << '|' << itoa((!inst->GetMerchantSlot() ? inst->GetSerialNumber()
: inst->GetMerchantSlot())); // merchant serial number
ob << '|' << itoa(inst->GetRecastTimestamp()); // recast timestamp ob << '|' << itoa(inst->GetRecastTimestamp()); // recast timestamp
ob << '|' << itoa(((inst->IsStackable() ? ((inst->GetItem()->ItemType == EQEmu::item::ItemTypePotion) ? 1 : 0) : inst->GetCharges()))); // charge count ob << '|' << itoa(((inst->IsStackable() ? ((inst->GetItem()->ItemType == EQEmu::item::ItemTypePotion) ? 1 : 0)
: inst->GetCharges()))); // charge count
ob << '|' << itoa((inst->IsAttuned() ? 1 : 0)); // inst attuned ob << '|' << itoa((inst->IsAttuned() ? 1 : 0)); // inst attuned
ob << '|' << itoa(0); // unknown ob << '|' << itoa(0); // unknown
ob << '|'; ob << '|';
@ -2449,220 +2454,202 @@ namespace Titanium
for (int index = EQEmu::invbag::SLOT_BEGIN; index <= invbag::SLOT_END; ++index) { for (int index = EQEmu::invbag::SLOT_BEGIN; index <= invbag::SLOT_END; ++index) {
ob << '|'; ob << '|';
EQEmu::ItemInstance* sub = inst->GetItem(index); EQEmu::ItemInstance *sub = inst->GetItem(index);
if (!sub) if (!sub)
continue; continue;
SerializeItem(ob, sub, 0, (depth + 1)); SerializeItem(ob, sub, 0, (depth + 1));
} }
ob << StringFormat("%.*s%s", (depth ? (depth - 1) : 0), protection, (depth ? "\"" : "")); // For trailing quotes (and protection) if a subitem; ob << StringFormat(
"%.*s%s",
(depth ? (depth - 1) : 0),
protection,
(depth ? "\"" : "")); // For trailing quotes (and protection) if a subitem;
if (!depth) if (!depth)
ob.write("\0", 1); ob.write("\0", 1);
} }
static inline int16 ServerToTitaniumSlot(uint32 serverSlot) static inline int16 ServerToTitaniumSlot(uint32 server_slot) {
{ int16 titanium_slot = invslot::SLOT_INVALID;
int16 TitaniumSlot = invslot::SLOT_INVALID;
if (serverSlot <= EQEmu::invslot::slotWaist) { if (server_slot <= EQEmu::invslot::slotWaist) {
TitaniumSlot = serverSlot; titanium_slot = server_slot;
}
else if (server_slot == EQEmu::invslot::slotAmmo) {
titanium_slot = server_slot - 1;
}
else if (server_slot <= EQEmu::invslot::slotGeneral8 && server_slot >= EQEmu::invslot::slotGeneral1) {
titanium_slot = server_slot - 1;
}
else if (server_slot <= (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotWaist) &&
server_slot >= EQEmu::invslot::slotCursor) {
titanium_slot = server_slot - 3;
}
else if (server_slot == (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotAmmo)) {
titanium_slot = server_slot - 4;
}
else if (server_slot <= EQEmu::invbag::GENERAL_BAGS_8_END &&
server_slot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQEmu::invbag::CURSOR_BAG_END && server_slot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
titanium_slot = server_slot - 20;
}
else if (server_slot <= EQEmu::invslot::TRIBUTE_END && server_slot >= EQEmu::invslot::TRIBUTE_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQEmu::invslot::GUILD_TRIBUTE_END &&
server_slot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQEmu::invslot::BANK_END && server_slot >= EQEmu::invslot::BANK_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQEmu::invbag::BANK_BAGS_16_END && server_slot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQEmu::invslot::SHARED_BANK_END && server_slot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQEmu::invbag::SHARED_BANK_BAGS_END &&
server_slot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQEmu::invslot::TRADE_END && server_slot >= EQEmu::invslot::TRADE_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQEmu::invbag::TRADE_BAGS_END && server_slot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQEmu::invslot::WORLD_END && server_slot >= EQEmu::invslot::WORLD_BEGIN) {
titanium_slot = server_slot;
} }
else if (serverSlot == EQEmu::invslot::slotAmmo) { Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to Titanium Slot %i", server_slot, titanium_slot);
TitaniumSlot = serverSlot - 1;
}
else if (serverSlot <= EQEmu::invslot::slotGeneral8 && serverSlot >= EQEmu::invslot::slotGeneral1) { return titanium_slot;
TitaniumSlot = serverSlot - 1;
}
else if (serverSlot <= (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotWaist) && serverSlot >= EQEmu::invslot::slotCursor) {
TitaniumSlot = serverSlot - 3;
}
else if (serverSlot == (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotAmmo)) {
TitaniumSlot = serverSlot - 4;
}
else if (serverSlot <= EQEmu::invbag::GENERAL_BAGS_8_END && serverSlot >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
TitaniumSlot = serverSlot;
}
else if (serverSlot <= EQEmu::invbag::CURSOR_BAG_END && serverSlot >= EQEmu::invbag::CURSOR_BAG_BEGIN) {
TitaniumSlot = serverSlot - 20;
}
else if (serverSlot <= EQEmu::invslot::TRIBUTE_END && serverSlot >= EQEmu::invslot::TRIBUTE_BEGIN) {
TitaniumSlot = serverSlot;
}
else if (serverSlot <= EQEmu::invslot::GUILD_TRIBUTE_END && serverSlot >= EQEmu::invslot::GUILD_TRIBUTE_BEGIN) {
TitaniumSlot = serverSlot;
}
else if (serverSlot <= EQEmu::invslot::BANK_END && serverSlot >= EQEmu::invslot::BANK_BEGIN) {
TitaniumSlot = serverSlot;
}
else if (serverSlot <= EQEmu::invbag::BANK_BAGS_16_END && serverSlot >= EQEmu::invbag::BANK_BAGS_BEGIN) {
TitaniumSlot = serverSlot;
}
else if (serverSlot <= EQEmu::invslot::SHARED_BANK_END && serverSlot >= EQEmu::invslot::SHARED_BANK_BEGIN) {
TitaniumSlot = serverSlot;
}
else if (serverSlot <= EQEmu::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQEmu::invbag::SHARED_BANK_BAGS_BEGIN) {
TitaniumSlot = serverSlot;
}
else if (serverSlot <= EQEmu::invslot::TRADE_END && serverSlot >= EQEmu::invslot::TRADE_BEGIN) {
TitaniumSlot = serverSlot;
}
else if (serverSlot <= EQEmu::invbag::TRADE_BAGS_END && serverSlot >= EQEmu::invbag::TRADE_BAGS_BEGIN) {
TitaniumSlot = serverSlot;
}
else if (serverSlot <= EQEmu::invslot::WORLD_END && serverSlot >= EQEmu::invslot::WORLD_BEGIN) {
TitaniumSlot = serverSlot;
}
Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to Titanium Slot %i", serverSlot, TitaniumSlot);
return TitaniumSlot;
} }
static inline int16 ServerToTitaniumCorpseSlot(uint32 serverCorpseSlot)
{
int16 TitaniumSlot = invslot::SLOT_INVALID;
if (serverCorpseSlot <= EQEmu::invslot::slotGeneral8 && serverCorpseSlot >= EQEmu::invslot::slotGeneral1) { static inline int16 ServerToTitaniumCorpseSlot(uint32 server_corpse_slot) {
TitaniumSlot = serverCorpseSlot - 1; int16 titanium_slot = invslot::SLOT_INVALID;
if (server_corpse_slot <= EQEmu::invslot::slotGeneral8 && server_corpse_slot >= EQEmu::invslot::slotGeneral1) {
titanium_slot = server_corpse_slot - 1;
} }
else if (serverCorpseSlot <= (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotWaist) && serverCorpseSlot >= EQEmu::invslot::slotCursor) { else if (server_corpse_slot <= (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotWaist) &&
TitaniumSlot = serverCorpseSlot - 3; server_corpse_slot >= EQEmu::invslot::slotCursor) {
titanium_slot = server_corpse_slot - 3;
} }
else if (serverCorpseSlot == (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotAmmo)) { else if (server_corpse_slot == (EQEmu::invslot::POSSESSIONS_COUNT + EQEmu::invslot::slotAmmo)) {
TitaniumSlot = serverCorpseSlot - 4; titanium_slot = server_corpse_slot - 4;
} }
Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to Titanium Corpse Slot %i", serverCorpseSlot, TitaniumSlot); Log(Logs::Detail,
Logs::Netcode,
"Convert Server Corpse Slot %i to Titanium Corpse Slot %i",
server_corpse_slot,
titanium_slot);
return TitaniumSlot; return titanium_slot;
} }
static inline uint32 TitaniumToServerSlot(int16 titaniumSlot) static inline uint32 TitaniumToServerSlot(int16 titanium_slot) {
{ uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID;
if (titaniumSlot <= invslot::slotWaist) { if (titanium_slot <= invslot::slotWaist) {
ServerSlot = titaniumSlot; server_slot = titanium_slot;
}
else if (titanium_slot == invslot::slotAmmo) {
server_slot = titanium_slot + 1;
}
else if (titanium_slot <= invslot::slotGeneral8 && titanium_slot >= invslot::slotGeneral1) {
server_slot = titanium_slot + 1;
}
else if (titanium_slot <= (invslot::POSSESSIONS_COUNT + invslot::slotWaist) &&
titanium_slot >= invslot::slotCursor) {
server_slot = titanium_slot + 3;
}
else if (titanium_slot == (invslot::POSSESSIONS_COUNT + invslot::slotAmmo)) {
server_slot = titanium_slot + 4;
}
else if (titanium_slot <= invbag::GENERAL_BAGS_END && titanium_slot >= invbag::GENERAL_BAGS_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invbag::CURSOR_BAG_END && titanium_slot >= invbag::CURSOR_BAG_BEGIN) {
server_slot = titanium_slot + 20;
}
else if (titanium_slot <= invslot::TRIBUTE_END && titanium_slot >= invslot::TRIBUTE_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invslot::GUILD_TRIBUTE_END && titanium_slot >= invslot::GUILD_TRIBUTE_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invslot::BANK_END && titanium_slot >= invslot::BANK_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invbag::BANK_BAGS_END && titanium_slot >= invbag::BANK_BAGS_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invslot::SHARED_BANK_END && titanium_slot >= invslot::SHARED_BANK_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invbag::SHARED_BANK_BAGS_END && titanium_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invslot::TRADE_END && titanium_slot >= invslot::TRADE_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invbag::TRADE_BAGS_END && titanium_slot >= invbag::TRADE_BAGS_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invslot::WORLD_END && titanium_slot >= invslot::WORLD_BEGIN) {
server_slot = titanium_slot;
} }
else if (titaniumSlot == invslot::slotAmmo) { Log(Logs::Detail, Logs::Netcode, "Convert Titanium Slot %i to Server Slot %i", titanium_slot, server_slot);
ServerSlot = titaniumSlot + 1;
}
else if (titaniumSlot <= invslot::slotGeneral8 && titaniumSlot >= invslot::slotGeneral1) { return server_slot;
ServerSlot = titaniumSlot + 1;
}
else if (titaniumSlot <= (invslot::POSSESSIONS_COUNT + invslot::slotWaist) && titaniumSlot >= invslot::slotCursor) {
ServerSlot = titaniumSlot + 3;
}
else if (titaniumSlot == (invslot::POSSESSIONS_COUNT + invslot::slotAmmo)) {
ServerSlot = titaniumSlot + 4;
}
else if (titaniumSlot <= invbag::GENERAL_BAGS_END && titaniumSlot >= invbag::GENERAL_BAGS_BEGIN) {
ServerSlot = titaniumSlot;
}
else if (titaniumSlot <= invbag::CURSOR_BAG_END && titaniumSlot >= invbag::CURSOR_BAG_BEGIN) {
ServerSlot = titaniumSlot + 20;
}
else if (titaniumSlot <= invslot::TRIBUTE_END && titaniumSlot >= invslot::TRIBUTE_BEGIN) {
ServerSlot = titaniumSlot;
}
else if (titaniumSlot <= invslot::GUILD_TRIBUTE_END && titaniumSlot >= invslot::GUILD_TRIBUTE_BEGIN) {
ServerSlot = titaniumSlot;
}
else if (titaniumSlot <= invslot::BANK_END && titaniumSlot >= invslot::BANK_BEGIN) {
ServerSlot = titaniumSlot;
}
else if (titaniumSlot <= invbag::BANK_BAGS_END && titaniumSlot >= invbag::BANK_BAGS_BEGIN) {
ServerSlot = titaniumSlot;
}
else if (titaniumSlot <= invslot::SHARED_BANK_END && titaniumSlot >= invslot::SHARED_BANK_BEGIN) {
ServerSlot = titaniumSlot;
}
else if (titaniumSlot <= invbag::SHARED_BANK_BAGS_END && titaniumSlot >= invbag::SHARED_BANK_BAGS_BEGIN) {
ServerSlot = titaniumSlot;
}
else if (titaniumSlot <= invslot::TRADE_END && titaniumSlot >= invslot::TRADE_BEGIN) {
ServerSlot = titaniumSlot;
}
else if (titaniumSlot <= invbag::TRADE_BAGS_END && titaniumSlot >= invbag::TRADE_BAGS_BEGIN) {
ServerSlot = titaniumSlot;
}
else if (titaniumSlot <= invslot::WORLD_END && titaniumSlot >= invslot::WORLD_BEGIN) {
ServerSlot = titaniumSlot;
}
Log(Logs::Detail, Logs::Netcode, "Convert Titanium Slot %i to Server Slot %i", titaniumSlot, ServerSlot);
return ServerSlot;
} }
static inline uint32 TitaniumToServerCorpseSlot(int16 titaniumCorpseSlot) static inline uint32 TitaniumToServerCorpseSlot(int16 titanium_corpse_slot)
{ {
uint32 ServerSlot = EQEmu::invslot::SLOT_INVALID; uint32 server_slot = EQEmu::invslot::SLOT_INVALID;
if (titaniumCorpseSlot <= invslot::slotGeneral8 && titaniumCorpseSlot >= invslot::slotGeneral1) { if (titanium_corpse_slot <= invslot::slotGeneral8 && titanium_corpse_slot >= invslot::slotGeneral1) {
ServerSlot = titaniumCorpseSlot + 1; server_slot = titanium_corpse_slot + 1;
} }
else if (titaniumCorpseSlot <= (invslot::POSSESSIONS_COUNT + invslot::slotWaist) && titaniumCorpseSlot >= invslot::slotCursor) { else if (titanium_corpse_slot <= (invslot::POSSESSIONS_COUNT + invslot::slotWaist) && titanium_corpse_slot >= invslot::slotCursor) {
ServerSlot = titaniumCorpseSlot + 3; server_slot = titanium_corpse_slot + 3;
} }
else if (titaniumCorpseSlot == (invslot::POSSESSIONS_COUNT + invslot::slotAmmo)) { else if (titanium_corpse_slot == (invslot::POSSESSIONS_COUNT + invslot::slotAmmo)) {
ServerSlot = titaniumCorpseSlot + 4; server_slot = titanium_corpse_slot + 4;
} }
Log(Logs::Detail, Logs::Netcode, "Convert Titanium Corpse Slot %i to Server Corpse Slot %i", titaniumCorpseSlot, ServerSlot); Log(Logs::Detail, Logs::Netcode, "Convert Titanium Corpse Slot %i to Server Corpse Slot %i", titanium_corpse_slot, server_slot);
return ServerSlot; return server_slot;
} }
static inline void ServerToTitaniumSayLink(std::string& titaniumSayLink, const std::string& serverSayLink) static inline void ServerToTitaniumSayLink(std::string &titanium_saylink, const std::string &server_saylink)
{ {
if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (serverSayLink.find('\x12') == std::string::npos)) { if ((constants::SAY_LINK_BODY_SIZE == EQEmu::constants::SAY_LINK_BODY_SIZE) || (server_saylink.find('\x12') == std::string::npos)) {
titaniumSayLink = serverSayLink; titanium_saylink = server_saylink;
return; return;
} }
auto segments = SplitString(serverSayLink, '\x12'); auto segments = SplitString(server_saylink, '\x12');
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) { if (segment_iter & 1) {
if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) { if (segments[segment_iter].length() <= EQEmu::constants::SAY_LINK_BODY_SIZE) {
titaniumSayLink.append(segments[segment_iter]); titanium_saylink.append(segments[segment_iter]);
// TODO: log size mismatch error // TODO: log size mismatch error
continue; continue;
} }
@ -2672,37 +2659,37 @@ namespace Titanium
// 6.2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXXXXX (45) // 6.2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXXXXX (45)
// Diff: ^^^^^ ^ ^^^^^ // Diff: ^^^^^ ^ ^^^^^
titaniumSayLink.push_back('\x12'); titanium_saylink.push_back('\x12');
titaniumSayLink.append(segments[segment_iter].substr(0, 31)); titanium_saylink.append(segments[segment_iter].substr(0, 31));
titaniumSayLink.append(segments[segment_iter].substr(36, 5)); titanium_saylink.append(segments[segment_iter].substr(36, 5));
if (segments[segment_iter][41] == '0') if (segments[segment_iter][41] == '0')
titaniumSayLink.push_back(segments[segment_iter][42]); titanium_saylink.push_back(segments[segment_iter][42]);
else else
titaniumSayLink.push_back('F'); titanium_saylink.push_back('F');
titaniumSayLink.append(segments[segment_iter].substr(48)); titanium_saylink.append(segments[segment_iter].substr(48));
titaniumSayLink.push_back('\x12'); titanium_saylink.push_back('\x12');
} }
else { else {
titaniumSayLink.append(segments[segment_iter]); titanium_saylink.append(segments[segment_iter]);
} }
} }
} }
static inline void TitaniumToServerSayLink(std::string& serverSayLink, const std::string& titaniumSayLink) static inline void TitaniumToServerSayLink(std::string &server_saylink, const std::string &titanium_saylink)
{ {
if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (titaniumSayLink.find('\x12') == std::string::npos)) { if ((EQEmu::constants::SAY_LINK_BODY_SIZE == constants::SAY_LINK_BODY_SIZE) || (titanium_saylink.find('\x12') == std::string::npos)) {
serverSayLink = titaniumSayLink; server_saylink = titanium_saylink;
return; return;
} }
auto segments = SplitString(titaniumSayLink, '\x12'); auto segments = SplitString(titanium_saylink, '\x12');
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) { for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) { if (segment_iter & 1) {
if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) { if (segments[segment_iter].length() <= constants::SAY_LINK_BODY_SIZE) {
serverSayLink.append(segments[segment_iter]); server_saylink.append(segments[segment_iter]);
// TODO: log size mismatch error // TODO: log size mismatch error
continue; continue;
} }
@ -2712,91 +2699,89 @@ namespace Titanium
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56) // RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
// Diff: ^^^^^ ^ ^^^^^ // Diff: ^^^^^ ^ ^^^^^
serverSayLink.push_back('\x12'); server_saylink.push_back('\x12');
serverSayLink.append(segments[segment_iter].substr(0, 31)); server_saylink.append(segments[segment_iter].substr(0, 31));
serverSayLink.append("00000"); server_saylink.append("00000");
serverSayLink.append(segments[segment_iter].substr(31, 5)); server_saylink.append(segments[segment_iter].substr(31, 5));
serverSayLink.push_back('0'); server_saylink.push_back('0');
serverSayLink.push_back(segments[segment_iter][36]); server_saylink.push_back(segments[segment_iter][36]);
serverSayLink.append("00000"); server_saylink.append("00000");
serverSayLink.append(segments[segment_iter].substr(37)); server_saylink.append(segments[segment_iter].substr(37));
serverSayLink.push_back('\x12'); server_saylink.push_back('\x12');
} }
else { else {
serverSayLink.append(segments[segment_iter]); server_saylink.append(segments[segment_iter]);
} }
} }
} }
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot) static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot) {
{
switch (slot) { switch (slot) {
case EQEmu::CastingSlot::Gem1: case EQEmu::CastingSlot::Gem1:
return CastingSlot::Gem1; return CastingSlot::Gem1;
case EQEmu::CastingSlot::Gem2: case EQEmu::CastingSlot::Gem2:
return CastingSlot::Gem2; return CastingSlot::Gem2;
case EQEmu::CastingSlot::Gem3: case EQEmu::CastingSlot::Gem3:
return CastingSlot::Gem3; return CastingSlot::Gem3;
case EQEmu::CastingSlot::Gem4: case EQEmu::CastingSlot::Gem4:
return CastingSlot::Gem4; return CastingSlot::Gem4;
case EQEmu::CastingSlot::Gem5: case EQEmu::CastingSlot::Gem5:
return CastingSlot::Gem5; return CastingSlot::Gem5;
case EQEmu::CastingSlot::Gem6: case EQEmu::CastingSlot::Gem6:
return CastingSlot::Gem6; return CastingSlot::Gem6;
case EQEmu::CastingSlot::Gem7: case EQEmu::CastingSlot::Gem7:
return CastingSlot::Gem7; return CastingSlot::Gem7;
case EQEmu::CastingSlot::Gem8: case EQEmu::CastingSlot::Gem8:
return CastingSlot::Gem8; return CastingSlot::Gem8;
case EQEmu::CastingSlot::Gem9: case EQEmu::CastingSlot::Gem9:
return CastingSlot::Gem9; return CastingSlot::Gem9;
case EQEmu::CastingSlot::Item: case EQEmu::CastingSlot::Item:
return CastingSlot::Item; return CastingSlot::Item;
case EQEmu::CastingSlot::PotionBelt: case EQEmu::CastingSlot::PotionBelt:
return CastingSlot::PotionBelt; return CastingSlot::PotionBelt;
case EQEmu::CastingSlot::Discipline: case EQEmu::CastingSlot::Discipline:
return CastingSlot::Discipline; return CastingSlot::Discipline;
case EQEmu::CastingSlot::AltAbility: case EQEmu::CastingSlot::AltAbility:
return CastingSlot::AltAbility; return CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something default: // we shouldn't have any issues with other slots ... just return something
return CastingSlot::Discipline; return CastingSlot::Discipline;
} }
} }
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation) static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 item_location) {
{
switch (slot) { switch (slot) {
case CastingSlot::Gem1: case CastingSlot::Gem1:
return EQEmu::CastingSlot::Gem1; return EQEmu::CastingSlot::Gem1;
case CastingSlot::Gem2: case CastingSlot::Gem2:
return EQEmu::CastingSlot::Gem2; return EQEmu::CastingSlot::Gem2;
case CastingSlot::Gem3: case CastingSlot::Gem3:
return EQEmu::CastingSlot::Gem3; return EQEmu::CastingSlot::Gem3;
case CastingSlot::Gem4: case CastingSlot::Gem4:
return EQEmu::CastingSlot::Gem4; return EQEmu::CastingSlot::Gem4;
case CastingSlot::Gem5: case CastingSlot::Gem5:
return EQEmu::CastingSlot::Gem5; return EQEmu::CastingSlot::Gem5;
case CastingSlot::Gem6: case CastingSlot::Gem6:
return EQEmu::CastingSlot::Gem6; return EQEmu::CastingSlot::Gem6;
case CastingSlot::Gem7: case CastingSlot::Gem7:
return EQEmu::CastingSlot::Gem7; return EQEmu::CastingSlot::Gem7;
case CastingSlot::Gem8: case CastingSlot::Gem8:
return EQEmu::CastingSlot::Gem8; return EQEmu::CastingSlot::Gem8;
case CastingSlot::Gem9: case CastingSlot::Gem9:
return EQEmu::CastingSlot::Gem9; return EQEmu::CastingSlot::Gem9;
case CastingSlot::Ability: case CastingSlot::Ability:
return EQEmu::CastingSlot::Ability; return EQEmu::CastingSlot::Ability;
// Tit uses 10 for item and discipline casting, but items have a valid location // Tit uses 10 for item and discipline casting, but items have a valid location
case CastingSlot::Item: case CastingSlot::Item:
if (itemlocation == INVALID_INDEX) if (item_location == INVALID_INDEX)
return EQEmu::CastingSlot::Discipline;
else
return EQEmu::CastingSlot::Item;
case CastingSlot::PotionBelt:
return EQEmu::CastingSlot::PotionBelt;
case CastingSlot::AltAbility:
return EQEmu::CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return EQEmu::CastingSlot::Discipline; return EQEmu::CastingSlot::Discipline;
else
return EQEmu::CastingSlot::Item;
case CastingSlot::PotionBelt:
return EQEmu::CastingSlot::PotionBelt;
case CastingSlot::AltAbility:
return EQEmu::CastingSlot::AltAbility;
default: // we shouldn't have any issues with other slots ... just return something
return EQEmu::CastingSlot::Discipline;
} }
} }

View File

@ -38,10 +38,10 @@ int Lua_Inventory::PushCursor(Lua_ItemInst item) {
return self->PushCursor(*inst); return self->PushCursor(*inst);
} }
bool Lua_Inventory::SwapItem(int slot_a, int slot_b) { bool Lua_Inventory::SwapItem(int source_slot, int destination_slot) {
Lua_Safe_Call_Bool(); Lua_Safe_Call_Bool();
EQEmu::InventoryProfile::SwapItemFailState fail_state = EQEmu::InventoryProfile::swapInvalid; EQEmu::InventoryProfile::SwapItemFailState fail_state = EQEmu::InventoryProfile::swapInvalid;
return self->SwapItem(slot_a, slot_b, fail_state); return self->SwapItem(source_slot, destination_slot, fail_state);
} }
bool Lua_Inventory::DeleteItem(int slot_id) { bool Lua_Inventory::DeleteItem(int slot_id) {

View File

@ -39,7 +39,7 @@ public:
Lua_ItemInst GetItem(int slot_id, int bag_slot); Lua_ItemInst GetItem(int slot_id, int bag_slot);
int PutItem(int slot_id, Lua_ItemInst item); int PutItem(int slot_id, Lua_ItemInst item);
int PushCursor(Lua_ItemInst item); int PushCursor(Lua_ItemInst item);
bool SwapItem(int slot_a, int slot_b); bool SwapItem(int source_slot, int destination_slot);
bool DeleteItem(int slot_id); bool DeleteItem(int slot_id);
bool DeleteItem(int slot_id, int quantity); bool DeleteItem(int slot_id, int quantity);
bool CheckNoDrop(int slot_id); bool CheckNoDrop(int slot_id);