Page 1 of 1

getting name or spellid for buffs/debuffs

PostPosted: Mon Oct 05, 2015 12:38 pm
by modernist
is this basically impossible? even api like GetPlayerBuffName() doesn't seem to exist in 1.12. i'm looking to match names or ids from a table when UNIT_AURA is called — but there's pretty much bugger all way to do it as I can see.

best alternative i can find is matching based on the icon texture path:

Code: Select all
f:SetScript('OnEvent', function()
    local buffs = {}
    local aura_on
    local j = 0
    for i = 1, 16 do
        local icon = UnitBuff('player', i)
        if icon ~= nil then
            buffs[i] = icon
            j = j + 1
        end
    end
    for i = 1, j do
        local aura_on = string.find(buffs[i], table.iconpath)
        if aura_on ~= nil then
            DEFAULT_CHAT_FRAME:AddMessage'icon match'
        end
    end
end)


but obviously this is a terrible and non-workable method, nobody is gonna know what the texture path for their spell is

Re: getting name or spellid for buffs/debuffs

PostPosted: Mon Oct 05, 2015 1:07 pm
by Geigerkind
What you could do is to get the buff name by the GameTooltip. After that you just iterate in your own table to find the spellID. But as far as I know there is no way in vanilla to get the SpellId directly

Re: getting name or spellid for buffs/debuffs

PostPosted: Mon Oct 05, 2015 4:12 pm
by modernist
oh that works, neat.

https://github.com/obble/modup/blob/master/spell.lua

this write-up is now actually partially based on your method for PA — i'm having an issue where the event won't actually push until the aura is removed (rather than applied). Any idea if I'm doing something dumb here?

Re: getting name or spellid for buffs/debuffs

PostPosted: Mon Oct 05, 2015 4:23 pm
by Geigerkind
The UNIT_AURA event is different and weaker as in other expansions. In Wotlk I think all aura based events were merged into UNIT_AURA.
In vanilla you have to use a bunch of events in order to track them properly.
If you are only using it for the player auras PLAYER_AURAS_CHANGED should be fine.

Re: getting name or spellid for buffs/debuffs

PostPosted: Mon Oct 05, 2015 4:58 pm
by modernist
fantastic, thanks