View Single Post
10-08-22, 04:42 AM   #1
vbezhenar
A Murloc Raider
Join Date: Sep 2016
Posts: 4
Filtering out buffs on standard raid UI

Standard raid UI shows unwanted buffs for paladins. Like auras, blessings. There're only 3 icons for buffs, so that causes obvious issues when I need to track sacred shield of beacon of light.

I'm talking about classic WotLK, btw.

I digged to CompactUnitFrames code and found out that there's a function CompactUnitFrame_UtilShouldDisplayBuff which determines whether a particular buff should be displayed or not.

I tried to replace that function with my own code. Something like

Code:
local original_CompactUnitFrame_UtilShouldDisplayBuff = CompactUnitFrame_UtilShouldDisplayBuff;

CompactUnitFrame_UtilShouldDisplayBuff = function (unit, index, filter)
	local _, _, _, _, _, _, _, _, _, spellId = UnitBuff(unit, index, filter);
	local hide = hideBuffs[spellId];
	if hide == nil then
		return original_CompactUnitFrame_UtilShouldDisplayBuff(unit, index, filter);
	elseif hide then
		return false;
	else
		return original_CompactUnitFrame_UtilShouldDisplayBuff(unit, index, filter);
	end
end;
And this approach actually worked for me. But I stumbled upon another issue: when one player left in combat, unit frames became buggy.

It's my understanding that I somehow tainted the frames with my code and so they don't react to roster changes in combat anymore.

While that's an acceptable compromise for me, I still want to know if there's a way to do what I want the other way, without causing issues with taints.

Here's original Blizzard implementation:

Code:
function CompactUnitFrame_UtilShouldDisplayBuff(unit, index, filter)
	local name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, _, spellId, canApplyAura = UnitBuff(unit, index, filter);

	local hasCustom, alwaysShowMine, showForMySpec = SpellGetVisibilityInfo(spellId, UnitAffectingCombat("player") and "RAID_INCOMBAT" or "RAID_OUTOFCOMBAT");

	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 SpellIsSelfBuff(spellId);
	end
end
I think that I can override UnitBuff or SpellGetVisibilityInfo but I somehow feel like this will not solve anything but cause more issues.

I'm aware of hooksecurefunc function, but according to its description I can't return different value for a hooked function which makes it useless for my purposes.
  Reply With Quote