diff WorldPlan.lua @ 67:96183f981acb

Update for Legion Patch 7.2 - Pins for quests detected from the flight map should properly update as needed. - Fixed dropdown menu configurations not getting applied. - Added a toggle button to the world map display that performs the same function as the 'Enable' option in the dropdown menu. - Rewrote the majority of display update handlers for a significant performance improvements while interacting with the world map. - AP token info should now reflect artifact knowledge changes.
author Nenue
date Sat, 01 Apr 2017 08:17:30 -0400
parents e43e10c5576b
children cce68795f955
line wrap: on
line diff
--- a/WorldPlan.lua	Thu Mar 30 02:32:44 2017 -0400
+++ b/WorldPlan.lua	Sat Apr 01 08:17:30 2017 -0400
@@ -3,7 +3,7 @@
 -- %file-revision%
 local addonFileName, db = ...
 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
-local WP_VERSION = "1.2"
+local WP_VERSION = "1.4"
 local tinsert, pairs, floor = tinsert, pairs, floor
 local tremove, ipairs, wipe, unpack = tremove, ipairs, wipe, unpack
 local select, type, tostring, tonumber = select, type, tostring, tonumber
@@ -29,7 +29,9 @@
 db.TasksByID = {}
 db.FreePins = {}
 db.UsedPins = {}
+db.UpdatedPins = {}
 db.ReportChunks = {}
+db.BountyInfo = {}
 
 -- default color templates
 db.DefaultType = {
@@ -82,7 +84,7 @@
   NotifyWhenNewQuests = true,
   EnablePins = true,
   FadeWhileGrouped = false,
-  FlightMapAlphaLimits = {1, 1, 1},
+  FlightMapAlphaLimits = {1, .7, 1},
   FlightMapScalingLimits = {1, 3, 1.5},
   --UntrackedColor = {},
   --TrackedColor = {},
@@ -105,12 +107,7 @@
       WorldPlanData[key] = true
     end
   end
-  for _, module in ipairs(db.OrderedModules) do
-    if module.OnConfigUpdate then
-      module:OnConfigUpdate()
-    end
-  end
-  _G.WorldPlan:Refresh()
+  _G.WorldPlan:OnConfigUpdate()
 end
 
 -- insert visual options into the tracking button menu
@@ -195,6 +192,18 @@
   end
 end
 
+function WorldPlanCore:OnConfigUpdate()
+  for _, module in ipairs(db.OrderedModules) do
+    if module.OnConfigUpdate then
+      module:OnConfigUpdate()
+    end
+  end
+  db.currentMapID = nil
+  db.BountyUpdate = true
+  self:SetCurrentMap('CONFIG_UPDATE')
+  self:Refresh()
+end
+
 function WorldPlanCore:print(...) db.print(...) end
 
 function WorldPlanCore:AddHandler (frame)
@@ -285,34 +294,37 @@
 
 }
 
-function WorldPlanCore:SetCurrentMap()
+function WorldPlanCore:SetCurrentMap(event)
   local mapAreaID = GetCurrentMapAreaID()
   if not mapAreaID then
     return
   end
-  print(mapAreaID)
+  print('SetCurrentMap()', event, mapAreaID)
   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
+  local isMapOpen = WorldMapFrame:IsShown()
+  local isNewMap = isMapOpen and (mapAreaID ~= db.currentMapID)
   db.currentMapID = mapAreaID
   db.isContinentMap = isContinent
+  db.isBrokenIsle = isBrokenIsle
   db.useContinentType = (WorldMapDetailFrame:GetScale() < 1)
 
 
   for _, module in ipairs(db.OrderedModules) do
     if module.OnMapInfo then
       print('  |cFF00FFFF'..module:GetName() .. ':OnMapInfo()|r')
-      module:OnMapInfo(isBrokenIsle, isContinent, mapAreaID)
+      module:OnMapInfo(isBrokenIsle, isContinent, mapAreaID, isNewMap, isMapOpen)
     end
   end
 end
 
-
 function WorldPlanCore:OnEvent (event, ...)
 
   print('|cFF00FF88'..self:GetName().. ':OnEvent()|r', event, GetTime(), 'init:', self.initialized)
@@ -324,7 +336,9 @@
   else
     if (event == 'WORLD_MAP_UPDATE') or (event == 'PLAYER_ENTERING_WORLD') or (event == 'PLAYER_LOGIN') then
       print('|cFFFF4400currentMapID =', db.currentMapID, ...)
-      self:SetCurrentMap()
+
+
+      self:SetCurrentMap(event)
     end
   end
 end