Hello there!
I am trying to track my
Anticipation stacks (Rogue Lvl 90 Talent where you can store up additional 5 combo points) on my oUF layout.
This is the code inside my function library
Lua Code:
local anticipation = {}
lib.createAnticipation = function()
local frame = CreateFrame("Frame", nil, oUF_LynPlayer)
frame:SetFrameLevel(oUF_LynPlayer:GetFrameLevel()+1)
frame:SetSize(((cfg.power.width + 2) * 5) + 5, cfg.power.height)
frame:SetPoint('CENTER', UIParent, 0, 0)
for i = 1, 5 do
anticipation[i] = CreateFrame("StatusBar", nil, frame)
anticipation[i]:SetStatusBarTexture(cfg.barGw)
anticipation[i]:SetStatusBarColor(1, 0.3, 0)
anticipation[i]:SetHeight(cfg.power.height)
anticipation[i]:SetWidth(cfg.power.width)
anticipation[i]:SetPoint('LEFT', anticipation[i-1], 'RIGHT', 2, 0)
anticipation[i].bg = CreateFrame("Frame", nil, anticipation[i])
anticipation[i].bg:SetFrameLevel(anticipation[i]:GetFrameLevel()-1)
anticipation[i].bg:SetPoint("TOPLEFT", -1, 1)
anticipation[i].bg:SetPoint("BOTTOMRIGHT", 1, -1)
anticipation[i].bg:SetBackdrop({
bgFile = cfg.background,
tile = false,
tileSize = 16,
edgeSize = 0,
insets = {
left = 0,
right = 0,
top = 0,
bottom = 0,
},
})
anticipation[i].bg:SetBackdropColor(0,0,0,1)
anticipation[i]:Hide()
end
end
lib.updateAnticipation = function(self, event)
if self.unit ~= "player" then return end
for i = 1, 5 do anticipation[i]:Hide() end
local stacks = select(4, UnitBuff('player', GetSpellInfo(115189))) -- Anticipation stacks
if stacks then
for i = 1, stacks do
anticipation[i]:Show()
end
end
end
... and these are called on my oUF player frame:
Lua Code:
self:RegisterEvent('PLAYER_LOGIN', lib.createAnticipation)
self:RegisterEvent('UNIT_AURA', lib.updateAnticipation)
My problem is now, it doesn't throw errors, the event call works (chat prints out correct Anticipation stacks when I get one/loose one) -
but it doesn't show my frames.