Thread Tools Display Modes
Prev Previous Post   Next Post Next
11-20-23, 12:21 PM   #1
fatrog
A Fallenroot Satyr
Join Date: Nov 2022
Posts: 21
Troubles checking debuff on raid members

Hello,

I have made a custom tiny addon just for my personal use. (It helps me getting better with addon making)
My goal is to put a symbol on the 4 players who got the debuff "Controlled Burn" (used by the first boss of the new raid)

But despite what I tried, I can't get it working...

Here is my actual code so far:

Lua Code:
  1. local raidTargetIcons = {1, 2, 3, 4}
  2.  
  3. local function UpdateRaidDebuffList()
  4.     for i = 1, GetNumGroupMembers() do
  5.         local unit = "raid" .. i
  6.         for j = 1, 40 do
  7.             local _, _, _, _, _, _, _, _, _, _, spellId, _, _, _, _, _, castSuccess = UnitDebuff(unit, j)
  8.             if not spellId then
  9.                 break
  10.             end
  11.  
  12.             if spellId == 421972 and castSuccess then
  13.                 local icon = table.remove(raidTargetIcons)
  14.                 if icon then
  15.                     print(GetUnitName(unit, true) .. " has successfully cast Controlled Burn.")
  16.                     ApplyRaidTargetIcon(unit, icon)
  17.                 end
  18.                 break
  19.             end
  20.         end
  21.     end
  22. end
  23.  
  24. local function ApplyRaidTargetIcon(unit, icon)
  25.     SetRaidTarget(unit, icon)
  26. end
  27.  
  28. local function ClearRaidTargetIcon(unit)
  29.     SetRaidTarget(unit, 0)
  30. end
  31.  
  32. local function OnEvent(_, event, _, sourceGUID, _, _, _, _, _, destGUID, _, _, spellId)
  33.     if event == "COMBAT_LOG_EVENT_UNFILTERED" then
  34.     elseif event == "SPELL_AURA_REMOVED" and spellId == 421972 then
  35.         local destName = GetUnitName(destGUID, true)
  36.         if destName then
  37.             local icon = GetRaidTargetIndex(destName)
  38.             if icon then
  39.                 table.insert(raidTargetIcons, icon)
  40.                 ClearRaidTargetIcon(destName)
  41.                 print(destName .. "'s Controlled Burn debuff has been removed.")
  42.             end
  43.         end
  44.     end
  45. end
  46.  
  47. local frame = CreateFrame("Frame")
  48. frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  49. frame:SetScript("OnEvent", OnEvent)
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Troubles checking debuff on raid members


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