Hi, I use a druid in World of Warcraft and I use Pitbull 4.0 is there any way for me to put a HoT Counter on my Raid frames, like X-Perl uses or many other addons can count HoTs.
If I'm in the wrong place asking can someone help me find where to ask this please.
local i = 1
local count = 0
local mine = false
while true do
local name, _, _, _, _, _, _, caster = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Renew" then
count = count + 1
if caster == "player" then mine = true end
elseif name == "Rejuvenation" then
count = count + 1
if caster == "player" then mine = true end
elseif name == "Regrowth" then
count = count + 1
if caster == "player" then mine = true end
elseif name == "Lifebloom" then
count = count + 1
if caster == "player" then mine = true end
elseif name == "Wild Growth" then
count = count + 1
if caster == "player" then mine = true end
elseif name == "Earthliving" then
count = count + 1
if caster == "player" then mine = true end
elseif name == "Riptide" then
count = count + 1
if caster == "player" then mine = true end
elseif name == "Gift of the Naaru" then
count = count + 1
if caster == "player" then mine = true end
end
i=i+1
end
if count > 0 then
if mine then return "|cff00ff00%s|r", count else return "|cffff0000%s|r", count end
end
I have tested part of it: it does return HoTs in red when I don't have an active HoT on the player. I haven't tested this luatext on a healer yet, so I don't know if it correctly returns the number of HoTs in green if you have an active HoT on the player. Let me know if it works.
The template should be easy enough for you to tweak if you want to add/remove HoTs, change colors... etc.
Shadoweric's code will produce erroneous results if there's HoT's from multiple sources. Example: If buff 1 is Renew cast by "player" and buff 2 is Regrowth cast by "party1" then the code will return %s, 2. My code, below, will return 1, 1 in the same scenario. Also, it's a lot tidier. :)
local i = 1
local mine, other = 0, 0
while true do
local name, _, _, _, _, _, _, caster = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Renew"
or name == "Rejuvenation"
or name == "Regrowth"
or name == "Lifebloom"
or name == "Wild Growth"
or name == "Earthliving"
or name == "Riptide"
or name == "Gift of the Naaru"
then
if caster == "player" then
mine = mine + 1
else
other = other + 1
end
end
i = i + 1
end
return format("|cff00ff00%s|r", mine), format("|cffff0000%s|r", other)
Your code is tidier, but how is it returning %s in red? The first buff will set mine to true, which only means the color of the text will be green and not red. The count gets updated for every buff it iterates through. mine stays true if it's set once. I'm no lua expert, but I'm missing something.
Your code is tidier, but how is it returning %s in red? The first buff will set mine to true, which only means the color of the text will be green and not red. The count gets updated for every buff it iterates through. mine stays true if it's set once. I'm no lua expert, but I'm missing something.
I simply corrected a mistake that was pointed out over there and fixed this post here which is a little older and previous reply to the same question.
Oh, my bad, it will be green if at least one is player cast; however, it will still count all buffs whether player cast or not. If this is intended (green if at least one buff is player cast?), then I apologize.
Also, your "while true" loop breaks as soon as it finds a debuff or no buff at "i". I forget if debuffs are always last, but UnitAura() will return nil if passed an applied buff/debuff at "i" when it doesn't match the criteria in the third argument.
Yeah it is. I was simply trying to show a count of HoTs and color it accordingly. You took it one step further by splitting them up, which works too. :)
How about this: It makes text look like (2) if target has 1 shield and 1 hot. I might have missed some shield for now, let me know of any...
local i = 1
local mine, other, shield = 0, 0, false
while true do
local name, _, _, _, _, _, _, caster = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Renew"
or name == "Rejuvenation"
or name == "Regrowth"
or name == "Lifebloom"
or name == "Wild Growth"
or name == "Earthliving"
or name == "Riptide"
or name == "Gift of the Naaru"
or name == "Glyph of Prayer of Healing"
then
if caster == "player" then
mine = mine + 1
else
other = other + 1
end
elseif name == "Power Word: Shield"
or name == "Guardian Spirit"
or name == "Divine Aegis"
or name == "Earth Shield"
or name == "Living Seed"
or name == "Sacred Shield"
then
shield = true
if caster == "player" then
mine = mine + 1
else
other = other + 1
end
end
i = i + 1
end
local total = mine + other
if total>0 then
local s = ""
if mine>0 then
s = format("|cff00ff00%s|r", total)
else
s = format("|cffff0000%s|r", total)
end
if shield then
return "|cffffff00(|r%s|cffffff00)|r",s
else
return s
end
end
How about this: It makes text look like (2) if target has 1 shield and 1 hot. I might have missed some shield for now, let me know of any...
Why are you adding to the HoT count when there is a shield? I think adding the parenthesis is enough of an indication. Perhaps you could color the parenthesis in the same way as the HoT count. If it was casted by you, green. If it wasn't cast by you, red.
local i = 1
local mine, other, shield, shieldcolor = 0, 0, false, "ffffff"
while true do
local name, _, _, _, _, _, _, caster = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Renew"
or name == "Rejuvenation"
or name == "Regrowth"
or name == "Lifebloom"
or name == "Wild Growth"
or name == "Earthliving"
or name == "Riptide"
or name == "Gift of the Naaru"
or name == "Glyph of Prayer of Healing"
then
if caster == "player" then
mine = mine + 1
else
other = other + 1
end
elseif name == "Power Word: Shield"
or name == "Guardian Spirit"
or name == "Divine Aegis"
or name == "Earth Shield"
or name == "Living Seed"
or name == "Sacred Shield"
then
if caster == "player" then
shieldcolor = "00ff00"
elseif not shield then
shieldcolor = "ff0000"
end
shield = true
end
i = i + 1
end
local total = mine + other
if total>0 then
local s = ""
if mine>0 then
s = format("|cff00ff00%s|r", total)
else
s = format("|cffff0000%s|r", total)
end
if shield then
return "|cff%s(|r%s|cff%s)|r", shieldcolor,s,shieldcolor
else
return s
end
end
My code colors shield always yellow and the hot based on if i have any heal or shield on target green, otherwise red. I have found it useful knowing how many heal effects target has, it works awesome in raid frames.
Your code would only color based on last shield buff in the list - not working properly. Quick fix to that by sorting the if's:
if caster == "player" then
shieldcolor = "00ff00"
elseif shield=false then
shieldcolor = "ff0000"
end
shield = true
Combined the 2 ideas (colored shield) and added Prayer of Mending. Makes yellow total number when there's only shields. There is also paladin buff called Flash of Light but don't know if it's worth mentioning being a small after-hot of a fast cast spell.
Edit: Removing Gift of Naaru and Prayer of Healing from my use, they are also minor effects.
Do you think this is too slow for 25 man raid frames?
local i = 1
local mine,other,shields,shieldcolor = 0, 0, 0, "00ff00"
while true do
local name, _, _, _, _, _, _, caster = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Renew"
or name == "Rejuvenation"
or name == "Regrowth"
or name == "Lifebloom"
or name == "Wild Growth"
or name == "Earthliving"
or name == "Riptide"
or name == "Gift of the Naaru"
or name == "Glyph of Prayer of Healing"
then
if caster == "player" then
mine = mine+1
else
other = other+1
end
elseif name == "Power Word: Shield"
or name == "Guardian Spirit"
or name == "Divine Aegis"
or name == "Earth Shield"
or name == "Living Seed"
or name == "Sacred Shield"
or name == "Prayer of Mending"
then
if caster == "player" then
shieldcolor = "00ff00"
elseif shields == 0 then
shieldcolor = "ff0000"
end
shields = shields+1
end
i = i + 1
end
local total = mine+other+shields
if total>0 then
local s = ""
if mine>0 then
s = format("|cff00ff00%s|r",total)
elseif other>0 then
s = format("|cffff0000%s|r",total)
else
s = format("|cffffff00%s|r",total)
end
if shields>0 then
return "|cff%s(|r%s|cff%s)|r",shieldcolor,s,shieldcolor
else
return s
end
end
Oh, and to see any effect to it with Pitbull 4 you have to enable Event "UNIT_AURA" for this text.
If I'm in the wrong place asking can someone help me find where to ask this please.
Thank You
I have tested part of it: it does return HoTs in red when I don't have an active HoT on the player. I haven't tested this luatext on a healer yet, so I don't know if it correctly returns the number of HoTs in green if you have an active HoT on the player. Let me know if it works.
The template should be easy enough for you to tweak if you want to add/remove HoTs, change colors... etc.
Also it's reported as working in the luatext thread here: http://forums.wowace.com/showpost.php?p=291459&postcount=472
I simply corrected a mistake that was pointed out over there and fixed this post here which is a little older and previous reply to the same question.
Also, your "while true" loop breaks as soon as it finds a debuff or no buff at "i". I forget if debuffs are always last, but UnitAura() will return nil if passed an applied buff/debuff at "i" when it doesn't match the criteria in the third argument.
Why are you adding to the HoT count when there is a shield? I think adding the parenthesis is enough of an indication. Perhaps you could color the parenthesis in the same way as the HoT count. If it was casted by you, green. If it wasn't cast by you, red.
Your code would only color based on last shield buff in the list - not working properly. Quick fix to that by sorting the if's:
Edit: Removing Gift of Naaru and Prayer of Healing from my use, they are also minor effects.
Do you think this is too slow for 25 man raid frames?
Oh, and to see any effect to it with Pitbull 4 you have to enable Event "UNIT_AURA" for this text.