Quantcast
WoWInterface - View Single Post - Filter on nameplates debuffs.
View Single Post
01-22-21, 12:24 PM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
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:
  1. local GetNamePlateForUnit = C_NamePlate.GetNamePlateForUnit
  2. local OriginalUpdateBuffs = NameplateBuffContainerMixin.UpdateBuffs
  3.  
  4. local alteredNamePlates = { }
  5.  
  6. local function ShouldShowBuff(frame, name, caster)
  7.     return name -- already filtered
  8. end
  9.  
  10. local function UpdateBuffs(self, unit, filter, showAll)
  11.     OriginalUpdateBuffs(self, unit, "HARMFUL|PLAYER")
  12. end
  13.  
  14. local frame = CreateFrame("Frame")
  15.  
  16. frame:SetScript("OnEvent", function(self, event, unit)
  17.     local nameplate = GetNamePlateForUnit(unit)
  18.     if nameplate and not alteredNamePlates[nameplate] then
  19.         alteredNamePlates[nameplate] = true
  20.         local buffFrame = nameplate.UnitFrame.BuffFrame
  21.         buffFrame.ShouldShowBuff = ShouldShowBuff
  22.         buffFrame.UpdateBuffs = UpdateBuffs
  23.     end
  24. end)
  25.  
  26. frame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
  Reply With Quote