From a8be4befaeff93dc0ba9ad9ed7197115e1d6e2c3 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 9 Feb 2026 23:24:04 -0800 Subject: [PATCH] Fix quest turn-in: send REQUEST_REWARD instead of QUERY_QUEST for completable quests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When clicking a quest in gossip, now checks if: - Quest is in quest log AND marked complete → send CMSG_QUESTGIVER_REQUEST_REWARD - Quest is new or incomplete → send CMSG_QUESTGIVER_QUERY_QUEST This fixes the "Already on that quest" error when trying to turn in completed quests like "A Threat Within". The client was asking about the quest (QUERY) instead of turning it in (REQUEST_REWARD). --- src/game/game_handler.cpp | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 80a175f7..ec23c0f0 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -4312,9 +4312,32 @@ void GameHandler::selectGossipOption(uint32_t optionId) { void GameHandler::selectGossipQuest(uint32_t questId) { if (state != WorldState::IN_WORLD || !socket || !gossipWindowOpen) return; - LOG_INFO("Selecting gossip quest: questId=", questId, " npcGuid=", currentGossip.npcGuid); - auto packet = QuestgiverQueryQuestPacket::build(currentGossip.npcGuid, questId); - socket->send(packet); + + // Check if quest is in our quest log and completable + bool isInLog = false; + bool isCompletable = false; + for (const auto& quest : questLog_) { + if (quest.questId == questId) { + isInLog = true; + isCompletable = quest.complete; + break; + } + } + + if (isInLog && isCompletable) { + // Quest is ready to turn in - request reward + LOG_INFO("Turning in quest: questId=", questId, " npcGuid=", currentGossip.npcGuid); + network::Packet packet(static_cast(Opcode::CMSG_QUESTGIVER_REQUEST_REWARD)); + packet.writeUInt64(currentGossip.npcGuid); + packet.writeUInt32(questId); + socket->send(packet); + } else { + // New quest or not completable - query details + LOG_INFO("Querying quest details: questId=", questId, " npcGuid=", currentGossip.npcGuid); + auto packet = QuestgiverQueryQuestPacket::build(currentGossip.npcGuid, questId); + socket->send(packet); + } + gossipWindowOpen = false; }