diff QuestPOI.lua @ 27:4a7e89bffbcb r27-beta

- Order Hall resource rewards now show numerals in quest pins. - Fixed an occasional lua error that occurs when opening the quest map for the first time. - Fixed another source of textures losing their masks.
author Nenue
date Thu, 27 Oct 2016 06:18:16 -0400
parents a2b623043970
children c1612c2c1840
line wrap: on
line diff
--- a/QuestPOI.lua	Tue Oct 25 12:32:34 2016 -0400
+++ b/QuestPOI.lua	Thu Oct 27 06:18:16 2016 -0400
@@ -70,7 +70,7 @@
   region:SetMask(mask)
 end
 
-function QuestPOI:OnEnter()
+function WorldPlanPOIMixin:OnEnter()
   local completed = select(4,GetAchievementInfo(familiars_id))
   if not completed then
     if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then
@@ -98,10 +98,10 @@
   end
   TaskPOI_OnEnter(self)
 end
-function QuestPOI:OnLeave()
+function WorldPlanPOIMixin:OnLeave()
   TaskPOI_OnLeave(self)
 end
-function QuestPOI:OnMouseDown()
+function WorldPlanPOIMixin:OnMouseDown()
   TaskPOI_OnClick(self)
 end
 
@@ -112,17 +112,27 @@
 
 end
 
-
-function QuestPOI:OnShow ()
-  qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow()')
-  -- pop this on principle
-  self:Refresh()
-end
-function QuestPOI:OnHide()
-  --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
+function WorldPlanPOIMixin:ShowNew()
+  self:SetShown(true)
+  self.isNew = nil
+  self.FadeIn:Play()
 end
 
-function QuestPOI:SetAnchor(frame, mapID, mapWidth, mapHeight)
+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
+
+end
+function WorldPlanPOIMixin:OnHide()
+  qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
+end
+
+function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight)
   self:ClearAllPoints()
   local dX, dY = TQ_GetQuestLocation(self.questID, mapID)
   if not dX or dX == 0 then
@@ -146,11 +156,14 @@
 end
 
 
-function QuestPOI:OnLoad()
+function WorldPlanPOIMixin:OnLoad()
+  qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db)
   self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
+  self.style = WorldPlan.db.defaultPinStyle
+  self.subStyle = WorldPlan.db.defaultPinStyle.continent
 end
 
-function QuestPOI:OnEvent(event, ...)
+function WorldPlanPOIMixin:OnEvent(event, ...)
   if event == 'SUPER_TRACKED_QUEST_CHANGED' then
     if self:IsVisible() then
       self:Refresh()
@@ -161,7 +174,7 @@
 
 local PIN_UPDATE_DELAY = .016
 local TOP_PIN_ID
-function QuestPOI:OnUpdate (sinceLast)
+function WorldPlanPOIMixin:OnUpdate (sinceLast)
   -- control update check intervals
   self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast
   if self.throttle <= 0 then
@@ -234,7 +247,7 @@
 
 
 
-function QuestPOI:Refresh ()
+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))
@@ -244,18 +257,19 @@
 
   local questID = self.questId
   local style = self.style
+  local subStyle = style[(self.filtered and 'minimized' or 'continent')]
   local borderMask = style.mask
   local borderFill = style.texture
   local iconBorder = self.iconBorder
   local icon = self.icon
   local count = self.count
 
+  self.subStyle = subStyle
+  self.hasNumeric = style.hasNumeric
+  self.numberRGB = style.numberRGB
+  self.showNumber = subStyle.showNumber
 
-  local subStyle = self.filtered and 'minimized' or 'continent'
-  if subStyle ~= self.subStyle then
-    print( '  - changed subStyle, need to redo masks')
-  end
-  self.subStyle = subStyle
+
   print('  - subStyle:', (self.filtered == true), self.subStyle)
 
   --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
@@ -264,11 +278,16 @@
 
   if self.itemName then
     local color = self.rewardColor or COMMON_COLOR
-    if self.itemNumber and  self.target then
-      self.count:SetText(color.hex .. tostring(self.itemNumber))
+
+
+    self.label:SetShown( self.showNumber)
+    if self.hasNumeric then
+      self.label:SetText(self.itemNumber)
+      self.label:SetTextColor(unpack(self.numberRGB))
     else
-      self.count:SetText(nil)
+      self.label:SetText(nil)
     end
+
   end
 
   SetMaskedTexture(iconBorder, borderFill, borderMask)
@@ -299,16 +318,11 @@
   else
     self.EliteDecal:Hide()
   end
-
-  if style.showNumber then
-    self.label:SetText(self.itemNumber)
-  else
-    self.label:SetText(nil)
-  end
   qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
 
 
   self:UpdateSize()
+  self.hasUpdate = nil
 end
 
 function WorldPlanFilterPinMixin:OnEnter ()