Ejemplo n.º 1
0
 public RecursiveSearch(Dictionary <int, int> inventory, CraftingSource craftingSource, int maxDepth)
 {
     PossibleCraftCache = new Dictionary <Recipe, bool>();
     Inventory          = inventory;
     CraftingSource     = craftingSource;
     MaxDepth           = maxDepth;
 }
Ejemplo n.º 2
0
        public static void FindRecipes(Dictionary <int, int> inventory)
        {
            RecipeInfoCache.Clear();
            RecursiveSearch recursiveSearch = new RecursiveSearch(inventory, CraftingSource.PlayerAsCraftingSource());

            SortedSet <int> sortedAvailableRecipes = new SortedSet <int>();

            foreach (int n in SortedRecipeList)
            {
                Recipe recipe = Main.recipe[n];
                if (recipe is CompoundRecipe compoundRecipe)
                {
                    recipe = compoundRecipe.OverridenRecipe;
                }
                RecipeInfo recipeInfo = recursiveSearch.FindIngredientsForRecipe(recipe);
                if (recipeInfo != null)
                {
                    if (recipeInfo.RecipeUsed.Count > 1)
                    {
                        RecipeInfoCache.Add(recipe, recipeInfo);
                    }
                    sortedAvailableRecipes.Add(n);
                }
            }

            foreach (int availableRecipe in sortedAvailableRecipes)
            {
                Main.availableRecipe[Main.numAvailableRecipes++] = availableRecipe;
            }
        }
Ejemplo n.º 3
0
 public RecursiveSearch(Dictionary <int, int> inventory, CraftingSource craftingSource) : this(inventory,
                                                                                               craftingSource, RecursiveCraft.DepthSearch)
 {
 }