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();
        }
示例#2
0
        // 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
            }
        }
示例#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 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);
            }
        }
        // public override bool Autoload() => CataclysmMod.Instance.Calamity != null;

        public override void ModifyRecipes()
        {
            if (CalamityChangesConfig.Instance.throwingBrickRecipeChange)
            {
                RecipeFinder finder = new RecipeFinder();
                finder.AddIngredient(ItemID.RedBrick, 5);
                finder.AddTile(TileID.Anvils);
                finder.SetResult(ModContent.ItemType <ThrowingBrick>(), 15);

                if (finder.TryFindExactRecipe(out RecipeEditor throwingBrick))
                {
                    throwingBrick.DeleteTile(TileID.Anvils);
                    throwingBrick.AddTile(TileID.WorkBenches);
                }
            }

            if (CalamityChangesConfig.Instance.halleysInfernoRecipeChange)
            {
                RecipeFinder finder = new RecipeFinder();
                finder.AddIngredient(ModContent.ItemType <Lumenite>(), 6);
                finder.AddIngredient(ModContent.ItemType <RuinousSoul>(), 4);
                finder.AddIngredient(ModContent.ItemType <ExodiumClusterOre>(), 12);
                finder.AddIngredient(ItemID.SniperScope);
                finder.AddTile(TileID.LunarCraftingStation);
                finder.SetResult(ModContent.ItemType <HalleysInferno>());

                if (finder.TryFindExactRecipe(out RecipeEditor halleysInferno))
                {
                    halleysInferno.DeleteIngredient(ItemID.SniperScope);
                    halleysInferno.AddIngredient(ItemID.RifleScope);
                }
            }
        }
示例#6
0
        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 void DeleteRecipes(int item)
        {
            RecipeFinder val = new RecipeFinder();

            val.SetResult(item);
            foreach (Recipe item2 in val.SearchRecipes())
            {
                new RecipeEditor(item2).DeleteRecipe();
            }
        }
 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
        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();
            }
        }
示例#10
0
        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();
            }
        }
示例#11
0
        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);
            }
        }
示例#12
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();
        }
 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();
         });
     }
 }
示例#14
0
 public AssemblingMachineUI(AssemblingMachineState machine)
     : base(machine)
 {
     if (_machine.Recipe.IsRecipeEmpty)
     {
         RecipeFinder finder = new RecipeFinder();
         finder.SetResult(ModContent.ItemType <Items.IntermediateProducts.IronGearWheelItem>());
         Recipe recipe2 = finder.SearchRecipes().First();
         if (recipe2 != null)
         {
             _machine.SelectRecipe(recipe2);
         }
     }
 }
        private bool ItemIsDerivativeOfShoeSpikes(Item item)
        {
            if (item.type == ItemID.ShoeSpikes || item.type == ItemID.ClimbingClaws || item.type == ItemID.MasterNinjaGear)
            {
                return(true);
            }

            // TODO: This is an attempt at mod compatibility, but to work properly this would likely require a few layers of recursive searching for items with huge crafting trees.
            RecipeFinder finder = new RecipeFinder();

            finder.SetResult(item.type);
            finder.AddIngredient(ItemID.ShoeSpikes);

            return(finder.SearchRecipes().Count > 0);
        }
        public void PostLoad()
        {
            RecipeFinder finder = new RecipeFinder();

            for (int k = Main.maxItemTypes; k < ItemLoader.ItemCount; k++)
            {
                finder.SetResult(k);
                finder.AddIngredient(ItemID.ShoeSpikes);

                if (finder.SearchRecipes().Count > 0)
                {
                    ShoeSpikeAccessories.Add(k);
                }
            }
        }
示例#17
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();
            }
        }
示例#18
0
 public static bool AttemptDelete(DeletionRecipe recipe, bool exact)
 {
     Finder = new RecipeFinder();
     Finder.SetResult(recipe.Result.Type, recipe.Result.Stack);
     foreach (DeletionItem ingredient in recipe.Ingredients)
     {
         Finder.AddIngredient(ingredient.Type, ingredient.Stack);
     }
     foreach (short tile in recipe.RequiredTiles)
     {
         Finder.AddTile(tile);
     }
     return(exact
                             ? DeleteExact()
                             : DeleteAlike());
 }
示例#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 DropEnches(NPC npc, int forceType, bool dropPerPlayer = false)
        {
            int max = 1;

            if (Main.expertMode)
            {
                max++;
            }
            if (FargoSoulsWorld.EternityMode)
            {
                max++;
            }

            RecipeFinder finder = new RecipeFinder();

            finder.SetResult(forceType);
            Recipe exactRecipe = finder.SearchRecipes()[0];

            List <int> enches = new List <int>();

            foreach (Item material in exactRecipe.requiredItem)
            {
                if (material.Name.EndsWith("Enchantment"))
                {
                    enches.Add(material.type);
                }
            }

            while (enches.Count > max)
            {
                enches.RemoveAt(Main.rand.Next(enches.Count));
            }

            foreach (int itemType in enches)
            {
                if (!dropPerPlayer || Main.netMode == NetmodeID.SinglePlayer)
                {
                    Item.NewItem(npc.position, npc.Size, itemType);
                }
                else if (Main.netMode == NetmodeID.Server)
                {
                    npc.DropItemInstanced(npc.position, npc.Size, itemType);
                }
            }
        }
示例#21
0
 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
        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 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();
            }
        }
示例#24
0
        internal static void AddRecipes(Mod mod)
        {
            RecipeFinder rf = new RecipeFinder();

            rf.SetResult(ItemID.Torch, 3);
            rf.AddIngredient(ItemID.Gel);

            new RecipeEditor(rf.SearchRecipes()[0]).DeleteRecipe();

            ModRecipe r           = new ModRecipe(mod);
            bool      overhaulMod = ModLoader.GetMod("TerrariaOverhaul") != null;

            foreach (Tuple <string, short, int> rc in GelMakeTorchesCount)
            {
                if (rc.Item1 == "Blue" && overhaulMod)
                {
                    continue;
                }
                r.AddGelIngredient(rc.Item1);
                r.AddRecipeGroup(RecipeGroupID.Wood);
                r.SetResult(rc.Item2, Math.Max(overhaulMod? rc.Item3 / 2 : rc.Item3, 1));
                r.AddRecipe();
                r = new ModRecipe(mod);
            }

            foreach (Tuple <short, string, int> rc in ItemRecipesAddGel)
            {
                RecipeFinder finder = new RecipeFinder();
                finder.SetResult(rc.Item1);
                foreach (Recipe recipe in finder.SearchRecipes())
                {
                    recipe.AddIngredient(ColorfulGel.GetGelItem(rc.Item2, rc.Item3));
                }
            }

            r.AddGelIngredient("Ice");
            r.AddRecipeGroup("Wood");
            r.SetResult(ItemID.IceTorch, 3);
            r.AddRecipe();
        }
        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
                }
            }
        }
示例#26
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>());
            });
        }
示例#27
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();
            }
        }
示例#28
0
        public override void ProcessTriggers(TriggersSet triggersSet)
        {
            if (JustEnoughRecipes.ItemRecipeKey.JustPressed)
            {
                Item selected = Main.mouseItem.netID != 0 ? Main.mouseItem : Main.HoverItem;
                if (selected.netID != 0)
                {
                    Logger.Log(selected.ToString());
                    JustEnoughRecipes.instance.recipeUI.panelTitle.UpdateItem(selected);

                    RecipeFinder finder = new RecipeFinder();
                    finder.SetResult(selected.netID);
                    var result = finder.SearchRecipes();
                    JustEnoughRecipes.instance.recipeUI.SetRecipes(result);
                    JustEnoughRecipes.instance.recipeUI.pageNavigator.SetTotal(result.Count);

                    JustEnoughRecipes.instance.recipeUI.Visible = true;
                }
                else
                {
                    JustEnoughRecipes.instance.recipeUI.Visible = false;
                }
            }
            else if (JustEnoughRecipes.ItemUsageKey.JustPressed)
            {
                // TODO: Usage page
                Item selected = Main.mouseItem.netID != 0 ? Main.mouseItem : Main.HoverItem;
                if (selected.netID != 0)
                {
                    RecipeFinder finder = new RecipeFinder();
                    finder.AddIngredient(selected.netID);
                    foreach (var r in finder.SearchRecipes())
                    {
                        Logger.Log(r.createItem.Name);
                    }
                }
            }
        }
        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();
        }