Thread Tools Display Modes
Prev Previous Post   Next Post Next
05-30-21, 09:14 PM   #1
Tair
A Deviate Faerie Dragon
Join Date: Aug 2020
Posts: 10
[TBC] Merge multiple event triggers into one notification? (Paladin's taunt))

Hi all,

I enjoy learning to write simple addons as I come across things in-game that I would like to add notifications for. I have a problem that I'm not sure how to solve and would really appreciate the input from more experienced authors.

In TBC, Paladins have the Righteous Defense spell, which applies an aura to up to 3 enemies. I'd like to track which targets are affected and print the names of those targets in a single message. The single message part is where I'm not sure how to proceed.

I've figured out how to detect and print which targets are taunted:

lua Code:
  1. if subevent == "SPELL_AURA_APPLIED" then
  2.      spellId, spellName, spellSchool = select(12, ...)
  3.      if spellName == "Righteous Defense" and Tair_BattleLog_SourceIsPlayer(sourceName) then
  4.           print("Taunted "..destName)
  5.      end
  6. end

Which prints up to 3 lines of target names. I'd like to combine that into a single message, so my next thought was to add them to a table:

lua Code:
  1. local tauntedMobs = {}

lua Code:
  1. if subevent == "SPELL_AURA_APPLIED" then
  2.      spellId, spellName, spellSchool = select(12, ...)
  3.      if spellName == "Righteous Defense" and Tair_BattleLog_SourceIsPlayer(sourceName) then
  4.           --print("Taunted "..destName)
  5.           table.insert(tauntedMobs, destName)
  6.      end
  7. end

I know that I can output the table of targets with table.concat, but my hurdle is that I'm not sure when I can actually call that and get the final list of targets.

Potential ideas I've had:
  • Maybe using UNIT_THREAT_LIST_UPDATE to print the table, assuming that it might have all of the targets at that point
  • Setting a timer function for some short duration to allow the table to populate before printing the list of targets

Hopefully I described things clearly enough. Thanks for reading this far!

Edit: I thought I ought to add a summary since the majority of the post just explained my thought process. I want to print a single message with the name of every target that has an aura applied as a result of a specific spell. So, as an example:

Righteous Defense: Scarlet Protector, Scarlet Defender, Scarlet Monk
Frost Nova: Scarlet Protector, Scarlet Defender, Scarlet Monk

I'm a little bit stuck because I'm not sure how to best take the multiple SPELL_AURA_APPLIED events that fire and combine them into a single message that captures the entire list of targets.

Last edited by Tair : 05-30-21 at 09:28 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » [TBC] Merge multiple event triggers into one notification? (Paladin's taunt))

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off