diff Modules/ObjectiveTracker.lua @ 71:6f8661094643

- obtains veneer objects through a common function and track them as a unified table.
author Nenue
date Tue, 23 Aug 2016 06:35:08 -0400
parents ef4116179e2f
children d80db9a9b7e4
line wrap: on
line diff
--- a/Modules/ObjectiveTracker.lua	Mon Aug 22 20:38:43 2016 -0400
+++ b/Modules/ObjectiveTracker.lua	Tue Aug 23 06:35:08 2016 -0400
@@ -5,4 +5,50 @@
 -- Fixes objective tracker positioning in relation to buff frame alterations
 
 local plugin = CreateFrame('Frame', 'VeneerObjectives', UIParent)
-local vn, print = LibStub("LibKraken").register(VeneerController, plugin)
\ No newline at end of file
+local vn, print = LibStub("LibKraken").register(VeneerController, plugin)
+local ot
+local otvn
+
+local ResetObjectiveTrackerAnchor = function()
+
+  print('|cFFFF4400ObjectiveTracker_Initialize|r')
+  otvn = vn.GetVeneer(ot.BlocksFrame)
+  print(otvn:GetHeight())
+  vn:print(ot:GetHeight(), ot:GetWidth())
+
+
+  for i = 1, #ot.MODULES do
+    print(i, ot.MODULES[i])
+  end
+end
+
+local UpdateVeneer = function()
+  if not ot.initialized then
+    return
+  end
+
+  ot:ClearAllPoints()
+  ot:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -5, -140)
+end
+
+local CreateVeneer = function()
+  ot = ObjectiveTrackerFrame
+  hooksecurefunc('ObjectiveTracker_Initialize', ResetObjectiveTrackerAnchor)
+  hooksecurefunc('ObjectiveTracker_Update', UpdateVeneer)
+end
+
+plugin.init = function()
+  if ObjectiveTrackerFrame then
+    print('tracker is already loaded')
+    CreateVeneer()
+  else
+    plugin:RegisterEvent('ADDON_LOADED')
+    plugin.ADDON_LOADED = function(self, addon)
+      if addon == 'Blizzard_ObjectiveTracker' then
+        print('responding to blizzard tracker loadin')
+        CreateVeneer()
+      end
+    end
+  end
+end
+