Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Instant Teleports
- // This is just an attempt. Not finished, but the coding is close. Credits to me (CALEB) for the base, and rest for whoever finishes them.
- internal void Instant_teleport(int X, int Y)
- {
- while (true)
- {
- {
- roomUser.X = X;
- roomUser.Y = Y;
- roomUser.goalX = -1;
- Room.refreshCoord(X, Y);
- refreshAppearance(false, false, true);
- return;
- }
- Thread.Sleep(1);
- }
- {
- try
- {
- string currentPacket;
- int itemID = Encoding.decodeVL64(currentPacket.Substring(2));
- if (Room.floorItemManager.containsItem(itemID))
- {
- Rooms.Items.floorItem Item = Room.floorItemManager.getItem(itemID); // Find the itemID.
- if (Item.Sprite == "arrow")
- {
- int oldX = roomUser.X;
- int oldY = roomUser.Y;
- roomUser.goalX = roomUser.X;
- roomUser.goalY = roomUser.Y;
- roomUser.goalX = -1;
- Room.refreshCoord(roomUser.X, roomUser.Y);
- Room.sqUNIT[oldX, oldY] = false;
- Room.setSquareState(oldX, oldY, 1, 1, virtualRoom.squareState.Open);
- refreshAppearance(false, false, true);
- }
- else
- {
- roomUser.goalX = roomUser.X;
- roomUser.goalY = roomUser.Y;
- int teleport = int.Parse(DB.runRead("SELECT tid FROM furniture WHERE x = " + roomUser.goalX + " AND y = " + roomUser.goalY + " AND roomid = " + _roomID + ""));
- if (teleport == 53500)
- {
- while (true)
- {
- if (!(Math.Abs(roomUser.X - roomUser.goalX) > 0 || Math.Abs(roomUser.Y - roomUser.goalY) > 0))
- {
- int otherteleport = int.Parse(DB.runRead("SELECT teleportid FROM furniture WHERE x = " + roomUser.goalX + " AND y = " + roomUser.goalY + " AND roomid = " + _roomID + ""));
- if (otherteleport == 0)
- {
- }
- else
- {
- int roomnew = int.Parse(DB.runRead("SELECT roomid FROM furniture WHERE id = '" + otherteleport + "'"));
- int x = int.Parse(DB.runRead("SELECT x FROM furniture WHERE id = '" + otherteleport + "'"));
- int y = int.Parse(DB.runRead("SELECT y FROM furniture WHERE id = '" + otherteleport + "'"));
- int oldX = roomUser.X;
- int oldY = roomUser.Y;
- int _inRoom;
- Room.sqUNIT[oldX, oldY] = false;
- Room.setSquareState(oldX, oldY, 1, 1, virtualRoom.squareState.Open);
- sendData("D^" + "H" + Encoding.encodeVL64(roomnew));
- }
- break;
- }
- Thread.Sleep(1);
- }
- }
- }
- }
- }
- catch
- {
- }
- }
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement