Decompiled source of LethalEnergy v1.2.3

LC_LethalEnergy.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LC_LethalEnergy.NetcodePatcher;
using LethalLib.Modules;
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: AssemblyTitle("LC_LethalEnergy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC_LethalEnergy")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("45290088-3404-4593-9b10-989b1ca3aae7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace LC_LethalEnergy
{
	public class DrinkCase : GrabbableObject
	{
		public static GameObject canPrefab;

		public int cansHeld;

		public Transform[] cans;

		public ManualLogSource mls;

		private int minimumCans = 5;

		private int value = 0;

		public bool loaded = false;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			mls = LethalEnergyMod.mls;
			GameObject gameObject = ((Component)((Component)this).transform.Find("DrinkContainer")).gameObject;
			cans = (Transform[])(object)new Transform[gameObject.transform.childCount];
			for (int i = 0; i < gameObject.transform.childCount; i++)
			{
				cans[i] = gameObject.transform.GetChild(i);
			}
			((MonoBehaviour)this).StartCoroutine(SetValue());
			if (((NetworkBehaviour)this).IsServer)
			{
				mls.LogMessage((object)"SetCans was called");
				((MonoBehaviour)this).StartCoroutine(SendOutData());
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(RequestData());
			}
		}

		public IEnumerator SendOutData()
		{
			int cans = Mathf.Clamp(Random.Range(1, 7) + Random.Range(1, 7), minimumCans, 12);
			SendCansClientRpc(cans);
			yield return (object)new WaitForSeconds(2f);
			SendCansServerRpc(cans);
		}

		public IEnumerator RequestData()
		{
			yield return (object)new WaitForSeconds(8f);
			if (!loaded)
			{
				RequestCanDataServerRpc();
			}
		}

		public IEnumerator SetValue()
		{
			yield return (object)new WaitForSeconds(3f);
			value = Random.Range(base.itemProperties.minValue, base.itemProperties.maxValue + 1);
			UpdateScrapValue();
		}

		public void UpdateScrapValue()
		{
			((GrabbableObject)this).SetScrapValue(value + cansHeld * 10);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			mls.LogMessage((object)("CansHeld: " + cansHeld));
			if (buttonDown && cansHeld > 0)
			{
				cansHeld--;
				UpdateCans();
				SendCansServerRpc(cansHeld);
				SpawnCanServerRpc();
			}
		}

		public void UpdateCans()
		{
			if (value != 0)
			{
				UpdateScrapValue();
			}
			cansHeld = Mathf.Clamp(cansHeld, 0, cans.Length);
			for (int i = 0; i < cans.Length; i++)
			{
				((Component)cans[i]).gameObject.SetActive(i < cansHeld);
			}
		}

		public IEnumerator waitForCanToSpawnOnClient(NetworkObjectReference netObjectRef, Vector3 vector)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			NetworkObject netObject = null;
			float startTime = Time.realtimeSinceStartup;
			while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref netObjectRef)).TryGet(ref netObject, (NetworkManager)null))
			{
				yield return (object)new WaitForSeconds(0.03f);
			}
			if ((Object)(object)netObject == (Object)null)
			{
				Debug.Log((object)"No network object found");
				yield break;
			}
			yield return (object)new WaitForEndOfFrame();
			GrabbableObject component = ((Component)netObject).GetComponent<GrabbableObject>();
			RoundManager instance = RoundManager.Instance;
			instance.totalScrapValueInLevel -= (float)base.scrapValue;
			RoundManager instance2 = RoundManager.Instance;
			instance2.totalScrapValueInLevel += (float)component.scrapValue;
			component.startFallingPosition = vector;
			component.fallTime = 0f;
			component.hasHitGround = false;
			component.reachedFloorTarget = false;
			if ((Object)(object)base.playerHeldBy != (Object)null && base.playerHeldBy.isInHangarShipRoom)
			{
				base.playerHeldBy.SetItemInElevator(true, true, component);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SendCansServerRpc(int cans)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2178516310u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, cans);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2178516310u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SendCansClientRpc(cans);
				}
			}
		}

		[ClientRpc]
		public void SendCansClientRpc(int cans)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3972762219u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, cans);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3972762219u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					mls.LogMessage((object)("SetCans was called AND went through with " + cans + " cans"));
					cansHeld = cans;
					UpdateCans();
					loaded = true;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnCanServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(336232444u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 336232444u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Transform val3 = ((((!((Object)(object)base.playerHeldBy != (Object)null) || !base.playerHeldBy.isInElevator) && !StartOfRound.Instance.inShipPhase) || !((Object)(object)RoundManager.Instance.spawnedScrapContainer != (Object)null)) ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.spawnedScrapContainer);
				Vector3 val4 = ((Component)this).transform.position + Vector3.up * 0.25f;
				GameObject val5 = Object.Instantiate<GameObject>(canPrefab, val4, Quaternion.identity, val3);
				GrabbableObject component = val5.GetComponent<GrabbableObject>();
				component.targetFloorPosition = component.GetItemFloorPosition(((Component)this).transform.position);
				if ((Object)(object)base.playerHeldBy != (Object)null && base.playerHeldBy.isInHangarShipRoom)
				{
					base.playerHeldBy.SetItemInElevator(true, true, component);
				}
				((NetworkBehaviour)component).NetworkObject.Spawn(false);
				SpawnCanClientRpc(NetworkObjectReference.op_Implicit(val5.GetComponent<NetworkObject>()), val4.x, val4.y, val4.z, cansHeld);
			}
		}

		[ClientRpc]
		public void SpawnCanClientRpc(NetworkObjectReference netObjectRef, float x, float y, float z, int cans)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1260893740u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref x, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref y, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref z, default(ForPrimitives));
					BytePacker.WriteValueBitPacked(val2, cans);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1260893740u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					cansHeld = cans;
					UpdateCans();
					((MonoBehaviour)this).StartCoroutine(waitForCanToSpawnOnClient(netObjectRef, new Vector3(x, y, z)));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RequestCanDataServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3319284306u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3319284306u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					RequestCanDataClientRpc();
				}
			}
		}

		[ClientRpc]
		public void RequestCanDataClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2097148857u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2097148857u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviour)this).IsServer)
				{
					SendCansServerRpc(cansHeld);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_DrinkCase()
		{
			//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
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2178516310u, new RpcReceiveHandler(__rpc_handler_2178516310));
			NetworkManager.__rpc_func_table.Add(3972762219u, new RpcReceiveHandler(__rpc_handler_3972762219));
			NetworkManager.__rpc_func_table.Add(336232444u, new RpcReceiveHandler(__rpc_handler_336232444));
			NetworkManager.__rpc_func_table.Add(1260893740u, new RpcReceiveHandler(__rpc_handler_1260893740));
			NetworkManager.__rpc_func_table.Add(3319284306u, new RpcReceiveHandler(__rpc_handler_3319284306));
			NetworkManager.__rpc_func_table.Add(2097148857u, new RpcReceiveHandler(__rpc_handler_2097148857));
		}

		private static void __rpc_handler_2178516310(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int num = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref num);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DrinkCase)(object)target).SendCansServerRpc(num);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3972762219(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int num = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref num);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((DrinkCase)(object)target).SendCansClientRpc(num);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_336232444(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DrinkCase)(object)target).SpawnCanServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1260893740(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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netObjectRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjectRef, default(ForNetworkSerializable));
				float x = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref x, default(ForPrimitives));
				float y = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref y, default(ForPrimitives));
				float z = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref z, default(ForPrimitives));
				int num = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref num);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((DrinkCase)(object)target).SpawnCanClientRpc(netObjectRef, x, y, z, num);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3319284306(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DrinkCase)(object)target).RequestCanDataServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2097148857(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((DrinkCase)(object)target).RequestCanDataClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "DrinkCase";
		}
	}
	public class LethalCan : GrabbableObject
	{
		public bool drinking;

		public float fill = 1f;

		public float duration = 20f;

		public float timeToDrink = 2f;

		public float timeToStart = 0.75f;

		public AudioSource audio;

		public Coroutine DrinkCoroutine;

		public PlayerControllerB previousPlayerHeldBy;

		public const string DrinkAnimation = "HoldMask";

		public static Item normalProp;

		public static Item storeProp;

		public static Vector3 normalPos;

		public static Vector3 normalRot;

		public static Item drinkingProp;

		public static Vector3 drinkingPos;

		public static Vector3 drinkingRot;

		private float animationLerp;

		private const int baseValue = 8;

		public const int emptyValue = 1;

		public static AudioClip drinkingSFX;

		public bool loaded = false;

		public bool store = false;

		public override void Start()
		{
			//IL_0044: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (!store)
			{
				((GrabbableObject)this).SetScrapValue(8);
			}
			if ((Object)(object)normalProp == (Object)null)
			{
				if (!store)
				{
					normalProp = base.itemProperties;
				}
				normalPos = base.itemProperties.positionOffset;
				normalRot = base.itemProperties.rotationOffset;
				drinkingPos = drinkingProp.positionOffset;
				drinkingRot = drinkingProp.rotationOffset;
			}
			((GrabbableObject)this).Start();
			base.fallTime = 1f;
			base.hasHitGround = true;
			audio = ((Component)this).GetComponent<AudioSource>();
			if (!((NetworkBehaviour)this).IsServer)
			{
				((MonoBehaviour)this).StartCoroutine(RequestData());
			}
		}

		public IEnumerator RequestData()
		{
			yield return (object)new WaitForSeconds(5f);
			if (!loaded)
			{
				RequestFillDataServerRpc();
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown)
			{
				base.isBeingUsed = true;
				if (fill <= 0f)
				{
					previousPlayerHeldBy.playerBodyAnimator.SetTrigger("shakeItem");
					return;
				}
				previousPlayerHeldBy.activatingItem = true;
				previousPlayerHeldBy.playerBodyAnimator.SetBool("HoldMask", true);
				previousPlayerHeldBy = base.playerHeldBy;
				DrinkCoroutine = ((MonoBehaviour)this).StartCoroutine((IEnumerator)StartDrink());
			}
			else
			{
				base.isBeingUsed = false;
				if (DrinkCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(DrinkCoroutine);
				}
				Stop();
			}
		}

		public override void Update()
		{
			//IL_0100: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (!base.isHeld || !((Object)(object)base.playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController))
			{
				return;
			}
			if (base.playerHeldBy.playerBodyAnimator.GetBool("HoldMask"))
			{
				animationLerp = Mathf.MoveTowards(animationLerp, 1f, Time.deltaTime * 3f / timeToStart);
			}
			else
			{
				animationLerp = Mathf.MoveTowards(animationLerp, 0f, Time.deltaTime * 3f / timeToStart);
			}
			animationLerp = Mathf.Clamp01(animationLerp);
			if (animationLerp > 0.1f)
			{
				ChangeItem(drinkingProp);
			}
			else
			{
				ChangeItem((!store) ? normalProp : storeProp);
			}
			if ((Object)(object)base.itemProperties == (Object)(object)drinkingProp)
			{
				drinkingProp.positionOffset = Vector3.Lerp(normalPos, drinkingPos, animationLerp);
				drinkingProp.rotationOffset = Vector3.Lerp(normalRot, drinkingRot, animationLerp);
			}
			if (drinking)
			{
				if ((Object)(object)previousPlayerHeldBy == (Object)null || !base.isHeld || fill <= 0f)
				{
					Stop();
					base.itemUsedUp = true;
				}
				fill -= Time.deltaTime / timeToDrink;
				PlayerPatches.Caffeine += Time.deltaTime / timeToDrink;
				PlayerPatches.Duration += duration * Time.deltaTime / timeToDrink;
			}
		}

		public void ChangeItem(Item to)
		{
			if ((Object)(object)base.itemProperties != (Object)(object)to)
			{
				base.itemProperties = to;
			}
		}

		private IEnumerator<WaitForSeconds> StartDrink()
		{
			yield return new WaitForSeconds(timeToStart);
			drinking = true;
			audio.PlayOneShot(drinkingSFX, 0.75f);
		}

		public IEnumerator<WaitForSeconds> CrushCan()
		{
			Vector3 origin = Vector3.one;
			Vector3 target = new Vector3(1f, 0.3f, 1f);
			float time = 0f;
			while (time < 1f)
			{
				((Component)this).transform.localScale = Vector3.Lerp(origin, target, time);
				time += Time.deltaTime * 4f;
				yield return null;
			}
			base.originalScale = target;
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				previousPlayerHeldBy = base.playerHeldBy;
			}
		}

		public override void DiscardItem()
		{
			animationLerp = 0f;
			if (DrinkCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(DrinkCoroutine);
			}
			Stop();
			SendFillServerRpc(fill);
			if ((Object)(object)previousPlayerHeldBy != (Object)null)
			{
				previousPlayerHeldBy.activatingItem = false;
			}
			((GrabbableObject)this).DiscardItem();
		}

		public void Stop()
		{
			drinking = false;
			previousPlayerHeldBy.activatingItem = false;
			audio.Stop();
			base.playerHeldBy.playerBodyAnimator.ResetTrigger("shakeItem");
			previousPlayerHeldBy.playerBodyAnimator.SetBool("HoldMask", false);
		}

		[ServerRpc(RequireOwnership = false)]
		public void SendFillServerRpc(float fill)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1564617918u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref fill, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1564617918u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SendFillClientRpc(fill);
				}
			}
		}

		[ClientRpc]
		public void SendFillClientRpc(float Fill)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3072911950u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref Fill, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3072911950u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				loaded = true;
				fill = Fill;
				if (fill <= 0f)
				{
					((GrabbableObject)this).SetScrapValue(1);
					base.itemUsedUp = true;
					((MonoBehaviour)this).StartCoroutine((IEnumerator)CrushCan());
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RequestFillDataServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2400585966u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2400585966u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					RequestFillDataClientRpc();
				}
			}
		}

		[ClientRpc]
		public void RequestFillDataClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3583883871u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3583883871u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviour)this).IsServer)
				{
					SendFillServerRpc(fill);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_LethalCan()
		{
			//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
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1564617918u, new RpcReceiveHandler(__rpc_handler_1564617918));
			NetworkManager.__rpc_func_table.Add(3072911950u, new RpcReceiveHandler(__rpc_handler_3072911950));
			NetworkManager.__rpc_func_table.Add(2400585966u, new RpcReceiveHandler(__rpc_handler_2400585966));
			NetworkManager.__rpc_func_table.Add(3583883871u, new RpcReceiveHandler(__rpc_handler_3583883871));
		}

		private static void __rpc_handler_1564617918(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float num = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((LethalCan)(object)target).SendFillServerRpc(num);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3072911950(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float num = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LethalCan)(object)target).SendFillClientRpc(num);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2400585966(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((LethalCan)(object)target).RequestFillDataServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3583883871(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LethalCan)(object)target).RequestFillDataClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "LethalCan";
		}
	}
	public static class PlayerPatches
	{
		public static float BaseSpeed;

		public static float Caffeine;

		public static float DecayRate = 5f;

		public static float Duration;

		public static bool warn;

		public static bool kill;

		public static float Boost = 0.25f;

		[HarmonyPatch(typeof(PlayerControllerB), "Start")]
		[HarmonyPostfix]
		public static void StartPatch(PlayerControllerB __instance)
		{
			BaseSpeed = __instance.movementSpeed;
			Caffeine = 0f;
			Duration = 0f;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		public static void UpdatePatch(PlayerControllerB __instance)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)(object)StartOfRound.Instance.localPlayerController)
			{
				return;
			}
			__instance.movementSpeed = BaseSpeed + BaseSpeed * Caffeine * Boost;
			if (Caffeine > 0f)
			{
				if (Duration > 0f)
				{
					Duration -= Time.deltaTime;
				}
				else
				{
					Caffeine -= Time.deltaTime / DecayRate;
				}
				if (Caffeine > 3f && !warn)
				{
					warn = true;
					__instance.DamagePlayer(10, true, true, (CauseOfDeath)8, 1, false, default(Vector3));
					HUDManager.Instance.DisplayTip("Warning", "High caffeine blood content", true, false, "LC_Tip1");
				}
				if (Caffeine > 4f && !kill)
				{
					kill = true;
					__instance.DamagePlayer(9999, true, true, (CauseOfDeath)8, 1, false, Vector3.up);
				}
				Caffeine = Mathf.Clamp(Caffeine, 0f, 5f);
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
		[HarmonyPostfix]
		public static void ResetCaffine(PlayerControllerB __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && __instance.health <= 0)
			{
				warn = false;
				kill = false;
				Caffeine = 0f;
				Duration = 0f;
			}
		}

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevelWait")]
		[HarmonyPostfix]
		public static void ResetCaffeine()
		{
			warn = false;
			kill = false;
			Caffeine = 0f;
			Duration = 0f;
		}
	}
	[BepInPlugin("Mellowdy.LethalEnergy", "LethalEnergy", "1.2.0")]
	public class LethalEnergyMod : BaseUnityPlugin
	{
		private const string modGUID = "Mellowdy.LethalEnergy";

		private const string modName = "LethalEnergy";

		private const string modVersion = "1.2.0";

		private readonly Harmony harmony = new Harmony("Mellowdy.LethalEnergy");

		public static ManualLogSource mls;

		private static LethalEnergyMod instance;

		public static AssetBundle assets;

		public static string assetName = "monster.energy";

		public static string canPrefabName = "monstercan.prefab";

		public static string casePrefabName = "monstercase.prefab";

		public static string drinkSoundName = "drinking.wav";

		public static string fridgePrefabName = "Fridge.prefab";

		public static string fridgeUnlockableName = "Unlockable.asset";

		public static int rarity = 30;

		private bool runonce = false;

		private void Awake()
		{
			if (!runonce)
			{
				RunNetcodePatcher();
			}
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("Mellowdy.LethalEnergy");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = Path.Combine(directoryName, assetName).Replace("\\", "/");
			assets = AssetBundle.LoadFromFile(text);
			GameObject val = assets.LoadAsset<GameObject>(casePrefabName);
			Item val2 = assets.LoadAsset<Item>("case.asset");
			val2.spawnPrefab = val;
			DrinkCase drinkCase = val.AddComponent<DrinkCase>();
			((GrabbableObject)drinkCase).itemProperties = val2;
			((GrabbableObject)drinkCase).grabbable = true;
			((GrabbableObject)drinkCase).useCooldown = 0.5f;
			Item val3 = assets.LoadAsset<Item>("Can.asset");
			GameObject canPrefab = (val3.spawnPrefab = GetCan(assets.LoadAsset<GameObject>(canPrefabName), val3));
			LethalCan.drinkingSFX = assets.LoadAsset<AudioClip>(drinkSoundName);
			LethalCan.drinkingProp = assets.LoadAsset<Item>("Drinking.asset");
			DrinkCase.canPrefab = canPrefab;
			Item val4 = assets.LoadAsset<Item>("BuyCan.asset");
			val4.spawnPrefab = GetCan(assets.LoadAsset<GameObject>("boughtcan.prefab"), val4);
			LethalCan.storeProp = val4;
			LethalCan component = val4.spawnPrefab.GetComponent<LethalCan>();
			component.store = true;
			int value = ((BaseUnityPlugin)this).Config.Bind<int>("Shop", "Can Price", 10, "Price for a can of monster in the shop").Value;
			GameObject val5 = assets.LoadAsset<GameObject>(fridgePrefabName);
			int value2 = ((BaseUnityPlugin)this).Config.Bind<int>("Shop", "Mini-fridge Price", 85, "Price for the mini-fridge").Value;
			bool value3 = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Mini-fridge is decor", true, "Decides if the fridge is considered décor that rotates every quota or a ship upgrade that is always available for purchase.").Value;
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val5);
			Items.RegisterItem(val4);
			Items.RegisterShopItem(val4, value);
			UnlockableItem val6 = assets.LoadAsset<UnlockablesList>(fridgeUnlockableName).unlockables[0];
			val6.alwaysInStock = !value3;
			Unlockables.RegisterUnlockable(val6, (StoreType)((!value3) ? 1 : 2), (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, value2);
			LevelTypes[] array = new LevelTypes[8];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			LevelTypes[] array2 = (LevelTypes[])(object)array;
			int[] array3 = new int[8] { 0, 10, 8, 10, 5, 2, 15, 20 };
			rarity = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "Base Rarity", 20, "Rarity for all moons not otherwise listed").Value;
			for (int i = 0; i < array2.Length; i++)
			{
				string text2 = ((object)(LevelTypes)(ref array2[i])).ToString().Replace("Level", "");
				array3[i] = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", text2 ?? "", array3[i], "Rarity for " + text2).Value;
				Items.RegisterScrap(val2, array3[i], array2[i]);
			}
			Items.RegisterScrap(val3, 0, (LevelTypes)1, (string[])null);
			Items.RegisterScrap(val2, rarity, (LevelTypes)1024);
			harmony.PatchAll();
			harmony.PatchAll(typeof(PlayerPatches));
			mls.LogInfo((object)"LethalEnergy has been loaded");
		}

		public static GameObject GetCan(GameObject g, Item itemProp)
		{
			LethalCan lethalCan = g.AddComponent<LethalCan>();
			((GrabbableObject)lethalCan).itemProperties = itemProp;
			((GrabbableObject)lethalCan).grabbable = true;
			return g;
		}

		public void RunNetcodePatcher()
		{
			runonce = true;
			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);
					}
				}
			}
		}
	}
}
namespace LC_LethalEnergy.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}