Exemple #1
0
        public static RoleplayBotAI GetRoleplayBotAI(RoleplayBotAIType Type, int VirtualId)
        {
            switch (Type)
            {
            case RoleplayBotAIType.THUG:
                return(new ThugBot(VirtualId));

            case RoleplayBotAIType.QUEST:
                return(new QuestBot(VirtualId));

            case RoleplayBotAIType.JURY:
                return(new JuryBot(VirtualId));

            case RoleplayBotAIType.HOSP:
                return(new HospitalBot(VirtualId));

            case RoleplayBotAIType.GUNSTORE:
                return(new GunStoreBot(VirtualId));

            case RoleplayBotAIType.PHONESTORE:
                return(new PhoneStoreBot(VirtualId));

            case RoleplayBotAIType.CARSTORE:
                return(new CarStoreBot(VirtualId));

            case RoleplayBotAIType.SUPERMARKET:
                return(new SupermarketBot(VirtualId));

            case RoleplayBotAIType.BANKWORKER:
                return(new BankWorkerBot(VirtualId));

            case RoleplayBotAIType.DRINKSERVER:
                return(new DrinkServerBot(VirtualId));

            case RoleplayBotAIType.FOODSERVER:
                return(new FoodServerBot(VirtualId));

            case RoleplayBotAIType.BUSINESS:
                return(new BusinessBot(VirtualId));

            case RoleplayBotAIType.DELIVERY:
                return(new DeliveryBot(VirtualId));

            case RoleplayBotAIType.DRUGSELLER:
                return(new DrugSellerBot(VirtualId));

            case RoleplayBotAIType.PLANTSELLER:
                return(new PlantSellerBot(VirtualId));

            case RoleplayBotAIType.MAFIAWARS:
                return(new MafiaWarsBot(VirtualId));

            case RoleplayBotAIType.PET:
                return(new PetBot(VirtualId));

            default:
                return(new BlankBot(VirtualId));
            }
        }
Exemple #2
0
        public static RoleplayBot GetCachedBotByAI(RoleplayBotAIType BotAI)
        {
            RoleplayBot CachedBot = null;

            foreach (RoleplayBot CachedBots in RoleplayBotManager.CachedRoleplayBots.Values)
            {
                if (CachedBots == null)
                {
                    continue;
                }
                if (CachedBots.AIType != BotAI)
                {
                    continue;
                }

                CachedBot = CachedBots;
            }

            return(CachedBot);
        }
Exemple #3
0
        public static RoomUser DeployBotByAI(RoleplayBotAIType BotAI, string SpawnType = "default", int RoomID = 0)
        {
            lock (SyncLock)
            {
                try
                {
                    RoleplayBot Bot = RoleplayBotManager.GetCachedBotByAI(BotAI);

                    if (Bot == null)
                    {
                        return(null);
                    }

                    return(RoleplayBotManager.DeployBotByID(Bot.Id));
                }
                catch (Exception ex)
                {
                    RoleplayBotManager.OnError(ex.Message);
                }
            }

            return(null);
        }
Exemple #4
0
        /// <summary>
        /// Initialises RoleplayBot
        /// </summary>
        public RoleplayBot(int Id, int OwnerId, string Name, string Gender, string Figure, string Motto, int MaxHealth, int CurHealth, int Strength, int Level, int SpawnId, int X, int Y, double Z, int SpawnRot, string AITypeString, RoleplayBotAIType AIType, int RoamInterval, int AttackInterval, int FollowInterval, int RoomStayInterval, bool RoamBot, bool RoamCityBot, bool AddableBot, int Corporation, string StopWorkItem, string WorkUniform, bool CanBeAttacked, int DefaultAttackPosition, string Odds, int RandomSpeechTimer, string PetData)
        {
            this.Id        = Id;
            this.OwnerId   = OwnerId;
            this.Name      = Name;
            this.Gender    = Gender;
            this.Figure    = Figure;
            this.Motto     = Motto;
            this.MaxHealth = MaxHealth;
            this.CurHealth = CurHealth;
            this.Strength  = Strength;
            this.Level     = Level;
            this.SpawnId   = SpawnId;
            this.VirtualId = -1;
            this.Deployed  = false;
            this.Dead      = false;
            this.Jailed    = false;
            this.X         = X;
            this.Y         = Y;
            this.Z         = Z;
            this.oX        = X;
            this.oY        = Y;
            this.oZ        = Z;

            this.AITypeString = AITypeString;
            this.AIType       = AIType;

            this.SpawnRot          = SpawnRot;
            this.RandomSpeechTimer = RandomSpeechTimer;
            this.OriginalId        = SpawnId;

            this.WalkingToItem = false;
            this.ItemWalkingTo = StopWorkItem;
            this.Corporation   = Corporation;
            this.WorkUniform   = WorkUniform;

            List <RandomSpeech> Null = new List <RandomSpeech>();

            this.RoomBotInstance = new RoomBot(Id, SpawnId, "", "", Name, "", Figure, X, Y, Z, SpawnRot, 0, 0, 0, 0, ref Null, Gender, 0, 0, false, 0, false, 0);

            this.RoamBot       = RoamBot;
            this.RoamCityBot   = RoamCityBot;
            this.AddableBot    = AddableBot;
            this.CanBeAttacked = CanBeAttacked;

            this.UserFollowing         = null;
            this.UserAttacking         = null;
            this.Attacking             = false;
            this.Roaming               = RoamBot;
            this.Following             = false;
            this.DefaultAttackPosition = DefaultAttackPosition;

            this.FollowCooldown = new CryptoRandom().Next(0, FollowInterval);
            this.AttackCooldown = new CryptoRandom().Next(0, AttackInterval);
            this.RoamCooldown   = new CryptoRandom().Next(0, RoamInterval);
            this.RoomStayTime   = new CryptoRandom().Next(0, RoomStayInterval);
            this.LookCooldown   = new CryptoRandom().Next(0, LookCooldown);

            this.RoamInterval     = RoamInterval;
            this.AttackInterval   = AttackInterval;
            this.FollowInterval   = FollowInterval;
            this.RoomStayInterval = RoomStayInterval;

            this.TeleporterEntering = null;
            this.TeleporterExiting  = null;
            this.LastTeleport       = null;
            this.Teleporting        = false;
            this.Teleported         = false;

            this.Boss = false;
            this.Team = null;

            this.HabboInstance = new Habbo(Id + RoleplayBotManager.BotFriendMultiplyer, Name, 1, Motto, Figure, Gender, 0, 0, SpawnId, false, 0, false, false, 0, 0, "", "", false, false, false, false, false, 0, 0, false, 0, 0, false, 0, false, false, 0, true, string.Empty);
            this.Invisible     = false;

            this.ActiveTimers = new ConcurrentDictionary <string, BotRoleplayTimer>();
            this.Responses    = new ConcurrentDictionary <string, RoleplayBotResponse>();
            this.RandomSpeech = new List <RandomSpeech>();

            this.OriginalMaxOdds = Convert.ToInt32(Odds.Split(',')[1]);
            this.OriginalMinOdds = Convert.ToInt32(Odds.Split(',')[0]);

            this.MaxOdds = OriginalMaxOdds;
            this.MinOdds = OriginalMinOdds;

            this.PetData = PetData;
            string[] PetParts = this.PetData.Replace(" ", "").Split('|');

            if (this.IsPet)
            {
                this.PetInstance = new Pet(this.Id, this.OwnerId, this.SpawnId, this.Name, Convert.ToInt32(PetParts[0]), PetParts[1], PetParts[2], 0, 0, 0, 0, 0, this.X, this.Y, this.Z, 0, 0, 0, 0, null);
            }
            else
            {
                this.PetInstance = null;
            }
        }