I'm completely new to LUA and WoW Addons and am the kind of person to learn as I code.
I'm writing an addon for a guild member as my first project and may, if I think it's good enough, release it to the community.
What I am trying to do sounds fairly simple but I'm having a hard time understanding some of the functions and events.
Here's what I'm trying to do... It's for Warlocks only!
- When the lock uses a SS on a character (either a party/raid member or themselves) remember that target.
- When the SS fades alert the Lock via some kind of visual and/or audio warning, and the player (if different) via a whisper.
- If the SS Target dies or otherwise looses the SS Notify the lock and SS Target of the remaining cooldown before a new SS will be available (Note: I do not want the lock to have to have one in their bag for this to work)
- If the SS Target has died or otherwise lost the SS notify both lock and SS target at a user defined interval of the remaining cooldown. i.e. 5 mins remaining, 1 min remaining and finally the instant it has cooled down.
What I need to know is what events I should be looking for. I've looked on wow-wiki and couldn't see any that fit what I need but from examples I've seen of other addons the events are not always clear what they do.
UNIT_AURA could be used to handle the first two, but your handler would probably have to poll all buffs of the affected unit (using UnitAura()) looking for a soulstone that was cast by you (UnitAura() gives a lot of return values, check the wowwiki doc on it).
Maybe someone else knows a more efficient event to just look for this one aura?
You want to watch for their buffs/debuffs changes, that is, the UNIT_AURA event, as previously mentioned. "Aura" is just a general word that encompasses both buffs and debuffs, which are more specific terms.
UNIT_AURA will fire with arg1 equal to the unitID of the unit that changed auras, you could then use UnitBuff(unitID, "Soulstone") or whatever the buff name is to check for its existence.
You'll also want to watch for when you actually do the casting of Soulstone and not for when somebody else does so you'll want to use UNIT_SPELLCAST_SUCCEDDED (I swear target is also one of the args but its only target name and not unitid or guid).