Decompiled source of EnhancedLockpicker v1.1.8

EnhancedLockpicker.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EnhancedLockpicker.NetcodePatcher;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EnhancedLockpicker")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Mod for Lethal Company, that enhance Lockpicker")]
[assembly: AssemblyFileVersion("1.1.8.0")]
[assembly: AssemblyInformationalVersion("1.1.8+768e2c3761a5b4221713377521053baeb0031148")]
[assembly: AssemblyProduct("EnhancedLockpicker")]
[assembly: AssemblyTitle("EnhancedLockpicker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.8.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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;
		}
	}
}
namespace EnhancedLockpicker
{
	public class Config
	{
		public static ConfigEntry<bool> doorLPEnabled;

		public static ConfigEntry<float> doorLPTime;

		public static ConfigEntry<bool> doorLockLPEnabled;

		public static void Load()
		{
			doorLPEnabled = Plugin.config.Bind<bool>("Door", "DoorLPEnabled", true, "Will Lockpicker have custom time for unlocking door?\n[All Client]");
			doorLPTime = Plugin.config.Bind<float>("Door", "DoorLPTime", 10f, "How long will it take for Lockpicker to open door.\nVanilla value 30. Suggested values between 1-60.");
			doorLockLPEnabled = Plugin.config.Bind<bool>("Door", "DoorLockLPEnabled", true, "Will Lockpicker being able to jam a door lock (locking door)?\n[All Client]");
		}
	}
	public class EnhancedLockpickerComp : NetworkBehaviour
	{
		private LockPicker LP;

		public bool isLocking;

		private AudioSource lockPickerAudio;

		private Coroutine setRotationCoroutine;

		public void Start()
		{
			LP = ((Component)this).gameObject.GetComponent<LockPicker>();
			lockPickerAudio = ((Component)LP).gameObject.GetComponent<AudioSource>();
		}

		public void PlaceLockPicker(DoorLock doorScript, bool lockPicker1)
		{
			if (!LP.isOnDoor)
			{
				((Component)this).gameObject.GetComponent<AudioSource>().PlayOneShot(LP.placeLockPickerClips[Random.Range(0, LP.placeLockPickerClips.Length)]);
				LP.armsAnimator.SetBool("mounted", true);
				LP.armsAnimator.SetBool("picking", true);
				lockPickerAudio.Play();
				lockPickerAudio.pitch = Random.Range(0.94f, 1.06f);
				LP.isOnDoor = true;
				isLocking = true;
				doorScript.isPickingLock = true;
				((Component)doorScript).gameObject.GetComponent<InteractTrigger>().interactable = false;
				LP.currentlyPickingDoor = doorScript;
				if (setRotationCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(setRotationCoroutine);
				}
				setRotationCoroutine = ((MonoBehaviour)this).StartCoroutine(setRotationOnDoor(doorScript, lockPicker1));
			}
		}

		private IEnumerator setRotationOnDoor(DoorLock doorScript, bool lockPicker1)
		{
			float startTime = Time.timeSinceLevelLoad;
			yield return (object)new WaitUntil((Func<bool>)(() => !((GrabbableObject)LP).isHeld || Time.timeSinceLevelLoad - startTime > 10f));
			if (lockPicker1)
			{
				((Component)LP).transform.localEulerAngles = doorScript.lockPickerPosition.localEulerAngles;
			}
			else
			{
				((Component)LP).transform.localEulerAngles = doorScript.lockPickerPosition2.localEulerAngles;
			}
			setRotationCoroutine = null;
		}

		public void Update()
		{
			if (isLocking && (Object)(object)LP.currentlyPickingDoor != (Object)null && (LP.currentlyPickingDoor.isLocked || HarmonyPatches.GetDoorOpened(LP.currentlyPickingDoor)))
			{
				EnhancedLockpickerNetworkHandler.instance.FinishPickingRpc(this);
			}
		}

		public void FinishPickingLock()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (isLocking)
			{
				RetractClaws();
				LP.currentlyPickingDoor = null;
				Vector3 position = ((Component)this).transform.position;
				((Component)this).transform.SetParent((Transform)null);
				((GrabbableObject)LP).startFallingPosition = position;
				((GrabbableObject)LP).FallToGround(false, false, default(Vector3));
				lockPickerAudio.PlayOneShot(LP.finishPickingLockClips[Random.Range(0, LP.finishPickingLockClips.Length)]);
			}
		}

		private void RetractClaws()
		{
			LP.isOnDoor = false;
			isLocking = false;
			LP.armsAnimator.SetBool("mounted", false);
			LP.armsAnimator.SetBool("picking", false);
			if ((Object)(object)LP.currentlyPickingDoor != (Object)null)
			{
				LP.currentlyPickingDoor.isPickingLock = false;
				LP.currentlyPickingDoor.lockPickTimeLeft = LP.currentlyPickingDoor.maxTimeLeft;
				LP.currentlyPickingDoor = null;
			}
			lockPickerAudio.Stop();
		}

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

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

		protected internal override string __getTypeName()
		{
			return "EnhancedLockpickerComp";
		}
	}
	public class EnhancedLockpickerNetworkHandler : NetworkBehaviour
	{
		public static EnhancedLockpickerNetworkHandler instance;

		private void Awake()
		{
			instance = this;
		}

		public void PlaceLockPickerRpc(EnhancedLockpickerComp eLockpicker, DoorLock doorScript, bool lockPicker1)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				PlaceLockPickerClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)eLockpicker).NetworkObject), NetworkObjectReference.op_Implicit(((NetworkBehaviour)doorScript).NetworkObject), lockPicker1);
			}
			else
			{
				PlaceLockPickerServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)eLockpicker).NetworkObject), NetworkObjectReference.op_Implicit(((NetworkBehaviour)doorScript).NetworkObject), lockPicker1);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlaceLockPickerServerRpc(NetworkObjectReference eLockpickerObject, NetworkObjectReference doorObject, bool lockPicker1)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00cd: 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_0118: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2855908607u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref eLockpickerObject, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref doorObject, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lockPicker1, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2855908607u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					PlaceLockPickerClientRpc(eLockpickerObject, doorObject, lockPicker1);
				}
			}
		}

		[ClientRpc]
		public void PlaceLockPickerClientRpc(NetworkObjectReference eLockpickerObject, NetworkObjectReference doorObject, bool lockPicker1)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00cd: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(825027714u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref eLockpickerObject, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref doorObject, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lockPicker1, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 825027714u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				NetworkObject val4 = default(NetworkObject);
				if (((NetworkObjectReference)(ref doorObject)).TryGet(ref val3, (NetworkManager)null) && ((NetworkObjectReference)(ref eLockpickerObject)).TryGet(ref val4, (NetworkManager)null))
				{
					DoorLock componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<DoorLock>();
					((Component)val4).gameObject.GetComponent<EnhancedLockpickerComp>().PlaceLockPicker(componentInChildren, lockPicker1);
				}
			}
		}

		public void FinishPickingRpc(EnhancedLockpickerComp eLockpicker)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				FinishPickingClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)eLockpicker).NetworkObject));
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void FinishPickingServerRpc(NetworkObjectReference eLockpickerObject)
		{
			//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)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(526280992u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref eLockpickerObject, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 526280992u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					FinishPickingClientRpc(eLockpickerObject);
				}
			}
		}

		[ClientRpc]
		public void FinishPickingClientRpc(NetworkObjectReference eLockpickerObject)
		{
			//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)
			//IL_00dc: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3504707913u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref eLockpickerObject, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3504707913u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				if (((NetworkObjectReference)(ref eLockpickerObject)).TryGet(ref val3, (NetworkManager)null))
				{
					((Component)val3).gameObject.GetComponent<EnhancedLockpickerComp>().FinishPickingLock();
				}
			}
		}

		public void LockDoorRpc(DoorLock doorLock)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				LockDoorClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)doorLock).NetworkObject));
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void LockDoorServerRpc(NetworkObjectReference doorLockObject)
		{
			//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)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2847268390u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref doorLockObject, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2847268390u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					LockDoorClientRpc(doorLockObject);
				}
			}
		}

		[ClientRpc]
		public void LockDoorClientRpc(NetworkObjectReference doorLockObject)
		{
			//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)
			//IL_00dc: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1298059785u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref doorLockObject, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1298059785u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				if (((NetworkObjectReference)(ref doorLockObject)).TryGet(ref val3, (NetworkManager)null))
				{
					((Component)val3).gameObject.GetComponentInChildren<DoorLock>().LockDoor(30f);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2855908607u, new RpcReceiveHandler(__rpc_handler_2855908607), "PlaceLockPickerServerRpc");
			((NetworkBehaviour)this).__registerRpc(825027714u, new RpcReceiveHandler(__rpc_handler_825027714), "PlaceLockPickerClientRpc");
			((NetworkBehaviour)this).__registerRpc(526280992u, new RpcReceiveHandler(__rpc_handler_526280992), "FinishPickingServerRpc");
			((NetworkBehaviour)this).__registerRpc(3504707913u, new RpcReceiveHandler(__rpc_handler_3504707913), "FinishPickingClientRpc");
			((NetworkBehaviour)this).__registerRpc(2847268390u, new RpcReceiveHandler(__rpc_handler_2847268390), "LockDoorServerRpc");
			((NetworkBehaviour)this).__registerRpc(1298059785u, new RpcReceiveHandler(__rpc_handler_1298059785), "LockDoorClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2855908607(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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference eLockpickerObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref eLockpickerObject, default(ForNetworkSerializable));
				NetworkObjectReference doorObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref doorObject, default(ForNetworkSerializable));
				bool lockPicker = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lockPicker, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((EnhancedLockpickerNetworkHandler)(object)target).PlaceLockPickerServerRpc(eLockpickerObject, doorObject, lockPicker);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_825027714(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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference eLockpickerObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref eLockpickerObject, default(ForNetworkSerializable));
				NetworkObjectReference doorObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref doorObject, default(ForNetworkSerializable));
				bool lockPicker = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lockPicker, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((EnhancedLockpickerNetworkHandler)(object)target).PlaceLockPickerClientRpc(eLockpickerObject, doorObject, lockPicker);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_526280992(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_004f: 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)
			{
				NetworkObjectReference eLockpickerObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref eLockpickerObject, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((EnhancedLockpickerNetworkHandler)(object)target).FinishPickingServerRpc(eLockpickerObject);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3504707913(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_004f: 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)
			{
				NetworkObjectReference eLockpickerObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref eLockpickerObject, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((EnhancedLockpickerNetworkHandler)(object)target).FinishPickingClientRpc(eLockpickerObject);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2847268390(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_004f: 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)
			{
				NetworkObjectReference doorLockObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref doorLockObject, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((EnhancedLockpickerNetworkHandler)(object)target).LockDoorServerRpc(doorLockObject);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1298059785(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_004f: 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)
			{
				NetworkObjectReference doorLockObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref doorLockObject, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((EnhancedLockpickerNetworkHandler)(object)target).LockDoorClientRpc(doorLockObject);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "EnhancedLockpickerNetworkHandler";
		}
	}
	public class HarmonyPatches
	{
		private static readonly Type patchType;

		private static FieldInfo RayHit;

		private static FieldInfo DoorTrigger;

		static HarmonyPatches()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Expected O, but got Unknown
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Expected O, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			RayHit = typeof(LockPicker).GetField("hit", BindingFlags.Instance | BindingFlags.NonPublic);
			DoorTrigger = typeof(DoorLock).GetField("doorTrigger", BindingFlags.Instance | BindingFlags.Public);
			patchType = typeof(HarmonyPatches);
			Harmony val = new Harmony("LethalCompany.MrHydralisk.EnhancedLockpicker");
			ConfigEntry<bool> doorLPEnabled = Config.doorLPEnabled;
			if (doorLPEnabled == null || doorLPEnabled.Value)
			{
				val.Patch((MethodBase)AccessTools.Method(typeof(DoorLock), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(patchType, "DL_Awake_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				val.Patch((MethodBase)AccessTools.Method(typeof(DoorLock), "LockDoor", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(patchType, "DL_LockDoor_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			}
			val.Patch((MethodBase)AccessTools.Method(typeof(GameNetworkManager), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(patchType, "GNM_Start_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)AccessTools.Method(typeof(StartOfRound), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(patchType, "SOR_Start_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			ConfigEntry<bool> doorLockLPEnabled = Config.doorLockLPEnabled;
			if (doorLockLPEnabled == null || doorLockLPEnabled.Value)
			{
				val.Patch((MethodBase)AccessTools.Method(typeof(LockPicker), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(patchType, "LP_Start_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				val.Patch((MethodBase)AccessTools.Method(typeof(LockPicker), "ItemActivate", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(patchType, "LP_ItemActivate_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				val.Patch((MethodBase)AccessTools.Method(typeof(LockPicker), "RetractClaws", (Type[])null, (Type[])null), new HarmonyMethod(patchType, "LP_RetractClaws_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				val.Patch((MethodBase)AccessTools.Method(typeof(DoorLock), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(patchType, "DL_Update_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		public static void DL_Awake_Postfix(DoorLock __instance)
		{
			__instance.maxTimeLeft = Config.doorLPTime?.Value ?? 60f;
			__instance.lockPickTimeLeft = __instance.maxTimeLeft;
		}

		public static float ChangeLockDoorTimeToLockPick(float timeToLockPick)
		{
			return Config.doorLPTime?.Value ?? timeToLockPick;
		}

		public static IEnumerable<CodeInstruction> DL_LockDoor_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			list.Insert(list.FindIndex((CodeInstruction cd) => ((object)cd).ToString().Contains("timeToHold")), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(HarmonyPatches), "ChangeLockDoorTimeToLockPick", (Type[])null, (Type[])null)));
			return list.AsEnumerable();
		}

		public static void GNM_Start_Postfix(GameNetworkManager __instance)
		{
			((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Plugin.instance.enhancedLockpickerNetworkManager);
		}

		public static void SOR_Start_Postfix(StartOfRound __instance)
		{
			if (((NetworkBehaviour)__instance).IsHost)
			{
				Object.Instantiate<GameObject>(Plugin.instance.enhancedLockpickerNetworkManager).GetComponent<NetworkObject>().Spawn(true);
			}
		}

		public static void LP_Start_Postfix(LockPicker __instance)
		{
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<EnhancedLockpickerComp>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<EnhancedLockpickerComp>().Start();
			}
		}

		public static void LP_ItemActivate_Postfix(LockPicker __instance, bool used, bool buttonDown = true)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = (RaycastHit)RayHit.GetValue(__instance);
			EnhancedLockpickerComp component = ((Component)__instance).gameObject.GetComponent<EnhancedLockpickerComp>();
			if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null || ((object)(RaycastHit)(ref val)).Equals((object)default(RaycastHit)) || (Object)(object)((RaycastHit)(ref val)).transform.parent == (Object)null)
			{
				return;
			}
			DoorLock component2 = ((Component)((RaycastHit)(ref val)).transform).GetComponent<DoorLock>();
			if (!((Object)(object)component2 != (Object)null) || component2.isLocked)
			{
				return;
			}
			NavMeshObstacle component3 = ((Component)component2).GetComponent<NavMeshObstacle>();
			if (component3 != null && ((Behaviour)component3).enabled)
			{
				bool flag = true;
				Vector3 localPosition;
				if (Vector3.Distance(component2.lockPickerPosition.position, ((Component)((GrabbableObject)__instance).playerHeldBy).transform.position) < Vector3.Distance(component2.lockPickerPosition2.position, ((Component)((GrabbableObject)__instance).playerHeldBy).transform.position))
				{
					flag = true;
					localPosition = component2.lockPickerPosition.localPosition;
				}
				else
				{
					flag = false;
					localPosition = component2.lockPickerPosition2.localPosition;
				}
				((GrabbableObject)__instance).playerHeldBy.DiscardHeldObject(true, ((NetworkBehaviour)component2).NetworkObject, localPosition, true);
				EnhancedLockpickerNetworkHandler.instance.PlaceLockPickerRpc(component, component2, flag);
			}
		}

		public static void LP_RetractClaws_Prefix(LockPicker __instance)
		{
			EnhancedLockpickerComp component = ((Component)__instance).gameObject.GetComponent<EnhancedLockpickerComp>();
			if (component.isLocking)
			{
				component.isLocking = false;
				((Component)__instance.currentlyPickingDoor).gameObject.GetComponent<InteractTrigger>().interactable = true;
			}
		}

		public static bool GetDoorOpened(DoorLock doorScript)
		{
			return (bool)typeof(DoorLock).GetField("isDoorOpened", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(doorScript);
		}

		public static void DL_Update_Postfix(DoorLock __instance)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			if (__instance.isLocked || !__instance.isPickingLock)
			{
				return;
			}
			bool doorOpened = GetDoorOpened(__instance);
			if (doorOpened)
			{
				__instance.lockPickTimeLeft = -1f;
			}
			InteractTrigger val = (InteractTrigger)DoorTrigger.GetValue(__instance);
			__instance.lockPickTimeLeft -= Time.deltaTime;
			val.disabledHoverTip = $"Jamming lock: {(int)__instance.lockPickTimeLeft} sec.";
			if (__instance.lockPickTimeLeft < 0f)
			{
				if (!doorOpened)
				{
					EnhancedLockpickerNetworkHandler.instance.LockDoorRpc(__instance);
					return;
				}
				val.interactable = true;
				__instance.UnlockDoorServerRpc();
			}
		}
	}
	[BepInPlugin("MrHydralisk.EnhancedLockpicker", "Enhanced Lockpicker", "1.1.8")]
	public class Plugin : BaseUnityPlugin
	{
		private const string MOD_GUID = "MrHydralisk.EnhancedLockpicker";

		private const string MOD_NAME = "Enhanced Lockpicker";

		public static Plugin instance;

		public static ManualLogSource MLogS;

		public static ConfigFile config;

		public GameObject enhancedLockpickerNetworkManager;

		private void Awake()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			MLogS = Logger.CreateLogSource("MrHydralisk.EnhancedLockpicker");
			config = ((BaseUnityPlugin)this).Config;
			Config.Load();
			instance = this;
			try
			{
				RuntimeHelpers.RunClassConstructor(typeof(HarmonyPatches).TypeHandle);
			}
			catch (Exception ex)
			{
				MLogS.LogError((object)string.Concat("Error in static constructor of ", typeof(HarmonyPatches), ": ", ex));
			}
			LoadBundle();
			MLogS.LogInfo((object)"Plugin is loaded!");
		}

		private void LoadBundle()
		{
			AssetBundle val = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnhancedLockpicker.Assets.enhancedlockpicker"));
			enhancedLockpickerNetworkManager = val.LoadAsset<GameObject>("Assets/Mods/EnhancedLockpicker/EnhancedLockpickerNetworkManager.prefab");
			enhancedLockpickerNetworkManager.AddComponent<EnhancedLockpickerNetworkHandler>();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "EnhancedLockpicker";

		public const string PLUGIN_NAME = "EnhancedLockpicker";

		public const string PLUGIN_VERSION = "1.1.8";
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace EnhancedLockpicker.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}