From 203848d48caa4ea3e1b1853d078a0366c17c8fc3 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sat, 30 Jul 2011 17:15:07 +0000 Subject: [PATCH] - 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. --- modules/CustomBar.lua | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/modules/CustomBar.lua b/modules/CustomBar.lua index dd76d31..6f7b62c 100644 --- a/modules/CustomBar.lua +++ b/modules/CustomBar.lua @@ -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