/*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="recipe">The recipe to parse.</param>
 /// <param name="reflectionHelper">Simplifies access to private game code.</param>
 public RecipeModel(CraftingRecipe recipe, IReflectionHelper reflectionHelper)
     : this(
         name : recipe.name,
         type : recipe.isCookingRecipe ? RecipeType.Cooking : RecipeType.CraftingMenu,
         ingredients : reflectionHelper.GetPrivateField <Dictionary <int, int> >(recipe, "recipeList").GetValue(),
         item : recipe.createItem,
         mustBeLearned : true
         )
 {
 }
Exemple #2
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="recipe">The recipe to parse.</param>
 /// <param name="reflectionHelper">Simplifies access to private game code.</param>
 /// <param name="translations">Provides translations stored in the mod folder.</param>
 public RecipeModel(CraftingRecipe recipe, IReflectionHelper reflectionHelper, ITranslationHelper translations)
     : this(
         key : recipe.name,
         displayType : translations.Get(recipe.isCookingRecipe ? L10n.RecipeTypes.Cooking : L10n.RecipeTypes.Crafting),
         ingredients : reflectionHelper.GetPrivateField <Dictionary <int, int> >(recipe, "recipeList").GetValue(),
         item : item => recipe.createItem(),
         mustBeLearned : true
         )
 {
 }
Exemple #3
0
 public static TValue GetFieldValue <TValue>(this IReflectionHelper reflection, object obj, string name, bool required = true)
 {
     return(reflection.GetPrivateField <TValue>(obj, name, required).GetValue());
 }