I checked the functions that Blizzard's default raid frames use to filter buffs/debuffs and found that they were using AuraUtil.ShouldDisplayBuff() and AuraUtil.ShouldDisplayDeuff().
These functions in turn call SpellGetVisibilityInfo(), so I pre-hooked the SpellGetVisibilityInfo() function to prevent the blacklisted aura from being registered.
function AuraUtil.ShouldDisplayDebuff(unitCaster, spellId)
local hasCustom, alwaysShowMine, showForMySpec = securecallfunction(GetCachedVisibilityInfo, spellId);
if ( hasCustom ) then
return showForMySpec or (alwaysShowMine and (unitCaster == "player" or unitCaster == "pet" or unitCaster == "vehicle") ); --Would only be "mine" in the case of something like forbearance.
else
return true;
end
end
function AuraUtil.ShouldDisplayBuff(unitCaster, spellId, canApplyAura)
local hasCustom, alwaysShowMine, showForMySpec = securecallfunction(GetCachedVisibilityInfo, spellId);
if ( hasCustom ) then
return showForMySpec or (alwaysShowMine and (unitCaster == "player" or unitCaster == "pet" or unitCaster == "vehicle"));
else
return (unitCaster == "player" or unitCaster == "pet" or unitCaster == "vehicle") and canApplyAura and not securecallfunction(CheckIsSelfBuff, spellId);
end
end
local function GetCachedVisibilityInfo(spellId)
if cachedVisualizationInfo[spellId] == nil then
local newInfo = {SpellGetVisibilityInfo(spellId, UnitAffectingCombat("player") and "RAID_INCOMBAT" or "RAID_OUTOFCOMBAT")};
if not hasValidPlayer then
-- Don't cache the info if the player is not valid since we didn't get a valid result
return unpack(newInfo);
end
cachedVisualizationInfo[spellId] = newInfo;
end
local info = cachedVisualizationInfo[spellId];
return unpack(info);
end
~~AuraUtil has a cache using the local variable cachedVisualizationInfo to initialize its value, so when the module is enabled/disabled, it triggers PLAYER_REGEN_ENABLED/PLAYER_REGEN_DISABLED depending on the combat situation.
Actually, when the module is enabled/disabled, it shouldn't be in combat, so I could have called PLAYER_REGEN_ENABLED, but just in case.~~
To initialize AuraUtil's internal variable cachedVisualizationInfo, I triggered the PLAYER_REGEN_ENABLED event when the aura module is enabled/disabled (I only used PLAYER_REGEN_ENABLED because it can only be enabled/disabled when the module is not in combat).
local function DumpCaches()
cachedVisualizationInfo = {};
cachedSelfBuffChecks = {};
cachedPriorityChecks = {};
end
EventRegistry:RegisterFrameEvent("PLAYER_REGEN_ENABLED");
EventRegistry:RegisterFrameEvent("PLAYER_REGEN_DISABLED");
EventRegistry:RegisterCallback("PLAYER_REGEN_ENABLED", DumpCaches, {});
EventRegistry:RegisterCallback("PLAYER_REGEN_DISABLED", DumpCaches, {});
I checked the functions that Blizzard's default raid frames use to filter buffs/debuffs and found that they were using AuraUtil.ShouldDisplayBuff() and AuraUtil.ShouldDisplayDeuff(). These functions in turn call SpellGetVisibilityInfo(), so I pre-hooked the SpellGetVisibilityInfo() function to prevent the blacklisted aura from being registered.
~~AuraUtil has a cache using the local variable cachedVisualizationInfo to initialize its value, so when the module is enabled/disabled, it triggers PLAYER_REGEN_ENABLED/PLAYER_REGEN_DISABLED depending on the combat situation. Actually, when the module is enabled/disabled, it shouldn't be in combat, so I could have called PLAYER_REGEN_ENABLED, but just in case.~~ To initialize AuraUtil's internal variable cachedVisualizationInfo, I triggered the PLAYER_REGEN_ENABLED event when the aura module is enabled/disabled (I only used PLAYER_REGEN_ENABLED because it can only be enabled/disabled when the module is not in combat).