Posted by shagaal on Sat, 22 Sep 2012 23:08:56
Might be a very simple problem, but i searched for more than one hour and couldn't find an answer: Is there any way to get the remaining time of an buff by spellID (BuffID)? Currently I am using the UnitBuff function. But this function can only return the expiration time based on the buffs name. Since there are multiple buffs active with the same name, this is totally unrelyable.
Once there was a function "GetPlayerBuff" to get Buffs by buffID, but its was removed. Since "UnitBuff" seams to be the only remaining function get buff information, I guess its necessary to access the buff by its index. But how to get a buff-index from the BuffID? (buff indexes are never constant)
someone gots an idea ?
Posted by nefertem on Sat, 22 Sep 2012 23:19:10
As I understand your problem, you need to be able to differentiate between different buffs having the same name. UnitAura() gets you as much information about the particular aura as is available.
name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitAura("unit", index [, "filter"]) or UnitAura("unit", "name" [, "rank" [, "filter"]])
There are lots of ways to distinguish one buff from another with the same name. You can do it by caster, or maybe by expires.
I get the feeling you might need to iterate through all the buffs to do what you want, if so, here is some old code that may help:
for i=1,40,1 do -- Check for Affliction local n,_,_,_,btype = UnitAura(mon.Unit,i,"HARMFUL") if not n then break end -- Done looking. aff = string.find(mon.Deflict,btype or "nothing") ~= nil -- nil or indices end
Posted by shagaal on Sun, 23 Sep 2012 09:55:21
Ahh of course :) Implemented it and it works perfect, tank you very much!