if(self.RuneBar.PostUpdate) then self.RuneBar:PostUpdate(event, rune, usable) end |
end |
|
local function Update(self, event, rune) |
local runebar = self.RuneBar |
if(#runebar == 0) then |
local function Update(self) |
local bar = self.RuneBar |
if(#bar == 0) then |
local text = '' |
for i = 1, 6 do |
local start, duration, ready = GetRuneCooldown(i) |
local r, g, b = unpack(runebar.colors[GetRuneType(i)]) |
local r, g, b = unpack(bar.colors[GetRuneType(i)]) |
|
text = format('%s|cff%02x%02x%02x%s%s|r', text, r * 255, g * 255, b * 255, ready and (runebar.symbol or '*') or floor(duration - floor(GetTime() - start)), i ~= 6 and (runebar.space or ' ') or '') |
text = format('%s|cff%02x%02x%02x%s%s|r', text, r * 255, g * 255, b * 255, ready and (bar.symbol or '*') or floor(duration - floor(GetTime() - start)), i ~= 6 and (bar.space or ' ') or '') |
end |
|
runebar:SetText(text) |
bar:SetText(text) |
else |
for i = 1, 6 do |
local runetype = GetRuneType(i) |
if(runetype) then |
runebar[i]:SetStatusBarColor(unpack(runebar.colors[runetype])) |
bar[i]:SetStatusBarColor(unpack(bar.colors[runetype])) |
end |
end |
end |
end |
|
local function Enable(self, unit) |
local runebar = self.RuneBar |
if(runebar and unit == 'player' and class == 'DEATHKNIGHT') then |
runebar.colors = self.colors.runes or colors |
local bar = self.RuneBar |
if(bar and unit == 'player' and select(2, UnitClass('player')) == 'DEATHKNIGHT') then |
local c = self.colors.runes or {} |
bar.colors = {c[1] or {0.77, 0.12, 0.23}, c[2] or {0.3, 0.8, 0.1}, c[3] or {0, 0.4, 0.7}, c[4] or {0.8, 0.8, 0.8}} |
|
self:RegisterEvent('RUNE_TYPE_UPDATE', Update) |
self:RegisterEvent('RUNE_POWER_UPDATE', #runebar == 0 and Update or UpdateStatusBar) |
self:RegisterEvent('RUNE_POWER_UPDATE', #bar == 0 and Update or UpdateStatusBar) |
|
if(#runebar == 0) then |
dummy:SetScript('OnUpdate', function(s, e) OnUpdateText(self, e) end) |
if(#bar == 0) then |
CreateFrame('Frame'):SetScript('OnUpdate', function(_, elapsed) OnUpdateText(self, elapsed) end) |
end |
|
RuneFrame:Hide() |