Quantcast
LUA: Detecting stealth in WeakAuras 2 - WoWInterface
Thread Tools Display Modes
07-28-18, 09:35 AM   #1
Felankor
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: May 2007
Posts: 26
Question LUA: Detecting stealth in WeakAuras 2

Hi,

I'm trying to set up WeakAuras for a friends rogue. He want's it to show when it's good to re-apply things like rupture (E.g. if he opened from stealth using rupture it's better to wait until the DoT ends before using it again as the new DoT will do less damage, and to include the pandemic timer etc). Using /run in game I can detect stealth using `UnitAura` but it's not working in WeakAuras.

Trigger: COMBAT_LOG_EVENT_UNFILTERED

Lua Code:
  1. function(event, ...)
  2.    
  3.     local wa_stealthed, wa_vanishing
  4.    
  5.     for i=1,40 do
  6.         appliedBuff = UnitAura("player", i, "PLAYER|HELPFUL")
  7.         if (select(1, appliedBuff) == "Stealth") then
  8.             DEFAULT_CHAT_FRAME:AddMessage("Detected Stealth...");
  9.             wa_stealthed = appliedBuff
  10.         elseif (select(1, appliedBuff) == "Vanish") then
  11.             DEFAULT_CHAT_FRAME:AddMessage("Detected Vanish...");
  12.             wa_vanishing = appliedBuff
  13.         end
  14.     end
  15. -- Next I detect rupture from the event and determine what to display etc.
  16. end

The chat messages in the code above never appear in chat when Rupture triggers the event, but it works in chat with /run (although I need to remove the elseif and variables to shorten it to fit in chat).

All I can think of is that by the time Rupture triggers the event it has already removed stealth from the player. So I added a second event `UPDATE_STEALTH` to the same trigger just to see if it would work but when entering and leaving stealth that event doesn't fire.

Can anyone suggest another way to do this? Alternatively is it possible to detect how much damage the DoT is doing vs how much the next one will do?

Thanks
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LUA: Detecting stealth in WeakAuras 2

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