diff QuestPOI.lua @ 9:a2b623043970 v1.0-rc

WorldQuests: - Filter interface controls reworked: Left-Click toggles inclusive filtering, right-click toggle exclusion, and holding ctrl or shift will flip or reset the other filters of that type respectively. - Fix QuestPOI texture masks disappearing when toggling filter options * new masks aren't applied until SetTexture() is called, making a seemingly redundant call necessary for the change to manifest - Implemented configuration data storage and retrieval; tracking menu options should actually do something now. - Ignore remaining time for Profession quests that aren't part of the player's profession loadout - Alternate tooltip data appears for Pet Battle quests involved in the Family Familar achievement. A list of outstanding criteria is provided in the POI tooltip, and the quest name is highlighted in the filter tooltip. ClassPlan: - actually handle the mission complete icon
author Nenue
date Sun, 23 Oct 2016 17:18:31 -0400
parents 802abb8a10ea
children 4a7e89bffbcb
line wrap: on
line diff
--- a/QuestPOI.lua	Sun Oct 23 07:19:53 2016 -0400
+++ b/QuestPOI.lua	Sun Oct 23 17:18:31 2016 -0400
@@ -5,6 +5,7 @@
 --
 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
+local TQ_IsActive = C_TaskQuest.IsActive
 local QuestPOIGetIconInfo, WorldMapPOIFrame =  QuestPOIGetIconInfo, WorldMapPOIFrame
 
 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
@@ -12,6 +13,16 @@
 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
 local QuestPOI = WorldPlanPOIMixin
 
+local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
+local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
+
+local POI_BORDER_MASK = "Interface\\Minimap\\UI-Minimap-Background"
+local POI_BORDER_FILL = "Interface\\BUTTONS\\YELLOWORANGE64"
+local POI_BORDER_BLUE = "Interface\\BUTTONS\\GRADBLUE"
+local POI_BORDER_RED = "Interface\\BUTTONS\\RedGrad64"
+local POI_BORDER_YELLOW = "Interface\\BUTTONS\\YELLOWORANGE64"
+local POI_BORDER_GREEN = "Interface\\BUTTONS\\GREENGRAD64"
+
   local familiars = {
       [42159] = {npc = 106552, name = 'Nightwatcher Merayl'},
       [40277] = {npc = 97804, name = 'Tiffany Nelson'},
@@ -51,6 +62,13 @@
   }, -- 7 days + 1 minute
 }
 
+-- update a masked texture without messing up its blending mask
+local SetMaskedTexture = function(region, file, mask)
+  mask = mask or POI_BORDER_MASK
+  region:SetMask(nil)
+  region:SetTexture(file)
+  region:SetMask(mask)
+end
 
 function QuestPOI:OnEnter()
   local completed = select(4,GetAchievementInfo(familiars_id))
@@ -118,7 +136,7 @@
   self.x = dX
   self.y = dY
 
-  print('  |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY))
+  qprint('  |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY))
 
   local pX = (dX * mapWidth)
   local pY = (-dY * mapHeight)
@@ -198,8 +216,11 @@
     end
   else
     -- remove self in a timely manner
-    if not self.isPending then
-      self:Hide()
+    if not TQ_IsActive(self.questID) then
+      print('|cFFFF4400'..self:GetName()..' pin hard timeout')
+      if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
+        self:Hide()
+      end
     end
   end
   self.timeThreschold = tl
@@ -212,6 +233,84 @@
 end
 
 
+
+function QuestPOI: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 questID = self.questId
+  local style = self.style
+  local borderMask = style.mask
+  local borderFill = style.texture
+  local iconBorder = self.iconBorder
+  local icon = self.icon
+  local count = self.count
+
+
+  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))
+  SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask)
+  icon:SetAllPoints(self)
+
+  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))
+    else
+      self.count:SetText(nil)
+    end
+  end
+
+  SetMaskedTexture(iconBorder, borderFill, borderMask)
+  local border = (self.rewardType and db.rewardStyle[self.rewardType]) or (WORLD_QUEST_QUALITY_COLORS[self.rarity] or db.defaultStyle)
+  iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
+  iconBorder:SetDesaturated(true)
+
+  local trackingBorder = self.supertrackBorder
+
+  self.highlight:SetMask(nil)
+  if questID == GetSuperTrackedQuestID() then
+    trackingBorder:SetVertexColor(0,0,0,1)
+  else
+    trackingBorder:SetVertexColor(0,0,0,0.5)
+  end
+  self.highlight:SetAllPoints(trackingBorder)
+
+  SetMaskedTexture(trackingBorder, borderFill, borderMask)
+  self.highlight:SetMask(borderMask)
+
+  local qType = self.worldQuestType
+  self.tagIcon:SetAtlas(self.tagAtlas)
+  self.tagIcon:SetTexCoord(0,1,0,1)
+
+
+  if self.isElite then
+    self.EliteDecal:Show()
+  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()
+end
+
 function WorldPlanFilterPinMixin:OnEnter ()
   local filter = WorldPlan.FilterOptions[self:GetID()]
   local mapID = GetCurrentMapAreaID()