changeset 22:9b3fa734abff

ObjectiveFrame - polish quest rewards display - implement money objectives - set line metrics in UpdateLine - set block metrics in UpdateBlock (sum of line metrics)
author Nenue
date Sat, 09 Apr 2016 07:32:45 -0400
parents d5ee940de273
children e837384ac363
files Core.xml ObjectiveCore.lua ObjectiveFrame.lua ObjectiveInfo.lua ObjectiveTracker.xml ObjectiveUI.lua ObjectiveWidgets.lua
diffstat 7 files changed, 376 insertions(+), 220 deletions(-) [+]
line wrap: on
line diff
--- a/Core.xml	Fri Apr 08 06:12:05 2016 -0400
+++ b/Core.xml	Sat Apr 09 07:32:45 2016 -0400
@@ -27,6 +27,9 @@
     <Color r="1" g="1" b="0" a="1" />
   </Texture>
 
+  <Font name="VeneerNumberFont" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="13" >
+    <Color r="1" g="1" b="1" a="1" />
+  </Font>
   <Font name="VeneerTitleFont" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="15" >
     <Color r="1" g="1" b="1" a="1" />
   </Font>
--- a/ObjectiveCore.lua	Fri Apr 08 06:12:05 2016 -0400
+++ b/ObjectiveCore.lua	Sat Apr 09 07:32:45 2016 -0400
@@ -4,13 +4,16 @@
 -- @file-revision@ @file-hash@
 -- Created: 3/26/2016 1:51 AM
 local B, _G = select(2,...).frame, _G
-local pairs, setmetatable, type, tostring = _G.pairs, _G.setmetatable, _G.type, _G.tostring
-local format = _G.format
+local pairs, setmetatable, type, tostring, band, format = _G.pairs, _G.setmetatable, _G.type, _G.tostring, bit.band, string.format
+local ipairs, tinsert, hooksecurefunc = _G.ipairs, _G.tinsert, _G.hooksecurefunc
+local PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText = PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText
+local AddQuestWatch, SetSuperTrackedQuestID, GetNumQuestWatches, AUTO_QUEST_WATCH, MAX_WATCHABLE_QUESTS = AddQuestWatch, SetSuperTrackedQuestID, GetNumQuestWatches, AUTO_QUEST_WATCH, MAX_WATCHABLE_QUESTS
+local QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone = QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone
+local AddAutoQuestPopUp = AddAutoQuestPopUp
 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
 local print = B.print('Objectives')
 local ObjectiveTrackerFrame, VeneerObjectiveScroll, CreateFrame = _G.ObjectiveTrackerFrame, _G.VeneerObjectiveScroll, _G.CreateFrame
 local Wrapper = _G.VeneerObjectiveWrapper
-local ipairs, tinsert, hooksecurefunc = _G.ipairs, _G.tinsert, _G.hooksecurefunc
 local Scroller = VeneerObjectiveWrapper.scrollArea
 local Scroll = _G.VeneerObjectiveScroll
 
@@ -142,11 +145,7 @@
   name = "Bonus",
   displayName = "Bonus Objectives",
   updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE,
-  updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST +
-        OBJECTIVE_TRACKER_UPDATE_TASK_ADDED +
-        OBJECTIVE_TRACKER_UPDATE_SCENARIO +
-        OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE +
-        OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED
+  updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED
 }
 
 local Tracker_string = function (self)
@@ -209,101 +208,109 @@
   return true
 end
 
+local Event = {}
+Event.QUEST_LOG_UPDATE =  function()
+  return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE
+end
+Event.QUEST_ACCEPTED = function(questLogIndex, questID)
+  if ( IsQuestTask(questID) ) then
+    return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID
+  else
+    if ( AUTO_QUEST_WATCH == "1" and GetNumQuestWatches() < MAX_WATCHABLE_QUESTS ) then
+      AddQuestWatch(questLogIndex);
+      SetSuperTrackedQuestID(questID);
+    end
+    return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
+  end
+end
+Event.QUEST_WATCH_LIST_CHANGED = function(questID, added)
+  if ( added ) then
+    if ( not IsQuestTask(questID) ) then
+      return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added
+    end
+  else
+    return OBJECTIVE_TRACKER_UPDATE_QUEST, questID, added
+  end
+end
+Event.QUEST_POI_UPDATE = function()
 
-function mod:OnEvent (event, ...)
-  local isHandled
-  print('OnEvent(|cFF00FF00'.. event ..'|r):', ...)
-  if ( event == "QUEST_LOG_UPDATE" ) then
-    mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST);
+  QuestPOIUpdateIcons();
+  if ( GetCVar("trackQuestSorting") == "proximity" ) then
+    SortQuestWatches();
+  end
 
-  elseif ( event == "TRACKED_ACHIEVEMENT_UPDATE" ) then
-    --AchievementObjectiveTracker_OnAchievementUpdate(...);
-    mod.Cheevs:Update(OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT)
+  return OBJECTIVE_TRACKER_UPDATE_ALL
 
-  elseif ( event == "QUEST_ACCEPTED" ) then
-    local questLogIndex, questID = ...;
-    if ( IsQuestTask(questID) ) then
-      mod:Update(OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID);
-    else
-      if ( AUTO_QUEST_WATCH == "1" and GetNumQuestWatches() < MAX_WATCHABLE_QUESTS ) then
-        AddQuestWatch(questLogIndex);
-        SetSuperTrackedQuestID(questID);
-      end
-      mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
-    end
+end
+Event.SUPER_TRACKED_QUEST_CHANGED = function()
+  return OBJECTIVE_TRACKER_UPDATE_QUEST
+end
+Event.ZONE_CHANGED = function()
 
-  elseif ( event == "TRACKED_ACHIEVEMENT_LIST_CHANGED" ) then
-    local achievementID, added = ...;
-    if ( added ) then
-      mod:Update(OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED, achievementID);
-    else
-      mod:Update(OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT);
-    end
-
-  elseif ( event == "QUEST_WATCH_LIST_CHANGED" ) then
-    local questID, added = ...;
-    if ( added ) then
-      if ( not IsQuestTask(questID) ) then
-        mod:Update(OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added);
-      end
-    else
-      mod:Update(OBJECTIVE_TRACKER_UPDATE_QUEST, questID, added);
-    end
-
-  elseif ( event == "QUEST_POI_UPDATE" ) then
-    QuestPOIUpdateIcons();
-    if ( GetCVar("trackQuestSorting") == "proximity" ) then
-      SortQuestWatches();
-    end
-
-    mod:Update(OBJECTIVE_TRACKER_UPDATE_ALL);
-
-  elseif ( event == "SCENARIO_CRITERIA_UPDATE" ) then
-    mod:Update(OBJECTIVE_TRACKER_UPDATE_SCENARIO);
-  elseif ( event == "SUPER_TRACKED_QUEST_CHANGED" ) then
-    --mod:Update(OBJECTIVE_TRACKER_UPDATE_QUEST)
-  elseif ( event == "ZONE_CHANGED" ) then
-    local inMicroDungeon = IsPlayerInMicroDungeon();
-    if ( inMicroDungeon ~= self.inMicroDungeon ) then
-      if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then
-        SetMapToCurrentZone();			-- update the zone to get the right POI numbers for the tracker
-      end
-      --SortQuestWatches();
-      self.inMicroDungeon = inMicroDungeon;
-    end
-  elseif ( event == "QUEST_AUTOCOMPLETE" ) then
-    local questId = ...;
-    AddAutoQuestPopUp(questId, "COMPLETE");
-    mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
-  elseif ( event == "SCENARIO_UPDATE" ) then
-    local newStage = ...;
-    if ( newStage ) then
-      mod:Update(OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE);
-    else
-      mod:Update(OBJECTIVE_TRACKER_UPDATE_SCENARIO);
-    end
-  elseif ( event == "ZONE_CHANGED_NEW_AREA" ) then
+  local inMicroDungeon = IsPlayerInMicroDungeon();
+  if ( inMicroDungeon ~= mod.inMicroDungeon ) then
     if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then
       SetMapToCurrentZone();			-- update the zone to get the right POI numbers for the tracker
     end
-    SortQuestWatches();
-    mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE)
-  elseif (event == 'CRITERIA_COMPLETE') then
-    mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE)
-
-  elseif ( event == "QUEST_TURNED_IN" ) then
-    local questID, xp, money = ...;
-    if ( IsQuestTask(questID) ) then
-      mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE)
-    else
-
-      mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
-    end
-  elseif ( event == "PLAYER_MONEY" and self.watchMoneyReasons > 0 ) then
-    -- only update trackers that have money counters
-    mod:Update(self.watchMoneyReasons);
+    --SortQuestWatches();
+    mod.inMicroDungeon = inMicroDungeon;
   end
 end
+Event.QUEST_AUTOCOMPLETE = function(questId)
+  AddAutoQuestPopUp(questId, "COMPLETE");
+  return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP
+end
+Event.SCENARIO_CRITERIA_UPDATE =  function()
+  return OBJECTIVE_TRACKER_UPDATE_SCENARIO
+end
+Event.SCENARIO_UPDATE = function(newStage)
+  if ( newStage ) then
+    return OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE
+  else
+    return OBJECTIVE_TRACKER_UPDATE_SCENARIO
+  end
+end
+Event.TRACKED_ACHIEVEMENT_UPDATE = function()
+  return OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT
+end
+Event.TRACKED_ACHIEVEMENT_LIST_CHANGED = function(achievementID, added)
+  if ( added ) then
+    return OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED, achievementID
+  else
+    return OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT
+  end
+end
+Event.ZONE_CHANGED_NEW_AREA = function ()
+  if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then
+    SetMapToCurrentZone();			-- update the zone to get the right POI numbers for the tracker
+  end
+  SortQuestWatches();
+  mod.currentZoneArea = GetCurrentMapAreaID()
+  print('Updating zone ID to', mod.currentZoneArea, '=', GetZoneText(), GetMinimapZoneText())
+
+
+  return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED
+end
+
+
+Event.PLAYER_MONEY = function()
+  if mod.watchMoneyReasons > 0 then
+    return mod.watchMoneyReasons
+  end
+end
+Event.CRITERIA_COMPLETE = function()
+  return OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE
+end
+Event.QUEST_TURN_IN = function(questID, xp, money)
+  if ( IsQuestTask(questID) ) then
+    mod.Bonus:OnTurnIn(questID, xp, money)
+    print('updating bonus modules (code', OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, ',', questID, xp, money)
+    return OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, questID, xp, money
+  else
+    return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, questID, xp, money
+  end
+end
+mod.Event = Event
 
 --- Done once per ui load
 local BlizzHooks = {
@@ -318,6 +325,20 @@
   ['SetSuperTrackedQuestID'] = 'SetSuperTrackedQuestID'
 }
 local VeneerData
+
+mod.SetWatchMoney = function(watchMoney, reason)
+  if watchMoney then
+    if band(mod.watchMoneyReasons, reason) == 0 then
+      mod.watchMoneyReasons = mod.watchMoneyReasons + reason;
+    end
+  else
+    if band(mod.watchMoneyReasons, reason) > 0 then
+      mod.watchMoneyReasons = mod.watchMoneyReasons - reason;
+    end
+  end
+end
+
+
 function mod:OnInitialize()
   local c = mod.Conf.Wrapper
   VeneerData = _G.VeneerData
@@ -335,6 +356,9 @@
       end
     end
   end
+
+  mod.Conf.TasksLog = mod.Conf.TasksLog or {}
+
   Scroller:SetScrollChild(Scroll)
   Scroller:SetWidth(c.Width)
   Scroll:SetWidth(c.Width)
@@ -344,9 +368,43 @@
   ObjectiveTrackerFrame:Hide()
 end
 
+function mod:OnEvent (event, ...)
+  local isHandled
+  print('OnEvent(|cFF00FF00'.. event ..'|r):', ...)
+  local reason, arg1, arg2, arg3
+  if Event[event] then
+    if type(Event[event]) == 'function' then
+      PlaySoundFile([[Interface\Addons\SharedMedia_MyMedia\sound\Info.ogg]])
+      reason, arg1, arg2, arg3 = Event[event](...)
+    elseif type(Event[event]) == 'table' then
+      PlaySoundFile([[Interface\Addons\SharedMedia_MyMedia\sound\Link.ogg]])
+      for i, action in ipairs(Event[event]) do
+        if type(action) == 'function' then
+          reason, arg1, arg2, arg3 = action(event, ...)
+        else
+          reason = action
+        end
+
+        if reason then
+          mod:Update(reason, arg1, arg2, arg3)
+        end
+      end
+    else
+      PlaySoundFile([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]])
+      reason = Event[event]
+    end
+  else
+    PlaySoundFile([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]])
+  end
+  if reason then
+    mod:Update(reason, arg1, arg2, arg3)
+  else
+    print('no reason value returned')
+    PlaySoundFile([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]])
+  end
+end
+
 --- Done any time the the minimize button is toggled up
-
-
 function mod:OnEnable()
   for id, name in ipairs(mod.orderedNames) do
     if not mod.orderedHandlers[id] then
@@ -354,22 +412,11 @@
     end
   end
 
-  Wrapper:RegisterEvent("CRITERIA_COMPLETE");
-  Wrapper:RegisterEvent("SCENARIO_UPDATE");
-  Wrapper:RegisterEvent("SCENARIO_CRITERIA_UPDATE");
-  Wrapper:RegisterEvent("PLAYER_MONEY");
-  Wrapper:RegisterEvent("QUEST_ACCEPTED");
-  Wrapper:RegisterEvent("QUEST_AUTOCOMPLETE");
-  Wrapper:RegisterEvent("QUEST_LOG_UPDATE");
-  Wrapper:RegisterEvent("QUEST_POI_UPDATE");
-  Wrapper:RegisterEvent("QUEST_TURNED_IN");
-  Wrapper:RegisterEvent("QUEST_WATCH_LIST_CHANGED");
-  Wrapper:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED");
-  Wrapper:RegisterEvent("TRACKED_ACHIEVEMENT_LIST_CHANGED");
-  Wrapper:RegisterEvent("TRACKED_ACHIEVEMENT_UPDATE");
-  Wrapper:RegisterEvent("VARIABLES_LOADED");
-  Wrapper:RegisterEvent("ZONE_CHANGED_NEW_AREA");
-  Wrapper:RegisterEvent("ZONE_CHANGED");
+  for event, action in pairs(Event) do
+    print('|cFFFF0088listen to', event, 'for action|r', tostring(action))
+    Wrapper:RegisterEvent(event)
+  end
+
   Wrapper:SetScript('OnEvent', mod.OnEvent)
 
   local c = mod.Conf.Wrapper
@@ -383,7 +430,7 @@
 end
 
 function mod:OnDisable()
-
+  Wrapper:UnregisterAllEvents()
 end
 
 
--- a/ObjectiveFrame.lua	Fri Apr 08 06:12:05 2016 -0400
+++ b/ObjectiveFrame.lua	Sat Apr 09 07:32:45 2016 -0400
@@ -43,7 +43,8 @@
 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
 local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24
 local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2
-local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0}
+local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 }
+local rewardSize = 32
 local oprint = B.print('Objectives')
 local bprint = B.print('Block')
 local tprint = B.print('Tracker')
@@ -122,6 +123,8 @@
       block.SelectionOverlay:SetPoint('TOPLEFT')
       block.SelectionOverlay:SetPoint('BOTTOMRIGHT')
 
+      block.icon:SetSize(rewardSize, rewardSize)
+      block.icon:SetPoint('TOPRIGHT', block, 'TOPRIGHT', -2, -2)
 
 
       --- methods for event handlers
@@ -181,6 +184,7 @@
 
   local attachmentHeight = 0
   if info.objectives then
+    attachmentHeight = textSpacing * 2
     for i, data in ipairs(info.objectives) do
       print('     |cFF88FF00#', i, data.type, data.text)
       displayObjectiveHeader = true
@@ -189,16 +193,24 @@
       block:UpdateLine(line, data)
 
       line:ClearAllPoints()
-      if line.displayText then
+      if line.widget then
+        local widgetPosition = 0
+        line.widget:SetPoint('TOP', line, 'TOP', 0, -widgetPosition)
+        line.widget:Show()
+        line.height = line.widget:GetHeight() + textSpacing
+
+        if line.displayText and #line.displayText >= 1 then
+          widgetPosition = line.status:GetHeight() + textSpacing
+          line.status:SetText(line.displayText)
+          line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + line.widget.height
+          print('      - progressbar has text, adjust')
+        end
+      elseif line.displayText then
         line.status:SetText(line.displayText)
-        line.height = floor(line.status:GetStringHeight()+.5)
+        line.height = floor(line.status:GetStringHeight()+.5) + textSpacing
+
       end
-
-      if line.widget then
-        line.widget:SetPoint('TOP', line, 'TOP', 0, 0)
-        line.widget:Show()
-      end
-
+      attachmentHeight = attachmentHeight + line.height
 
       line:Show()
 
@@ -207,7 +219,7 @@
       line:SetPoint('RIGHT', block, 'RIGHT', 0, 0)
       line:SetHeight(line.height)
 
-      attachmentHeight = attachmentHeight + line.height
+
       print('      sz', line:GetSize())
       print('      pt', line:GetPoint(1))
       print('     |cFF44BBFF#', i, 'anchoring line, size:', line.height, 'current endpoint:', line.statusbg)
@@ -216,14 +228,14 @@
     end
 
     if attachmentHeight > 0 then
-      block.attachmentHeight = attachmentHeight + textSpacing * 2
+      block.attachmentHeight = attachmentHeight
       print('     |cFF00FF00attachment:', block.attachmentHeight)
     end
 
     local lines = handler.lines[block.blockIndex]
-    local numObjectives = info.numObjectives
+    local numObjectives = #info.objectives
     local numLines = #lines
-    if numLines > numObjectives then
+    if lines and numLines > numObjectives then
       print('   has extra lines, need to clean up;', numLines, numObjectives)
       for  i = numObjectives+1, numLines do
         print('    hide', i, lines[i]:GetName())
@@ -270,7 +282,6 @@
 Quest.UpdateObjectives = function(handler, block)
   local print = lprint
   print('|cFF00FFFFUpdateObjectives()')
-  Default.UpdateObjectives(handler, block)
   local info = block.info
   local completionText
   if info.isAutoComplete then
@@ -279,11 +290,13 @@
       completionText = CLICK_TO_COMPLETE
     end
   end
-  if not completionText then
-    completionText = GetQuestLogCompletionText(info.questLogIndex)
+  if info.isComplete then
+    if not completionText then
+      completionText = GetQuestLogCompletionText(info.questLogIndex)
+    end
+  else
+    Default.UpdateObjectives(handler, block)
   end
-
-  block.status:SetText()
 end
 
 --- Module-specific display variables
@@ -313,6 +326,7 @@
   line.displayColor = {r, g, b, a}
   line.status:SetTextColor(r, g, b, a)
   line.displayText = data.text
+
   return line
 end
 
@@ -322,13 +336,7 @@
 
 
   line.displayColor = 'FFFFFF'
-  if data.text and not info.title then
-    print('using first text item as title')
-    info.title = data.text
-  else
-    line.displayText = data.text
-  end
-
+  line.displayText = data.text
   line.progress = 0
   print('  ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text)
   if data.objectiveType == 'progressbar' then
@@ -344,7 +352,7 @@
     line.format = PERCENTAGE_STRING
     local widget = mod.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex)
     print('    |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue)
-    widget:SetPoint('CENTER', line, 'CENTER', 0, 0)
+    widget:SetPoint('TOP', line, 'TOP', 0, 0)
 
     line.widget = widget
     line.height = widget.height
@@ -480,7 +488,6 @@
 Default.Update = function (self, reason, ...)
   local print = tprint
   local tracker = self.frame
-  print('|cFFFF4400'..tracker:GetName().. '|r:Update()', reason, ...)
   local blockIndex = 0
   local trackerHeight = floor(tracker.titlebg:GetHeight()+.5)
 
@@ -494,10 +501,10 @@
       local info = self:GetInfo(watchIndex)
       if info then
         local currentBlock = self:UpdateBlock(blockIndex, info)
-        currentBlock:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, -1)
+        currentBlock:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0)
         currentBlock:SetPoint('RIGHT', tracker,'RIGHT', 0, 0)
         self.currentAnchor = currentBlock
-        print('    |cFFFFFF00'..watchIndex..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height)
+        print('    |cFFFFFF00'..watchIndex..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height, trackerHeight)
         trackerHeight = trackerHeight + currentBlock.height
         numBlocks = max(numBlocks, watchIndex)
         actualBlocks = actualBlocks + 1
@@ -528,7 +535,7 @@
   if numBlocks >= 1 then
     previousBlock = nil
 
-    tracker.height = trackerHeight + tracker.titlebg:GetHeight()
+    tracker.height = trackerHeight
     tracker:SetHeight(tracker.height)
     tracker:Show()
 
@@ -613,8 +620,7 @@
     if info.rewardInfo[1].type == 'currency' or info.rewardInfo[1].type == 'item' then
       block.icon:Show()
       block.iconLabel:SetText(info.rewardInfo[1].count)
-      block.icon:SetSize(block.height, block.height)
-      block.icon:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0)
+      block.icon:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2)
       tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block.icon, 'TOPLEFT'
       block.icon:SetTexture(info.rewardInfo[1].texture)
     end
@@ -659,7 +665,7 @@
   for id, handler in pairs(mod.orderedHandlers) do
     local frame = handler.frame
 
-    print(format(' |cFF00FFFFbitcheck (%04X vs %04x+%04x):|r', reason, handler.updateReasonModule, handler.updateReasonEvents), band(reason, handler.updateReasonModule + handler.updateReasonEvents))
+    print(format('|cFF00FFFF%s and(%04X vs %04x+%04x) = %04X|r', handler.name, reason, handler.updateReasonModule, handler.updateReasonEvents, band(reason, handler.updateReasonModule + handler.updateReasonEvents)))
     if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then
       handler:Update(reason, ...)
       print(' |cFF00FF00'..id..'|r', handler.displayName, 'count:', handler.numWatched)
@@ -737,6 +743,7 @@
             print('  '..block:GetName()..' |cFF00FF00probe hit!')
             mod.UpdateBlockAction(block, itemButton, itemButton.previousItem) -- needs to be previousItem from this scope
             block:SetScript('OnUpdate', nil)
+
           end
         end)
         previousItem = itemButton
--- a/ObjectiveInfo.lua	Fri Apr 08 06:12:05 2016 -0400
+++ b/ObjectiveInfo.lua	Sat Apr 09 07:32:45 2016 -0400
@@ -1,5 +1,5 @@
 local B = select(2,...).frame
-local wipe, pairs, ipairs, min, max, unpack, format = table.wipe, pairs, ipairs, min, max, unpack, format
+local wipe, pairs, ipairs, min, max, unpack, format, mod = table.wipe, pairs, ipairs, min, max, unpack, format, mod
 local tinsert, tostring = tinsert, tostring
 local GetQuestTagInfo, GetQuestLogTitle = GetQuestTagInfo, GetQuestLogTitle
 local GetNumQuestLogEntries, GetNumQuestWatches, GetQuestLogCompletionText, IsQuestWatched, IsQuestHardWatched, GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown = GetNumQuestLogEntries, GetNumQuestWatches, GetQuestLogCompletionText, IsQuestWatched, IsQuestHardWatched, GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown
@@ -9,8 +9,9 @@
 local GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo
 local QuestHasPOIInfo, GetDistanceSqToQuest, GetQuestFactionGroup = QuestHasPOIInfo, GetDistanceSqToQuest, GetQuestFactionGroup
 local GetTrackedAchievements, GetNumTrackedAchievements, GetAchievementInfo = GetTrackedAchievements, GetNumTrackedAchievements, GetAchievementInfo
-local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local print = B.print('TrackerInfo')
+local GetMoney, floor = GetMoney, floor
+local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local print = B.print('Info')
 local QUEST_TAG_DUNGEON = QUEST_TAG_DUNGEON
 local QUEST_TAG_GROUP = QUEST_TAG_GROUP
 local QUEST_TAG_ACCOUNT = QUEST_TAG_ACCOUNT
@@ -19,12 +20,57 @@
 local LE_QUEST_FREQUENCY_WEEKLY = LE_QUEST_FREQUENCY_WEEKLY
 local FACTION_ALLIANCE, LE_QUEST_FACTION_HORDE, FACTION_HORDE, LE_QUEST_FACTION_HORDE = FACTION_ALLIANCE, LE_QUEST_FACTION_HORDE, FACTION_HORDE, LE_QUEST_FACTION_HORDE
 
-local Tracker, Bonus, AutoQuest, Quest, Cheevs = mod.DefaultTracker, mod.Bonus, mod.AutoQuest, mod.Quest, mod.Cheevs
+local Tracker, Bonus, AutoQuest, Quest, Cheevs = T.DefaultTracker, T.Bonus, T.AutoQuest, T.Quest, T.Cheevs
 --------------------------------------------------------------------
 --- Tracker-specific data retrieval functions
 --------------------------------------------------------------------
 
 
+local DoQuestRewards= function(t, questID)
+  local rewards = {}
+  t.numCurrencies = GetNumQuestLogRewardCurrencies(questID)
+  for i = 1, t.numCurrencies do
+    local name, texture, count = GetQuestLogRewardCurrencyInfo(i, questID)
+    tinsert(rewards,{
+      type = 'currency',
+      index = i,
+      name = name,
+      texture = texture,
+      count = count
+    });
+  end
+  -- items
+  t.numItems = GetNumQuestLogRewards(questID)
+  for i = 1, t.numItems do
+    local name, texture, count, quality, isUsable = GetQuestLogRewardInfo(i, questID)
+    tinsert(rewards, {
+      type = 'item',
+      index = i ,
+      name = name,
+      texture = texture,
+      count = count,
+      quality = quality,
+      isUsable = isUsable
+    });
+  end
+  -- money
+
+  local money = GetQuestLogRewardMoney(questID)
+  if ( money > 0 ) then
+    tinsert(rewards, {
+      type = 'money',
+      name = GetMoneyString(money),
+      texture = "Interface\\Icons\\inv_misc_coin_01",
+      count = 0,
+    });
+  end
+
+  if #rewards >= 1 then
+    t.rewardInfo = rewards
+  end
+end
+
+
 -----------------------------
 --- AUTO_QUEST
 AutoQuest.LogInfo = {}
@@ -40,19 +86,22 @@
 end
 AutoQuest.GetInfo = function(self, popupIndex)
 
+
   local questID, type = GetAutoQuestPopUp(popupIndex)
   local questIndex = GetQuestLogIndexByID(questID)
   local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
 
-  self.Info[questID] = {
-    title = title,
-    description = type,
-    popupType = type,
-    questID = questID,
-    questIndex = questIndex,
-    popupIndex = popupIndex,
-  }
-  self.WatchInfo[popupIndex] = self.Info[questID]
+  self.Info[questID] = self.Info[questID] or {}
+  local popup = self.Info[questID]
+  popup.title = title
+  popup.description = type
+  popup.popupType = type
+  popup.questID = questID
+  popup.questIndex = questIndex
+  popup.popupIndex = popupIndex
+
+  self.Info[questID] = popup
+  self.WatchInfo[popupIndex] = popup
 
 
   return self.Info[questID]
@@ -71,9 +120,23 @@
 -- It's kind of dumb, but this avoids the risk of code taint.
 
 --- Returns a tasks table modified to include recently completed objectives
-local completedTasks = {}
+local UnitName, GetRealmName = UnitName, GetRealmName
 local InternalGetTasksTable = function()
+  local completedTasks = T.Conf.TasksLog
+  local char = UnitName("player")
+  local realm = GetRealmName()
   local tasks = GetTasksTable()
+
+  for questID, data in pairs(Bonus.Info) do
+
+    print('  -- questID:', questID, #data.objectives)
+      for i, o in ipairs(data.objectives) do
+        print('    --', i, o.text)
+      end
+
+  end
+
+
   for questID, data in pairs(completedTasks) do
     if questID > 0  then
       local found = false
@@ -98,6 +161,7 @@
 
 --- Returns an entry from the composed tasks table if possible, otherwise makes an API pull
 local InternalGetTaskInfo = function(questID)
+  local completedTasks = T.Conf.TasksLog
   if completedTasks[questID] then
     return true, true, #completedTasks[questID].objectives
   else
@@ -107,7 +171,9 @@
 
 --- Same as above but for the objective entries
 local InternalGetQuestObjectiveInfo = function(questID, objectiveIndex)
+  local completedTasks = T.Conf.TasksLog
   if ( completedTasks[questID] ) then
+    print('using internal data')
     return completedTasks[questID].objectives[objectiveIndex], completedTasks[questID].objectiveType, true;
   else
     return GetQuestObjectiveInfo(questID, objectiveIndex, false);
@@ -121,25 +187,27 @@
 Bonus.POI = {}
 Bonus.Scenario = {}
 Bonus.QuestBlock = {}
+Bonus.WatchInfo = {}
 function Bonus:GetNumWatched ()
   print(self.name, self)
+
   local tasks = InternalGetTasksTable()
   local numWatched = 0
   local numAll = 0
   self.WatchInfo = {}
   print('|cFFFFFF00Bonus.GetNumWatched()|r', #tasks)
+  print('  TasksTable pull:')
   for i, questID in ipairs(tasks) do
     local isInArea, isOnMap, numObjectives = InternalGetTaskInfo(questID)
     local existingTask = self.QuestBlock[questID]
     local displayObjectiveHeader = false;
-    print ('   |cFF00FF00taskIndex', i, 'questID', questID, 'inArea', isInArea, 'onMap', isOnMap, 'existing', (existingTask and 'Y' or 'N'))
-    if isInArea or isOnMap then
+    local test = (isInArea or (isOnMap and existingTask))
+    --local test = true
+    if test then
       self.Info[questID] = self.Info[questID] or {}
 
       local t = self.Info[questID]
-      local title = GetQuestLogTitle(questID)
       self.WatchInfo[i] = t
-      t.title = title
       t.isInArea = isInArea
       t.isOnMap = isOnMap
       t.existingTask = existingTask
@@ -147,10 +215,22 @@
       t.objectives = {}
       t.taskIndex = i
 
+
+      DoQuestRewards(t, questID)
+
+      local taskTitle
       local taskFinished = true;
       for objectiveIndex = 1, numObjectives do
         local text, objectiveType, finished, displayAsObjective = InternalGetQuestObjectiveInfo(questID, objectiveIndex, false);
         displayObjectiveHeader = displayObjectiveHeader or displayAsObjective;
+        if not taskTitle then
+          if objectiveType == 'progressbar' and not text:match('^%d%+\\%d+') then
+            taskTitle = text
+            text = ''
+          end
+        end
+
+
         print('  --', text, objectiveType, finished, displayAsObjective)
         t.objectives[objectiveIndex] = t.objectives[objectiveIndex] or  {}
         local  o = t.objectives[objectiveIndex]
@@ -162,15 +242,33 @@
         o.displayAsObjective = displayAsObjective
         print('     |cFF00FF88*', objectiveIndex, text)
       end
+
+      -- didn't get a name from progress bar? what about area name
+      if not taskTitle then
+        if isInArea then
+          taskTitle = GetMapNameByID(GetCurrentMapAreaID())
+        end
+      end
+      t.title = taskTitle
     end
+
+    print ('    |cFF00FF88#', i, 'questID', questID, 'inArea', isInArea, 'onMap', isOnMap, 'existing', (existingTask and 'Y' or 'N'), (test and '|cFF00FF00show|r' or '|cFFFF0088hide|r'))
   end
 
 
   self.numAll = #tasks
   self.numWatched = #self.WatchInfo
-  print('   stats:', self.numAll, 'active tasks,', self.numWatched, 'nearby or animating')
+  print('  stats:', self.numAll, 'active tasks,', self.numWatched, 'nearby or animating')
   --return #tasks
-  return GetNumQuestLogTasks()
+  return #self.WatchInfo
+end
+
+--- info cleanup done when  turn-ins are detected
+Bonus.OnTurnIn = function(self, questID, xp, money)
+  print('|cFFFF8800'..self.name..':OnTurnIn call', questID, xp, money)
+
+
+
 end
 
 Bonus.GetInfo = function(self, taskIndex)
@@ -215,48 +313,7 @@
 
   t.displayObjectives = displayObjectives
 
-
-  local rewards = {}
-  t.numCurrencies = GetNumQuestLogRewardCurrencies(questID)
-  for i = 1, t.numCurrencies do
-    local name, texture, count = GetQuestLogRewardCurrencyInfo(i, questID)
-    tinsert(rewards,{
-      type = 'currency',
-      index = i,
-      name = name,
-      texture = texture,
-      count = count
-    });
-  end
-  -- items
-  t.numItems = GetNumQuestLogRewards(questID)
-  for i = 1, t.numItems do
-    local name, texture, count, quality, isUsable = GetQuestLogRewardInfo(i, questID)
-    tinsert(rewards, {
-      type = 'item',
-      index = i ,
-      name = name,
-      texture = texture,
-      count = count,
-      quality = quality,
-      isUsable = isUsable
-    });
-  end
-  -- money
-
-  local money = GetQuestLogRewardMoney(questID)
-  if ( money > 0 ) then
-    tinsert(rewards, {
-      type = 'money',
-      name = GetMoneyString(money),
-      texture = "Interface\\Icons\\inv_misc_coin_01",
-      count = 0,
-    });
-  end
-
-  if #rewards >= 1 then
-    t.rewardInfo = rewards
-  end
+  DoQuestRewards(t, questID)
 
   Bonus.TasksTable[questID] = t
 
@@ -371,6 +428,7 @@
   q.objectives = {}
   for i = 1, q.numObjectives do
     local text, type, finished = GetQuestLogLeaderBoard(i, questIndex)
+    print(format('   #%d %s %s %s', i, tostring(type), tostring(text), tostring(finished)))
     q.objectives[i] = {
       index = i,
       type = type,
@@ -385,6 +443,46 @@
     end
   end
 
+  if requiredMoney >= 1 then
+    local money = GetMoney()
+    local moneyText = money
+    local requiredSilver, requiredCopper
+    local requiredGold = (requiredMoney > 10000) and (floor(requiredMoney/10000)) or nil
+    if mod(requiredMoney, 10000) ~= 0 then
+      requiredSilver = (requiredMoney > 100) and (mod(requiredMoney, 10000) / 100) or nil
+      if mod(requiredMoney, 100) ~= 0 then
+        requiredCopper = mod(requiredMoney, 100)
+      end
+    end
+
+    -- round the money value down
+    if requiredMoney > 9999 and not (requiredSilver or requiredCopper) then
+      moneyText = floor(money/10000)
+    elseif requiredMoney < 10000 and mod(requiredMoney,100) == 0 then
+      moneyText = floor(money/100)
+    end
+
+    local text = moneyText
+    local index = #q.objectives + 1
+    local finished = (GetMoney() >= requiredMoney)
+
+    if not finished then
+      text = text .. ' / ' .. GetCoinTextureString(requiredMoney, 15)
+    else
+      text = '' .. GetCoinTextureString(requiredMoney, 15)
+    end
+    q.objectives[index] = {
+      index = index,
+      type = 'progressbar',
+      quantity = money,
+      requiredQuantity = requiredMoney,
+      text = text,
+      finished = finished
+    }
+    print(format('   #%d %s %s %s', index, 'money', text, tostring(finished)))
+  end
+
+
   local link, icon, charges = GetQuestLogSpecialItemInfo(questIndex)
   local start, duration, enable = GetQuestLogSpecialItemCooldown(questIndex)
   if link or icon or charges then
--- a/ObjectiveTracker.xml	Fri Apr 08 06:12:05 2016 -0400
+++ b/ObjectiveTracker.xml	Sat Apr 09 07:32:45 2016 -0400
@@ -252,12 +252,9 @@
         </Texture>
       </Layer>
       <Layer level="ARTWORK">
-        <Texture name="$parentItemTile" parentKey="icon" alphaMode="ADD" hidden="true">
-          <Size x="40" y="40" />
-          <TexCoords top="0.12" bottom="0.87" left="0.12" right="0.87" />
+        <Texture name="$parentItemTile" parentKey="icon" alphaMode="BLEND" hidden="true">
           <Anchors>
             <Anchor point="TOPRIGHT" x="0" y="0" />
-
           </Anchors>
         </Texture>
         <Texture parentKey="typeTag" file="Interface\QuestFrame\QuestTypeIcons" alphaMode="ADD" hidden="true">
@@ -315,7 +312,7 @@
             <Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" />
           </Anchors>
         </FontString>
-        <FontString name="$parentItemTileText" parentKey="iconLabel" inherits="VeneerCriteriaFontNormal">
+        <FontString name="$parentItemTileText" parentKey="iconLabel" inherits="VeneerNumberFont">
           <Anchors>
             <Anchor point="TOPRIGHT" x="-1" y="-4" relativeKey="$parent.icon" />
           </Anchors>
--- a/ObjectiveUI.lua	Fri Apr 08 06:12:05 2016 -0400
+++ b/ObjectiveUI.lua	Sat Apr 09 07:32:45 2016 -0400
@@ -111,5 +111,8 @@
 end
 
 local Bonus = mod.Bonus
+Bonus.Select = function(self, questID)
+  Bonus:OnTurnIn(self.info.questID, 0, 30800)
+end
 Bonus.Remove = function(self, questID)
 end
\ No newline at end of file
--- a/ObjectiveWidgets.lua	Fri Apr 08 06:12:05 2016 -0400
+++ b/ObjectiveWidgets.lua	Sat Apr 09 07:32:45 2016 -0400
@@ -104,6 +104,7 @@
   ToggleWorldMap()
 end
 
+
 mod.InitializeWidgets = function()
   --- tracker scroll
   Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel)
@@ -214,7 +215,7 @@
     if (rangeTimer <= 0) then
       local link, item, charges, showItemWhenComplete = GetQuestLogSpecialItemInfo(self.questLogIndex)
       if ((not charges) or (charges ~= self.charges)) then
-        mod.UpdateWrapper()
+        mod:Update()
         return
       end
 
@@ -382,7 +383,7 @@
 }
 
 local progressHeight = 16
-local progressBorder = 2
+local progressBorder = 1
 local progressIndent = 3
 local progressFont = _G.VeneerCriteriaFontNormal
 
@@ -397,8 +398,8 @@
   self.bg:SetHeight(progressHeight)
   self.bg:SetWidth(self.width)
   self.fg:ClearAllPoints()
-  self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', self.indent, self.indent)
-  self.fg:SetHeight(progressHeight - progressIndent *  2)
+  self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', progressBorder, progressBorder)
+  self.fg:SetHeight(progressHeight - progressBorder *  2)
   self.status:SetFontObject(progressFont)
   self.status:SetText(self.objective.quantityString)
 end
@@ -417,13 +418,13 @@
   local progress = (quantity / requiredQuantity)
   if progress >= 1 then
     self.fg:Show()
-    self.fg:SetWidth(self.width  - self.indent)
+    self.fg:SetWidth(self.width  - progressBorder * 2)
   elseif progress > 0 then
     self.fg:Show()
     print('color:', 1-progress*2 , progress*2 - 1,0,1)
-    print('width:', (self.width  -self.indent) * progress)
+    print('width:', (self.width  -progressBorder * 2) * progress)
     self.fg:SetTexture(1-progress*2 , progress*2,0,1)
-    self.fg:SetWidth((self.width  -self.indent) * progress)
+    self.fg:SetWidth((self.width  -progressBorder * 2) * progress)
   else
     self.fg:Hide()
   end