コード例 #1
0
        internal override void OnTimerTick()
        {
            if (SpeechTimer <= 0)
            {
                if (GetBotData() != null)
                {
                    if (GetBotData().RandomSpeech.Count > 0)
                    {
                        RandomSpeech Speech = GetBotData().GetRandomSpeech();
                        GetRoomUser().Chat(null, Speech.Message, Speech.Shout);
                    }
                }

                SpeechTimer = ButterflyEnvironment.GetRandomNumber(0, 150);
            }
            else
            {
                SpeechTimer--;
            }

            if (ActionTimer <= 0)
            {
                Point nextCoord = GetRoom().GetGameMap().getRandomWalkableSquare();
                //int randomX = ButterflyEnvironment.GetRandomNumber(0, GetRoom().Model.MapSizeX);
                //int randomY = ButterflyEnvironment.GetRandomNumber(0, GetRoom().Model.MapSizeY);

                GetRoomUser().MoveTo(nextCoord.X, nextCoord.Y);

                ActionTimer = ButterflyEnvironment.GetRandomNumber(0, 30);
            }
            else
            {
                ActionTimer--;
            }
        }
コード例 #2
0
        internal override void OnTimerTick()
        {
            if (GetBotData() == null)
            {
                return;
            }
            if (SpeechTimer <= 0)
            {
                if (GetBotData().RandomSpeech.Count > 0)
                {
                    RandomSpeech Speech = GetBotData().GetRandomSpeech();
                    GetRoomUser().Chat(null, Speech.Message, Speech.Shout);
                }

                SpeechTimer = ButterflyEnvironment.GetRandomNumber(10, 300);
            }
            else
            {
                SpeechTimer--;
            }

            if (ActionTimer <= 0)
            {
                switch (GetBotData().WalkingMode.ToLower())
                {
                default:
                case "stand":

                    // (8) Why is my life so boring?

                    break;

                case "freeroam":
                    Point nextCoord = GetRoom().GetGameMap().getRandomWalkableSquare();
                    GetRoomUser().MoveTo(nextCoord.X, nextCoord.Y);

                    break;

                case "specified_range":
                    Point nextCoord2 = GetRoom().GetGameMap().getRandomWalkableSquare();
                    GetRoomUser().MoveTo(nextCoord2.X, nextCoord2.Y);

                    break;
                }

                ActionTimer = ButterflyEnvironment.GetRandomNumber(1, 30);
            }
            else
            {
                ActionTimer--;
            }
        }
コード例 #3
0
ファイル: SoplonBot.cs プロジェクト: LuxuryJared/Coolmemes
        internal override void OnTimerTick()
        {
            if (GetBotData() == null)
            {
                return;
            }

            if (SpeechTimer <= 0)
            {
                if (GetBotData().RandomSpeech.Count > 0 && GetBotData().ChatEnabled)
                {
                    RandomSpeech Speech = GetBotData().GetRandomSpeech();
                    GetRoomUser().Chat(null, Speech.Message, OtanixEnvironment.GetGame().GetRoomRankConfig().BOTS_DEFAULT_COLOR, false);
                }

                try
                {
                    SpeechTimer = GetBotData().ChatSeconds * 2;
                }
                catch (Exception e)
                {
                    Logging.LogThreadException(e.ToString(), "Error in SpeechTimer Bot: (" + GetBotData().ChatSeconds + "): ");
                    SpeechTimer = 30;
                }
            }
            else
            {
                SpeechTimer--;
            }

            if (ActionTimer <= 0)
            {
                if (GetBotData().WalkingEnabled&& GetBotData().followingUser == null)
                {
                    var nextCoord = GetRoom().GetGameMap().getRandomWalkableSquare();
                    GetRoomUser().MoveTo(nextCoord.X, nextCoord.Y);
                }

                ActionTimer = new Random().Next(1, 30);
            }
            else
            {
                ActionTimer--;
            }

            if (FollowTimer <= 0)
            {
                if (GetBotData().followingUser != null)
                {
                    RoomUser user = GetRoom().GetRoomUserManager().GetRoomUserByHabbo(GetBotData().followingUser.HabboId);
                    if (user != null)
                    {
                        GetRoomUser().MoveTo(GetBotData().followingUser.SquareInFront);
                    }
                }
                else
                {
                    GetBotData().followingUser = null;
                }

                FollowTimer = 1;
            }
            else
            {
                FollowTimer--;
            }
        }