Quantcast WoWInterface - View Single Post - Check if debuff exists in game
View Single Post
08-19-14, 11:18 AM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,739
Well. You could do sth else. You could register UNIT_AURA to a specific event frame.

Each time UNIT_AURA triggers you can check
Lua Code:
  1. --get db via VARIABLES LOADED and saved variables
  2. local debuffList = DB.debuffList or {}
  3.  
  4. local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil
  5.  
  6. local function SearchAuras(self,event,unit)
  7.   if not debuffList then return end
  8.   for i=1,40 do
  9.     name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = UnitDebuff(unit,i)
  10.     if not name then break end
  11.     if not debuffList[spellId] then
  12.       debuffList[spellid] = {name = name, rank = rank, icon = icon, debuffType = debuffType, spellId = spellId}
  13.     end
  14.   end
  15. end
  16.  
  17. local auraCheck = CreateFrame("Frame")
  18. auraCheck:SetScript("OnEvent",SearchAuras)
  19. auraCheck:RegisterEvent("UNIT_AURA")

All spells are spells. Some spells are auras. Some less spells are debuffs.

UnitDebuff (aka. UnitAura, HARMFUL) may deliver even more values. You can check that by doing print(UnitDebuff(unit,i)).
http://wowprogramming.com/docs/api/UnitAura
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 08-19-14 at 11:28 AM.
  Reply With Quote