Beispiel #1
0
        /// <summary>
        /// Generates the bot from row.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns>RoomBot.</returns>
        internal static RoomBot GenerateBotFromRow(DataRow row)
        {
            if (row == null)
            {
                return(null);
            }

            var id = Convert.ToUInt32(row["id"]);

            AIType Type = AIType.Generic;

            switch (Convert.ToString(row["ai_type"]))
            {
            case "hospitalbot":
                Type = AIType.HospitalBot;
                break;

            case "miscbot":
                Type = AIType.MiscBot;
                break;

            case "weedbot":
                Type = AIType.WeedBot;
                break;

            case "eventsguide":
                Type = AIType.EventsGuide;
                break;

            case "generic":
            default:
                Type = AIType.Generic;
                break;
            }

            List <string> speeches = null;

            if (!row.IsNull("speech") && !string.IsNullOrEmpty(row["speech"].ToString()))
            {
                speeches = row["speech"].ToString().Split(';').ToList();
            }

            var bot = new RoomBot(id, Convert.ToUInt32(row["user_id"]), Type,
                                  row["is_bartender"].ToString() == "1");

            bot.Update(Convert.ToUInt32(row["room_id"]), (string)row["walk_mode"], (string)row["name"], (string)row["motto"],
                       (string)row["look"],
                       int.Parse(row["x"].ToString()), int.Parse(row["y"].ToString()), int.Parse(row["z"].ToString()), 4, 0, 0,
                       0, 0, speeches, null, (string)row["gender"], (int)row["dance"], (int)row["speaking_interval"],
                       Convert.ToInt32(row["automatic_chat"]) == 1, Convert.ToInt32(row["mix_phrases"]) == 1);

            return(bot);
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericBot"/> class.
        /// </summary>
        /// <param name="roomBot">The room bot.</param>
        /// <param name="virtualId">The virtual identifier.</param>
        /// <param name="botId">The bot identifier.</param>
        /// <param name="type">The type.</param>
        /// <param name="isBartender">if set to <c>true</c> [is bartender].</param>
        /// <param name="speechInterval">The speech interval.</param>
        internal GenericBot(RoomBot roomBot, int virtualId, int botId, AIType type, bool isBartender, int speechInterval)
        {
            _id             = botId;
            _virtualId      = virtualId;
            _isBartender    = isBartender;
            _speechInterval = speechInterval < 2 ? 2000 : speechInterval * 1000;

            // Get random speach
            if (roomBot != null && roomBot.AutomaticChat && roomBot.RandomSpeech != null && roomBot.RandomSpeech.Any())
            {
                _chatTimer = new Timer(ChatTimerTick, null, _speechInterval, _speechInterval);
            }
            _actionCount = Random.Next(10, 30 + virtualId);
        }
Beispiel #3
0
        /// <summary>
        /// Called when [self enter room].
        /// </summary>
        internal override void OnSelfEnterRoom()
        {
            ApplyEffect(1);
            RoomBot Pet = this.GetBotData();

            if (RPType == "dragon")
            {
                Shout("*Breathes a giant gust of fire into the air*");
            }
            // Initialize RP Stats
            this.GetBotData().InitRPStats();
            this.MaxHealth      = (int)Pet.GetRPStat("rp_maxhealth");
            this.Str            = (int)Pet.GetRPStat("rp_str");
            this.FollowInterval = (int)Pet.GetRPStat("rp_follow_interval");
            this.CoolDown       = (int)Pet.GetRPStat("rp_cooldown");
            this.CurCoolDown    = 0;
            this.RPType         = (string)Pet.GetRPStat("rp_type");
            this.CurHealth      = this.MaxHealth;

            // Initialize some shit init
            GameClient OwnerSession = HabboHotel.Roleplay.Misc.RoleplayManager.GenerateSession(GetRoomUser().PetData.OwnerName);

            if (OwnerSession == null)
            {
                return;
            }

            MyOwner = OwnerSession.GetHabbo().GetRoomUser();

            if (MyOwner == null)
            {
                return;
            }

            GetRoomUser().FollowingOwner       = MyOwner;
            GetRoomUser().FollowingOwner.MyPet = GetRoomUser();
        }