[Help] Nameplate Aura Whitelist


#13

It still shows auras of the same name. The Disable slow, Disable root, and Mystic Touch are shown.


(Fizzlemizz) #14

I don’t Monk so I’m not sure of the difference, I thought they were the same id but if already snared (slowed) when cast, they are then rooted… so to speak.
You can print(spellName, spellId) and check what IDs UnitDebuff is returning and check with WoWHead to see what they should be if you don’t already have them.


#15

The slow is 116095 and the root is 116706. The Rake stun and bleed behave the same way (same name, different ID’s).


(Fizzlemizz) #16

Maybe I’m doing it wrong but I get the same debuffs as my target frame. If I comment out the Mystic Touch entry in the table then it doesn’t show on the target nameplate.

Edit: They appear to be interactive. If I comment out 116706 I get both and if I comment 116095 out nothing on the first application and both on the second.


#17

No, I just isolated the script and ran it without other AddOns, and the filter works, but it still shows auras with identical names as the whitelisted spell ID’s. I’m pretty sure what it’s doing is searching through the debuffs for the spell ID, pulling the name, and displaying debuffs of that name.


(Fizzlemizz) #18

Because the debuff is active twice it will always find an entry in the table even if only one spellid because the debuff list is being process from start to finish for each nameplate buff being tested. It would work it there were only ever one debuff of the same name but different ids in effect.

Back to the drawing board.


#19

An alternative solution would be to whitelist spells by name and then blacklist specific ID’s. A strict whitelist would be a more ideal solution, but if it can’t be done, maybe that is an option.


(Fizzlemizz) #20

I’m not sure how far this will go ie. not sure if spells with the same name and differend ids also have a different duration but…

local function newShouldShowBuff(self, name, caster, nameplateShowPersonal, nameplateShowAll, duration)
	for i= 1, BUFF_MAX_DISPLAY do 
		local spellName, _, _, _, spellDuration, _, _, _, _, spellId = UnitAura(self.unit, i, "HARMFUL|INCLUDE_NAME_PLATE_ONLY");
		if not spellName then break end
		if name == spellName and spellDuration == duration and (whitelist[spellId] == caster or whitelist[spellId] == "all") then
			return true
		end
	end
	return false
end

#21

That is a genius solution. I think this should work, barring the extremely unlikely event that an aura I need to track has the same duration as one of the same name that I don’t need to track. I just have one more request before this should be settled: I still want to track some buffs on the personal resource display, also by ID if possible, but name should be okay for that. Is there a way to do this that would be compatible with this script?

EDIT: I spoke too soon. There was a priest casting on the training dummies near where I was testing this, and some of their buffs were popping in and out of the nameplates. I have no idea why that might happen, but I can’t use this unless it’s fixed. All of the priest’s debuffs were appearing on enemy nameplates, and they seemed to disappear when I got a certain distance away from the dummies and sometimes reappear when I turned my camera in certain directions.


(Fizzlemizz) #22

It would require some testing as to what is being returned as the caster and SpellCaster (7th return from UnitAura). They may be needed in the test as well.

if name == spellName and caster == spellCaster and ...

For helpful spells change the UnitAura filter

UnitAura(self.unit, i, “HELPFUL|HARMFUL|INCLUDE_NAME_PLATE_ONLY”)


#23

Now my auras do not appear and I still see random auras from other players on training dummies. This used to happen with the original script, and someone on WoWInterface suggested this as a fix:

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

If you could incorporate that somehow, maybe it would work.


(Fizzlemizz) #24

That’s also just using spell names and will still have the problem with duplicate names.

If it works, this assumes the spellId for “player helpful” and “everyone else harmful” are different (if not it would need a slightly different whitelist table structure). You could still get multiple spells the same if the whitelist entry is marked “all” and more than one of that spellId is cast/allowed on the unit.

local whitelist = {
	[116095] = "player", -- Disable WW Monk Slow
	[113746] = "player", -- Mystic Touch
	[116706] = "player", -- Disable WW Monk Root
	[137639] = "player", -- Storm, Earth, and Fire buff spell for player
--	[nnnn] = "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
	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 -- fingers crossed we're testing for the same aura
			if 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

#25

Extra auras still appear on nameplates when other players are attacking the training dummies. Otherwise, it does work as intended. More auras must be returning as true than intended somehow.


(Fizzlemizz) #26

Try changing:

if whitelist[spellId] == spellCaster or whitelist[spellId] == "all" then
		return true
end

to read

if whitelist[spellId] == spellCaster or whitelist[spellId] == "all" then
		return true
end
break

So it doesn’t continue searching once it’s found a match.


#27

It still shows errant auras. :confused: I’m not really sure what to do about it, but someone else on WoW Interface posted this script which seems to work by ID but still show duplicate names. You’re free to try to edit this script instead:

local whitelist = { 
    --[spellId] = {caster = unitId}
    --[155722] = {caster = "player"},   --Rake Bleed
    [163505] = {caster = "player"},     --Rake Stun
    [155625] = {caster = "player"},     --Moonfire (Lunar Inspiration Talent)
    [8936] = {caster = "player"}        --Regrowth 
}
 
local function newShouldShowBuff(_,name,caster)
    for k, v in pairs(whitelist) do
        local spellName, _, _, _, _, _, spellId = GetSpellInfo(k)
        if spellName == name and spellId == k then              
            return name and caster and (whitelist[k].caster == caster or whitelist[k].caster == "all")  
        end
    end
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

(Fizzlemizz) #28

Do you have a screenshot of what you mean my errant auras so I know what I’m looking for?

And a copy of your whitelist table.


#29

I have these two whitelisted:

[116706] = "all", -- Disable WW Monk Root
[137639] = "player", -- Storm, Earth, and Fire buff spell for player

I noticed that a Hunter’s Rapid Fire was appearing on the dummies, but not consistently. I’ve also seen Vampiric Touch and other Shadow Priest auras appear and disappear.

I can’t post links here, so I’m not sure how to show the screenshot.


(Fizzlemizz) #30

Place spaces before/after the dot or try enclosing the url in code </> tags.


(Fizzlemizz) #32

Change
if whitelist[spellId] == spellCaster or whitelist[spellId] == "all" then
too
if (caster and whitelist[spellId] == spellCaster) or whitelist[spellId] == "all" then


#33

It seems to be functioning correctly now. I just tested it in a large scale fight with all nameplates enabled in a random battleground. I’ll update you if anything goes wrong.

EDIT: Everything seems to be working. There’s just one thing I’d like to find out. Is there a way to make your buffs show up on friendly nameplates? Like Resto Druid HoTs? Alternatively, if I could show all whitelisted debuffs on friendly nameplates instead of only dispellable ones, that would work.