diff WorldQuests.lua @ 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
line wrap: on
line diff
--- 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