From d4fd3af2d749bdf2fdb3f14a16ac41a95dba3371 Mon Sep 17 00:00:00 2001 From: Parnic Date: Mon, 6 Dec 2010 01:44:07 +0000 Subject: [PATCH] - added support for custom buff/debuff trackers to be able to track totems by name --- modules/CustomBar.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/modules/CustomBar.lua b/modules/CustomBar.lua index 3303704..e469ad2 100644 --- a/modules/CustomBar.lua +++ b/modules/CustomBar.lua @@ -28,6 +28,9 @@ function IceCustomBar.prototype:Enable(core) self:RegisterEvent("UNIT_PET", "UpdateCustomBarEvent") self:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomBarEvent") self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateCustomBarEvent") + if self.unitClass == "SHAMAN" then + self:RegisterEvent("PLAYER_TOTEM_UPDATE", "UpdateTotems") + end if self.moduleSettings.auraIconScale == nil then self.moduleSettings.auraIconScale = 1 @@ -528,6 +531,25 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName) isMine = unitCaster == "player" end + if self.unitClass == "SHAMAN" then + for i=1,MAX_TOTEMS do + local haveTotem, totemName, startTime, realDuration, icon = GetTotemInfo(i) + + if self.moduleSettings.maxDuration and self.moduleSettings.maxDuration ~= 0 then + duration = self.moduleSettings.maxDuration + else + duration = realDuration + end + + if ((self.moduleSettings.exactMatch and totemName:upper() == buffName:upper()) + or (not self.moduleSettings.exactMatch and string.match(totemName:upper(), buffName:upper()))) then + endTime = startTime + realDuration + remaining = endTime - GetTime() + return duration, remaining, 1, icon, endTime + end + end + end + return nil, nil, nil, nil end @@ -535,6 +557,10 @@ function IceCustomBar.prototype:UpdateCustomBarEvent(event, unit) self:UpdateCustomBar(unit) end +function IceCustomBar.prototype:UpdateTotems(event, totem) + self:UpdateCustomBar(self.unit) +end + function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate) if unit and unit ~= self.unit and not (self.unit == "main hand weapon" or self.unit == "off hand weapon") then return