Originally Posted by kawe
i meant colored by "buff type" (my own aura bars/buffs, not the targets) for ex. renew > green, barkskin > yellow etc. Something like this;
|
Well, without knowing what variables are declared in the scope where that code is running, I can't write the whole thing for you, but to give you the general idea, put something like this at the top of the file:
Code:
local colors = {
GREEN = { r = 0, g = 0.82, b = 0 },
YELLOW = { r = 1, g = 0.82, b = 0 },
-- add more colors here
}
local spellColors = {
[ 139] = GREEN, -- Renew
[22812] = YELLOW, -- Barkskin
-- add more spells here
}
(It's not strictly necessary to define the colors separately, but it'll make it easier to maintain once you have a lot of spells listed, and will save a bit of memory since you'll only be defining each color table once instead of 40 times if you have 40 green spells, for example.)
Then in the part you were working with earlier, add something like the part in green:
Code:
if(reaction == 'HARMFUL') then
if(cfg.BarTimers_Color_by_Debuff) then
local debufftype = bar.timer.debuffType
local color = DebuffTypeColor[debufftype] or DebuffTypeColor.none
bar:SetStatusBarColor(color.r, color.g, color.b)
bar.spark:SetVertexColor(color.r, color.g, color.b)
else
bar:SetStatusBarColor(1, 0, 0)
bar.spark:SetVertexColor(1, 0, 0)
end
else
local color = (unit == 'player') and spellColors[spellID]
if color then
bar:SetStatusBarColor(color.r, color.g, color.b)
bar.spark:SetVertexColor(color.r, color.g, color.b)
else
bar:SetStatusBarColor(0.15, 0.35, 0.55)
bar.spark:SetVertexColor(0.15, 0.35, 0.55)
end
end
bar:Show()
You'd need to change the "unit" and "spellID" variables according to whatever's being used in your existing code.