Quantcast
Filter Buffs/Debuffs on Default Nameplates - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-10-17, 06:27 AM   #1
Sylen
A Cyclonian
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 48
Filter Buffs/Debuffs on Default Nameplates

TL;TR:
Is there a clean way you can filter(whitelist) the buffs/debuffs shown on the default blizzard nameplates (including the new personal resource display)?


I tried to modify the default filter to show all harmful spells by a player but as far as i can tell it achieved nothing. This is the code i am using for it
Code:
hooksecurefunc(NamePlateDriverFrame, "OnUnitAuraUpdate", function(self, unit)
	local filter;
	if UnitIsUnit("player", unit) then
		filter = "HELPFUL|INCLUDE_NAME_PLATE_ONLY";
	else
		local reaction = UnitReaction("player", unit);
		if reaction and reaction <= 4 then
			-- Reaction 4 is neutral and less than 4 becomes increasingly more hostile
			filter = "HARMFUL|PLAYER";
		else
			filter = "NONE";
		end
	end
 
	local nameplate = C_NamePlate.GetNamePlateForUnit(unit);
	if (nameplate) then
		nameplate.UnitFrame.BuffFrame:UpdateBuffs(nameplate.namePlateUnitToken, filter);
	end
end)
After some research i stumbled upon this thread in which the same problem is identified by Ketho but it seems nobody found a solution.

I researched more and found this script/macro on the mmo-champion forums, which stated by the author does the following:
"I was also disappointed the nameplates weren't showing all buffs on me so this script makes it show ALL buffs except indefinite buffs or buffs that last more than about a minute. It also doesn't show buffs with the SpellID specified by b so you can add your own unwanted SpellIDs to b or just leave it as b={} if you don't care."
Source
Code:
/run local b={196608,126896};local gn=UnitAura;local function fn(...)local a={gn(...)};a[15]=a[6]~=nil and not tContains(b,a[11])and abs(a[6]-31)<31;return unpack(a);end UnitAura=fn;
This script does indeed work but it uses a blacklist-filtering and i felt like creating a blacklist for all buffs i don't want to see on myself is too much work.
I figured what i need is a whitelist filter so i changed the script to this:
Code:
--Filter buffs/debuffs on nameplates, personal resource display
local filter = CreateFrame("Frame")
filter:RegisterEvent("PLAYER_ENTERING_WORLD")

filter:SetScript("OnEvent", function()
	--This filters debuffs and buffs(personal resource display)
	local Whitelist = {}
	
	local gn = UnitAura
	local function Filter(...)
		local AllBuffs = {gn(...)}
		AllBuffs[15] = AllBuffs[6] ~= nil and tContains(Whitelist, AllBuffs[11]) and abs(AllBuffs[6]-31)<31 return unpack(AllBuffs) end
	UnitAura = Filter
end)
The whitelist filter works just fine but another problem now occured, the script eats tremendous amounts of memory while running for a longer time resulting in a performance loss and fps drop.
At this point it overextends my coding knowledge and i don't really know how to move on.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Filter Buffs/Debuffs on Default Nameplates

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off