view Modules/ObjectiveTracker.lua @ 76:83b3cdaae6a5

refactor into addons
author Nenue
date Sat, 27 Aug 2016 10:45:05 -0400
parents 95ed343c3a42
children
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 INSET_V = -20

local GetVeneer = function()

  print('|cFFFF4400ObjectiveTracker_Initialize|r')
  otvn = vn.GetVeneer(ot)
  print(otvn:GetHeight())


  for i = 1, #ot.MODULES do
    print(i, ot.MODULES[i])
  end
  ot:ClearAllPoints()
  ot:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -5, -140)

  --vn.GetVeneer(ot):SetAllPoints(ot)
end

local UpdateVeneer = function()
  if not ot.initialized or not otvn then
    return
  end



  ot:ClearAllPoints()
  ot:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -5, -140)

end

local CreateVeneer = function()
  ot = ObjectiveTrackerFrame
  hooksecurefunc('ObjectiveTracker_Initialize', GetVeneer)
  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