Decompiled source of AnyMeatForCauldron v1.0.1

plugins/AnyMeatForCauldron.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AnyMeatForCauldron")]
[assembly: AssemblyDescription("Valheim mod to add an alternative cauldron recipes with cooked meat")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AnyMeatForCauldron")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("92657CB6-CD20-41E5-934D-76E7C67C557F")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace AnyMeatForCauldron;

[BepInPlugin("nightkosh.AnyMeatForCauldron", "AnyMeatForCauldron", "1.0.0")]
public class AnyMeatForCauldron : BaseUnityPlugin
{
	private const string PluginGuid = "nightkosh.AnyMeatForCauldron";

	private const string PluginName = "AnyMeatForCauldron";

	private const string PluginVersion = "1.0.0";

	private static ConfigEntry<bool> _modEnabled;

	private static ConfigEntry<bool> _boarJerkyEnabled;

	private static ConfigEntry<bool> _minceMeatSauceEnabled;

	private static ConfigEntry<bool> _sausagesEnabled;

	private static ConfigEntry<bool> _turnipStewEnabled;

	private static ConfigEntry<bool> _wolfJerkyEnabled;

	private static ConfigEntry<bool> _wolfMeatSkewerEnabled;

	private static ConfigEntry<bool> _meadBasePoisonResistEnabled;

	public void Awake()
	{
		_modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ModEnabled", true, "Enable or disable the mod.");
		_boarJerkyEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "BoarJerky", true, "Enable or disable alternative Boar Jerky recipe.");
		_minceMeatSauceEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "MinceMeatSauce", true, "Enable or disable alternative Mince Meat Sauce recipe.");
		_sausagesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Sausages", true, "Enable or disable alternative Sausages recipe.");
		_turnipStewEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TurnipStew", true, "Enable or disable alternative Turnip Stew recipe.");
		_wolfJerkyEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Wolfjerky", true, "Enable or disable alternative Wolf jerky recipe.");
		_wolfMeatSkewerEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "WolfMeatSkewer", true, "Enable or disable alternative Wolf Skewer recipe.");
		_meadBasePoisonResistEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "MeadBasePoisonResist", true, "Enable or disable alternative Poison Resist Mead recipe.");
		if (_modEnabled.Value)
		{
			AddRecipes();
		}
	}

	private void AddRecipes()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Expected O, but got Unknown
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Expected O, but got Unknown
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Expected O, but got Unknown
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Expected O, but got Unknown
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Expected O, but got Unknown
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Expected O, but got Unknown
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Expected O, but got Unknown
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Expected O, but got Unknown
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Expected O, but got Unknown
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Expected O, but got Unknown
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Expected O, but got Unknown
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Expected O, but got Unknown
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Expected O, but got Unknown
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Expected O, but got Unknown
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Expected O, but got Unknown
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Expected O, but got Unknown
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Expected O, but got Unknown
		if (_boarJerkyEnabled.Value)
		{
			AddRecipe(CraftingStations.Cauldron, 1, "BoarJerky", 2, (RequirementConfig[])(object)new RequirementConfig[2]
			{
				new RequirementConfig("CookedMeat", 1, 0, false),
				new RequirementConfig("Honey", 1, 0, false)
			});
		}
		if (_minceMeatSauceEnabled.Value)
		{
			AddRecipe(CraftingStations.Cauldron, 1, "MinceMeatSauce", 1, (RequirementConfig[])(object)new RequirementConfig[3]
			{
				new RequirementConfig("CookedMeat", 1, 0, false),
				new RequirementConfig("NeckTailGrilled", 1, 0, false),
				new RequirementConfig("Carrot", 1, 0, false)
			});
		}
		if (_sausagesEnabled.Value)
		{
			AddRecipe(CraftingStations.Cauldron, 2, "Sausages", 4, (RequirementConfig[])(object)new RequirementConfig[3]
			{
				new RequirementConfig("Entrails", 4, 0, false),
				new RequirementConfig("CookedMeat", 1, 0, false),
				new RequirementConfig("Thistle", 1, 0, false)
			});
		}
		if (_turnipStewEnabled.Value)
		{
			AddRecipe(CraftingStations.Cauldron, 2, "TurnipStew", 1, (RequirementConfig[])(object)new RequirementConfig[2]
			{
				new RequirementConfig("CookedMeat", 1, 0, false),
				new RequirementConfig("Turnip", 3, 0, false)
			});
		}
		if (_wolfJerkyEnabled.Value)
		{
			AddRecipe(CraftingStations.Cauldron, 3, "WolfJerky", 2, (RequirementConfig[])(object)new RequirementConfig[2]
			{
				new RequirementConfig("CookedWolfMeat", 1, 0, false),
				new RequirementConfig("Honey", 1, 0, false)
			});
		}
		if (_wolfMeatSkewerEnabled.Value)
		{
			AddRecipe(CraftingStations.Cauldron, 3, "WolfMeatSkewer", 1, (RequirementConfig[])(object)new RequirementConfig[3]
			{
				new RequirementConfig("CookedWolfMeat", 1, 0, false),
				new RequirementConfig("Onion", 1, 0, false),
				new RequirementConfig("Mushroom", 2, 0, false)
			});
		}
		if (_meadBasePoisonResistEnabled.Value)
		{
			AddRecipe(CraftingStations.MeadKetill, 1, "MeadBasePoisonResist", 1, (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig("Honey", 10, 0, false),
				new RequirementConfig("Thistle", 5, 0, false),
				new RequirementConfig("NeckTailGrilled", 1, 0, false),
				new RequirementConfig("Coal", 10, 0, false)
			});
		}
	}

	private void AddRecipe(string station, int level, string item, int amount, RequirementConfig[] requirements)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Expected O, but got Unknown
		RecipeConfig val = new RecipeConfig();
		val.Item = item;
		val.Name = "Recipe_" + item;
		val.Amount = amount;
		val.CraftingStation = station;
		val.MinStationLevel = level;
		foreach (RequirementConfig val2 in requirements)
		{
			val.AddRequirement(val2);
		}
		ItemManager.Instance.AddRecipe(new CustomRecipe(val));
	}
}