Fix gamepad support

This commit is contained in:
Les De Ridder 2019-02-11 01:29:52 +01:00
parent dee1e31cb7
commit b2e831d38d
1 changed files with 59 additions and 7 deletions

View File

@ -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()