Beispiel #1
0
        // Token: 0x06003B1D RID: 15133 RVA: 0x0010E31C File Offset: 0x0010C51C
        public static int GetRandomBattleArmyActors(IConfigDataLoader configDataLoader, List <int> randomArmies, RandomNumber randomNumber, out List <RandomArmyActor> actors)
        {
            actors = new List <RandomArmyActor>();
            Dictionary <int, int> dictionary = new Dictionary <int, int>();

            foreach (int key in randomArmies)
            {
                ConfigDataBattleRandomArmyInfo configDataBattleRandomArmyInfo = configDataLoader.GetConfigDataBattleRandomArmyInfo(key);
                if (configDataBattleRandomArmyInfo == null)
                {
                    return(-919);
                }
                for (int i = 0; i < configDataBattleRandomArmyInfo.RandomArmyActors.Count; i++)
                {
                    dictionary.Add(i, configDataBattleRandomArmyInfo.RandomArmyActors[i].Weight);
                }
                int randomNumberByAccumulateWeight = randomNumber.GetRandomNumberByAccumulateWeight(dictionary);
                if (randomNumberByAccumulateWeight == -2147483648)
                {
                    return(-920);
                }
                actors.Add(configDataBattleRandomArmyInfo.RandomArmyActors[randomNumberByAccumulateWeight]);
                dictionary.Clear();
            }
            return(0);
        }
Beispiel #2
0
        // Token: 0x06003B1F RID: 15135 RVA: 0x0010E4F8 File Offset: 0x0010C6F8
        public static void GetRandomTalentSkills(IConfigDataLoader configDataLoader, int randomTalentId, List <int> randomTalentProbilities, RandomNumber randomNumber, out List <ConfigDataSkillInfo> actorTalentSkillInfos)
        {
            actorTalentSkillInfos = new List <ConfigDataSkillInfo>();
            int randomTalentSkillId = BattleUtility.GetRandomTalentSkillId(configDataLoader, randomNumber, randomTalentId);
            ConfigDataSkillInfo configDataSkillInfo = configDataLoader.GetConfigDataSkillInfo(randomTalentSkillId);

            if (configDataSkillInfo == null)
            {
                return;
            }
            foreach (int num in randomTalentProbilities)
            {
                if (randomNumber.Next(0, 10000) < num)
                {
                    actorTalentSkillInfos.Add(configDataSkillInfo);
                }
                else
                {
                    actorTalentSkillInfos.Add(null);
                }
            }
        }
Beispiel #3
0
        // Token: 0x06003B1C RID: 15132 RVA: 0x0010E104 File Offset: 0x0010C304
        public static int AppendPveOpponentBattleActorSetups(IConfigDataLoader configDataLoader, ConfigDataBattleInfo battleInfo, int monsterLevel, int randomSeed, List <BattleActorSetup> actors)
        {
            List <RandomArmyActor> list = null;

            if (battleInfo.BattleRandomEnemies_ID.Count > 0)
            {
                RandomNumber randomNumber = new RandomNumber();
                randomNumber.SetSeed(randomSeed);
                int randomBattleArmyActors = BattleUtility.GetRandomBattleArmyActors(configDataLoader, battleInfo.BattleRandomEnemies_ID, randomNumber, out list);
                if (randomBattleArmyActors != 0)
                {
                    return(randomBattleArmyActors);
                }
            }
            List <ConfigDataSkillInfo> list2 = null;

            if (battleInfo.EnemyRandomTalentProbilities.Count > 0)
            {
                RandomNumber randomNumber2 = new RandomNumber();
                randomNumber2.SetSeed(randomSeed);
                BattleUtility.GetRandomTalentSkills(configDataLoader, battleInfo.EnemyRandomTalent_ID, battleInfo.EnemyRandomTalentProbilities, randomNumber2, out list2);
            }
            for (int i = 0; i < battleInfo.EnemyActors.Count; i++)
            {
                BattlePosActor battlePosActor = battleInfo.EnemyActors[i];
                int            key            = battlePosActor.ID;
                int            num            = battlePosActor.Level;
                int            behaviorId     = 0;
                if (battleInfo.EnemyActorsBehavior.Count > i)
                {
                    behaviorId = battleInfo.EnemyActorsBehavior[i];
                }
                int groupId = 0;
                if (battleInfo.EnemyGroups.Count > i)
                {
                    groupId = battleInfo.EnemyGroups[i];
                }
                if (list != null && i < list.Count && list[i] != null)
                {
                    key        = list[i].HeroID;
                    num        = list[i].Level;
                    behaviorId = list[i].AI;
                }
                if (num == 0)
                {
                    num = monsterLevel;
                }
                ConfigDataHeroInfo configDataHeroInfo = configDataLoader.GetConfigDataHeroInfo(key);
                if (configDataHeroInfo == null)
                {
                    return(-618);
                }
                BattleHero       hero             = BattleUtility.CreateDefaultConfigBattleHero(configDataHeroInfo);
                BattleActorSetup battleActorSetup = BattleUtility.CreateBattleActorSetupFromBattleHero(configDataLoader, hero, num, behaviorId, groupId);
                battleActorSetup.Position.x = battlePosActor.X;
                battleActorSetup.Position.y = battlePosActor.Y;
                battleActorSetup.Direction  = 0;
                if (battleInfo.EnemyDirs.Count > i)
                {
                    battleActorSetup.Direction = battleInfo.EnemyDirs[i];
                }
                battleActorSetup.IsNpc = false;
                if (list2 != null && i < list2.Count)
                {
                    battleActorSetup.ExtraTalentSkillInfo = list2[i];
                }
                actors.Add(battleActorSetup);
            }
            return(0);
        }