internal static void ConfirmCraft(Player player, Recipe recipe) { var mymod = ModHelpersMod.Instance; if (mymod.RecipeHack.IngredientOutsources.Count == 0) { return; } if (RecipeHack.AwaitingRecipeIdx == -1 || RecipeHack.AwaitingRecipeMissingIngredients == null) { return; } if (!RecipeIdentityHelpers.Equals(Main.recipe[RecipeHack.AwaitingRecipeIdx], recipe)) { RecipeHack.AwaitingRecipeIdx = -1; RecipeHack.AwaitingRecipeMissingIngredients = null; return; } if (Main.mouseItem.IsNotTheSameAs(recipe.createItem)) { RecipeHack.AwaitingRecipeIdx = -1; RecipeHack.AwaitingRecipeMissingIngredients = null; return; } IEnumerable <Item> outsourcedItems = RecipeHack.GetOutsourcedItems(player); ItemHelpers.ConsumeItems(RecipeHack.AwaitingRecipeMissingIngredients, outsourcedItems); RecipeHack.AwaitingRecipeIdx = -1; RecipeHack.AwaitingRecipeMissingIngredients = null; }
internal static void DefineItemMiscGroups2(Action <string, string[], Matcher> addDef) { addDef("Any Food Ingredient", new string[] { "Any Food" }, (item, grps) => { foreach (int foodId in grps["Any Food"]) { IEnumerable <Recipe> recipes = RecipeIdentityHelpers.GetRecipesOfItem(foodId); foreach (Recipe recipe in recipes) { for (int i = 0; i < recipe.requiredItem.Length; i++) { Item recipeItem = recipe.requiredItem[i]; if (recipeItem == null || recipeItem.IsAir) { break; } if (recipeItem.type == foodId) { return(true); } } } } return(false); }); }
//////////////// public static ISet <int> GetAvailableRecipesOfIngredients(Player player, IEnumerable <Item> ingredients) { int[] _; IDictionary <int, int> __; ISet <int> addedRecipeIdxs = new HashSet <int>(); ISet <int> possibleRecipeIdxs = new HashSet <int>(); // Find all potential recipes of each individual ingredient foreach (Item ingredient in ingredients) { IEnumerable <int> ingredientRecipeIdxs = RecipeIdentityHelpers.GetRecipeIndexesUsingIngredient(ingredient.netID); possibleRecipeIdxs.UnionWith(ingredientRecipeIdxs); } // Filter potential recipes list to actual recipes only foreach (int recipeIdx in possibleRecipeIdxs) { Recipe recipe = Main.recipe[recipeIdx]; if (recipe == null || recipe.createItem.type == 0) { continue; } // Just in case? if (RecipeHelpers.GetRecipeFailReasons(player, recipe, out _, out __, ingredients) == 0) { addedRecipeIdxs.Add(recipeIdx); } } return(addedRecipeIdxs); }
public void UnloadOuter() { this.ReflectionHelpers = null; this.PacketProtocolMngr = null; this.ExceptionMngr = null; this.Timers = null; this.ConfigJson = null; this.LogHelpers = null; this.ModFeaturesHelpers = null; this.BuffHelpers = null; this.NetHelpers = null; this.ItemIdentityHelpers = null; this.NPCIdentityHelpers = null; this.ProjectileIdentityHelpers = null; this.BuffIdentityHelpers = null; this.NPCBannerHelpers = null; this.RecipeIdentityHelpers = null; this.RecipeGroupHelpers = null; this.PlayerHooks = null; this.LoadHelpers = null; this.GetModInfo = null; this.GetModTags = null; this.WorldStateHelpers = null; this.ModLock = null; this.EntityGroups = null; this.AnimatedColors = null; this.PlayerMessages = null; this.Inbox = null; this.ControlPanel = null; this.MenuItemMngr = null; this.MenuContextMngr = null; this.MusicHelpers = null; this.PlayerIdentityHelpers = null; this.CustomEntMngr = null; this.Promises = null; this.DataStore = null; this.CustomHotkeys = null; this.XnaHelpers = null; this.ServerInfo = null; //this.PlayerDataMngr = null; this.SupportInfo = null; this.RecipeHack = null; this.ModListHelpers = null; this.ControlPanelHotkey = null; this.DataDumpHotkey = null; }
private void LoadOuter() { this.ReflectionHelpers = new ReflectionHelpers(); this.DataStore = new DataStore(); this.Promises = new Promises(); this.LoadHelpers = new LoadHelpers(); this.Timers = new Timers(); this.LogHelpers = new LogHelpers(); this.ModFeaturesHelpers = new ModFeaturesHelpers(); this.PacketProtocolMngr = new PacketProtocolManager(); this.BuffHelpers = new BuffHelpers(); this.NetHelpers = new NetHelpers(); this.ItemIdentityHelpers = new ItemIdentityHelpers(); this.NPCIdentityHelpers = new NPCIdentityHelpers(); this.ProjectileIdentityHelpers = new ProjectileIdentityHelpers(); this.BuffIdentityHelpers = new BuffIdentityHelpers(); this.NPCBannerHelpers = new NPCBannerHelpers(); this.RecipeIdentityHelpers = new RecipeIdentityHelpers(); this.RecipeGroupHelpers = new RecipeGroupHelpers(); this.PlayerHooks = new ExtendedPlayerHooks(); this.WorldStateHelpers = new WorldStateHelpers(); this.ControlPanel = new UIControlPanel(); this.ModLock = new ModLockService(); this.EntityGroups = new EntityGroups(); this.PlayerMessages = new PlayerMessages(); this.Inbox = new InboxControl(); this.GetModInfo = new GetModInfo(); this.GetModTags = new GetModTags(); this.MenuItemMngr = new MenuItemManager(); this.MenuContextMngr = new MenuContextServiceManager(); this.MusicHelpers = new MusicHelpers(); this.PlayerIdentityHelpers = new PlayerIdentityHelpers(); this.CustomEntMngr = new CustomEntityManager(); this.CustomHotkeys = new CustomHotkeys(); this.XnaHelpers = new XnaHelpers(); this.ServerInfo = new ServerInfo(); //this.PlayerDataMngr = new PlayerDataManager(); this.SupportInfo = new SupportInfoDisplay(); this.RecipeHack = new RecipeHack(); this.ModListHelpers = new ModListHelpers(); }