changeset 66:e43e10c5576b

Update for Legion Patch 7.2 - Massive performance improvements through largely re-written update routines. - Removed AP token caching until reliable mechanisms for detecting AK shifts can be resolved.
author Nenue
date Thu, 30 Mar 2017 02:32:44 -0400
parents 02f1d3bce558
children 96183f981acb
files QuestPOI.lua WorldPlan.lua WorldQuests.lua
diffstat 3 files changed, 129 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/QuestPOI.lua	Wed Mar 29 13:45:41 2017 -0400
+++ b/QuestPOI.lua	Thu Mar 30 02:32:44 2017 -0400
@@ -72,6 +72,42 @@
 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
 
+local DEFAULT_STYLE = {
+  border = {1,1,1},
+  x = 0, y = 0,
+  desaturated = true,
+  iconMask = "Interface\\Minimap\\UI-Minimap-Background",
+  borderMask = "Interface\\Minimap\\UI-Minimap-Background",
+  rewardMark = "Interface\\Minimap\\UI-Minimap-Background",
+  scaleFactors = {0.25, 0.7, 1},
+  iconWidth = 18,
+  borderWidth = 2,
+  highlightWidth = 2,
+  TagSize = 8,
+  maxAlertLevel = 0,
+  numberFontObject = 'WorldPlanFont'
+}
+local MINIMIZED_STYLE = {
+  hideNumber = true,
+  hideIcon = true,
+}
+local REWARD_TYPE_STYLES = {
+  [REWARD_CASH] = {
+    border = {1,1,0},
+    hideNumber = true,
+  },
+  [REWARD_ARTIFACT_POWER] = {},
+  [REWARD_GEAR] = {
+
+    hideNumber = true,
+  },
+  [REWARD_CURRENCY] = {},
+  [REWARD_REAGENT] = {
+
+    hideNumber = true,
+  },
+}
+
 local LE_ITEM_CLASS_WEAPON, LE_ITEM_CLASS_ARMOR, LE_ITEM_CLASS_GEM, LE_ITEM_GEM_ARTIFACTRELIC, LE_ITEM_CLASS_TRADEGOODS = LE_ITEM_CLASS_WEAPON, LE_ITEM_CLASS_ARMOR, LE_ITEM_CLASS_GEM, LE_ITEM_GEM_ARTIFACTRELIC, LE_ITEM_CLASS_TRADEGOODS
 
 
@@ -550,28 +586,30 @@
 end
 
 -- Places the pin and triggers display
-function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight)
-  wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, self.filtered, self.used)
+function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor)
+  wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used)
   if not self.used then
     self:HideFrames()
     return
   end
 
-
+  self:SetScale(scaleFactor)
   self:SetParent(owner)
   self:ClearAllPoints()
   self:SetFrameLevel(pinBaseIndex + self:GetID())
   self.Overlay:SetParent(owner)
+  self.Overlay:SetScale(scaleFactor)
   self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID())
   if (dX and dY) then
     if not (mapHeight and mapWidth) then
       mapWidth, mapHeight = owner:GetSize()
       end
-    if (self.x ~= dY) or (self.y ~= dY) then
+    if (self.x ~= dY) or (self.y ~= dY) or (self.scaleFactor ~= scaleFactor) then
       self.x = dX
       self.y = dY
-      local pX = (dX * mapWidth)
-      local pY = (-dY * mapHeight)
+      self.scaleFactor = scaleFactor
+      local pX = (dX * mapWidth) * (1 / scaleFactor)
+      local pY = (-dY * mapHeight) * (1 / scaleFactor)
       self:SetPoint('CENTER', owner, 'TOPLEFT', pX, pY)
     end
   else
@@ -646,7 +684,7 @@
   if self.isNew then
     --print('|cFFFFFF00push new poi stuff')
     self:OnNew()
-  elseif (self.isStale or (not self.title)) and not self.isAnimating then
+  elseif self.isStale then
     --wprint('|cFFFFFF00push poi update')
     self:Refresh()
     return
@@ -659,7 +697,10 @@
     if not (self.isAnimating) then
       self.PendingFade:Play()
     end
-    self:GetData()
+    local dataLoaded = self:GetData()
+    if dataLoaded then
+      WorldPlanQuests.isZoomDirty = true
+    end
     return
   else
     if self.PendingFade:IsPlaying() then
@@ -708,37 +749,43 @@
   end
 end
 
+
 function QuestPOI:Refresh ()
 
   rprint('|cFF00FF88'..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title)
 
+  local style = DEFAULT_STYLE
+  if self.dataLoaded and not self.filtered then
+    style = REWARD_TYPE_STYLES[self.rewardType]
+  else
+    style = MINIMIZED_STYLE
+  end
 
+  local currentWidth = style.iconWidth or DEFAULT_STYLE.iconWidth
 
-  local styleType = (self.dataLoaded and self.rewardType) or STYLE_TYPE_PENDING
-  local style,subStyle =  self:GetTypeInfo(self.rewardType)
-  if (self.filtered or (not self.dataLoaded)) and (self.questID ~= GetSuperTrackedQuestID()) then
-    subStyle = style.minimized
-  end
-  self.style = style
-  self.subStyle = subStyle
-  --print(style, subStyle)
-  self.currentWidth = subStyle.iconWidth
-  self.borderWidth = subStyle.borderWidth
-  self.highlightWidth = subStyle.highlightWidth
-  self.tagSize = subStyle.TagSize
-  self.maxAlertLevel = subStyle.maxAlertLevel
-  self.NoIcon = subStyle.NoIcon
 
+
+  local borderWidth = style.borderWidth or DEFAULT_STYLE.borderWidth
+  local highlightWidth = style.highlightWidth or DEFAULT_STYLE.highlightWidth
+  local tagSize = style.TagSize or DEFAULT_STYLE.TagSize
+  local hideIcon = style.hideIcon or DEFAULT_STYLE.hideIcon
+  local borderColor = style.border or DEFAULT_STYLE.border
   local questID = self.questID
   local iconBorder = self.RewardBorder
   local trackingBorder = self.HighlightBorder
   local icon = self.icon
   local count = self.count
+  local hideNumbers = style.hideNumber or DEFAULT_STYLE.hideNumber
+
+  local tagIcon = self.tagIcon
+  self.maxAlertLevel = style.maxAlertLevel or DEFAULT_STYLE.maxAlertLevel
+
+
   self.isBounty = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(self.questID)
 
   if self.itemName then
 
-    if self.itemNumber then
+    if self.itemNumber and (self.itemNumber > 1) and (not hideNumbers) then
       local numberString = self.itemNumber
       if self.itemNumber >= 1000000 then
         numberString = (floor(self.itemNumber/100000)/10) .. 'M'
@@ -754,9 +801,13 @@
         numberString = numberString .. 'k'
       end
       self.count:SetText(numberString)
+      self.count:Show()
     else
       self.count:SetText(nil)
+      self.count:Hide()
     end
+  else
+    self.count:Hide()
   end
 
   if db.Config.ShowVerboseInfo then
@@ -764,16 +815,16 @@
   end
 
 
-  icon:SetMask("Interface\\Minimap\\UI-Minimap-Background")
+  icon:SetSize(currentWidth, currentWidth)
+  icon:SetMask(style.iconMask or DEFAULT_STYLE.iconMask)
   if self.itemTexture then
     --iconBorder:SetTexture(WORLD_QUEST_BORDER)
 
-    if self.NoIcon then
+    if hideIcon then
       icon:SetTexture(PENDING_ICON)
       icon:SetDesaturated(true)
-      icon:SetVertexColor(style.r, style.g, style.b)
+      icon:SetVertexColor(unpack(borderColor))
     else
-
       icon:SetTexture(self.itemTexture)
       icon:SetDesaturated(false)
       icon:SetVertexColor(1, 1, 1)
@@ -782,22 +833,32 @@
     --
     icon:SetTexture(PENDING_ICON)
     icon:SetDesaturated(true)
-    icon:SetVertexColor(style.r, style.g, style.b)
+    icon:SetVertexColor(unpack(borderColor))
   end
+  local borderMask = style.borderMask or DEFAULT_STYLE.borderMask
+  local borderSize = currentWidth + (borderWidth * 2)
 
-  iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background")
+
+  iconBorder:SetSize(borderSize, borderSize)
+  iconBorder:SetMask(borderMask)
   iconBorder:SetTexture(PENDING_BORDER)
-  iconBorder:SetVertexColor(style.r, style.g, style.b, 1)
+  iconBorder:SetVertexColor(unpack(borderColor))
+  iconBorder:SetDesaturated(true)
 
-  iconBorder:SetDesaturated(true)
-  iconBorder:SetAlpha(subStyle.alpha or 1)
+  local highlightSize = borderSize + (highlightWidth * 2)
+  trackingBorder:SetSize(highlightSize, highlightSize)
+  trackingBorder:SetMask(borderMask)
+  trackingBorder:SetTexture(PENDING_BORDER)
 
-  trackingBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background")
-  trackingBorder:SetTexture(PENDING_BORDER)
+  self:SetSize(borderSize, borderSize)
+
+
+
+  iconBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))
+  trackingBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))
 
   self.tagIcon:SetShown((not self.filtered) and true or false)
   self.tagIcon:SetAtlas(self.tagAtlas)
-
   self.EliteBorder:SetShown(self.isElite and not self.filtered)
 
   self:UpdateSize()
@@ -862,7 +923,8 @@
 function QuestPOI:UpdateSize ()
 
   --qprint('|cFF00BB88'..self:GetID()..'|r:UpdateSize()', self.style, self.subStyle)
-
+  return
+  --[[
   local style = self.style
   local subStyle = self.subStyle
   local icon = self.icon
@@ -909,4 +971,5 @@
   else
     self.count:SetText(nil)
   end
+  --]]
 end
\ No newline at end of file
--- a/WorldPlan.lua	Wed Mar 29 13:45:41 2017 -0400
+++ b/WorldPlan.lua	Thu Mar 30 02:32:44 2017 -0400
@@ -294,10 +294,16 @@
   local isBrokenIsle = BROKEN_ISLE_MAPS[mapAreaID]
   local isContinent = (mapAreaID == BROKEN_ISLES_ID)
 
+  if db.isContinentMap ~= isContinent then
+    for _, pin in pairs(db.QuestsByID) do
+       pin.isStale = true
+    end
+  end
   db.currentMapID = mapAreaID
   db.isContinentMap = isContinent
   db.useContinentType = (WorldMapDetailFrame:GetScale() < 1)
 
+
   for _, module in ipairs(db.OrderedModules) do
     if module.OnMapInfo then
       print('  |cFF00FFFF'..module:GetName() .. ':OnMapInfo()|r')
--- a/WorldQuests.lua	Wed Mar 29 13:45:41 2017 -0400
+++ b/WorldQuests.lua	Thu Mar 30 02:32:44 2017 -0400
@@ -34,12 +34,16 @@
 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT
 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES
 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS
+local SCALE_FACTORS = {
+  0.25, 0.7, 1
+}
 
 local numShown = 0
 local numLoaded = 0
 local isDataLoaded
 local numPins = 0
 local NumPinFrames = 1
+local scaleConstant = 1
 Module.TasksByID = {}
 
 --%debug%
@@ -52,7 +56,7 @@
 end
 
 function Module:OnUpdate(sinceLast)
-  if self.filtersDirty or self.isStale then
+  if self.filtersDirty or self.isStale or self.isZoomDirty then
     self:Refresh()
   end
 end
@@ -152,14 +156,6 @@
   self:SetParent(WorldMapPOIFrame)
   WorldPlan:AddHandler(self, defaults)
 
-  local rgbWhite = {1, 1, 1 }
-  WorldPlan:AddTypeInfo(self, REWARD_UNKNOWN, { r = 0, g = 0, b = 0})
-  WorldPlan:AddTypeInfo(self, REWARD_REAGENT, { r = 0, g = 1, b = .5 })
-  WorldPlan:AddTypeInfo(self, REWARD_ARTIFACT_POWER, { r = 1, g = .25, b = .5, hasNumeric = true, numberRGB = rgbWhite })
-  WorldPlan:AddTypeInfo(self, REWARD_GEAR, { r = .3, g = .7, b = 1 })
-  WorldPlan:AddTypeInfo(self, REWARD_CURRENCY, { r = 1, g = 1, b = 0, hasNumeric = true, numberRGB = {1,1,0}, })
-  WorldPlan:AddTypeInfo(self, REWARD_CASH, { r = 1, g = 1, b = .32, pinMask = false, rewardMask = false })
-
   for areaID, fileName in pairs(WORLD_QUEST_MAPS) do
     db.QuestsByZone[areaID] = {}
   end
@@ -290,8 +286,8 @@
     WorldPlan.dataFlush = true
   end
 
+
   pin.isActive = TQ_IsActive(questID)
-
   pin:CheckFilterRules()
   rprint(pin:GetID(), pin.filtered, pin.used)
 
@@ -430,6 +426,17 @@
     return
   end
 
+  local scalingConstant = 1
+  local style = DEFAULT_STYLE
+  if self.dataLoaded then
+    style = REWARD_TYPE_STYLES[self.rewardType]
+    scalingConstant = db.isContinentMap and 2 or 3
+  end
+
+  local pinScale = SCALE_FACTORS[scalingConstant]
+  print(pinScale)
+  self:SetScale(pinScale)
+  self.Overlay:SetScale(pinScale)
 
     print('|cFF00FF88'..self:GetName()..':UpdateWorldQuests()|r', 'map:', mapID, 'realMap:', db.currentMapID)
 
@@ -494,6 +501,7 @@
   end
   wprint('  |cFF00FF88'..self:GetName()..':Refresh()|r')
 
+  scaleConstant = db.isContinentMap and 2 or 3
   for index, pin in pairs(db.QuestsByID) do
     pin.used = nil
   end
@@ -537,6 +545,7 @@
 
   self.isStale = nil
   self.sizesDirty = nil
+  self.isZoomDirty = nil
 end
 
 -- update visibility states of all pins
@@ -561,12 +570,15 @@
   rprint('|cFF00FF00update|r', pin.questID, pin.title)
 
   if x and y then
+    local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
     pin:SetFrameLevel(PinBaseIndex+pin:GetID())
     pin.owningFrame = WorldMapFrame
-    pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight)
+    pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor)
     --tinsert(self.UsedPositions, pin)
   end
-  if self:IsVisible() and pin.isStale then
+
+
+  if self:IsVisible() and (pin.isStale) then
     pin:Refresh()
   end
   if mapID then