View Single Post
01-10-19, 06:58 PM   #12
Sylen
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 50
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. }
  8.  
  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
  20.  
  21. local f = CreateFrame("Frame")
  22.     f:RegisterEvent("NAME_PLATE_UNIT_ADDED")
  23.     f:SetScript("OnEvent", function(_,_,unitId)
  24.    
  25.     Mixin(C_NamePlate.GetNamePlateForUnit(unitId))
  26. end)
  27.  
  28. for _,baseFrame in pairs(C_NamePlate.GetNamePlates()) do
  29.     Mixin(baseFrame)
  30. end

Last edited by Sylen : 01-10-19 at 07:00 PM.
  Reply With Quote