Rework of eq_dictionary

This commit is contained in:
Uleat
2016-04-07 17:21:55 -04:00
parent 6ea061dc55
commit e75a53b775
70 changed files with 2786 additions and 2779 deletions
+159 -159
View File
@@ -27,13 +27,13 @@ namespace RoF
char* SerializeItem(const ItemInst *inst, int16 slot_id, uint32 *length, uint8 depth);
// server to client inventory location converters
static inline structs::ItemSlotStruct ServerToRoFSlot(uint32 serverSlot);
static inline structs::MainInvItemSlotStruct ServerToRoFMainInvSlot(uint32 serverSlot);
static inline structs::InventorySlot_Struct ServerToRoFSlot(uint32 serverSlot);
static inline structs::TypelessInventorySlot_Struct ServerToRoFTypelessSlot(uint32 serverSlot);
static inline uint32 ServerToRoFCorpseSlot(uint32 serverCorpseSlot);
// client to server inventory location converters
static inline uint32 RoFToServerSlot(structs::ItemSlotStruct rofSlot);
static inline uint32 RoFToServerMainInvSlot(structs::MainInvItemSlotStruct rofSlot);
static inline uint32 RoFToServerSlot(structs::InventorySlot_Struct rofSlot);
static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rofSlot);
static inline uint32 RoFToServerCorpseSlot(uint32 rofCorpseSlot);
// server to client text link converter
@@ -162,7 +162,7 @@ namespace RoF
eq->unknown000 = 1;
OUT(npcid);
eq->slot = ServerToRoFMainInvSlot(emu->slot);
eq->inventory_slot = ServerToRoFTypelessSlot(emu->slot);
OUT(charges);
OUT(sell_price);
@@ -214,7 +214,7 @@ namespace RoF
SETUP_DIRECT_ENCODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
OUT(merchant_entity_id);
eq->slot_id = ServerToRoFMainInvSlot(emu->slot_id);
eq->inventory_slot = ServerToRoFTypelessSlot(emu->slot_id);
OUT(charges);
OUT(cost);
@@ -238,7 +238,7 @@ namespace RoF
ENCODE_LENGTH_EXACT(ApplyPoison_Struct);
SETUP_DIRECT_ENCODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
eq->inventorySlot = ServerToRoFMainInvSlot(emu->inventorySlot);
eq->inventory_slot = ServerToRoFTypelessSlot(emu->inventorySlot);
OUT(success);
FINISH_ENCODE();
@@ -481,7 +481,7 @@ namespace RoF
OUT(slot);
OUT(spell_id);
eq->inventoryslot = ServerToRoFSlot(emu->inventoryslot);
eq->inventory_slot = ServerToRoFSlot(emu->inventoryslot);
//OUT(inventoryslot);
OUT(target_id);
@@ -1536,7 +1536,7 @@ namespace RoF
ENCODE_LENGTH_EXACT(ItemVerifyReply_Struct);
SETUP_DIRECT_ENCODE(ItemVerifyReply_Struct, structs::ItemVerifyReply_Struct);
eq->slot = ServerToRoFSlot(emu->slot);
eq->inventory_slot = ServerToRoFSlot(emu->slot);
OUT(spell);
OUT(target);
@@ -2342,7 +2342,7 @@ namespace RoF
outapp->WriteUInt32(consts::BANDOLIERS_SIZE);
// Copy bandoliers where server and client indexes converge
for (uint32 r = 0; r < EmuConstants::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) {
for (uint32 r = 0; r < EQEmu::Constants::BANDOLIERS_SIZE && r < consts::BANDOLIERS_SIZE; ++r) {
outapp->WriteString(emu->bandoliers[r].Name);
for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true
outapp->WriteString(emu->bandoliers[r].Items[j].Name);
@@ -2357,7 +2357,7 @@ namespace RoF
}
}
// Nullify bandoliers where server and client indexes diverge, with a client bias
for (uint32 r = EmuConstants::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) {
for (uint32 r = EQEmu::Constants::BANDOLIERS_SIZE; r < consts::BANDOLIERS_SIZE; ++r) {
outapp->WriteString("");
for (uint32 j = 0; j < consts::BANDOLIER_ITEM_COUNT; ++j) { // Will need adjusting if 'server != client' is ever true
outapp->WriteString("");
@@ -2369,7 +2369,7 @@ namespace RoF
outapp->WriteUInt32(consts::POTION_BELT_ITEM_COUNT);
// Copy potion belt where server and client indexes converge
for (uint32 r = 0; r < EmuConstants::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) {
for (uint32 r = 0; r < EQEmu::Constants::POTION_BELT_ITEM_COUNT && r < consts::POTION_BELT_ITEM_COUNT; ++r) {
outapp->WriteString(emu->potionbelt.Items[r].Name);
outapp->WriteUInt32(emu->potionbelt.Items[r].ID);
if (emu->potionbelt.Items[r].Icon) {
@@ -2381,7 +2381,7 @@ namespace RoF
}
}
// Nullify potion belt where server and client indexes diverge, with a client bias
for (uint32 r = EmuConstants::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) {
for (uint32 r = EQEmu::Constants::POTION_BELT_ITEM_COUNT; r < consts::POTION_BELT_ITEM_COUNT; ++r) {
outapp->WriteString("");
outapp->WriteUInt32(0);
outapp->WriteSInt32(-1);
@@ -2502,9 +2502,9 @@ namespace RoF
outapp->WriteUInt8(0); // Unknown
outapp->WriteUInt8(0); // Unknown
outapp->WriteUInt32(EmuConstants::TRIBUTE_SIZE);
outapp->WriteUInt32(EQEmu::Constants::TRIBUTE_SIZE);
for (uint32 r = 0; r < EmuConstants::TRIBUTE_SIZE; r++)
for (uint32 r = 0; r < EQEmu::Constants::TRIBUTE_SIZE; r++)
{
outapp->WriteUInt32(emu->tributes[r].tribute);
outapp->WriteUInt32(emu->tributes[r].tier);
@@ -2820,12 +2820,12 @@ namespace RoF
OUT(object_type);
OUT(some_id);
eq->container_slot = ServerToRoFSlot(emu->unknown1);
structs::ItemSlotStruct RoFSlot;
RoFSlot.SlotType = 8; // Observed
structs::InventorySlot_Struct RoFSlot;
RoFSlot.Type = 8; // Observed
RoFSlot.Unknown02 = 0;
RoFSlot.MainSlot = 0xffff;
RoFSlot.SubSlot = 0xffff;
RoFSlot.AugSlot = 0xffff;
RoFSlot.Slot = 0xffff;
RoFSlot.Sub = 0xffff;
RoFSlot.Aug = 0xffff;
RoFSlot.Unknown01 = 0;
eq->unknown_slot = RoFSlot;
OUT(recipe_id);
@@ -3037,7 +3037,7 @@ namespace RoF
eq_cse->Gender = emu_cse->Gender;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < _MaterialCount; equip_index++) {
for (int equip_index = 0; equip_index < MaterialCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
@@ -3154,7 +3154,7 @@ namespace RoF
SETUP_DIRECT_ENCODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
OUT(npcid);
eq->itemslot = ServerToRoFMainInvSlot(emu->itemslot);
eq->inventory_slot = ServerToRoFTypelessSlot(emu->itemslot);
//OUT(itemslot);
OUT(quantity);
OUT(price);
@@ -3679,7 +3679,7 @@ namespace RoF
ENCODE_LENGTH_EXACT(TributeItem_Struct);
SETUP_DIRECT_ENCODE(TributeItem_Struct, structs::TributeItem_Struct);
eq->slot = ServerToRoFSlot(emu->slot);
eq->inventory_slot = ServerToRoFSlot(emu->slot);
OUT(quantity);
OUT(tribute_master_id);
OUT(tribute_points);
@@ -4164,7 +4164,7 @@ namespace RoF
SETUP_DIRECT_DECODE(Adventure_Sell_Struct, structs::Adventure_Sell_Struct);
IN(npcid);
emu->slot = RoFToServerMainInvSlot(eq->slot);
emu->slot = RoFToServerTypelessSlot(eq->inventory_slot);
IN(charges);
IN(sell_price);
@@ -4177,7 +4177,7 @@ namespace RoF
SETUP_DIRECT_DECODE(AltCurrencySellItem_Struct, structs::AltCurrencySellItem_Struct);
IN(merchant_entity_id);
emu->slot_id = RoFToServerMainInvSlot(eq->slot_id);
emu->slot_id = RoFToServerTypelessSlot(eq->inventory_slot);
IN(charges);
IN(cost);
@@ -4190,7 +4190,7 @@ namespace RoF
SETUP_DIRECT_DECODE(AltCurrencySelectItem_Struct, structs::AltCurrencySelectItem_Struct);
IN(merchant_entity_id);
emu->slot_id = RoFToServerMainInvSlot(eq->slot_id);
emu->slot_id = RoFToServerTypelessSlot(eq->inventory_slot);
FINISH_DIRECT_DECODE();
}
@@ -4212,7 +4212,7 @@ namespace RoF
DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct);
SETUP_DIRECT_DECODE(ApplyPoison_Struct, structs::ApplyPoison_Struct);
emu->inventorySlot = RoFToServerMainInvSlot(eq->inventorySlot);
emu->inventorySlot = RoFToServerTypelessSlot(eq->inventory_slot);
IN(success);
FINISH_DIRECT_DECODE();
@@ -4321,7 +4321,7 @@ namespace RoF
IN(slot);
IN(spell_id);
emu->inventoryslot = RoFToServerSlot(eq->inventoryslot);
emu->inventoryslot = RoFToServerSlot(eq->inventory_slot);
//IN(inventoryslot);
IN(target_id);
@@ -4449,7 +4449,7 @@ namespace RoF
DECODE_LENGTH_EXACT(structs::Consume_Struct);
SETUP_DIRECT_DECODE(Consume_Struct, structs::Consume_Struct);
emu->slot = RoFToServerSlot(eq->slot);
emu->slot = RoFToServerSlot(eq->inventory_slot);
IN(auto_consumed);
IN(type);
@@ -4810,7 +4810,7 @@ namespace RoF
IN(item_id);
int r;
for (r = 0; r < EmuConstants::ITEM_COMMON_SIZE; r++) {
for (r = 0; r < EQEmu::Constants::ITEM_COMMON_SIZE; r++) {
IN(augments[r]);
}
// Max Augs is now 6, but no code to support that many yet
@@ -4825,7 +4825,7 @@ namespace RoF
DECODE_LENGTH_EXACT(structs::ItemVerifyRequest_Struct);
SETUP_DIRECT_DECODE(ItemVerifyRequest_Struct, structs::ItemVerifyRequest_Struct);
emu->slot = RoFToServerSlot(eq->slot);
emu->slot = RoFToServerSlot(eq->inventory_slot);
IN(target);
FINISH_DIRECT_DECODE();
@@ -4866,7 +4866,7 @@ namespace RoF
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
//Log.LogDebugType(Logs::General, Logs::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot);
Log.Out(Logs::General, Logs::Netcode, "[RoF] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
Log.Out(Logs::General, Logs::Netcode, "[RoF] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.Type, eq->to_slot.Type, eq->from_slot.Slot, eq->to_slot.Slot, eq->from_slot.Sub, eq->to_slot.Sub, eq->from_slot.Aug, eq->to_slot.Aug, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
emu->from_slot = RoFToServerSlot(eq->from_slot);
emu->to_slot = RoFToServerSlot(eq->to_slot);
IN(number_in_stack);
@@ -5015,7 +5015,7 @@ namespace RoF
SETUP_DIRECT_DECODE(Merchant_Purchase_Struct, structs::Merchant_Purchase_Struct);
IN(npcid);
emu->itemslot = RoFToServerMainInvSlot(eq->itemslot);
emu->itemslot = RoFToServerTypelessSlot(eq->inventory_slot);
//IN(itemslot);
IN(quantity);
IN(price);
@@ -5114,7 +5114,7 @@ namespace RoF
DECODE_LENGTH_EXACT(structs::TributeItem_Struct);
SETUP_DIRECT_DECODE(TributeItem_Struct, structs::TributeItem_Struct);
emu->slot = RoFToServerSlot(eq->slot);
emu->slot = RoFToServerSlot(eq->inventory_slot);
IN(quantity);
IN(tribute_master_id);
IN(tribute_points);
@@ -5214,12 +5214,12 @@ namespace RoF
hdr.stacksize = stackable ? charges : 1;
hdr.unknown004 = 0;
structs::ItemSlotStruct slot_id = ServerToRoFSlot(slot_id_in);
structs::InventorySlot_Struct slot_id = ServerToRoFSlot(slot_id_in);
hdr.slot_type = (merchant_slot == 0) ? slot_id.SlotType : 9; // 9 is merchant 20 is reclaim items?
hdr.main_slot = (merchant_slot == 0) ? slot_id.MainSlot : merchant_slot;
hdr.sub_slot = (merchant_slot == 0) ? slot_id.SubSlot : 0xffff;
hdr.unknown013 = (merchant_slot == 0) ? slot_id.AugSlot : 0xffff;
hdr.slot_type = (merchant_slot == 0) ? slot_id.Type : 9; // 9 is merchant 20 is reclaim items?
hdr.main_slot = (merchant_slot == 0) ? slot_id.Slot : merchant_slot;
hdr.sub_slot = (merchant_slot == 0) ? slot_id.Sub : 0xffff;
hdr.unknown013 = (merchant_slot == 0) ? slot_id.Aug : 0xffff;
hdr.price = inst->GetPrice();
hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount();
//hdr.merchant_slot = (merchant_slot == 0) ? 1 : 0xffffffff;
@@ -5678,7 +5678,7 @@ namespace RoF
uint32 SubLengths[10];
for (int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; ++x) {
for (int x = SUB_BEGIN; x < EQEmu::Constants::ITEM_CONTAINER_SIZE; ++x) {
SubSerializations[x] = nullptr;
@@ -5690,15 +5690,15 @@ namespace RoF
iqbs.subitem_count++;
if (slot_id_in >= EmuConstants::GENERAL_BEGIN && slot_id_in <= EmuConstants::GENERAL_END) // (< 30) - no cursor?
if (slot_id_in >= EQEmu::Constants::GENERAL_BEGIN && slot_id_in <= EQEmu::Constants::GENERAL_END) // (< 30) - no cursor?
//SubSlotNumber = (((slot_id_in + 3) * 10) + x + 1);
SubSlotNumber = (((slot_id_in + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + x + 1);
else if (slot_id_in >= EmuConstants::BANK_BEGIN && slot_id_in <= EmuConstants::BANK_END)
SubSlotNumber = (((slot_id_in + 3) * EQEmu::Constants::ITEM_CONTAINER_SIZE) + x + 1);
else if (slot_id_in >= EQEmu::Constants::BANK_BEGIN && slot_id_in <= EQEmu::Constants::BANK_END)
//SubSlotNumber = (((slot_id_in - 2000) * 10) + 2030 + x + 1);
SubSlotNumber = (((slot_id_in - EmuConstants::BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::BANK_BAGS_BEGIN + x);
else if (slot_id_in >= EmuConstants::SHARED_BANK_BEGIN && slot_id_in <= EmuConstants::SHARED_BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::Constants::BANK_BEGIN) * EQEmu::Constants::ITEM_CONTAINER_SIZE) + EQEmu::Constants::BANK_BAGS_BEGIN + x);
else if (slot_id_in >= EQEmu::Constants::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::Constants::SHARED_BANK_END)
//SubSlotNumber = (((slot_id_in - 2500) * 10) + 2530 + x + 1);
SubSlotNumber = (((slot_id_in - EmuConstants::SHARED_BANK_BEGIN) * EmuConstants::ITEM_CONTAINER_SIZE) + EmuConstants::SHARED_BANK_BAGS_BEGIN + x);
SubSlotNumber = (((slot_id_in - EQEmu::Constants::SHARED_BANK_BEGIN) * EQEmu::Constants::ITEM_CONTAINER_SIZE) + EQEmu::Constants::SHARED_BANK_BAGS_BEGIN + x);
else
SubSlotNumber = slot_id_in; // ???????
@@ -5713,7 +5713,7 @@ namespace RoF
ss.write((const char*)&iqbs, sizeof(RoF::structs::ItemQuaternaryBodyStruct));
for (int x = SUB_BEGIN; x < EmuConstants::ITEM_CONTAINER_SIZE; ++x) {
for (int x = SUB_BEGIN; x < EQEmu::Constants::ITEM_CONTAINER_SIZE; ++x) {
if (SubSerializations[x]) {
@@ -5733,30 +5733,30 @@ namespace RoF
return item_serial;
}
static inline structs::ItemSlotStruct ServerToRoFSlot(uint32 serverSlot)
static inline structs::InventorySlot_Struct ServerToRoFSlot(uint32 serverSlot)
{
structs::ItemSlotStruct RoFSlot;
RoFSlot.SlotType = INVALID_INDEX;
structs::InventorySlot_Struct RoFSlot;
RoFSlot.Type = INVALID_INDEX;
RoFSlot.Unknown02 = NOT_USED;
RoFSlot.MainSlot = INVALID_INDEX;
RoFSlot.SubSlot = INVALID_INDEX;
RoFSlot.AugSlot = INVALID_INDEX;
RoFSlot.Slot = INVALID_INDEX;
RoFSlot.Sub = INVALID_INDEX;
RoFSlot.Aug = INVALID_INDEX;
RoFSlot.Unknown01 = NOT_USED;
uint32 TempSlot = 0;
if (serverSlot < 56 || serverSlot == MainPowerSource) { // Main Inventory and Cursor
RoFSlot.SlotType = maps::MapPossessions;
RoFSlot.MainSlot = serverSlot;
if (serverSlot < 56 || serverSlot == SlotPowerSource) { // Main Inventory and Cursor
RoFSlot.Type = inventory::TypePossessions;
RoFSlot.Slot = serverSlot;
if (serverSlot == MainPowerSource)
RoFSlot.MainSlot = slots::MainPowerSource;
if (serverSlot == SlotPowerSource)
RoFSlot.Slot = inventory::SlotPowerSource;
else if (serverSlot >= MainCursor) // Cursor and Extended Corpse Inventory
RoFSlot.MainSlot += 3;
else if (serverSlot >= SlotCursor) // Cursor and Extended Corpse Inventory
RoFSlot.Slot += 3;
else if (serverSlot >= MainAmmo) // (> 20)
RoFSlot.MainSlot += 1;
else if (serverSlot >= SlotAmmo) // (> 20)
RoFSlot.Slot += 1;
}
/*else if (ServerSlot < 51) { // Cursor Buffer
@@ -5764,51 +5764,51 @@ namespace RoF
RoFSlot.MainSlot = ServerSlot - 31;
}*/
else if (serverSlot >= EmuConstants::GENERAL_BAGS_BEGIN && serverSlot <= EmuConstants::CURSOR_BAG_END) { // (> 250 && < 341)
RoFSlot.SlotType = maps::MapPossessions;
else if (serverSlot >= EQEmu::Constants::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::Constants::CURSOR_BAG_END) { // (> 250 && < 341)
RoFSlot.Type = inventory::TypePossessions;
TempSlot = serverSlot - 1;
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 2;
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE);
RoFSlot.Slot = int(TempSlot / EQEmu::Constants::ITEM_CONTAINER_SIZE) - 2;
RoFSlot.Sub = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::Constants::ITEM_CONTAINER_SIZE);
if (RoFSlot.MainSlot >= slots::MainGeneral9) // (> 30)
RoFSlot.MainSlot = slots::MainCursor;
if (RoFSlot.Slot >= inventory::SlotGeneral9) // (> 30)
RoFSlot.Slot = inventory::SlotCursor;
}
else if (serverSlot >= EmuConstants::TRIBUTE_BEGIN && serverSlot <= EmuConstants::TRIBUTE_END) { // Tribute
RoFSlot.SlotType = maps::MapTribute;
RoFSlot.MainSlot = serverSlot - EmuConstants::TRIBUTE_BEGIN;
else if (serverSlot >= EQEmu::Constants::TRIBUTE_BEGIN && serverSlot <= EQEmu::Constants::TRIBUTE_END) { // Tribute
RoFSlot.Type = inventory::TypeTribute;
RoFSlot.Slot = serverSlot - EQEmu::Constants::TRIBUTE_BEGIN;
}
else if (serverSlot >= EmuConstants::BANK_BEGIN && serverSlot <= EmuConstants::BANK_BAGS_END) {
RoFSlot.SlotType = maps::MapBank;
TempSlot = serverSlot - EmuConstants::BANK_BEGIN;
RoFSlot.MainSlot = TempSlot;
else if (serverSlot >= EQEmu::Constants::BANK_BEGIN && serverSlot <= EQEmu::Constants::BANK_BAGS_END) {
RoFSlot.Type = inventory::TypeBank;
TempSlot = serverSlot - EQEmu::Constants::BANK_BEGIN;
RoFSlot.Slot = TempSlot;
if (TempSlot > 30) { // (> 30)
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 3;
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE);
RoFSlot.Slot = int(TempSlot / EQEmu::Constants::ITEM_CONTAINER_SIZE) - 3;
RoFSlot.Sub = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::Constants::ITEM_CONTAINER_SIZE);
}
}
else if (serverSlot >= EmuConstants::SHARED_BANK_BEGIN && serverSlot <= EmuConstants::SHARED_BANK_BAGS_END) {
RoFSlot.SlotType = maps::MapSharedBank;
TempSlot = serverSlot - EmuConstants::SHARED_BANK_BEGIN;
RoFSlot.MainSlot = TempSlot;
else if (serverSlot >= EQEmu::Constants::SHARED_BANK_BEGIN && serverSlot <= EQEmu::Constants::SHARED_BANK_BAGS_END) {
RoFSlot.Type = inventory::TypeSharedBank;
TempSlot = serverSlot - EQEmu::Constants::SHARED_BANK_BEGIN;
RoFSlot.Slot = TempSlot;
if (TempSlot > 30) { // (> 30)
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 3;
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE);
RoFSlot.Slot = int(TempSlot / EQEmu::Constants::ITEM_CONTAINER_SIZE) - 3;
RoFSlot.Sub = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::Constants::ITEM_CONTAINER_SIZE);
}
}
else if (serverSlot >= EmuConstants::TRADE_BEGIN && serverSlot <= EmuConstants::TRADE_BAGS_END) {
RoFSlot.SlotType = maps::MapTrade;
TempSlot = serverSlot - EmuConstants::TRADE_BEGIN;
RoFSlot.MainSlot = TempSlot;
else if (serverSlot >= EQEmu::Constants::TRADE_BEGIN && serverSlot <= EQEmu::Constants::TRADE_BAGS_END) {
RoFSlot.Type = inventory::TypeTrade;
TempSlot = serverSlot - EQEmu::Constants::TRADE_BEGIN;
RoFSlot.Slot = TempSlot;
if (TempSlot > 30) {
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 3;
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE);
RoFSlot.Slot = int(TempSlot / EQEmu::Constants::ITEM_CONTAINER_SIZE) - 3;
RoFSlot.Sub = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::Constants::ITEM_CONTAINER_SIZE);
}
/*
@@ -5825,38 +5825,38 @@ namespace RoF
*/
}
else if (serverSlot >= EmuConstants::WORLD_BEGIN && serverSlot <= EmuConstants::WORLD_END) {
RoFSlot.SlotType = maps::MapWorld;
TempSlot = serverSlot - EmuConstants::WORLD_BEGIN;
RoFSlot.MainSlot = TempSlot;
else if (serverSlot >= EQEmu::Constants::WORLD_BEGIN && serverSlot <= EQEmu::Constants::WORLD_END) {
RoFSlot.Type = inventory::TypeWorld;
TempSlot = serverSlot - EQEmu::Constants::WORLD_BEGIN;
RoFSlot.Slot = TempSlot;
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.Type, RoFSlot.Unknown02, RoFSlot.Slot, RoFSlot.Sub, RoFSlot.Aug, RoFSlot.Unknown01);
return RoFSlot;
}
static inline structs::MainInvItemSlotStruct ServerToRoFMainInvSlot(uint32 serverSlot)
static inline structs::TypelessInventorySlot_Struct ServerToRoFTypelessSlot(uint32 serverSlot)
{
structs::MainInvItemSlotStruct RoFSlot;
RoFSlot.MainSlot = INVALID_INDEX;
RoFSlot.SubSlot = INVALID_INDEX;
RoFSlot.AugSlot = INVALID_INDEX;
structs::TypelessInventorySlot_Struct RoFSlot;
RoFSlot.Slot = INVALID_INDEX;
RoFSlot.Sub = INVALID_INDEX;
RoFSlot.Aug = INVALID_INDEX;
RoFSlot.Unknown01 = NOT_USED;
uint32 TempSlot = 0;
if (serverSlot < 56 || serverSlot == MainPowerSource) { // (< 52)
RoFSlot.MainSlot = serverSlot;
if (serverSlot < 56 || serverSlot == SlotPowerSource) { // (< 52)
RoFSlot.Slot = serverSlot;
if (serverSlot == MainPowerSource)
RoFSlot.MainSlot = slots::MainPowerSource;
if (serverSlot == SlotPowerSource)
RoFSlot.Slot = inventory::SlotPowerSource;
else if (serverSlot >= MainCursor) // Cursor and Extended Corpse Inventory
RoFSlot.MainSlot += 3;
else if (serverSlot >= SlotCursor) // Cursor and Extended Corpse Inventory
RoFSlot.Slot += 3;
else if (serverSlot >= MainAmmo) // Ammo and Personl Inventory
RoFSlot.MainSlot += 1;
else if (serverSlot >= SlotAmmo) // Ammo and Personl Inventory
RoFSlot.Slot += 1;
/*else if (ServerSlot >= MainCursor) { // Cursor
RoFSlot.MainSlot = slots::MainCursor;
@@ -5866,13 +5866,13 @@ namespace RoF
}*/
}
else if (serverSlot >= EmuConstants::GENERAL_BAGS_BEGIN && serverSlot <= EmuConstants::CURSOR_BAG_END) {
else if (serverSlot >= EQEmu::Constants::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::Constants::CURSOR_BAG_END) {
TempSlot = serverSlot - 1;
RoFSlot.MainSlot = int(TempSlot / EmuConstants::ITEM_CONTAINER_SIZE) - 2;
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE);
RoFSlot.Slot = int(TempSlot / EQEmu::Constants::ITEM_CONTAINER_SIZE) - 2;
RoFSlot.Sub = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::Constants::ITEM_CONTAINER_SIZE);
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.Slot, RoFSlot.Sub, RoFSlot.Aug, RoFSlot.Unknown01);
return RoFSlot;
}
@@ -5882,17 +5882,17 @@ namespace RoF
return (serverCorpseSlot + 1);
}
static inline uint32 RoFToServerSlot(structs::ItemSlotStruct rofSlot)
static inline uint32 RoFToServerSlot(structs::InventorySlot_Struct rofSlot)
{
uint32 ServerSlot = INVALID_INDEX;
uint32 TempSlot = 0;
if (rofSlot.SlotType == maps::MapPossessions && rofSlot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 51)
if (rofSlot.MainSlot == slots::MainPowerSource)
TempSlot = MainPowerSource;
if (rofSlot.Type == inventory::TypePossessions && rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51)
if (rofSlot.Slot == inventory::SlotPowerSource)
TempSlot = SlotPowerSource;
else if (rofSlot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
TempSlot = rofSlot.MainSlot - 3;
else if (rofSlot.Slot >= inventory::SlotCursor) // Cursor and Extended Corpse Inventory
TempSlot = rofSlot.Slot - 3;
/*else if (RoFSlot.MainSlot == slots::MainGeneral9 || RoFSlot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF inventory/corpse slots
// Need to figure out what to do when we get these
@@ -5905,61 +5905,61 @@ namespace RoF
// For now, it's probably best to leave as-is and let this work itself out in the inventory rework.
}*/
else if (rofSlot.MainSlot >= slots::MainAmmo) // Ammo and Main Inventory
TempSlot = rofSlot.MainSlot - 1;
else if (rofSlot.Slot >= inventory::SlotAmmo) // Ammo and Main Inventory
TempSlot = rofSlot.Slot - 1;
else // Worn Slots
TempSlot = rofSlot.MainSlot;
TempSlot = rofSlot.Slot;
if (rofSlot.SubSlot >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rofSlot.SubSlot + 1;
if (rofSlot.Sub >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EQEmu::Constants::ITEM_CONTAINER_SIZE) + rofSlot.Sub + 1;
ServerSlot = TempSlot;
}
else if (rofSlot.SlotType == maps::MapBank) {
TempSlot = EmuConstants::BANK_BEGIN;
else if (rofSlot.Type == inventory::TypeBank) {
TempSlot = EQEmu::Constants::BANK_BEGIN;
if (rofSlot.SubSlot >= SUB_BEGIN)
TempSlot += ((rofSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rofSlot.SubSlot + 1;
if (rofSlot.Sub >= SUB_BEGIN)
TempSlot += ((rofSlot.Slot + 3) * EQEmu::Constants::ITEM_CONTAINER_SIZE) + rofSlot.Sub + 1;
else
TempSlot += rofSlot.MainSlot;
TempSlot += rofSlot.Slot;
ServerSlot = TempSlot;
}
else if (rofSlot.SlotType == maps::MapSharedBank) {
TempSlot = EmuConstants::SHARED_BANK_BEGIN;
else if (rofSlot.Type == inventory::TypeSharedBank) {
TempSlot = EQEmu::Constants::SHARED_BANK_BEGIN;
if (rofSlot.SubSlot >= SUB_BEGIN)
TempSlot += ((rofSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rofSlot.SubSlot + 1;
if (rofSlot.Sub >= SUB_BEGIN)
TempSlot += ((rofSlot.Slot + 3) * EQEmu::Constants::ITEM_CONTAINER_SIZE) + rofSlot.Sub + 1;
else
TempSlot += rofSlot.MainSlot;
TempSlot += rofSlot.Slot;
ServerSlot = TempSlot;
}
else if (rofSlot.SlotType == maps::MapTrade) {
TempSlot = EmuConstants::TRADE_BEGIN;
else if (rofSlot.Type == inventory::TypeTrade) {
TempSlot = EQEmu::Constants::TRADE_BEGIN;
if (rofSlot.SubSlot >= SUB_BEGIN)
TempSlot += ((rofSlot.MainSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rofSlot.SubSlot + 1;
if (rofSlot.Sub >= SUB_BEGIN)
TempSlot += ((rofSlot.Slot + 3) * EQEmu::Constants::ITEM_CONTAINER_SIZE) + rofSlot.Sub + 1;
// OLD CODE:
//TempSlot += 100 + (RoFSlot.MainSlot * EmuConstants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot;
//TempSlot += 100 + (RoFSlot.MainSlot * EQEmu::Constants::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot;
else
TempSlot += rofSlot.MainSlot;
TempSlot += rofSlot.Slot;
ServerSlot = TempSlot;
}
else if (rofSlot.SlotType == maps::MapWorld) {
TempSlot = EmuConstants::WORLD_BEGIN;
else if (rofSlot.Type == inventory::TypeWorld) {
TempSlot = EQEmu::Constants::WORLD_BEGIN;
if (rofSlot.MainSlot >= SUB_BEGIN)
TempSlot += rofSlot.MainSlot;
if (rofSlot.Slot >= SUB_BEGIN)
TempSlot += rofSlot.Slot;
ServerSlot = TempSlot;
}
@@ -5973,26 +5973,26 @@ namespace RoF
ServerSlot = TempSlot;
}*/
else if (rofSlot.SlotType == maps::MapGuildTribute) {
else if (rofSlot.Type == inventory::TypeGuildTribute) {
ServerSlot = INVALID_INDEX;
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rofSlot.SlotType, rofSlot.Unknown02, rofSlot.MainSlot, rofSlot.SubSlot, rofSlot.AugSlot, rofSlot.Unknown01, ServerSlot);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rofSlot.Type, rofSlot.Unknown02, rofSlot.Slot, rofSlot.Sub, rofSlot.Aug, rofSlot.Unknown01, ServerSlot);
return ServerSlot;
}
static inline uint32 RoFToServerMainInvSlot(structs::MainInvItemSlotStruct rofSlot)
static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rofSlot)
{
uint32 ServerSlot = INVALID_INDEX;
uint32 TempSlot = 0;
if (rofSlot.MainSlot < 57) { // Worn/Personal Inventory and Cursor (< 33)
if (rofSlot.MainSlot == slots::MainPowerSource)
TempSlot = MainPowerSource;
if (rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33)
if (rofSlot.Slot == inventory::SlotPowerSource)
TempSlot = SlotPowerSource;
else if (rofSlot.MainSlot >= slots::MainCursor) // Cursor and Extended Corpse Inventory
TempSlot = rofSlot.MainSlot - 3;
else if (rofSlot.Slot >= inventory::SlotCursor) // Cursor and Extended Corpse Inventory
TempSlot = rofSlot.Slot - 3;
/*else if (RoFSlot.MainSlot == slots::MainGeneral9 || RoFSlot.MainSlot == slots::MainGeneral10) { // 9th and 10th RoF inventory slots
// Need to figure out what to do when we get these
@@ -6000,19 +6000,19 @@ namespace RoF
// Same as above
}*/
else if (rofSlot.MainSlot >= slots::MainAmmo) // Main Inventory and Ammo Slots
TempSlot = rofSlot.MainSlot - 1;
else if (rofSlot.Slot >= inventory::SlotAmmo) // Main Inventory and Ammo Slots
TempSlot = rofSlot.Slot - 1;
else
TempSlot = rofSlot.MainSlot;
TempSlot = rofSlot.Slot;
if (rofSlot.SubSlot >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EmuConstants::ITEM_CONTAINER_SIZE) + rofSlot.SubSlot + 1;
if (rofSlot.Sub >= SUB_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EQEmu::Constants::ITEM_CONTAINER_SIZE) + rofSlot.Sub + 1;
ServerSlot = TempSlot;
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rofSlot.MainSlot, rofSlot.SubSlot, rofSlot.AugSlot, rofSlot.Unknown01, ServerSlot);
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", rofSlot.Slot, rofSlot.Sub, rofSlot.Aug, rofSlot.Unknown01, ServerSlot);
return ServerSlot;
}
@@ -6024,7 +6024,7 @@ namespace RoF
static inline void ServerToRoFTextLink(std::string& rofTextLink, const std::string& serverTextLink)
{
if ((consts::TEXT_LINK_BODY_LENGTH == EmuConstants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) {
if ((consts::TEXT_LINK_BODY_LENGTH == EQEmu::Constants::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) {
rofTextLink = serverTextLink;
return;
}
@@ -6033,7 +6033,7 @@ namespace RoF
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
if (segment_iter & 1) {
if (segments[segment_iter].length() <= EmuConstants::TEXT_LINK_BODY_LENGTH) {
if (segments[segment_iter].length() <= EQEmu::Constants::TEXT_LINK_BODY_LENGTH) {
rofTextLink.append(segments[segment_iter]);
// TODO: log size mismatch error
continue;
@@ -6063,7 +6063,7 @@ namespace RoF
static inline void RoFToServerTextLink(std::string& serverTextLink, const std::string& rofTextLink)
{
if ((EmuConstants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rofTextLink.find('\x12') == std::string::npos)) {
if ((EQEmu::Constants::TEXT_LINK_BODY_LENGTH == consts::TEXT_LINK_BODY_LENGTH) || (rofTextLink.find('\x12') == std::string::npos)) {
serverTextLink = rofTextLink;
return;
}