changeset 63:8e130c92698f

- Added methods for obtaining pin data, and registering callbacks on data updates.
author Nick@Zahhak
date Tue, 21 Mar 2017 16:36:12 -0400
parents abcdef801db5
children 876c3f0bfd0e
files QuestPOI.lua WorldPlan.lua WorldQuests.lua
diffstat 3 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/QuestPOI.lua	Sat Feb 11 14:25:57 2017 -0500
+++ b/QuestPOI.lua	Tue Mar 21 16:36:12 2017 -0400
@@ -471,7 +471,7 @@
 
 function QuestPOI:ShowFrames()
   if not self:IsShown() then
-    self:SetShown(true)
+    --self:SetShown(true)
     print('|cFFFFFF00' ..self:GetName()..':ShowFrames()')
     qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
   else
--- a/WorldPlan.lua	Sat Feb 11 14:25:57 2017 -0500
+++ b/WorldPlan.lua	Tue Mar 21 16:36:12 2017 -0400
@@ -354,6 +354,10 @@
     wipe(db.ReportChunks)
   end
 
+  if self.dataFlush then
+    self:FireCallbacks()
+  end
+
 end
 
 function WorldPlanCore:Setup ()
@@ -556,8 +560,19 @@
 
 --------------------------------------------------------------------------------------------------------------------
 -------------------
-
-
+function WorldPlanCore:GetQuestPins(zoneID)
+  return db.UsedPins
+end
+function WorldPlanCore:RegisterDataCallback(func)
+  self.callbacks = self.callbacks or {}
+  self.callbacks[func] = func
+end
+function WorldPlanCore:FireCallbacks()
+  for func in pairs(self.callbacks) do
+    func()
+  end
+  self.dataFlush = nil
+end
 
 
 
--- a/WorldQuests.lua	Sat Feb 11 14:25:57 2017 -0500
+++ b/WorldQuests.lua	Tue Mar 21 16:36:12 2017 -0400
@@ -247,6 +247,7 @@
 
   if (not pin.dataLoaded) then
     pin:GetData()
+    WorldPlan.dataFlush = true
   end
 
   pin:CheckFilterRules()
@@ -272,6 +273,7 @@
   pin:HideFrames()
   tinsert(db.FreePins, pin)
 
+  WorldPlan.dataFlush = true
   print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title)
 end
 
@@ -429,6 +431,7 @@
   if self.isStale and self:IsVisible() then
     self:Refresh()
   end
+
 end
 
 function Module:Report()