Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using Plus.HabboHotel.GameClients;
- using Plus.HabboHotel.Rooms.AI.Speech;
- using Plus.Communication.Packets.Outgoing.Inventory.Purse;
- namespace Plus.HabboHotel.Rooms.AI.Types
- {
- public class GenericBot : BotAI
- {
- private int VirtualId;
- private static readonly Random Random = new Random();
- private int ActionTimer = 0;
- private int SpeechTimer = 0;
- public GenericBot(int VirtualId)
- {
- this.VirtualId = VirtualId;
- }
- public override void OnSelfEnterRoom()
- {
- }
- public override void OnSelfLeaveRoom(bool Kicked)
- {
- }
- public override void OnUserEnterRoom(RoomUser User)
- {
- }
- public override void OnUserLeaveRoom(GameClient Client)
- {
- }
- public override void OnUserSay(RoomUser User, string Message)
- {
- }
- public override void OnUserShout(RoomUser User, string Message)
- {
- }
- public override void OnTimerTick()
- {
- if (GetBotData() == null)
- return;
- if (SpeechTimer <= 0)
- {
- if (GetBotData().RandomSpeech.Count > 0)
- {
- if (GetBotData().AutomaticChat == false)
- return;
- RandomSpeech Speech = GetBotData().GetRandomSpeech();
- string String = PlusEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Speech.Message, out string word) ? "SPAM" : Speech.Message;
- if (String.Contains("<") || String.Contains(">") || String.Contains("'"))
- String = "Você realmente tem a certeza que está querendo usar HTML? Seu doido!";
- GetRoomUser().Chat(String, false, GetBotData().ChatBubble);
- }
- SpeechTimer = GetBotData().SpeakingInterval;
- }
- else
- SpeechTimer--;
- if (ActionTimer <= 0)
- {
- Point nextCoord;
- switch (GetBotData().WalkingMode.ToLower())
- {
- default:
- case "stand":
- // (8) Why is my life so boring?
- break;
- case "freeroam":
- if (GetBotData().ForcedMovement)
- {
- if (GetRoomUser().Coordinate == GetBotData().TargetCoordinate)
- {
- GetBotData().ForcedMovement = false;
- GetBotData().TargetCoordinate = new Point();
- GetRoomUser().MoveTo(GetBotData().TargetCoordinate.X, GetBotData().TargetCoordinate.Y);
- }
- }
- else if (GetBotData().ForcedUserTargetMovement > 0)
- {
- RoomUser Target = GetRoom().GetRoomUserManager().GetRoomUserByHabbo(GetBotData().ForcedUserTargetMovement);
- if (Target == null)
- {
- GetBotData().ForcedUserTargetMovement = 0;
- GetRoomUser().ClearMovement(true);
- }
- else
- {
- var Sq = new Point(Target.X, Target.Y);
- if (Target.RotBody == 0)
- {
- Sq.Y--;
- }
- else if (Target.RotBody == 2)
- {
- Sq.X++;
- }
- else if (Target.RotBody == 4)
- {
- Sq.Y++;
- }
- else if (Target.RotBody == 6)
- {
- Sq.X--;
- }
- GetRoomUser().MoveTo(Sq);
- }
- }
- else if (GetBotData().TargetUser == 0)
- {
- nextCoord = GetRoom().GetGameMap().GetRandomWalkableSquare();
- GetRoomUser().MoveTo(nextCoord.X, nextCoord.Y);
- }
- break;
- case "specified_range":
- break;
- }
- ActionTimer = new Random(DateTime.Now.Millisecond + this.VirtualId ^ 2).Next(5, 15);
- }
- else
- ActionTimer--;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement