mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- adding 4 new modules care of Antumbra of Lothar server. Huge thanks to him for writing these!
This commit is contained in:
@ -39,3 +39,7 @@ modules\CastBar.lua
|
||||
modules\TargetCast.lua
|
||||
modules\MirrorBar.lua
|
||||
modules\SunderCount.lua
|
||||
modules\GlobalCoolDown.lua
|
||||
modules\SliceAndDice.lua
|
||||
modules\TargetCC.lua
|
||||
modules\FocusCC.lua
|
||||
|
175
modules/FocusCC.lua
Normal file
175
modules/FocusCC.lua
Normal file
@ -0,0 +1,175 @@
|
||||
local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local FocusCC = AceOO.Class(IceUnitBar)
|
||||
|
||||
-- Constructor --
|
||||
function FocusCC.prototype:init()
|
||||
FocusCC.super.prototype.init(self, "FocusCC", "focus")
|
||||
|
||||
self.unit = "focus"
|
||||
|
||||
self.moduleSettings = {}
|
||||
self.moduleSettings.desiredLerpTime = 0
|
||||
-- self.moduleSettings.shouldAnimate = false
|
||||
|
||||
self:SetDefaultColor("CC:Stun", 0.85, 0.55, 0.2)
|
||||
self:SetDefaultColor("CC:Incapacitate", 0.90, 0.6, 0.2)
|
||||
self:SetDefaultColor("CC:Fear", 0.85, 0.2, 0.65)
|
||||
|
||||
self.debuffList = {}
|
||||
self.debuffList["Kidney Shot"] = "Stun"
|
||||
self.debuffList["Cheap Shot"] = "Stun"
|
||||
self.debuffList["Mace Stun Effect"] = "Stun"
|
||||
self.debuffList["Shadowfury"] = "Stun"
|
||||
self.debuffList["Hammer of Justice"] = "Stun"
|
||||
self.debuffList["Impact"] = "Stun"
|
||||
self.debuffList["Blackout"] = "Stun"
|
||||
self.debuffList["Intimidation"] = "Stun"
|
||||
self.debuffList["Charge Stun"] = "Stun"
|
||||
self.debuffList["Intercept Stun"] = "Stun"
|
||||
self.debuffList["Revenge Stun"] = "Stun"
|
||||
self.debuffList["Concussion Blow"] = "Stun"
|
||||
self.debuffList["Bash"] = "Stun"
|
||||
self.debuffList["Pounce"] = "Stun"
|
||||
self.debuffList["Improved Concussive Shot"] = "Stun"
|
||||
self.debuffList["Starfire Stun"] = "Stun"
|
||||
self.debuffList["War Stomp"] = "Stun"
|
||||
|
||||
self.debuffList["Repentance"] = "Incapacitate"
|
||||
self.debuffList["Sap"] = "Incapacitate"
|
||||
self.debuffList["Gouge"] = "Incapacitate"
|
||||
self.debuffList["Blind"] = "Incapacitate"
|
||||
self.debuffList["Wyvern Sting"] = "Incapacitate"
|
||||
self.debuffList["Scatter Shot"] = "Incapacitate"
|
||||
self.debuffList["Sleep"] = "Incapacitate"
|
||||
self.debuffList["Polymorph"] = "Incapacitate"
|
||||
self.debuffList["Polymorph: Pig"] = "Incapacitate"
|
||||
self.debuffList["Polymorph: Turtle"] = "Incapacitate"
|
||||
self.debuffList["Hibernate"] = "Incapacitate"
|
||||
self.debuffList["Freezing Trap Effect"] = "Incapacitate"
|
||||
self.debuffList["Chastize"] = "Incapacitate"
|
||||
self.debuffList["Maim"] = "Incapacitate"
|
||||
|
||||
self.debuffList["Psychic Scream"] = "Fear"
|
||||
self.debuffList["Fear"] = "Fear"
|
||||
self.debuffList["Howl of Terror"] = "Fear"
|
||||
|
||||
self.previousDebuff = nil
|
||||
self.previousDebuffTarget = nil
|
||||
self.previousDebuffTime = nil
|
||||
end
|
||||
|
||||
-- 'Public' methods -----------------------------------------------------------
|
||||
|
||||
-- OVERRIDE
|
||||
function FocusCC.prototype:Enable(core)
|
||||
FocusCC.super.prototype.Enable(self, core)
|
||||
|
||||
self:RegisterEvent("UNIT_AURA", "UpdateFocusDebuffs")
|
||||
|
||||
self:ScheduleRepeatingEvent(self.elementName, self.UpdateFocusDebuffs, 0.1, self)
|
||||
|
||||
self:Show(false)
|
||||
end
|
||||
|
||||
-- OVERRIDE
|
||||
function FocusCC.prototype:GetDefaultSettings()
|
||||
local settings = FocusCC.super.prototype.GetDefaultSettings(self)
|
||||
|
||||
settings["enabled"] = false
|
||||
settings["shouldAnimate"] = false
|
||||
settings["desiredLerpTime"] = nil
|
||||
settings["lowThreshold"] = 0
|
||||
settings["side"] = IceCore.Side.Left
|
||||
settings["offset"] = 4
|
||||
|
||||
return settings
|
||||
end
|
||||
|
||||
function FocusCC.prototype:Disable(core)
|
||||
FocusCC.super.prototype.Disable(self, core)
|
||||
|
||||
self:CancelScheduledEvent(self.elementName)
|
||||
end
|
||||
|
||||
-- OVERRIDE
|
||||
function FocusCC.prototype:GetOptions()
|
||||
local opts = FocusCC.super.prototype.GetOptions(self)
|
||||
|
||||
opts["shouldAnimate"] = nil
|
||||
opts["desiredLerpTime"] = nil
|
||||
opts["lowThreshold"] = nil
|
||||
opts["textSettings"].args["upperTextString"] = nil
|
||||
opts["textSettings"].args["lowerTextString"] = nil
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
-- 'Protected' methods --------------------------------------------------------
|
||||
|
||||
function _GetMaxDebuffDuration(unitName, debuffNames)
|
||||
local i = 1
|
||||
local debuff, rank, texture, count, debuffType, duration, remaining = UnitDebuff(unitName, i)
|
||||
local result = {nil, nil, nil}
|
||||
|
||||
while debuff do
|
||||
if debuffNames[debuff] then
|
||||
if result[0] then
|
||||
if result[2] < remaining then
|
||||
result = {debuff, duration, remaining}
|
||||
end
|
||||
else
|
||||
result = {debuff, duration, remaining}
|
||||
end
|
||||
end
|
||||
|
||||
i = i + 1;
|
||||
|
||||
debuff, rank, texture, count, debuffType, duration, remaining = UnitDebuff(unitName, i)
|
||||
end
|
||||
|
||||
return unpack(result)
|
||||
end
|
||||
|
||||
function FocusCC.prototype:UpdateFocusDebuffs()
|
||||
local name, duration, remaining = _GetMaxDebuffDuration(self.unit, self.debuffList)
|
||||
local focusName = UnitName(self.unit)
|
||||
|
||||
if (name ~= nil) and (self.previousDebuff == nil) and (duration ~= nil) and (remaining ~= nil) then
|
||||
self.previousDebuff = name
|
||||
self.previousDebuffTarget = focusName
|
||||
self.previousDebuffTime = GetTime() + duration
|
||||
|
||||
-- Parnic: Force the CurrScale to 1 so that the lerping doesn't make it animate up and back down
|
||||
self.CurrScale = 1.0
|
||||
elseif (self.previousDebuff ~= nil) then
|
||||
if (focusName ~= self.previousDebuffTarget) then
|
||||
self.previousDebuff = nil
|
||||
self.previousDebuffTarget = nil
|
||||
self.previousDebuffTime = nil
|
||||
elseif (GetTime() > self.previousDebuffTime) then
|
||||
self.previousDebuff = nil
|
||||
self.previousDebuffTarget = nil
|
||||
self.previousDebuffTime = nil
|
||||
end
|
||||
end
|
||||
|
||||
if (name ~= nil) then
|
||||
self:Show(true)
|
||||
|
||||
if (duration ~= nil) then
|
||||
self:UpdateBar(remaining / duration, "CC:" .. self.debuffList[name])
|
||||
self:SetBottomText2(floor(remaining * 10) / 10)
|
||||
else
|
||||
self:UpdateBar(0, "CC:" .. self.debuffList[name])
|
||||
self:SetBottomText2("")
|
||||
end
|
||||
|
||||
self:SetBottomText1(name)
|
||||
elseif not IceHUD.IceCore:IsInConfigMode() then
|
||||
self:Show(false)
|
||||
end
|
||||
end
|
||||
|
||||
-- Load us up
|
||||
IceHUD.FocusCC = FocusCC:new()
|
151
modules/GlobalCoolDown.lua
Normal file
151
modules/GlobalCoolDown.lua
Normal file
@ -0,0 +1,151 @@
|
||||
local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local GlobalCoolDown = AceOO.Class(IceBarElement)
|
||||
|
||||
-- Constructor --
|
||||
function GlobalCoolDown.prototype:init()
|
||||
GlobalCoolDown.super.prototype.init(self, "GlobalCoolDown", "player")
|
||||
|
||||
self.moduleSettings = {}
|
||||
self.moduleSettings.barVisible = {bar = true, bg = false}
|
||||
self.moduleSettings.desiredLerpTime = 0
|
||||
self.moduleSettings.shouldAnimate = false
|
||||
|
||||
self.unit = "player"
|
||||
self.startTime = nil
|
||||
self.duration = nil
|
||||
self.spellId = _FindSpellId(self:GetSpellName())
|
||||
|
||||
self:SetDefaultColor("GlobalCoolDown", 0.1, 0.1, 0.1)
|
||||
end
|
||||
|
||||
-- 'Public' methods -----------------------------------------------------------
|
||||
|
||||
-- OVERRIDE
|
||||
function GlobalCoolDown.prototype:Enable(core)
|
||||
GlobalCoolDown.super.prototype.Enable(self, core)
|
||||
|
||||
self:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN", "CooldownStateChanged")
|
||||
|
||||
self:ScheduleRepeatingEvent(self.elementName, self.UpdateGlobalCoolDown, 0.05, self)
|
||||
|
||||
self:Show(false)
|
||||
end
|
||||
|
||||
function GlobalCoolDown.prototype:Disable(core)
|
||||
GlobalCoolDown.super.prototype.Disable(self, core)
|
||||
|
||||
self:CancelScheduledEvent(self.elementName)
|
||||
end
|
||||
|
||||
function GlobalCoolDown.prototype:GetSpellName()
|
||||
local defaultSpells = {
|
||||
ROGUE="Cheap Shot",
|
||||
PRIEST="Renew",
|
||||
DRUID="Rejuvenation",
|
||||
WARRIOR="Battle Shout",
|
||||
MAGE="Frost Armor",
|
||||
WARLOCK="Life Tap",
|
||||
PALADIN="Purify",
|
||||
SHAMAN="Lightning Shield",
|
||||
HUNTER="Serpent Sting"
|
||||
}
|
||||
local _, unitClass = UnitClass("player")
|
||||
return defaultSpells[unitClass]
|
||||
end
|
||||
|
||||
-- OVERRIDE
|
||||
function GlobalCoolDown.prototype:GetDefaultSettings()
|
||||
local settings = GlobalCoolDown.super.prototype.GetDefaultSettings(self)
|
||||
|
||||
settings["enabled"] = false
|
||||
settings["side"] = IceCore.Side.Right
|
||||
settings["offset"] = 1
|
||||
settings["shouldAnimate"] = false
|
||||
settings["desiredLerpTime"] = nil
|
||||
settings["lowThreshold"] = 0
|
||||
settings["barVisible"]["bg"] = false
|
||||
|
||||
return settings
|
||||
end
|
||||
|
||||
-- OVERRIDE
|
||||
function GlobalCoolDown.prototype:GetOptions()
|
||||
local opts = GlobalCoolDown.super.prototype.GetOptions(self)
|
||||
|
||||
opts["shouldAnimate"] = nil
|
||||
opts["desiredLerpTime"] = nil
|
||||
opts["lowThreshold"] = nil
|
||||
opts["textSettings"] = nil
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
-- 'Protected' methods --------------------------------------------------------
|
||||
|
||||
function _FindSpellId(spellName)
|
||||
for tab = 1, 4 do
|
||||
local _, _, offset, numSpells = GetSpellTabInfo(tab)
|
||||
|
||||
for i = (1+offset), (offset+numSpells) do
|
||||
local spell = GetSpellName(i, BOOKTYPE_SPELL)
|
||||
|
||||
if spell:lower() == spellName:lower() then
|
||||
return i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
function GlobalCoolDown.prototype:UpdateSpell()
|
||||
if not self.spellId then
|
||||
self.spellId = _FindSpellId(self:GetSpellName())
|
||||
end
|
||||
end
|
||||
|
||||
function GlobalCoolDown.prototype:CooldownStateChanged()
|
||||
self:UpdateSpell()
|
||||
|
||||
if not self.spellId then
|
||||
return
|
||||
end
|
||||
|
||||
local start, dur = GetSpellCooldown(self.spellId, BOOKTYPE_SPELL)
|
||||
|
||||
if dur > 0 and dur <= 1 then
|
||||
self.startTime = start
|
||||
self.duration = dur
|
||||
|
||||
self.CurrScale = 1
|
||||
self.frame:SetFrameStrata("TOOLTIP")
|
||||
self:Show(true)
|
||||
self.frame.bg:SetAlpha(0)
|
||||
else
|
||||
self.duration = nil
|
||||
self.startTime = nil
|
||||
|
||||
self:Show(false)
|
||||
end
|
||||
end
|
||||
|
||||
function GlobalCoolDown.prototype:UpdateGlobalCoolDown()
|
||||
if (self.duration ~= nil) and (self.startTime ~= nil) then
|
||||
remaining = GetTime() - self.startTime
|
||||
|
||||
if (remaining > self.duration) then
|
||||
self.duration = nil
|
||||
self.startTime = nil
|
||||
|
||||
self:Show(false)
|
||||
else
|
||||
self:UpdateBar(1 - (remaining / self.duration), "GlobalCoolDown", 0.8)
|
||||
end
|
||||
else
|
||||
self:Show(false)
|
||||
end
|
||||
end
|
||||
|
||||
-- Load us up
|
||||
IceHUD.GlobalCoolDown = GlobalCoolDown:new()
|
101
modules/SliceAndDice.lua
Normal file
101
modules/SliceAndDice.lua
Normal file
@ -0,0 +1,101 @@
|
||||
local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local SliceAndDice = AceOO.Class(IceUnitBar)
|
||||
|
||||
-- Constructor --
|
||||
function SliceAndDice.prototype:init()
|
||||
SliceAndDice.super.prototype.init(self, "SliceAndDice", "player")
|
||||
|
||||
self.moduleSettings = {}
|
||||
self.moduleSettings.desiredLerpTime = 0
|
||||
self.moduleSettings.shouldAnimate = false
|
||||
|
||||
self:SetDefaultColor("SliceAndDice", 0.75, 1, 0.2)
|
||||
end
|
||||
|
||||
-- 'Public' methods -----------------------------------------------------------
|
||||
|
||||
-- OVERRIDE
|
||||
function SliceAndDice.prototype:Enable(core)
|
||||
SliceAndDice.super.prototype.Enable(self, core)
|
||||
|
||||
self:RegisterEvent("PLAYER_AURAS_CHANGED", "UpdateSliceAndDice")
|
||||
|
||||
self:ScheduleRepeatingEvent(self.elementName, self.UpdateSliceAndDice, 0.1, self)
|
||||
|
||||
self:Show(false)
|
||||
end
|
||||
|
||||
function SliceAndDice.prototype:Disable(core)
|
||||
SliceAndDice.super.prototype.Disable(self, core)
|
||||
|
||||
self:CancelScheduledEvent(self.elementName)
|
||||
end
|
||||
|
||||
-- OVERRIDE
|
||||
function SliceAndDice.prototype:GetDefaultSettings()
|
||||
local settings = SliceAndDice.super.prototype.GetDefaultSettings(self)
|
||||
|
||||
settings["enabled"] = false
|
||||
settings["shouldAnimate"] = false
|
||||
settings["desiredLerpTime"] = nil
|
||||
settings["lowThreshold"] = 0
|
||||
settings["side"] = IceCore.Side.Right
|
||||
settings["offset"] = 4
|
||||
settings["upperText"]="SnD:#"
|
||||
|
||||
return settings
|
||||
end
|
||||
|
||||
-- OVERRIDE
|
||||
function SliceAndDice.prototype:GetOptions()
|
||||
local opts = SliceAndDice.super.prototype.GetOptions(self)
|
||||
|
||||
opts["shouldAnimate"] = nil
|
||||
opts["desiredLerpTime"] = nil
|
||||
opts["lowThreshold"] = nil
|
||||
opts["textSettings"].args["lowerTextString"] = nil
|
||||
opts["textSettings"].args["lowerTextVisible"] = nil
|
||||
opts["textSettings"].args["upperTextString"]["desc"] = "The text to display under this bar. # will be replaced with the number of Slice and Dice seconds remaining."
|
||||
opts["textSettings"].args["lockLowerFontAlpha"] = nil
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
-- 'Protected' methods --------------------------------------------------------
|
||||
|
||||
function _GetBuffDuration(unitName, buffName)
|
||||
local i = 1
|
||||
local buff, rank, texture, count, duration, remaining = UnitBuff(unitName, i)
|
||||
|
||||
while buff do
|
||||
if (buff == buffName) then
|
||||
return duration, remaining
|
||||
end
|
||||
|
||||
i = i + 1;
|
||||
|
||||
buff, rank, texture, count, duration, remaining = UnitBuff(unitName, i)
|
||||
end
|
||||
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
function SliceAndDice.prototype:UpdateSliceAndDice()
|
||||
local duration, remaining = _GetBuffDuration("player", "Slice and Dice")
|
||||
|
||||
if (duration ~= nil) and (remaining ~= nil) then
|
||||
self:Show(true)
|
||||
self:UpdateBar(remaining / duration, "SliceAndDice")
|
||||
formatString = self.moduleSettings.upperText or ''
|
||||
self:SetBottomText1(string.gsub(formatString, "#", tostring(floor(remaining))))
|
||||
else
|
||||
self:Show(false)
|
||||
end
|
||||
end
|
||||
|
||||
local _, unitClass = UnitClass("player")
|
||||
-- Load us up
|
||||
if unitClass == "ROGUE" then
|
||||
IceHUD.SliceAndDice = SliceAndDice:new()
|
||||
end
|
193
modules/TargetCC.lua
Normal file
193
modules/TargetCC.lua
Normal file
@ -0,0 +1,193 @@
|
||||
local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local TargetCC = AceOO.Class(IceUnitBar)
|
||||
|
||||
-- Constructor --
|
||||
function TargetCC.prototype:init()
|
||||
TargetCC.super.prototype.init(self, "TargetCC", "target")
|
||||
|
||||
self.unit = "target"
|
||||
|
||||
self.moduleSettings = {}
|
||||
self.moduleSettings.desiredLerpTime = 0
|
||||
-- self.moduleSettings.shouldAnimate = false
|
||||
|
||||
self:SetDefaultColor("CC:Stun", 0.85, 0.55, 0.2)
|
||||
self:SetDefaultColor("CC:Incapacitate", 0.90, 0.6, 0.2)
|
||||
self:SetDefaultColor("CC:Fear", 0.85, 0.2, 0.65)
|
||||
|
||||
self.debuffList = {}
|
||||
self.debuffList["Kidney Shot"] = "Stun"
|
||||
self.debuffList["Cheap Shot"] = "Stun"
|
||||
self.debuffList["Mace Stun Effect"] = "Stun"
|
||||
self.debuffList["Shadowfury"] = "Stun"
|
||||
self.debuffList["Hammer of Justice"] = "Stun"
|
||||
self.debuffList["Impact"] = "Stun"
|
||||
self.debuffList["Blackout"] = "Stun"
|
||||
self.debuffList["Intimidation"] = "Stun"
|
||||
self.debuffList["Charge Stun"] = "Stun"
|
||||
self.debuffList["Intercept Stun"] = "Stun"
|
||||
self.debuffList["Revenge Stun"] = "Stun"
|
||||
self.debuffList["Concussion Blow"] = "Stun"
|
||||
self.debuffList["Bash"] = "Stun"
|
||||
self.debuffList["Pounce"] = "Stun"
|
||||
self.debuffList["Improved Concussive Shot"] = "Stun"
|
||||
self.debuffList["Starfire Stun"] = "Stun"
|
||||
self.debuffList["War Stomp"] = "Stun"
|
||||
|
||||
self.debuffList["Repentance"] = "Incapacitate"
|
||||
self.debuffList["Sap"] = "Incapacitate"
|
||||
self.debuffList["Gouge"] = "Incapacitate"
|
||||
self.debuffList["Blind"] = "Incapacitate"
|
||||
self.debuffList["Wyvern Sting"] = "Incapacitate"
|
||||
self.debuffList["Scatter Shot"] = "Incapacitate"
|
||||
self.debuffList["Sleep"] = "Incapacitate"
|
||||
self.debuffList["Polymorph"] = "Incapacitate"
|
||||
self.debuffList["Polymorph: Pig"] = "Incapacitate"
|
||||
self.debuffList["Polymorph: Turtle"] = "Incapacitate"
|
||||
self.debuffList["Hibernate"] = "Incapacitate"
|
||||
self.debuffList["Freezing Trap Effect"] = "Incapacitate"
|
||||
self.debuffList["Chastize"] = "Incapacitate"
|
||||
self.debuffList["Maim"] = "Incapacitate"
|
||||
|
||||
self.debuffList["Psychic Scream"] = "Fear"
|
||||
self.debuffList["Fear"] = "Fear"
|
||||
self.debuffList["Howl of Terror"] = "Fear"
|
||||
|
||||
self.previousDebuff = nil
|
||||
self.previousDebuffTarget = nil
|
||||
self.previousDebuffTime = nil
|
||||
end
|
||||
|
||||
-- 'Public' methods -----------------------------------------------------------
|
||||
|
||||
-- OVERRIDE
|
||||
function TargetCC.prototype:Enable(core)
|
||||
TargetCC.super.prototype.Enable(self, core)
|
||||
|
||||
self:RegisterEvent("UNIT_AURA", "UpdateTargetDebuffs")
|
||||
|
||||
self:ScheduleRepeatingEvent(self.elementName, self.UpdateTargetDebuffs, 0.1, self)
|
||||
|
||||
self:Show(false)
|
||||
end
|
||||
|
||||
function TargetCC.prototype:Disable(core)
|
||||
TargetCC.super.prototype.Disable(self, core)
|
||||
|
||||
self:CancelScheduledEvent(self.elementName)
|
||||
end
|
||||
|
||||
-- OVERRIDE
|
||||
function TargetCC.prototype:GetDefaultSettings()
|
||||
local settings = TargetCC.super.prototype.GetDefaultSettings(self)
|
||||
|
||||
settings["enabled"] = false
|
||||
settings["shouldAnimate"] = false
|
||||
settings["desiredLerpTime"] = nil
|
||||
settings["lowThreshold"] = 0
|
||||
settings["side"] = IceCore.Side.Left
|
||||
settings["offset"] = 3
|
||||
|
||||
return settings
|
||||
end
|
||||
|
||||
-- OVERRIDE
|
||||
function TargetCC.prototype:GetOptions()
|
||||
local opts = TargetCC.super.prototype.GetOptions(self)
|
||||
|
||||
opts["shouldAnimate"] = nil
|
||||
opts["desiredLerpTime"] = nil
|
||||
opts["lowThreshold"] = nil
|
||||
opts["textSettings"].args["upperTextString"] = nil
|
||||
opts["textSettings"].args["lowerTextString"] = nil
|
||||
|
||||
opts["alertParty"] = {
|
||||
type = "toggle",
|
||||
name = "Alert Party",
|
||||
desc = "Broadcasts crowd control effects you apply to your target via the party chat channel",
|
||||
get = function()
|
||||
return self.moduleSettings.alertParty
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.alertParty = v
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
}
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
-- 'Protected' methods --------------------------------------------------------
|
||||
|
||||
function _GetMaxDebuffDuration(unitName, debuffNames)
|
||||
local i = 1
|
||||
local debuff, rank, texture, count, debuffType, duration, remaining = UnitDebuff(unitName, i)
|
||||
local result = {nil, nil, nil}
|
||||
|
||||
while debuff do
|
||||
if debuffNames[debuff] then
|
||||
if result[0] then
|
||||
if result[2] < remaining then
|
||||
result = {debuff, duration, remaining}
|
||||
end
|
||||
else
|
||||
result = {debuff, duration, remaining}
|
||||
end
|
||||
end
|
||||
|
||||
i = i + 1;
|
||||
|
||||
debuff, rank, texture, count, debuffType, duration, remaining = UnitDebuff(unitName, i)
|
||||
end
|
||||
|
||||
return unpack(result)
|
||||
end
|
||||
|
||||
function TargetCC.prototype:UpdateTargetDebuffs()
|
||||
local name, duration, remaining = _GetMaxDebuffDuration(self.unit, self.debuffList)
|
||||
local targetName = UnitName(self.unit)
|
||||
|
||||
if (name ~= nil) and (self.previousDebuff == nil) and (duration ~= nil) and (remaining ~= nil) then
|
||||
if (duration > 1) and (self.moduleSettings.alertParty) and ((GetNumPartyMembers() >= 1) or (GetNumRaidMembers() >= 1)) then
|
||||
SendChatMessage(targetName .. ": " .. name .. " (" .. tostring(floor(remaining * 10) / 10) .. "/" .. tostring(duration) .. "s)", "PARTY")
|
||||
end
|
||||
|
||||
self.previousDebuff = name
|
||||
self.previousDebuffTarget = targetName
|
||||
self.previousDebuffTime = GetTime() + duration
|
||||
-- Parnic: Force the CurrScale to 1 so that the lerping doesn't make it animate up and back down
|
||||
self.CurrScale = 1.0
|
||||
elseif (self.previousDebuff ~= nil) then
|
||||
if (targetName ~= self.previousDebuffTarget) then
|
||||
self.previousDebuff = nil
|
||||
self.previousDebuffTarget = nil
|
||||
self.previousDebuffTime = nil
|
||||
elseif (GetTime() > self.previousDebuffTime) then
|
||||
self.previousDebuff = nil
|
||||
self.previousDebuffTarget = nil
|
||||
self.previousDebuffTime = nil
|
||||
end
|
||||
end
|
||||
|
||||
if (name ~= nil) then
|
||||
self:Show(true)
|
||||
|
||||
if (duration ~= nil) then
|
||||
self:UpdateBar(remaining / duration, "CC:" .. self.debuffList[name])
|
||||
self:SetBottomText2(floor(remaining * 10) / 10)
|
||||
else
|
||||
self:UpdateBar(0, "CC:" .. self.debuffList[name])
|
||||
self:SetBottomText2("")
|
||||
end
|
||||
|
||||
self:SetBottomText1(name)
|
||||
else
|
||||
self:Show(false)
|
||||
end
|
||||
end
|
||||
|
||||
-- Load us up
|
||||
IceHUD.TargetCC = TargetCC:new()
|
Reference in New Issue
Block a user