fix(tracker): show (Complete) and correct level for DB-less custom quests
Quests with no static DB entry (e.g. Ascension custom quest 175206) made GetColoredQuestName bail out early on a nil name lookup, before it ever reached the (Complete)/(Failed) suffix logic. The tracker's existing fallback for that case never added the suffix either, and it computed level via QuestieLib.GetTbcLevel (static-DB-only), which silently defaults to level 1 and then gets scaled from that wrong base by Ascension's level scaling. Since these quests also auto-collapse once complete (hiding the tracker's other "Quest Complete!" indicator line), the title was the only place that could show completion status, and it was silently swallowing it. - QuestieTracker.lua: the "no DB name" fallback branch now appends (Complete) under the same collapseCompletedQuests/isMinimizable rule as the normal path, and uses the live quest object's own level instead of the static-only lookup. - QuestieQuest.lua (PopulateQuestLogInfo): re-syncs quest.level from a live GetQuestLogTitle scan every update, since QuestieDB.GetQuest caches quest objects permanently and QuestLogCache never tracked level at all. - TrackerUtils.lua (GetCompletionText): guards the Description[1] fallback against quests that have no top-level Description array, which was throwing and aborting that quest's tracker render entirely.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
--- COMPATIBILITY ---
|
--- COMPATIBILITY ---
|
||||||
local IsQuestFlaggedCompleted = QuestieCompat.IsQuestFlaggedCompleted or C_QuestLog.IsQuestFlaggedCompleted
|
local IsQuestFlaggedCompleted = QuestieCompat.IsQuestFlaggedCompleted or C_QuestLog.IsQuestFlaggedCompleted
|
||||||
|
local GetQuestLogTitle = QuestieCompat.GetQuestLogTitle
|
||||||
|
|
||||||
---@class QuestieQuest
|
---@class QuestieQuest
|
||||||
local QuestieQuest = QuestieLoader:CreateModule("QuestieQuest")
|
local QuestieQuest = QuestieLoader:CreateModule("QuestieQuest")
|
||||||
@@ -2305,6 +2306,24 @@ function QuestieQuest:PopulateQuestLogInfo(quest)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Sync level with the live quest log. QuestieDB.GetQuest permanently caches quest
|
||||||
|
-- objects (Database/QuestieDB.lua:1752 `if _QuestieDB.questCache[questId] then return
|
||||||
|
-- ... end`), so quest.level is otherwise frozen at whatever value was computed the
|
||||||
|
-- first time this quest was cached. QuestLogCache.questLog_DO_NOT_MODIFY doesn't carry
|
||||||
|
-- a level field at all, so read it straight from GetQuestLogTitle. On servers with
|
||||||
|
-- dynamic quest level scaling (e.g. Ascension), the effective level can change after
|
||||||
|
-- caching (player level-up, scaling option toggled), so re-sync it here every time.
|
||||||
|
if GetQuestLogTitle then
|
||||||
|
local questIndex = GetQuestLogIndexByID and GetQuestLogIndexByID(quest.Id)
|
||||||
|
if questIndex and questIndex > 0 then
|
||||||
|
local _, liveLevel = GetQuestLogTitle(questIndex)
|
||||||
|
if liveLevel and liveLevel > 0 and liveLevel ~= quest.level then
|
||||||
|
quest.level = liveLevel
|
||||||
|
quest.questLevel = liveLevel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Live fallback quests (no static DB entry) manage their own Objectives.
|
-- Live fallback quests (no static DB entry) manage their own Objectives.
|
||||||
-- Their per-objective Update() functions read directly from QuestLogCache.
|
-- Their per-objective Update() functions read directly from QuestLogCache.
|
||||||
if quest._isLogFallback then
|
if quest._isLogFallback then
|
||||||
|
|||||||
@@ -1030,6 +1030,13 @@ function QuestieTracker:Update()
|
|||||||
questName = questName .. " (" .. quest.Id .. ")"
|
questName = questName .. " (" .. quest.Id .. ")"
|
||||||
end
|
end
|
||||||
coloredQuestName = "|cFFFFFF00" .. questName .. "|r"
|
coloredQuestName = "|cFFFFFF00" .. questName .. "|r"
|
||||||
|
-- Fallback quests (e.g. custom server quests not in QuestieDB) skip
|
||||||
|
-- GetColoredQuestName entirely since it needs a DB name lookup, so they
|
||||||
|
-- never got the (Complete) suffix DB quests get under the same setting.
|
||||||
|
if Questie.db.profile.collapseCompletedQuests and isMinimizable then
|
||||||
|
coloredQuestName = coloredQuestName .. " " ..
|
||||||
|
Questie:Colorize("(" .. l10n("Complete") .. ")", "green")
|
||||||
|
end
|
||||||
elseif timedQuest then
|
elseif timedQuest then
|
||||||
coloredQuestName = QuestieLib:GetColoredQuestName(quest.Id,
|
coloredQuestName = QuestieLib:GetColoredQuestName(quest.Id,
|
||||||
Questie.db.profile.trackerShowQuestLevel, false, false)
|
Questie.db.profile.trackerShowQuestLevel, false, false)
|
||||||
@@ -1044,18 +1051,25 @@ function QuestieTracker:Update()
|
|||||||
-- server quest not yet in the static DB), so GetColoredQuestName
|
-- server quest not yet in the static DB), so GetColoredQuestName
|
||||||
-- returned nil -- fall back instead of SetText(nil) blanking the
|
-- returned nil -- fall back instead of SetText(nil) blanking the
|
||||||
-- title line while its objectives still render normally below it.
|
-- title line while its objectives still render normally below it.
|
||||||
-- Level/tag lookups don't require a DB "name" entry, so reuse the
|
-- Use the live quest object's own level (kept in sync by
|
||||||
-- same formatting helper as the normal path to keep the "[level]"
|
-- QuestieQuest:PopulateQuestLogInfo) instead of QuestieLib.GetTbcLevel,
|
||||||
-- prefix consistent with quests that do have a DB name.
|
-- which queries the static DB only: for a quest with no DB entry it
|
||||||
|
-- silently defaults to level 1, and Ascension's scaling then scales
|
||||||
|
-- that wrong base instead of the quest's real level.
|
||||||
local fallbackName = quest.name or tostring(quest.Id)
|
local fallbackName = quest.name or tostring(quest.Id)
|
||||||
if Questie.db.profile.trackerShowQuestLevel then
|
if Questie.db.profile.trackerShowQuestLevel and quest.level and quest.level > 0 then
|
||||||
local level = QuestieLib.GetTbcLevel(quest.Id)
|
fallbackName = QuestieLib:GetQuestString(quest.Id, fallbackName, quest.level, false)
|
||||||
fallbackName = QuestieLib:GetQuestString(quest.Id, fallbackName, level, false)
|
|
||||||
end
|
end
|
||||||
if Questie.db.profile.enableTooltipsQuestID then
|
if Questie.db.profile.enableTooltipsQuestID then
|
||||||
fallbackName = fallbackName .. " (" .. quest.Id .. ")"
|
fallbackName = fallbackName .. " (" .. quest.Id .. ")"
|
||||||
end
|
end
|
||||||
coloredQuestName = "|cFFFFFF00" .. fallbackName .. "|r"
|
coloredQuestName = "|cFFFFFF00" .. fallbackName .. "|r"
|
||||||
|
-- Same suffix rule as the normal (DB) branch -- GetColoredQuestName
|
||||||
|
-- never got a chance to run since it bailed out on the missing name.
|
||||||
|
if Questie.db.profile.collapseCompletedQuests and isMinimizable then
|
||||||
|
coloredQuestName = coloredQuestName .. " " ..
|
||||||
|
Questie:Colorize("(" .. l10n("Complete") .. ")", "green")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
line.label:SetText(coloredQuestName)
|
line.label:SetText(coloredQuestName)
|
||||||
|
|||||||
@@ -379,8 +379,14 @@ function TrackerUtils:GetCompletionText(quest)
|
|||||||
|
|
||||||
if completionText then
|
if completionText then
|
||||||
return completionText
|
return completionText
|
||||||
else
|
elseif quest.Description and quest.Description[1] then
|
||||||
return quest.Description[1]:gsub("%.", "")
|
return quest.Description[1]:gsub("%.", "")
|
||||||
|
else
|
||||||
|
-- Fallback/custom quests (e.g. server quests not in QuestieDB) have no
|
||||||
|
-- top-level Description array. Without this, indexing quest.Description[1]
|
||||||
|
-- throws and aborts the whole tracker render for that quest via the
|
||||||
|
-- caller's pcall, freezing its line on the last successful render.
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user