changeset 71:d6c0bed32c51

fixed bounty highlighting and changed quests matching the selected bounty to have a yellow highlight, while quests matching any ongoing bounty are highlighted blue
author Nenue
date Wed, 05 Apr 2017 12:44:19 -0400
parents bb2baedae81f
children 6db0b9696936
files QuestPOI.lua WorldQuests.lua
diffstat 2 files changed, 28 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/QuestPOI.lua	Wed Apr 05 12:12:41 2017 -0400
+++ b/QuestPOI.lua	Wed Apr 05 12:44:19 2017 -0400
@@ -782,6 +782,8 @@
     if tl and (timeLeft < 120) then
       self.HighlightBorder:SetVertexColor(1,0,0,0.7)
     elseif self.isBounty then
+      self.HighlightBorder:SetVertexColor(1,1,0,1)
+    elseif self.isCriteria then
       self.HighlightBorder:SetVertexColor(.25,.5,1,1)
     else
       self.HighlightBorder:SetVertexColor(0,0,0,0.7)
--- a/WorldQuests.lua	Wed Apr 05 12:12:41 2017 -0400
+++ b/WorldQuests.lua	Wed Apr 05 12:44:19 2017 -0400
@@ -80,11 +80,11 @@
   for target, arg in pairs(callbacks) do
     print(type(target))
     if type(target) == 'table' then
-      local callerName = target:GetName()
+      local callerName = target:GetName() or tostring(target)
       for name, method  in pairs(arg) do
         print(callerName, arg)
         hooksecurefunc(target, name, function(...)
-          self:OnSecureHook(callerName .. '.' .. arg, method, ...)
+          self:OnSecureHook(callerName .. '.' .. name, method, ...)
         end)
       end
     else
@@ -138,6 +138,7 @@
 callbacks[WorldMapFrame.UIElementsFrame.BountyBoard] = {
   SetSelectedBountyIndex = function(WorldQuests)
     WorldQuests:UpdateBountyInfo()
+    WorldQuests:Refresh(true)
   end
 }
 callbacks[WorldMapFrame.UIElementsFrame.ActionButton] = {
@@ -149,6 +150,7 @@
 
 local GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestFlaggedCompleted = GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestFlaggedCompleted
 function Module:UpdateBountyInfo()
+  print('|cFF00FF88BountyInfo()|r')
   wipe(db.BountyInfo)
   db.selectedBounty = nil
 
@@ -159,26 +161,32 @@
     if data.factionID then
       data.title = GetQuestLogTitle(GetQuestLogIndexByID(data.questID))
       data.complete =  IsQuestFlaggedCompleted(data.questID)
-      db.BountyInfo[data.factionID] = data
-      if index == selectedBounty then
-        db.selectedBounty = data
+      if not data.complete then
+        db.BountyInfo[data.factionID] = data
+        print('bounty', data.factionID, data.title, data.complete)
+        if index == selectedBounty then
+          db.selectedBounty = data
+        end
       end
+
     end
   end
 
   for questID, pin in pairs(db.QuestsByID) do
     local doUpdate
-    if pin.factionID and db.BountyInfo[pin.factionID] then
-      if not pin.isCriteria then
+    if pin.factionID then
+      if db.BountyInfo[pin.factionID] then
+        print(pin.questID, pin.factionID, db.BountyInfo[pin.factionID], pin.isCriteria)
         pin.isCriteria = true
         doUpdate = true
-      end
-    else
-      if pin.isCriteria then
+      else
         doUpdate = true
         pin.isCriteria = nil
       end
+
     end
+
+
     if doUpdate then
       if pin:IsVisible() then
         pin:Refresh()
@@ -519,13 +527,13 @@
 
     local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
     print(pin.title, pin.dataLoaded  and not pin.filtered, scaleFactor)
-    pin:SetAnchor(nil, pin.x, pin.y, self.hostWidth, self.hostHeight, scaleFactor)
-
-    if pin.isNew then
-      pin:OnShow()
+    if pin.used then
+      pin:SetAnchor(nil, pin.x, pin.y, self.hostWidth, self.hostHeight, scaleFactor)
+      if pin.isNew then
+        pin:OnShow()
+      end
     end
 
-
     pin = tremove(db.UpdatedPins)
 
   end
@@ -654,6 +662,9 @@
     end
   end
 
+
+  self:UpdateBountyInfo()
+
   print(numShown, 'shown', numLoaded, 'loaded')
   if numShown > numLoaded then
     self.Status:Show()