I've had some issues with buffs not correctly updating myself. Basically, doing this ...
lua Code:
header:SetScript('OnEvent', ParseAuras)
...before the headers are completely initialized seems to be a bad idea. I solved most of these problems by maintaining a structure like this:
lua Code:
local nivBuffs = CreateFrame("Frame", "nivBuffs")
local buffHeader = CreateFrame("Frame", "nivBuffs_Buffs", nil, "SecureAuraHeaderTemplate")
local debuffHeader = CreateFrame("Frame", "nivBuffs_Debuffs", nil, "SecureAuraHeaderTemplate")
do
local function setHeaderAttributes(header, template, filter, buff)
header:SetAttribute("unit", "player")
--set more attributes --
end
setHeaderAttributes(buffHeader, "nivBuffButtonTemplate", "HELPFUL", true)
buffHeader:SetPoint(nivBuffDB.buffAnchorFrom, nivBuffDB.buffAnchorFrame, nivBuffDB.buffAnchorTo, nivBuffDB.buffXpos, nivBuffDB.buffYpos)
buffHeader:Show()
setHeaderAttributes(debuffHeader, "nivDebuffButtonTemplate", "HARMFUL", false)
debuffHeader:SetPoint(nivBuffDB.debuffAnchorFrom, nivBuffDB.debuffAnchorFrame, nivBuffDB.debuffAnchorTo, nivBuffDB.debuffXpos, nivBuffDB.debuffYpos)
debuffHeader:Show()
end
--many local functions for updating --
local function updateStyle(self, event, unit)
--update style --
end
-- hide blizz auras --
nivBuffs:RegisterEvent("PLAYER_ENTERING_WORLD")
nivBuffs:RegisterEvent("UNIT_AURA")
nivBuffs:SetScript("OnEvent", updateStyle)
Of course, you may also get more inspiration from my whole code, if that doesn't spoil too much of the fun for you.