- added support for custom buff/debuff trackers to be able to track totems by name

This commit is contained in:
Parnic
2010-12-06 01:44:07 +00:00
parent cc8b66dc0c
commit d4fd3af2d7

View File

@ -28,6 +28,9 @@ function IceCustomBar.prototype:Enable(core)
self:RegisterEvent("UNIT_PET", "UpdateCustomBarEvent") self:RegisterEvent("UNIT_PET", "UpdateCustomBarEvent")
self:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomBarEvent") self:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomBarEvent")
self:RegisterEvent("PLAYER_FOCUS_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 if self.moduleSettings.auraIconScale == nil then
self.moduleSettings.auraIconScale = 1 self.moduleSettings.auraIconScale = 1
@ -528,6 +531,25 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName)
isMine = unitCaster == "player" isMine = unitCaster == "player"
end 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 return nil, nil, nil, nil
end end
@ -535,6 +557,10 @@ function IceCustomBar.prototype:UpdateCustomBarEvent(event, unit)
self:UpdateCustomBar(unit) self:UpdateCustomBar(unit)
end end
function IceCustomBar.prototype:UpdateTotems(event, totem)
self:UpdateCustomBar(self.unit)
end
function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate) 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 if unit and unit ~= self.unit and not (self.unit == "main hand weapon" or self.unit == "off hand weapon") then
return return