After hours of coding, I am more confused than I was to begin with. (Trying to create Warlock Power Bars).
What I wrote for soul shards seems to work:
Lua Code:
UpdateShards = function(self, event, unit, powerType)
if(self.unit ~= unit or (powerType and powerType ~= 'SOUL_SHARDS')) and (GetSpecialization() ~= SPEC_WARLOCK_AFFLICTION) then return end
local maxshards = 3
for i = 1, GetNumGlyphSockets() do
local glyphID = select(4, GetGlyphSocketInfo(i))
if glyphID == 63302 then maxshards = 4 end
local num = UnitPower(unit, SPELL_POWER_SOUL_SHARDS)
for i = 1, maxshards do
if(i <= num) then
self.SoulShards[i]:SetAlpha(1)
else
self.SoulShards[i]:SetAlpha(0)
end
end
end
end
I tried doing the same thing for burning embers, but with no success. Does this function only work because self.SoulShards is predefined in oUF elements? Does this mean I need to write a new element for Embers/Fury/ShadowOrbs/Monks etc?