WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Filtering out buffs on standard raid UI (https://www.wowinterface.com/forums/showthread.php?t=59249)

vbezhenar 10-08-22 04:42 AM

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.


All times are GMT -6. The time now is 11:38 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI