Code:
if not JukeTable then Juketable = {} end
if not EventHandlerLog then
EventHandlerLog = CreateFrame('Frame')
EventHandlerLog:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
function OnSuccessfulCast(self, event, ...)
local timestamp, type, hideCaster, sourceGUID, sourceName, sourceFlags, sourceFlags2, destGUID, destName, destFlags, destFlags2 = select(1, ...)
--print("timestamp = "..timestamp, " type = "..type, " sourceGUID = "..sourceGUID, " sourceName = "..sourceName, " sourceFlags = "..sourceFlags, " sourceflags2 = "..sourceFlags2, " destGUID = "..destGUID, " destName = "..destName, " destFlags = "..destFlags, " destFlag2 = "..destFlags2)
local COMBATLOG_OBJECT_TYPE_PLAYER = COMBATLOG_OBJECT_TYPE_PLAYER
local COMBATLOG_OBJECT_CONTROL_PLAYER = COMBATLOG_OBJECT_CONTROL_PLAYER
local COMBATLOG_OBJECT_REACTION_HOSTILE = COMBATLOG_OBJECT_REACTION_HOSTILE
local COMBATLOG_OBJECT_REACTION_FRIENDLY = COMBATLOG_OBJECT_REACTION_FRIENDLY
local COMBATLOG_OBJECT_REACTION_NEUTRAL = COMBATLOG_OBJECT_REACTION_NEUTRAL
local isFriendlySource = (bit.band(sourceFlags,COMBATLOG_OBJECT_REACTION_FRIENDLY) == COMBATLOG_OBJECT_REACTION_FRIENDLY)
local isPlayerSource = (bit.band(sourceFlags, COMBATLOG_OBJECT_TYPE_PLAYER) == COMBATLOG_OBJECT_TYPE_PLAYER) or (bit.band(sourceFlags, COMBATLOG_OBJECT_CONTROL_PLAYER) == COMBATLOG_OBJECT_CONTROL_PLAYER)
local isHostileSource = (bit.band(sourceFlags,COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE)
local isNeutralSource = (bit.band(sourceFlags,COMBATLOG_OBJECT_REACTION_NEUTRAL) == COMBATLOG_OBJECT_REACTION_NEUTRAL)
if (event=="COMBAT_LOG_EVENT_UNFILTERED") then
local InterruptSpells = {
{Spell = "Mind Freeze", Cooldown = 15 },
{Spell = "Strangulate", Cooldown = 120},
{Spell = "Skull Bash", Cooldown = 15},
{Spell = "Solar Beam", Cooldown = 60},
{Spell = "Counter Shot", Cooldown = 24},
{Spell = "Counterspell", Cooldown = 24},
{Spell = "Spear Hand Strike", Cooldown = 15},
{Spell = "Avenger's Shield", Cooldown = 15},
{Spell = "Rebuke", Cooldown = 15},
{Spell = "Silence", Cooldown = 45},
{Spell = "Kick", Cooldown = 15},
{Spell = "Deadly Throw", Cooldown = 0},
{Spell = "Wind Shear", Cooldown = 12},
{Spell = "Spell Lock", Cooldown = 24},
{Spell = "Optical Blast", Cooldown = 24},
{Spell = "Pummel", Cooldown = 15}
-- Add more if you want, make sure to format it correctly
}
if (type == "SPELL_AURA_APPLIED")
or (type == "SPELL_CAST_SUCCESS") then
local spellID, spellName, spellSchool = select(12, ...)
for i=1, #InterruptSpells do
if InterruptSpells[i].Spell == spellName then
if destGUID == UnitGUID("player") then
local tspell, _, _, _, tstart, tend, _, _, tint = UnitCastingInfo("player")
local tchannel, _, _, _, tchannelstart, tchannelend, _, tchannelint = UnitChannelInfo("player")
if tint or tchannelint then
-- if immune to disrupts, then return
return
else SpellStopCasting()
-- else stop spell casting
end
end
if not isHostileSource and not isNeutralSource then return end
if isFriendlySource and not isNeutralSource then return end
if not isPlayerSource and not isNeutralSource then return end
-- these are filters for enemy so we don't track friendly disrupts
if( not JukeTable[sourceGUID] ) then
JukeTable[sourceGUID] = {}
end
if( not JukeTable[sourceGUID][InterruptSpells[i].Spell]) then
JukeTable[sourceGUID][InterruptSpells[i].Spell] = { time = GetTime(), reset = InterruptSpells[i].Cooldown + GetTime() }
--This tracks GUID interrupt cooldown in a table
end
end
end
end
end
end
EventHandlerLog:SetScript('OnEvent', OnSuccessfulCast)
EventHandlerLog = true
end