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