View Single Post
01-24-19, 05:25 PM   #1
FranekW
A Cyclonian
 
FranekW's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 44
Track a debuff and start a timer when it's removed

Hello,

I am trying to build a simple function which will track a certain debuffs, that is to track moments when debuffs are applied and when they are removed. Then I would like to start a simple timer when the debuff which I track is over.

First I tried using UNIT_AURA but it gets fired every time a debuff changes or do damage to a unit. Then I came across COMBAT_LOG_EVENT, which is quite complicated. I have a simple function which I tried to create based on wowpedia and some code from WoW Interface:

Lua Code:
  1. function(timestamp, event, hideCaster,
  2.     sourceGUID, sourceName, sourceFlags, sourceRaidFlags,
  3.     destGUID, destName, destFlags, destRaidFlags, spellId, spellName, spellSchool, ...)
  4.  
  5.     if event == "SPELL_AURA_APPLIED" or event == "SPELL_AURA_REFRESHED" then
  6.         auraType, amount = ...
  7.         if auraType == "DEBUFF" then
  8.             -- Check the debuff is in the list to track
  9.             -- cache Target's GUID and the debuff's ID
  10.         end
  11.     elseif event == "SPELL_AURA_REMOVED" then
  12.         auraType, amount = ...
  13.         if check whether you track that debuff then
  14.             -- Check if debuff is in cache, if it was applied
  15.             -- if Yes, removed from cache and start a timer
  16.         end
  17.     else
  18.         -- do things in case debuff was neither atarted nor removed
  19.     end
  20. end

So the above function is run such that I pass all parameters COMBAT_LOG_EVENT returns. Is this function any close to do what I need it to do? I am simply need to know what aura is applied to a target and when it is over. Then I would like to start a timer.

Thanks.
  Reply With Quote