-- TimeSpace Script generated by friends111's python script. Replace all %TODO% values accordingly, check for errors (packet-generation isn't perfect), and modify things if needed.
local Map = require('Map')
local Monster = require('Monster')
local MonsterWave = require('MonsterWave')
local Event = require('Event')
local MapObject = require('MapObject')
local MapNpc = require('MapNpc')
local Portal = require('Portal')
local Location = require('Location')
local TimeSpace = require('TimeSpace')
local PortalType = require("PortalType")
local PortalMinimapOrientation = require('PortalMinimapOrientation')
local TimeSpaceObjective = require('TimeSpaceObjective')
local TimeSpaceTaskType = require('TimeSpaceTaskType')
local TimeSpaceTask = require('TimeSpaceTask')

local objectives = TimeSpaceObjective.Create()
    .WithGoToExit()
    .WithProtectNPC()

-- Grid min:(0, 1) ~ max:(10, 7) (width: 10, height: 6)
--     [ 0][ 1][ 2][ 3][ 4][ 5][ 6][ 7][ 8][ 9][10]
-- [ 0][  ][  ][  ][  ][  ][  ][  ][  ][  ][  ][  ]
-- [ 1][OO][OO][OO][XX][  ][  ][  ][  ][  ][  ][  ]
-- [ 2][  ][  ][  ][OO][  ][  ][  ][  ][  ][  ][  ]
-- [ 3][  ][OO][OO][OO][OO][OO][OO][  ][  ][  ][  ]
-- [ 4][  ][OO][OO][OO][OO][OO][OO][  ][  ][  ][  ]
-- [ 5][  ][OO][OO][OO][OO][OO][OO][  ][  ][  ][  ]
-- [ 6][  ][OO][OO][OO][OO][OO][OO][  ][  ][  ][  ]
-- [ 7][  ][XX][OO][OO][XX][OO][OO][OO][OO][OO][OO]
-- [ 8][  ][  ][  ][  ][  ][  ][  ][  ][  ][  ][  ]
-- [ 9][  ][  ][  ][  ][  ][  ][  ][  ][  ][  ][  ]
-- [10][  ][  ][  ][  ][  ][  ][  ][  ][  ][  ][  ]

local map_0_1 = Map.Create().WithMapId(4418).SetMapCoordinates(0, 1).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
) -- start
local map_1_1 = Map.Create().WithMapId(4409).SetMapCoordinates(1, 1).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None).WithOnStartDialog(6214)
)
local map_2_1 = Map.Create().WithMapId(4409).SetMapCoordinates(2, 1).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None).WithOnStartDialog(6215)
)
local map_3_1 = Map.Create().WithMapId(4405).SetMapCoordinates(3, 1).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_39_TEXT_0").WithOnStartDialog(6216).WithOnFinishDialog(6217)
)
local map_3_2 = Map.Create().WithMapId(4412).SetMapCoordinates(3, 2).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_3_3 = Map.Create().WithMapId(4403).SetMapCoordinates(3, 3).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None).WithOnStartDialog(6218)
)
local map_2_3 = Map.Create().WithMapId(4411).SetMapCoordinates(2, 3).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None).WithOnStartShout("TS_39_TEXT_1")
)
local map_1_3 = Map.Create().WithMapId(4411).SetMapCoordinates(1, 3).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None).WithOnStartDialog(6222)
)
local map_4_3 = Map.Create().WithMapId(4401).SetMapCoordinates(4, 3).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_5_3 = Map.Create().WithMapId(4405).SetMapCoordinates(5, 3).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_6_3 = Map.Create().WithMapId(4419).SetMapCoordinates(6, 3).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None).WithOnStartShout("TS_39_TEXT_2")
)
local map_1_4 = Map.Create().WithMapId(4408).SetMapCoordinates(1, 4).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_1_5 = Map.Create().WithMapId(4410).SetMapCoordinates(1, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_1_6 = Map.Create().WithMapId(4407).SetMapCoordinates(1, 6).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None).WithOnStartDialog(6219)
)
local map_1_7 = Map.Create().WithMapId(4418).SetMapCoordinates(1, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters, 80).WithTaskText("TS_39_TEXT_3").WithOnFinishShout("TS_39_TEXT_4")
)
local map_2_4 = Map.Create().WithMapId(4401).SetMapCoordinates(2, 4).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_2_5 = Map.Create().WithMapId(4407).SetMapCoordinates(2, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_2_6 = Map.Create().WithMapId(4411).SetMapCoordinates(2, 6).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_2_7 = Map.Create().WithMapId(4411).SetMapCoordinates(2, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_3_4 = Map.Create().WithMapId(4401).SetMapCoordinates(3, 4).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_3_5 = Map.Create().WithMapId(4404).SetMapCoordinates(3, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_3_6 = Map.Create().WithMapId(4400).SetMapCoordinates(3, 6).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_3_7 = Map.Create().WithMapId(4406).SetMapCoordinates(3, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_4_4 = Map.Create().WithMapId(4400).SetMapCoordinates(4, 4).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_4_5 = Map.Create().WithMapId(4410).SetMapCoordinates(4, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None).WithOnStartShout("TS_39_TEXT_5")
)
local map_4_6 = Map.Create().WithMapId(4403).SetMapCoordinates(4, 6).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_4_7 = Map.Create().WithMapId(4418).SetMapCoordinates(4, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.Survive, 60).WithTaskText("TS_39_TEXT_6").WithOnFinishShout("TS_39_TEXT_7")
)
local map_5_4 = Map.Create().WithMapId(4403).SetMapCoordinates(5, 4).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_5_5 = Map.Create().WithMapId(4408).SetMapCoordinates(5, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_5_6 = Map.Create().WithMapId(4400).SetMapCoordinates(5, 6).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_5_7 = Map.Create().WithMapId(4406).SetMapCoordinates(5, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_6_4 = Map.Create().WithMapId(4404).SetMapCoordinates(6, 4).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_6_5 = Map.Create().WithMapId(4406).SetMapCoordinates(6, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_6_6 = Map.Create().WithMapId(4405).SetMapCoordinates(6, 6).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_6_7 = Map.Create().WithMapId(4407).SetMapCoordinates(6, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_7_7 = Map.Create().WithMapId(4411).SetMapCoordinates(7, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None).WithOnStartDialog(6220)
)
local map_8_7 = Map.Create().WithMapId(4411).SetMapCoordinates(8, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_9_7 = Map.Create().WithMapId(4409).SetMapCoordinates(9, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_10_7 = Map.Create().WithMapId(4420).SetMapCoordinates(10, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None).WithOnStartDialog(6221)
)

local portal_0_1_to_1_1 = Portal.Create(PortalType.TsNormal).From(map_0_1, 23, 12).To(map_1_1, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_1_1_to_2_1 = Portal.Create(PortalType.TsNormal).From(map_1_1, 23, 11).To(map_2_1, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_1_1_to_0_1 = Portal.Create(PortalType.TsNormal).From(map_1_1, 1, 11).To(map_0_1, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_2_1_to_3_1 = Portal.Create(PortalType.TsNormal).From(map_2_1, 23, 11).To(map_3_1, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_2_1_to_1_1 = Portal.Create(PortalType.TsNormal).From(map_2_1, 1, 11).To(map_1_1, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_3_1_to_3_2 = Portal.Create(PortalType.Locked).From(map_3_1, 12, 23).To(map_3_2, 11, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_3_1_to_2_1 = Portal.Create(PortalType.Locked).From(map_3_1, 1, 12).To(map_2_1, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_3_2_to_3_1 = Portal.Create(PortalType.TsNormal).From(map_3_2, 11, 1).To(map_3_1, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_3_2_to_3_3 = Portal.Create(PortalType.TsNormal).From(map_3_2, 11, 23).To(map_3_3, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_3_3_to_3_2 = Portal.Create(PortalType.TsNormal).From(map_3_3, 12, 1).To(map_3_2, 11, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_3_3_to_4_3 = Portal.Create(PortalType.TsNormal).From(map_3_3, 23, 12).To(map_4_3, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_3_3_to_2_3 = Portal.Create(PortalType.TsNormal).From(map_3_3, 1, 12).To(map_2_3, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_2_3_to_3_3 = Portal.Create(PortalType.TsNormal).From(map_2_3, 23, 11).To(map_3_3, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_2_3_to_1_3 = Portal.Create(PortalType.Locked).From(map_2_3, 1, 11).To(map_1_3, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_4_3_to_5_3 = Portal.Create(PortalType.TsNormal).From(map_4_3, 23, 11).To(map_5_3, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_4_3_to_4_4 = Portal.Create(PortalType.TsNormal).From(map_4_3, 12, 23).To(map_4_4, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_4_3_to_3_3 = Portal.Create(PortalType.TsNormal).From(map_4_3, 1, 11).To(map_3_3, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_5_3_to_5_4 = Portal.Create(PortalType.TsNormal).From(map_5_3, 12, 23).To(map_5_4, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_5_3_to_4_3 = Portal.Create(PortalType.TsNormal).From(map_5_3, 1, 12).To(map_4_3, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_5_4_to_5_3 = Portal.Create(PortalType.TsNormal).From(map_5_4, 12, 1).To(map_5_3, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_5_4_to_6_4 = Portal.Create(PortalType.TsNormal).From(map_5_4, 23, 12).To(map_6_4, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_5_4_to_4_4 = Portal.Create(PortalType.TsNormal).From(map_5_4, 1, 12).To(map_4_4, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_6_4_to_6_3 = Portal.Create(PortalType.TsNormal).From(map_6_4, 12, 1).To(map_6_3, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_6_4_to_6_5 = Portal.Create(PortalType.TsNormal).From(map_6_4, 12, 23).To(map_6_5, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_6_4_to_5_4 = Portal.Create(PortalType.Locked).From(map_6_4, 1, 12).To(map_5_4, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_6_3_to_6_4 = Portal.Create(PortalType.Locked).From(map_6_3, 12, 23).To(map_6_4, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_6_5_to_6_4 = Portal.Create(PortalType.TsNormal).From(map_6_5, 12, 1).To(map_6_4, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_6_5_to_5_5 = Portal.Create(PortalType.TsNormal).From(map_6_5, 1, 12).To(map_5_5, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_5_5_to_6_5 = Portal.Create(PortalType.TsNormal).From(map_5_5, 23, 12).To(map_6_5, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_5_5_to_5_6 = Portal.Create(PortalType.TsNormal).From(map_5_5, 12, 23).To(map_5_6, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_5_6_to_5_5 = Portal.Create(PortalType.TsNormal).From(map_5_6, 12, 1).To(map_5_5, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_5_6_to_6_6 = Portal.Create(PortalType.Locked).From(map_5_6, 23, 12).To(map_6_6, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_5_6_to_5_7 = Portal.Create(PortalType.TsNormal).From(map_5_6, 12, 23).To(map_5_7, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_5_6_to_4_6 = Portal.Create(PortalType.TsNormal).From(map_5_6, 1, 12).To(map_4_6, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_5_7_to_5_6 = Portal.Create(PortalType.TsNormal).From(map_5_7, 12, 1).To(map_5_6, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_5_7_to_4_7 = Portal.Create(PortalType.TsNormal).From(map_5_7, 1, 12).To(map_4_7, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_4_7_to_5_7 = Portal.Create(PortalType.Locked).From(map_4_7, 23, 12).To(map_5_7, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_4_6_to_4_5 = Portal.Create(PortalType.TsNormal).From(map_4_6, 12, 1).To(map_4_5, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_4_6_to_5_6 = Portal.Create(PortalType.TsNormal).From(map_4_6, 23, 12).To(map_5_6, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_4_6_to_3_6 = Portal.Create(PortalType.TsNormal).From(map_4_6, 1, 12).To(map_3_6, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_4_5_to_4_4 = Portal.Create(PortalType.Locked).From(map_4_5, 12, 1).To(map_4_4, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_4_5_to_4_6 = Portal.Create(PortalType.Locked).From(map_4_5, 12, 23).To(map_4_6, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_3_6_to_3_5 = Portal.Create(PortalType.TsNormal).From(map_3_6, 12, 1).To(map_3_5, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_3_6_to_4_6 = Portal.Create(PortalType.TsNormal).From(map_3_6, 23, 12).To(map_4_6, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_3_6_to_3_7 = Portal.Create(PortalType.TsNormal).From(map_3_6, 12, 23).To(map_3_7, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_3_6_to_2_6 = Portal.Create(PortalType.Locked).From(map_3_6, 1, 12).To(map_2_6, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_3_7_to_3_6 = Portal.Create(PortalType.TsNormal).From(map_3_7, 12, 1).To(map_3_6, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_3_7_to_2_7 = Portal.Create(PortalType.TsNormal).From(map_3_7, 1, 12).To(map_2_7, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_2_7_to_3_7 = Portal.Create(PortalType.TsNormal).From(map_2_7, 23, 11).To(map_3_7, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_2_7_to_1_7 = Portal.Create(PortalType.TsNormal).From(map_2_7, 1, 11).To(map_1_7, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_1_7_to_2_7 = Portal.Create(PortalType.Locked).From(map_1_7, 23, 12).To(map_2_7, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_3_5_to_3_4 = Portal.Create(PortalType.TsNormal).From(map_3_5, 12, 1).To(map_3_4, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_3_5_to_3_6 = Portal.Create(PortalType.TsNormal).From(map_3_5, 12, 23).To(map_3_6, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_3_5_to_2_5 = Portal.Create(PortalType.TsNormal).From(map_3_5, 1, 12).To(map_2_5, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_3_4_to_4_4 = Portal.Create(PortalType.TsNormal).From(map_3_4, 23, 11).To(map_4_4, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_3_4_to_3_5 = Portal.Create(PortalType.Locked).From(map_3_4, 12, 23).To(map_3_5, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_3_4_to_2_4 = Portal.Create(PortalType.Locked).From(map_3_4, 1, 11).To(map_2_4, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_4_4_to_4_3 = Portal.Create(PortalType.TsNormal).From(map_4_4, 12, 1).To(map_4_3, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_4_4_to_5_4 = Portal.Create(PortalType.Locked).From(map_4_4, 23, 12).To(map_5_4, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_4_4_to_4_5 = Portal.Create(PortalType.Locked).From(map_4_4, 12, 23).To(map_4_5, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_4_4_to_3_4 = Portal.Create(PortalType.TsNormal).From(map_4_4, 1, 12).To(map_3_4, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_2_5_to_2_4 = Portal.Create(PortalType.TsNormal).From(map_2_5, 12, 1).To(map_2_4, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_2_5_to_3_5 = Portal.Create(PortalType.TsNormal).From(map_2_5, 23, 12).To(map_3_5, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_2_4_to_3_4 = Portal.Create(PortalType.TsNormal).From(map_2_4, 23, 11).To(map_3_4, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_2_4_to_2_5 = Portal.Create(PortalType.TsNormal).From(map_2_4, 12, 23).To(map_2_5, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_2_4_to_1_4 = Portal.Create(PortalType.TsNormal).From(map_2_4, 1, 11).To(map_1_4, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_1_4_to_2_4 = Portal.Create(PortalType.TsNormal).From(map_1_4, 23, 12).To(map_2_4, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_1_4_to_1_5 = Portal.Create(PortalType.TsNormal).From(map_1_4, 12, 23).To(map_1_5, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_1_5_to_1_4 = Portal.Create(PortalType.TsNormal).From(map_1_5, 12, 1).To(map_1_4, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_1_5_to_1_6 = Portal.Create(PortalType.TsNormal).From(map_1_5, 12, 23).To(map_1_6, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_1_6_to_1_5 = Portal.Create(PortalType.Locked).From(map_1_6, 12, 1).To(map_1_5, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_1_6_to_2_6 = Portal.Create(PortalType.Locked).From(map_1_6, 23, 12).To(map_2_6, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_2_6_to_3_6 = Portal.Create(PortalType.TsNormal).From(map_2_6, 23, 11).To(map_3_6, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_2_6_to_1_6 = Portal.Create(PortalType.TsNormal).From(map_2_6, 1, 11).To(map_1_6, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_6_6_to_6_7 = Portal.Create(PortalType.TsNormal).From(map_6_6, 12, 23).To(map_6_7, 12, 1).MinimapOrientation(PortalMinimapOrientation.South)
local portal_6_6_to_5_6 = Portal.Create(PortalType.TsNormal).From(map_6_6, 1, 12).To(map_5_6, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_6_7_to_6_6 = Portal.Create(PortalType.TsNormal).From(map_6_7, 12, 1).To(map_6_6, 12, 23).MinimapOrientation(PortalMinimapOrientation.North)
local portal_6_7_to_7_7 = Portal.Create(PortalType.TsNormal).From(map_6_7, 23, 12).To(map_7_7, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_7_7_to_8_7 = Portal.Create(PortalType.TsNormal).From(map_7_7, 23, 11).To(map_8_7, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_7_7_to_6_7 = Portal.Create(PortalType.TsNormal).From(map_7_7, 1, 11).To(map_6_7, 23, 12).MinimapOrientation(PortalMinimapOrientation.West)
local portal_8_7_to_9_7 = Portal.Create(PortalType.Locked).From(map_8_7, 23, 11).To(map_9_7, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_8_7_to_7_7 = Portal.Create(PortalType.TsNormal).From(map_8_7, 1, 11).To(map_7_7, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_9_7_to_10_7 = Portal.Create(PortalType.Locked).From(map_9_7, 23, 11).To(map_10_7, 1, 12).MinimapOrientation(PortalMinimapOrientation.East)
local portal_9_7_to_8_7 = Portal.Create(PortalType.TsNormal).From(map_9_7, 1, 11).To(map_8_7, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_10_7_to_9_7 = Portal.Create(PortalType.TsNormal).From(map_10_7, 1, 12).To(map_9_7, 23, 11).MinimapOrientation(PortalMinimapOrientation.West)
local portal_1_3_to_2_3 = Portal.Create(PortalType.TsNormal).From(map_1_3, 23, 11).To(map_2_3, 1, 11).MinimapOrientation(PortalMinimapOrientation.East)
local portal_1_3_to_UNKNOWN = Portal.Create(PortalType.TSEnd).From(map_1_3, 1, 11).To(map_1_3, 1, 11).MinimapOrientation(PortalMinimapOrientation.West)

map_0_1.AddPortal(portal_0_1_to_1_1)
map_1_1.AddPortal(portal_1_1_to_2_1)
map_1_1.AddPortal(portal_1_1_to_0_1)
map_2_1.AddPortal(portal_2_1_to_3_1)
map_2_1.AddPortal(portal_2_1_to_1_1)
map_3_1.AddPortal(portal_3_1_to_3_2)
map_3_1.AddPortal(portal_3_1_to_2_1)
map_3_2.AddPortal(portal_3_2_to_3_1)
map_3_2.AddPortal(portal_3_2_to_3_3)
map_3_3.AddPortal(portal_3_3_to_3_2)
map_3_3.AddPortal(portal_3_3_to_4_3)
map_3_3.AddPortal(portal_3_3_to_2_3)
map_2_3.AddPortal(portal_2_3_to_3_3)
map_2_3.AddPortal(portal_2_3_to_1_3)
map_4_3.AddPortal(portal_4_3_to_5_3)
map_4_3.AddPortal(portal_4_3_to_4_4)
map_4_3.AddPortal(portal_4_3_to_3_3)
map_5_3.AddPortal(portal_5_3_to_5_4)
map_5_3.AddPortal(portal_5_3_to_4_3)
map_5_4.AddPortal(portal_5_4_to_5_3)
map_5_4.AddPortal(portal_5_4_to_6_4)
map_5_4.AddPortal(portal_5_4_to_4_4)
map_6_4.AddPortal(portal_6_4_to_6_3)
map_6_4.AddPortal(portal_6_4_to_6_5)
map_6_4.AddPortal(portal_6_4_to_5_4)
map_6_3.AddPortal(portal_6_3_to_6_4)
map_6_5.AddPortal(portal_6_5_to_6_4)
map_6_5.AddPortal(portal_6_5_to_5_5)
map_5_5.AddPortal(portal_5_5_to_6_5)
map_5_5.AddPortal(portal_5_5_to_5_6)
map_5_6.AddPortal(portal_5_6_to_5_5)
map_5_6.AddPortal(portal_5_6_to_6_6)
map_5_6.AddPortal(portal_5_6_to_5_7)
map_5_6.AddPortal(portal_5_6_to_4_6)
map_5_7.AddPortal(portal_5_7_to_5_6)
map_5_7.AddPortal(portal_5_7_to_4_7)
map_4_7.AddPortal(portal_4_7_to_5_7)
map_4_6.AddPortal(portal_4_6_to_4_5)
map_4_6.AddPortal(portal_4_6_to_5_6)
map_4_6.AddPortal(portal_4_6_to_3_6)
map_4_5.AddPortal(portal_4_5_to_4_4)
map_4_5.AddPortal(portal_4_5_to_4_6)
map_3_6.AddPortal(portal_3_6_to_3_5)
map_3_6.AddPortal(portal_3_6_to_4_6)
map_3_6.AddPortal(portal_3_6_to_3_7)
map_3_6.AddPortal(portal_3_6_to_2_6)
map_3_7.AddPortal(portal_3_7_to_3_6)
map_3_7.AddPortal(portal_3_7_to_2_7)
map_2_7.AddPortal(portal_2_7_to_3_7)
map_2_7.AddPortal(portal_2_7_to_1_7)
map_1_7.AddPortal(portal_1_7_to_2_7)
map_3_5.AddPortal(portal_3_5_to_3_4)
map_3_5.AddPortal(portal_3_5_to_3_6)
map_3_5.AddPortal(portal_3_5_to_2_5)
map_3_4.AddPortal(portal_3_4_to_4_4)
map_3_4.AddPortal(portal_3_4_to_3_5)
map_3_4.AddPortal(portal_3_4_to_2_4)
map_4_4.AddPortal(portal_4_4_to_4_3)
map_4_4.AddPortal(portal_4_4_to_5_4)
map_4_4.AddPortal(portal_4_4_to_4_5)
map_4_4.AddPortal(portal_4_4_to_3_4)
map_2_5.AddPortal(portal_2_5_to_2_4)
map_2_5.AddPortal(portal_2_5_to_3_5)
map_2_4.AddPortal(portal_2_4_to_3_4)
map_2_4.AddPortal(portal_2_4_to_2_5)
map_2_4.AddPortal(portal_2_4_to_1_4)
map_1_4.AddPortal(portal_1_4_to_2_4)
map_1_4.AddPortal(portal_1_4_to_1_5)
map_1_5.AddPortal(portal_1_5_to_1_4)
map_1_5.AddPortal(portal_1_5_to_1_6)
map_1_6.AddPortal(portal_1_6_to_1_5)
map_1_6.AddPortal(portal_1_6_to_2_6)
map_2_6.AddPortal(portal_2_6_to_3_6)
map_2_6.AddPortal(portal_2_6_to_1_6)
map_6_6.AddPortal(portal_6_6_to_6_7)
map_6_6.AddPortal(portal_6_6_to_5_6)
map_6_7.AddPortal(portal_6_7_to_6_6)
map_6_7.AddPortal(portal_6_7_to_7_7)
map_7_7.AddPortal(portal_7_7_to_8_7)
map_7_7.AddPortal(portal_7_7_to_6_7)
map_8_7.AddPortal(portal_8_7_to_9_7)
map_8_7.AddPortal(portal_8_7_to_7_7)
map_9_7.AddPortal(portal_9_7_to_10_7)
map_9_7.AddPortal(portal_9_7_to_8_7)
map_10_7.AddPortal(portal_10_7_to_9_7)
map_1_3.AddPortal(portal_1_3_to_2_3)
map_1_3.AddPortal(portal_1_3_to_UNKNOWN)

--- Map 0_1
map_0_1.OnMapJoin({
    Event.TryStartTaskForMap(map_0_1),
})
---

--- Map 1_1
map_1_1.AddNpcs({
    MapNpc.CreateNpcWithVnum(319).At(7, 11).Facing(7).WithMustProtectAura().WithFollowPlayer().WithHpMpMultiplier(2), -- Kliff [17:07:45]
})
map_1_1.OnMapJoin({
    Event.TryStartTaskForMap(map_1_1),
})
---

--- Map 2_1
map_2_1.OnMapJoin({
    Event.TryStartTaskForMap(map_2_1),
})
---

--- Map 3_1
map_3_1.AddMonsters({
    Monster.CreateWithVnum(311).At(16, 12).Facing(5).WithCustomLevel(40), -- Lord Cuarry's Knight [17:08:07]
    Monster.CreateWithVnum(311).At(13, 8).Facing(0).WithCustomLevel(40), -- Lord Cuarry's Knight [17:08:07]
    Monster.CreateWithVnum(311).At(12, 7).Facing(4).WithCustomLevel(40), -- Lord Cuarry's Knight [17:08:07]
    Monster.CreateWithVnum(339).At(11, 12).Facing(6).AsTarget().WithCustomLevel(50), -- Knights' Captain [17:08:07]
    Monster.CreateWithVnum(311).At(8, 7).Facing(3).SpawnAfterMobsKilled(3).WithCustomLevel(40), -- Lord Cuarry's Knight [17:08:11]
    Monster.CreateWithVnum(311).At(14, 18).Facing(4).SpawnAfterMobsKilled(3).WithCustomLevel(40), -- Lord Cuarry's Knight [17:08:11]
    Monster.CreateWithVnum(311).At(17, 16).Facing(1).SpawnAfterMobsKilled(3).WithCustomLevel(40), -- Lord Cuarry's Knight [17:08:11]
})
map_3_1.OnMapJoin({
    Event.TryStartTaskForMap(map_3_1),
})
map_3_1.OnTaskFinish({
    Event.OpenPortal(portal_3_1_to_2_1),
    Event.OpenPortal(portal_3_1_to_3_2),
})
map_3_1.OnAllTargetMobsDead({
    Event.DespawnAllMobsInRoom(map_3_1),
})
---

--- Map 3_2
map_3_2.OnMapJoin({
    Event.TryStartTaskForMap(map_3_2),
})
---

--- Map 3_3
map_3_3.OnMapJoin({
    Event.TryStartTaskForMap(map_3_3),
})
---

--- Map 2_3
map_2_3.OnMapJoin({
    Event.TryStartTaskForMap(map_2_3),
})
---

--- Map 1_3
map_1_3.AddMonsters({
    Monster.CreateWithVnum(253).At(16, 16).Facing(6).WithCustomLevel(55), -- Ugly Spearman [17:17:51]
    Monster.CreateWithVnum(253).At(10, 13).Facing(6).WithCustomLevel(55), -- Ugly Spearman [17:17:51]
    Monster.CreateWithVnum(253).At(15, 11).Facing(1).SpawnAfterMobsKilled(1).WithCustomLevel(55), -- Ugly Spearman [17:18:01]
})
map_1_3.AddObjects({
    MapObject.CreateRegularBox().At(12, 5), -- [17:17:51]
})
map_1_3.OnMapJoin({
    Event.TryStartTaskForMap(map_1_3),
})
---

--- Map 4_3
map_4_3.AddMonsters({
    Monster.CreateWithVnum(253).At(18, 18).Facing(4).WithCustomLevel(55), -- Ugly Spearman [17:08:40]
    Monster.CreateWithVnum(253).At(13, 14).Facing(7).WithCustomLevel(55), -- Ugly Spearman [17:08:40]
    Monster.CreateWithVnum(253).At(5, 13).Facing(7).WithCustomLevel(55), -- Ugly Spearman [17:08:40]
})
map_4_3.OnMapJoin({
    Event.TryStartTaskForMap(map_4_3),
})
---

--- Map 5_3
map_5_3.OnMapJoin({
    Event.TryStartTaskForMap(map_5_3),
})
---

--- Map 6_3
map_6_3.AddMonsters({
    Monster.CreateWithVnum(253).At(16, 16).Facing(5).WithCustomLevel(55), -- Ugly Spearman [17:09:10]
    Monster.CreateWithVnum(253).At(15, 11).Facing(5).WithCustomLevel(55), -- Ugly Spearman [17:09:10]
    Monster.CreateWithVnum(253).At(10, 12).Facing(5).WithCustomLevel(55), -- Ugly Spearman [17:09:10]
})
map_6_3.AddObjects({
    MapObject.CreateLever().At(11, 16).OnSwitch({
        Event.TogglePortal(portal_6_3_to_6_4),
    }), -- [17:09:10]
    MapObject.CreateRegularBox().At(13, 4), -- [17:09:10]
    MapObject.CreateOldBox().At(11, 4), -- [17:09:10]
})
map_6_3.OnMapJoin({
    Event.TryStartTaskForMap(map_6_3),
})
---

--- Map 1_4
map_1_4.AddMonsters({
    Monster.CreateWithVnum(253).At(17, 15).Facing(0), -- Ugly Spearman [17:13:54]
    Monster.CreateWithVnum(253).At(6, 12).Facing(3), -- Ugly Spearman [17:13:54]
    Monster.CreateWithVnum(253).At(15, 11).Facing(4).SpawnAfterMobsKilled(1).WithCustomLevel(55), -- Ugly Spearman [17:13:56]
})
map_1_4.OnMapJoin({
    Event.TryStartTaskForMap(map_1_4),
})
---

--- Map 1_5
map_1_5.AddMonsters({
    Monster.CreateWithVnum(62).At(14, 4).Facing(5), -- Strong Devil Vampie [17:14:02]
    Monster.CreateWithVnum(62).At(12, 6).Facing(0), -- Strong Devil Vampie [17:14:02]
    Monster.CreateWithVnum(62).At(11, 14).Facing(3), -- Strong Devil Vampie [17:14:02]
    Monster.CreateWithVnum(62).At(13, 10).Facing(7), -- Strong Devil Vampie [17:14:02]
    Monster.CreateWithVnum(253).At(10, 14).Facing(3).SpawnAfterMobsKilled(2).WithCustomLevel(55), -- Ugly Spearman [17:14:05]
    Monster.CreateWithVnum(62).At(12, 11).Facing(4).SpawnAfterMobsKilled(3), -- Strong Devil Vampie [17:14:06]
    Monster.CreateWithVnum(253).At(13, 8).Facing(3).SpawnAfterMobsKilled(3).WithCustomLevel(55), -- Ugly Spearman [17:14:06]
})
map_1_5.OnMapJoin({
    Event.TryStartTaskForMap(map_1_5),
})
---

--- Map 1_6
map_1_6.AddNpcs({
    MapNpc.CreateNpcWithVnum(329).At(13, 10).Facing(6), -- Kenel [17:14:16]
})
map_1_6.OnMapJoin({
    Event.TryStartTaskForMap(map_1_6),
})
map_1_6.OnTaskFinish({
    Event.OpenPortal(portal_1_6_to_1_5),
    Event.OpenPortal(portal_1_6_to_2_6),
    Event.OpenPortal(portal_5_6_to_6_6),
})
---

--- Map 1_7
map_1_7.AddMonsters({
    Monster.CreateWithVnum(62).At(21, 9).Facing(3), -- Strong Devil Vampie [17:12:02]
    Monster.CreateWithVnum(62).At(17, 12).Facing(4), -- Strong Devil Vampie [17:12:02]
    Monster.CreateWithVnum(75).At(12, 11).Facing(3).SpawnAfterMobsKilled(2), -- Happy Horn Imp [17:12:04]
    Monster.CreateWithVnum(75).At(14, 15).Facing(4).SpawnAfterMobsKilled(2), -- Happy Horn Imp [17:12:04]
    Monster.CreateWithVnum(132).At(15, 6).Facing(0).SpawnAfterMobsKilled(2), -- Flame [17:12:04]
    Monster.CreateWithVnum(132).At(12, 6).Facing(2).SpawnAfterMobsKilled(4), -- Flame [17:12:08]
    Monster.CreateWithVnum(75).At(16, 10).Facing(0).SpawnAfterMobsKilled(4), -- Happy Horn Imp [17:12:08]
    Monster.CreateWithVnum(253).At(13, 8).Facing(5).SpawnAfterMobsKilled(6).WithCustomLevel(55), -- Ugly Spearman [17:12:11]
})
map_1_7.AddObjects({
    MapObject.CreateOldBox().At(4, 11), -- [17:12:02]
    MapObject.CreateOldBox().At(4, 10), -- [17:12:02]
})
map_1_7.OnMapJoin({
    Event.TryStartTaskForMap(map_1_7),
})
map_1_7.OnTaskFinish({
    Event.OpenPortal(portal_1_7_to_2_7),
    Event.AddTime(160),
})
map_1_7.OnTaskFail({
    Event.DespawnAllMobsInRoom(map_1_7),
    Event.OpenPortal(portal_1_7_to_2_7),
    Event.RemoveTime(80),
})
---

--- Map 2_4
map_2_4.AddMonsters({
    Monster.CreateWithVnum(74).At(12, 12).Facing(1), -- Large Imp [17:13:43]
    Monster.CreateWithVnum(74).At(8, 5).Facing(5), -- Large Imp [17:13:43]
    Monster.CreateWithVnum(74).At(10, 16).Facing(1).SpawnAfterMobsKilled(1), -- Large Imp [17:13:45]
    Monster.CreateWithVnum(253).At(10, 14).Facing(4).SpawnAfterMobsKilled(2).WithCustomLevel(55), -- Ugly Spearman [17:13:46]
    Monster.CreateWithVnum(253).At(13, 8).Facing(1).SpawnAfterMobsKilled(3).WithCustomLevel(55), -- Ugly Spearman [17:13:47]
})
map_2_4.OnMapJoin({
    Event.TryStartTaskForMap(map_2_4),
})
---

--- Map 2_5
map_2_5.AddMonsters({
    Monster.CreateWithVnum(253).At(17, 15).Facing(3).WithCustomLevel(55), -- Ugly Spearman [17:13:35]
    Monster.CreateWithVnum(253).At(15, 7).Facing(3).WithCustomLevel(55), -- Ugly Spearman [17:13:35]
    Monster.CreateWithVnum(253).At(15, 11).Facing(0).SpawnAfterMobsKilled(1).WithCustomLevel(55), -- Ugly Spearman [17:13:36]
})
map_2_5.OnMapJoin({
    Event.TryStartTaskForMap(map_2_5),
})
---

--- Map 2_6
map_2_6.AddMonsters({
    Monster.CreateWithVnum(62).At(9, 10).Facing(5), -- Strong Devil Vampie [17:14:33]
    Monster.CreateWithVnum(62).At(13, 7).Facing(2), -- Strong Devil Vampie [17:14:33]
    Monster.CreateWithVnum(75).At(12, 11).Facing(4).SpawnAfterMobsKilled(2), -- Happy Horn Imp [17:14:36]
    Monster.CreateWithVnum(75).At(14, 15).Facing(4).SpawnAfterMobsKilled(2), -- Happy Horn Imp [17:14:36]
    Monster.CreateWithVnum(132).At(15, 6).Facing(4).SpawnAfterMobsKilled(2), -- Flame [17:14:36]
    Monster.CreateWithVnum(132).At(12, 6).Facing(5).SpawnAfterMobsKilled(4), -- Flame [17:14:38]
    Monster.CreateWithVnum(75).At(16, 10).Facing(4).SpawnAfterMobsKilled(4), -- Happy Horn Imp [17:14:38]
    Monster.CreateWithVnum(253).At(10, 14).Facing(0).SpawnAfterMobsKilled(6).WithCustomLevel(55), -- Ugly Spearman [17:14:41]
    Monster.CreateWithVnum(253).At(13, 8).Facing(6).SpawnAfterMobsKilled(6).WithCustomLevel(55), -- Ugly Spearman [17:14:41]
})
map_2_6.OnMapJoin({
    Event.TryStartTaskForMap(map_2_6),
})
---

--- Map 2_7
map_2_7.OnMapJoin({
    Event.TryStartTaskForMap(map_2_7),
})
---

--- Map 3_4
map_3_4.AddMonsters({
    Monster.CreateWithVnum(87).At(3, 13).Facing(5), -- Tired Dark Jelly [17:12:39]
    Monster.CreateWithVnum(253).At(15, 10).Facing(2).WithCustomLevel(55), -- Ugly Spearman [17:12:39]
    Monster.CreateWithVnum(87).At(16, 14).Facing(2).SpawnAfterMobsKilled(1), -- Tired Dark Jelly [17:12:41]
    Monster.CreateWithVnum(253).At(10, 14).Facing(3).SpawnAfterMobsKilled(2).WithCustomLevel(55), -- Ugly Spearman [17:12:42]
    Monster.CreateWithVnum(87).At(10, 18).Facing(2).SpawnAfterMobsKilled(2), -- Tired Dark Jelly [17:12:42]
})
map_3_4.OnMapJoin({
    Event.TryStartTaskForMap(map_3_4),
})
---

--- Map 3_5
map_3_5.OnMapJoin({
    Event.TryStartTaskForMap(map_3_5),
})
---

--- Map 3_6
map_3_6.AddMonsters({
    Monster.CreateWithVnum(253).At(21, 18).Facing(4).WithCustomLevel(55), -- Ugly Spearman [17:11:30]
    Monster.CreateWithVnum(253).At(7, 4).Facing(7).WithCustomLevel(55), -- Ugly Spearman [17:11:30]
    Monster.CreateWithVnum(253).At(15, 11).Facing(5).SpawnAfterMobsKilled(1).WithCustomLevel(55), -- Ugly Spearman [17:11:34]
})
map_3_6.OnMapJoin({
    Event.TryStartTaskForMap(map_3_6),
})
---

--- Map 3_7
map_3_7.AddMonsters({
    Monster.CreateWithVnum(104).At(4, 10).Facing(5), -- Large Steel Hamster [17:11:41]
    Monster.CreateWithVnum(104).At(18, 8).Facing(1), -- Large Steel Hamster [17:11:41]
    Monster.CreateWithVnum(104).At(13, 16).Facing(4), -- Large Steel Hamster [17:11:41]
    Monster.CreateWithVnum(132).At(15, 8).Facing(0).SpawnAfterMobsKilled(1), -- Flame [17:11:45]
    Monster.CreateWithVnum(132).At(9, 12).Facing(3).SpawnAfterMobsKilled(3), -- Flame [17:11:47]
    Monster.CreateWithVnum(253).At(10, 14).Facing(5).SpawnAfterMobsKilled(4).WithCustomLevel(55), -- Ugly Spearman [17:11:49]
    Monster.CreateWithVnum(253).At(13, 8).Facing(4).SpawnAfterMobsKilled(5).WithCustomLevel(55), -- Ugly Spearman [17:11:51]
})
map_3_7.OnMapJoin({
    Event.TryStartTaskForMap(map_3_7),
})
---

--- Map 4_4
map_4_4.OnMapJoin({
    Event.TryStartTaskForMap(map_4_4),
})
---

--- Map 4_5
local key_1 = MapObject.CreateSealedKey(1000).At(9, 9) -- [17:11:19]
local key_2 = MapObject.CreateSealedKey(2000).At(13, 9) -- [17:11:19]
local key_3 = MapObject.CreateSealedKey(1000).At(17, 9) -- [17:11:19]
key_1.OnPickup({
    Event.OpenPortal(portal_4_5_to_4_4),
    Event.RemoveItems({key_2, key_3}),
})
key_2.OnPickup({
    Event.OpenPortal(portal_4_5_to_4_4),
    Event.OpenPortal(portal_4_5_to_4_6),
    Event.RemoveItems({key_1, key_3}),
})
key_3.OnPickup({
    Event.OpenPortal(portal_4_5_to_4_6),
    Event.RemoveItems({key_1, key_2}),
})
map_4_5.AddObjects({
    key_1,
    key_2,
    key_3,
})
map_4_5.OnMapJoin({
    Event.TryStartTaskForMap(map_4_5),
})
---

--- Map 4_6
map_4_6.OnMapJoin({
    Event.TryStartTaskForMap(map_4_6),
})
---

--- Map 4_7
map_4_7.AddMonsterWaves({
    -- wave 1
    MonsterWave.CreateWithDelay(0 * 30).WithMonsters({
        Monster.CreateWithVnum(254).At(18, 11).Facing(6).WithCustomLevel(99), -- Ghastly Spearman [17:10:07]
    }),
})
map_4_7.AddObjects({
    MapObject.CreateRegularBox().At(5, 11), -- [17:10:07]
})
map_4_7.OnMapJoin({
    Event.TryStartTaskForMap(map_4_7),
})
map_4_7.OnTaskFinish({
    Event.OpenPortal(portal_4_7_to_5_7),
    Event.DespawnAllMobsInRoom(map_4_7),
})
---

--- Map 5_4
map_5_4.AddMonsters({
    Monster.CreateWithVnum(253).At(15, 6).Facing(7).WithCustomLevel(55), -- Ugly Spearman [17:08:56]
    Monster.CreateWithVnum(253).At(5, 5).Facing(3).WithCustomLevel(55), -- Ugly Spearman [17:08:56]
    Monster.CreateWithVnum(253).At(11, 14).Facing(2).SpawnAfterMobsKilled(1).WithCustomLevel(55), -- Ugly Spearman [17:08:58]
})
map_5_4.OnMapJoin({
    Event.TryStartTaskForMap(map_5_4),
})
---

--- Map 5_5
map_5_5.OnMapJoin({
    Event.TryStartTaskForMap(map_5_5),
})
---

--- Map 5_6
map_5_6.AddMonsters({
    Monster.CreateWithVnum(62).At(12, 12).Facing(0), -- Strong Devil Vampie [17:09:38]
    Monster.CreateWithVnum(62).At(12, 5).Facing(5), -- Strong Devil Vampie [17:09:38]
    Monster.CreateWithVnum(62).At(14, 11).Facing(4), -- Strong Devil Vampie [17:09:38]
    Monster.CreateWithVnum(62).At(6, 7).Facing(6), -- Strong Devil Vampie [17:09:38]
    Monster.CreateWithVnum(253).At(10, 14).Facing(0).SpawnAfterMobsKilled(2).WithCustomLevel(55), -- Ugly Spearman [17:09:41]
    Monster.CreateWithVnum(62).At(12, 11).Facing(7).SpawnAfterMobsKilled(3), -- Strong Devil Vampie [17:09:42]
    Monster.CreateWithVnum(253).At(13, 8).Facing(7).SpawnAfterMobsKilled(3).WithCustomLevel(55), -- Ugly Spearman [17:09:42]
})
map_5_6.OnMapJoin({
    Event.TryStartTaskForMap(map_5_6),
})
---

--- Map 5_7
map_5_7.AddMonsters({
    Monster.CreateWithVnum(104).At(7, 16).Facing(7), -- Large Steel Hamster [17:09:54]
    Monster.CreateWithVnum(104).At(9, 7).Facing(7), -- Large Steel Hamster [17:09:54]
    Monster.CreateWithVnum(104).At(5, 15).Facing(3), -- Large Steel Hamster [17:09:54]
    Monster.CreateWithVnum(132).At(15, 8).Facing(2).SpawnAfterMobsKilled(1), -- Flame [17:09:55]
    Monster.CreateWithVnum(132).At(9, 12).Facing(2).SpawnAfterMobsKilled(3), -- Flame [17:09:58]
    Monster.CreateWithVnum(253).At(10, 14).Facing(4).SpawnAfterMobsKilled(4).WithCustomLevel(55), -- Ugly Spearman [17:09:59]
    Monster.CreateWithVnum(253).At(13, 8).Facing(2).SpawnAfterMobsKilled(5).WithCustomLevel(55), -- Ugly Spearman [17:10:00]
})
map_5_7.OnMapJoin({
    Event.TryStartTaskForMap(map_5_7),
})
---

--- Map 6_4
map_6_4.OnMapJoin({
    Event.TryStartTaskForMap(map_6_4),
})
---

--- Map 6_5
map_6_5.AddMonsters({
    Monster.CreateWithVnum(87).At(19, 11).Facing(7), -- Tired Dark Jelly [17:09:26]
    Monster.CreateWithVnum(253).At(14, 6).Facing(2).WithCustomLevel(55), -- Ugly Spearman [17:09:26]
    Monster.CreateWithVnum(87).At(7, 9).Facing(5).SpawnAfterMobsKilled(1), -- Tired Dark Jelly [17:09:27]
    Monster.CreateWithVnum(253).At(10, 14).Facing(6).SpawnAfterMobsKilled(2).WithCustomLevel(55), -- Ugly Spearman [17:09:28]
})
map_6_5.OnMapJoin({
    Event.TryStartTaskForMap(map_6_5),
})
---

--- Map 6_6
map_6_6.OnMapJoin({
    Event.TryStartTaskForMap(map_6_6),
})
---

--- Map 6_7
map_6_7.AddMonsters({
    Monster.CreateWithVnum(253).At(19, 12).Facing(2).WithCustomLevel(55), -- Ugly Spearman [17:15:06]
    Monster.CreateWithVnum(253).At(10, 4).Facing(0).WithCustomLevel(55), -- Ugly Spearman [17:15:06]
    Monster.CreateWithVnum(253).At(15, 11).Facing(3).SpawnAfterMobsKilled(1).WithCustomLevel(55), -- Ugly Spearman [17:15:07]
})
map_6_7.OnMapJoin({
    Event.TryStartTaskForMap(map_6_7),
})
---

--- Map 7_7
map_7_7.OnMapJoin({
    Event.TryStartTaskForMap(map_7_7),
})
---

--- Map 8_7
map_8_7.AddMonsters({
    Monster.CreateWithVnum(253).At(8, 13).Facing(3).WithCustomLevel(55), -- Ugly Spearman [17:15:55]
    Monster.CreateWithVnum(253).At(7, 8).Facing(1).WithCustomLevel(55), -- Ugly Spearman [17:15:55]
    Monster.CreateWithVnum(253).At(6, 13).Facing(1).WithCustomLevel(55), -- Ugly Spearman [17:15:55]
    Monster.CreateWithVnum(253).At(10, 8).Facing(5).SpawnAfterMobsKilled(2).WithCustomLevel(55), -- Ugly Spearman [17:15:58]
    Monster.CreateWithVnum(253).At(13, 13).Facing(2).SpawnAfterMobsKilled(2).WithCustomLevel(55), -- Ugly Spearman [17:15:58]
    Monster.CreateWithVnum(253).At(15, 8).Facing(0).SpawnAfterMobsKilled(4).WithCustomLevel(55), -- Ugly Spearman [17:16:00]
    Monster.CreateWithVnum(253).At(18, 14).Facing(5).SpawnAfterMobsKilled(4).WithCustomLevel(55), -- Ugly Spearman [17:16:00]
    Monster.CreateWithVnum(253).At(20, 9).Facing(2).SpawnAfterMobsKilled(5).WithCustomLevel(55), -- Ugly Spearman [17:16:02]
})
map_8_7.AddObjects({
    MapObject.CreateLever().At(13, 10).OnSwitch({
        Event.TogglePortal(portal_8_7_to_9_7),
    }), -- [17:15:55]
})
map_8_7.OnMapJoin({
    Event.TryStartTaskForMap(map_8_7),
})
---

--- Map 9_7
map_9_7.AddMonsters({
    Monster.CreateWithVnum(253).At(7, 8).Facing(3).WithCustomLevel(55), -- Ugly Spearman [17:16:14]
    Monster.CreateWithVnum(253).At(6, 13).Facing(0).WithCustomLevel(55), -- Ugly Spearman [17:16:14]
    Monster.CreateWithVnum(253).At(10, 8).Facing(0).SpawnAfterMobsKilled(1).WithCustomLevel(55), -- Ugly Spearman [17:16:15]
    Monster.CreateWithVnum(253).At(13, 13).Facing(6).SpawnAfterMobsKilled(2).WithCustomLevel(55), -- Ugly Spearman [17:16:17]
    Monster.CreateWithVnum(253).At(15, 8).Facing(7).SpawnAfterMobsKilled(2).WithCustomLevel(55), -- Ugly Spearman [17:16:17]
    Monster.CreateWithVnum(253).At(8, 13).Facing(7).SpawnAfterMobsKilled(3).WithCustomLevel(55), -- Ugly Spearman [17:16:18]
    Monster.CreateWithVnum(253).At(18, 14).Facing(7).SpawnAfterMobsKilled(4).WithCustomLevel(55), -- Ugly Spearman [17:16:20]
    Monster.CreateWithVnum(253).At(20, 9).Facing(3).SpawnAfterMobsKilled(5).WithCustomLevel(55), -- Ugly Spearman [17:16:21]
})
map_9_7.AddObjects({
    MapObject.CreateLever().At(13, 11).OnSwitch({
        Event.TogglePortal(portal_9_7_to_10_7),
    }), -- [17:16:14]
    MapObject.CreateRegularBox().At(15, 18), -- [17:16:14]
    MapObject.CreateRegularBox().At(12, 17), -- [17:16:14]
})
map_9_7.OnMapJoin({
    Event.TryStartTaskForMap(map_9_7),
})
---

--- Map 10_7
map_10_7.AddNpcs({
    MapNpc.CreateNpcWithVnum(316).At(11, 12).Facing(1), -- Kenko Flailman [17:16:32]
})
map_10_7.AddObjects({
    MapObject.CreateLever().At(17, 7).OnSwitch({
        Event.TogglePortal(portal_2_3_to_1_3),
    }).OnTrigger({
        Event.SetTime(600),
    }), -- [17:16:32]
})
map_10_7.OnMapJoin({
    Event.TryStartTaskForMap(map_10_7),
})
---

local ts = TimeSpace.Create(39)  -- TimeSpace ID
    .SetMaps({map_0_1, map_1_1, map_2_1, map_3_1, map_3_2, map_3_3, map_2_3, map_1_3, map_4_3, map_5_3, map_6_3, map_1_4, map_1_5, map_1_6, map_1_7, map_2_4, map_2_5, map_2_6, map_2_7, map_3_4, map_3_5, map_3_6, map_3_7, map_4_4, map_4_5, map_4_6, map_4_7, map_5_4, map_5_5, map_5_6, map_5_7, map_6_4, map_6_5, map_6_6, map_6_7, map_7_7, map_8_7, map_9_7, map_10_7})
    .SetSpawn(Location.InMap(map_0_1).At(6, 8))
    .SetLives(3)
    .SetObjectives(objectives)
    .SetDurationInSeconds(600)
    .SetBonusPointItemDropChance(10000)
    .SetObtainablePartner(319) -- Kliff
return ts
