From 37edad7920c706994b5d4eb55fd1702fa40e99a1 Mon Sep 17 00:00:00 2001 From: Les De Ridder Date: Fri, 18 Jan 2019 02:06:31 +0100 Subject: [PATCH] Fix an issue where cycling through focused quests doesn't work --- CleanJournal.lua | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/CleanJournal.lua b/CleanJournal.lua index f9d3ace..ab85d02 100644 --- a/CleanJournal.lua +++ b/CleanJournal.lua @@ -78,11 +78,11 @@ function AO_ToggleIgnoreQuest(questIndex) local lastTracked = FOCUSED_QUEST_TRACKER:GetLastTracked() if lastTracked.trackType == TRACK_TYPE_QUEST and lastTracked.arg1 == questIndex then - local IGNORE_SCENE_RESTRICTION = true - FOCUSED_QUEST_TRACKER:AssistNext(IGNORE_SCENE_RESTRICTION) + local unignoredQuest = AO_GetFirstUnignoredQuest() - lastTracked = FOCUSED_QUEST_TRACKER:GetLastTracked() - if lastTracked.trackType == TRACK_TYPE_QUEST and lastTracked.arg1 == questIndex then + if unignoredQuest then + FOCUSED_QUEST_TRACKER:ForceAssist(unignoredQuest.questIndex) + else FOCUSED_QUEST_TRACKER:ClearTracker() end end @@ -109,6 +109,18 @@ function AO_IsQuestIgnored(quest) return AO_IGNORED_QUESTS[quest.name] end +function AO_GetFirstUnignoredQuest() + local quests, categories, seenCategories = QUEST_JOURNAL_MANAGER:GetQuestListData() + + for _, quest in ipairs(quests) do + if quest and not AO_IsQuestIgnored(quest) then + return quest + end + end + + return nil +end + function AO_SortQuestCategories(entry1, entry2) if entry1.type == entry2.type then return entry1.name < entry2.name @@ -176,7 +188,15 @@ FOCUSED_QUEST_TRACKER.BeginTracking = function(self, trackType, arg1, arg2) local questIndex = arg1 if AO_IsQuestIgnored(AO_GetQuestByIndex(questIndex)) then - return + local unignoredQuest = AO_GetFirstUnignoredQuest() + + if unignoredQuest then + FOCUSED_QUEST_TRACKER:ForceAssist(unignoredQuest.questIndex) + + return true + else + return false + end end end