diff QuestPOI.lua @ 54:b289eb3e6a32

- Fix stray pin text arising from pins that are never shown.
author Nenue
date Sat, 31 Dec 2016 17:31:39 -0500
parents 44baf4f35c7c
children 6a2e85836219
line wrap: on
line diff
--- a/QuestPOI.lua	Fri Dec 30 20:43:58 2016 -0500
+++ b/QuestPOI.lua	Sat Dec 31 17:31:39 2016 -0500
@@ -30,7 +30,7 @@
 
 
 local PIN_REFRESH_DELAY = .5
-local PIN_REQUEST_DELAY = .2
+local PIN_REQUEST_DELAY = .1
 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
 
@@ -272,7 +272,10 @@
   local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
   -- if the title is nil, then wait and try later
   if not questTitle then
-    self.isPending = true
+    if not self.isPending then
+      C_TaskQuest.RequestPreloadRewardData(questID)
+      self.isPending = true
+    end
     dprint('|cFFBB8844isPending=true|r|cFF00FFFF', self.questId)
   else
     self.title, self.factionID, self.capped = questTitle, factionID, capped
@@ -396,25 +399,20 @@
 
 function QuestPOI:OnShow ()
 
-  if self.isNew then
-    qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
-    --qprint('|cFFFFFF00popping new pin handler')
-    self:StartFade()
-  elseif not self.isAnimating then
-    self:SetAlpha(1) -- fix stuck alpha
-  end
-
   if self.isStale then
     qprint('|cFF0088FFflagged for refresh')
     self:Refresh()
   end
-  --WorldPlan:print(self:GetAlpha())
 
-  if not self.Overlay:IsShown() then
+  if self.isNew or (not self.Overlay:IsShown()) then
+    qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
+    --qprint('|cFFFFFF00popping new pin handler')
     self:StartFade()
   end
 
-
+  if not self.isAnimating then
+    self:SetAlpha(1) -- fix stuck alpha
+  end
   self.Overlay:SetShown(true)
 end
 function QuestPOI:OnHide()
@@ -426,8 +424,10 @@
 
 local overlayBaseIndex = 1300
 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight)
+  wqprint(self:GetName()..':SetAnchor', self.filtered, self.used)
   self:SetParent(owner)
   self:ClearAllPoints()
+  self:SetFrameLevel(overlayBaseIndex + self:GetID())
   self.Overlay:SetParent(owner)
   self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID())
   if (dX and dY) then
@@ -452,6 +452,7 @@
   self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
   self.isPending = true
   self.count = self.Overlay.count
+  self.Description = self.Overlay.Description
   self.timeLabel = self.Overlay.timeLabel
   self.updateRate = PIN_REQUEST_DELAY
   self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
@@ -556,21 +557,25 @@
 
   if self.itemName then
 
-    if self.itemNumber and self.itemNumber >= 1000 then
-      local numeral = floor(self.itemNumber/1000)
-      local decimal = mod(self.itemNumber, 1000)
-      local numberString = numeral
-      if decimal > 100 then
-        numberString = numberString .. '.' .. tostring(floor(decimal/100))
+    if self.itemNumber then
+      local numberString = self.itemNumber
+      if self.itemNumber >= 1000 then
+        local numeral = floor(self.itemNumber/1000)
+        local decimal = mod(self.itemNumber, 1000)
+        numberString = numeral
+        if decimal > 100 then
+          numberString = numberString .. '.' .. tostring(floor(decimal/100))
+        end
+        numberString = numberString .. 'k'
       end
-      numberString = numberString .. 'k'
       self.count:SetText(numberString)
     else
-      self.count:SetText(self.itemNumber)
+      self.count:SetText(nil)
     end
+  end
 
+  self.Description:SetText(self.title .. "\n" .. floor(self.x*100+.5) .. "," .. floor(self.y*100+.5))
 
-  end
   icon:SetMask("Interface\\Minimap\\UI-Minimap-Background")
   if self.itemTexture then
     --iconBorder:SetTexture(WORLD_QUEST_BORDER)
@@ -594,18 +599,18 @@
 
   iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background")
   iconBorder:SetTexture(PENDING_BORDER)
-  if isBounty then
-    iconBorder:SetVertexColor(0,.4,.9)
-  else
-    iconBorder:SetVertexColor(style.r, style.g, style.b, 1)
-  end
+  iconBorder:SetVertexColor(style.r, style.g, style.b, 1)
 
   iconBorder:SetDesaturated(true)
   iconBorder:SetAlpha(subStyle.alpha or 1)
 
   trackingBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background")
   trackingBorder:SetTexture(PENDING_BORDER)
-  trackingBorder:SetVertexColor(0,0,0,1)
+  if isBounty then
+    trackingBorder:SetVertexColor(.25,.5,1)
+  else
+    trackingBorder:SetVertexColor(0,0,0,1)
+  end
 
   self.tagIcon:SetShown((not self.filtered) and true or false)
   self.tagIcon:SetAtlas(self.tagAtlas)