public TeleportResult TeleportTo(int x, int y, int Timeout) { //GameInfo.RoomList_CheckDS1(); if (Environment.TickCount - SelectSkillTimer > 1000) { SelectSkillTimer = Environment.TickCount; GameInfo.SendPacket(GameInfo.UseDiabloClient,GameClient.SelectSkill.Build(D2Data.SkillType.Teleport, D2Data.SkillHand.Right)); } Point myLastPos = new Point(GameInfo.PlayerX, GameInfo.PlayerY); if (myLastPos.X == x && myLastPos.Y == y) { Console.WriteLine("doTele(): Trying to teleport to the same x,y as our current location"); return TeleportResult.AlreadyThere ; } if (Distance(myLastPos, new Point(x, y)) > this.MaxTeleportDistance) { Console.WriteLine("doTele(): Trying to teleport too far"); return TeleportResult.OutOfRange; } int i = 0; //Console.WriteLine("Teleporting to: " + x + "," + y); GameInfo.SendPacket(GameInfo.UseDiabloClient,GameClient.CastRightSkill.Build((ushort)x, (ushort)y)); while (myLastPos.X == GameInfo.PlayerX && myLastPos.Y == GameInfo.PlayerY) { sleep(10); i += 10; if (i % Timeout == 0) { Console.WriteLine("Teleport timed out"); return TeleportResult.Failed; } if (i % 100 == 0) GameInfo.SendPacket(GameInfo.UseDiabloClient, GameClient.CastRightSkill.Build((ushort)x, (ushort)y)); } return TeleportResult.Susceed; }