WoWInterface - View Single Post - Nameplate Debuff Whitelist
View Single Post
01-11-19, 05:47 PM   #13
A Murloc Raider
Join Date: Jul 2018
Posts: 7
Originally Posted by Sylen View Post
Ok I got a working version that uses spellIds instead of spellNames. It works for debuffs and buffs BUT still shows both debuffs if they have an identical name (tested with druids Rake ability).

Also I am kinda convinced now, that your desired behaviour is actually not possible to achieve because the Blizzard function is only looking for spellNames and even if you filter two spells with the same name for their respective spellIds you would still have to handover the spellName in the end which is identical again (at least for my understanding of how the code operates).

Lua Code:
  1. local whitelist = {
  2.     --[spellId] = {caster = unitId}
  3.     --[155722] = {caster = "player"},   --Rake Bleed
  4.     [163505] = {caster = "player"},     --Rake Stun
  5.     [155625] = {caster = "player"},     --Moonfire (Lunar Inspiration Talent)
  6.     [8936] = {caster = "player"}        --Regrowth
  7. }
  9. local function newShouldShowBuff(_,name,caster)
  10.     for k, v in pairs(whitelist) do
  11.         local spellName, _, _, _, _, _, spellId = GetSpellInfo(k)
  12.         if spellName == name and spellId == k then             
  13.             return name and caster and (whitelist[k].caster == caster or whitelist[k].caster == "all") 
  14.         end
  15.     end
  16. end
  17. local function Mixin(baseFrame)
  18.     baseFrame.UnitFrame.BuffFrame.ShouldShowBuff = newShouldShowBuff
  19. end
  21. local f = CreateFrame("Frame")
  22.     f:RegisterEvent("NAME_PLATE_UNIT_ADDED")
  23.     f:SetScript("OnEvent", function(_,_,unitId)
  25.     Mixin(C_NamePlate.GetNamePlateForUnit(unitId))
  26. end)
  28. for _,baseFrame in pairs(C_NamePlate.GetNamePlates()) do
  29.     Mixin(baseFrame)
  30. end
I've been talking with someone on the WoW forums about it, and they are trying to help by also checking the duration of the auras and only displaying duplicate names if their durations are the same as the original spell ID's aura. We're running into other issues with it, but if you want to try that, it seems like a reasonable solution.

Here's the link if you want to check it out:

EDIT: It looks like we may have done it, but I wasn't able to test whether or not random auras from other players would show up. I'll post the script here, and you are free to test it.

local whitelist = {
	[116706] = "player", -- Disable WW Monk Root
	[137639] = "player", -- Storm, Earth, and Fire buff spell for player
--	[] = "all", -- Other spell from anyone

local function newShouldShowBuff(self, name, caster, nameplateShowPersonal, nameplateShowAll, duration)
	local filter = "INCLUDE_NAME_PLATE_ONLY"
	if UnitIsUnit(self.unit, "player") then
		filter = "HELPFUL|".. filter
		filter = "HARMFUL|".. filter
	for i=1, BUFF_MAX_DISPLAY do 
		local spellName, _, _, _, spellDuration, _, spellCaster, _, _, spellId = UnitAura(self.unit, i, filter);
		if not spellName then break end
		if name == spellName and caster == spellCaster and duration == spellDuration then -- fingers crossed we're testing for the same aura
			if whitelist[spellId] == spellCaster or whitelist[spellId] == "all" then
				return true
	return false
local function Mixin(baseFrame)
	baseFrame.UnitFrame.BuffFrame.ShouldShowBuff = newShouldShowBuff
local f = CreateFrame("Frame")
f:SetScript("OnEvent", function(_,_,unitId)
for _,baseFrame in pairs(C_NamePlate.GetNamePlates()) do
EDIT: Just noticed extra auras appearing from other players. If you can manage to fix that, this seems to be working as intended, though I would like to see if you could edit your spell ID script to include duration first. Yours seems to work without any problems so far.

Last edited by Shiezko : 01-11-19 at 09:39 PM.
  Reply With Quote