-- TODO: Hide ignored quests on compass (currently effectively impossible -> would require a compass replacement) -- TODO: Hide floating markers for ignored quests (currently effectively impossible -> would require a floating marker replacement) AO_IGNORED_QUESTS = {} AO_ORIG_QUEST_CATEGORY_NAMES = {} AO_ORIG_QUEST_CATEGORY_TYPES = {} QUEST_CAT_AO_IGNORED = 4 -- -- GetQuestListData -- __GetQuestListData = QUEST_JOURNAL_MANAGER.GetQuestListData QUEST_JOURNAL_MANAGER.GetQuestListData = function(QUEST_JOURNAL_MANAGER) local ignoredCategory = GetString(SI_AO_IGNORED_QUEST_CATEGORY) local quests, _, _ = __GetQuestListData(QUEST_JOURNAL_MANAGER) local categories = {} local seenCategories = {} for i, quest in ipairs(quests) do if AO_IsQuestIgnored(quest) then quests[i].categoryName = ignoredCategory quests[i].categoryType = QUEST_CAT_AO_IGNORED elseif quest.categoryName == ignoredCategory then quests[i].categoryName = AO_ORIG_QUEST_CATEGORY_NAMES[quest.name] quests[i].categoryType = AO_ORIG_QUEST_CATEGORY_TYPES[quest.name] end if not seenCategories[quest.categoryName] then table.insert(categories, { name = quest.categoryName, type = quest.categoryType}) seenCategories[quest.categoryName] = true end end table.sort(categories, AO_SortQuestCategories) table.sort(quests, AO_SortQuestEntries) return quests, categories, seenCategories end -- -- AddOn Functions -- EVENT_MANAGER:RegisterForEvent("CleanJournal", EVENT_ADD_ON_LOADED, function(eventCode, addOnName) if addOnName ~= "CleanJournal" then return end local defaults = { AO_IGNORED_QUESTS = {}, AO_ORIG_QUEST_CATEGORY_NAMES = {}, AO_ORIG_QUEST_CATEGORY_TYPES = {} } local savedVars = ZO_SavedVars:New("CleanJournalData", 1, nil, defaults) AO_IGNORED_QUESTS = savedVars.AO_IGNORED_QUESTS AO_ORIG_QUEST_CATEGORY_NAMES = savedVars.AO_ORIG_QUEST_CATEGORY_NAMES AO_ORIG_QUEST_CATEGORY_TYPES = savedVars.AO_ORIG_QUEST_CATEGORY_TYPES QUEST_JOURNAL_KEYBOARD:RefreshQuestMasterList() QUEST_JOURNAL_KEYBOARD:RefreshQuestList() QUEST_JOURNAL_GAMEPAD:RefreshQuestMasterList() QUEST_JOURNAL_GAMEPAD:RefreshQuestList() EVENT_MANAGER:UnregisterForEvent("CleanJournal", EVENT_ADD_ON_LOADED) end ) function AO_ToggleIgnoreQuest(questIndex) local quests, categories, seenCategories = QUEST_JOURNAL_MANAGER:GetQuestListData() local quest = AO_GetQuestByIndex(questIndex) if AO_IsQuestIgnored(quest) then AO_IGNORED_QUESTS[quest.name] = nil WORLD_MAP_QUEST_BREADCRUMBS:OnQuestAdded(questIndex) PlaySound(SOUNDS.QUEST_SHARE_ACCEPTED) if FOCUSED_QUEST_TRACKER:GetNumTracked() == 0 then FOCUSED_QUEST_TRACKER:ForceAssist(questIndex) end else AO_IGNORED_QUESTS[quest.name] = true AO_ORIG_QUEST_CATEGORY_NAMES[quest.name] = quest.categoryName AO_ORIG_QUEST_CATEGORY_TYPES[quest.name] = quest.categoryType WORLD_MAP_QUEST_BREADCRUMBS:OnQuestRemoved(false, questIndex) PlaySound(SOUNDS.QUEST_SHARE_DECLINED) local lastTracked = FOCUSED_QUEST_TRACKER:GetLastTracked() if lastTracked.trackType == TRACK_TYPE_QUEST and lastTracked.arg1 == questIndex then local unignoredQuest = AO_GetFirstUnignoredQuest() if unignoredQuest then FOCUSED_QUEST_TRACKER:ForceAssist(unignoredQuest.questIndex) else FOCUSED_QUEST_TRACKER:ClearTracker() end end end QUEST_JOURNAL_KEYBOARD:OnQuestsUpdated() QUEST_JOURNAL_GAMEPAD:OnQuestsUpdated() end function AO_GetQuestByIndex(questIndex) local quests, _, _ = QUEST_JOURNAL_MANAGER:GetQuestListData() for _, quest in ipairs(quests) do if quest.questIndex == questIndex then return quest end end end function AO_IsQuestIgnored(quest) if not quest then return nil end 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 else return entry1.type < entry2.type end end function AO_SortQuestEntries(entry1, entry2) if entry1.categoryType == entry2.categoryType then if entry1.categoryType == QUEST_CAT_AO_IGNORED then if AO_ORIG_QUEST_CATEGORY_TYPES[entry1.name] == AO_ORIG_QUEST_CATEGORY_TYPES[entry2.name] then if AO_ORIG_QUEST_CATEGORY_NAMES[entry1.name] == AO_ORIG_QUEST_CATEGORY_NAMES[entry2.name] then return entry1.name < entry2.name end return AO_ORIG_QUEST_CATEGORY_NAMES[entry1.name] < AO_ORIG_QUEST_CATEGORY_NAMES[entry2.name] end return AO_ORIG_QUEST_CATEGORY_TYPES[entry1.name] < AO_ORIG_QUEST_CATEGORY_TYPES[entry2.name] elseif entry1.categoryName == entry2.categoryName then return entry1.name < entry2.name end return entry1.categoryName < entry2.categoryName end return entry1.categoryType < entry2.categoryType end -- -- ZO_QuestJournalNavigationEntry_OnMouseUp -- __ZO_QuestJournalNavigationEntry_OnMouseUp = ZO_QuestJournalNavigationEntry_OnMouseUp function ZO_QuestJournalNavigationEntry_OnMouseUp(label, button, upInside) __ZO_QuestJournalNavigationEntry_OnMouseUp(label, button, upInside) if(button == MOUSE_BUTTON_INDEX_RIGHT and upInside) then local quest = label.node.data local questIndex = quest.questIndex if questIndex then local ignoreString = GetString(SI_AO_IGNORE_QUEST_TOOLTIP) local unignoreString = GetString(SI_AO_UNIGNORE_QUEST_TOOLTIP) AddMenuItem(AO_IsQuestIgnored(quest) and unignoreString or ignoreString, function() AO_ToggleIgnoreQuest(questIndex) end) ShowMenu(label) end return end end --- --- FOCUSED_QUEST_TRACKER.BeginTracking --- __FOCUSED_QUEST_TRACKER_BeginTracking = FOCUSED_QUEST_TRACKER.BeginTracking FOCUSED_QUEST_TRACKER.BeginTracking = function(self, trackType, arg1, arg2) if trackType == TRACK_TYPE_QUEST then local questIndex = arg1 if AO_IsQuestIgnored(AO_GetQuestByIndex(questIndex)) then local unignoredQuest = AO_GetFirstUnignoredQuest() if unignoredQuest then FOCUSED_QUEST_TRACKER:ForceAssist(unignoredQuest.questIndex) return true end return false end end return __FOCUSED_QUEST_TRACKER_BeginTracking(self, trackType, arg1, arg2) end --- --- WORLD_MAP_QUEST_BREADCRUMBS.RefreshQuest --- __WORLD_MAP_QUEST_BREADCRUMBS_RefreshQuest = WORLD_MAP_QUEST_BREADCRUMBS.RefreshQuest WORLD_MAP_QUEST_BREADCRUMBS.RefreshQuest = function(self, questIndex) __WORLD_MAP_QUEST_BREADCRUMBS_RefreshQuest(self, questIndex) if AO_IsQuestIgnored(AO_GetQuestByIndex(questIndex)) then WORLD_MAP_QUEST_BREADCRUMBS:OnQuestRemoved(false, questIndex) end end --- --- QUEST_JOURNAL_GAMEPAD.RefreshOptionsList --- __QUEST_JOURNAL_GAMEPAD_RefreshOptionsList = QUEST_JOURNAL_GAMEPAD.RefreshOptionsList QUEST_JOURNAL_GAMEPAD.RefreshOptionsList = function(self) __QUEST_JOURNAL_GAMEPAD_RefreshOptionsList(self) local quest = self:GetSelectedQuestData() local ignoreString = GetString(SI_AO_IGNORE_QUEST_TOOLTIP) local unignoreString = GetString(SI_AO_UNIGNORE_QUEST_TOOLTIP) local ignoreQuest = ZO_GamepadEntryData:New(AO_IsQuestIgnored(quest) and unignoreString or ignoreString) ignoreQuest.action = function() AO_ToggleIgnoreQuest(quest.questIndex) self:SwitchActiveList("questList") end table.insert(self.options, ignoreQuest) self.optionsList:Clear() for _, option in pairs(self.options) do self.optionsList:AddEntry("ZO_GamepadSubMenuEntryTemplate", option) end self.optionsList:Commit() end --- --- QUEST_JOURNAL_GAMEPAD.InitializeKeybindStripDescriptors --- __QUEST_JOURNAL_GAMEPAD_InitializeKeybindStripDescriptors = QUEST_JOURNAL_GAMEPAD.InitializeKeybindStripDescriptors QUEST_JOURNAL_GAMEPAD.InitializeKeybindStripDescriptors = function(self) __QUEST_JOURNAL_GAMEPAD_InitializeKeybindStripDescriptors(self) for i, v in pairs(self.mainKeybindStripDescriptor) do if type(v) == "table" and v.name == GetString(SI_GAMEPAD_QUEST_JOURNAL_OPTIONS) then v.visible = function() return true end end end ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.mainKeybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON) end QUEST_JOURNAL_GAMEPAD:InitializeKeybindStripDescriptors()