I've looked through the core.lua for PE to get a sense of how it handles its custom condition "interruptat":
At first we've got
Code:
ProbablyEngine.condition.register('interruptAt', function (target, spell)
if ProbablyEngine.condition['modifier.toggle']('interrupt') then
if UnitName('player') == UnitName(target) then return false end
local stopAt = tonumber(spell) or 95
local secondsLeft, castLength = ProbablyEngine.condition['casting.delta'](target)
if secondsLeft and 100 - (secondsLeft / castLength * 100) > stopAt then
return true
end
end
return false
end)
So it checks whether the toggle button is pressed, then it checks if your target is yourself. If so then don't execute. Of course.
Then it sets up local the variables to do the calculations for the countdown timer (the interrupt at "x percent during cast")
Here it calls upon a separate custom condition named "casting.delta" to get the cast time variables for the calculation.
Then it does the math, and execute, we'll get our interrupt. Cool.
So let's head over to "ProbablyEngine.condition['casting.delta'](target)" to see how that work.
Code:
ProbablyEngine.condition.register('casting.delta', function(target, spell)
local name, startTime, endTime, notInterruptible = checkCasting(target)
if name and not notInterruptible then
local castLength = (endTime - startTime) / 1000
local secondsLeft = endTime / 1000 - GetTime()
return secondsLeft, castLength
end
return false
end)
Here we see it call upon another custom function called checkCasting(target), then it checks if the name of the spell is the same, and if it is interruptible (not notinterruptible, double negative) if both pass, then it'll do its own calculation and return value for cast length and seconds left (which was utilized in the earlier code)
Then let's go check out what that checkCasting(target) function is all about
Code:
local function checkCasting(target)
local name, startTime, endTime, notInterruptible = checkChanneling(target)
if name then return name, startTime, endTime, notInterruptible end
local name, _, _, _, startTime, endTime, _, _, notInterruptible = UnitCastingInfo(target)
if name then return name, startTime, endTime, notInterruptible end
return false
end
Whoa, we have two things here, first it stores all these variables from checkChanneling(target) custom function.
Then it does the same for Unitcastinginfo(target), this one is a command from WoW protected lua.
Okay then our final stop is checkChanneling(target)
Code:
local function checkChanneling(target)
local name_, _, _, _, startTime, endTime, _, notInterruptible = UnitChannelInfo(target)
if name then return name, startTime, endTime, notInterruptible end
return false
end
Huh...that's the same code except replace Unitcastinginfo(target) from checkCasting(target), with Unitchannelinfo(target). Seems to me this could've been fitted into the previous codes. Oh well, probably this is for organization purpose.
So what I want to do is add something inside the interrupt custom condition like
elseif checkchanneling(target) and not notInterruptible then return true.
But that doesn't seem to work.