diff ObjectiveTracker/QuestData.lua @ 58:f253baf6022d

ObjectiveTracker: - Quest tracker now checks all of its allotted frames for data validity, - it also uses GetQuestLogTitle to verify non-zero log indexes
author Nenue
date Fri, 08 Jul 2016 18:01:49 -0400
parents aa693607b813
children
line wrap: on
line diff
--- a/ObjectiveTracker/QuestData.lua	Fri Jun 10 20:53:59 2016 -0400
+++ b/ObjectiveTracker/QuestData.lua	Fri Jul 08 18:01:49 2016 -0400
@@ -101,7 +101,6 @@
 
 local GetQuestWatchIndex = GetQuestWatchIndex
 local numAnimating = 0
-local blocksChecked = {}
 
 --- Get a total of things to show, and straighten out the index while we're at it
 --- Return the number shown, total in log, and the info table to parse
@@ -118,13 +117,8 @@
   local bottomIndex = 1
   local start, limit = 1, numAll
 
-  if id and not added then
-    -- if a particular id is supplied, add to checklist
-    if self.InfoBlock[id] then
-      blocksChecked[self.InfoBlock[id]] = self.InfoBlock[id]
-    end
-  end
 
+  --- Update the index tables
   numAnimating = 0
   local numEntries = 0
   for logIndex = start, limit do
@@ -132,11 +126,11 @@
     local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex)
     local watchIndex = GetQuestWatchIndex(logIndex)
 
-    --- Start of crazy audit flagging
+
     if watchIndex and watchIndex >= bottomIndex then
       -- do watch data pointers match?
-      local watchInfo = self.WatchInfo[watchIndex]
-      local watchBlock = self.WatchBlock[watchIndex]
+      local watchInfo, watchBlock = self.WatchInfo[watchIndex], self.WatchBlock[watchIndex]
+
       if watchInfo and watchInfo.questID ~= questID then
         print('GetNumWatched', 'trimming WatchInfo ['..watchIndex..'] =/=', questID)
         self.WatchInfo[watchIndex] = nil
@@ -144,7 +138,6 @@
       if watchBlock and watchBlock.info.questID ~= questID then
         print('GetNumWatched', 'trimming WatchBlock ['..watchIndex..'] =/=', watchBlock:GetName())
         self.WatchBlock[watchIndex] = nil
-        blocksChecked[watchBlock] = watchBlock
       end
     end
 
@@ -155,7 +148,6 @@
       if logBlock.info.questID ~= questID then
         print('GetQuests', 'replace info', logBlock.info.questID, '->', questID)
         self.LogBlock[logIndex] = nil
-        blocksChecked[logBlock] = logBlock
       end
     end
     --- end of crazy audit flagging
@@ -169,20 +161,24 @@
 
 
 
-  --- After GetInfo pass, look for any non-conformant blocks and deal with them
+  --- Clean up blocks that got cut off for some reason
   for index, block in ipairs(self.usedBlocks) do
-
-    local logIndex = GetQuestLogIndexByID(block.info.questID, 'player')
     -- animating blocks have been evaluated
     if not block.blockFadeOut:IsPlaying() then
-      if not logIndex then
+
+      local logIndex = GetQuestLogIndexByID(block.info.questID, 'player')
+      print('GetNumWatched', GetQuestLogTitle(logIndex))
+      local questID = select(8,GetQuestLogTitle(logIndex))
+      print('GetNumWatched', questID)
+
+      if questID == 0 then
         self:ClearBlock(block)
-        print('GetNumWatched', '|cFF44FF00'.. index, (block and block:GetName() or '|cFFFF0000-|r'), '(trim not active)')
+        print('GetNumWatched', '|cFF44FF00'.. index, (block and block:GetName() or '|cFFFF0000-|r'), logIndex,  questID, '(unresolved)', block.info.title)
       elseif not IsQuestWatched(block.info.logIndex) then
         self:ClearBlock(block)
-        print('GetNumWatched', '|cFFFF4400'.. index, (block and block:GetName() or '|cFFFF0000-|r'), '(trim non-watched)')
+        print('GetNumWatched', '|cFFFF4400'.. index, (block and block:GetName() or '|cFFFF0000-|r'), logIndex, questID, '(unwatched)', block.info.title)
       else
-        print('GetNumWatched', '|cFF0088FF'.. index, (block and block:GetName() or '|cFFFF0000-|r'), logIndex or '|cFF444444-|r')
+        print('GetNumWatched', '|cFF0088FF'.. index, (block and block:GetName() or '|cFFFF0000-|r'), logIndex or '|cFF444444-|r', block.info.title)
       end
     else
 
@@ -574,3 +570,7 @@
   print('removing', block.info.logIndex, 'from watcher')
   RemoveQuestWatch(block.info.logIndex)
 end
+
+Quest.OnRemoved = function(block)
+  print('OnRemoved', block:GetID())
+end
\ No newline at end of file