view 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 source
-- Veneer
-- ObjectiveTracker.lua
-- Created: 8/16/2016 8:19 AM
-- %file-revision%
-- Fixes objective tracker positioning in relation to buff frame alterations

local plugin = CreateFrame('Frame', 'VeneerObjectives', UIParent)
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