Quantcast
Nameplate Aura Filter - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-15-22, 05:06 AM   #1
Zaqqari
A Deviate Faerie Dragon
Join Date: Aug 2019
Posts: 11
Nameplate Aura Filter

Fizzlemizz helped me with an addon a while ago to filter the nameplate auras by spell ID, and it works great. The only thing I wish I could do with it is stop it from filtering friendly nameplates. By default, friendly nameplates show all dispellable debuffs. You can't modify friendly nameplates in dungeon and raid instances, so I'd like to keep the debuffs consistent by disabling the filter on friendly nameplates.

Also, forgive my ignorance, but is there anywhere I can find a list of everything you can do with the WoW API (e.g. INCLUDE_NAME_PLATE_ONLY, Mixin, BUFF_MAX_DISPLAY, UnitIsUnit, etc.)? I'm just guessing at what these things do without much success. I'd like to learn how to write my own addons from start to finish, but I don't really know where to find good information. Most of the links I find in guides are outdated or no longer active.

Code:
local whitelist = {

	[116841] = "player",--Tiger's Lust
	[228287] = "player",--Mark of the Crane
	[115078] = "all",--Paralysis
	
}

local function newShouldShowBuff(self, name, caster, nameplateShowPersonal, nameplateShowAll, duration)
	local filter = "INCLUDE_NAME_PLATE_ONLY"
	if UnitIsUnit(self.unit, "player") then
		filter = "HELPFUL|".. filter
	else
		filter = "HARMFUL|".. filter
	end
	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
			if (caster and whitelist[spellId] == spellCaster) or whitelist[spellId] == "all" then
				return true
			end
		end
	end
	return false
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

Last edited by Zaqqari : 01-15-22 at 05:47 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Nameplate Aura Filter

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