diff --git a/CleanJournal.lua b/CleanJournal.lua index a5e43d3..046f661 100644 --- a/CleanJournal.lua +++ b/CleanJournal.lua @@ -1,7 +1,5 @@ --- TODO: Hide ignored quests on compass (currently effectively impossible) --- TODO: Hide floating markers for ignored quests (currently effectively impossible) --- --- TODO: Fix gamepad support +-- 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 = {} @@ -66,8 +64,11 @@ EVENT_MANAGER:RegisterForEvent("CleanJournal", EVENT_ADD_ON_LOADED, AO_ORIG_QUEST_CATEGORY_NAMES = savedVars.AO_ORIG_QUEST_CATEGORY_NAMES AO_ORIG_QUEST_CATEGORY_TYPES = savedVars.AO_ORIG_QUEST_CATEGORY_TYPES - SYSTEMS:GetObject("questJournal"):RefreshQuestMasterList() - SYSTEMS:GetObject("questJournal"):RefreshQuestList() + 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 @@ -110,7 +111,8 @@ function AO_ToggleIgnoreQuest(questIndex) end end - SYSTEMS:GetObject("questJournal"):OnQuestsUpdated() + QUEST_JOURNAL_KEYBOARD:OnQuestsUpdated() + QUEST_JOURNAL_GAMEPAD:OnQuestsUpdated() end function AO_GetQuestByIndex(questIndex) @@ -238,3 +240,53 @@ WORLD_MAP_QUEST_BREADCRUMBS.RefreshQuest = function(self, questIndex) 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()