Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. #region Instant Teleports
  2. // 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.
  3.  
  4. internal void Instant_teleport(int X, int Y)
  5. {
  6. while (true)
  7. {
  8.  
  9. {
  10. roomUser.X = X;
  11. roomUser.Y = Y;
  12. roomUser.goalX = -1;
  13. Room.refreshCoord(X, Y);
  14. refreshAppearance(false, false, true);
  15. return;
  16. }
  17. Thread.Sleep(1);
  18. }
  19.  
  20. {
  21. try
  22. {
  23.  
  24. string currentPacket;
  25. int itemID = Encoding.decodeVL64(currentPacket.Substring(2));
  26. if (Room.floorItemManager.containsItem(itemID))
  27. {
  28. Rooms.Items.floorItem Item = Room.floorItemManager.getItem(itemID); // Find the itemID.
  29. if (Item.Sprite == "arrow")
  30. {
  31. int oldX = roomUser.X;
  32. int oldY = roomUser.Y;
  33.  
  34. roomUser.goalX = roomUser.X;
  35. roomUser.goalY = roomUser.Y;
  36. roomUser.goalX = -1;
  37. Room.refreshCoord(roomUser.X, roomUser.Y);
  38.  
  39. Room.sqUNIT[oldX, oldY] = false;
  40. Room.setSquareState(oldX, oldY, 1, 1, virtualRoom.squareState.Open);
  41. refreshAppearance(false, false, true);
  42. }
  43. else
  44. {
  45.  
  46. roomUser.goalX = roomUser.X;
  47. roomUser.goalY = roomUser.Y;
  48. int teleport = int.Parse(DB.runRead("SELECT tid FROM furniture WHERE x = " + roomUser.goalX + " AND y = " + roomUser.goalY + " AND roomid = " + _roomID + ""));
  49. if (teleport == 53500)
  50. {
  51. while (true)
  52. {
  53. if (!(Math.Abs(roomUser.X - roomUser.goalX) > 0 || Math.Abs(roomUser.Y - roomUser.goalY) > 0))
  54. {
  55. int otherteleport = int.Parse(DB.runRead("SELECT teleportid FROM furniture WHERE x = " + roomUser.goalX + " AND y = " + roomUser.goalY + " AND roomid = " + _roomID + ""));
  56. if (otherteleport == 0)
  57. {
  58. }
  59. else
  60. {
  61. int roomnew = int.Parse(DB.runRead("SELECT roomid FROM furniture WHERE id = '" + otherteleport + "'"));
  62. int x = int.Parse(DB.runRead("SELECT x FROM furniture WHERE id = '" + otherteleport + "'"));
  63. int y = int.Parse(DB.runRead("SELECT y FROM furniture WHERE id = '" + otherteleport + "'"));
  64. int oldX = roomUser.X;
  65. int oldY = roomUser.Y;
  66. int _inRoom;
  67. Room.sqUNIT[oldX, oldY] = false;
  68. Room.setSquareState(oldX, oldY, 1, 1, virtualRoom.squareState.Open);
  69. sendData("D^" + "H" + Encoding.encodeVL64(roomnew));
  70.  
  71.  
  72. }
  73. break;
  74. }
  75. Thread.Sleep(1);
  76. }
  77. }
  78. }
  79. }
  80. }
  81. catch
  82. {
  83. }
  84. }
  85. }
  86.  
  87. #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement