From 2da6d3f37c02f6c50d6b1336c55811644b720901 Mon Sep 17 00:00:00 2001 From: dannuic Date: Fri, 17 Apr 2026 14:57:35 -0600 Subject: [PATCH] Fixed item index mapping --- common/patches/tob.cpp | 35 +++++++++++++++++------------------ common/patches/tob_limits.h | 4 ++-- common/patches/tob_structs.h | 3 +-- tob/opcodes.md | 2 +- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/common/patches/tob.cpp b/common/patches/tob.cpp index c0ea35bda..159ec2643 100644 --- a/common/patches/tob.cpp +++ b/common/patches/tob.cpp @@ -471,7 +471,7 @@ namespace TOB int item_count = in->size / sizeof(EQ::InternalSerializedItem_Struct); if (!item_count || (in->size % sizeof(EQ::InternalSerializedItem_Struct)) != 0) { - Log(Logs::General, Logs::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", + LogNetcode("[STRUCTS] Wrong size on outbound {}: Got {}, expected multiple of {}", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(EQ::InternalSerializedItem_Struct)); delete in; @@ -2324,7 +2324,6 @@ namespace TOB eq->container_slot = ServerToTOBSlot(emu->unknown1); structs::InventorySlot_Struct TOBSlot; TOBSlot.Type = 8; // Observed - TOBSlot.Padding1 = 0; TOBSlot.Slot = 0xffff; TOBSlot.SubIndex = 0xffff; TOBSlot.AugIndex = 0xffff; @@ -5045,8 +5044,8 @@ namespace TOB TOBSlot.Slot = server_slot - EQ::invslot::WORLD_BEGIN; } - Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to TOB Slot [%i, %i, %i, %i]", - server_slot, TOBSlot.Type, TOBSlot.Slot, TOBSlot.SubIndex, TOBSlot.AugIndex); + Log(Logs::Detail, Logs::Netcode, fmt::format("Convert Server Slot {} to TOB Slot [{}, {}, {}, {}]", + server_slot, TOBSlot.Type, TOBSlot.Slot, TOBSlot.SubIndex, TOBSlot.AugIndex).c_str()); return TOBSlot; } @@ -5062,8 +5061,8 @@ namespace TOB if (TOBSlot.Slot != invslot::SLOT_INVALID) TOBSlot.Type = invtype::typeCorpse; - Log(Logs::Detail, Logs::Netcode, "Convert Server Corpse Slot %i to TOB Corpse Slot [%i, %i, %i, %i]", - server_corpse_slot, TOBSlot.Type, TOBSlot.Slot, TOBSlot.SubIndex, TOBSlot.AugIndex); + Log(Logs::Detail, Logs::Netcode, fmt::format("Convert Server Corpse Slot {} to TOB Corpse Slot [{}, {}, {}, {}]", + server_corpse_slot, TOBSlot.Type, TOBSlot.Slot, TOBSlot.SubIndex, TOBSlot.AugIndex).c_str()); return TOBSlot; } @@ -5103,8 +5102,8 @@ namespace TOB } } - Log(Logs::Detail, Logs::Netcode, "Convert Server Slot %i to TOB Typeless Slot [%i, %i, %i] (implied type: %i)", - server_slot, TOBSlot.Slot, TOBSlot.SubIndex, TOBSlot.AugIndex, server_type); + Log(Logs::Detail, Logs::Netcode, fmt::format("Convert Server Slot {} to TOB Typeless Slot [{}, {}, {}] (implied type: {})", + server_slot, TOBSlot.Slot, TOBSlot.SubIndex, TOBSlot.AugIndex, server_type).c_str()); return TOBSlot; } @@ -5112,8 +5111,8 @@ namespace TOB static inline uint32 TOBToServerSlot(structs::InventorySlot_Struct tob_slot) { if (tob_slot.AugIndex < invaug::SOCKET_INVALID || tob_slot.AugIndex >= invaug::SOCKET_COUNT) { - Log(Logs::Detail, Logs::Netcode, "Convert TOB Slot [%i, %i, %i, %i] to Server Slot %i", - tob_slot.Type, tob_slot.Slot, tob_slot.SubIndex, tob_slot.AugIndex, EQ::invslot::SLOT_INVALID); + Log(Logs::Detail, Logs::Netcode, fmt::format("Convert TOB Slot [{}, {}, {}, {}] to Server Slot {}", + tob_slot.Type, tob_slot.Slot, tob_slot.SubIndex, tob_slot.AugIndex, EQ::invslot::SLOT_INVALID).c_str()); return EQ::invslot::SLOT_INVALID; } @@ -5235,8 +5234,8 @@ namespace TOB } } - Log(Logs::Detail, Logs::Netcode, "Convert TOB Slot [%i, %i, %i, %i] to Server Slot %i", - tob_slot.Type, tob_slot.Slot, tob_slot.SubIndex, tob_slot.AugIndex, server_slot); + Log(Logs::Detail, Logs::Netcode, fmt::format("Convert TOB Slot [{}, {}, {}, {}] to Server Slot {}", + tob_slot.Type, tob_slot.Slot, tob_slot.SubIndex, tob_slot.AugIndex, server_slot).c_str()); return server_slot; } @@ -5253,8 +5252,8 @@ namespace TOB ServerSlot = TOBToServerCorpseMainSlot(tob_corpse_slot.Slot); } - Log(Logs::Detail, Logs::Netcode, "Convert TOB Slot [%i, %i, %i, %i] to Server Slot %i", - tob_corpse_slot.Type, tob_corpse_slot.Slot, tob_corpse_slot.SubIndex, tob_corpse_slot.AugIndex, ServerSlot); + Log(Logs::Detail, Logs::Netcode, fmt::format("Convert TOB Slot [{}, {}, {}, {}] to Server Slot {}", + tob_corpse_slot.Type, tob_corpse_slot.Slot, tob_corpse_slot.SubIndex, tob_corpse_slot.AugIndex, ServerSlot).c_str()); return ServerSlot; } @@ -5275,8 +5274,8 @@ namespace TOB static inline uint32 TOBToServerTypelessSlot(structs::TypelessInventorySlot_Struct tob_slot, int16 tob_type) { if (tob_slot.AugIndex < invaug::SOCKET_INVALID || tob_slot.AugIndex >= invaug::SOCKET_COUNT) { - Log(Logs::Detail, Logs::Netcode, "Convert TOB Typeless Slot [%i, %i, %i] (implied type: %i) to Server Slot %i", - tob_slot.Slot, tob_slot.SubIndex, tob_slot.AugIndex, tob_type, EQ::invslot::SLOT_INVALID); + Log(Logs::Detail, Logs::Netcode, fmt::format("Convert TOB Typeless Slot [{}, {}, {}] (implied type: {}) to Server Slot {}", + tob_slot.Slot, tob_slot.SubIndex, tob_slot.AugIndex, tob_type, EQ::invslot::SLOT_INVALID).c_str()); return EQ::invslot::SLOT_INVALID; } @@ -5389,8 +5388,8 @@ namespace TOB } } - Log(Logs::Detail, Logs::Netcode, "Convert TOB Typeless Slot [%i, %i, %i] (implied type: %i) to Server Slot %i", - tob_slot.Slot, tob_slot.SubIndex, tob_slot.AugIndex, tob_type, ServerSlot); + Log(Logs::Detail, Logs::Netcode, fmt::format("Convert TOB Typeless Slot [{}, {}, {}] (implied type: {}) to Server Slot {}", + tob_slot.Slot, tob_slot.SubIndex, tob_slot.AugIndex, tob_type, ServerSlot).c_str()); return ServerSlot; } diff --git a/common/patches/tob_limits.h b/common/patches/tob_limits.h index 1288cf878..beb5e7b90 100644 --- a/common/patches/tob_limits.h +++ b/common/patches/tob_limits.h @@ -200,8 +200,8 @@ namespace TOB const int16 SLOT_INVALID = IINVALID; const int16 SLOT_BEGIN = INULL; - const int16 SLOT_END = 9; //254; - const int16 SLOT_COUNT = 10; //255; // server Size will be 255..unsure what actual client is (test) + const int16 SLOT_END = 199; + const int16 SLOT_COUNT = 200; // server Size will be 200..unsure what actual client is (test) const char* GetInvBagIndexName(int16 bag_index); diff --git a/common/patches/tob_structs.h b/common/patches/tob_structs.h index c92d271ca..b2211c7f0 100644 --- a/common/patches/tob_structs.h +++ b/common/patches/tob_structs.h @@ -523,8 +523,7 @@ namespace TOB { // The padding is because these structs are padded to the default 4 bytes struct InventorySlot_Struct { - /*000*/ int16 Type; - /*002*/ int16 Padding1; + /*000*/ int32 Type; /*004*/ int16 Slot; /*006*/ int16 SubIndex; /*008*/ int16 AugIndex; diff --git a/tob/opcodes.md b/tob/opcodes.md index 67cdf20a9..f8113c535 100644 --- a/tob/opcodes.md +++ b/tob/opcodes.md @@ -379,7 +379,7 @@ Below is a status list for the 450 opcodes we currently use on the server for th | `OP_MOTD` | 🟢 Verified | | | | `OP_MoveCoin` | 🟡 Unverified | | | | `OP_MoveDoor` | 🟡 Unverified | | | -| `OP_MoveItem` | 🟡 Unverified | | | +| `OP_MoveItem` | 🟢 Verified | | | | `OP_MoveMultipleItems` | 🟡 Unverified | | | | `OP_MoveLogDisregard` | 🔴 Not-Set | | | | `OP_MoveLogRequest` | 🔴 Not-Set | | |