Thread: UnitAura API
View Single Post
04-16-18, 06:41 AM   #1
doofus
A Chromatic Dragonspawn
Join Date: Feb 2018
Posts: 158
UnitAura API

Maybe I should be doing more testing while trying this but thought of asking here, in case you get there before me.

I am using the UnitAura API to read buffs and debuffs on friendly players, party and raid members, and on hostile targets.

For friendly players I need to know their buffs and debuffs, eg does this player got a Rejuvenation ticking, and does he have a debuff I could (the "player") potentially dispel ?

I can read buffs OK using

Code:
    bf_name, bf_rank, bf_icon, bf_count, bf_debuffType, bf_duration, bf_expirationTime, bf_unitCaster, bf_canStealOrPurge, bf_nameplateShowPersonal, bf_spellId, bf_canApplyAura, bf_isBossDebuff, bf_isCastByPlayer, bf_nameplateShowAll, bf_timeMod = UnitAura(unit_codename, i,"HELPFUL");
    if ( bf_name == nil ) then break; end;
    bf_duration = bf_expirationTime - GetTime();
    if ( bf_duration < 0 ) then bf_duration = 3600; end;
    if ( bf_isCastByPlayer or bf_unitCaster == "player" or bf_unitCaster == "pet" ) then
        do something with this buff
    end
I am using castbyPlayer and uni9tCaster=="player" to know these are my buffs, and therefore this Rejuvenation is mine.

But now we move on to debuffs and would like to know if the friendly player has any debuffs I could remove.

I use something very similar to the above:

Code:
    bf_name, bf_rank, bf_icon, bf_count, bf_debuffType, bf_duration, bf_expirationTime, bf_unitCaster, bf_canStealOrPurge, bf_nameplateShowPersonal, bf_spellId, bf_canApplyAura, bf_isBossDebuff, bf_isCastByPlayer, bf_nameplateShowAll, bf_timeMod = UnitAura(unit_codename, i,"HARMFUL");
    if ( bf_name == nil ) then break; end;
    bf_duration = bf_expirationTime - GetTime();
    if ( bf_duration < 0 ) then bf_duration = 3600; end;
    if ( bf_canStealOrPurge ) then
    then
                do something with this debuff
    end
The only way I have found to test this code (some help here please) is in Mythic dungeons where sometimes there are dispellable debuffs on players - it is a cumbersome and timewasting process and so far the above code does not work very well, or at all, it does not work at all. If I allow for all debuffs to be returned then I receive debuffs which I cannot dispell so it seems this flag is to blame ()but am still debugging).

Any help greatly appreciated.
  Reply With Quote