Quantcast
WoWInterface - View Single Post - Filter Buffs/Debuffs on Default Nameplates
View Single Post
09-13-17, 11:20 AM   #4
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Google brought me to this thread on MMOC, with a script which seems to work:

Code:
local whitelist = {
	["Goremaw's Bite"] = "player",
	["Night Terrors"] = "player",
	["Nightblade"] = "player",
	["Symbols of Death"] = "player"
}

local function newShouldShowBuff(_,name,caster)
	return name and (whitelist[name] == caster or whitelist[name] == "all")
end

local function Mixin(baseFrame)
	baseFrame.UnitFrame.BuffFrame.ShouldShowBuff = newShouldShowBuff
end

local f = CreateFrame("Frame")
f:RegisterEvent("NAME_PLATE_UNIT_ADDED")
f:SetScript("OnEvent", function(_,_,unitId)
	Mixin(C_NamePlate.GetNamePlateForUnit(unitId))
end)

for _,baseFrame in pairs(C_NamePlate.GetNamePlates()) do
	Mixin(baseFrame)
end
Keep in mind this is a strict whitelist filter; buffs that normally show on nameplates as per default UI will be hidden unless they are added to the whitelist (I think that was already what you wanted, either way.)

https://gfycat.com/violetoldfashionedgraywolf

Haven't tested this for too long so I can't tell you if it runs into memory issues, but at least it doesn't make me puke inside my mouth by overwriting a global function.


Edit: Playing a bit more with this code enabled, it doesn't look like this works well at all. I had a few debuffs that weren't whitelisted that appeared on nameplates anyway.
Maybe somebody can figure out why it happens and fix the script, or come up with a different solution altogether :/

Last edited by Ammako : 09-13-17 at 02:52 PM.
  Reply With Quote