diff WorldPlan.lua @ 35:26dfa661daa7

WorldPlan: - Quest pins will appear in the flight map. They follow the filter settings applied from the world map. - Reward filter toggle changed to clear out other reward filters. The assumption being that one is most often looking only for that particular type of quest when they go to use it. - Fixed filter bar info falling out of sync after player-triggered world map updates. - Code stuff: -- Quest pin shown-state management makes better use of OnShow OnHide handlers, SetShown is toggled and it all goes from there -- WorldQuests module re-factored outside of the top level frame script. ClassPlan: - Available missions are now recorded; the mission list can be toggled between in-progress and available by clicking the heading.
author Nenue
date Thu, 03 Nov 2016 17:29:15 -0400
parents 0100d923d8c3
children 21bcff08b0f4
line wrap: on
line diff
--- a/WorldPlan.lua	Wed Nov 02 19:04:47 2016 -0400
+++ b/WorldPlan.lua	Thu Nov 03 17:29:15 2016 -0400
@@ -11,9 +11,12 @@
   QuestsByID = {},
   TaskQueue = {},
 }
+WorldPlanPOIMixin = {}
 local WorldPlan = WorldPlanCore
 
 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
+
+local mprint = DEVIAN_WORKSPACE and function(...) _G.print('Canvas', ...) end or function() end
 local WP_VERSION = "1.0"
 local tinsert, pairs, floor = table.insert, pairs, floor
 local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS
@@ -168,9 +171,14 @@
   if event == 'ADDON_LOADED' then
     local addon = ...
     if addon == "Blizzard_FlightMap" then
-      print('do mixin junk')
-      self.OnFlightMapLoaded()
+      mprint('sending data provider')
+      local dataProvider = Mixin(MapCanvasDataProviderMixin, WorldPlanDataProvider)
+      WorldPlanDataPinMixin = Mixin(MapCanvasPinMixin, WorldPlanDataPinMixin)
+      for k,v in pairs(dataProvider) do
+        mprint((v == WorldPlanDataProvider[k]) and ('|cFF00FF00'..tostring(k)..'|r') or ('|cFFFF4400'..tostring(k)..'|r'))
+      end
 
+      FlightMapFrame:AddDataProvider(dataProvider)
     end
     if IsLoggedIn() and not self.initialized then
       self:Setup()
@@ -179,8 +187,8 @@
     if event == 'WORLD_MAP_UPDATE' then
       self.currentMapID = GetCurrentMapAreaID()
       self.isContinentMap = (self.currentMapID == BROKEN_ISLES_ID)
-      self:print('|cFFFF4400currentMapID =', self.currentMapID)
-      --self.isStale = true
+      --self:print('|cFFFF4400currentMapID =', self.currentMapID)
+      self.isStale = true
     end
 
     for i, module in ipairs(self.modules) do
@@ -196,7 +204,7 @@
 
 
   tinsert(self.TaskQueue, func)
-  self:print('|cFF00FF00adding scheduled task #', #self.TaskQueue)
+  --self:print('|cFF00FF00adding scheduled task #', #self.TaskQueue)
 end
 
 function WorldPlanCore:OnUpdate()
@@ -410,43 +418,7 @@
 end
 
 --------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
-
-
--- data provider manipulations for the taxi map
-WorldPlan.OnFlightMapLoaded = function()
-  if true then return end
-  -- todo: figure out how to layer inside the map canvas
-  local res = {}
-  local t = {}
-  for k,v in pairs(FlightMapFrame) do
-    tinsert(res, tostring(k))
-  end
-
-  table.sort(res)
-  for i, k in ipairs(res) do
-    print(k)
-  end
-  hooksecurefunc(FlightMapFrame, 'RefreshAll', function(self)
-    print('|cFF0088FFWQDP RefreshAllData ', GetTime())
-
-    WorldPlan:GetPinsForMap(self:GetMapID())
-
-    for pin in self:EnumerateAllPins() do
-      if pin.worldQuest then
-        --print('got pin #', pin.questID)
-        local wp = self.QuestsByID[pin.questID]
-        if wp then
-          wp:ClearAllPoints()
-          wp:SetParent(FlightMapFrame.ScrollContainer)
-          wp:SetFrameStrata('MEDIUM')
-          wp:SetPoint('CENTER', pin, 'CENTER')
-          wp:Show()
-        end
-      end
-    end
-  end)
-end
+-------------------
 
 
 
@@ -465,4 +437,4 @@
   SetTimedCallbackForAllPins(5, function(self) self.PendingFade:Play() end)
   SetTimedCallbackForAllPins(8, function(self) self.PendingFade:Stop() end)
 end
---%end-debug%
+--%end-debug%
\ No newline at end of file