fix(quest): Phase 1 compat — guard quest-log-aware frame unload
Prevent premature frame unloading for completed-but-logged quests: - AvailableQuests: UnloadUndoable() guard on currentQuestlog - DailyQuests: HandleDailyQuests() guard on currentQuestlog - QuestieQuest: IsSafeToUnloadQuestFrames() helper + HideQuest() guard - TooltipHandler: IsQuestFlaggedCompleted gated by currentQuestlog - TrackerUtils: fallback IsComplete gated by currentQuestlog Revert: git revert HEAD --no-edit
This commit is contained in:
@@ -92,7 +92,10 @@ end
|
||||
function AvailableQuests.UnloadUndoable()
|
||||
local questId, _ = next(availableQuests)
|
||||
while questId do
|
||||
if (not QuestieDB.IsDoable(questId)) then
|
||||
-- Only unload if the quest is no longer doable AND is not in the live quest log.
|
||||
-- The currentQuestlog guard prevents removing frames for completed-but-logged quests
|
||||
-- (e.g. Quest 8325) where IsDoable returns false but the quest is still accepted.
|
||||
if (not QuestieDB.IsDoable(questId)) and not QuestiePlayer.currentQuestlog[questId] then
|
||||
QuestieMap:UnloadQuestFrames(questId)
|
||||
end
|
||||
questId, _ = next(availableQuests, questId)
|
||||
@@ -438,7 +441,7 @@ local function StartPeriodicCleanup()
|
||||
|
||||
local questId, frameList = next(QuestieMap.questIdFrames)
|
||||
while questId do
|
||||
if completedQuests[questId] then
|
||||
if completedQuests[questId] and not QuestiePlayer.currentQuestlog[questId] then
|
||||
-- This quest is complete but still has frames on the map
|
||||
Questie:Debug(Questie.DEBUG_INFO, "[AvailableQuests] Cleanup: Removing lingering frames for completed quest:", questId)
|
||||
QuestieMap:UnloadQuestFrames(questId)
|
||||
|
||||
@@ -110,7 +110,8 @@ function _DailyQuests:HandleDailyQuests(possibleQuestIds, currentQuestId, type)
|
||||
Questie.db.char.hiddenDailies[type][questId] = nil;
|
||||
else
|
||||
-- If the quest is not in the questlog remove all frames
|
||||
if (GetQuestLogIndexByID(questId) == 0) then
|
||||
-- Guard with currentQuestlog to prevent removing frames for completed-but-logged quests
|
||||
if (GetQuestLogIndexByID(questId) == 0) and not QuestiePlayer.currentQuestlog[questId] then
|
||||
_DailyQuests:HideDailyQuest(questId);
|
||||
end
|
||||
Questie.db.char.hiddenDailies[type][questId] = true;
|
||||
|
||||
@@ -453,15 +453,28 @@ end
|
||||
|
||||
function QuestieQuest:HideQuest(id)
|
||||
Questie.db.char.hidden[id] = true
|
||||
-- Only unload frames/tooltips if the quest is NOT in the live quest log.
|
||||
-- A completed-but-logged quest (e.g. Quest 8325) must keep its pins even when hidden.
|
||||
if not QuestiePlayer.currentQuestlog[id] then
|
||||
QuestieMap:UnloadQuestFrames(id)
|
||||
QuestieTooltips:RemoveQuest(id)
|
||||
end
|
||||
end
|
||||
|
||||
function QuestieQuest:UnhideQuest(id)
|
||||
Questie.db.char.hidden[id] = nil
|
||||
AvailableQuests.CalculateAndDrawAll()
|
||||
end
|
||||
|
||||
--- Returns true when a quest can be safely unloaded from the map/tooltip tracker.
|
||||
--- Completion is in char.complete AND the quest is not in the live quest log.
|
||||
--- Prevents Quest 8325 flicker: completed-but-logged quests must keep their pins.
|
||||
---@param questId number
|
||||
---@return boolean
|
||||
function QuestieQuest:IsSafeToUnloadQuestFrames(questId)
|
||||
return Questie.db.char.complete[questId] and not QuestiePlayer.currentQuestlog[questId]
|
||||
end
|
||||
|
||||
local allianceTournamentMarkerQuests = { [13684] = true, [13685] = true, [13688] = true, [13689] = true, [13690] = true,
|
||||
[13593] = true, [13703] = true, [13704] = true, [13705] = true, [13706] = true }
|
||||
local hordeTournamentMarkerQuests = { [13691] = true, [13693] = true, [13694] = true, [13695] = true, [13696] = true,
|
||||
|
||||
@@ -7,6 +7,8 @@ local l10n = QuestieLoader:ImportModule("l10n")
|
||||
|
||||
---@type QuestieDB
|
||||
local QuestieDB = QuestieLoader:ImportModule("QuestieDB")
|
||||
---@type QuestiePlayer
|
||||
local QuestiePlayer = QuestieLoader:ImportModule("QuestiePlayer")
|
||||
|
||||
--- COMPATIBILITY ---
|
||||
local UnitGUID = QuestieCompat.UnitGUID
|
||||
@@ -112,7 +114,7 @@ local function _PlayerHasQuest(questId)
|
||||
end
|
||||
|
||||
-- 2) Turned in / completed
|
||||
if IsQuestFlaggedCompleted and IsQuestFlaggedCompleted(questId) then
|
||||
if IsQuestFlaggedCompleted and IsQuestFlaggedCompleted(questId) and not QuestiePlayer.currentQuestlog[questId] then
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
@@ -788,7 +788,7 @@ function TrackerUtils:BuildFallbackQuest(questId)
|
||||
}
|
||||
-- IsComplete must be a method (called as quest:IsComplete())
|
||||
quest.IsComplete = function(self)
|
||||
return (isComplete == 1 or (IsQuestFlaggedCompleted and IsQuestFlaggedCompleted(questId))) and 1 or 0
|
||||
return (isComplete == 1 or (QuestiePlayer.currentQuestlog[questId] and IsQuestFlaggedCompleted and IsQuestFlaggedCompleted(questId))) and 1 or 0
|
||||
end
|
||||
|
||||
return quest
|
||||
|
||||
Reference in New Issue
Block a user