Make objective tracking 'optional' via database
James Whitehead II [12-02-10 - 13:06]
Make objective tracking 'optional' via database
diff --git a/DatabaseDefaults.lua b/DatabaseDefaults.lua
index b6f2344..f237e96 100644
--- a/DatabaseDefaults.lua
+++ b/DatabaseDefaults.lua
@@ -6,6 +6,8 @@ addon.defaults = {
profile = {
positions = {},
+ trackQuestObjectives = true,
+
goodcolor = {0, 1, 0},
badcolor = {1, 0, 0},
middlecolor = {1, 1, 0},
diff --git a/TomTomLite.lua b/TomTomLite.lua
index 94289d0..ab27226 100644
--- a/TomTomLite.lua
+++ b/TomTomLite.lua
@@ -17,11 +17,11 @@ function addon:Initialize()
self.arrow:SetPoint("CENTER", 0, 0)
self.arrow:Hide()
- self:RegisterEvent("QUEST_POI_UPDATE", "ObjectivesChanged")
- self:RegisterEvent("QUEST_LOG_UPDATE", "ObjectivesChanged")
+ self:RegisterEvent("QUEST_POI_UPDATE")
+ self:RegisterEvent("QUEST_LOG_UPDATE")
self:RegisterMessage("TOMTOMLITE_WAYPOINT_ADDED")
- hooksecurefunc("WatchFrame_Update", function()
- addon:ObjectivesChanged()
+ hooksecurefunc("WatchFrame_Update", function(self)
+ addon:UpdateQuestObjectives()
end)
end
@@ -120,10 +120,6 @@ function addon:TOMTOMLITE_WAYPOINT_ADDED(msg, waypoint, ...)
self.arrow:Show()
end
-function addon:ObjectivesChanged(event, ...)
- self:Scan()
-end
-
local function POIAnchorToCoord(poiframe)
local point, relto, relpoint, x, y = poiframe:GetPoint()
local frame = WorldMapDetailFrame
@@ -153,7 +149,20 @@ local function findQuestFrameFromQuestIndex(index)
end
end
-function addon:Scan()
+function addon:QUEST_POI_UPDATE()
+ self:UpdateQuestObjectives()
+end
+
+function addon:QUEST_LOG_UPDATE()
+ self:UpdateQuestObjectives()
+end
+
+function addon:UpdateQuestObjectives()
+ -- Only do an objective scan if the option is enabled
+ if not self.db.profile.trackQuestObjectives then
+ return
+ end
+
QuestPOIUpdateIcons()
local watchIndex = 1