Quantcast

Change options to enable sources

James Whitehead II [01-10-11 - 23:19]
Change options to enable sources
Filename
DatabaseDefaults.lua
sources/Corpse.lua
sources/QuestObjectives.lua
diff --git a/DatabaseDefaults.lua b/DatabaseDefaults.lua
index d9b3eaf..e938255 100644
--- a/DatabaseDefaults.lua
+++ b/DatabaseDefaults.lua
@@ -6,7 +6,10 @@ addon.defaults = {
     profile = {
         positions = {},

-        trackQuestObjectives = true,
+        corpseSource = true,
+        questObjectivesSource = true,
+        archaeologyDigSitesSource = true,
+
         showMapIconsZone = false,
         showMapIconsContinent = false,

diff --git a/sources/Corpse.lua b/sources/Corpse.lua
index f079492..e26f832 100644
--- a/sources/Corpse.lua
+++ b/sources/Corpse.lua
@@ -22,6 +22,10 @@ local waypoint
 local map, floor, x, y

 local function GetCorpseLocation()
+    if not addon.db.profile.corpseSource then
+        return
+    end
+
     if map and x and y then
         return map, floor, x, y
     end
@@ -69,10 +73,10 @@ local function GetCorpseLocation()
 end

 local function SetCorpseArrow()
-    if map and x and y and x > 0 and y > 0 then
+    if not waypoint and map and x and y and x > 0 and y > 0 then
         waypoint = addon:AddWaypoint(map, floor, x, y, {
             title = "Your corpse",
-            priority = 100,
+            priority = addon.PRI_ALWAYS,
         })
         return waypoint
 	end
@@ -100,7 +104,7 @@ eventFrame:SetScript("OnUpdate", function(self, elapsed)
 		return
 	else
 		counter = 0
-		if addon.db.profile.corpseArrow then
+		if addon.db.profile.corpseSource then
 			if GetCorpseLocation() then
 				if SetCorpseArrow() then
 					self:Hide()
diff --git a/sources/QuestObjectives.lua b/sources/QuestObjectives.lua
index 4309f9c..335bda2 100644
--- a/sources/QuestObjectives.lua
+++ b/sources/QuestObjectives.lua
@@ -16,9 +16,6 @@ do
     addon:RegisterSource("questobj", L["Quest Objectives (tracked)"], desc)
 end

-local PRI_FIRST = 15
-local PRI_OTHER = 0
-
 local eventFrame = CreateFrame("Frame")
 eventFrame:RegisterEvent("QUEST_POI_UPDATE")
 eventFrame:RegisterEvent("QUEST_LOG_UPDATE")
@@ -51,7 +48,7 @@ function addon:OBJECTIVES_CHANGED()
     SetCVar("questPOI", 1)

     -- Only do an objective scan if the option is enabled
-    if not self.db.profile.trackQuestObjectives then
+    if not self.db.profile.questObjectivesSource then
         return
     end

@@ -93,7 +90,7 @@ function addon:OBJECTIVES_CHANGED()
                 -- possibly change the priority

                 local waypoint = waypoints[key]
-                local newpri = (watchIndex == 1) and PRI_FIRST or PRI_OTHER
+                local newpri = (watchIndex == 1) and addon.PRI_ACTIVE or addon.PRI_NORMAL
                 if waypoint.priority ~= newpri then
                     changed = true
                     waypoint.priority = newpri
@@ -104,7 +101,7 @@ function addon:OBJECTIVES_CHANGED()
                 -- Create the waypoint, setting priority
                 local waypoint = self:AddWaypoint(map, floor, x, y, {
                     title = title,
-                    priority = (watchIndex == 1) and PRI_FIRST or PRI_OTHER,
+                    priority = (watchIndex == 1) and addon.PRI_ACTIVE or addon.PRI_NORMAL,
                 })

                 newWaypoints[key] = waypoint