From 33094907b7ab598c8cd4ee53ab46d79a62d87e64 Mon Sep 17 00:00:00 2001 From: anadale Date: Mon, 20 Oct 2008 15:43:27 +0000 Subject: [PATCH] - Unit auras handling moved to new 3.0.2 UnitAura API. [AuraDuration] tag should work now. --- Categories/Auras.lua | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/Categories/Auras.lua b/Categories/Auras.lua index 8be039d..207da2b 100644 --- a/Categories/Auras.lua +++ b/Categories/Auras.lua @@ -24,7 +24,7 @@ local function func(self, unit) local u = newList() local v = newList() for i = 1, 40 do - local name, _, _, count, _, timeLeft = UnitBuff(unit, i) + local name, _, _, count, _, duration, expirationTime = UnitAura(unit, i, "HELPFUL") if not name then break end @@ -32,14 +32,15 @@ local function func(self, unit) count = 1 end t[name] = (t[name] or 0) + count - if timeLeft and timeLeft > 0 and (not v[name] or v[name] > timeLeft) then - v[name] = timeLeft + + if expirationTime and expirationTime > 0 and (not v[name] or v[name] > expirationTime) then + v[name] = expirationTime end end local numDebuffs = 0 local isFriend = UnitIsFriend("player", unit) for i = 1, 40 do - local name, _, _, count, dispelType, _, timeLeft = UnitDebuff(unit, i) + local name, _, _, count, dispelType, _, expirationTime = UnitAura(unit, i, "HARMFUL") if not name then break end @@ -51,16 +52,13 @@ local function func(self, unit) if isFriend and dispelType then u[dispelType] = true end - if timeLeft and timeLeft > 0 and (not v[name] or v[name] > timeLeft) then - v[name] = timeLeft + + if expirationTime and expirationTime > 0 and (not v[name] or v[name] > expirationTime) then + v[name] = expirationTime end end currentAuras[unit] = t currentDebuffTypes[unit] = u - local currentTime = GetTime() - for name, timeLeft in pairs(v) do - v[name] = timeLeft + currentTime - end currentAuraTimes[unit] = v currentNumDebuffs[unit] = numDebuffs return self[unit] @@ -97,7 +95,7 @@ DogTag:AddTimerHandler("Unit", function(num, currentTime) local u = newList() local v = newList() for i = 1, 40 do - local name, _, _, count, _, timeLeft = UnitBuff(unit, i) + local name, _, _, count, _, _, expirationTime = UnitAura(unit, i, "HELPFUL") if not name then break end @@ -105,14 +103,14 @@ DogTag:AddTimerHandler("Unit", function(num, currentTime) count = 1 end t[name] = (t[name] or 0) + count - if timeLeft and timeLeft > 0 and (not v[name] or v[name] > timeLeft) then - v[name] = timeLeft + if expirationTime and expirationTime > 0 and (not v[name] or v[name] > expirationTime) then + v[name] = expirationTime end end local numDebuffs = 0 local isFriend = UnitIsFriend("player", unit) for i = 1, 40 do - local name, _, _, count, dispelType, _, timeLeft = UnitDebuff(unit, i) + local name, _, _, count, dispelType, _, expirationTime = UnitAura(unit, i, "HARMFUL") if not name then break end @@ -124,13 +122,10 @@ DogTag:AddTimerHandler("Unit", function(num, currentTime) if isFriend and dispelType then u[dispelType] = true end - if timeLeft and timeLeft > 0 and (not v[name] or v[name] > timeLeft) then - v[name] = timeLeft + if expirationTime and expirationTime > 0 and (not v[name] or v[name] > expirationTime) then + v[name] = expirationTime end end - for k, time in pairs(v) do - v[k] = time + currentTime - end local old = rawget(currentAuras, unit) or newList() local oldType = rawget(currentDebuffTypes, unit) or newList() local oldTimes = rawget(currentAuraTimes, unit) or newList()