From d5de031c2363082a71de04135342471094b932b9 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 9 Mar 2026 22:04:18 -0700 Subject: [PATCH] tbc: fix quest log stride and CMSG_QUESTGIVER_QUERY_QUEST format TBC 2.4.3 quest log update fields use 4 fields per slot (questId, state, counts, timer) vs WotLK's 5 (extra counts field). The wrong stride (5) caused all quest log reads to use wrong indices beyond the first slot, breaking quest tracking on TBC servers. TBC 2.4.3 CMSG_QUESTGIVER_QUERY_QUEST is guid(8) + questId(4) = 12 bytes. WotLK added a trailing isDialogContinued(u8) byte that TBC servers don't expect; sending it caused quest details to not be sent back on some emulators. --- include/game/packet_parsers.hpp | 6 ++++++ src/game/packet_parsers_tbc.cpp | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/game/packet_parsers.hpp b/include/game/packet_parsers.hpp index 27e6dfc8..933ce955 100644 --- a/include/game/packet_parsers.hpp +++ b/include/game/packet_parsers.hpp @@ -345,6 +345,12 @@ public: bool parseSpellDamageLog(network::Packet& packet, SpellDamageLogData& data) override; // TBC 2.4.3 SMSG_SPELLHEALLOG uses full uint64 GUIDs (WotLK uses packed GUIDs) bool parseSpellHealLog(network::Packet& packet, SpellHealLogData& data) override; + // TBC 2.4.3 quest log has 4 update fields per slot (questId, state, counts, timer) + // WotLK expands this to 5 (splits counts into two fields). + uint8_t questLogStride() const override { return 4; } + // TBC 2.4.3 CMSG_QUESTGIVER_QUERY_QUEST: guid(8) + questId(4) — no trailing + // isDialogContinued byte that WotLK added + network::Packet buildQueryQuestPacket(uint64_t npcGuid, uint32_t questId) override; }; /** diff --git a/src/game/packet_parsers_tbc.cpp b/src/game/packet_parsers_tbc.cpp index 141f9f96..f65de114 100644 --- a/src/game/packet_parsers_tbc.cpp +++ b/src/game/packet_parsers_tbc.cpp @@ -698,6 +698,20 @@ network::Packet TbcPacketParsers::buildAcceptQuestPacket(uint64_t npcGuid, uint3 return packet; } +// ============================================================================ +// TBC 2.4.3 CMSG_QUESTGIVER_QUERY_QUEST +// +// WotLK adds a trailing uint8 isDialogContinued byte; TBC does not. +// TBC format: guid(8) + questId(4) = 12 bytes. +// ============================================================================ +network::Packet TbcPacketParsers::buildQueryQuestPacket(uint64_t npcGuid, uint32_t questId) { + network::Packet packet(wireOpcode(Opcode::CMSG_QUESTGIVER_QUERY_QUEST)); + packet.writeUInt64(npcGuid); + packet.writeUInt32(questId); + // No isDialogContinued byte (WotLK-only addition) + return packet; +} + // ============================================================================ // TBC parseAuraUpdate - SMSG_AURA_UPDATE doesn't exist in TBC // TBC uses inline aura update fields + SMSG_INIT_EXTRA_AURA_INFO_OBSOLETE (0x3A3) /