-- 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 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()
    .WithKillMob(109, 1)

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

local map_3_2 = Map.Create().WithMapId(4014).SetMapCoordinates(3, 2).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
) -- start
local map_4_2 = Map.Create().WithMapId(4004).SetMapCoordinates(4, 2).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_GENERIC_TEXT_KILL_ALL_ENEMIES").WithOnStartDialog(6175).WithOnStartShout("TS_9_TEXT_0")
)
local map_5_2 = Map.Create().WithMapId(4004).SetMapCoordinates(5, 2).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_6_2 = Map.Create().WithMapId(4000).SetMapCoordinates(6, 2).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_GENERIC_TEXT_KILL_ALL_ENEMIES").WithOnStartDialog(6176)
)
local map_7_2 = Map.Create().WithMapId(4004).SetMapCoordinates(7, 2).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_8_2 = Map.Create().WithMapId(4016).SetMapCoordinates(8, 2).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_GENERIC_TEXT_KILL_ALL_ENEMIES").WithOnStartDialog(6177).WithOnFinishShout("TS_9_TEXT_1")
)
local map_6_3 = Map.Create().WithMapId(4006).SetMapCoordinates(6, 3).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_6_4 = Map.Create().WithMapId(4006).SetMapCoordinates(6, 4).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_6_5 = Map.Create().WithMapId(4012).SetMapCoordinates(6, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_GENERIC_TEXT_KILL_ALL_ENEMIES").WithOnStartDialog(6178).WithOnStartShout("TS_9_TEXT_0")
)
local map_6_6 = Map.Create().WithMapId(4006).SetMapCoordinates(6, 6).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_GENERIC_TEXT_KILL_ALL_ENEMIES").WithOnStartDialog(6179)
)
local map_6_7 = Map.Create().WithMapId(4013).SetMapCoordinates(6, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_GENERIC_TEXT_KILL_ALL_ENEMIES").WithOnStartDialog(6180)
)
local map_7_5 = Map.Create().WithMapId(4005).SetMapCoordinates(7, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_8_5 = Map.Create().WithMapId(4005).SetMapCoordinates(8, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_9_5 = Map.Create().WithMapId(4016).SetMapCoordinates(9, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithOnStartDialog(6181).WithOnFinishDialog(6182)
)
local map_5_5 = Map.Create().WithMapId(4005).SetMapCoordinates(5, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_4_5 = Map.Create().WithMapId(4002).SetMapCoordinates(4, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_GENERIC_TEXT_KILL_ALL_ENEMIES").WithOnStartDialog(6183)
)
local map_3_5 = Map.Create().WithMapId(4000).SetMapCoordinates(3, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_2_5 = Map.Create().WithMapId(4014).SetMapCoordinates(2, 5).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_GENERIC_TEXT_KILL_ALL_ENEMIES").WithOnStartDialog(6185)
)
local map_4_4 = Map.Create().WithMapId(4015).SetMapCoordinates(4, 4).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_GENERIC_TEXT_KILL_ALL_ENEMIES").WithOnStartDialog(6184)
)
local map_3_6 = Map.Create().WithMapId(4006).SetMapCoordinates(3, 6).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_3_7 = Map.Create().WithMapId(4010).SetMapCoordinates(3, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_4_7 = Map.Create().WithMapId(4005).SetMapCoordinates(4, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.None)
)
local map_5_7 = Map.Create().WithMapId(2102).SetMapCoordinates(5, 7).WithTask(
    TimeSpaceTask.Create(TimeSpaceTaskType.KillAllMonsters).WithTaskText("TS_GENERIC_TEXT_KILL_ALL_ENEMIES").WithOnStartDialog(6187).WithOnFinishDialog(6188)
)

local portal_3_2_to_4_2 = Portal.Create(PortalType.TsNormal).From(map_3_2, 17, 9).To(map_4_2, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_4_2_to_5_2 = Portal.Create(PortalType.Locked).From(map_4_2, 17, 9).To(map_5_2, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_4_2_to_3_2 = Portal.Create(PortalType.Locked).From(map_4_2, 0, 9).To(map_3_2, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_5_2_to_6_2 = Portal.Create(PortalType.TsNormal).From(map_5_2, 17, 9).To(map_6_2, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_5_2_to_4_2 = Portal.Create(PortalType.TsNormal).From(map_5_2, 0, 9).To(map_4_2, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_6_2_to_7_2 = Portal.Create(PortalType.Locked).From(map_6_2, 17, 9).To(map_7_2, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_6_2_to_6_3 = Portal.Create(PortalType.Locked).From(map_6_2, 8, 17).To(map_6_3, 8, 0).MinimapOrientation(PortalMinimapOrientation.South)
local portal_6_2_to_5_2 = Portal.Create(PortalType.Locked).From(map_6_2, 0, 9).To(map_5_2, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_7_2_to_8_2 = Portal.Create(PortalType.TsNormal).From(map_7_2, 17, 9).To(map_8_2, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_7_2_to_6_2 = Portal.Create(PortalType.TsNormal).From(map_7_2, 0, 9).To(map_6_2, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_8_2_to_7_2 = Portal.Create(PortalType.Locked).From(map_8_2, 0, 9).To(map_7_2, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_6_3_to_6_2 = Portal.Create(PortalType.TsNormal).From(map_6_3, 8, 0).To(map_6_2, 8, 17).MinimapOrientation(PortalMinimapOrientation.North)
local portal_6_3_to_6_4 = Portal.Create(PortalType.TsNormal).From(map_6_3, 8, 17).To(map_6_4, 8, 0).MinimapOrientation(PortalMinimapOrientation.South)
local portal_6_4_to_6_3 = Portal.Create(PortalType.TsNormal).From(map_6_4, 8, 0).To(map_6_3, 8, 17).MinimapOrientation(PortalMinimapOrientation.North)
local portal_6_4_to_6_5 = Portal.Create(PortalType.TsNormal).From(map_6_4, 8, 17).To(map_6_5, 8, 0).MinimapOrientation(PortalMinimapOrientation.South)
local portal_6_5_to_6_4 = Portal.Create(PortalType.Locked).From(map_6_5, 8, 0).To(map_6_4, 8, 17).MinimapOrientation(PortalMinimapOrientation.North)
local portal_6_5_to_7_5 = Portal.Create(PortalType.Locked).From(map_6_5, 17, 9).To(map_7_5, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_6_5_to_6_6 = Portal.Create(PortalType.Locked).From(map_6_5, 8, 17).To(map_6_6, 8, 0).MinimapOrientation(PortalMinimapOrientation.South)
local portal_6_5_to_5_5 = Portal.Create(PortalType.Locked).From(map_6_5, 0, 9).To(map_5_5, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_6_6_to_6_5 = Portal.Create(PortalType.Locked).From(map_6_6, 8, 0).To(map_6_5, 8, 17).MinimapOrientation(PortalMinimapOrientation.North)
local portal_6_6_to_6_7 = Portal.Create(PortalType.Locked).From(map_6_6, 8, 17).To(map_6_7, 8, 0).MinimapOrientation(PortalMinimapOrientation.South)
local portal_6_7_to_6_6 = Portal.Create(PortalType.Locked).From(map_6_7, 8, 0).To(map_6_6, 8, 17).MinimapOrientation(PortalMinimapOrientation.North)
local portal_7_5_to_8_5 = Portal.Create(PortalType.TsNormal).From(map_7_5, 17, 9).To(map_8_5, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_7_5_to_6_5 = Portal.Create(PortalType.TsNormal).From(map_7_5, 0, 9).To(map_6_5, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_8_5_to_9_5 = Portal.Create(PortalType.TsNormal).From(map_8_5, 17, 9).To(map_9_5, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_8_5_to_7_5 = Portal.Create(PortalType.TsNormal).From(map_8_5, 0, 9).To(map_7_5, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_9_5_to_8_5 = Portal.Create(PortalType.Locked).From(map_9_5, 0, 9).To(map_8_5, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_5_5_to_6_5 = Portal.Create(PortalType.TsNormal).From(map_5_5, 17, 9).To(map_6_5, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_5_5_to_4_5 = Portal.Create(PortalType.TsNormal).From(map_5_5, 0, 9).To(map_4_5, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_4_5_to_4_4 = Portal.Create(PortalType.Locked).From(map_4_5, 8, 0).To(map_4_4, 8, 17).MinimapOrientation(PortalMinimapOrientation.North)
local portal_4_5_to_5_5 = Portal.Create(PortalType.Locked).From(map_4_5, 17, 9).To(map_5_5, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_4_5_to_3_5 = Portal.Create(PortalType.Locked).From(map_4_5, 0, 9).To(map_3_5, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_4_4_to_4_5 = Portal.Create(PortalType.Locked).From(map_4_4, 8, 17).To(map_4_5, 8, 0).MinimapOrientation(PortalMinimapOrientation.South)
local portal_3_5_to_4_5 = Portal.Create(PortalType.TsNormal).From(map_3_5, 17, 9).To(map_4_5, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_3_5_to_3_6 = Portal.Create(PortalType.Locked).From(map_3_5, 8, 17).To(map_3_6, 8, 0).MinimapOrientation(PortalMinimapOrientation.South)
local portal_3_5_to_2_5 = Portal.Create(PortalType.TsNormal).From(map_3_5, 0, 9).To(map_2_5, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_2_5_to_3_5 = Portal.Create(PortalType.Locked).From(map_2_5, 17, 9).To(map_3_5, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_3_6_to_3_5 = Portal.Create(PortalType.TsNormal).From(map_3_6, 8, 0).To(map_3_5, 8, 17).MinimapOrientation(PortalMinimapOrientation.North)
local portal_3_6_to_3_7 = Portal.Create(PortalType.TsNormal).From(map_3_6, 8, 17).To(map_3_7, 8, 0).MinimapOrientation(PortalMinimapOrientation.South)
local portal_3_7_to_3_6 = Portal.Create(PortalType.TsNormal).From(map_3_7, 8, 0).To(map_3_6, 8, 17).MinimapOrientation(PortalMinimapOrientation.North)
local portal_3_7_to_4_7 = Portal.Create(PortalType.TsNormal).From(map_3_7, 17, 9).To(map_4_7, 0, 9).MinimapOrientation(PortalMinimapOrientation.East)
local portal_4_7_to_5_7 = Portal.Create(PortalType.TsNormal).From(map_4_7, 17, 9).To(map_5_7, 7, 19).MinimapOrientation(PortalMinimapOrientation.East)
local portal_4_7_to_3_7 = Portal.Create(PortalType.TsNormal).From(map_4_7, 0, 9).To(map_3_7, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)
local portal_5_7_to_4_7 = Portal.Create(PortalType.Locked).From(map_5_7, 7, 19).To(map_4_7, 17, 9).MinimapOrientation(PortalMinimapOrientation.West)

map_3_2.AddPortal(portal_3_2_to_4_2)
map_4_2.AddPortal(portal_4_2_to_5_2)
map_4_2.AddPortal(portal_4_2_to_3_2)
map_5_2.AddPortal(portal_5_2_to_6_2)
map_5_2.AddPortal(portal_5_2_to_4_2)
map_6_2.AddPortal(portal_6_2_to_7_2)
map_6_2.AddPortal(portal_6_2_to_6_3)
map_6_2.AddPortal(portal_6_2_to_5_2)
map_7_2.AddPortal(portal_7_2_to_8_2)
map_7_2.AddPortal(portal_7_2_to_6_2)
map_8_2.AddPortal(portal_8_2_to_7_2)
map_6_3.AddPortal(portal_6_3_to_6_2)
map_6_3.AddPortal(portal_6_3_to_6_4)
map_6_4.AddPortal(portal_6_4_to_6_3)
map_6_4.AddPortal(portal_6_4_to_6_5)
map_6_5.AddPortal(portal_6_5_to_6_4)
map_6_5.AddPortal(portal_6_5_to_7_5)
map_6_5.AddPortal(portal_6_5_to_6_6)
map_6_5.AddPortal(portal_6_5_to_5_5)
map_6_6.AddPortal(portal_6_6_to_6_5)
map_6_6.AddPortal(portal_6_6_to_6_7)
map_6_7.AddPortal(portal_6_7_to_6_6)
map_7_5.AddPortal(portal_7_5_to_8_5)
map_7_5.AddPortal(portal_7_5_to_6_5)
map_8_5.AddPortal(portal_8_5_to_9_5)
map_8_5.AddPortal(portal_8_5_to_7_5)
map_9_5.AddPortal(portal_9_5_to_8_5)
map_5_5.AddPortal(portal_5_5_to_6_5)
map_5_5.AddPortal(portal_5_5_to_4_5)
map_4_5.AddPortal(portal_4_5_to_4_4)
map_4_5.AddPortal(portal_4_5_to_5_5)
map_4_5.AddPortal(portal_4_5_to_3_5)
map_4_4.AddPortal(portal_4_4_to_4_5)
map_3_5.AddPortal(portal_3_5_to_4_5)
map_3_5.AddPortal(portal_3_5_to_3_6)
map_3_5.AddPortal(portal_3_5_to_2_5)
map_2_5.AddPortal(portal_2_5_to_3_5)
map_3_6.AddPortal(portal_3_6_to_3_5)
map_3_6.AddPortal(portal_3_6_to_3_7)
map_3_7.AddPortal(portal_3_7_to_3_6)
map_3_7.AddPortal(portal_3_7_to_4_7)
map_4_7.AddPortal(portal_4_7_to_5_7)
map_4_7.AddPortal(portal_4_7_to_3_7)
map_5_7.AddPortal(portal_5_7_to_4_7)

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

--- Map 4_2
map_4_2.AddMonsters({
    Monster.CreateWithVnum(105).At(6, 8).Facing(2).WithCustomLevel(12), -- Happy Miner [12:10:54]
    Monster.CreateWithVnum(105).At(3, 10).Facing(7).WithCustomLevel(12), -- Happy Miner [12:10:54]
})
map_4_2.OnMapJoin({
    Event.TryStartTaskForMap(map_4_2),
})
map_4_2.OnTaskFinish({
    Event.OpenPortal(portal_4_2_to_5_2),
})
---

--- Map 5_2
map_5_2.AddMonsters({
    Monster.CreateWithVnum(105).At(15, 10).Facing(7), -- Happy Miner [12:11:01]
    Monster.CreateWithVnum(108).At(11, 8).Facing(1), -- Weak Expy Miner [12:11:01]
    Monster.CreateWithVnum(108).At(4, 8).Facing(7), -- Weak Expy Miner [12:11:01]
})
map_5_2.OnMapJoin({
    Event.TryStartTaskForMap(map_5_2),
})
---

--- Map 6_2
map_6_2.AddMonsters({
    Monster.CreateWithVnum(105).At(5, 10).Facing(1).WithCustomLevel(12), -- Happy Miner [12:11:14]
    Monster.CreateWithVnum(105).At(2, 9).Facing(1).WithCustomLevel(12), -- Happy Miner [12:11:14]
})
map_6_2.OnMapJoin({
    Event.TryStartTaskForMap(map_6_2),
})
map_6_2.OnTaskFinish({
    Event.OpenPortal(portal_6_2_to_7_2),
    Event.OpenPortal(portal_6_2_to_5_2),
})
---

--- Map 7_2
map_7_2.AddMonsters({
    Monster.CreateWithVnum(105).At(7, 7).Facing(0), -- Happy Miner [12:11:22]
    Monster.CreateWithVnum(105).At(3, 7).Facing(4), -- Happy Miner [12:11:22]
    Monster.CreateWithVnum(105).At(14, 9).Facing(3).SpawnAfterMobsKilled(1), -- Happy Miner [12:11:24]
    Monster.CreateWithVnum(108).At(10, 9).Facing(4).SpawnAfterMobsKilled(3), -- Weak Expy Miner [12:11:31]
    Monster.CreateWithVnum(108).At(12, 8).Facing(5).SpawnAfterMobsKilled(3), -- Weak Expy Miner [12:11:31]
})
map_7_2.OnMapJoin({
    Event.TryStartTaskForMap(map_7_2),
})
---

--- Map 8_2
map_8_2.AddMonsters({
    Monster.CreateWithVnum(105).At(5, 10).Facing(4).WithCustomLevel(12), -- Happy Miner [12:11:42]
    Monster.CreateWithVnum(105).At(4, 8).Facing(6).WithCustomLevel(12), -- Happy Miner [12:11:42]
})
map_8_2.AddObjects({
    MapObject.CreateLever().At(9, 9).OnSwitch({
        Event.TogglePortal(portal_6_2_to_6_3),
    }), -- [12:11:41]
})
map_8_2.OnMapJoin({
    Event.TryStartTaskForMap(map_8_2),
})
map_8_2.OnTaskFinish({
    Event.OpenPortal(portal_8_2_to_7_2),
    Event.AddTime(200),
})
---

--- Map 6_3
map_6_3.AddMonsters({
    Monster.CreateWithVnum(108).At(7, 12).Facing(1), -- Weak Expy Miner [12:11:58]
    Monster.CreateWithVnum(108).At(10, 4).Facing(5), -- Weak Expy Miner [12:11:58]
})
map_6_3.OnMapJoin({
    Event.TryStartTaskForMap(map_6_3),
})
---

--- Map 6_4
map_6_4.AddMonsters({
    Monster.CreateWithVnum(105).At(10, 7).Facing(7), -- Happy Miner [12:12:08]
    Monster.CreateWithVnum(105).At(11, 6).Facing(0), -- Happy Miner [12:12:08]
})
map_6_4.OnMapJoin({
    Event.TryStartTaskForMap(map_6_4),
})
---

--- Map 6_5
map_6_5.AddMonsters({
    Monster.CreateWithVnum(105).At(4, 11).Facing(6).WithCustomLevel(12), -- Happy Miner [12:12:17]
    Monster.CreateWithVnum(105).At(4, 9).Facing(5).WithCustomLevel(12), -- Happy Miner [12:12:17]
    Monster.CreateWithVnum(108).At(8, 10).Facing(0).SpawnAfterMobsKilled(2).WithCustomLevel(15), -- Weak Expy Miner [12:12:20]
})
map_6_5.OnMapJoin({
    Event.TryStartTaskForMap(map_6_5),
})
map_6_5.OnTaskFinish({
    Event.OpenPortal(portal_6_5_to_6_4),
    Event.OpenPortal(portal_6_5_to_6_6),
    Event.AddTime(150),
})
---

--- Map 6_6
map_6_6.AddMonsters({
    Monster.CreateWithVnum(105).At(10, 5).Facing(1).WithCustomLevel(12), -- Happy Miner [12:12:26]
    Monster.CreateWithVnum(105).At(7, 5).Facing(0).WithCustomLevel(12), -- Happy Miner [12:12:26]
    Monster.CreateWithVnum(105).At(8, 10).Facing(3).SpawnAfterMobsKilled(2).WithCustomLevel(12), -- Happy Miner [12:12:30]
    Monster.CreateWithVnum(105).At(10, 16).Facing(2).SpawnAfterMobsKilled(3).WithCustomLevel(12), -- Happy Miner [12:12:31]
})
map_6_6.OnMapJoin({
    Event.TryStartTaskForMap(map_6_6),
})
map_6_6.OnTaskFinish({
    Event.OpenPortal(portal_6_6_to_6_5),
    Event.OpenPortal(portal_6_6_to_6_7),
})
---

--- Map 6_7
map_6_7.AddMonsters({
    Monster.CreateWithVnum(105).At(10, 5).Facing(5).WithCustomLevel(12), -- Happy Miner [12:12:38]
    Monster.CreateWithVnum(105).At(8, 5).Facing(1).WithCustomLevel(12), -- Happy Miner [12:12:38]
    Monster.CreateWithVnum(108).At(10, 8).Facing(1).SpawnAfterMobsKilled(1), -- Weak Expy Miner [12:12:41]
})
map_6_7.AddObjects({
    MapObject.CreateLever().At(9, 9).OnSwitch({
        Event.TogglePortal(portal_6_5_to_7_5),
    }), -- [12:12:36]
    MapObject.CreateOldBox().At(7, 10), -- [12:12:36]
})
map_6_7.OnMapJoin({
    Event.TryStartTaskForMap(map_6_7),
})
map_6_7.OnTaskFinish({
    Event.OpenPortal(portal_6_7_to_6_6),
    Event.AddTime(150),
})
---

--- Map 7_5
map_7_5.AddMonsters({
    Monster.CreateWithVnum(108).At(6, 9).Facing(5), -- Weak Expy Miner [12:13:22]
    Monster.CreateWithVnum(108).At(6, 8).Facing(3).SpawnAfterMobsKilled(1), -- Weak Expy Miner [12:13:24]
})
map_7_5.OnMapJoin({
    Event.TryStartTaskForMap(map_7_5),
})
---

--- Map 8_5
map_8_5.AddMonsters({
    Monster.CreateWithVnum(105).At(7, 9).Facing(5), -- Happy Miner [12:13:29]
    Monster.CreateWithVnum(105).At(8, 10).Facing(3), -- Happy Miner [12:13:29]
    Monster.CreateWithVnum(108).At(12, 9).Facing(3).SpawnAfterMobsKilled(1), -- Weak Expy Miner [12:13:34]
    Monster.CreateWithVnum(108).At(16, 8).Facing(5).SpawnAfterMobsKilled(1), -- Weak Expy Miner [12:13:34]
})
map_8_5.OnMapJoin({
    Event.TryStartTaskForMap(map_8_5),
})
---

--- Map 9_5
map_9_5.AddMonsters({
    Monster.CreateWithVnum(108).At(5, 8).Facing(0).WithCustomLevel(15), -- Weak Expy Miner [12:13:46]
    Monster.CreateWithVnum(105).At(4, 10).Facing(3).WithCustomLevel(12), -- Happy Miner [12:13:46]
})
map_9_5.AddObjects({
    MapObject.CreateLever().At(9, 9).OnSwitch({
        Event.TogglePortal(portal_6_5_to_5_5),
    }), -- [12:13:45]
    MapObject.CreateOldBox().At(6, 6), -- [12:13:45]
})
map_9_5.OnMapJoin({
    Event.TryStartTaskForMap(map_9_5),
})
map_9_5.OnTaskFinish({
    Event.OpenPortal(portal_9_5_to_8_5),
    Event.AddTime(150),
})
---

--- Map 5_5
map_5_5.AddMonsters({
    Monster.CreateWithVnum(106).At(3, 11).Facing(4).WithCustomLevel(20), -- Miner [12:14:07]
    Monster.CreateWithVnum(106).At(3, 9).Facing(7).SpawnAfterMobsKilled(1).WithCustomLevel(20), -- Miner [12:14:09]
})
map_5_5.OnMapJoin({
    Event.TryStartTaskForMap(map_5_5),
})
---

--- Map 4_5
map_4_5.AddMonsters({
    Monster.CreateWithVnum(105).At(13, 9).Facing(1).WithCustomLevel(12), -- Happy Miner [12:14:14]
    Monster.CreateWithVnum(108).At(8, 7).Facing(5).WithCustomLevel(15), -- Weak Expy Miner [12:14:14]
    Monster.CreateWithVnum(105).At(10, 5).Facing(5).SpawnAfterMobsKilled(2).WithCustomLevel(12), -- Happy Miner [12:14:18]
})
map_4_5.OnMapJoin({
    Event.TryStartTaskForMap(map_4_5),
})
map_4_5.OnTaskFinish({
    Event.OpenPortal(portal_4_5_to_4_4),
})
---

--- Map 3_5
map_3_5.AddMonsters({
    Monster.CreateWithVnum(105).At(10, 12).Facing(3).WithCustomLevel(12), -- Happy Miner [12:14:40]
    Monster.CreateWithVnum(105).At(14, 6).Facing(3).WithCustomLevel(12), -- Happy Miner [12:14:40]
    Monster.CreateWithVnum(105).At(3, 9).Facing(0).SpawnAfterMobsKilled(1).WithCustomLevel(12), -- Happy Miner [12:14:45]
})
map_3_5.OnMapJoin({
    Event.TryStartTaskForMap(map_3_5),
})
---

--- Map 2_5
map_2_5.AddMonsters({
    Monster.CreateWithVnum(105).At(10, 9).Facing(5), -- Happy Miner [12:14:53]
    Monster.CreateWithVnum(105).At(8, 8).Facing(5).WithCustomLevel(12), -- Happy Miner [12:14:53]
    Monster.CreateWithVnum(105).At(13, 9).Facing(7).SpawnAfterMobsKilled(1).WithCustomLevel(12), -- Happy Miner [12:14:55]
})
map_2_5.AddObjects({
    MapObject.CreateLever().At(7, 7).OnSwitch({
        Event.TogglePortal(portal_3_5_to_3_6),
    }), -- [12:14:52]
})
map_2_5.OnMapJoin({
    Event.TryStartTaskForMap(map_2_5),
})
map_2_5.OnTaskFinish({
    Event.OpenPortal(portal_2_5_to_3_5),
    Event.AddTime(150),
})
---

--- Map 4_4
map_4_4.AddMonsters({
    Monster.CreateWithVnum(105).At(7, 12).Facing(5).WithCustomLevel(12), -- Happy Miner [12:14:25]
    Monster.CreateWithVnum(105).At(7, 10).Facing(0).WithCustomLevel(12), -- Happy Miner [12:14:25]
})
map_4_4.AddObjects({
    MapObject.CreateLever().At(8, 7).OnSwitch({
        Event.TogglePortal(portal_4_5_to_3_5),
    }), -- [12:14:23]
    MapObject.CreateOldBox().At(10, 13), -- [12:14:23]
})
map_4_4.OnMapJoin({
    Event.TryStartTaskForMap(map_4_4),
})
map_4_4.OnTaskFinish({
    Event.OpenPortal(portal_4_4_to_4_5),
    Event.AddTime(150),
})
---

--- Map 3_6
map_3_6.AddMonsters({
    Monster.CreateWithVnum(106).At(7, 3).Facing(5).WithCustomLevel(20), -- Miner [12:15:08]
    Monster.CreateWithVnum(106).At(8, 10).Facing(7).SpawnAfterMobsKilled(1).WithCustomLevel(20), -- Miner [12:15:11]
})
map_3_6.OnMapJoin({
    Event.TryStartTaskForMap(map_3_6),
})
---

--- Map 3_7
map_3_7.AddMonsters({
    Monster.CreateWithVnum(105).At(8, 7).Facing(3), -- Happy Miner [12:15:14]
    Monster.CreateWithVnum(105).At(7, 8).Facing(0), -- Happy Miner [12:15:14]
})
map_3_7.OnMapJoin({
    Event.TryStartTaskForMap(map_3_7),
})
---

--- Map 4_7
map_4_7.AddMonsters({
    Monster.CreateWithVnum(105).At(13, 9).Facing(2), -- Happy Miner [12:15:23]
    Monster.CreateWithVnum(105).At(12, 8).Facing(2), -- Happy Miner [12:15:23]
    Monster.CreateWithVnum(106).At(10, 10).Facing(5).WithCustomLevel(20), -- Miner [12:15:23]
    Monster.CreateWithVnum(108).At(8, 10).Facing(0), -- Weak Expy Miner [12:15:23]
})
map_4_7.OnMapJoin({
    Event.TryStartTaskForMap(map_4_7),
})
---

--- Map 5_7
map_5_7.AddMonsters({
    Monster.CreateWithVnum(105).At(29, 19).Facing(5).WithCustomLevel(12), -- Happy Miner [12:15:47]
    Monster.CreateWithVnum(105).At(26, 15).Facing(0).WithCustomLevel(12), -- Happy Miner [12:15:47]
    Monster.CreateWithVnum(105).At(25, 13).Facing(6).WithCustomLevel(12), -- Happy Miner [12:15:47]
    Monster.CreateWithVnum(105).At(10, 19).Facing(0).WithCustomLevel(12), -- Happy Miner [12:15:47]
    Monster.CreateWithVnum(105).At(10, 8).Facing(4).WithCustomLevel(12), -- Happy Miner [12:15:47]
    Monster.CreateWithVnum(109).At(19, 19).Facing(1).AsTarget().SpawnAfterMobsKilled(5).WithCustomLevel(21), -- Expy Miner [12:15:58]
})
map_5_7.OnMapJoin({
    Event.TryStartTaskForMap(map_5_7),
})
---

local ts = TimeSpace.Create(9)  -- TimeSpace ID
    .SetMaps({map_3_2, map_4_2, map_5_2, map_6_2, map_7_2, map_8_2, map_6_3, map_6_4, map_6_5, map_6_6, map_6_7, map_7_5, map_8_5, map_9_5, map_5_5, map_4_5, map_3_5, map_2_5, map_4_4, map_3_6, map_3_7, map_4_7, map_5_7})
    .SetSpawn(Location.InMap(map_3_2).At(7, 9))
    .SetLives(4)
    .SetObjectives(objectives)
    .SetDurationInSeconds(500)
    .SetBonusPointItemDropChance(5000)
return ts
