Decompiled source of MuckFoods v1.5.0

MuckFoods.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("MuckFoods")]
[assembly: AssemblyConfiguration("RELEASE")]
[assembly: AssemblyDescription("Adds a wide variety of foods which can be cooked by combining various existing ingredients in a Cauldron. This also decreases the effectiveness of some vanilla foods, to encourage combining many ingredients into one.")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyInformationalVersion("1.5.0+c83f9cd55aa6877169f18117cf58bacd7dbf7b9a")]
[assembly: AssemblyProduct("MuckFoods")]
[assembly: AssemblyTitle("MuckFoods")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	public static class Extensions
	{
		public static void LogItemCreated(this ManualLogSource log, InventoryItem item)
		{
			log.LogInfo((object)("Item \"" + item.name + "\" created, ID " + item.id));
		}

		public static ConfigEntry<int> BindMoreThanZero(this ConfigFile config, string section, string key, int defaultValue, string description)
		{
			ConfigEntry<int> val = config.Bind<int>(section, key, defaultValue, description);
			if (val.Value <= 0)
			{
				val.Value = defaultValue;
			}
			return val;
		}

		public static ConfigEntry<float> BindMoreThanZero(this ConfigFile config, string section, string key, float defaultValue, string description)
		{
			ConfigEntry<float> val = config.Bind<float>(section, key, defaultValue, description);
			if (val.Value <= 0f)
			{
				val.Value = defaultValue;
			}
			return val;
		}

		public static ConfigEntry<float> BindNonNegative(this ConfigFile config, string section, string key, float defaultValue, string description)
		{
			ConfigEntry<float> val = config.Bind<float>(section, key, defaultValue, description);
			if (val.Value < 0f)
			{
				val.Value = defaultValue;
			}
			return val;
		}

		public static ConfigEntry<int> BindNonNegative(this ConfigFile config, string section, string key, int defaultValue, string description)
		{
			ConfigEntry<int> val = config.Bind<int>(section, key, defaultValue, description);
			if ((float)val.Value < 0f)
			{
				val.Value = defaultValue;
			}
			return val;
		}

		public static InventoryItem Clone(this InventoryItem i)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			InventoryItem obj = ScriptableObject.CreateInstance<InventoryItem>();
			obj.amount = i.amount;
			obj.armor = i.armor;
			obj.armorComponent = i.armorComponent;
			obj.attackDamage = i.attackDamage;
			obj.attackRange = i.attackRange;
			obj.attackSpeed = i.attackSpeed;
			obj.attackTypes = i.attackTypes;
			obj.bowComponent = i.bowComponent;
			obj.buildRotation = i.buildRotation;
			obj.buildable = i.buildable;
			obj.craftAmount = i.craftAmount;
			obj.craftable = i.craftable;
			obj.description = i.description;
			obj.fuel = i.fuel;
			obj.grid = i.grid;
			obj.heal = i.heal;
			((Object)obj).hideFlags = ((Object)i).hideFlags;
			obj.hunger = i.hunger;
			obj.id = i.id;
			obj.important = i.important;
			obj.material = i.material;
			obj.max = i.max;
			obj.mesh = i.mesh;
			obj.name = i.name;
			obj.positionOffset = i.positionOffset;
			obj.prefab = i.prefab;
			obj.processTime = i.processTime;
			obj.processType = i.processType;
			obj.processable = i.processable;
			obj.processedItem = i.processedItem;
			obj.rarity = i.rarity;
			obj.requirements = i.requirements;
			obj.resourceDamage = i.resourceDamage;
			obj.rotationOffset = i.rotationOffset;
			obj.scale = i.scale;
			obj.sharpness = i.sharpness;
			obj.sprite = i.sprite;
			obj.stackable = i.stackable;
			obj.stamina = i.stamina;
			obj.stationRequirement = i.stationRequirement;
			obj.swingFx = i.swingFx;
			obj.tag = i.tag;
			obj.tier = i.tier;
			obj.type = i.type;
			obj.unlockWithFirstRequirementOnly = i.unlockWithFirstRequirementOnly;
			return obj;
		}
	}
}
namespace MuckFoods
{
	public class CreateRecipesPatch
	{
		public static InventoryItem[] NewFoods = (InventoryItem[])(object)new InventoryItem[0];

		[HarmonyPatch(typeof(ItemManager), "InitAllItems")]
		[HarmonyPostfix]
		private static void InitializeFoods()
		{
			InventoryItem val = ItemManager.Instance.allItems[45];
			InventoryItem val2 = ItemManager.Instance.allItems[46];
			InventoryItem val3 = ItemManager.Instance.allItems[47];
			InventoryItem val4 = ItemManager.Instance.allItems[49];
			InventoryItem val5 = ItemManager.Instance.allItems[50];
			InventoryItem val6 = ItemManager.Instance.allItems[51];
			InventoryItem val7 = ItemManager.Instance.allItems[52];
			InventoryItem val8 = ItemManager.Instance.allItems[53];
			InventoryItem val9 = ItemManager.Instance.allItems[54];
			InventoryItem val10 = ItemManager.Instance.allItems[56];
			InventoryItem val11 = ItemManager.Instance.allItems[57];
			InventoryItem val12 = ItemManager.Instance.allItems[58];
			InventoryItem val13 = ItemManager.Instance.allItems[59];
			InventoryItem val14 = ItemManager.Instance.allItems[60];
			InventoryItem val15 = ItemManager.Instance.allItems[61];
			InventoryItem val16 = ItemManager.Instance.allItems[62];
			InventoryItem val17 = ItemManager.Instance.allItems[63];
			InventoryItem val18 = ItemManager.Instance.allItems[64];
			SetStats(val2, 0f, 0f, 0f);
			SetStats(val4, 0f, 0f, 0f);
			if (Plugin.RebalanceFoods)
			{
				SetStats(val, 4f, 4f, 4f);
				SetStats(val5, 6f, 6f, 3f);
				val6.heal = 10f;
				val7.hunger = 10f;
				val9.stamina = 10f;
				SetStats(val8, 10f, 10f, 10f);
				SetStats(val16, 25f, 10f, 10f);
				SetStats(val18, 10f, 25f, 10f);
				SetStats(val15, 10f, 10f, 25f);
				SetStats(val17, 30f, 30f, 30f);
				Restoration.FromIngredients(val5).Apply(val11);
				Restoration.FromIngredients(val11, val2).Apply(val14);
				Restoration.FromIngredients(val, val10, val2).Apply(val12);
				Restoration.FromIngredients(val11, val2, val10).Apply(val13);
			}
			InventoryItem val19 = CreateFood(val, Resources.AppleBakedSprite, "Baked Apple", "soft and sweet, but looks familiar somehow...", CraftRequirements(val), val);
			InventoryItem val20 = CreateFood(val6, Resources.ShroomRedToastySprite, "Toasted Gulpon Shroom", "nice and hot!", CraftRequirements(val6), val6);
			InventoryItem val21 = CreateFood(val7, Resources.ShroomYellowToastySprite, "Toasted Ligon Shroom", "tasty and filling", CraftRequirements(val7), val7);
			InventoryItem val22 = CreateFood(val9, Resources.ShroomPurpleToastySprite, "Toasted Sugon Shroom", "keeps you jumping at your best", CraftRequirements(val9), val9);
			InventoryItem val23 = CreateFood(val8, Resources.ShroomSusToastySprite, "Toasted Slurbon Shroom", "still kinda sus...", CraftRequirements(val8), val8);
			val19.processTime = val11.processTime;
			val20.processTime = val11.processTime;
			val21.processTime = val11.processTime;
			val22.processTime = val11.processTime;
			val23.processTime = val11.processTime;
			List<InventoryItem> list = new List<InventoryItem>();
			list.Add(val19);
			list.Add(val20);
			list.Add(val21);
			list.Add(val22);
			list.Add(val23);
			list.Add(CreateFood(val12, val12.sprite, "Pie Pie", "it's pie flavoured", CraftRequirements(val3, val2), val10, val2));
			list.Add(CreateFood(val10, Resources.FlaxseedBreadSprite, "Flaxseed Bread", "what else can you do with flax?", CraftRequirements(val3, val4), val10, val4));
			list.Add(CreateFood(val14, Resources.AppleMeatStewSprite, "Apple Meat Stew", "yummy", CraftRequirements(val, val5, val2), val, val11, val2));
			list.Add(CreateFood(val12, Resources.PieAppleMeatSprite, "Apple Meat Pie", "dessert and dinner in one", CraftRequirements(val, val5, val3, val2), val, val11, val10, val2));
			list.Add(CreateFood(val17, Resources.LessWeirdSoupSprite, "Less Weird Soup", "food for a fun guy", CraftRequirements(val6, val7, val9, val2), val6, val7, val9, val2));
			List<InventoryItem> list2 = list;
			(InventoryItem, string, string, InventoryItem)[] array = new(InventoryItem, string, string, InventoryItem)[4]
			{
				(val6, "Gulpon", "Red", val16),
				(val7, "Ligon", "Yellow", val18),
				(val9, "Sugon", "Purple", val15),
				(val8, "Slurbon", "Weird", val17)
			};
			DescrSprite[] array2 = new DescrSprite[4]
			{
				new DescrSprite("spicy pie", Resources.PieRedSprite),
				new DescrSprite("pie with shroom", Resources.PieYellowSprite),
				new DescrSprite("pie in the sky", Resources.PiePurpleSprite),
				new DescrSprite("mystery pie", Resources.PieSusSprite)
			};
			DescrSprite[] array3 = new DescrSprite[4]
			{
				new DescrSprite("pretty healthy", Resources.PieRedAppleSprite),
				new DescrSprite("pie with apple and shroom", Resources.PieYellowAppleSprite),
				new DescrSprite("pretty fast pie", Resources.PiePurpleAppleSprite),
				new DescrSprite("who needs meat anyway?", Resources.PieSusAppleSprite)
			};
			DescrSprite[] array4 = new DescrSprite[4]
			{
				new DescrSprite("don't die pie", Resources.PieRedMeatSprite),
				new DescrSprite("could feed an army (or just you)", Resources.PieYellowMeatSprite),
				new DescrSprite("fills you with energy", Resources.PiePurpleMeatSprite),
				new DescrSprite("sus, savoury, scrumptious", Resources.PieSusMeatSprite)
			};
			DescrSprite[] array5 = new DescrSprite[4]
			{
				new DescrSprite("red and vegan friendly", Resources.SoupRedAppleSprite),
				new DescrSprite("it's sweet and savoury", Resources.SoupYellowAppleSprite),
				new DescrSprite("better than nothing ig", Resources.SoupPurpleAppleSprite),
				new DescrSprite("lv 5 vegans only", Resources.SoupSusAppleSprite)
			};
			DescrSprite[] array6 = new DescrSprite[4]
			{
				new DescrSprite("savoury stew", Resources.SoupRedMeatSprite),
				new DescrSprite("tender meat and shroom", Resources.SoupYellowMeatSprite),
				new DescrSprite("tasty stew for when you're tired", Resources.SoupPurpleMeatSprite),
				new DescrSprite("i think the meat became rainbows", Resources.SoupSusMeatSprite)
			};
			DescrSprite[] array7 = new DescrSprite[4]
			{
				new DescrSprite("reddest food ever made", Resources.SoupRedAppleMeatSprite),
				new DescrSprite("a real hunter-gatherer's meal", Resources.SoupYellowAppleMeatSprite),
				new DescrSprite("keeps you going", Resources.SoupPurpleAppleMeatSprite),
				new DescrSprite("the heartiest stew in the land", Resources.SoupSusAppleMeatSprite)
			};
			int num = 0;
			(InventoryItem, string, string, InventoryItem)[] array8 = array;
			for (int i = 0; i < array8.Length; i++)
			{
				(InventoryItem, string, string, InventoryItem) tuple = array8[i];
				list2.Add(CreateFood(val12, array2[num].Sprite, tuple.Item2 + " Shroom Pie", array2[num].Descr, CraftRequirements(val3, tuple.Item1, val2), val10, tuple.Item4, val2));
				list2.Add(CreateFood(val12, array3[num].Sprite, "Apple and " + tuple.Item2 + " Shroom Pie", array3[num].Descr, CraftRequirements(val3, val, tuple.Item1, val2), val10, val, tuple.Item4, val2));
				list2.Add(CreateFood(val12, array4[num].Sprite, "Meat and " + tuple.Item2 + " Shroom Pie", array4[num].Descr, CraftRequirements(val3, val5, tuple.Item1, val2), val10, val11, tuple.Item4, val2));
				list2.Add(CreateFood(tuple.Item4, array5[num].Sprite, "Apple and " + tuple.Item2 + " Shroom Stew", array5[num].Descr, CraftRequirements(val, tuple.Item1, val2), val, tuple.Item4, val2));
				list2.Add(CreateFood(tuple.Item4, array6[num].Sprite, "Meat and " + tuple.Item2 + " Shroom Stew", array6[num].Descr, CraftRequirements(val5, tuple.Item1, val2), val11, tuple.Item4, val2));
				list2.Add(CreateFood(tuple.Item4, array7[num].Sprite, tuple.Item3 + " Gourmet Stew", array7[num].Descr, CraftRequirements(val5, val, tuple.Item1, val2), val11, val, tuple.Item4, val2));
				num++;
			}
			val12.sprite = Resources.PieAppleSprite;
			val13.sprite = Resources.PieMeatSprite;
			int num2 = ItemManager.Instance.allItems.Keys.DefaultIfEmpty(0).Max() + 1;
			foreach (InventoryItem item in list2)
			{
				item.id = num2++;
				ItemManager.Instance.allItems.Add(item.id, item);
				Plugin.Log.LogItemCreated(item);
			}
			ItemManager.Instance.allScriptableItems = ItemManager.Instance.allScriptableItems.Concat(list2).ToArray();
			NewFoods = list2.ToArray();
		}

		[HarmonyPatch(typeof(CauldronUI), "Awake")]
		[HarmonyPostfix]
		private static void AddFoodsToCauldron()
		{
			CauldronUI.Instance.processableFood = CauldronUI.Instance.processableFood.Concat(NewFoods).ToArray();
		}

		private static InventoryItem CreateFood(InventoryItem baseItem, Sprite sprite, string name, string descr, CraftRequirement[] requirements, params InventoryItem[] restoresSumOf)
		{
			Plugin.Log.LogInfo((object)("Making: " + name));
			Restoration resto = Restoration.FromIngredients(restoresSumOf);
			InventoryItem val = Clone(baseItem, name, descr, sprite, requirements, resto);
			Plugin.Log.LogInfo((object)("Added food \"" + name + "\" which restores " + resto.Heal + " Health, " + resto.Hunger + " Hunger, " + resto.Stamina + " Stamina. Made from: " + string.Join(",", val.requirements.Select((CraftRequirement x) => x.item.name))));
			return val;
		}

		private static CraftRequirement[] CraftRequirements(params InventoryItem[] items)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			CraftRequirement[] array = (CraftRequirement[])(object)new CraftRequirement[items.Length];
			for (int i = 0; i < items.Length; i++)
			{
				array[i] = new CraftRequirement
				{
					item = items[i],
					amount = 1
				};
			}
			return array;
		}

		private static void SetStats(InventoryItem food, float heal, float hunger, float stamina)
		{
			food.heal = heal;
			food.hunger = hunger;
			food.stamina = stamina;
		}

		private static InventoryItem Clone(InventoryItem item, string name, string description, Sprite sprite, CraftRequirement[] requirements, Restoration resto)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			InventoryItem val = ScriptableObject.CreateInstance<InventoryItem>();
			val.material = item.material;
			val.sprite = sprite;
			val.name = name;
			val.description = description;
			val.requirements = requirements;
			resto.Apply(val);
			val.important = false;
			val.type = (ItemType)8;
			val.tier = item.tier;
			val.mesh = item.mesh;
			val.rotationOffset = item.rotationOffset;
			val.positionOffset = item.positionOffset;
			val.scale = item.scale;
			val.stackable = true;
			val.amount = 1;
			val.max = 69;
			val.resourceDamage = 1;
			val.attackDamage = 1;
			val.attackSpeed = 1f;
			val.attackRange = 0f;
			val.sharpness = 0f;
			val.craftable = false;
			val.unlockWithFirstRequirementOnly = item.unlockWithFirstRequirementOnly;
			val.stationRequirement = item.stationRequirement;
			val.buildable = false;
			val.grid = false;
			val.prefab = item.prefab;
			val.buildRotation = item.buildRotation;
			val.processable = false;
			val.processType = item.processType;
			val.processedItem = item.processedItem;
			val.processTime = 5f;
			val.armor = 0;
			val.swingFx = item.swingFx;
			val.bowComponent = item.bowComponent;
			val.armorComponent = item.armorComponent;
			val.fuel = item.fuel;
			val.tag = (ItemTag)2;
			val.rarity = item.rarity;
			val.attackTypes = item.attackTypes;
			((Object)val).hideFlags = ((Object)item).hideFlags;
			val.craftAmount = 1;
			return val;
		}
	}
	public sealed class DescrSprite
	{
		public string Descr { get; }

		public Sprite Sprite { get; }

		public DescrSprite(string descr, Sprite sprite)
		{
			Descr = descr;
			Sprite = sprite;
		}
	}
	[BepInPlugin("MuckFoods.MichMcb", "Muck Foods", "1.5.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log = null;

		public static bool RebalanceFoods = true;

		public static float CookHealthBonus = 5f;

		public static float CookHungerBonus = 5f;

		public static float CookStaminaBonus = 5f;

		public static float[] HealthBonus = new float[4];

		public static float[] HungerBonus = new float[4];

		public static float[] StaminaBonus = new float[4];

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			RebalanceFoods = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "RebalanceFoods", RebalanceFoods, "If true, then vanilla foods' Health/Hunger/Stamina will be rebalanced. These foods will be affected:\nApple: 5/15/5 -> 4/4/4\nRaw Meat: 5/10/0 -> 6/6/3\nGulpon Shroom: 12 Health -> 10 Health\nLigon Shroom: 12 Hunger -> 10 Hunger\nSugon Shroom: 12 Stamina -> 10 Stamina\nSlurbon Shroon: 15/15/15 -> 10/10/10\nRed Soup: 30/10/10 -> 25/10/10\nYellow Soup: 10/50/10 -> 10/25/10\nPurple Soup: 10/10/40 -> 10/10/25\nWeird Soup: 40/40/40 -> 30/30/30Cooked Meat: 20/50/5 -> Depends on config\nMeat Soup: 30/50/20 -> Depends on config\nApple Pie: 30/60/20 -> Depends on config\nMeat Pie: 30/60/20 -> Depends on config").Value;
			CookHealthBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "CookHealthBonus", CookHealthBonus, "The base bonus to health that foods gain when cooked. Additive with bonuses for multiple ingredients").Value;
			CookHungerBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "CookHungerBonus", CookHungerBonus, "The base bonus to hunger that foods gain when cooked. Additive with bonuses for multiple ingredients").Value;
			CookStaminaBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "CookStaminaBonus", CookStaminaBonus, "The base bonus to stamina that foods gain when cooked. Additive with bonuses for multiple ingredients").Value;
			HealthBonus[0] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "OneFoodHealthBonus", 0f, "The bonus to health that foods with 1 ingredient gain").Value;
			HungerBonus[0] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "OneFoodHungerBonus", 0f, "The bonus to hunger that foods with 1 ingredient gain").Value;
			StaminaBonus[0] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "OneFoodStaminaBonus", 0f, "The bonus to stamina that foods with 1 ingredient gain").Value;
			HealthBonus[1] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "TwoFoodHealthBonus", 3f, "The bonus to health that foods with 2 ingredients gain").Value;
			HungerBonus[1] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "TwoFoodHungerBonus", 3f, "The bonus to hunger that foods with 2 ingredients gain").Value;
			StaminaBonus[1] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "TwoFoodStaminaBonus", 3f, "The bonus to stamina that foods with 2 ingredients gain").Value;
			HealthBonus[2] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "ThreeFoodHealthBonus", 6f, "The bonus to health that foods with 3 ingredients gain").Value;
			HungerBonus[2] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "ThreeFoodHungerBonus", 6f, "The bonus to hunger that foods with 3 ingredients gain").Value;
			StaminaBonus[2] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "ThreeFoodStaminaBonus", 6f, "The bonus to stamina that foods with 3 ingredients gain").Value;
			HealthBonus[3] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "FourFoodHealthBonus", 10f, "The bonus to health that foods with 4 ingredients gain").Value;
			HungerBonus[3] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "FourFoodHungerBonus", 10f, "The bonus to hunger that foods with 4 ingredients gain").Value;
			StaminaBonus[3] = ((BaseUnityPlugin)this).Config.Bind<float>("Main", "FourFoodStaminaBonus", 10f, "The bonus to stamina that foods with 4 ingredients gain").Value;
			((BaseUnityPlugin)this).Config.Save();
			Resources.Load();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MuckFoods loaded!");
			Harmony.CreateAndPatchAll(typeof(CreateRecipesPatch), (string)null);
		}
	}
	public static class Resources
	{
		public static Sprite AppleBakedSprite;

		public static Sprite AppleMeatStewSprite;

		public static Sprite FlaxseedBreadSprite;

		public static Sprite LessWeirdSoupSprite;

		public static Sprite PieAppleMeatSprite;

		public static Sprite PieAppleSprite;

		public static Sprite PieMeatSprite;

		public static Sprite PiePurpleAppleSprite;

		public static Sprite PiePurpleMeatSprite;

		public static Sprite PiePurpleSprite;

		public static Sprite PieRedAppleSprite;

		public static Sprite PieRedMeatSprite;

		public static Sprite PieRedSprite;

		public static Sprite PieSusAppleSprite;

		public static Sprite PieSusMeatSprite;

		public static Sprite PieSusSprite;

		public static Sprite PieYellowAppleSprite;

		public static Sprite PieYellowMeatSprite;

		public static Sprite PieYellowSprite;

		public static Sprite SoupPurpleAppleMeatSprite;

		public static Sprite SoupPurpleAppleSprite;

		public static Sprite SoupPurpleMeatSprite;

		public static Sprite SoupRedAppleMeatSprite;

		public static Sprite SoupRedAppleSprite;

		public static Sprite SoupRedMeatSprite;

		public static Sprite SoupSusAppleMeatSprite;

		public static Sprite SoupSusAppleSprite;

		public static Sprite SoupSusMeatSprite;

		public static Sprite SoupYellowAppleMeatSprite;

		public static Sprite SoupYellowAppleSprite;

		public static Sprite SoupYellowMeatSprite;

		public static Sprite ShroomRedToastySprite;

		public static Sprite ShroomYellowToastySprite;

		public static Sprite ShroomPurpleToastySprite;

		public static Sprite ShroomSusToastySprite;

		public static void Load()
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MuckFoods.resources");
			AssetBundle obj = AssetBundle.LoadFromStream(stream);
			AppleBakedSprite = obj.LoadAsset<Sprite>("AppleBaked.png");
			ShroomRedToastySprite = obj.LoadAsset<Sprite>("ShroomRedToasty.png");
			ShroomYellowToastySprite = obj.LoadAsset<Sprite>("ShroomYellowToasty.png");
			ShroomPurpleToastySprite = obj.LoadAsset<Sprite>("ShroomPurpleToasty.png");
			ShroomSusToastySprite = obj.LoadAsset<Sprite>("ShroomSusToasty.png");
			AppleMeatStewSprite = obj.LoadAsset<Sprite>("AppleMeatStew.png");
			FlaxseedBreadSprite = obj.LoadAsset<Sprite>("FlaxseedBread.png");
			LessWeirdSoupSprite = obj.LoadAsset<Sprite>("LessWeirdSoup.png");
			PieAppleMeatSprite = obj.LoadAsset<Sprite>("PieAppleMeat.png");
			PieAppleSprite = obj.LoadAsset<Sprite>("PieApple.png");
			PieMeatSprite = obj.LoadAsset<Sprite>("PieMeat.png");
			PiePurpleAppleSprite = obj.LoadAsset<Sprite>("PiePurpleApple.png");
			PiePurpleMeatSprite = obj.LoadAsset<Sprite>("PiePurpleMeat.png");
			PiePurpleSprite = obj.LoadAsset<Sprite>("PiePurple.png");
			PieRedAppleSprite = obj.LoadAsset<Sprite>("PieRedApple.png");
			PieRedMeatSprite = obj.LoadAsset<Sprite>("PieRedMeat.png");
			PieRedSprite = obj.LoadAsset<Sprite>("PieRed.png");
			PieSusAppleSprite = obj.LoadAsset<Sprite>("PieSusApple.png");
			PieSusMeatSprite = obj.LoadAsset<Sprite>("PieSusMeat.png");
			PieSusSprite = obj.LoadAsset<Sprite>("PieSus.png");
			PieYellowAppleSprite = obj.LoadAsset<Sprite>("PieYellowApple.png");
			PieYellowMeatSprite = obj.LoadAsset<Sprite>("PieYellowMeat.png");
			PieYellowSprite = obj.LoadAsset<Sprite>("PieYellow.png");
			SoupPurpleAppleMeatSprite = obj.LoadAsset<Sprite>("SoupPurpleAppleMeat.png");
			SoupPurpleAppleSprite = obj.LoadAsset<Sprite>("SoupPurpleApple.png");
			SoupPurpleMeatSprite = obj.LoadAsset<Sprite>("SoupPurpleMeat.png");
			SoupRedAppleMeatSprite = obj.LoadAsset<Sprite>("SoupRedAppleMeat.png");
			SoupRedAppleSprite = obj.LoadAsset<Sprite>("SoupRedApple.png");
			SoupRedMeatSprite = obj.LoadAsset<Sprite>("SoupRedMeat.png");
			SoupSusAppleMeatSprite = obj.LoadAsset<Sprite>("SoupSusAppleMeat.png");
			SoupSusAppleSprite = obj.LoadAsset<Sprite>("SoupSusApple.png");
			SoupSusMeatSprite = obj.LoadAsset<Sprite>("SoupSusMeat.png");
			SoupYellowAppleMeatSprite = obj.LoadAsset<Sprite>("SoupYellowAppleMeat.png");
			SoupYellowAppleSprite = obj.LoadAsset<Sprite>("SoupYellowApple.png");
			SoupYellowMeatSprite = obj.LoadAsset<Sprite>("SoupYellowMeat.png");
			Plugin.Log.LogInfo((object)"Assets loaded");
		}
	}
	public readonly struct Restoration
	{
		public float Heal { get; }

		public float Hunger { get; }

		public float Stamina { get; }

		public Restoration(float heal, float hunger, float stamina)
		{
			Heal = heal;
			Hunger = hunger;
			Stamina = stamina;
		}

		public void Apply(InventoryItem item)
		{
			item.heal = Math.Max(0f, Heal);
			item.hunger = Math.Max(0f, Hunger);
			item.stamina = Math.Max(0f, Stamina);
		}

		public static Restoration FromItem(InventoryItem item)
		{
			return new Restoration(item.heal, item.hunger, item.stamina);
		}

		public static Restoration FromFloats(float[] values)
		{
			float heal = ((values.Length != 0) ? values[0] : 0f);
			float hunger = ((values.Length > 1) ? values[1] : 0f);
			float stamina = ((values.Length > 2) ? values[2] : 0f);
			return new Restoration(heal, hunger, stamina);
		}

		public static Restoration FromIngredients(params InventoryItem[] items)
		{
			float num = Plugin.CookHealthBonus + Plugin.HealthBonus[items.Length - 1];
			float num2 = Plugin.CookHungerBonus + Plugin.HungerBonus[items.Length - 1];
			float num3 = Plugin.CookStaminaBonus + Plugin.StaminaBonus[items.Length - 1];
			foreach (InventoryItem val in items)
			{
				Plugin.Log.LogInfo((object)("Adding " + val.name + " ingredient value: " + val.heal + "/" + val.hunger + "/" + val.stamina));
				num += val.heal;
				num2 += val.hunger;
				num3 += val.stamina;
			}
			return new Restoration(num, num2, num3);
		}
	}
}