Exemplo n.º 1
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
            }
        }
Exemplo n.º 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);
            }
        }
        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();
        }
Exemplo n.º 4
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();
                }
            }
        }
Exemplo n.º 5
0
        public override void ModifyTooltips(Item item, List <TooltipLine> tooltips)
        {
            if (item.modItem != null)
            {
                if (item.owner > -1 && Main.netMode != 1)
                {
                    SGAPlayer sgaply = (Main.player[item.owner].GetModPlayer <SGAPlayer>());
                    pboostertextboost = "\nCurrent boost: " + sgaply.SpaceDiverWings;
                    pboostertext      = pboostertextbase2 + pboostertextboost;
                }
                var    myType    = (item.modItem).GetType();
                var    n         = myType.Namespace;
                string asastring = (string)n;
                //int ishavocitem = (asastring.Split('.').Length - 1);
                int ishavocitem = asastring.Length - asastring.Replace("HavocGear.", "").Length;
                if (ishavocitem > 0)
                {
                    Color c = Main.hslToRgb(0.9f, 0.5f, 0.35f);
                    tooltips.Add(new TooltipLine(mod, "Havoc Item", Idglib.ColorText(c, "Former Havoc mod item")));
                }
                if (SGAmod.UsesPlasma.ContainsKey(item.type))
                {
                    Color c = Main.hslToRgb(0.7f, 0.15f, 0.7f);
                    tooltips.Add(new TooltipLine(mod, "Plasma Item", Idglib.ColorText(c, "This weapon uses plasma cells for recharging")));
                }

                if (SGAmod.UsesClips.ContainsKey(item.type))
                {
                    Color c = Main.hslToRgb(0.7f, 0.15f, 0.7f);
                    tooltips.Add(new TooltipLine(mod, "Clip Item", Idglib.ColorText(c, "This weapon has a clip and requires manual reloading")));
                }
            }

            if (SGAWorld.downedWraiths < 1)
            {
                RecipeFinder finder = new RecipeFinder();
                finder.AddTile(TileID.Furnaces);
                List <Recipe> reclist = finder.SearchRecipes();

                Recipe foundone = reclist.Find(rec => rec.createItem.type == item.type);

                if (foundone != null)
                {
                    Color c = Main.hslToRgb(0.5f, 0.10f, 0.1f);
                    tooltips.Add(new TooltipLine(mod, "Wraithclue", Idglib.ColorText(c, "Crafting this will anger something...")));
                }
            }
            if (item.type == ItemID.LunarBar)
            {
                if (SGAWorld.downedWraiths < 4)
                {
                    Color c = Main.hslToRgb(0.5f, 0.20f, 0.7f);
                    tooltips.Add(new TooltipLine(mod, "Wraithclue", Idglib.ColorText(c, "A very strong being has locked it away from your possession, talk to the guide")));
                }
            }
        }
 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(); });
     }
 }
        public void DeleteRecipes(int item)
        {
            RecipeFinder val = new RecipeFinder();

            val.SetResult(item);
            foreach (Recipe item2 in val.SearchRecipes())
            {
                new RecipeEditor(item2).DeleteRecipe();
            }
        }
Exemplo n.º 8
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();
            }
        }
Exemplo n.º 9
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();
            }
        }
Exemplo n.º 10
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);
            }
        }
Exemplo n.º 11
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();
            }
        }
 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();
         });
     }
 }
Exemplo n.º 13
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);
         }
     }
 }
Exemplo n.º 14
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 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);
                }
            }
        }
Exemplo n.º 16
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();
            }
        }
        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);
        }
Exemplo n.º 18
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
                });
            }
        }
Exemplo n.º 19
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);
                }
            }
        }
Exemplo n.º 20
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>());
                }
            }
        }
Exemplo n.º 21
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();
                }
            }
        }
Exemplo n.º 22
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();
        }
Exemplo n.º 23
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>());
            });
        }
Exemplo n.º 24
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++;
                }
            }
        }
Exemplo n.º 25
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();
            }
        }
        public override void AddRecipes()
        {
            RecipeFinder finder = new RecipeFinder();

            finder.SetResult(ItemID.WireKite);

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

            // heart statue recipe
            ModRecipe rcp = new ModRecipe(this);

            rcp.AddIngredient(ItemID.LifeCrystal);
            rcp.AddIngredient(ItemID.StoneBlock, 50);
            rcp.AddTile(TileID.HeavyWorkBench);
            rcp.SetResult(ItemID.HeartStatue);
            rcp.AddRecipe();

            // star statue
            rcp = new ModRecipe(this);
            rcp.AddIngredient(ItemID.ManaCrystal, 3);
            rcp.AddIngredient(ItemID.StoneBlock, 50);
            rcp.AddTile(TileID.HeavyWorkBench);
            rcp.SetResult(ItemID.StarStatue);
            rcp.AddRecipe();

            // queen statue
            rcp = new ModRecipe(this);
            rcp.AddRecipeGroup(GroupGoldCrown);
            rcp.AddIngredient(ItemID.StoneBlock, 50);
            rcp.AddTile(TileID.HeavyWorkBench);
            rcp.SetResult(ItemID.QueenStatue);
            rcp.AddRecipe();

            // king statue
            rcp = new ModRecipe(this);
            rcp.AddRecipeGroup(GroupGoldCrown);
            rcp.AddIngredient(ItemID.StoneBlock, 50);
            rcp.AddTile(TileID.HeavyWorkBench);
            rcp.SetResult(ItemID.KingStatue);
            rcp.AddRecipe();

            // sextant
            rcp = new ModRecipe(this);
            rcp.AddRecipeGroup(GroupGoldBar, 15);
            rcp.AddIngredient(ItemID.Lens, 5);
            rcp.AddTile(TileID.Tables);
            rcp.AddTile(TileID.Chairs);
            rcp.SetResult(ItemID.Sextant);
            rcp.AddRecipe();

            // weather radio
            rcp = new ModRecipe(this);
            rcp.AddRecipeGroup(GroupGoldBar, 8);
            rcp.AddRecipeGroup(GroupIronBar, 15);
            rcp.AddIngredient(ItemID.Cloud, 15);
            rcp.AddIngredient(ItemID.SnowBlock, 15);
            rcp.AddTile(TileID.Tables);
            rcp.AddTile(TileID.Chairs);
            rcp.SetResult(ItemID.WeatherRadio);
            rcp.AddRecipe();

            // fisherman's guide
            rcp = new ModRecipe(this);
            rcp.AddIngredient(ItemID.Book);
            rcp.AddIngredient(ItemID.ArmoredCavefish);
            rcp.AddIngredient(ItemID.SpecularFish);
            rcp.AddIngredient(ItemID.NeonTetra);
            rcp.AddIngredient(ItemID.Bass);
            rcp.AddIngredient(ItemID.Trout);
            rcp.AddIngredient(ItemID.AtlanticCod);
            rcp.AddTile(TileID.Bookcases);
            rcp.SetResult(ItemID.FishermansGuide);
            rcp.AddRecipe();
        }
        public override void AddRecipes()
        {
            // Create equivalencies
            List <int> anyCopperBar = new List <int> {
                ItemID.CopperBar, ItemID.TinBar
            };
            List <int> anyIronBar = new List <int> {
                ItemID.IronBar, ItemID.LeadBar
            };
            List <int> anySilverBar = new List <int> {
                ItemID.SilverBar, ItemID.TungstenBar
            };
            List <int> anyGoldBar = new List <int> {
                ItemID.GoldBar, ItemID.PlatinumBar
            };
            List <int> anyCobaltBar = new List <int> {
                ItemID.CobaltBar, ItemID.PalladiumBar
            };
            List <int> anyMythrilBar = new List <int> {
                ItemID.MythrilBar, ItemID.OrichalcumBar
            };
            List <int> anyTitaniumBar = new List <int> {
                ItemID.TitaniumBar, ItemID.AdamantiteBar
            };

            ModRecipe recipe;

            // Magic carpet
            foreach (int gold in anyGoldBar)
            {
                recipe = new ModRecipe(this);
                recipe.AddIngredient(ItemID.Silk, 30);
                recipe.AddIngredient(gold, 8);
                recipe.AddTile(TileID.Loom);
                recipe.SetResult(ItemID.FlyingCarpet);
                recipe.AddRecipe();
            }

            // Hermes boots
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Silk, 10);
            recipe.AddIngredient(ItemID.SwiftnessPotion, 3);
            recipe.AddTile(TileID.Loom);
            recipe.SetResult(ItemID.HermesBoots);
            recipe.AddRecipe();

            // Fisherman's Pocket Guide
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Silk, 20);
            recipe.AddIngredient(ItemID.Chain);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(ItemID.FishermansGuide);
            recipe.AddRecipe();

            // Weather Radio iron
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.IronBar, 10);
            recipe.AddIngredient(ItemID.Wire, 50);
            recipe.AddIngredient(ItemID.NeptunesShell);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(ItemID.WeatherRadio);
            recipe.AddRecipe();

            // Weather Radio lead
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.LeadBar, 10);
            recipe.AddIngredient(ItemID.Wire, 50);
            recipe.AddIngredient(ItemID.NeptunesShell);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(ItemID.WeatherRadio);
            recipe.AddRecipe();

            // Sextant gold
            foreach (int gold in anyGoldBar)
            {
                recipe = new ModRecipe(this);
                recipe.AddIngredient(gold, 15);
                recipe.AddIngredient(ItemID.Glass, 15);
                recipe.AddTile(TileID.CrystalBall);
                recipe.SetResult(ItemID.Sextant);
                recipe.AddRecipe();
            }

            // Cobalt Shield
            foreach (int cobalt in anyCobaltBar)
            {
                recipe = new ModRecipe(this);
                recipe.AddIngredient(cobalt, 20);
                recipe.AddTile(TileID.MythrilAnvil);
                recipe.SetResult(ItemID.CobaltShield);
                recipe.AddRecipe();
            }

            // Cloud in a Bottle
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Bottle);
            recipe.AddIngredient(ItemID.Cloud);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(ItemID.CloudinaBottle);
            recipe.AddRecipe();

            // Slime Staff
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Wood, 10);
            recipe.AddIngredient(ItemID.Gel, 20);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(ItemID.SlimeStaff);
            recipe.AddRecipe();

            // Ankh Charm
            RecipeFinder finder = new RecipeFinder();

            finder.SetResult(ItemID.AnkhCharm);
            foreach (Recipe ankhRecipe in finder.SearchRecipes())
            {
                RecipeEditor editor = new RecipeEditor(ankhRecipe);
                editor.AddIngredient(ItemID.PocketMirror);
            }

            // Pocket Mirror
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.MagicMirror);
            recipe.AddIngredient(ItemID.SoulofLight, 10);
            recipe.AddIngredient(ItemID.Obsidian, 15);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(ItemID.PocketMirror);
            recipe.AddRecipe();

            // Magic Mirror
            foreach (int iron in anyIronBar)
            {
                recipe = new ModRecipe(this);
                recipe.AddIngredient(iron, 10);
                recipe.AddIngredient(ItemID.Glass, 10);
                recipe.AddIngredient(ItemID.FallenStar, 10);
                recipe.AddTile(TileID.WorkBenches);
                recipe.SetResult(ItemID.MagicMirror);
                recipe.AddRecipe();
            }

            // Rod of Discord
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.SoulofLight, 20);
            recipe.AddIngredient(ItemID.FallenStar, 50);
            recipe.AddIngredient(ItemID.SoulofFright, 10);
            recipe.AddTile(TileID.CrystalBall);
            recipe.SetResult(ItemID.RodofDiscord);
            recipe.AddRecipe();

            // Wooden Boomerang
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Wood, 10);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(ItemID.WoodenBoomerang);
            recipe.AddRecipe();

            // Enchanted Boomerang
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.WoodenBoomerang);
            recipe.AddIngredient(ItemID.FallenStar, 12);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(ItemID.EnchantedBoomerang);
            recipe.AddRecipe();

            // Aglet
            foreach (int copper in anyCopperBar)
            {
                recipe = new ModRecipe(this);
                recipe.AddIngredient(copper, 5);
                recipe.SetResult(ItemID.Aglet);
                recipe.AddTile(TileID.Anvils);
                recipe.AddRecipe();
            }

            // Anklet of the Wind
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.JungleSpores, 15);
            recipe.AddIngredient(ItemID.Cloud, 10);
            recipe.AddIngredient(ItemID.PinkGel, 10);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(ItemID.AnkletoftheWind);
            recipe.AddRecipe();

            // Titan Glove
            foreach (int cobalt in anyCobaltBar)
            {
                recipe = new ModRecipe(this);
                recipe.AddIngredient(cobalt, 10);
                recipe.AddTile(TileID.Anvils);
                recipe.SetResult(ItemID.TitanGlove);
                recipe.AddRecipe();
            }

            // Bezoar
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Stinger, 15);
            recipe.AddIngredient(ItemID.Vine, 10);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(ItemID.Bezoar);
            recipe.AddRecipe();

            // Adhesive Bandage
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Silk, 10);
            recipe.AddIngredient(ItemID.Gel, 50);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(ItemID.AdhesiveBandage);
            recipe.AddRecipe();

            // Armor Polish
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Bone, 80);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(ItemID.ArmorPolish);
            recipe.AddRecipe();

            // Vitamins
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.BottledWater);
            recipe.AddIngredient(ItemID.Waterleaf, 5);
            recipe.AddIngredient(ItemID.Blinkroot, 5);
            recipe.AddIngredient(ItemID.Daybloom, 5);
            recipe.SetResult(ItemID.Vitamins);
            recipe.AddTile(TileID.Anvils);
            recipe.AddRecipe();

            // Fast Clock
            foreach (int watch in new List <int> {
                ItemID.GoldWatch, ItemID.PlatinumWatch
            })
            {
                recipe = new ModRecipe(this);
                recipe.AddIngredient(ItemID.Timer1Second);
                recipe.AddIngredient(watch);
                recipe.AddTile(TileID.Anvils);
                recipe.SetResult(ItemID.FastClock);
                recipe.AddRecipe();
            }

            // Trifold Map
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Silk, 20);
            recipe.AddIngredient(ItemID.BlackInk);
            recipe.SetResult(ItemID.TrifoldMap);
            recipe.AddTile(TileID.Anvils);
            recipe.AddRecipe();

            // Megaphone
            foreach (int copper in anyCopperBar)
            {
                recipe = new ModRecipe(this);
                recipe.AddIngredient(ItemID.Wire, 10);
                recipe.AddIngredient(copper, 10);
                recipe.AddTile(TileID.Anvils);
                recipe.SetResult(ItemID.Megaphone);
                recipe.AddRecipe();
            }

            // Nazar
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Lens, 5);
            recipe.AddIngredient(ItemID.SoulofNight, 10);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(ItemID.Nazar);
            recipe.AddRecipe();

            // Blindfold
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.Silk, 20);
            recipe.AddIngredient(ItemID.SoulofNight, 10);
            recipe.SetResult(ItemID.Blindfold);
            recipe.AddTile(TileID.WorkBenches);
            recipe.AddRecipe();

            // Band of Starpower
            recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.FallenStar, 10);
            recipe.SetResult(ItemID.BandofStarpower);
            recipe.AddTile(TileID.Anvils);
            recipe.AddRecipe();

            // Bamd of Regeneration
            foreach (int iron in anyIronBar)
            {
                recipe = new ModRecipe(this);
                recipe.AddIngredient(ItemID.LifeCrystal);
                recipe.AddIngredient(iron);
                recipe.AddTile(TileID.Anvils);
                recipe.SetResult(ItemID.BandofRegeneration);
                recipe.AddRecipe();
            }
        }
Exemplo n.º 29
0
        private void TryAddItem(Item item, Chest shop, ref int nextSlot)
        {
            const int maxShop = 40;

            if (item.modItem == null || !item.modItem.mod.Name.Equals("FargowiltasSouls") || nextSlot >= maxShop)
            {
                return;
            }

            bool duplicateItem = false;

            if (item.Name.EndsWith("Enchantment"))
            {
                foreach (Item item2 in shop.item)
                {
                    if (item2.type == item.type)
                    {
                        duplicateItem = true;
                        break;
                    }
                }
                if (duplicateItem == false && nextSlot < maxShop)
                {
                    shop.item[nextSlot].SetDefaults(item.type);
                    nextSlot++;
                }
            }
            else if (item.Name.Contains("Force"))
            {
                RecipeFinder finder = new RecipeFinder();
                finder.SetResult(item.type);
                Recipe exactRecipe = finder.SearchRecipes()[0];
                foreach (Item item2 in exactRecipe.requiredItem)
                {
                    foreach (Item item3 in shop.item)
                    {
                        if (item3.type == item2.type)
                        {
                            duplicateItem = true;
                            break;
                        }
                    }
                    if (duplicateItem == false && nextSlot < maxShop)
                    {
                        if (item2.Name.Contains("Enchantment"))
                        {
                            shop.item[nextSlot].SetDefaults(item2.type);
                            nextSlot++;
                        }
                    }
                }
            }
            else if (item.Name.StartsWith("Soul"))
            {
                RecipeFinder finder = new RecipeFinder();
                finder.SetResult(item.type);
                Recipe exactRecipe = finder.SearchRecipes()[0];
                foreach (Item item2 in exactRecipe.requiredItem)
                {
                    foreach (Item item3 in shop.item)
                    {
                        if (item3.type == item2.type)
                        {
                            duplicateItem = true;
                            break;
                        }
                    }
                    if (duplicateItem == false && nextSlot < maxShop)
                    {
                        if (item2.Name.Contains("Force") || item2.Name.Contains("Soul"))
                        {
                            shop.item[nextSlot].SetDefaults(item2.type);
                            nextSlot++;
                        }
                    }
                }
            }
            else if (item.Name.EndsWith("Essence"))
            {
                foreach (Item item2 in shop.item)
                {
                    if (item2.type == item.type)
                    {
                        duplicateItem = true;
                        break;
                    }
                }
                if (duplicateItem == false && nextSlot < maxShop)
                {
                    shop.item[nextSlot].SetDefaults(item.type);
                    nextSlot++;
                }
            }
            else if (item.Name.EndsWith("Soul"))
            {
                RecipeFinder finder = new RecipeFinder();
                finder.SetResult(item.type);
                Recipe exactRecipe = finder.SearchRecipes()[0];
                foreach (Item item2 in exactRecipe.requiredItem)
                {
                    foreach (Item item3 in shop.item)
                    {
                        if (item3.type == item2.type)
                        {
                            duplicateItem = true;
                            break;
                        }
                    }
                    if (duplicateItem == false && nextSlot < maxShop)
                    {
                        if (item2.Name.EndsWith("Essence"))
                        {
                            shop.item[nextSlot].SetDefaults(item2.type);
                            nextSlot++;
                        }
                    }
                }
                duplicateItem = false;
                foreach (Item item4 in shop.item)
                {
                    if (item4.type == item.type)
                    {
                        duplicateItem = true;
                        break;
                    }
                }
                if (duplicateItem == false && nextSlot < maxShop)
                {
                    shop.item[nextSlot].SetDefaults(item.type);
                    nextSlot++;
                }
            }
            else if (item.type == ModLoader.GetMod("FargowiltasSouls").ItemType("AeolusBoots"))
            {
                foreach (Item item2 in shop.item)
                {
                    if (item2.type == ItemID.FrostsparkBoots || item2.type == ItemID.BalloonHorseshoeFart)
                    {
                        duplicateItem = true;
                        break;
                    }
                }
                if (duplicateItem == false && nextSlot < maxShop)
                {
                    shop.item[nextSlot].SetDefaults(ItemID.FrostsparkBoots);
                    nextSlot++;
                }
                if (duplicateItem == false && nextSlot < maxShop)
                {
                    shop.item[nextSlot].SetDefaults(ItemID.BalloonHorseshoeFart);
                    nextSlot++;
                }
            }
        }
Exemplo n.º 30
0
        public void CheckRecipesForItem(int type)
        {
            ((ResearchFrom14)mod).ui.recipes.changedToList = true;
            if (ModContent.GetInstance <Config>().researchRecipes)
            {
                Item itm = new Item();
                itm.SetDefaults(type);

                if (itm.createTile >= 0)
                {
                    List <int> tiles = AdjTiles(itm.createTile);
                    foreach (int t in tiles)
                    {
                        RecipeFinder rf = new RecipeFinder();
                        rf.AddTile(t);
                        List <Recipe> res = rf.SearchRecipes();
                        // Main.NewText("Found " + res.Count + "recipes with tile.");
                        foreach (Recipe r in res)
                        {
                            validateAndResearchRecipe(r);
                        }
                    }
                }
                RecipeFinder rf2 = new RecipeFinder();
                rf2.AddIngredient(itm.type);
                List <Recipe> res2 = rf2.SearchRecipes();
                // Main.NewText("Found " + res2.Count + "recipes with item.");
                foreach (Recipe r in res2)
                {
                    validateAndResearchRecipe(r);
                }
            }
            Mod rare = ModLoader.GetMod("ARareItemSwapJPANs");

            if (rare != null && ModContent.GetInstance <Config>().PartsCompat)
            {
                List <string> parts = rare.Call("GetPartList") as List <string>;
                if (parts == null)
                {
                    return;
                }
                parts.RemoveAll((x) => !IsResearched(x));
                if (parts.Count > 0)
                {
                    bool allPartsResearched = true;
                    foreach (string part in parts)
                    {
                        allPartsResearched = allPartsResearched && researchedParts.Contains(part);
                    }
                    if (!allPartsResearched)
                    {
                        List <Item> results = rare.Call("GetMaxPurchasesAvailable", parts) as List <Item>;

                        if (results == null)
                        {
                            return;
                        }
                        foreach (string part in parts)
                        {
                            if (!researchedParts.Contains(part))
                            {
                                researchedParts.Add(part);
                            }
                        }
                        foreach (Item result in results)
                        {
                            if (!IsResearched(result))
                            {
                                AddResearchedAmount(result.type, Int32.MaxValue - 1000);
                                researchedCache.Add(result.type);
                                CheckRecipesForItem(result.type);
                            }
                        }
                    }
                }
            }
        }