Hello, need help to modify interrupt engine with checking stances.
Code:
if xelperInterruptInit == nil then xelperInterruptInit = true
function PQR_InterruptSpell()
local _, playerClass = UnitClass("player")
if playerClass == "DEATHKNIGHT" then
return 47528
elseif playerClass == "HUNTER" then
return 34490
elseif playerClass == "MAGE" then
return 2139
elseif playerClass == "PRIEST" then
return 15487
elseif playerClass == "ROGUE" then
return 1766
elseif playerClass == "SHAMAN" then
return 57994
elseif playerClass == "WARRIOR" then
local DS = GetShapeshiftForm()
if DS == 1
return 57755
end
else
local DS = GetShapeshiftForm()
if DS == 2
return 72
end
else
local DS = GetShapeshiftForm()
if DS == 3
return 6552
end
end
end
end
Need add Heroic Throw/Pummel/Shield bash
Full script:
Code:
-- New Interrupt Engine // Новый движок--
if xelperInterruptInit == nil then
xelperInterruptInit = true
function PQR_InterruptSpell()
local _, playerClass = UnitClass("player")
if playerClass == "DEATHKNIGHT" then
return 47528
elseif playerClass == "HUNTER" then
return 34490
elseif playerClass == "MAGE" then
return 2139
elseif playerClass == "PRIEST" then
return 15487
elseif playerClass == "ROGUE" then
return 1766
elseif playerClass == "SHAMAN" then
return 57994
elseif playerClass == "WARRIOR" then
local DS = GetShapeshiftForm()
if DS == 1
return 57755
end
else
local DS = GetShapeshiftForm()
if DS == 2
return 72
end
else
local DS = GetShapeshiftForm()
if DS == 3
return 6552
end
end
end
end
-- Сore / Ядро --
local customTarget = "target"
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
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
--we can't attack the target.
if UnitCanAttack("player", customTarget) == nil then
return false
end
if castInterruptable then
--target is casting something that is interruptable.
--the following 2 variables are named logically... value is in seconds.
local timeSinceStart = (GetTime() * 1000 - castStartTime) / 1000
local timeLeft = ((GetTime() * 1000 - castEndTime) * -1) / 1000
local castTime = castEndTime - castStartTime
local currentPercent = timeSinceStart / castTime * 100000
--interrupt percentage check
if currentPercent < PQR_InterruptPercent then
return false
end
--minimum interrupt time.
if timeSinceStart - PQR_InterruptDelay < 0 then
return false
end
--make sure the interrupt spell is available
local interruptSpell = PQR_InterruptSpell()
if interruptSpell ~= 0 then
local interruptName = GetSpellInfo(interruptSpell)
if not PQR_SpellAvailable(interruptSpell) or not IsSpellInRange(interruptName, customTarget) then
return false
end
else
return false
end
--Finally, make sure the spell they are casting is on the interrupt list or interrupt all is checked
--if PQR_IsInterruptAll() then
PQR_Debug("Casting interrupt on "..customTarget)
CastSpellByID(interruptSpell, customTarget)
return true
--end
end
--PQR_InterruptStarted is a global flag to indicate that a new interrupt rotation has started.
if not PQR_InterruptStart then
PQR_InterruptStart = true
--Only interrupt these abilities:
--PQR_AddInterrupt("Holy Light")
--PQR_AddInterrupt("Flash of Light")
--PQR_AddInterrupt(GetSpellInfo(16914)) --Hurricane
--This is the delay before interrupting in seconds.
PQR_InterruptDelay = 0.05
--This is the percentage of the cast to wait before interrupting
PQR_InterruptPercent = math.random(30,60)
end
if not spells then
spells = {
"Greater Heal", --Priest Heal
"Penance", --Priest Direct channel heal
"Flash Heal", --Priest quick big heal"
"Heal", --Priest normal heal
"Binding Heal", --Priest heal for themself and another
"Lesser Heal", --Priest small heal
"Prayer of Healing", --Priest AoE heal
"Chain Heal", --Shaman AoE heal
"Healing Wave", --Shaman heal
"Lesser Healing Wave", --Shaman minor heal
"Flash of Light", --Paladin quick heal
"Holy Light", --Paladin small heal
"Nourish", --Druid heals
"Healing Touch", --Druid heal
"Regrowth", --Druid AoE
"Rebirth", --Druid brez
"Tranquility", --Druid AoE heal
"Hex", --Shaman CC
"Cyclone",
"Polymorph"
}
end