Decompiled source of Farming and Cooking Mod MelanieMelicious v0.0.4

MelanieMeliciousCooked.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
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 GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using MelanieMeliciousCooked;
using MelanieMeliciousCooked.NetcodePatcher;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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;
		}
	}
}
public class HarmonyPatches
{
	[HarmonyPostfix]
	[HarmonyPatch(typeof(TimeOfDay), "OnHourChanged")]
	private static void HourPatch()
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		if (!GameNetworkManager.Instance.isHostingGame)
		{
			return;
		}
		try
		{
			if (Random.Range(0, 99) < MelanieCookedConfig.carrotGrow.Value)
			{
				GameObject val = Object.Instantiate<GameObject>(Plugin.itemList.itemsList[1].spawnPrefab, GameObject.Find("PlotCarrot0Spawn").transform.position, new Quaternion(0f, 0f, 0f, 0f));
				Transform transform = val.transform;
				transform.localPosition += new Vector3(Random.Range(-0.3f, 0.3f), 0f, Random.Range(-0.3f, 0.3f));
				val.transform.localEulerAngles = new Vector3(-90f, 0f, 0f);
				val.GetComponent<NetworkObject>().Spawn(false);
				val.GetComponent<GrabbableObject>().SetScrapValue(Random.Range(5, 30));
			}
		}
		catch
		{
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(GameNetworkManager), "Start")]
	private static void NetworkPatch(ref GameNetworkManager __instance)
	{
		((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Plugin.unlockList.unlockables[0].prefabObject);
		((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Plugin.unlockList.unlockables[1].prefabObject);
		((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Plugin.unlockList.unlockables[3].prefabObject);
	}
}
public static class MelanieCookedConfig
{
	public static ConfigEntry<int> grinder0Cost;

	public static ConfigEntry<int> crockpot0Cost;

	public static ConfigEntry<int> oven0Cost;

	public static ConfigEntry<int> plotCarrot0Cost;

	public static ConfigEntry<int> carrotGrow;

	public static void SetupConfig(ConfigFile config)
	{
		grinder0Cost = config.Bind<int>("Prices", "Meat Grinder", 180, "Modify the price for the meat grinder.");
		crockpot0Cost = config.Bind<int>("Prices", "Crockpot", 180, "Modify the price for the crockpot.");
		oven0Cost = config.Bind<int>("Prices", "Mini Oven", 180, "Modify the price for the mini oven.");
		plotCarrot0Cost = config.Bind<int>("Prices", "Carrot Planter", 120, "Modify the price for carrot planters.");
		carrotGrow = config.Bind<int>("Growth Chance", "Carrot", 10, "Modify the chance for carrots to progress growing phase per hour.");
	}
}
namespace MelanieMeliciousCooked
{
	public class ItemManager : NetworkBehaviour
	{
		public Transform oldParent;

		public Transform newParent;

		public char cookType;

		public void Parent(PlayerControllerB playerWhoTriggered)
		{
			if (!((NetworkBehaviour)this).IsServer)
			{
				((Component)this).GetComponent<PlaceableObjectsSurface>().PlaceObject(playerWhoTriggered);
			}
			GrabbableObject currentlyHeldObjectServer = playerWhoTriggered.currentlyHeldObjectServer;
			char c = cookType;
			char c2 = c;
			if (c2 == '0' && (((Object)currentlyHeldObjectServer).name.StartsWith("RedLocust") || ((Object)currentlyHeldObjectServer).name.StartsWith("Ragdoll") || ((Object)currentlyHeldObjectServer).name.StartsWith("CaveDwellerEnemy") || ((Object)currentlyHeldObjectServer).name.StartsWith("ManticoilBody") || ((Object)currentlyHeldObjectServer).name.StartsWith("TulipSnakeBody") || ((Object)currentlyHeldObjectServer).name.StartsWith("CentipedeBody") || ((Object)currentlyHeldObjectServer).name.StartsWith("HoarderingBugBody") || ((Object)currentlyHeldObjectServer).name.StartsWith("CaveDwellerBody") || ((Object)currentlyHeldObjectServer).name.StartsWith("CrawlerBody") || ((Object)currentlyHeldObjectServer).name.StartsWith("BaboonHawkBody") || ((Object)currentlyHeldObjectServer).name.StartsWith("BunkerSpiderBody")))
			{
				((Component)currentlyHeldObjectServer).transform.parent = oldParent;
				SpawnItemServerRpc(0, Random.Range(((Component)playerWhoTriggered.currentlyHeldObjectServer).GetComponent<GrabbableObject>().scrapValue, ((Component)playerWhoTriggered.currentlyHeldObjectServer).GetComponent<GrabbableObject>().scrapValue + 30), ((Object)currentlyHeldObjectServer).name);
				if (((NetworkBehaviour)this).IsServer)
				{
					((Component)this).GetComponent<PlaceableObjectsSurface>().PlaceObject(playerWhoTriggered);
				}
			}
		}

		public void Cook()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			string[] array = new string[4] { "", "", "", "" };
			int num = 0;
			ushort num2 = 0;
			ushort num3 = 0;
			ushort num4 = 0;
			ushort num5 = 0;
			ushort num6 = 0;
			ushort num7 = 0;
			foreach (Transform item in oldParent)
			{
				Transform val = item;
				if (num7 < 4)
				{
					switch (((Object)val).name)
					{
					case "Meat0(Clone)":
						array[num7] = "Meat0(Clone)";
						num += ((Component)val).gameObject.GetComponent<GrabbableObject>().scrapValue;
						num2++;
						num7++;
						break;
					case "MeatCube(Clone)":
						array[num7] = "MeatCube(Clone)";
						num += ((Component)val).gameObject.GetComponent<GrabbableObject>().scrapValue;
						num2 += 2;
						num7++;
						break;
					case "Carrot0(Clone)":
						array[num7] = "Carrot0(Clone)";
						num += ((Component)val).gameObject.GetComponent<GrabbableObject>().scrapValue;
						num3++;
						num4++;
						num7++;
						break;
					case "Potato0(Clone)":
						array[num7] = "Potato0(Clone)";
						num += ((Component)val).gameObject.GetComponent<GrabbableObject>().scrapValue;
						num3++;
						num5++;
						num7++;
						break;
					case "Tomato0(Clone)":
						array[num7] = "Tomato0(Clone)";
						num += ((Component)val).gameObject.GetComponent<GrabbableObject>().scrapValue;
						num3++;
						num6++;
						num7++;
						break;
					case "Tomato(Clone)":
						array[num7] = "Tomato(Clone)";
						num += ((Component)val).gameObject.GetComponent<GrabbableObject>().scrapValue;
						num3++;
						num6++;
						num7++;
						break;
					case "Golden Tomato(Clone)":
						array[num7] = "Golden Tomato(Clone)";
						num += ((Component)val).gameObject.GetComponent<GrabbableObject>().scrapValue;
						num3++;
						num6++;
						num7++;
						break;
					case "PickleJar(Clone)":
						array[num7] = "PickleJar(Clone)";
						num += ((Component)val).gameObject.GetComponent<GrabbableObject>().scrapValue;
						num3++;
						num7++;
						break;
					}
				}
			}
			switch (cookType)
			{
			case '0':
				if (num2 > 1 && num7 == 4)
				{
					SpawnItemServerRpc(3, num + Random.Range(10, num / 4), array[0], array[1], array[2], array[3]);
				}
				else if (num3 > 2)
				{
					SpawnItemServerRpc(2, num + Random.Range(10, num / 4), array[0], array[1], array[2], array[3]);
				}
				break;
			case '1':
				if (num2 > 2 || (num2 > 0 && num3 > 1))
				{
					SpawnItemServerRpc(4, num + Random.Range(10, num / 4), array[0], array[1], array[2], array[3]);
				}
				break;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnItemServerRpc(int itemList, int dishValue, string delete0 = "", string delete1 = "", string delete2 = "", string delete3 = "")
		{
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Expected O, but got Unknown
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(828491791u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, itemList);
				BytePacker.WriteValueBitPacked(val2, dishValue);
				bool flag = delete0 != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(delete0, false);
				}
				bool flag2 = delete1 != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(delete1, false);
				}
				bool flag3 = delete2 != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives));
				if (flag3)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(delete2, false);
				}
				bool flag4 = delete3 != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag4, default(ForPrimitives));
				if (flag4)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(delete3, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 828491791u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			string[] array = new string[4] { delete0, delete1, delete2, delete3 };
			GameObject val3 = Object.Instantiate<GameObject>(Plugin.itemList.itemsList[itemList].spawnPrefab, newParent.position, newParent.rotation, RoundManager.Instance.spawnedScrapContainer);
			val3.GetComponent<NetworkObject>().Spawn(false);
			val3.GetComponent<GrabbableObject>().SetScrapValue(dishValue);
			try
			{
				string[] array2 = array;
				foreach (string text in array2)
				{
					bool flag5 = false;
					foreach (Transform item in oldParent)
					{
						Transform val4 = item;
						if (!flag5 && ((Object)val4).name == text)
						{
							((Object)val4).name = "delete";
							Object.Destroy((Object)(object)((Component)val4).gameObject);
							flag5 = true;
						}
					}
				}
			}
			catch
			{
			}
			DeleteItemClientRpc(NetworkObjectReference.op_Implicit(val3.GetComponent<NetworkObject>()), dishValue, delete0, delete1, delete2, delete3);
		}

		[ClientRpc]
		public void DeleteItemClientRpc(NetworkObjectReference netObjectRef, int dishValue, string delete0 = "", string delete1 = "", string delete2 = "", string delete3 = "")
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2178165484u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, dishValue);
				bool flag = delete0 != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(delete0, false);
				}
				bool flag2 = delete1 != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(delete1, false);
				}
				bool flag3 = delete2 != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives));
				if (flag3)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(delete2, false);
				}
				bool flag4 = delete3 != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag4, default(ForPrimitives));
				if (flag4)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(delete3, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2178165484u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || ((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			try
			{
				string[] array = new string[4] { delete0, delete1, delete2, delete3 };
				string[] array2 = array;
				foreach (string text in array2)
				{
					bool flag5 = false;
					foreach (Transform item in oldParent)
					{
						Transform val3 = item;
						if (!flag5 && ((Object)val3).name == text)
						{
							((Object)val3).name = "delete";
							Object.Destroy((Object)(object)((Component)val3).gameObject);
							flag5 = true;
						}
					}
				}
			}
			catch
			{
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ItemManager()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(828491791u, new RpcReceiveHandler(__rpc_handler_828491791));
			NetworkManager.__rpc_func_table.Add(2178165484u, new RpcReceiveHandler(__rpc_handler_2178165484));
		}

		private static void __rpc_handler_828491791(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int itemList = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref itemList);
				int dishValue = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref dishValue);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string delete = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref delete, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				string delete2 = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref delete2, false);
				}
				bool flag3 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag3, default(ForPrimitives));
				string delete3 = null;
				if (flag3)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref delete3, false);
				}
				bool flag4 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag4, default(ForPrimitives));
				string delete4 = null;
				if (flag4)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref delete4, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ItemManager)(object)target).SpawnItemServerRpc(itemList, dishValue, delete, delete2, delete3, delete4);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2178165484(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netObjectRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
				int dishValue = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref dishValue);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string delete = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref delete, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				string delete2 = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref delete2, false);
				}
				bool flag3 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag3, default(ForPrimitives));
				string delete3 = null;
				if (flag3)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref delete3, false);
				}
				bool flag4 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag4, default(ForPrimitives));
				string delete4 = null;
				if (flag4)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref delete4, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ItemManager)(object)target).DeleteItemClientRpc(netObjectRef, dishValue, delete, delete2, delete3, delete4);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ItemManager";
		}
	}
	[BepInPlugin("MelanieMelicious.FarmAndCook", "MelanieMelicious - Farming and Cooking Mod", "0.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "MelanieMelicious.FarmAndCook";

		private const string NAME = "MelanieMelicious - Farming and Cooking Mod";

		private const string VERSION = "0.0.4";

		private readonly Harmony harmony = new Harmony("MelanieMelicious.FarmAndCook");

		public static ManualLogSource mls;

		public static AssetBundle bundle;

		public static UnlockablesList unlockList;

		public static AllItemsList itemList;

		public static Plugin instance;

		private void Awake()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			instance = this;
			MelanieCookedConfig.SetupConfig(((BaseUnityPlugin)this).Config);
			mls = Logger.CreateLogSource("MelanieMelicious - Farming and Cooking Mod");
			mls = ((BaseUnityPlugin)this).Logger;
			harmony.PatchAll(typeof(HarmonyPatches));
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "melaniecooked");
			bundle = AssetBundle.LoadFromFile(text);
			unlockList = bundle.LoadAsset<UnlockablesList>("Assets/MelanieCooked/Asset/Furniture.asset");
			itemList = bundle.LoadAsset<AllItemsList>("Assets/MelanieCooked/Asset/Food.asset");
			NetworkPrefabs.RegisterNetworkPrefab(unlockList.unlockables[0].prefabObject);
			Unlockables.RegisterUnlockable(unlockList.unlockables[0], (StoreType)1, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieCookedConfig.grinder0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(unlockList.unlockables[1].prefabObject);
			Unlockables.RegisterUnlockable(unlockList.unlockables[1], (StoreType)1, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieCookedConfig.crockpot0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(unlockList.unlockables[2].prefabObject);
			Unlockables.RegisterUnlockable(unlockList.unlockables[2], (StoreType)1, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieCookedConfig.plotCarrot0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(unlockList.unlockables[3].prefabObject);
			Unlockables.RegisterUnlockable(unlockList.unlockables[3], (StoreType)1, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieCookedConfig.oven0Cost.Value);
			foreach (Item items in itemList.itemsList)
			{
				NetworkPrefabs.RegisterNetworkPrefab(items.spawnPrefab);
				Items.RegisterItem(items);
			}
		}
	}
}
namespace MelanieMeliciousCooked.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}