mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
- 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:
24
IceHUD.lua
24
IceHUD.lua
@ -561,3 +561,27 @@ function IceHUD:MathRound(num, idp)
|
|||||||
local mult = 10^(idp or 0)
|
local mult = 10^(idp or 0)
|
||||||
return math.floor(num * mult + 0.5) / mult
|
return math.floor(num * mult + 0.5) / mult
|
||||||
end
|
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
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
local AceOO = AceLibrary("AceOO-2.0")
|
local AceOO = AceLibrary("AceOO-2.0")
|
||||||
|
|
||||||
local LacerateCount = AceOO.Class(IceElement)
|
local LacerateCount = AceOO.Class(IceElement)
|
||||||
local MAX_DEBUFF_COUNT = 40
|
|
||||||
|
|
||||||
LacerateCount.prototype.lacerateSize = 20
|
LacerateCount.prototype.lacerateSize = 20
|
||||||
|
|
||||||
@ -84,7 +83,7 @@ function LacerateCount.prototype:GetOptions()
|
|||||||
opts["gradient"] = {
|
opts["gradient"] = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = "Change color",
|
name = "Change color",
|
||||||
desc = "1 compo point: yellow, 5 lacerates: red",
|
desc = "1 lacerate: yellow, 5 lacerates: red",
|
||||||
get = function()
|
get = function()
|
||||||
return self.moduleSettings.gradient
|
return self.moduleSettings.gradient
|
||||||
end,
|
end,
|
||||||
@ -235,30 +234,8 @@ function LacerateCount.prototype:CreateLacerateFrame(doTextureUpdate)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function LacerateCount.prototype:GetDebuffCount(unit, ability, onlyMine)
|
|
||||||
for i = 1, MAX_DEBUFF_COUNT do
|
|
||||||
local name, texture, applications, duration
|
|
||||||
if IceHUD.WowVer >= 30000 then
|
|
||||||
name, _, texture, applications, _, _, duration = UnitDebuff(unit, i)
|
|
||||||
else
|
|
||||||
name, _, texture, applications, _, duration = UnitDebuff(unit, i)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not texture then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
if string.match(texture, ability) and (not onlyMine or duration) then
|
|
||||||
return applications
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function LacerateCount.prototype:UpdateLacerateCount()
|
function LacerateCount.prototype:UpdateLacerateCount()
|
||||||
local points = self:GetDebuffCount("target", "Ability_Druid_Lacerate", true)
|
local points = IceHUD:GetDebuffCount("target", "Ability_Druid_Lacerate", true)
|
||||||
|
|
||||||
if (points == 0) then
|
if (points == 0) then
|
||||||
points = nil
|
points = nil
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
local AceOO = AceLibrary("AceOO-2.0")
|
local AceOO = AceLibrary("AceOO-2.0")
|
||||||
|
|
||||||
local SunderCount = AceOO.Class(IceElement)
|
local SunderCount = AceOO.Class(IceElement)
|
||||||
local MAX_DEBUFF_COUNT = 40
|
|
||||||
|
|
||||||
SunderCount.prototype.sunderSize = 20
|
SunderCount.prototype.sunderSize = 20
|
||||||
|
|
||||||
@ -84,7 +83,7 @@ function SunderCount.prototype:GetOptions()
|
|||||||
opts["gradient"] = {
|
opts["gradient"] = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = "Change color",
|
name = "Change color",
|
||||||
desc = "1 compo point: yellow, 5 sunders: red",
|
desc = "1 sunder: yellow, 5 sunders: red",
|
||||||
get = function()
|
get = function()
|
||||||
return self.moduleSettings.gradient
|
return self.moduleSettings.gradient
|
||||||
end,
|
end,
|
||||||
@ -235,30 +234,8 @@ function SunderCount.prototype:CreateSunderFrame(doTextureUpdate)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function SunderCount.prototype:GetDebuffCount(unit, ability, onlyMine)
|
|
||||||
for i = 1, MAX_DEBUFF_COUNT do
|
|
||||||
local name, texture, applications, duration
|
|
||||||
if IceHUD.WowVer >= 30000 then
|
|
||||||
name, _, texture, applications, _, _, duration = UnitDebuff(unit, i)
|
|
||||||
else
|
|
||||||
name, _, texture, applications, _, duration = UnitDebuff(unit, i)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not texture then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
if string.match(texture, ability) and (not onlyMine or duration) then
|
|
||||||
return applications
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function SunderCount.prototype:UpdateSunderCount()
|
function SunderCount.prototype:UpdateSunderCount()
|
||||||
local points = self:GetDebuffCount("target", "Ability_Warrior_Sunder")
|
local points = IceHUD:GetDebuffCount("target", "Ability_Warrior_Sunder")
|
||||||
|
|
||||||
if (points == 0) then
|
if (points == 0) then
|
||||||
points = nil
|
points = nil
|
||||||
|
Reference in New Issue
Block a user