Quantcast
WoWInterface - View Single Post - Nameplate Debuff Whitelist
View Single Post
07-26-18, 06:12 AM   #1
Shiezko
A Murloc Raider
Join Date: Jul 2018
Posts: 7
Nameplate Debuff Whitelist

I want to hide all buffs/debuffs on nameplates (including the personal resource display) and then whitelist the ones I want to show. I also want an option for showing debuffs casted only by the player or by anyone.

After doing some research, this is all I could come up with:

Code:
local whitelist = {
    ["Shadow Word: Pain"] = "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
It's a bit of code from MMO-Champion that I found on a post from these forums almost a year ago. I didn't want to necro the thread, but I would really like some help ironing it out. The code does exactly what I want, but it has some issues.

Non-whitelisted buffs appear on nameplates. The world buffs in battlegrounds always show up on my personal resource display, and random debuffs from friendly players will pop up from time to time. There also seems to be no way to distinguish between spells of the same name but different spell IDs. For example, I want to show the Disable root but not the slow unless I'm the one who casted it.

Any help is appreciated! I don't have much experience in this, so this is my last resort.
  Reply With Quote