Originally Posted by Sylen
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:
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
|
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:
https://us.forums.blizzard.com/en/wo...elist/69575/22
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.
Code:
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
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
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.