Originally Posted by Katae
Sorry, didn't see your post till now.
Here's a quick buff check that will watch a specific buff and tell you if it's down. As a bonus, I added a 10 second countdown for when it's falling off.
Code:
{ name = "WatchBuff",
anchor_to = "CENTER", anchor_from = "CENTER", y_off = 300,
text = {
string = function()
local buff = "Inner Fire" -- name of watched buff
local aura, time_left = UnitAura("player", buff)
if aura then
time_left = floor(select(7, UnitAura("player", buff)) - GetTime())
if time_left <= 10 and time_left > 0 then
return format("%s is down in %s seconds", buff, time_left)
end
end
if not aura or time_left <= 0 then
return buff.." is down."
end
end,
size = 10, color = "1 0.75 0", outline = 2,
}
}
|
Thank you
Works great.
I wanted to add to that to make it much more similar to power auras.
I first added a box with a background around the text (anchored to the WatchBuff frame)
then I added a texture. I first noticed when I buffed myself, the textures wouldn't go disappear.
I then looked at the AFK timer to see how you made the box disappear, you used this
Code:
self:RegisterEvent("PLAYER_FLAGS_CHANGED")
I tried that. It would only update everytime I change my afk tag. (I'm a n00b at coding, I just test things to see how they work first). So I tried something from Wowwiki's page...
instead of
PLAYER_FLAGS_CHANGED
I tried
COMBAT_LOG_EVENT
That worked for buffing myself but didn't work so well when I right clicked the buff off, as no combat log event occured during that time.
I tried
PLAYER_AURAS_CHANGED
Seems to be a broken function, unless it perhaps it means like a paladin aura or something.
How would I set it up to be like the afk set up?
You are afk --> box shows
You are not afk --> box disappears
You are unbuffed --> box shows
You are not unbuffed (or you are buffed) --> box disappears
Below is the code I have so far...
Code:
{ name = "WatchBuff",
anchor_to = "CENTER", anchor_from = "CENTER", y_off = 300,
text = {
string = function()
local buff = "Mark of the Wild" -- name of watched buff
local aura, time_left = UnitAura("player", buff)
if aura then
time_left = floor(select(7, UnitAura("player", buff)) - GetTime())
if time_left <= 10 and time_left > 0 then
return format("%s is down in %s seconds", buff, time_left)
end
end
if not aura or time_left <= 0 then
return "Mark of the Wild is down."
end
end,
size = 10, color = {1, 0.75, 0}, outline = 2,level=1, update=0.1,
},
OnLoad = function(self)
self:RegisterEvent("COMBAT_LOG_EVENT")
self:Hide()
end,
OnEvent = function(self)
local buff = "Mark of the Wild" -- name of watched buff
local aura, time_left = UnitAura("player", buff)
if not aura then
self:Show()
elseif aura then
self:Hide()
end
end,
},
{ parent="WatchBuff",y_off = 5,anchor_to="TOP",width="152",height=1,bg_color={1,1,0} },
{ parent="WatchBuff",y_off = -5,anchor_to="BOTTOM",width="152",height=1,bg_color={1,1,0} },
{ parent="WatchBuff",x_off = -5,anchor_to="LEFT",width=1,height="20",bg_color={1,1,0} },
{ parent="WatchBuff",x_off = 5,anchor_to="RIGHT",width=1,height="20",bg_color={1,1,0} },
{ parent="WatchBuff",anchor_to="CENTER",width=150,height="18",bg_color={0,0,0},bg_alpha = 0.50,level=0},
{ name="Art_L", parent="WatchBuff",anchor_to="LEFT",y_off=-200, height="500",
tex_file="Interface\\AddOns\\PowerAuras\\Aura5", width="500" },
Hope everyone had a merry christmas