diff QuestPOI.lua @ 30:8cb750e79952

WorldPlan: - Reworking filters to utilize newly added CVars
author Nenue
date Fri, 28 Oct 2016 14:06:07 -0400
parents c1612c2c1840
children d0114b51cdea
line wrap: on
line diff
--- a/QuestPOI.lua	Thu Oct 27 13:50:56 2016 -0400
+++ b/QuestPOI.lua	Fri Oct 28 14:06:07 2016 -0400
@@ -13,7 +13,7 @@
 
 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
-local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuest', ...) end or function() end
+local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end
 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
 local QuestPOI = WorldPlanPOIMixin
 
@@ -172,19 +172,22 @@
   qprint('|cFF00FF88'..self:GetName()..':RefreshData()|r')
 
   if info then
-
-    self.x = info.x or self.x
-    self.y = info.y or self.y
     self.inProgress = info.inProgress
     self.floor = info.floor
     self.numObjectives = info.numObjectives or 0
-    print('|cFFFF4400subbing in new info', info.x, info.y, self.x, self.y)
+    if info.x and info.y then
+      self.x = info.x or self.x
+      self.y = info.y or self.y
+      qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y)
+    end
+
+    self.passesBlizzFilters = WorldMap_DoesWorldQuestInfoPassFilters(info)
   end
 
 
   local questID = self:GetID()
   local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _
-  local hasUpdate, isPending = self.isNew, false
+  local hasUpdate, isPending = self.hasUpdate, self.isPending
 
 
   if not HaveQuestData(questID) then
@@ -207,7 +210,7 @@
       rewardName = GetMoneyString(money)
       rewardType = REWARD_CASH
     end
-    rewardStyle = WorldPlan:GetTypeInfo(rewardType)
+    rewardStyle = self:GetTypeInfo(rewardType)
 
     self.itemNumber = rewardCount or self.itemNumber
     self.rewardType = rewardType or REWARD_ITEM
@@ -264,7 +267,8 @@
 
 
     qprint('  |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending)
-    qprint(' ', self.title, self.itemTexture, 'rewardType:', self.rewardType, 'tag:', self.tagID, 'style', self.style )
+    qprint('  ', 'rewardType:', self.rewardType, 'tag:', self.tagID)
+    qprint('  ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
   end
   return hasUpdate, isPending
 end
@@ -277,15 +281,14 @@
 function WorldPlanPOIMixin:ShowNew()
   self:SetShown(true)
   self.isNew = nil
+  self.hasUpdate = true
   self.FadeIn:Play()
 end
 
 function WorldPlanPOIMixin:OnShow ()
   qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow() update:', self.hasUpdate, 'new:', self.isNew, 'animation:', self.isAnimating)
-  qprint(debugstack())
   -- pop this on principle
   if self.hasUpdate then
-
     self:Refresh()
   end
 
@@ -328,9 +331,7 @@
 
 function WorldPlanPOIMixin:OnEvent(event, ...)
   if event == 'SUPER_TRACKED_QUEST_CHANGED' then
-    if self:IsVisible() then
-      self:Refresh()
-    end
+    self.hasUpdate = true
   end
 end
 
@@ -338,6 +339,12 @@
 local PIN_UPDATE_DELAY = .016
 local TOP_PIN_ID
 function WorldPlanPOIMixin:OnUpdate (sinceLast)
+
+  if self.hasUpdate then
+    wqprint('|cFFFFFF00push poi update')
+    self:Refresh()
+    return
+  end
   -- control update check intervals
   self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast
   if self.throttle <= 0 then
@@ -361,10 +368,6 @@
     end
   end
 
-  if self.hasUpdate then
-    self:Refresh()
-    self.hasUpdate = nil
-  end
 
   -- update time elements
   local tl = self.timeThreschold
@@ -397,17 +400,18 @@
 
 function WorldPlanPOIMixin:Refresh ()
   local db = WorldPlan.db
-  local print = qprint
-  print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
-  print(self.style)
+  local print = wqprint
+  print('|cFF00FF88'..self:GetName()..'|r:Refresh()')
 
 
 
   local questID = self:GetID()
-  local style,subStyle =  WorldPlan:GetTypeInfo(self.rewardType or ((self.quality or 0) + 127))
+  local style,subStyle =  self:GetTypeInfo(self.rewardType)
   if self.filtered then
     subStyle = style.minimized
   end
+  self.style = style
+
 
   local borderMask = style.mask
   local borderFill = style.texture
@@ -421,18 +425,20 @@
   self.showNumber = subStyle.showNumber
 
 
-  print('  - subStyle:', (self.filtered == true), self.subStyle)
 
   --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
   SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask)
   icon:SetAllPoints(self)
 
   if self.itemName then
-    local color = self.rewardColor or COMMON_COLOR
-
 
 
     if self.hasNumeric then
+      if subStyle.numberFontObject then
+        wqprint('change font', _G[subStyle.numberFontObject]:GetName())
+        self.count:SetFontObject(_G[subStyle.numberFontObject])
+      end
+
       self.count:SetShown(true)
       self.count:SetText(self.itemNumber)
       self.count:SetTextColor(unpack(self.numberRGB))
@@ -444,8 +450,7 @@
   end
 
   SetMaskedTexture(iconBorder, borderFill, borderMask)
-  local border = WorldPlan:GetTypeInfo(self.rewardType)
-  print(self.rewardType, print)
+  local border = self:GetTypeInfo(self.rewardType)
   iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
   iconBorder:SetDesaturated(true)
 
@@ -472,7 +477,8 @@
   else
     self.EliteBorder:Hide()
   end
-  qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
+  --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
+  --print('  - subStyle:', (self.filtered == true), self.subStyle)
 
 
   self:UpdateSize()