Advertisement
Guest User

FIX - Exploit Bots

a guest
Jul 5th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.93 KB | None | 0 0
  1. using System;
  2. using System.Drawing;
  3. using Plus.HabboHotel.GameClients;
  4. using Plus.HabboHotel.Rooms.AI.Speech;
  5. using Plus.Communication.Packets.Outgoing.Inventory.Purse;
  6.  
  7. namespace Plus.HabboHotel.Rooms.AI.Types
  8. {
  9. public class GenericBot : BotAI
  10. {
  11. private int VirtualId;
  12. private static readonly Random Random = new Random();
  13. private int ActionTimer = 0;
  14. private int SpeechTimer = 0;
  15.  
  16. public GenericBot(int VirtualId)
  17. {
  18. this.VirtualId = VirtualId;
  19. }
  20.  
  21. public override void OnSelfEnterRoom()
  22. {
  23.  
  24. }
  25.  
  26. public override void OnSelfLeaveRoom(bool Kicked)
  27. {
  28.  
  29. }
  30.  
  31. public override void OnUserEnterRoom(RoomUser User)
  32. {
  33.  
  34. }
  35.  
  36. public override void OnUserLeaveRoom(GameClient Client)
  37. {
  38.  
  39. }
  40.  
  41. public override void OnUserSay(RoomUser User, string Message)
  42. {
  43. }
  44.  
  45. public override void OnUserShout(RoomUser User, string Message)
  46. {
  47. }
  48.  
  49. public override void OnTimerTick()
  50. {
  51. if (GetBotData() == null)
  52. return;
  53.  
  54. if (SpeechTimer <= 0)
  55. {
  56. if (GetBotData().RandomSpeech.Count > 0)
  57. {
  58. if (GetBotData().AutomaticChat == false)
  59. return;
  60.  
  61. RandomSpeech Speech = GetBotData().GetRandomSpeech();
  62.  
  63. string String = PlusEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Speech.Message, out string word) ? "SPAM" : Speech.Message;
  64. if (String.Contains("<") || String.Contains(">") || String.Contains("'"))
  65. String = "Você realmente tem a certeza que está querendo usar HTML? Seu doido!";
  66. GetRoomUser().Chat(String, false, GetBotData().ChatBubble);
  67. }
  68. SpeechTimer = GetBotData().SpeakingInterval;
  69. }
  70. else
  71. SpeechTimer--;
  72.  
  73. if (ActionTimer <= 0)
  74. {
  75. Point nextCoord;
  76. switch (GetBotData().WalkingMode.ToLower())
  77. {
  78. default:
  79. case "stand":
  80. // (8) Why is my life so boring?
  81. break;
  82.  
  83. case "freeroam":
  84. if (GetBotData().ForcedMovement)
  85. {
  86. if (GetRoomUser().Coordinate == GetBotData().TargetCoordinate)
  87. {
  88. GetBotData().ForcedMovement = false;
  89. GetBotData().TargetCoordinate = new Point();
  90.  
  91. GetRoomUser().MoveTo(GetBotData().TargetCoordinate.X, GetBotData().TargetCoordinate.Y);
  92. }
  93. }
  94. else if (GetBotData().ForcedUserTargetMovement > 0)
  95. {
  96. RoomUser Target = GetRoom().GetRoomUserManager().GetRoomUserByHabbo(GetBotData().ForcedUserTargetMovement);
  97. if (Target == null)
  98. {
  99. GetBotData().ForcedUserTargetMovement = 0;
  100. GetRoomUser().ClearMovement(true);
  101. }
  102. else
  103. {
  104. var Sq = new Point(Target.X, Target.Y);
  105.  
  106. if (Target.RotBody == 0)
  107. {
  108. Sq.Y--;
  109. }
  110. else if (Target.RotBody == 2)
  111. {
  112. Sq.X++;
  113. }
  114. else if (Target.RotBody == 4)
  115. {
  116. Sq.Y++;
  117. }
  118. else if (Target.RotBody == 6)
  119. {
  120. Sq.X--;
  121. }
  122.  
  123.  
  124. GetRoomUser().MoveTo(Sq);
  125. }
  126. }
  127. else if (GetBotData().TargetUser == 0)
  128. {
  129. nextCoord = GetRoom().GetGameMap().GetRandomWalkableSquare();
  130. GetRoomUser().MoveTo(nextCoord.X, nextCoord.Y);
  131. }
  132. break;
  133.  
  134. case "specified_range":
  135.  
  136. break;
  137. }
  138.  
  139. ActionTimer = new Random(DateTime.Now.Millisecond + this.VirtualId ^ 2).Next(5, 15);
  140. }
  141. else
  142. ActionTimer--;
  143. }
  144. }
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement