Page 1 of 1

Addon Help: Checking Buffs on player

Posted: Fri Jan 29, 2016 3:15 pm
by Micbran
So, for the on_pre_use function that can be defined for a talent, it obviously returns a boolean But, I was wondering how do you check if the player has a certain buff/debuff on them? And a little bit more than that, how can you check how many stacks of that buff/debuff are on and then shove all that in the on_pre_use function? Thanks in advance.

Re: Addon Help: Checking Buffs on player

Posted: Fri Jan 29, 2016 4:05 pm
by darkgod

Code: Select all

if self:hasEffect(self.EFF_FOO) then ...
Has for how many stacks you'll have to check the particular effect code; they dont have all stacks (most dont)

Re: Addon Help: Checking Buffs on player

Posted: Sat Jan 30, 2016 12:28 pm
by stinkstink
I like to add the following function to effects that are going to have their number of charges checked:

Code: Select all

getCharges = function(self, eff) return eff.cur_charges end,
That way when I want to check if the effect is active and how many stacks are applied, I can just use

Code: Select all

local charges = self:callEffect("EFF_EFFECT_NAME", "getCharges") or 0

Re: Addon Help: Checking Buffs on player

Posted: Fri Aug 19, 2016 12:23 am
by Nagyhal
That's a fantastic bit of ToME shorthand, stinkstink!

Re: Addon Help: Checking Buffs on player

Posted: Wed Aug 24, 2016 8:53 am
by Zireael
Nagyhal wrote:That's a fantastic bit of ToME shorthand, stinkstink!
I concur, this is excellent!