In that case, just remove that entire SPELL_CAST_SUCCESS block. That event fires when the spell finishes casting, no matter if it took effect on the target or not. I would also suggest havint the spell check before the other conditionals since no matter what event type is triggered, you'd want to exit if it's a spell you want to exclude.
This is what I have in mind:
Lua Code:
-- Spell List
local spellData = {
-- Class Spells
[2139] = { -- Counterspell
cooldown = 24,
-- texture = "Interface\\Icons\\spell_frost_iceshock",
},
[1766] = { -- Kick
cooldown = 15,
},
[47528] = { -- Mind Freeze
cooldown = 15,
},
[6522] = { -- Pummel
cooldown = 15,
},
[96231] = { -- Rebuke
cooldown = 15,
},
[80964] = { -- Skull Bash (Bear Form)
cooldown = 15,
},
[80965] = { -- Skull Bash (Cat Form)
cooldown = 15,
},
[57994] = { -- Wind Shear
cooldown = 12,
},
[34490] = { -- Silencing Shot
cooldown = 20,
},
[15487] = { -- Silence (Priest)
cooldown = 45,
},
[47476] = { -- Strangulate
cooldown = 120,
},
-- [108194] = { -- Asphyxiate
-- cooldown = 20,
-- },
[116705] = { -- Spear Hand Strike
cooldown = 15,
},
-- Racials
[28730] = { -- Arcane Torrent (Mana)
cooldown = 120,
},
[50613] = { -- Arcane Torrent (Runic Power)
cooldown = 120,
},
[80483] = { -- Arcane Torrent (Focus)
cooldown = 120,
},
[129597] = { -- Arcane Torrent (Chi)
cooldown = 120,
},
[25046] = { -- Arcane Torrent (Energy)
cooldown = 120,
},
[69179] = { -- Arcane Torrent (Rage)
cooldown = 120,
},
}
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
eventFrame:SetScript("OnEvent", function(self,event, _, combatEvent, _, sourceGUID, _, _, _, _, destName, _, _, spellID, spellName, _, extraSpellID)
-- Only allow player and specific spells we handle
local spell=spellData[spellID]
if sourceGUID ~= UnitGUID("Player") or not spell then
return
end
-- Success/Fail Messages
if combatEvent == "SPELL_INTERRUPT" then
SendChatMessage(format("%s > %s's %s",GetSpellLink(spellID),destName,GetSpellLink(extraSpellID)),"Say")
elseif combatEvent == "SPELL_CAST_MISSED" then
SendChatMessage(format("%s has failed to interrupt !!! %.0fs CD",GetSpellLink(spellID),spell.cooldown),"Say")
elseif combatEvent == "SPELL_CAST_FAILED" then
-- Remaining Time Message
local start, duration, enabled = GetSpellCooldown(spellID)
if enabled==1 and duration>0 then
SendChatMessage(format("%s's CD has %0.1fs left", GetSpellLink(spellID), (start + duration) - GetTime()), "Say")
end
end
end)
Note, I shortened the code a bit, renamed the variables receiving
GetSpellCooldown()'s returns to conform with
Blizzard's Add-On Development Policy regarding obfuscation, and cleaned up the event handler's parameters. The unused handler parameters have been renamed to the variable
_ , which even though it's considered in Lua as just another variable, it's commonly used for this and is easier to distinguish as a value that isn't important.
EDIT: Removed the condition for SPELL_AURA_APPLIED since in some cases, it may cause spaming when using an AoE ability like Arcane Torrent. This will also fix some cases of success messages sending twice.
Note, SPELL_CAST_FAILED should also be considered for possible spam as some players may "mash" the ability when trying to cast it.