fix: register direct tooltip fallback for special objectives

This commit is contained in:
Xurkon
2026-06-05 18:24:48 -05:00
parent cd01a537f3
commit 32b21de96a
2 changed files with 46 additions and 3 deletions
+25 -3
View File
@@ -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"))
@@ -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)