From 32b21de96aa7856790d98f4957453240d70de61d Mon Sep 17 00:00:00 2001 From: Xurkon Date: Fri, 5 Jun 2026 18:24:48 -0500 Subject: [PATCH] fix: register direct tooltip fallback for special objectives --- Modules/Quest/QuestieQuest.lua | 28 +++++++++++++++++++--- Tests/QuestieQuestTooltipFallback_spec.lua | 21 ++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 Tests/QuestieQuestTooltipFallback_spec.lua diff --git a/Modules/Quest/QuestieQuest.lua b/Modules/Quest/QuestieQuest.lua index e46f479..fba6ae7 100644 --- a/Modules/Quest/QuestieQuest.lua +++ b/Modules/Quest/QuestieQuest.lua @@ -1646,13 +1646,35 @@ _RegisterObjectiveTooltips = function(objective, questId, blockItemTooltips) objective.hasRegisteredTooltips = true end else - -- No spawnList and no Id means there is nothing Questie can draw for this objective. - -- This covers server-tracked trigger objectives (e.g. "complete N quests in zone" for - -- quest 50150) which may have any objectiveType from the server, not just "event". if not objective.Id or objective.Id == 0 then + -- No spawnList and no Id means there is nothing Questie can draw for this objective. + -- This covers server-tracked trigger objectives (e.g. "complete N quests in zone" for + -- quest 50150) which may have any objectiveType from the server, not just "event". objective.hasRegisteredTooltips = true return end + + if objective.Type == "monster" or objective.Type == "object" or objective.Type == "item" then + local tooltipKey = nil + if objective.Type == "monster" then + tooltipKey = "m_" .. objective.Id + elseif objective.Type == "object" then + tooltipKey = "o_" .. objective.Id + elseif objective.Type == "item" then + tooltipKey = "i_" .. objective.Id + end + + if tooltipKey and not objective.hasRegisteredTooltips then + QuestieTooltips:RegisterObjectiveTooltip(questId, tooltipKey, objective) + objective.hasRegisteredTooltips = true + end + + if objective.Type == "item" then + objective.registeredItemTooltips = true + end + return + end + Questie:Error("[QuestieQuest]: [Tooltips] " .. l10n("There was an error populating objectives for %s %s %s %s", objective.Description or "No objective text", questId or "No quest id", 0 or "No objective", "No error")) diff --git a/Tests/QuestieQuestTooltipFallback_spec.lua b/Tests/QuestieQuestTooltipFallback_spec.lua new file mode 100644 index 0000000..af94b07 --- /dev/null +++ b/Tests/QuestieQuestTooltipFallback_spec.lua @@ -0,0 +1,21 @@ +describe("QuestieQuest tooltip fallback", function() + local function read(path) + local f = assert(io.open(path, "r"), "cannot open " .. path) + local c = f:read("*a") + f:close() + return c + end + + local function has(content, needle) + return string.find(content, needle, 1, true) ~= nil + end + + it("registers direct objective tooltips when special objectives have ids but no spawnList", function() + local questieQuest = read("Modules/Quest/QuestieQuest.lua") + + assert.is_true(has(questieQuest, 'tooltipKey = "m_" .. objective.Id')) + assert.is_true(has(questieQuest, 'tooltipKey = "o_" .. objective.Id')) + assert.is_true(has(questieQuest, 'tooltipKey = "i_" .. objective.Id')) + assert.is_true(has(questieQuest, "objective.registeredItemTooltips = true")) + end) +end)