Skip to content

Commit 70ffcd1

Browse files
committed
System - Debuff fixes
1 parent 3396d85 commit 70ffcd1

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

Diff for: System/API/Debuff.lua

+4-3
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,14 @@ br.api.debuffs = function(debuff, k, v)
281281
-- string[opt="target"] thisUnit The unit to check the ticks gained by reapplying the debuff on.
282282
-- @treturn number
283283
debuff.ticksGainedOnRefresh = function(thisUnit)
284-
local name, _, _, _, duration, expirationTime = br.UnitDebuffID(thisUnit, v, nil, "PLAYER")
285284
local haste = br._G.UnitSpellHaste("player")
286285
local hasteMultiplier = 1 + (haste / 100)
287286
local baseTickTime = baseTickTimes[v] or 3
288287
local hastedTickTime = baseTickTime / hasteMultiplier
289-
290-
if name then
288+
local auraInfo = br.UnitDebuffID(thisUnit, v, nil, "PLAYER")
289+
if auraInfo then
290+
local expirationTime = auraInfo.expirationTime
291+
local duration = auraInfo.duration
291292
local remainingDuration = expirationTime - br._G.GetTime()
292293
local remainingTicks = math.floor(remainingDuration / hastedTickTime)
293294

Diff for: System/Functions/Aura.lua

+18-9
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,33 @@ function br.UnitDebuffID(unit, spellID, filter)
8484
end
8585

8686
-- Failsafe if not cached
87-
local exactSearch = filter ~= nil and br._G.strfind(br._G.strupper(filter), "EXACT")
88-
if unit == "player" then
89-
local auraInfo = C_UnitAuras.GetPlayerAuraBySpellID(spellID)
87+
if unit == "player" then
88+
local auraInfo = C_UnitAuras.GetPlayerAuraBySpellID(spellID)
9089
if auraInfo and auraInfo.expirationTime > br._G.GetTime() then return auraInfo end
9190
end
91+
local exactSearch = filter ~= nil and br._G.strfind(br._G.strupper(filter), "EXACT")
9292
if exactSearch then
9393
for i = 1, 40 do
94-
local buffName, _, _, _, _, _, _, _, _, buffSpellID = br._G.UnitDebuff(unit, i, "player")
95-
if buffName == nil then return nil end
96-
if buffSpellID == spellID then
97-
return br._G.UnitDebuff(unit, i, "player")
94+
-- local buffName, _, _, _, _, _, _, _, _, buffSpellID = br._G.UnitDebuff(unit, i, "player")
95+
local auraInfo = C_UnitAuras.GetDebuffDataByIndex(unit, i, "PLAYER")
96+
if auraInfo == nil then return nil end
97+
if auraInfo.spellId == spellID then
98+
return auraInfo --br._G.UnitDebuff(unit, i, "player")
9899
end
99100
end
100101
else
101102
if filter ~= nil and br._G.strfind(br._G.strupper(filter), "PLAYER") then
102-
return br._G.AuraUtil.FindAuraByName(spellName, unit, "HARMFUL|PLAYER")
103+
for i = 1, 40 do
104+
local auraInfo = C_UnitAuras.GetDebuffDataByIndex(unit, i, "HARMFUL|PLAYER")
105+
if auraInfo and auraInfo.name == spellName then return auraInfo end
106+
end
107+
-- return br._G.AuraUtil.FindAuraByName(spellName, unit, "HARMFUL|PLAYER")
108+
end
109+
for i = 1, 40 do
110+
local auraInfo = C_UnitAuras.GetDebuffDataByIndex(unit, i, "HARMFUL")
111+
if auraInfo and auraInfo.name == spellName then return auraInfo end
103112
end
104-
return br._G.AuraUtil.FindAuraByName(spellName, unit, "HARMFUL")
113+
-- return br._G.AuraUtil.FindAuraByName(spellName, unit, "HARMFUL")
105114
end
106115
end
107116

0 commit comments

Comments
 (0)