Hello - I’ve been using an addon since Legion that would display the Spell Steal border or a Purgable Spell border for classes that do not have a purge but it no longer works. I was wondering if anyone could tell me what’s wrong with the addon now. Here is the code:
hooksecurefunc("TargetFrame_UpdateAuras", function(s)
for i = 1, MAX_TARGET_BUFFS do
_, ic, _, dT = UnitBuff(s.unit, i)
if(ic and (not s.maxBuffs or i<=s.maxBuffs)) then
fS=_G[s:GetName()..'Buff'..i..'Stealable']
if(UnitIsEnemy(PlayerFrame.unit, s.unit) and dT=='Magic') then
fS:Show()
else
fS:Hide()
end
end
end
end)
hooksecurefunc(TargetFrame,"UpdateAuras", function(s)
for i = 1, MAX_TARGET_BUFFS do
_, ic, _, dT = UnitBuff(s.unit, i)
if(ic and (not s.maxBuffs or i<=s.maxBuffs)) then
fS=_G[s:GetName()..'Buff'..i..'Stealable']
if(UnitIsEnemy(PlayerFrame.unit, s.unit) and dT=='Magic') then
fS:Show()
else
fS:Hide()
end
end
end
end)
Thanks, I think that fixed the function issue but now it’s coming up with the error: Interface/AddOns/SpellStealAura/SpellStealAura.lua:55: attempt to index global 'fS' (a nil value)
hooksecurefunc(TargetFrame,"UpdateAuras", function(s)
for i = 1, MAX_TARGET_BUFFS do
_, ic, _, dT = UnitBuff(s.unit, i)
if (ic and (not s.maxBuffs or i<=s.maxBuffs)) then
local fS = _G[s:GetName()..'Buff'..i..'Stealable']
if (UnitIsEnemy(PlayerFrame.unit, s.unit) and dT=='Magic') then
fS:Show()
else
fS:Hide()
end
end
end
end)
I got another error: SpellStealAura/SpellStealAura.lua:55: attempt to index local 'fS' (a nil value)
hooksecurefunc(TargetFrame,"UpdateAuras", function(s)
for i = 1, MAX_TARGET_BUFFS do
_, ic, _, dT = UnitBuff(s.unit, i)
if(ic and (not s.maxBuffs or i<=s.maxBuffs)) then
local fS = _G[s:GetName()..'Buff'..i..'Stealable']
if(UnitIsEnemy(PlayerFrame.unit, s.unit) and dT=='Magic') then
fS:Show()
else
fS:Hide()
end
end
end
end)
These seem to have moved to pools. You could rebuild the code based on iterating through the buffs pool for the target. Something (untested) like:
local i=0
for frame in TargetFrame.auraPools:GetPool("TargetBuffFrameTemplate"):EnumerateActive() do
i = i + 1
local _, ic, _, dT = UnitBuff("target", i)
if(UnitIsEnemy("player", "target") and dT=='Magic') then
frame.Stealable:Show()
else
frame.Stealable:Hide()
end
end