From 5801af41bcba9be97ae31d1c2e849901494b26a0 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 18 Mar 2026 01:30:20 -0700 Subject: [PATCH] fix: correct Turtle WoW SMSG_INIT_WORLD_STATES format and remove dead minRepeatMs branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turtle WoW is Classic 1.12-based and uses the Classic packet format for SMSG_INIT_WORLD_STATES (no areaId uint32 field before count), not WotLK format. Including it in the WotLK branch caused the parser to consume 4 bytes of the count+first-key as a phantom areaId, misaligning all world state key/value pairs (BG scores, zone events, flag states). Also remove the dead `turtleMode ? 150 : 150` branch in performGameObjectInteractionNow — both arms were identical so the ternary had no effect; replace with a constexpr constant. --- src/game/game_handler.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 8fdaf71d..147a79fe 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -4018,9 +4018,9 @@ void GameHandler::handlePacket(network::Packet& packet) { } worldStateMapId_ = packet.readUInt32(); worldStateZoneId_ = packet.readUInt32(); - // WotLK adds areaId (uint32) before count; detect by checking if payload would be consistent + // WotLK adds areaId (uint32) before count; Classic/TBC/Turtle use the shorter format size_t remaining = packet.getSize() - packet.getReadPos(); - bool isWotLKFormat = isActiveExpansion("wotlk") || isActiveExpansion("turtle"); + bool isWotLKFormat = isActiveExpansion("wotlk"); if (isWotLKFormat && remaining >= 6) { packet.readUInt32(); // areaId (WotLK only) } @@ -19764,14 +19764,12 @@ void GameHandler::interactWithGameObject(uint64_t guid) { void GameHandler::performGameObjectInteractionNow(uint64_t guid) { if (guid == 0) return; if (state != WorldState::IN_WORLD || !socket) return; - bool turtleMode = isActiveExpansion("turtle"); - // Rate-limit to prevent spamming the server static uint64_t lastInteractGuid = 0; static std::chrono::steady_clock::time_point lastInteractTime{}; auto now = std::chrono::steady_clock::now(); // Keep duplicate suppression, but allow quick retry clicks. - int64_t minRepeatMs = turtleMode ? 150 : 150; + constexpr int64_t minRepeatMs = 150; if (guid == lastInteractGuid && std::chrono::duration_cast(now - lastInteractTime).count() < minRepeatMs) { return;