- updated to accept either a spell id or a spell name for custom bars. this allows tracking of different debuffs with the same name (such as Hemorrhage and its DoT). thanks to Nibelheim on WoWInterface for this one as well.

This commit is contained in:
Parnic
2011-07-30 17:15:07 +00:00
parent 551e367ec4
commit 203848d48c

View File

@ -270,9 +270,10 @@ function IceCustomBar.prototype:GetOptions()
end,
set = function(info, v)
local orig = v
if tonumber(v) ~= nil then
v = GetSpellInfo(tonumber(v))
end
--Parnic: we now allow spell IDs to be used directly
--if tonumber(v) ~= nil then
-- v = GetSpellInfo(tonumber(v))
--end
if v == nil then
v = orig
end
@ -585,17 +586,24 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName)
local remaining
local isBuff = self.moduleSettings.buffOrDebuff == "buff" and true or false
local buffFilter = (isBuff and "HELPFUL" or "HARMFUL") .. (self.moduleSettings.trackOnlyMine and "|PLAYER" or "")
local buff, rank, texture, count, type, duration, endTime, unitCaster = UnitAura(unitName, i, buffFilter)
local buff, rank, texture, count, type, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, buffFilter)
local isMine = unitCaster == "player"
local mySpellId = tonumber(self.moduleSettings.buffToTrack)
local checkId = mySpellId ~= nil
local validId = true
while buff do
if self.moduleSettings.maxDuration and self.moduleSettings.maxDuration ~= 0 then
duration = self.moduleSettings.maxDuration
end
if checkId then
validId = spellId == mySpellId
end
if (((self.moduleSettings.exactMatch and buff:upper() == buffName:upper())
or (not self.moduleSettings.exactMatch and string.match(buff:upper(), buffName:upper())))
and (not self.moduleSettings.trackOnlyMine or isMine)) then
and (not self.moduleSettings.trackOnlyMine or isMine) and validId) then
if endTime and not remaining then
remaining = endTime - GetTime()
end
@ -604,7 +612,7 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName)
i = i + 1;
buff, rank, texture, count, type, duration, endTime, unitCaster = UnitAura(unitName, i, buffFilter)
buff, rank, texture, count, type, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, buffFilter)
isMine = unitCaster == "player"
end
@ -654,8 +662,13 @@ function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate)
local endTime = 0
if not fromUpdate then
self.auraDuration, remaining, count, auraIcon, endTime =
self:GetAuraDuration(self.unit, self.moduleSettings.buffToTrack)
if tonumber(self.moduleSettings.buffToTrack) == nil then
self.auraDuration, remaining, count, auraIcon, endTime =
self:GetAuraDuration(self.unit, self.moduleSettings.buffToTrack)
else
self.auraDuration, remaining, count, auraIcon, endTime =
self:GetAuraDuration(self.unit, GetSpellInfo(self.moduleSettings.buffToTrack))
end
if endTime == 0 then
self.bIsAura = true