From 50d7e190fddac22c846c83c5b6b22264b45f2e9d Mon Sep 17 00:00:00 2001 From: Casper Warden <216465704+casperwardensl@users.noreply.github.com> Date: Thu, 19 Nov 2020 17:16:58 +0000 Subject: [PATCH] Add command to teleport to region coordinates Resolves #34 --- lib/classes/commands/TeleportCommands.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/classes/commands/TeleportCommands.ts b/lib/classes/commands/TeleportCommands.ts index 5a835da..65f716b 100644 --- a/lib/classes/commands/TeleportCommands.ts +++ b/lib/classes/commands/TeleportCommands.ts @@ -13,6 +13,7 @@ import { TeleportFlags } from '../../enums/TeleportFlags'; import { PacketFlags } from '../../enums/PacketFlags'; import { RegionInfoReplyEvent } from '../../events/RegionInfoReplyEvent'; import { Bot } from '../../Bot'; +import { Utils } from '../Utils'; export class TeleportCommands extends CommandsBase { @@ -151,6 +152,12 @@ export class TeleportCommands extends CommandsBase }); } + teleportToRegionCoordinates(x: number, y: number, position: Vector3, lookAt: Vector3): Promise + { + const globalPos = Utils.RegionCoordinatesToHandle(x, y); + return this.teleportToHandle(globalPos.regionHandle, position, lookAt); + } + teleportToHandle(handle: Long, position: Vector3, lookAt: Vector3): Promise { return new Promise((resolve, reject) =>