- extracted some functionality from the lacerate and sunder count modules to IceHUD for determining spell/ability buffs/debuffs on units. also fixed a small 3.0 bug in said modules for determining if the buff/debuff belonged to the player or not

This commit is contained in:
Parnic
2008-10-20 05:02:40 +00:00
parent cc32a46fe1
commit 6786fba204
3 changed files with 28 additions and 50 deletions

View File

@ -561,3 +561,27 @@ function IceHUD:MathRound(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
function IceHUD:GetBuffCount(unit, ability, onlyMine)
return IceHUD:GetAuraCount("HELPFUL"..(onlyMine and "|PLAYER" or ""), unit, ability)
end
function IceHUD:GetDebuffCount(unit, ability, onlyMine)
return IceHUD:GetAuraCount("HARMFUL"..(onlyMine and "|PLAYER" or ""), unit, ability)
end
function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine)
for i = 1, 40 do
local _, _, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or ""))
if not texture then
break
end
if string.match(texture, ability) then
return applications
end
end
return 0
end