I don't see a way to do it without taint but this didn't throw any errors the little I tested at a training dummy:
Lua Code:
local GetNamePlateForUnit = C_NamePlate.GetNamePlateForUnit
local OriginalUpdateBuffs = NameplateBuffContainerMixin.UpdateBuffs
local alteredNamePlates = { }
local function ShouldShowBuff(frame, name, caster)
return name -- already filtered
end
local function UpdateBuffs(self, unit, filter, showAll)
OriginalUpdateBuffs(self, unit, "HARMFUL|PLAYER")
end
local frame = CreateFrame("Frame")
frame:SetScript("OnEvent", function(self, event, unit)
local nameplate = GetNamePlateForUnit(unit)
if nameplate and not alteredNamePlates[nameplate] then
alteredNamePlates[nameplate] = true
local buffFrame = nameplate.UnitFrame.BuffFrame
buffFrame.ShouldShowBuff = ShouldShowBuff
buffFrame.UpdateBuffs = UpdateBuffs
end
end)
frame:RegisterEvent("NAME_PLATE_UNIT_ADDED")