public async Task<IHttpActionResult> PostAction(RecipeFinder.Models.Action action) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Actions.Add(action); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (ActionExists(action.ActionId)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = action.ActionId }, action); }
public async Task<IHttpActionResult> PutAction(int id, RecipeFinder.Models.Action action) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != action.ActionId) { return BadRequest(); } db.Entry(action).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActionExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
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(); } }
/// <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; }
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 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); } }
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(); }); } }
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); } } }
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(); } }
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()); }
// 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 }); } }
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); } } }
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(); } } }
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>()); } } }
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(); } }
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(); } } }
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 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++; } } }
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>()); }); }
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 } } }
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 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 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(); }
//public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, // ref PlayerDeathReason damageSource) //{ // position = Main.LocalPlayer.position; // return true; //} public override void ProcessTriggers(TriggersSet triggersSet) { if (Error666Wings) { if (MoTools.DevSpeedHotKey.Current) { //Error666Wings.HorizontalWingSpeeds(player, ref speed, ref acceleration).speed = 50f; //Error666Wings.HorizontalWingSpeeds(player, ref speed, ref acceleration).acceleration *= 30.0f; player.runAcceleration *= 30.0f; player.accRunSpeed = 50f; } } if (MoTools.SecretHotKey.Current) { /*if (!SecretRecipe) * { * ModRecipe recipe = new ModRecipe(mod); * recipe.AddIngredient(ItemID.DirtBlock); * recipe.SetResult(ItemType<Error666Wings>()); * recipe.AddRecipe(); * * SecretRecipe = true; * }*/ /*else * { * RecipeFinder finder = new RecipeFinder(); // make a new RecipeFinder * * finder = new RecipeFinder(); // make a new RecipeFinder * finder.AddIngredient(ItemID.DirtBlock); // add a required tile, any anvil * finder.SetResult(ItemType<Error666Wings>()); // 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 * } * * SecretRecipe = false; * }*/ } else { RecipeFinder finder = new RecipeFinder(); // make a new RecipeFinder finder = new RecipeFinder(); // make a new RecipeFinder finder.AddIngredient(ItemID.DirtBlock); // add a required tile, any anvil finder.SetResult(ItemType <Error666Wings>()); // 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 } SecretRecipe = false; } }
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(); } }
public void RecipeFinderResults_ShouldCallContextRecipeSearch() { var testQuery = new RecipeQuery(); var recipeFinder = new RecipeFinder(this.Context, testQuery); this.Context.RSCalledTimes = 0; var search = recipeFinder.Results(); var query = this.Context.search; Assert.AreEqual(1, this.Context.RSCalledTimes); CollectionAssert.AreEqual(query.Include, new Guid[0]); CollectionAssert.AreEqual(query.Exclude, new Guid[0]); Assert.AreEqual(query.Keywords, null); Assert.AreEqual(query.Meal, MealFilter.All); Assert.AreEqual(query.Photos, PhotoFilter.All); Assert.AreEqual(query.Rating, Rating.None); Assert.AreEqual(SortOrder.Rating, query.Sort); Assert.AreEqual(SortDirection.Descending, query.Direction); Assert.AreEqual(query.Time, new TimeFilter()); Assert.AreEqual(query.Diet, new DietFilter()); Assert.AreEqual(query.Nutrition, new NutritionFilter()); Assert.AreEqual(query.Skill, new SkillFilter()); Assert.AreEqual(query.Taste, new TasteFilter()); }
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); } } } } } }
public static bool TryFindExactRecipe(this RecipeFinder finder, out RecipeEditor editor) => (editor = new RecipeEditor(finder.FindExactRecipe())) != null;
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++; } } }