changeset 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
files FlightMap.lua QuestPOI.lua WorldPlan.lua WorldQuests.lua WorldQuests.xml
diffstat 5 files changed, 292 insertions(+), 88 deletions(-) [+]
line wrap: on
line diff
--- a/FlightMap.lua	Thu Mar 30 02:32:44 2017 -0400
+++ b/FlightMap.lua	Sat Apr 01 08:17:30 2017 -0400
@@ -114,10 +114,13 @@
                 frame.pin = pin
 
                 -- sticking it onto the MapCanvas pin
+                pin:SetAnchor(frame, nil, nil, nil, nil, pin.filtered and 0.5 or 1)
                 pin.owningFrame = frame:GetMap()
                 pin.throttle = 1
                 pin.isStale = true
-                pin:SetAnchor(frame)
+
+                pin:ClearAllPoints()
+                pin:SetPoint('CENTER', frame, 'CENTER')
                 --print(pin.Overlay:IsShown(), pin.Overlay:GetPoint(1))
               end
               pin:SetShown(pin.used)
--- a/QuestPOI.lua	Thu Mar 30 02:32:44 2017 -0400
+++ b/QuestPOI.lua	Sat Apr 01 08:17:30 2017 -0400
@@ -31,19 +31,20 @@
 local GameTooltip = GameTooltip
 local GetItemIcon = GetItemIcon
 
-local print = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
-local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
-local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
-local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end
-local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
-local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or function() end
-local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or function() end
+local print = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or nop
+local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or nop
+local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or nop
+local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or nop
+local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or nop
+local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or nop
+local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or nop
 local QuestPOI = WorldPlanPOIMixin
 
 local pinBaseIndex = 1300
 local overlayBaseIndex = 1350
 local previousHighlight
 
+local DATA_DEBUG = false
 local PIN_REFRESH_DELAY = .5
 local PIN_REQUEST_DELAY = .1
 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
@@ -90,6 +91,7 @@
 local MINIMIZED_STYLE = {
   hideNumber = true,
   hideIcon = true,
+  iconWidth = 3,
 }
 local REWARD_TYPE_STYLES = {
   [REWARD_CASH] = {
@@ -376,7 +378,6 @@
     end
   end
 
-  self.isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(questID)
 
   return self.dataLoaded
 end
@@ -511,7 +512,12 @@
       qprint('  ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
 
       if (self.itemNumber ~= rewardCount) or (self.rewardType ~= rewardType) or (self.itemName ~= rewardName) or (self.itemTexture ~= rewardIcon) then
+        if DATA_DEBUG and (self.debugTimer <= 0) then
+          return false
+        end
+
         return true, rewardType, rewardName, rewardIcon, rewardCount, quality
+
       else
         return false
       end
@@ -565,8 +571,8 @@
     self:Refresh()
   end
 
-  if self.isNew or (not self.Overlay:IsShown()) then
-    --qprint('|cFFFFFF00popping new pin handler')
+  if self.isNew then
+    qprint('|cFFFFFF00popping new pin handler')
     self:StartFade()
   end
 
@@ -585,42 +591,52 @@
   self.isAnimating = nil
 end
 
--- Places the pin and triggers display
+-- Applies position and sizing parameters to the pin data
 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor)
-  wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used)
+  dprint(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)
+  if owner then
+    local prevOwner = self:GetParent()
+    if prevOwner ~= owner then
+      self.isStale = true
+    end
+    self:SetParent(owner)
+    self.Overlay:SetParent(owner)
+  else
+    owner = self:GetParent()
+  end
+
   self:ClearAllPoints()
   self:SetFrameLevel(pinBaseIndex + self:GetID())
-  self.Overlay:SetParent(owner)
-  self.Overlay:SetScale(scaleFactor)
   self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID())
+
+  local scaleChanged
+  if scaleFactor and (self.scaleFactor ~= scaleFactor) then
+    print('scaleFactor')
+    self:SetScale(scaleFactor)
+    self.Overlay:SetScale(scaleFactor)
+    self.scaleFactor = scaleFactor
+    scaleChanged = true
+  end
+
   if (dX and dY) then
     if not (mapHeight and mapWidth) then
       mapWidth, mapHeight = owner:GetSize()
-      end
-    if (self.x ~= dY) or (self.y ~= dY) or (self.scaleFactor ~= scaleFactor) then
+    end
+
+    if (self.x ~= dY) or (self.y ~= dY) or scaleChanged then
       self.x = dX
       self.y = dY
-      self.scaleFactor = scaleFactor
       local pX = (dX * mapWidth) * (1 / scaleFactor)
       local pY = (-dY * mapHeight) * (1 / scaleFactor)
       self:SetPoint('CENTER', owner, 'TOPLEFT', pX, pY)
     end
-  else
-    if self.x or self.y then
-      self.x = nil
-      self.y = nil
-      self:SetPoint('CENTER')
-    end
   end
 
-  self:ShowFrames()
 end
 
 -- Show/Hide the text overlays associated with the quest pin; they aren't hierarchically linked
@@ -650,7 +666,7 @@
 
 function QuestPOI:OnLoad()
   qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config)
-
+  self.debugTimer = 4
   self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
   self.isPending = true
   self.count = self.Overlay.count
@@ -674,6 +690,8 @@
 
 function QuestPOI:OnUpdate (sinceLast)
   -- control update check intervals
+
+
   self.throttle = (self.throttle or self.updateRate) + sinceLast
   if self.throttle >= self.updateRate then
     -- factor overtime into the throttle timer
@@ -681,31 +699,42 @@
   else
     return
   end
-  if self.isNew then
-    --print('|cFFFFFF00push new poi stuff')
-    self:OnNew()
-  elseif self.isStale then
-    --wprint('|cFFFFFF00push poi update')
-    self:Refresh()
-    return
+  --@debug@
+  if DATA_DEBUG then
+    self.debugTimer = self.debugTimer - sinceLast
+    if self.debugTimer >= 0 then
+      print(self.debugTimer)
+    end
   end
+  --@end-debug@
 
   -- query for reward data if it wasn't found in the original scan
   local questID = self.questID
   if not self.dataLoaded then
-    --print('|cFFFF4400'..self:GetID()..':|r polling reward info')
+    print('|cFFFF4400'..self:GetID()..':|r polling reward info')
     if not (self.isAnimating) then
       self.PendingFade:Play()
     end
     local dataLoaded = self:GetData()
-    if dataLoaded then
-      WorldPlanQuests.isZoomDirty = true
+    if dataLoaded and not tContains(db.UpdatedPins, self) then
+
+      print('|cFF00FF88'..self:GetID()..':|r reward info loaded! queue it up')
+
+      tinsert(db.UpdatedPins, self)
     end
     return
   else
     if self.PendingFade:IsPlaying() then
+      print('|cFFFF4400'..self:GetID()..':|r cancel fader')
       self.PendingFade:Stop()
     end
+
+    if self.isStale then
+      print(self.questID, '|cFFFFFF00flagged for update')
+      self:CheckFilterRules()
+      self:Refresh()
+      return
+    end
   end
 
   self:UpdateStatus()
--- 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
--- a/WorldQuests.lua	Thu Mar 30 02:32:44 2017 -0400
+++ b/WorldQuests.lua	Sat Apr 01 08:17:30 2017 -0400
@@ -18,6 +18,7 @@
 local GetQuestLogRewardInfo = GetQuestLogRewardInfo
 local GetCurrentMapAreaID, GetMapInfo, GetMapNameByID = GetCurrentMapAreaID, GetMapInfo, GetMapNameByID
 
+
 local print = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end
 local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or function() end
 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
@@ -38,6 +39,7 @@
   0.25, 0.7, 1
 }
 
+local ToggleButton = {}
 local numShown = 0
 local numLoaded = 0
 local isDataLoaded
@@ -56,13 +58,25 @@
 end
 
 function Module:OnUpdate(sinceLast)
-  if self.filtersDirty or self.isStale or self.isZoomDirty then
+
+  if self.filtersDirty or self.isStale then
     self:Refresh()
   end
+  if #db.UpdatedPins >= 1 then
+    print('|cFF00FF88pending updates', #db.UpdatedPins)
+    self:UpdateQueuedPins()
+  end
+
 end
 
-local InternalDoRefresh = function (self)
-  WorldPlanQuests:Refresh()
+local currentScale = WorldMapDetailFrame:GetScale()
+function Module:RefreshIfChanged()
+  local scaleCheck = WorldMapDetailFrame:GetScale()
+  if scaleCheck ~= currentScale then
+    print('|cFF00FF88scale changed from', currentScale, 'to', scaleCheck)
+    self:Refresh()
+    currentScale = scaleCheck
+  end
 end
 
 function Module:Setup()
@@ -73,11 +87,24 @@
   end
 
   hooksecurefunc("ClickWorldMapActionButton", function () self:OnClickWorldMapActionButton() end)
-  hooksecurefunc("WorldMapScrollFrame_ReanchorQuestPOIs", InternalDoRefresh)
-  hooksecurefunc("WorldMap_UpdateQuestBonusObjectives", function () self:OnUpdateQuestBonusObjectives() end)
-  hooksecurefunc("WorldMapFrame_UpdateMap", InternalDoRefresh)
-  WorldMapFrame.UIElementsFrame.BountyBoard:SetSelectedBountyChangedCallback(InternalDoRefresh);
-  WorldMapFrame.UIElementsFrame.ActionButton:SetOnCastChangedCallback(InternalDoRefresh);
+  hooksecurefunc("WorldMapScrollFrame_ReanchorQuestPOIs", function()
+    print("WorldMapScrollFrame_ReanchorQuestPOIs")
+    self:RefreshIfChanged()
+  end)
+  hooksecurefunc("WorldMap_UpdateQuestBonusObjectives", function ()
+    self:OnUpdateQuestBonusObjectives()
+  end)
+  hooksecurefunc("WorldMapFrame_UpdateMap", function()
+    print("WorldMapFrame_UpdateMap")
+    self:RefreshIfChanged()
+  end)
+  WorldMapFrame.UIElementsFrame.BountyBoard:SetSelectedBountyChangedCallback(function()
+    self:OnSelectedBountyChanged()
+  end);
+  WorldMapFrame.UIElementsFrame.ActionButton:SetOnCastChangedCallback(function()
+    print("CastChangedCallback")
+    self:Refresh(true)
+  end);
 
   self.Status = CreateFrame('Frame', nil, self)
   self.Status:SetPoint('TOPLEFT', WorldMapPOIFrame, 'TOPLEFT', 0, 0)
@@ -103,14 +130,76 @@
 
 
   end)
+
+  self:SetAllPoints(WorldMapPOIFrame)
+  for k,v in pairs( ToggleButton) do
+    self.Toggle:SetScript(k,v)
+  end
+  self:Show()
+end
+
+local GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestFlaggedCompleted = GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestFlaggedCompleted
+function Module:UpdateBountyInfo()
+  wipe(db.BountyInfo)
+  db.selectedBounty = nil
+
+  local selectedBounty = WorldMapFrame.UIElementsFrame.BountyBoard:GetSelectedBountyIndex()
+  local bounties, numBounties = GetQuestBountyInfoForMapID(db.currentMapID)
+
+  for index, data in ipairs(bounties) do
+    if data.factionID then
+      data.title = GetQuestLogTitle(GetQuestLogIndexByID(data.questID))
+      data.complete =  IsQuestFlaggedCompleted(data.questID)
+      db.BountyInfo[data.factionID] = data
+      if index == selectedBounty then
+        db.selectedBounty = data
+      end
+    end
+  end
+
+  for questID, pin in pairs(db.QuestsByID) do
+    local doUpdate
+    if pin.factionID and db.BountyInfo[pin.factionID] then
+      if not pin.isCriteria then
+        pin.isCriteria = true
+        doUpdate = true
+      end
+    else
+      if pin.isCriteria then
+        doUpdate = true
+        pin.isCriteria = nil
+      end
+    end
+    if doUpdate then
+      if pin:IsVisible() then
+        pin:Refresh()
+      else
+        pin.isStale = true
+      end
+    end
+  end
+  db.BountyUpdate = nil
+end
+
+function Module:OnSelectedBountyChanged()
+  self:UpdateBountyInfo()
 end
 
 function Module:OnConfigUpdate()
+  print('|cFFFFFF00OnConfigUpdate()|r')
   if db.Config.FadeWhileGrouped then
     db.PinAlpha = 0.15
   else
     db.PinAlpha = 1
   end
+
+  if not db.Config.EnablePins then
+    for _, pin in pairs(db.QuestsByID) do
+      pin:SetShown(false)
+    end
+  end
+
+  ToggleButton.OnShow(self.Toggle)
 end
 
 local InternalHideButton = function(button, index)
@@ -140,11 +229,12 @@
 end
 
 function Module:OnUpdateQuestBonusObjectives()
-  print('|cFFFF4400WorldMap_UpdateQuestBonusObjectives')
+  rprint('|cFFFF4400WorldMap_UpdateQuestBonusObjectives')
   self:UpdateBlizzButtons()
 end
 
 function Module:OnClickWorldMapActionButton()
+  rprint('|cFFFF4400ClickWorldMapActionButton')
   self:UpdateBlizzButtons()
 end
 
@@ -167,21 +257,22 @@
   self:RegisterEvent('CURRENT_SPELL_CAST_CHANGED')
 end
 
-function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID)
-  print('|cFFFFFF00'..self:GetName()..':OnMapInfo()|r visible =', self:IsVisible())
-  if self.isZoomedOut ~= isZoomedOut then
-    self.sizesDirty = true
+function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID, isNewMap, isMapOpen)
+
+  print('|cFFFFFF00'..self:GetName()..':OnMapInfo()|r, mapAreaID =', mapAreaID,'visible =', isMapOpen, 'changed =', isNewMap)
+
+  if db.BountyUpdate then
+    self:UpdateBountyInfo()
+  end
+  if isNewMap then
+    print('|cFF00FF88refreshing for changed map')
+    if isMapOpen then
+      self:Refresh(true)
+    else
+      self.isStale = true
+    end
   end
 
-  self.isZoomedOut = isZoomedOut
-  self.isWorldQuestMap = isBrokenIsle
-  self.currentMapID = mapAreaID
-
-  if self:IsVisible() then
-    self:Refresh(true)
-  else
-    self.isStale = true
-  end
 end
 local superTrackedQuestID
 function Module:OnEvent (event, ...)
@@ -290,6 +381,7 @@
   pin.isActive = TQ_IsActive(questID)
   pin:CheckFilterRules()
   rprint(pin:GetID(), pin.filtered, pin.used)
+  pin:SetShown(pin.used)
 
   return pin
 end
@@ -417,6 +509,21 @@
   end
   return 128, icon, quantity, name, itemID, quality
 end
+
+-- pins are queued by their OnUpdate and are ostensibly already visible, we just need to fix the zoom and anchor
+function Module:UpdateQueuedPins()
+  print('|cFF00FF88UpdateQueuedPins()')
+  local pin = tremove(db.UpdatedPins)
+  while pin do
+    pin:CheckFilterRules()
+
+    local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
+    print(pin.title, pin.dataLoaded  and not pin.filtered, scaleFactor)
+    pin:SetAnchor(nil, pin.x, pin.y, self.hostWidth, self.hostHeight, scaleFactor)
+    pin = tremove(db.UpdatedPins)
+  end
+end
+
 -- create of update quest pins for a map and its underlying zones
 function Module:UpdateWorldQuests (mapID)
 
@@ -490,15 +597,20 @@
   end
 end
 
-function Module:Refresh()
-  self.currentMapID = GetCurrentMapAreaID()
-  rprint('|cFF00FF88'..self:GetName()..':Refresh()|r')
-  print('|cFF00FF88'..self:GetName()..':Refresh()|r')
+local bountiesInitialized
+function Module:Refresh(...)
+  rprint('|cFF00FF88'..self:GetName()..':Refresh()|r', ...)
+  print('|cFF00FF88'..self:GetName()..':Refresh()|r', ...)
   if not self:IsVisible() then
     print('  not visible, flag for later')
     self.isStale = true
     return self:MarkAllPins()
   end
+  if not db.Config.EnablePins then
+    return
+  end
+
+
   wprint('  |cFF00FF88'..self:GetName()..':Refresh()|r')
 
   scaleConstant = db.isContinentMap and 2 or 3
@@ -512,8 +624,6 @@
     self:UpdateAnchors(nil)
   end
 
-  print('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
-  rprint('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
   --local showQuestPOI = db.Config.EnablePins
   numShown = 0
   numLoaded = 0
@@ -522,7 +632,7 @@
     if pin.used then
       pin.throttle = 1
       if oV == false then
-        print('|cFF00FF00cleanup +|r', questID, pin.title)
+        rprint('|cFF00FF00cleanup +|r', questID, pin.title)
       end
       pin:SetShown(true)
       numShown = numShown + 1
@@ -532,12 +642,13 @@
 
     else
       if oV == true then
-        print('|cFFFF4400 -|r', questID, pin.title)
+        rprint('|cFFFF4400 -|r', questID, pin.title)
       end
       pin:HideFrames()
     end
   end
 
+  print(numShown, 'shown', numLoaded, 'loaded')
   if numShown > numLoaded then
     self.Status:Show()
   end
@@ -566,7 +677,7 @@
   end
 
 
-  print('~ ', pin.mapID, pin.questID, pin.title)
+  --print('  |- ', pin.questID, pin.title)
   rprint('|cFF00FF00update|r', pin.questID, pin.title)
 
   if x and y then
@@ -603,8 +714,8 @@
   self.hostWidth, self.hostHeight = WorldMapPOIFrame:GetSize()
   self.nudgeThrescholdX = 16/self.hostWidth
   self.nudgeThrescholdY = 16/self.hostHeight
-  local print = rprint
-  print('|cFF00FF00'..self:GetName()..':UpdateAnchors()')
+
+  rprint('|cFF00FF00'..self:GetName()..':UpdateAnchors()')
   local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo()
   if isMicroDungeon then
     return
@@ -613,15 +724,15 @@
   isDataLoaded = true
 
   numPins = 0
-  local taskInfo = TQ_GetQuestsForPlayerByMapID(self.currentMapID)
+  local taskInfo = TQ_GetQuestsForPlayerByMapID(db.currentMapID)
   if taskInfo then
-    self:UpdateMap(taskInfo, self.currentMapID)
+    self:UpdateMap(taskInfo, db.currentMapID)
   end
-  local numZones = MC_GetNumZones(self.currentMapID)
+  local numZones = MC_GetNumZones(db.currentMapID)
   if numZones then
     for i = 1, numZones do
-      local mapAreaID = MC_GetZoneInfo(self.currentMapID, i)
-      local taskInfo = TQ_GetQuestsForPlayerByMapID(mapAreaID, self.currentMapID)
+      local mapAreaID = MC_GetZoneInfo(db.currentMapID, i)
+      local taskInfo = TQ_GetQuestsForPlayerByMapID(mapAreaID, db.currentMapID)
       if taskInfo then
         self:UpdateMap(taskInfo, mapAreaID)
       end
@@ -629,3 +740,11 @@
   end
 end
 
+function ToggleButton:OnShow()
+  self:SetChecked(db.Config.EnablePins and true or false)
+end
+function ToggleButton:OnClick()
+  print(self:GetChecked())
+  db.Config.EnablePins = self:GetChecked()
+  _G.WorldPlan:OnConfigUpdate()
+end
\ No newline at end of file
--- a/WorldQuests.xml	Thu Mar 30 02:32:44 2017 -0400
+++ b/WorldQuests.xml	Sat Apr 01 08:17:30 2017 -0400
@@ -4,11 +4,49 @@
 
 
   <Frame name="$parentQuests" mixin="WorldPlanQuestsMixin" parent="WorldPlan">
+
     <Scripts>
       <OnLoad method="OnLoad" />
       <OnEvent method="OnEvent" />
+      <OnUpdate method="OnUpdate" />
       <OnShow method="OnShow" />
     </Scripts>
+
+    <Frames>
+      <CheckButton name="$parentToggle" parentKey="Toggle" >
+        <Size x="20" y="20" />
+        <Anchors>
+          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" x="2" y="-6" />
+        </Anchors>
+        <Layers>
+          <Layer level="BACKGROUND">
+            <Texture setAllPoints="false">
+              <Anchors>
+                <Anchor point="TOPRIGHT" x="-1" y="-1" />
+                <Anchor point="BOTTOMLEFT" x="1" y="1" />
+              </Anchors>
+              <Color a="1" r="0" g="0" b="0" />
+            </Texture>
+          </Layer>
+        </Layers>
+
+        <ButtonText inherits="GameFontNormal" text="World Quests">
+          <Anchors>
+            <Anchor point="LEFT" relativePoint="RIGHT" x="3" />
+          </Anchors>
+        </ButtonText>
+        <NormalTexture setAllPoints="true">
+          <Color a=".25" r="0" g="0" b="0" />
+        </NormalTexture>
+        <CheckedTexture setAllPoints="false">
+          <Anchors>
+            <Anchor point="TOPRIGHT" x="-1" y="-1" />
+            <Anchor point="BOTTOMLEFT" x="1" y="1" />
+          </Anchors>
+          <Color a=".75" r="1" g="1" b="1" />
+        </CheckedTexture>
+      </CheckButton>
+    </Frames>
   </Frame>
 
   </Ui>
\ No newline at end of file