private static List <Recipe> ParseRecipeJson(List <RecipeJson> json) { var recipes = new List <Recipe>(); foreach (var item in json) { var recipe = new Recipe(); recipe.Id = item.Id.ObjectIdValue; recipe.Name = item.Name; foreach (var sessionItem in item.Session) { if (sessionItem.Name.Trim() == "Ingredientes") { foreach (var contentItem in sessionItem.Content) { var ingredientItem = new Ingredient(); ingredientItem.RecipeId = item.Id.ObjectIdValue; ingredientItem.Description = contentItem.Trim(); recipe.Ingredient.Add(ingredientItem); } } if (sessionItem.Name.Trim() == "Modo de Preparo") { foreach (var contentItem in sessionItem.Content) { var preparationModeItem = new PreparationMode(); preparationModeItem.RecipeId = item.Id.ObjectIdValue; preparationModeItem.Description = contentItem.Trim(); recipe.PreparationMode.Add(preparationModeItem); } } if (sessionItem.Name.Trim() == "Outras informações") { foreach (var contentItem in sessionItem.Content) { var otherInfoItem = new OtherInfo(); otherInfoItem.RecipeId = item.Id.ObjectIdValue; otherInfoItem.Description = contentItem.Trim(); recipe.OtherInfo.Add(otherInfoItem); } } } recipes.Add(recipe); } return(recipes); }
public SpellcastingFeature(string name, string text, string spellcastingID, Ability spellcastingAbility, string displayName, PreparationMode preparation, string prepareableSpells, Ability prepareCountAdditionalModifier = Ability.None, int prepareCountPerClassLevel = 1, bool overwrittenByMulticlassing = true, int level = 1, bool hidden = false) : base(name, text, level, hidden) { Preparation = preparation; SpellcastingID = spellcastingID; DisplayName = displayName; PrepareableSpells = prepareableSpells; OverwrittenByMulticlassing = overwrittenByMulticlassing; PrepareCountAdditionalModifier = prepareCountAdditionalModifier; PrepareCountPerClassLevel = prepareCountPerClassLevel; PreparationChange = RechargeModifier.LongRest; SpellcastingAbility = spellcastingAbility; PrepareCountAdditional = 0; }
public SpellChoiceFeature(string name, string text, string spellcastingID, string uniqueID, string availableSpellChoices, int amount = 1, PreparationMode addTo = PreparationMode.LearnSpells, List <Keyword> kwToAdd = null, int level = 1, bool hidden = false) : base(name, text, level, hidden) { SpellcastingID = spellcastingID; UniqueID = uniqueID; AddTo = addTo; AvailableSpellChoices = availableSpellChoices; if (kwToAdd == null) { KeywordsToAdd = new List <Keyword>(); } else { KeywordsToAdd = kwToAdd; } Amount = amount; }