comparison BuffFrame/BuffFrame.lua @ 48:9837069e366a

move BuffFrame-specific things out of Veneer.lua straighten out table hierarchy for BuffFrame module
author Nenue
date Thu, 28 Apr 2016 06:58:13 -0400
parents
children 16465f3fd919
comparison
equal deleted inserted replaced
47:1a322b92dbfa 48:9837069e366a
1 --------------------------------------------
2 -- Veneer
3 -- Nick
4 -- @project-revision@ @project-hash@
5 -- @file-revision@ @file-hash@
6 -- Created: 4/28/2016 5:58 AM
7 --------------------------------------------
8
9 local B = select(2,...).frame
10 local M = B:RegisterModule('BuffFrame')
11
12 function M:OnInitialize()
13 local displays = M.displays
14 local c= M.Conf
15 -- suffix tables
16
17 M.drawn = B.Abstract(displays, 'drawn', M.drawn )
18 -- Lesser extent of guide frames that have been positioned
19 M.positioned = B.Abstract(displays, 'positioned', M.positioned)
20 -- Backdrop style frame
21 M.decors = B.Abstract(displays, 'decorator', M.decors)
22 -- Static positioning frames
23 M.guides = B.Abstract(displays, 'guides', M.guides)
24 -- Anchor points for guides
25 M.anchors = B.Abstract(displays, 'anchor', M.anchors)
26 -- Stored functions for doing icon texture adjustments
27 M.zoom = B.Abstract(displays, 'zoom', M.zoom )
28
29
30 for name, display in pairs(displays) do
31 display.conf = setmetatable({}, {
32 __index = function(_, k)
33 --print('config check '.. name .. k)
34 return c[name .. k] or c['BuffButton' .. k]
35 end,
36 __newindex = function(_, k , v)
37 c[name..k] = v
38 end,
39 })
40 end
41
42 M:RegisterUnitEvent("UNIT_AURA", "player", "vehicle")
43 M:RegisterEvent("GROUP_ROSTER_UPDATE")
44 M:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
45 hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", M.PostBuffAnchors)
46 hooksecurefunc("RaidBuffTray_Update", M.UpdateRaidBuffs)
47 end
48
49 function M:OnUpdate ()
50 local displays = M.displays
51 M.ShowConsolidated = (IsInGroup() and GetCVarBool("consolidateBuffs"))
52 M.ShowMissingBuffs = (IsInGroup() and M.Conf.RaidShowMissing)
53
54 for name, auraType in pairs(displays) do
55
56 M.UpdateBuffs(auraType.buffName, true)
57 print(name, auraType)
58 _G[name..'Anchor']:EnableMouse(B.Conf.ConfigMode)
59 end
60
61 M.UpdateAnchorAnchors()
62 M.UpdateRaidBuffs()
63 M.UpdateBuffsTodo()
64 end