function(event, ...)
WA_killcommandwait_threshold = 0.3 -- Set threshold here
WA_killcommandwait_wait = WA_killcommandwait_wait or 0
if event == "PLAYER_REGEN_DISABLED" then
local s_kc, d_kc = GetSpellCooldown(34026)
local t = GetTime()
WA_killcommandwait_wait = s_kc + d_kc - t
if WA_killcommandwait_wait <= WA_killcommandwait_threshold then
return true
end
elseif event == "SPELL_COOLDOWN_READY" then
local spellId = ...
if spellId == 34026 then
WA_killcommandwait_wait = 0
return true
end
elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then
local _, message, _, _, sourceName, sourceFlags, _, _, _, _, _, spellId = ...
if message == "SPELL_CAST_START" or message == "SPELL_CAST_SUCCESS" then
if bit.band(sourceFlags, 0x511) == 1297 then
if message == "SPELL_CAST_START" and spellId == 77767 then
local s_kc, d_kc = GetSpellCooldown(34026)
local _, _, _, _, _, _, cast_cs = GetSpellInfo(77767)
local t = GetTime()
WA_killcommandwait_wait = s_kc + d_kc - t - cast_cs/1000
if WA_killcommandwait_wait <= WA_killcommandwait_threshold then
return true
end
elseif spellId == 34026 then
WA_killcommandwait_wait = 5
return false
elseif spellId ~= 77767 then
local s_kc, d_kc = GetSpellCooldown(34026)
local s_cs, d_cs = GetSpellCooldown(77767)
WA_killcommandwait_wait = s_kc + d_kc - s_cs - d_cs
if WA_killcommandwait_wait <= WA_killcommandwait_threshold then
return true
end
end
end
end
end
return false
end