view BuffFrame/BuffFrame.lua @ 49:16465f3fd919

- remove UpdateAnchorAnchors and use hardlink for the one frame that this applied to
author Nenue
date Fri, 29 Apr 2016 10:50:27 -0400
parents 9837069e366a
children d7655c4e6e06
line wrap: on
line source
--------------------------------------------
-- Veneer
-- Nick
-- @project-revision@ @project-hash@
-- @file-revision@ @file-hash@
-- Created: 4/28/2016 5:58 AM
--------------------------------------------

local B = select(2,...).frame
local M = B:RegisterModule('BuffFrame')

M.PlayerBuffsActive = {}
function M:OnInitialize()
  local displays = M.displays

  -- suffix tables
  M.drawn = B.Abstract(displays, 'drawn', M.drawn )
  -- Lesser extent of guide frames that have been positioned
  M.positioned = B.Abstract(displays, 'positioned', M.positioned)
  -- Backdrop style frame
  M.decors = B.Abstract(displays, 'decorator', M.decors)
  -- Static positioning frames
  M.guides = B.Abstract(displays, 'guides', M.guides)
  -- Anchor points for guides
  M.anchors = B.Abstract(displays, 'anchor', M.anchors)
  -- Stored functions for doing icon texture adjustments
  M.zoom = B.Abstract(displays, 'zoom', M.zoom )


  for name, display in pairs(displays) do
    display.conf = setmetatable({}, {
      __index = function(_, k)
        --print('config check '.. name .. k)
        return M.Conf[name .. k] or M.Conf['BuffButton' .. k]
      end,
      __newindex = function(_, k , v)
        M.Conf[name..k] = v
      end,
    })
  end

  M:RegisterUnitEvent("UNIT_AURA", "player", "vehicle")
  M:RegisterEvent("GROUP_ROSTER_UPDATE")
  M:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
  hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", M.PostBuffAnchors)
  hooksecurefunc("RaidBuffTray_Update", M.UpdateRaidBuffs)
end

function M:OnUpdate ()
  local displays = M.displays
  M.ShowConsolidated = (IsInGroup() and GetCVarBool("consolidateBuffs"))
  M.ShowMissingBuffs = (IsInGroup() and M.Conf.RaidShowMissing)

  for name, auraType in pairs(displays) do

    M.UpdateBuffs(auraType.buffName, true)
    --print(name, auraType)
    _G[name..'Anchor']:EnableMouse(B.Conf.ConfigMode)
  end

  M.UpdateRaidBuffs()
  M.UpdateBuffsTodo()
end