From 155183e38dfef6edd71c7029245344e3112cbdd4 Mon Sep 17 00:00:00 2001 From: kokekanon <114332266+kokekanon@users.noreply.github.com> Date: Thu, 7 Nov 2024 21:44:57 -0300 Subject: [PATCH] fix: packets in game_questlog and game_outfit (#958) --- modules/game_questlog/questlog.lua | 6 +++++- src/client/game.cpp | 2 +- src/client/game.h | 2 +- src/client/protocolgameparse.cpp | 8 ++++++-- src/client/protocolgamesend.cpp | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/game_questlog/questlog.lua b/modules/game_questlog/questlog.lua index 7a8012f5c5..bb3138e618 100644 --- a/modules/game_questlog/questlog.lua +++ b/modules/game_questlog/questlog.lua @@ -26,15 +26,18 @@ function terminate() destroyWindows() questLogButton:destroy() + questLogButton = nil end function destroyWindows() if questLogWindow then questLogWindow:destroy() + questLogWindow = nil end if questLineWindow then questLineWindow:destroy() + questLineWindow = nil end end @@ -69,6 +72,7 @@ function onGameQuestLine(questId, questMissions) end if questLineWindow then questLineWindow:destroy() + questLineWindow = nil end questLineWindow = g_ui.createWidget('QuestLineWindow', rootWidget) @@ -85,7 +89,7 @@ function onGameQuestLine(questId, questMissions) }) for i, questMission in pairs(questMissions) do - local name, description = unpack(questMission) + local name, description, missionId = unpack(questMission) local missionLabel = g_ui.createWidget('MissionLabel') missionLabel:setText(name) diff --git a/src/client/game.cpp b/src/client/game.cpp index 28cad81b75..07e41fe380 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -478,7 +478,7 @@ void Game::processQuestLog(const std::vector>& questMissions) +void Game::processQuestLine(const uint16_t questId, const std::vector>& questMissions) { g_lua.callGlobalField("g_game", "onQuestLine", questId, questMissions); } diff --git a/src/client/game.h b/src/client/game.h index ae4c25b231..53fe2b620a 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -498,7 +498,7 @@ class Game // questlog static void processQuestLog(const std::vector>& questList); - static void processQuestLine(const uint16_t questId, const std::vector>& questMissions); + static void processQuestLine(const uint16_t questId, const std::vector>& questMissions); // modal dialogs >= 970 static void processModalDialog(const uint32_t id, const std::string_view title, const std::string_view message, const std::vector> diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index 6d9705b279..27ebb7c5d4 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -2933,12 +2933,16 @@ void ProtocolGame::parseQuestLine(const InputMessagePtr& msg) const uint16_t questId = msg->getU16(); const uint8_t missionCount = msg->getU8(); - std::vector> questMissions; + std::vector> questMissions; for (auto i = 0; i < missionCount; ++i) { + auto missionId = 0; + if (g_game.getClientVersion() >= 1200) { + missionId = msg->getU16(); + } const auto& missionName = msg->getString(); const auto& missionDescrition = msg->getString(); - questMissions.emplace_back(missionName, missionDescrition); + questMissions.emplace_back(missionName, missionDescrition, missionId); } g_game.processQuestLine(questId, questMissions); diff --git a/src/client/protocolgamesend.cpp b/src/client/protocolgamesend.cpp index 267699db60..3ab53739af 100644 --- a/src/client/protocolgamesend.cpp +++ b/src/client/protocolgamesend.cpp @@ -788,7 +788,7 @@ void ProtocolGame::sendChangeOutfit(const Outfit& outfit) } } - if (g_game.getClientVersion() >= 1340) { + if (g_game.getClientVersion() >= 1334) { msg->addU8(static_cast(outfit.hasMount())); }