I thought it was a bit large to do this and I have edited to cut down the size but here is part one:
Code:
JumpBlock = {
name = "TJump",
oldZone = "",
reason = JUMP_SUCCESS,
eventCode = 0,
JumpState = JUMP_STATE_IDLE
}
local function FailedJump(eventCode, reason)
-- Failed Jump Handler
if JumpBlock.JumpState == JUMP_STATE_STARTED then
JumpBlock.eventCode = eventCode
JumpBlock.reason = reason
JumpBlock.JumpState = JUMP_STATE_FAILED
end
end
local function DoingJump(eventCode, abilityId)
-- This is triggered when travel animation plays
if (abilityId == ABILITY_ID_RECALL) and (JumpBlock.JumpState == JUMP_STATE_STARTED) then
JumpBlock.JumpState = JUMP_STATE_DONE
end
end
function Gotos:Initialise()
EVENT_MANAGER:RegisterForEvent(JumpBlock.name .. "1", EVENT_JUMP_FAILED, FailedJump)
EVENT_MANAGER:RegisterForEvent(JumpBlock.name .. "2", EVENT_REQUIREMENTS_FAIL, FailedJump)
EVENT_MANAGER:RegisterForEvent(JumpBlock.name .. "3", EVENT_ABILITY_REQUIREMENTS_FAIL, FailedJump)
EVENT_MANAGER:RegisterForEvent(JumpBlock.name .. "4", EVENT_ABILITY_COOLDOWN_UPDATED, DoingJump)
EVENT_MANAGER:AddFilterForEvent(JumpBlock.name .. "4",
EVENT_ABILITY_COOLDOWN_UPDATED,
REGISTER_FILTER_ABILITY_ID,
ABILITY_ID_RECALL)
end
I will add part two shortly.