. Basically your switching whole interrupt code with this one posted, implemented both Pummel and Disrupting Shout.
Code:
CML_Interrupts = nil
function CML_Interrupts()
-- Credit goes to Xelper for his interupt code. Thank you very much Xelper!!
if not PummelCheck then
return false
end
if RandomPummel == nil then
if Pummel == 1 then RandomPummel = math.random(0,50) end
if Pummel == 2 then RandomPummel = 30 end
if Pummel == 3 then RandomPummel = 0 end
end
function PQR_InterruptSpell()
if IsPlayerSpell(6552) and PQR_SpellAvailable(6552) then --Pummel
return 6552
elseif IsPlayerSpell(102060) and PQR_SpellAvailable(102060) then -- Disrupting Shout
return 102060
else
return 0
end
end
local PQR_InterruptPercent = Pummel
local interruptSpell = PQR_InterruptSpell()
local interruptName = GetSpellInfo(interruptSpell)
InterruptTargetsList = { "target", "focus", "mouseover" }
-- Interrupt Casts and Channels on Target and Focus.
if interruptSpell ~= 0 then
for i = 1, #InterruptTargetsList do
local customTarget = InterruptTargetsList[i]
local castName, _, _, _, castStartTime, castEndTime, _, _, castInterruptable = UnitCastingInfo(customTarget)
local channelName, _, _, _, channelStartTime, channelEndTime, _, channelInterruptable = UnitChannelInfo(customTarget)
if channelName ~= nil then
--target is channeling a spell that is interruptable
--load the channel variables into the cast variables to make logic a little easier.
castName = channelName
castStartTime = channelStartTime
castEndTime = channelEndTime
castInterruptable = channelInterruptable
PQR_InterruptPercent = 0
local IsChannel = true
end
--This is actually "Not Interruptable"... so lets swap it around to use in the positive.
if castInterruptable == false then
castInterruptable = true
else
castInterruptable = false
end
if castInterruptable then
local timeSinceStart = (GetTime() * 1000 - castStartTime) / 1000
local timeLeft = ((GetTime() * 1000 - castEndTime) * -1) / 1000
local castTime = castEndTime - castStartTime
local currentPercent = timeSinceStart / castTime * 100000
if IsSpellInRange(GetSpellInfo(23881), customTarget) ~= nil
and ( currentPercent > PQR_InterruptPercent or interruptSpell ~= 6552 )
and UnitCanAttack("player", customTarget) ~= nil then
--target is casting something that is interruptable.
--the following 2 variables are named logically... value is in seconds.
if InteruptTimer == nil
or InteruptTimer <= GetTime() - 1.25 then
if currentPercent < RandomPummel and not IsChannel then return false end
CastSpellByID(interruptSpell, customTarget)
InteruptTimer = GetTime()
end
end
end
end
end
end