コード例 #1
0
        private void LoadEditRecipe(object sender, EventArgs e)
        {
            RecipeButton btn    = (RecipeButton)sender;
            RecipeEditor editor = new RecipeEditor(_chosenBook, Controller.GetInstance().GetRecipe(_chosenBook, btn.ID));

            Navigate(editor);
        }
コード例 #2
0
        public static void RecipeEditing(Mod mod)
        {
            RecipeFinder finder = new RecipeFinder();

            finder.AddIngredient(ItemID.MechanicalGlove, 1);
            finder.AddIngredient(ItemID.MagmaStone, 1);
            finder.SetResult(ItemID.FireGauntlet, 1);
            //.AddTile(TileID.Workshop);

            foreach (Recipe recipe in finder.SearchRecipes())

            {
                RecipeEditor editor = new RecipeEditor(recipe);
                editor.AddIngredient(2766, 15);
            }

            RecipeFinder finder2 = new RecipeFinder();

            finder2.AddIngredient(2431, 14);
            finder2.AddTile(TileID.Anvils);
            finder2.SetResult(ItemID.HornetStaff);
            Recipe exactRecipe2 = finder2.FindExactRecipe();

            bool isFound2 = exactRecipe2 != null;

            if (isFound2)
            {
                RecipeEditor editor2 = new RecipeEditor(exactRecipe2);
                editor2.DeleteIngredient(2431);
                editor2.AddIngredient(1134, 1);
                editor2.AddIngredient(1124, 20);
                editor2.AddIngredient(209, 15);
                editor2.SetResult(ItemID.HornetStaff);
            }
        }
コード例 #3
0
        public static void RemoveRecipes()
        {
            List <Tuple <int, int[]> > recipesToDelete = new List <Tuple <int, int[]> >
            {
                new Tuple <int, int[]>(ItemID.NightsEdge, new int[] { ItemID.BloodButcherer }),
                new Tuple <int, int[]>(ItemID.MechanicalWorm, new int[] { ItemID.Vertebrae }),
                new Tuple <int, int[]>(ItemID.SuperHealingPotion, new int[0]),
                new Tuple <int, int[]>(ItemID.CelestialSigil, new int[0]),
                new Tuple <int, int[]>(ItemID.FragmentVortex, new int[0]),
                new Tuple <int, int[]>(ItemID.FragmentNebula, new int[0]),
                new Tuple <int, int[]>(ItemID.FragmentSolar, new int[0]),
                new Tuple <int, int[]>(ItemID.FragmentStardust, new int[0])
            };

            foreach (var toDeleteRecipe in recipesToDelete)
            {
                var finder = new RecipeFinder();
                finder.SetResult(toDeleteRecipe.Item1);
                foreach (var ingredient in toDeleteRecipe.Item2)
                {
                    finder.AddIngredient(ingredient);
                }
                foreach (Recipe foundRecipe in finder.SearchRecipes())
                {
                    RecipeEditor editor = new RecipeEditor(foundRecipe);
                    editor.DeleteRecipe();
                }
            }
        }
コード例 #4
0
        public override void AddRecipes()
        {
            RecipeFinder finder = new RecipeFinder();

            finder.AddIngredient(ItemID.Keybrand);
            foreach (Recipe recipe in finder.SearchRecipes())
            {
                RecipeEditor editor = new RecipeEditor(recipe);
                editor.DeleteIngredient(ItemID.Keybrand);
                editor.AddIngredient(ModContent.ItemType <Items.Weapons.Keybrand>());
            }
            finder = new RecipeFinder();
            finder.SetResult(ItemID.Keybrand);
            foreach (Recipe recipe in finder.SearchRecipes())
            {
                RecipeEditor editor = new RecipeEditor(recipe);
                editor.SetResult(ModContent.ItemType <Items.Materials.RustedKeybrand>());
            }
            ModRecipe r = new ModRecipe(this);

            r.AddIngredient(ItemID.HellstoneBar, 15);
            r.AddTile(TileID.Anvils);
            r.SetResult(ItemID.Flamarang);
            r.AddRecipe();
        }
コード例 #5
0
ファイル: RecipeHelper.cs プロジェクト: flexystraws/Terraria
        // Showcase RecipeFinder and RecipeEditor
        // With these classes, you can find and edit recipes
        public static void ExampleRecipeEditing(Mod mod)
        {
            // In the following example, we find recipes that uses a chain as ingredient and then we remove that ingredient from the recipe.
            RecipeFinder finder = new RecipeFinder();           // make a new RecipeFinder

            finder.AddIngredient(ItemID.Chain);                 // add Chain (with a stack of 1) to the finder

            foreach (Recipe recipe in finder.SearchRecipes())   // loop every recipe found by the finder
            {
                RecipeEditor editor = new RecipeEditor(recipe); // for the currently looped recipe, make a new RecipeEditor
                editor.DeleteIngredient(ItemID.Chain);          // delete the Chain ingredient.
            }

            // The following is a more precise example, finding an exact recipe and deleting it if possible.
            finder = new RecipeFinder();                             // make a new RecipeFinder
            finder.AddRecipeGroup("IronBar");                        // add a new recipe group, in this case the vanilla one for iron or lead bars.
            finder.AddTile(TileID.Anvils);                           // add a required tile, any anvil
            finder.SetResult(ItemID.Chain, 10);                      // set the result to be 10 chains
            Recipe exactRecipe = finder.FindExactRecipe();           // try to find the exact recipe matching our criteria

            bool isRecipeFound = exactRecipe != null;                // if our recipe is not null, it means we found the exact recipe

            if (isRecipeFound)                                       // since our recipe is found, we can continue
            {
                RecipeEditor editor = new RecipeEditor(exactRecipe); // for our recipe, make a new RecipeEditor
                editor.DeleteRecipe();                               // delete the recipe
            }
        }
コード例 #6
0
 /// <summary>
 /// Set the ingredient name and add listener to the delete button.
 /// </summary>
 public void SetIngredient(RecipeEditor editor, string name)
 {
     nameText.text = name;
     deleteBtn.onClick.AddListener(() =>
     {
         editor.RemoveIngredient(this);
         Destroy(gameObject);
     });
 }
コード例 #7
0
ファイル: RecipeTweaks.cs プロジェクト: Dierney/VanillaTweaks
        public static void EditVanillaRecipes()
        {
            if (Config.MolotovCraft > 0)
            {
                var recipe = new ModRecipe(VanillaTweaks.Instance);
                recipe.AddIngredient(ItemID.Ale, 5);
                recipe.AddIngredient(ItemID.Torch, 1);
                recipe.AddIngredient(ItemID.Silk, 1);
                recipe.AddIngredient(ItemID.Gel, Config.MolotovCraft);
                recipe.SetResult(ItemID.MolotovCocktail, 5);
                recipe.AddRecipe();
            }
            if (Config.BoneBlockFix)
            {
                var finder = new RecipeFinder();
                finder.AddIngredient(ItemID.BoneBlockWall, 4);
                finder.AddTile(TileID.BoneWelder);
                finder.SetResult(ItemID.BoneBlock, 1);
                var recipe = finder.FindExactRecipe();
                if (recipe != null)
                {
                    recipe.createItem.SetDefaults(ItemID.Bone);
                }
            }
            var foundRecipes = new List <Recipe>();

            if (Config.JestersArrowCraft == 0)
            {
                foreach (var recipe in Main.recipe)
                {
                    if (recipe != null && recipe.createItem != null && recipe.createItem.type == ItemID.JestersArrow)
                    {
                        foundRecipes.Add(recipe);
                    }
                }

                foreach (var recipe in foundRecipes)
                {
                    var editor = new RecipeEditor(recipe);
                    editor.DeleteRecipe();
                }
                foundRecipes.Clear();
            }
            else
            {
                foreach (var recipe in Main.recipe)
                {
                    if (recipe != null && recipe.createItem != null && recipe.createItem.type == ItemID.JestersArrow)
                    {
                        var editor = new RecipeEditor(recipe);
                        editor.SetIngredientStack(ItemID.WoodenArrow, Config.JestersArrowCraft);
                        editor.SetResult(ItemID.JestersArrow, Config.JestersArrowCraft);
                    }
                }
            }
        }
 public static void DestroyRecipes()
 {
     foreach (short lunarTool in LunarTools)
     {
         RecipeFinder finder = new RecipeFinder();
         finder.SetResult(lunarTool);
         List <Terraria.Recipe> recipes = finder.SearchRecipes();
         recipes.ForEach(x => { var editor = new RecipeEditor(x); editor.DeleteRecipe(); });
     }
 }
コード例 #9
0
ファイル: RecipeWrapper.cs プロジェクト: dennisw100/Tremor
            public static bool DeleteAlike()
            {
                List <Recipe> recipes = Finder.SearchRecipes();

                foreach (Recipe recipe in recipes)
                {
                    Editor = new RecipeEditor(recipe);
                    Editor.DeleteRecipe();
                }
                return(recipes.Count > 0);
            }
コード例 #10
0
ファイル: RecipeManager.cs プロジェクト: HumanGamer/TUA
        public static void removeRecipe(int itemID)
        {
            RecipeFinder rf = new RecipeFinder();

            rf.SetResult(itemID);

            foreach (Recipe r in rf.SearchRecipes())
            {
                RecipeEditor re = new RecipeEditor(r);
                re.DeleteRecipe();
            }
        }
コード例 #11
0
        public override void AddRecipes()
        {
            RecipeFinder finder = new RecipeFinder();

            finder.AddIngredient(ItemID.Amethyst, 8);
            finder.AddIngredient(ItemID.CopperBar, 10);
            foreach (Recipe recipe in finder.SearchRecipes())
            {
                RecipeEditor editor = new RecipeEditor(recipe);
                editor.DeleteRecipe();
            }
        }
コード例 #12
0
ファイル: RecipeWrapper.cs プロジェクト: dennisw100/Tremor
            public static bool DeleteExact()
            {
                Recipe foundRecipe = Finder.FindExactRecipe();

                if (foundRecipe != null)
                {
                    Editor = new RecipeEditor(foundRecipe);
                    Editor.DeleteRecipe();
                    return(true);
                }
                return(false);
            }
コード例 #13
0
ファイル: RecipeHelper.cs プロジェクト: W1K1/tsorcRevamp
        public static void RecipeRemover(int ItemRecipeToRemove)
        {
            //removes ANY recipe that results in ItemRecipeToRemove
            RecipeFinder finder = new RecipeFinder();

            finder.SetResult(ItemRecipeToRemove);

            foreach (Recipe recipe in finder.SearchRecipes())
            {
                RecipeEditor editor = new RecipeEditor(recipe);
                editor.DeleteRecipe();
            }
        }
コード例 #14
0
ファイル: RecipeHelper.cs プロジェクト: W1K1/tsorcRevamp
        public static void RecipeIngredientAdder(int ItemRecipeToEdit, int ItemIngredientToAdd, int ItemCount = 1)
        {
            //any recipe that results in ItemRecipeToEdit will have ItemIngredientToAdd added to it, with ItemCount amount (default 1)
            RecipeFinder finder = new RecipeFinder();

            finder.SetResult(ItemRecipeToEdit);

            foreach (Recipe recipe in finder.SearchRecipes())
            {
                RecipeEditor editor = new RecipeEditor(recipe);
                editor.AddIngredient(ItemIngredientToAdd, ItemCount);
            }
        }
コード例 #15
0
        /// <summary>
        ///     Attempts to find a recipe according to the provided <see cref="RecipeFinder" />.
        /// </summary>
        /// <param name="finder"></param>
        /// <param name="editor"></param>
        /// <returns></returns>
        public static bool TryFindExactRecipe(this RecipeFinder finder, out RecipeEditor editor)
        {
            Recipe foundRecipe = finder.FindExactRecipe();

            if (foundRecipe == null)
            {
                editor = null;
                return false;
            }

            editor = new RecipeEditor(finder.FindExactRecipe());
            return true;
        }
コード例 #16
0
 public static void DestroyRecipes()
 {
     foreach (var lunarTool in LunarTools)
     {
         var finder = new RecipeFinder();
         finder.SetResult(lunarTool);
         var recipes = finder.SearchRecipes();
         recipes.ForEach(x =>
         {
             var editor = new RecipeEditor(x);
             editor.DeleteRecipe();
         });
     }
 }
コード例 #17
0
        public override void PostSetupContent()
        {
            base.PostSetupContent();
            RecipeFinder recipeFinder = new RecipeFinder();

            recipeFinder.SetResult(ItemID.BeetleScaleMail);
            recipeFinder.AddIngredient(ItemID.TurtleScaleMail);
            foreach (Recipe recip in recipeFinder.SearchRecipes())
            {
                RecipeEditor recipeEditor = new RecipeEditor(recip);
                recipeEditor.DeleteRecipe();
            }
            ModRecipe recipe = new ModRecipe(this);

            recipe.AddIngredient(ItemID.Gel, 10);
            recipe.AddIngredient(ItemID.Wood, 10);
            recipe.AddIngredient(ItemID.ManaCrystal, 1);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(ItemID.SlimeStaff);
            recipe.AddRecipe();
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.ChlorophyteBar, 14);
            recipe.AddIngredient(ItemID.BeetleHusk, 5);
            recipe.AddTile(TileID.MythrilAnvil);
            recipe.SetResult(ItemID.BeetleHelmet);
            recipe.AddRecipe();
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.ChlorophyteBar, 27);
            recipe.AddIngredient(ItemID.BeetleHusk, 10);
            recipe.AddTile(TileID.MythrilAnvil);
            recipe.SetResult(ItemID.BeetleScaleMail);
            recipe.AddRecipe();
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.ChlorophyteBar, 21);
            recipe.AddIngredient(ItemID.BeetleHusk, 8);
            recipe.AddTile(TileID.MythrilAnvil);
            recipe.SetResult(ItemID.BeetleLeggings);
            recipe.AddRecipe();
            AlchemistRecipe crecipe = new AlchemistRecipe(this);

            crecipe.AddIngredient(ItemID.Bottle, 15);
            crecipe.AddIngredient(ItemID.Deathweed, 1);
            crecipe.AddIngredient(ItemID.VialofVenom, 1);
            crecipe.AddIngredient(ItemID.Fireblossom, 1);
            crecipe.AddIngredient(ItemID.ExplosivePowder, 1);
            crecipe.AddTile(TileID.AlchemyTable);
            crecipe.SetResult(ItemID.ToxicFlask, 15);
            crecipe.AddRecipe();
            ModMethods.PostSetupContent();
        }
コード例 #18
0
        public static void RemoveRecipe(int itemID)
        {
            RecipeFinder rf = new RecipeFinder();

            rf.SetResult(itemID);

            List <Recipe> list = rf.SearchRecipes();

            for (int i = 0; i < list.Count; i++)
            {
                Recipe       r  = list[i];
                RecipeEditor re = new RecipeEditor(r);
                re.DeleteRecipe();
            }
        }
コード例 #19
0
        // Adapt certain vanilla recipes to our own 'pillar recipes'
        // For Night's Edge there is Blood Carnage, for Mechanical Worm there is Mechanical Brain
        public static void AdaptToNovaRecipes(Mod mod)
        {
            //Night's Edge can't be crafted with Blood Butcherer
            //Mechanical Worm can't be crafted with Vertebrae

            // Search night's edge
            var rFinder = new RecipeFinder();

            rFinder.SetResult(ItemID.NightsEdge);
            rFinder.AddIngredient(ItemID.BloodButcherer);
            // Add to found recipes
            var foundRecipes = rFinder.SearchRecipes();

            // Search mech worm
            rFinder = new RecipeFinder();
            rFinder.SetResult(ItemID.MechanicalWorm);
            rFinder.AddIngredient(ItemID.Vertebrae);
            // Add to found recipes
            foundRecipes = foundRecipes.Concat(rFinder.SearchRecipes()).ToList();

            // For all found recipes, delete them
            foundRecipes.ForEach(recipe =>
            {
                var rEditor = new RecipeEditor(recipe);
                rEditor.DeleteRecipe();
            });

            //The following recipes (with result of this type) require Nova Fragments for crafting
            foreach (short resultType in new short[]
            {
                ItemID.SuperHealingPotion,
                ItemID.CelestialSigil,
                ItemID.FragmentVortex,
                ItemID.FragmentNebula,
                ItemID.FragmentSolar,
                ItemID.FragmentStardust
            })
            {
                rFinder = new RecipeFinder();
                rFinder.SetResult(resultType);
                rFinder.SearchRecipes().ForEach(recipe =>
                {
                    var rEditor = new RecipeEditor(recipe);
                    rEditor.AddIngredient(mod.ItemType <NovaFragment>(), resultType == ItemID.CelestialSigil ? 20 : 1);                    // 20 frags for sigil, 1 for others
                });
            }
        }
コード例 #20
0
        public static void EditVanillaRecipes()
        {
            if (GetInstance <ServerConfig>().MolotovBlueGelCraft > 0)
            {
                var recipe = new ModRecipe(GetInstance <VanillaTweaks>());
                recipe.AddIngredient(ItemID.Ale, 5);
                recipe.AddIngredient(ItemID.Torch, 1);
                recipe.AddIngredient(ItemID.Silk, 1);
                recipe.AddIngredient(ItemID.Gel, GetInstance <ServerConfig>().MolotovBlueGelCraft);
                recipe.SetResult(ItemID.MolotovCocktail, 5);
                recipe.AddRecipe();
            }

            var foundRecipes = new List <Recipe>();

            if (GetInstance <ServerConfig>().JestersArrowCraft == 0)
            {
                foreach (var recipe in Main.recipe)
                {
                    if (recipe != null && recipe.createItem != null && recipe.createItem.type == ItemID.JestersArrow)
                    {
                        foundRecipes.Add(recipe);
                    }
                }

                foreach (var recipe in foundRecipes)
                {
                    var editor = new RecipeEditor(recipe);
                    editor.DeleteRecipe();
                }
                foundRecipes.Clear();
            }
            else
            {
                foreach (var recipe in Main.recipe)
                {
                    if (recipe != null && recipe.createItem != null && recipe.createItem.type == ItemID.JestersArrow)
                    {
                        var editor = new RecipeEditor(recipe);
                        editor.SetIngredientStack(ItemID.WoodenArrow, GetInstance <ServerConfig>().JestersArrowCraft);
                        editor.SetResult(ItemID.JestersArrow, GetInstance <ServerConfig>().JestersArrowCraft);
                    }
                }
            }
        }
コード例 #21
0
ファイル: AARecipes.cs プロジェクト: DellyThePuffercat/AAMod
 private static void RemoveNightsEdgeRecipe()
 {
     RecipeFinder finder = new RecipeFinder();
     {
         finder.AddIngredient(ItemID.BloodButcherer, 1);
         finder.AddIngredient(ItemID.FieryGreatsword, 1);
         finder.AddIngredient(ItemID.BladeofGrass, 1);
         finder.AddIngredient(ItemID.Muramasa, 1);
         finder.AddTile(TileID.DemonAltar);
         finder.SetResult(ItemID.NightsEdge, 1);
         Recipe recipe2 = finder.FindExactRecipe();
         if (recipe2 != null)
         {
             RecipeEditor editor = new RecipeEditor(recipe2);
             editor.DeleteRecipe();
         }
     }
 }
コード例 #22
0
ファイル: MiscRecipes.cs プロジェクト: Pop000100/Miscellania
        public static void PostAddRecipes()
        {
            if (ModContent.GetInstance <ServerConfig>().AncientMuramasa)
            {
                var finder = new RecipeFinder();
                finder.AddIngredient(ItemID.Muramasa);
                var foundRecipes = finder.SearchRecipes();
                foreach (var foundRecipe in foundRecipes)
                {
                    var editor = new RecipeEditor(foundRecipe);
                    editor.AcceptRecipeGroup("GoldensMisc:Muramasa");
                }
            }
            if (ModContent.GetInstance <ServerConfig>().AncientForges)
            {
                var finder = new RecipeFinder();
                finder.AddIngredient(ItemID.Hellforge);
                var foundRecipes = finder.SearchRecipes();
                foreach (var foundRecipe in foundRecipes)
                {
                    var editor = new RecipeEditor(foundRecipe);
                    editor.AcceptRecipeGroup("GoldensMisc:Hellforge");
                }
            }
            if (ModContent.GetInstance <ServerConfig>().NinjaGear)
            {
                var finder = new RecipeFinder();
                finder.AddIngredient(ItemID.TigerClimbingGear);
                finder.AddIngredient(ItemID.Tabi);
                finder.AddIngredient(ItemID.BlackBelt);
                finder.SetResult(ItemID.MasterNinjaGear);

                var foundRecipes = finder.SearchRecipes();
                foreach (var foundRecipe in foundRecipes)
                {
                    var editor = new RecipeEditor(foundRecipe);
                    editor.DeleteIngredient(ItemID.Tabi);
                    editor.DeleteIngredient(ItemID.BlackBelt);
                    editor.AddIngredient(ModContent.ItemType <NinjaGear>());
                }
            }
        }
コード例 #23
0
        public static void SetAllFurnaceRecipeSystem()
        {
            RecipeFinder rf = new RecipeFinder();

            rf.AddTile(TileID.Furnaces);

            List <Recipe> list = rf.SearchRecipes();

            for (int i = 0; i < list.Count; i++)
            {
                Recipe r      = list[i];
                Recipe recipe = r;
                if (recipe.requiredItem.Length == 1)
                {
                    TUA.instance.AddFurnaceRecipe(recipe.requiredItem[0].type, recipe.createItem.type, 20);
                    _removedRecipes.Add(r);
                    RecipeEditor re = new RecipeEditor(r);
                    re.DeleteRecipe();
                }
            }
        }
コード例 #24
0
ファイル: RecipeHelper.cs プロジェクト: W1K1/tsorcRevamp
        public static void ExactRecipeRemover2Ingredients(int Ingredient1, int Ingredient1Amount, int Ingredient2, int Ingredient2Amount, int CraftingStation, int RecipeResult)
        {
            //this method is for when there's an item whose recipe needs to be removed, but we can't use RecipeRemover
            //that usually means we're giving it a custom recipe somewhere else, since RecipeRemover runs on any recipe that results in that item
            //using exact recipes is thus required. not sure if we need to do this again, but if we do, now theres a method
            RecipeFinder finder = new RecipeFinder();

            finder.AddIngredient(Ingredient1, Ingredient1Amount);
            finder.AddIngredient(Ingredient2, Ingredient2Amount);
            finder.AddTile(CraftingStation);
            finder.SetResult(RecipeResult);
            Recipe locateRecipe = finder.FindExactRecipe();

            bool recipeFound = locateRecipe != null;

            if (recipeFound)
            {
                RecipeEditor editor = new RecipeEditor(locateRecipe);
                editor.DeleteRecipe();
            }
        }
コード例 #25
0
        public override void AddRecipes()
        {
            ModRecipe newLeather = new ModRecipe(this);

            newLeather.AddRecipeGroup("ExtraGunGear:EvilChunk", 3);
            newLeather.AddTile(TileID.WorkBenches);
            newLeather.SetResult(ItemID.Leather);
            newLeather.AddRecipe();

            RecipeFinder finder = new RecipeFinder();

            finder.AddIngredient(ItemID.RottenChunk, 5);
            finder.AddTile(TileID.WorkBenches);
            finder.SetResult(ItemID.Leather);
            Recipe recipe2 = finder.FindExactRecipe();

            if (recipe2 != null)
            {
                RecipeEditor editor = new RecipeEditor(recipe2);
                editor.DeleteRecipe();
            }
        }
        public override void PostAddRecipes()
        {
            Mod tremor = ModLoader.GetMod("Tremor");

            if (tremor != null && Config.DommhammerjackhammerSettings == 2)
            {
                RecipeFinder finder = new RecipeFinder(); // make a new RecipeFinder
                finder.AddIngredient(ItemID.Pwnhammer);   // add a new recipe group, in this case the vanilla one for iron or lead bars.
                finder.AddIngredient(tremor.ItemType("DarkBulb"), 15);
                finder.AddIngredient(ItemID.Bone, 100);
                finder.AddTile(TileID.MythrilAnvil);                     // add a required tile, any anvil
                finder.SetResult(tremor.ItemType("Squasher"));           // set the result to be 10 chains
                Recipe exactRecipe = finder.FindExactRecipe();           // try to find the exact recipe matching our criteria

                bool isRecipeFound = exactRecipe != null;                // if our recipe is not null, it means we found the exact recipe
                if (isRecipeFound)                                       // since our recipe is found, we can continue
                {
                    RecipeEditor editor = new RecipeEditor(exactRecipe); // for our recipe, make a new RecipeEditor
                    editor.DeleteRecipe();                               // delete the recipe
                }
            }
        }
コード例 #27
0
        public static void GetAllRecipeByIngredientAndReplace(int ingredientToReplace, int replacingIngredient)
        {
            RecipeFinder rf = new RecipeFinder();

            rf.AddIngredient(ingredientToReplace);

            List <Recipe> list = rf.SearchRecipes();

            for (int i = 0; i < list.Count; i++)
            {
                Recipe       r      = list[i];
                Recipe       recipe = r;
                RecipeEditor re     = new RecipeEditor(recipe);

                if (re.DeleteIngredient(ingredientToReplace))
                {
                    re.AddIngredient(replacingIngredient);
                    Main.recipe[Recipe.numRecipes] = r;
                    Recipe.numRecipes++;
                }
            }
        }
コード例 #28
0
        public override void AddRecipes()
        {
            var recipe = new ModRecipe(mod);

            recipe.AddIngredient(ItemID.PocketMirror);
            recipe.AddIngredient(ItemID.HandWarmer);
            recipe.AddTile(TileID.TinkerersWorkbench);
            recipe.SetResult(this);
            recipe.AddRecipe();

            // Add this item to Ankh Charm's recipes
            var finder = new RecipeFinder();

            finder.SetResult(ItemID.AnkhCharm);
            var recipes = finder.SearchRecipes();

            recipes.ForEach(x =>
            {
                var editor = new RecipeEditor(x);
                editor.AddIngredient(ModContent.ItemType <HeatedMirror>());
            });
        }
コード例 #29
0
        public static void TestRecipeEditor(Mod mod)
        {
            RecipeFinder finder = new RecipeFinder();

            finder.AddIngredient(ItemID.Chain);
            foreach (Recipe recipe in finder.SearchRecipes())
            {
                RecipeEditor editor = new RecipeEditor(recipe);
                editor.DeleteIngredient(ItemID.Chain);
            }

            finder = new RecipeFinder();
            finder.AddRecipeGroup("IronBar");
            finder.AddTile(TileID.Anvils);
            finder.SetResult(ItemID.Chain, 10);
            Recipe recipe2 = finder.FindExactRecipe();

            if (recipe2 != null)
            {
                RecipeEditor editor = new RecipeEditor(recipe2);
                editor.DeleteRecipe();
            }
        }
コード例 #30
0
        public override void AddRecipes()
        {
            RecipeFinder HBR = new RecipeFinder();

            HBR = new RecipeFinder();
            HBR.AddIngredient(ItemID.Hellstone, 3);
            HBR.AddIngredient(ItemID.Obsidian);
            HBR.AddTile(TileID.Hellforge);
            HBR.SetResult(ItemID.HellstoneBar);
            Recipe HBRR = HBR.FindExactRecipe();

            if (HBR != null)
            {
                RecipeEditor HBE = new RecipeEditor(HBRR);
                HBE.DeleteRecipe();
            }

            ModRecipe HSB = new ModRecipe(this);

            HSB.AddIngredient(ItemID.Hellstone, 5);
            HSB.AddTile(TileID.Hellforge);
            HSB.SetResult(ItemID.HellstoneBar);
            HSB.AddRecipe();
        }