Beispiel #1
0
        public void Init()
        {
            this._enemyBot.Clear();
            this._enemyPet.Clear();
            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM roleplay_enemy");
                DataTable table1 = dbClient.GetTable();
                if (table1 != null)
                {
                    foreach (DataRow dataRow in table1.Rows)
                    {
                        if ((this._enemyBot.ContainsKey(Convert.ToInt32(dataRow["id"])) && (string)dataRow["type"] == "bot") || (this._enemyPet.ContainsKey(Convert.ToInt32(dataRow["id"])) && (string)dataRow["type"] == "pet"))
                        {
                            continue;
                        }

                        RPEnemy Config = new RPEnemy((int)dataRow["id"], (int)dataRow["health"], (int)dataRow["weaponFarId"], (int)dataRow["weaponCacId"], (int)dataRow["deadTimer"],
                                                     (int)dataRow["lootItemId"], (int)dataRow["moneyDrop"], Convert.ToInt32((string)dataRow["dropScriptId"]), (int)dataRow["teamId"], (int)dataRow["aggroDistance"],
                                                     (int)dataRow["zoneDistance"], Convert.ToInt32((string)dataRow["resetPosition"]) == 1, (int)dataRow["lostAggroDistance"], Convert.ToInt32((string)dataRow["zombieMode"]) == 1);

                        if ((string)dataRow["type"] == "bot")
                        {
                            this._enemyBot.Add((int)dataRow["id"], Config);
                        }
                        else
                        {
                            this._enemyPet.Add((int)dataRow["id"], Config);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void SetConfig(RPEnemy EnemyConfig)
        {
            this.Config = EnemyConfig;

            this.Health    = this.Config.Health;
            this.WeaponGun = ButterflyEnvironment.GetGame().GetRoleplayManager().GetWeaponManager().GetWeaponGun(this.Config.WeaponGunId);
            this.WeaponCac = ButterflyEnvironment.GetGame().GetRoleplayManager().GetWeaponManager().GetWeaponCac(this.Config.WeaponCacId);
        }
Beispiel #3
0
        public RPEnemy GetEnemyPet(int Id)
        {
            if (!this._enemyPet.ContainsKey(Id))
            {
                return(null);
            }

            RPEnemy enemy = null;

            this._enemyPet.TryGetValue(Id, out enemy);
            return(enemy);
        }
Beispiel #4
0
        public RPEnemy AddEnemyPet(int PetId)
        {
            if (this._enemyPet.ContainsKey(PetId))
            {
                return(this.GetEnemyPet(PetId));
            }

            using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
                queryreactor.RunQuery("INSERT INTO `roleplay_enemy` (`id`, `type`, `weaponFarId`) VALUES ('" + PetId + "', 'pet', '0');");

            RPEnemy EnemyConfig = new RPEnemy(PetId, 100, 0, 0, 0, 0, 0, 5461, 0, 0, 0, true, 12, false);

            this._enemyPet.Add(PetId, EnemyConfig);
            return(this.GetEnemyPet(PetId));
        }
Beispiel #5
0
        public RoleBot(RPEnemy EnemyConfig)
        {
            this.SetConfig(EnemyConfig);

            this.Dead            = false;
            this.AggroVirtuelId  = 0;
            this.AggroTimer      = 0;
            this.ResetBot        = false;
            this.ResetBotTimer   = 0;
            this.HitCount        = 0;
            this.Dodge           = false;
            this.DodgeTimer      = 0;
            this.GunCharger      = 6;
            this.GunLoadTimer    = 0;
            this.DodgeStartCount = ButterflyEnvironment.GetRandomNumber(2, 4);
            this.ActionTimer     = ButterflyEnvironment.GetRandomNumber(10, 30);
        }