Do not allow tracking ignored quests

This commit is contained in:
Les De Ridder 2019-01-15 00:15:55 +01:00
parent 2989faa080
commit 829d901a89
1 changed files with 33 additions and 5 deletions

View File

@ -24,7 +24,7 @@ QUEST_JOURNAL_MANAGER.GetQuestListData = function(QUEST_JOURNAL_MANAGER)
local seenCategories = {}
for i, quest in ipairs(quests) do
if AO_IGNORED_QUESTS[quest.name] then
if AO_IsQuestIgnored(quest) then
quests[i].categoryName = ignoredCategory
quests[i].categoryType = QUEST_CAT_AO_IGNORED
elseif quest.categoryName == ignoredCategory then
@ -49,14 +49,17 @@ end
--
function AO_ToggleIgnoreQuest(questIndex)
-- TODO: Make it impossible to ignore all quests (but what when you complete the last unignored quest?)
local quests, categories, seenCategories = QUEST_JOURNAL_MANAGER:GetQuestListData()
local quest = AO_GetQuestByIndex(questIndex)
if quest.categoryName == GetString(SI_AO_IGNORED_QUEST_CATEGORY) then
if AO_IsQuestIgnored(quest) then
AO_IGNORED_QUESTS[quest.name] = nil
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
end
@ -66,6 +69,7 @@ end
function AO_GetQuestByIndex(questIndex)
local quests, _, _ = QUEST_JOURNAL_MANAGER:GetQuestListData()
for _, quest in ipairs(quests) do
if quest.questIndex == questIndex then
return quest
@ -73,6 +77,9 @@ function AO_GetQuestByIndex(questIndex)
end
end
function AO_IsQuestIgnored(quest)
return AO_IGNORED_QUESTS[quest.name]
end
function AO_SortQuestCategories(entry1, entry2)
if entry1.type == entry2.type then
@ -89,8 +96,10 @@ function AO_SortQuestEntries(entry1, entry2)
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
@ -98,6 +107,7 @@ function AO_SortQuestEntries(entry1, entry2)
return entry1.categoryName < entry2.categoryName
end
return entry1.categoryType < entry2.categoryType
end
@ -113,16 +123,34 @@ function 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 ignored = quest.categoryName == GetString(SI_AO_IGNORED_QUEST_CATEGORY)
if questIndex then
local ignoreString = GetString(SI_AO_IGNORE_QUEST_TOOLTIP)
local unignoreString = GetString(SI_AO_UNIGNORE_QUEST_TOOLTIP)
AddMenuItem(ignored and unignoreString or ignoreString, function() AO_ToggleIgnoreQuest(questIndex) end)
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
return
end
end
return __FOCUSED_QUEST_TRACKER_BeginTracking(self, trackType, arg1, arg2)
end