diff WorldPlan.lua @ 36:21bcff08b0f4

WorldPlan: - Quest pins are now placed on the flight map. Their visibility rules will mirror the filter options from the world map. - Filter controls polish: - First click negates other reward type filters. Subsequent clicks will then toggle individual reward types until the filters are reset via Right-click. - Adheres to the Blizzard CVars added in patch 7.1 - Numerous optimizations to how data and visual updates are handled; should see an even better load time, and snappier world map interaction. ClassPlan: - The 'Available Missions' list is now recorded. It can be reviewed by clicking on the mission list heading. - Information filtering by character and realm.
author Nenue
date Fri, 04 Nov 2016 01:40:39 -0400
parents 26dfa661daa7
children 589c444d4837
line wrap: on
line diff
--- a/WorldPlan.lua	Thu Nov 03 17:29:15 2016 -0400
+++ b/WorldPlan.lua	Fri Nov 04 01:40:39 2016 -0400
@@ -11,12 +11,13 @@
   QuestsByID = {},
   TaskQueue = {},
 }
+WorldPlanQuestsMixin = {
+  QuestsByZone = {},
+  QuestsByID = {},
+  freePins = {},
+}
 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
@@ -35,25 +36,26 @@
   continent = {
     PinSize = 14,
     Border = 2,
-    TrackingBorder = 1,
+    highlightWidth = 1,
     TagSize = 6,
-    TimeleftStage = 0,
+    maxAlertLevel = 0,
     showNumber = true,
     numberFontObject = 'WorldPlanFont'
   },
   zone = {
-    PinSize = 22,
-    Border = 3,
-    TrackingBorder = 2,
+    iconWidth = 22,
+    borderWidth = 3,
+    highlightWidth = 2,
     TagSize = 12,
-    TimeleftStage = 3,
+    maxAlertLevel = 3,
     showNumber = true,
     numberFontObject = 'WorldPlanNumberFontThin'
   },
   minimized = {
-    PinSize = 6,
-    Border = 0,
-    TrackingBorder = 1,
+    iconWidth = 6,
+    borderWidth = 0,
+    highlightWidth = 0,
+    maxAlertLevel = 1,
     NoIcon = true,
     TimeleftStage = 1,
     showNumber = false,
@@ -95,7 +97,7 @@
   _G.WorldPlan:Refresh()
 end
 
-function WorldPlan:print(...)
+function WorldPlanCore:print(...)
   local msg
   for i = 1, select('#', ...) do
     msg = (msg and (msg .. ' ') or '') .. tostring(select(i, ...))
@@ -104,7 +106,7 @@
 end
 
 local current_type_owner
-function WorldPlan:AddHandler (frame, defaults)
+function WorldPlanCore:AddHandler (frame, defaults)
   print('|cFFFFFF00'..self:GetName()..':AddHandler()', frame:GetName())
   tinsert(self.modules, frame)
   self.defaults[frame] = defaults
@@ -113,7 +115,7 @@
   end
 end
 
-function WorldPlan:OnLoad ()
+function WorldPlanCore:OnLoad ()
 
   self.Types = setmetatable({}, {
     __newindex = function(t, k, v)
@@ -141,9 +143,8 @@
     self:AddTypeInfo(self, index, { r = color.r, g = color.g, b = color.b, hex = color.hex, })
   end
 
-  WorldPlan = self
 
-  WorldPlan:print('v'..WP_VERSION)
+  WorldPlanCore:print('v'..WP_VERSION)
 
   self:RegisterEvent("QUESTLINE_UPDATE")
   self:RegisterEvent("QUEST_LOG_UPDATE")
@@ -156,7 +157,7 @@
   self:SetParent(WorldMapFrame)
 end
 
-function WorldPlan:OnShow()
+function WorldPlanCore:OnShow()
   print(self:GetName()..':OnShow()')
   if self.isStale then
     self:Refresh()
@@ -165,21 +166,11 @@
   hooksecurefunc(self, 'SetScript', function(...) self:print('|cFFFFFF00'..self:GetName()..':SetScript()|r', ...) end)
 end
 
-function WorldPlan:OnEvent (event, ...)
+function WorldPlanCore:OnEvent (event, ...)
   print()
   print(event, 'init:', self.initialized)
   if event == 'ADDON_LOADED' then
-    local addon = ...
-    if addon == "Blizzard_FlightMap" then
-      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()
     end
@@ -228,7 +219,7 @@
   end
 end
 
-function WorldPlan:Setup ()
+function WorldPlanCore:Setup ()
   if not WorldPlanData then
     WorldPlanData = {key = 0 }
   end
@@ -272,13 +263,13 @@
   end)
 end
 
-function WorldPlan:AddTypeInfo(owner, id, info)
+function WorldPlanCore:AddTypeInfo(owner, id, info)
   self.Types[owner] = self.Types[owner] or {}
   self.Types[owner][id] = info
   print('Type('..owner:GetName()..')('..id..') = '.. tostring(info))
 end
 
-function WorldPlan:GetTypeInfo(owner, typeID)
+function WorldPlanCore:GetTypeInfo(owner, typeID)
   local info, extraInfo
   if not owner then
     --print('## deferring to default type list')
@@ -322,7 +313,7 @@
     }, -- 7 days + 1 minute
   }
   -- Generates a timeleft string
-  function WorldPlan:GetTimeInfo(timeLeft, limit)
+  function WorldPlanCore:GetTimeInfo(timeLeft, limit)
     limit = limit or #timeStates
     for index = 1, limit do
       local state = timeStates[index]
@@ -338,7 +329,7 @@
   end
 end
 
-function WorldPlan:Refresh (forced)
+function WorldPlanCore:Refresh (forced)
   print('|cFFFFFF00'..self:GetName()..':Refresh()|r forced:', forced, 'init:', self.initialized)
   if not self.initialized then
     return
@@ -353,7 +344,7 @@
 end
 
 -- insert visual options into the tracking button menu
-WorldPlan.OnDropDownInitialize = function  (self, callback, dropType)
+WorldPlanCore.OnDropDownInitialize = function  (self, callback, dropType)
   if self ~= WorldMapFrameDropDown then
     return
   end
@@ -430,8 +421,8 @@
 SLASH_WORLDPLAN2 = "/wp"
 SlashCmdList.WORLDPLAN = function()
   print('command pop')
-  WorldPlan:GetPinsForMap()
-  WorldPlan:RefreshPins()
+  WorldPlanCore:GetPinsForMap()
+  WorldPlanCore:RefreshPins()
 
   SetTimedCallbackForAllPins(0, function(self) self.FadeIn:Play() self.FlashIn:Play()  end)
   SetTimedCallbackForAllPins(5, function(self) self.PendingFade:Play() end)