diff ObjectiveInfo.lua @ 14:ed642234f017

ObjectiveFrame - implement proper tracker name text - expanded tracker prototypes to cover "objective lines" formatting and accommodation of widget variables - implement the progress bars for bonus objectives ObjectiveStyle - moved `UpdateWrapperStyle` over and renamed it to fit semantics - change the formula for block.`height` to measure non-widget content only - allows widgets to position relative to text - size FontString `status` to match block.`height` - full block height is acquired by adding block.`height` and block.`attachmentHeight` which is calculated during objective parsing ObjectiveWidgets - use string keys for generated widgets to deal with multiple objectives under the same questID, and maybe dungeon objectives - wrapper buttons use a common code path - specialized handlers for wheel scrolling moved over to fit semantics
author Nenue
date Mon, 04 Apr 2016 03:16:22 -0400
parents 9455693fc290
children 880828018bf4
line wrap: on
line diff
--- a/ObjectiveInfo.lua	Sat Apr 02 17:46:52 2016 -0400
+++ b/ObjectiveInfo.lua	Mon Apr 04 03:16:22 2016 -0400
@@ -3,9 +3,9 @@
 local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo
 local GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo
 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local print = B.print('Objectives')
+local print = B.print('TrackerInfo')
 
-local Tracker, AutoQuest, Quest, Cheevs = mod.Tracker, mod.AutoQuest, mod.Quest, mod.Cheevs
+local Tracker, Bonus, AutoQuest, Quest, Cheevs = mod.Tracker, mod.Bonus, mod.AutoQuest, mod.Quest, mod.Cheevs
 --------------------------------------------------------------------
 --- Tracker-specific data retrieval functions
 --------------------------------------------------------------------
@@ -13,28 +13,84 @@
 
 -----------------------------
 --- AUTO_QUEST
-AutoQuest.name = "Remote Quests"
 AutoQuest.GetNumWatched = GetNumAutoQuestPopUps
 AutoQuest.GetInfo = function(watchIndex)
   return Quest.GetInfo(watchIndex)
 end
 
 -----------------------------
+--- BONUS OBJECTIVE
+Bonus.TasksTable = {}
+Bonus.TasksPOI = {}
+Bonus.TaskScenario = {}
+
+local taskData = {}
+Bonus.QuestBlock = {}
+Bonus.GetNumWatched = function()
+  Bonus.TasksTable = GetTasksTable()
+  local numTasks = 0
+  for i, questID in ipairs(Bonus.TasksTable) do
+    local isInArea, isOnMap, numObjectives = GetTaskInfo(questID)
+    if isInArea and isOnMap then
+      numTasks = numTasks + 1
+    end
+  end
+  Bonus.numAll = #Bonus.TasksTable
+  Bonus.numWatched = numTasks
+  return GetNumQuestLogTasks()
+end
+Bonus.GetInfo = function(self, watchIndex)
+  local questID = Bonus.TasksTable[watchIndex]
+  if not questID then
+    print('|cFFFF4400no quest ID for row', watchIndex)
+    return
+  end
+
+
+  local t= {}
+  t.isInArea, t.isOnMap, t.numObjectives = GetTaskInfo(questID)
+
+  print('isInArea', t.isInArea, 'isOnMap', t.isOnMap, 'numObj', t.numObjectives)
+  t.displayObjectives = false
+  t.isComplete = true
+  t.questID = questID
+  if t.numObjectives >= 1 then
+    print(t.numObjectives,'objective rows')
+    t.objectives = {}
+    for i = 1, t.numObjectives do
+      t.objectives[i] = {}
+      local o = t.objectives[i]
+      o.index = i
+      o.text, o.objectiveType, o.finished, o.displayAsObjective = GetQuestObjectiveInfo(questID, i, true)
+
+      print(i, '==>', o.text, o.objectiveType, o.finished, o.displayAsObjective)
+      t.displayObjectives = t.displayObjectives or o.displayAsObjective
+      t.isComplete = t.isComplete and o.finished
+
+    end
+  end
+  Bonus.TasksTable[questID] = t
+
+  return t
+end
+
+-----------------------------
 --- QUEST
-Quest.name = "Quests"
 Quest.itemButtons = {}
 Quest.freeButtons = {}
 Quest.POI = {}
 Quest.QuestBlock = {}
 Quest.GetNumWatched = function()
-  return GetNumQuestWatches ()
+  Quest.numAll = GetNumQuestLogEntries()
+  Quest.numWatched = GetNumQuestWatches()
+  return Quest.numWatched
 end
 Quest.GetInfo = function (self, watchIndex)
   print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)')
   local questID, title, questIndex, numObjectives, requiredMoney, isComplete,
   startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex)
 
-  local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
+  local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
   local questTagID, tagName = GetQuestTagInfo(questID);
 
   if not questID then
@@ -67,6 +123,11 @@
   q.isComplete = isComplete
   q.isStory = isStory
   q.isTask = isTask
+
+  if isTask then
+    --q.task =  Bonus.GetInfo(questID)
+  end
+
   --q.isBreadCrumb = isBreadCrumb
   q.completionText= GetQuestLogCompletionText(questIndex)
   q.numObjectives = GetNumQuestLeaderBoards(questIndex)
@@ -76,6 +137,7 @@
   for i = 1, q.numObjectives do
     local text, type, finished = GetQuestLogLeaderBoard(i, questIndex)
     q.objectives[i] = {
+      index = i,
       type = type,
       text = text,
       finished = finished
@@ -156,12 +218,13 @@
   for i = 1, c.numObjectives do
     local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i)
     c.objectives[i] = {
+      index = i,
       cheevID = cheevID,
       text = description,
       type = type,
       finished = completed,
-      quantity = quantity,
-      requiredQuantity = requiredQuantity,
+      value = quantity,
+      maxValue = requiredQuantity,
       characterName = characterName,
       flags = flags,
       assetID = assetID,