fix: store fallback quests in TrackerUtils._fallbackQuests not currentQuestlog to prevent arrow/quest module crashes
This commit is contained in:
@@ -2240,6 +2240,10 @@ end
|
||||
|
||||
function QuestieTracker:RemoveQuest(questId)
|
||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieTracker:RemoveQuest] - ", questId)
|
||||
-- Clean up any fallback quest object we built for this quest
|
||||
if TrackerUtils._fallbackQuests then
|
||||
TrackerUtils._fallbackQuests[questId] = nil
|
||||
end
|
||||
if Questie.db.char.collapsedQuests then
|
||||
Questie.db.char.collapsedQuests[questId] = nil
|
||||
end
|
||||
@@ -2375,10 +2379,12 @@ function QuestieTracker:AQW_Insert(index, expire)
|
||||
if Questie.IsSoD then
|
||||
QuestieDebugOffer.QuestTracking(questId)
|
||||
else
|
||||
-- Quest not in DB — try building a fallback object from the quest log
|
||||
-- Quest not in DB — try building a fallback object from the quest log.
|
||||
-- Store in TrackerUtils._fallbackQuests only, NOT currentQuestlog,
|
||||
-- so QuestieArrow/QuestieQuest don't call DB-only methods on it.
|
||||
local fallback = TrackerUtils:BuildFallbackQuest(questId)
|
||||
if fallback then
|
||||
QuestiePlayer.currentQuestlog[questId] = fallback
|
||||
TrackerUtils._fallbackQuests[questId] = fallback
|
||||
QuestieCombatQueue:Queue(function()
|
||||
QuestieTracker:Update()
|
||||
end)
|
||||
|
||||
@@ -694,7 +694,10 @@ end
|
||||
|
||||
---@return table sortedQuestIds Table with sorted Quest ID's by Sort Type
|
||||
---@return table questDetails Table with raw quest table from QuestiePlayer.currentQuestLog, percentage completed value per quest, and a "translated" zoneName
|
||||
-- Builds a minimal quest-like object from the quest log for quests not in QuestieDB.
|
||||
-- Private cache of fallback quest objects for quests not in QuestieDB.
|
||||
-- Intentionally NOT stored in QuestiePlayer.currentQuestlog so arrow/map/other modules
|
||||
-- don't try to call DB-only methods on them.
|
||||
TrackerUtils._fallbackQuests = TrackerUtils._fallbackQuests or {}
|
||||
-- Returns nil if the quest is not currently in the quest log.
|
||||
function TrackerUtils:BuildFallbackQuest(questId)
|
||||
for i = 1, GetNumQuestLogEntries() do
|
||||
@@ -761,11 +764,18 @@ function TrackerUtils:GetSortedQuestIds()
|
||||
|
||||
-- Fallback for quests not in QuestieDB (e.g. custom server quests).
|
||||
-- Build a minimal quest object from the quest log so the tracker can still display it.
|
||||
-- Stored in TrackerUtils._fallbackQuests, NOT in currentQuestlog, so other modules
|
||||
-- (Arrow, QuestieQuest) don't try to call DB-only methods on it.
|
||||
if type(quest) ~= "table" or not quest.IsComplete or not quest.Objectives then
|
||||
local fallback = TrackerUtils:BuildFallbackQuest(qid)
|
||||
local fallback = TrackerUtils._fallbackQuests[qid]
|
||||
if not fallback then
|
||||
fallback = TrackerUtils:BuildFallbackQuest(qid)
|
||||
if fallback then
|
||||
TrackerUtils._fallbackQuests[qid] = fallback
|
||||
end
|
||||
end
|
||||
if fallback then
|
||||
quest = fallback
|
||||
QuestiePlayer.currentQuestlog[qid] = fallback
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user