I didn't test it either, but some observations
- You need to enclose those spell IDs in brackets to use them as table keys.
- Instead of "if not A == B then" you can just do "if A ~= B then".
- Since the enemy status of a unit won't change in the middle of scanning their buffs, and you only want to add the borders on enemies, just check UnitIsEnemy first, and don't bother scanning the buffs if the target isn't an enemy.
- The maxBuffs check is sort of required (since the target can have more debuffs on them than are displayed) but it's simpler to just check whether the stealable texture object exists.
Here's how I'd do it:
Code:
local _, playerClass = UnitClass("player")
if playerClass ~= "ROGUE" then return end
local spellIDs = {
[49016] = true,
[52610] = true,
[5229] = true,
[34692] = true,
[19574] = true,
[18499] = true
}
hooksecurefunc("TargetFrame_UpdateAuras", function(self)
local unit = self.unit
if not UnitIsEnemy(unit, "player") then return end
local name = self:GetName()
for i = 1, MAX_TARGET_BUFFS do
local _, _, _, debuffType, _, _, _, _, _, id = UnitBuff(unit, i)
if not id then return end
local stealable = _G[name.."Buff"..i.."Stealable"]
if not stealable then return end
stealable:SetShown(debuffType == "Magic" and spellIDs[id])
end
end)