Quantcast

Find the first objective in the watch list

James Whitehead II [12-01-10 - 22:56]
Find the first objective in the watch list

If the first quest does not have an objective that can be tracked, as in
it does not have an objective number next to it, it will find the first
objective that DOES exist and use that for the quest arrow.
Filename
TomTomLite.lua
diff --git a/TomTomLite.lua b/TomTomLite.lua
index e447dde..103df50 100644
--- a/TomTomLite.lua
+++ b/TomTomLite.lua
@@ -149,26 +149,37 @@ local function findQuestFrameFromQuestIndex(index)
 end

 function addon:Scan()
-    -- Get the first quest item in the watch frame
-    local questIndex = GetQuestIndexForWatch(1)
-    if not questIndex then
-        self.arrow:Hide()
-        return
-    end
+    QuestPOIUpdateIcons()

-    local title = GetQuestLogTitle(questIndex)
-    local qid = select(9, GetQuestLogTitle(questIndex))
+    local watchIndex = 1
+    while true do
+        -- Get the first quest item in the watch frame
+        local questIndex = GetQuestIndexForWatch(watchIndex)
+        if not questIndex then
+            self.arrow:Hide()
+            return
+        end

-    QuestPOIUpdateIcons()
-    local completed, x, y, objective = QuestPOIGetIconInfo(qid)
-    local map, floor = GetCurrentMapAreaID()
+        local title = GetQuestLogTitle(questIndex)
+        local qid = select(9, GetQuestLogTitle(questIndex))

-    if not floor then floor = 0 end
-    if completed then
-        title = "Turn in: " .. title
-    end
+        local completed, x, y, objective = QuestPOIGetIconInfo(qid)
+
+        -- Check to see if there was coordinate information for the current point
+        if x and y then
+            local map, floor = GetCurrentMapAreaID()
+
+            if not floor then floor = 0 end
+            if completed then
+                title = "Turn in: " .. title
+            end
+
+            if x and y and map and floor then
+                self:AddWaypoint(map, floor, x, y, {title = title})
+            end
+            return
+        end

-    if x and y and map and floor then
-        self:AddWaypoint(map, floor, x, y, {title = title})
+        watchIndex = watchIndex + 1
     end
 end