Compare commits

...

5 Commits

2 changed files with 66 additions and 4 deletions

View File

@ -1,3 +1,6 @@
-- TODO: Hide ignored quests on compass
-- TODO: Fix gamepad support
-- TODO: Use localisation files
ZO_CreateStringId("SI_AO_IGNORED_QUEST_CATEGORY", "Ignored")
ZO_CreateStringId("SI_AO_IGNORE_QUEST_TOOLTIP", "Ignore")
@ -49,19 +52,40 @@ 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 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
SYSTEMS:GetObject("questJournal"):OnQuestsUpdated()
@ -78,9 +102,25 @@ function AO_GetQuestByIndex(questIndex)
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
@ -148,9 +188,31 @@ 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
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

View File

@ -1,6 +1,6 @@
## Title: CleanJournal
## License: NCSA
## Author: Les De Ridder <les@lesderid.net>
## Author: Les De Ridder <eso@lesderid.net>
## AddOnVersion: 1
## APIVersion: 100025
## DependsOn: