public JsonRecipe(RecipeFamily recipe) { Key = recipe.RecipeName; Untranslated = recipe.DisplayName.NotTranslated; BaseCraftTime = recipe.CraftMinutes?.GetBaseValue ?? 0; BaseLaborCost = recipe.Labor; BaseXPGain = recipe.ExperienceOnCraft; CraftStation = FMZUtils.GetTablesForRecipe(recipe); DefaultVariant = recipe.DefaultRecipe.DisplayName; NumberOfVariants = recipe.Recipes.Count; SkillNeeds = recipe.RequiredSkills.Select(t => new JsonSkillNeeds { Skill = t.SkillItem.DisplayName, Level = t.Level }).ToList(); Variants = recipe.Recipes.Select(recipe => new JsonRecipeVariant { Key = recipe.Name, Name = recipe.DisplayName.NotTranslated, Ingredients = recipe.Ingredients.Select(ingredient => new JsonRecipeIngredient { IsSpecificItem = ingredient.IsSpecificItem, Tag = ingredient.Tag?.DisplayName, Name = ingredient.Item?.DisplayName.NotTranslated ?? "", Ammount = ingredient.Quantity?.GetBaseValue ?? 0, IsStatic = ingredient.Quantity is ConstantValue }).ToList(), Products = recipe.Items.Select(prod => new JsonRecipeProduct { Name = prod.Item.DisplayName, Ammount = prod.Quantity.GetBaseValue, }).ToList() }).ToList(); }
private static void UpdateRecipesFromSkills(InfoBuilder info, TechTreeSimData data) { while (data.SkillsToEvaluate.Any()) { var skill = data.SkillsToEvaluate.Dequeue(); data.CurSkills.Add(skill); info.AppendLineLocStr("Adding Skill: " + skill.Name); foreach (var recipe in RecipeFamily.GetRecipesBySkill(skill)) { data.UnusableRecipes.AddRange(recipe.Recipes); } UpdateRecipes(info, data); } }
public void Delete(long recipeFamilyID) { RecipeFamily recipeFamily = Get(recipeFamilyID); IEnumerable <long> recipeIDs = GetAllRecipeVariants(recipeFamily.Id).Select(r => r.Id); foreach (long id in recipeIDs) { //Let the Recipe Service deal with removing all information for the recipe recipeService.Delete(id); } //At this point, no child objects/data remain that are associated with recipeFamily recipeFamilyRepository.Remove(recipeFamily); recipeFamilyRepository.SaveChanges(); //null out the references to completely remove the objects from memeory. recipeIDs = null; recipeFamily = null; }
public void Update(RecipeFamily changedRecipeFamily) { recipeFamilyRepository.Update(changedRecipeFamily); }
public void Insert(RecipeFamily newRecipeFamily) { recipeFamilyRepository.Insert(newRecipeFamily); }
public static List <string> GetTablesForRecipe(RecipeFamily recipe) { return(CraftingComponent.TablesForRecipe(recipe.GetType()).Select(type => GetTableNameFromUILink(WorldObject.UILink(type, false))).ToList()); }