Tracking debuffs on multiple units affected by AoE spells
What would be the best way to track multiple targets affected by multiple AoE spells?
Each AoE spell applies the same debuff to all units within the area of effect e.g. Druid Feral's Thrash is a multitarget spell which doesn't need a valid single target but applies DoTs to all non-friendly units including invisible units. Similarly, Primal Wrath does the same with a different debuff.
I made a simple function with Thrash. It is logged by CLEU using subevents such as "SPELL_DAMAGE", "SPELL_CAST_SUCCESS", "SPELL_CAST_FAILED", etc. I tried the following code:
but the table auratable.targets is empty after each combat session.
I thought about catching the "UNIT_AURA" event and if a nameplate gains a debuff but having to test 40 units and checking 40 indices of possible debuff per unit each time I apply one of the AoE spells seems like a lot of loops to do.
The IDs referenced in the CLEU are GUIDs. Any ID used for a unit frame is a Unit ID(or token) which normally refers to a frame that can be referenced, or created securely.
You can cache the GUIDs when nameplates are added/removed and use those to check applicable units in the CLEU so you can avoid multiplicative aura scans, especially if you'd be scanning nameplates and raid frames.
Performance tip: Cache the player GUID in the frame your using for the CLEU event and put the IF statements inside the player check.
And move that player GUID check outside of your OnEvent function. You should just need to grab it once.
First of all, thanks for the performance tip.
Second, I should have mentioned that the function is a part of a lua code inside WeakAuras. I don't fully understand the bit with frame reference. I think you are just pointing out the difference between UnitID related to a frame and unitGUID in CLEU. If I query a unit using `UnitGUID` I should get the unit's GUID. Is that correct?
Regarding the second point, is my approach with for loop good enough for adding / removing nameplates from cache? I am thinking about something like event where a player gets new nameplate etc.
|All times are GMT -6. The time now is 09:50 PM.|
vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI