Thread Tools Display Modes
Prev Previous Post   Next Post Next
02-25-19, 03:51 PM   #1
wille480
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 56
Smart way to register unit aura event for all raid members

Hello! So i am reaching out for some smart advice to register every raid member in a a raid on the unit_aura event.

Some quick info about the addon: I am gathering each raid members debuffs (UnitDebuff()) and checking if a debuff on the raid member exists in my pre defined list of debuffs that i am checking.

How would a smart way be to register all the raid members on the event "UNIT_AURA" for this?

What i currently have is something along this line

Lua Code:
  1. local frame = CreateFrame("FRAME", nil); -- Frame that register various events in the world
  2.  
  3. function frame:UNIT_AURA()
  4.     -- check if every raid member inside my raid have any of the following debuffs in my debuff list
  5. end
  6.  
  7. function frame:PLAYER_ENTERING_WORLD(event, ...)
  8.     if(IsInRaid("player")) then --
  9.         for i = 1, MAX_RAID_MEMBERS do --(40)
  10.             if(UnitName("raid"..i) ~= nil) then
  11.                 frame:RegisterEvent("UNIT_AURA", "raid"..i)
  12.             end
  13.         end
  14.     end
  15. end
  16.  
  17.  
  18. frame:SetScript("OnEvent", function(self, event, ...)
  19.         self[event](self, event, ...)
  20.     end)
  21. frame:RegisterEvent("PLAYER_ENTERING_WORLD");

Would this be a good and smart way to register all the raid members under the event "UNIT_AURA" in order to check the raid members for debuffs? It is important for me to have the frame:UNIT_AURA() function executed whenever anything in regards to debuffs happends on whatever player in my raid. Kinds regards!

Last edited by wille480 : 02-25-19 at 03:54 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Smart way to register unit aura event for all raid members

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