lastAuraIndex = lastAuraIndex + 1 |
-- Is all this info really necessary? |
if(auras[lastAuraIndex] == nil) then auras[lastAuraIndex] = {} end |
auras[lastAuraIndex].name = name |
auras[lastAuraIndex].rank = rank |
auras[lastAuraIndex].icon = icon |
auras[lastAuraIndex].count = count |
auras[lastAuraIndex].debuffType = debuffType |
auras[lastAuraIndex].duration = duration |
auras[lastAuraIndex].expirationTime = expirationTime |
auras[lastAuraIndex].unitCaster = unitCaster |
auras[lastAuraIndex].isStealable = isStealable |
auras[lastAuraIndex].noTime = ( duration == 0 and expirationTime == 0) |
end |
auras[lastAuraIndex].name = name |
auras[lastAuraIndex].rank = rank |
auras[lastAuraIndex].icon = icon |
auras[lastAuraIndex].count = count |
auras[lastAuraIndex].debuffType = debuffType |
auras[lastAuraIndex].duration = duration |
auras[lastAuraIndex].expirationTime = expirationTime |
auras[lastAuraIndex].unitCaster = unitCaster |
auras[lastAuraIndex].isStealable = isStealable |
auras[lastAuraIndex].noTime = ( duration == 0 and expirationTime == 0) |
end |
end |
|
-- Show and configure bars for buffs/debuffs. |
local bars = self.AuraBars.bars |
for index = 1 , lastAuraIndex do |
local aura = auras[index] |
local bar = bars[index] |
-- Show and configure bars for buffs/debuffs. |
local bars = self.AuraBars.bars |
for index = 1 , lastAuraIndex do |
local aura = auras[index] |
local bar = bars[index] |
|
if(bar == nil) and (index == 1) then |
bar = CreateAuraBar(self,self.AuraBars) -- Relative to anchor |
bars[index] = bar |
elseif(bar == nil) then |
bar = CreateAuraBar(self,bars[index - 1]) -- Relative to previous bar |
bars[index] = bar |
end |
if(bar == nil) and (index == 1) then |
bar = CreateAuraBar(self,self.AuraBars) -- Relative to anchor |
bars[index] = bar |
elseif(bar == nil) then |
bar = CreateAuraBar(self,bars[index - 1]) -- Relative to previous bar |
bars[index] = bar |
end |
|
-- Backup the details of the aura onto the bar, so the OnUpdate function can use it |
bar.aura = aura |
-- Backup the details of the aura onto the bar, so the OnUpdate function can use it |
bar.aura = aura |
|
-- Configure |
if bar.aura.noTime then |
bar:SetMinMaxValues(0, 1) |
bar:SetValue(1) |
-- Configure |
if bar.aura.noTime then |
bar:SetMinMaxValues(0, 1) |
bar:SetValue(1) |
else |
if self.AuraBars.scaleTime then |
local maxvalue = math.min(self.AuraBars.scaleTime, bar.aura.duration) |
bar:SetMinMaxValues(0, maxvalue) |
bar:SetWidth( |
( maxvalue / self.AuraBars.scaleTime ) * |
( ( self.AuraBars.auraBarWidth or self.AuraBars:GetWidth() ) - |
( bar:GetHeight() + self.AuraBars.gap or 0 ) ) ) -- icon size + gap |
else |
if self.AuraBars.scaleTime then |
local maxvalue = math.min(self.AuraBars.scaleTime, bar.aura.duration) |
bar:SetMinMaxValues(0, maxvalue) |
bar:SetWidth( |
( maxvalue / self.AuraBars.scaleTime ) * |
( ( self.AuraBars.auraBarWidth or self.AuraBars:GetWidth() ) - |
( bar:GetHeight() + self.AuraBars.gap or 0 ) ) ) -- icon size + gap |
else |
bar:SetMinMaxValues(0, bar.aura.duration) |
end |
bar:SetValue(bar.aura.expirationTime - GetTime()) |
bar:SetMinMaxValues(0, bar.aura.duration) |
end |
bar:SetValue(bar.aura.expirationTime - GetTime()) |
end |
|
bar.icon:SetTexture(bar.aura.icon) |
bar.icon:SetTexture(bar.aura.icon) |
|
local spellText |
if(bar.aura.count > 1) then |
spellText = string.format("%s [%d]", ShortenedSpellName(aura.name,20), bar.aura.count) |
else |
spellText = ShortenedSpellName(bar.aura.name,20) |
end |
local spellText |
if(bar.aura.count > 1) then |
spellText = string.format("%s [%d]", ShortenedSpellName(aura.name,20), bar.aura.count) |
else |
spellText = ShortenedSpellName(bar.aura.name,20) |
end |
|
bar.spellname:SetText(spellText) |
bar.spelltime:SetText(FormatTime(bar.aura.expirationTime-GetTime())) |
bar.spellname:SetText(spellText) |
bar.spelltime:SetText(FormatTime(bar.aura.expirationTime-GetTime())) |
|
-- Colour bars |
local r, g, b = 0.2, 0.6, 1.0 -- Colour for buffs (This is Magic Blue) |
local bgMod = 0.5 |
if(helpOrHarm == "HARMFUL") then |
local debuffType = bar.aura.debuffType and bar.aura.debuffType or "none" |
r, g, b = DebuffTypeColor[debuffType].r, DebuffTypeColor[debuffType].g, DebuffTypeColor[debuffType].b |
end |
bar:SetStatusBarColor(r, g, b) |
bar.bg:SetVertexColor(r * bgMod, g * bgMod, b * bgMod) |
bar:Show() |
-- Colour bars |
local r, g, b = 0.2, 0.6, 1.0 -- Colour for buffs (This is Magic Blue) |
local bgMod = 0.5 |
if(helpOrHarm == "HARMFUL") then |
local debuffType = bar.aura.debuffType and bar.aura.debuffType or "none" |
r, g, b = DebuffTypeColor[debuffType].r, DebuffTypeColor[debuffType].g, DebuffTypeColor[debuffType].b |
end |
bar:SetStatusBarColor(r, g, b) |
bar.bg:SetVertexColor(r * bgMod, g * bgMod, b * bgMod) |
bar:Show() |
end |
|
-- Hide unused bars. |
for index = lastAuraIndex + 1, #(bars) do |
bars[index]:Hide() |
end |
-- Hide unused bars. |
for index = lastAuraIndex + 1, #(bars) do |
bars[index]:Hide() |
end |
end |
|
--[[ |