--[[
first we are going to make two tables (lunarEmpowerments and solarEmpowerments)
we're going to make a frame we will utilize later to update the frames
then we are going to make 3 different individual lunarEmpowerment and solarEmpowerment frames, place them, make them pretty, and then put them in our empowerments parent table and hide them
then we set our script which will scan the player's buffs for lunar or solar empowerment, if they are there, show the respective number of bars, and if they aren't, hide any bars
]]--
if UnitClass(unit) == 'Druid' then
local lunarEmpowerments, solarEmpowerments = {}, {}
local empowermentCheckFrame = CreateFrame('Frame', nil, self)
empowermentCheckFrame:RegisterEvent('PLAYER_ENTERING_WORLD')
empowermentCheckFrame:RegisterUnitEvent('UNIT_AURA', 'player')
for i = 1, 3 do
local lunarEmpowerment = CreateFrame('Frame', nil, self)
local solarEmpowerment = CreateFrame('Frame', nil, self)
lunarEmpowerment:SetSize(41.3, 5)
solarEmpowerment:SetSize(41.3, 5)
local lunarEmpowermentTexture = lunarEmpowerment:CreateTexture(nil, 'OVERLAY')
local solarEmpowermentTexture = solarEmpowerment:CreateTexture(nil, 'OVERLAY')
lunarEmpowermentTexture:SetAllPoints()
solarEmpowermentTexture:SetAllPoints()
if i == 1 then
lunarEmpowerment:SetPoint('BOTTOMRIGHT', self.Power, 'TOP', -0.4, 0.8)
solarEmpowerment:SetPoint('BOTTOMLEFT', self.Power, 'TOP', 0.4, 0.8)
else
lunarEmpowerment:SetPoint('RIGHT', lunarEmpowerments[i - 1], 'LEFT', -0.8, 0)
solarEmpowerment:SetPoint('LEFT', solarEmpowerments[i - 1], 'RIGHT', 0.8, 0)
end
lunarEmpowerment:SetBackdrop(BACKDROP)
solarEmpowerment:SetBackdrop(BACKDROP)
lunarEmpowerment:SetBackdropColor(0, 0, 0)
solarEmpowerment:SetBackdropColor(0, 0, 0)
lunarEmpowermentTexture:SetTexture(TEXTURE)
solarEmpowermentTexture:SetTexture(TEXTURE)
lunarEmpowermentTexture:SetVertexColor(0.3, 0.52, 0.9)
solarEmpowermentTexture:SetVertexColor(1, 0.55, 0)
lunarEmpowerment:Hide()
solarEmpowerment:Hide()
lunarEmpowerments[i] = lunarEmpowerment
solarEmpowerments[i] = solarEmpowerment
end
empowermentCheckFrame:SetScript('OnEvent', function(self)
local isLunarEmpowered, isSolarEmpowered = false, false
for i = 1, 40 do
local name, _, count, _, _, _, _, _, _, spellID = UnitBuff('player', i)
if not name then break end
if spellID == 164547 then
isLunarEmpowered = true
for j = 1, count do
lunarEmpowerments[j]:Show()
end
if count < 3 then
for k = count + 1, 3 do
lunarEmpowerments[k]:Hide()
end
end
elseif spellID == 164545 then
isSolarEmpowered = true
for j = 1, count do
solarEmpowerments[j]:Show()
end
if count < 3 then
for k = count + 1, 3 do
solarEmpowerments[k]:Hide()
end
end
end
end
if not isLunarEmpowered then
for i = 1, 3 do
lunarEmpowerments[i]:Hide()
end
end
if not isSolarEmpowered then
for i = 1, 3 do
solarEmpowerments[i]:Hide()
end
end
end)
end