Ejemplo n.º 1
0
        private bool ParseRewards(PgSkill item, object value, string parsedFile, string parsedKey)
        {
            PgRewardList ParsedRewardList = null !;

            if (!Inserter <PgRewardList> .SetItemProperty((PgRewardList valueRewardList) => ParsedRewardList = valueRewardList, value))
            {
                return(false);
            }

            foreach (PgReward Reward in ParsedRewardList.List)
            {
                int         Level = Reward.RewardLevel;
                List <Race> RaceRestrictionList = Reward.RaceRestrictionList;
                string?     AbilityKey          = Reward.Ability_Key;
                string?     BonusLevelSkillKey  = Reward.BonusLevelSkill_Key;
                string?     RecipeKey           = Reward.Recipe_Key;
                string      Notes = Reward.Notes;

                if (AbilityKey != null)
                {
                    PgSkillAdvancement NewSkillAdvancement = new PgSkillAdvancementRewardAbility()
                    {
                        RawLevel = Level, RaceRestrictionList = RaceRestrictionList, Ability_Key = AbilityKey
                    };

                    ParsingContext.AddSuplementaryObject(NewSkillAdvancement);
                    item.SkillAdvancementList.Add(NewSkillAdvancement);
                }

                if (BonusLevelSkillKey != null)
                {
                    PgSkillAdvancement NewSkillAdvancement = new PgSkillAdvancementRewardBonusLevel()
                    {
                        RawLevel = Level, RaceRestrictionList = RaceRestrictionList, BonusLevelSkill_Key = BonusLevelSkillKey
                    };

                    ParsingContext.AddSuplementaryObject(NewSkillAdvancement);
                    item.SkillAdvancementList.Add(NewSkillAdvancement);
                }

                if (RecipeKey != null)
                {
                    PgSkillAdvancement NewSkillAdvancement = new PgSkillAdvancementRewardRecipe()
                    {
                        RawLevel = Level, RaceRestrictionList = RaceRestrictionList, Recipe_Key = RecipeKey
                    };

                    ParsingContext.AddSuplementaryObject(NewSkillAdvancement);
                    item.SkillAdvancementList.Add(NewSkillAdvancement);
                }

                if (Notes.Length > 0)
                {
                    PgSkillAdvancement NewSkillAdvancement = new PgSkillAdvancementNotes()
                    {
                        RawLevel = Level, RaceRestrictionList = RaceRestrictionList, Text = Notes
                    };

                    ParsingContext.AddSuplementaryObject(NewSkillAdvancement);
                    item.SkillAdvancementList.Add(NewSkillAdvancement);
                }
            }

            return(true);
        }