Decompiled source of mod3 Modpack v1.1.0

plugins/backrooms/Backrooms.dll

Decompiled 7 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using DunGen.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.AI.Navigation;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>();
	}
}
[RequireComponent(typeof(SphereCollider))]
public class KillBox : MonoBehaviour
{
	private void OnTriggerEnter(Collider other)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
		if ((Object)(object)component != (Object)null)
		{
			component.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0);
		}
	}
}
public class LightFlickerEffect : MonoBehaviour
{
	[Tooltip("External light to flicker; you can leave this null if you attach script to a light")]
	public Light light;

	[Tooltip("Minimum random light intensity")]
	public float minIntensity;

	[Tooltip("Maximum random light intensity")]
	public float maxIntensity = 1f;

	[Tooltip("How much to smooth out the randomness; lower values = sparks, higher = lantern")]
	[Range(1f, 50f)]
	public int smoothing = 5;

	private Queue<float> smoothQueue;

	private float lastSum;

	public void Reset()
	{
		smoothQueue.Clear();
		lastSum = 0f;
	}

	private void Start()
	{
		smoothQueue = new Queue<float>(smoothing);
		if ((Object)(object)light == (Object)null)
		{
			light = ((Component)this).GetComponent<Light>();
		}
	}

	private void Update()
	{
		if (!((Object)(object)light == (Object)null))
		{
			while (smoothQueue.Count >= smoothing)
			{
				lastSum -= smoothQueue.Dequeue();
			}
			float num = Random.Range(minIntensity, maxIntensity);
			smoothQueue.Enqueue(num);
			lastSum += num;
			light.intensity = lastSum / (float)smoothQueue.Count;
		}
	}
}
public class LookAtPlayer : MonoBehaviour
{
	private void Update()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).gameObject.transform.LookAt(((Component)GameNetworkManager.Instance.localPlayerController).transform.position + Vector3.up);
	}
}
public class SpawnPosition : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}
}
[CompilerGenerated]
[EditorBrowsable(EditorBrowsableState.Never)]
[GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)]
internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
{
	private struct MonoScriptData
	{
		public byte[] FilePathsData;

		public byte[] TypesData;

		public int TotalTypes;

		public int TotalFiles;

		public bool IsEditorOnly;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static MonoScriptData Get()
	{
		MonoScriptData result = default(MonoScriptData);
		result.FilePathsData = new byte[506]
		{
			0, 0, 0, 1, 0, 0, 0, 42, 92, 65,
			115, 115, 101, 116, 115, 92, 66, 97, 99, 107,
			114, 111, 111, 109, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 65, 114, 101, 89, 111, 117,
			87, 97, 116, 99, 104, 101, 100, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 38, 92, 65,
			115, 115, 101, 116, 115, 92, 66, 97, 99, 107,
			114, 111, 111, 109, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 66, 97, 99, 107, 114, 111,
			111, 109, 115, 46, 99, 115, 0, 0, 0, 1,
			0, 0, 0, 33, 92, 65, 115, 115, 101, 116,
			115, 92, 66, 97, 99, 107, 114, 111, 111, 109,
			115, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			69, 120, 105, 116, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 33, 92, 65, 115, 115, 101,
			116, 115, 92, 66, 97, 99, 107, 114, 111, 111,
			109, 115, 92, 83, 99, 114, 105, 112, 116, 115,
			92, 72, 111, 111, 107, 46, 99, 115, 0, 0,
			0, 1, 0, 0, 0, 36, 92, 65, 115, 115,
			101, 116, 115, 92, 66, 97, 99, 107, 114, 111,
			111, 109, 115, 92, 83, 99, 114, 105, 112, 116,
			115, 92, 75, 105, 108, 108, 66, 111, 120, 46,
			99, 115, 0, 0, 0, 1, 0, 0, 0, 47,
			92, 65, 115, 115, 101, 116, 115, 92, 66, 97,
			99, 107, 114, 111, 111, 109, 115, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 76, 105, 103, 104,
			116, 70, 108, 105, 99, 107, 101, 114, 69, 102,
			102, 101, 99, 116, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 35, 92, 65, 115, 115, 101,
			116, 115, 92, 66, 97, 99, 107, 114, 111, 111,
			109, 115, 92, 83, 99, 114, 105, 112, 116, 115,
			92, 76, 111, 97, 100, 101, 114, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 41, 92, 65,
			115, 115, 101, 116, 115, 92, 66, 97, 99, 107,
			114, 111, 111, 109, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 76, 111, 111, 107, 65, 116,
			80, 108, 97, 121, 101, 114, 46, 99, 115, 0,
			0, 0, 1, 0, 0, 0, 36, 92, 65, 115,
			115, 101, 116, 115, 92, 66, 97, 99, 107, 114,
			111, 111, 109, 115, 92, 83, 99, 114, 105, 112,
			116, 115, 92, 83, 107, 105, 98, 105, 100, 105,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			35, 92, 65, 115, 115, 101, 116, 115, 92, 66,
			97, 99, 107, 114, 111, 111, 109, 115, 92, 83,
			99, 114, 105, 112, 116, 115, 92, 83, 109, 105,
			108, 101, 114, 46, 99, 115, 0, 0, 0, 1,
			0, 0, 0, 42, 92, 65, 115, 115, 101, 116,
			115, 92, 66, 97, 99, 107, 114, 111, 111, 109,
			115, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			83, 112, 97, 119, 110, 80, 111, 115, 105, 116,
			105, 111, 110, 46, 99, 115
		};
		result.TypesData = new byte[233]
		{
			0, 0, 0, 0, 25, 66, 97, 99, 107, 114,
			111, 111, 109, 115, 124, 66, 97, 99, 107, 114,
			111, 111, 109, 115, 72, 101, 108, 112, 101, 114,
			0, 0, 0, 0, 19, 66, 97, 99, 107, 114,
			111, 111, 109, 115, 124, 66, 97, 99, 107, 114,
			111, 111, 109, 115, 0, 0, 0, 0, 14, 66,
			97, 99, 107, 114, 111, 111, 109, 115, 124, 69,
			120, 105, 116, 0, 0, 0, 0, 14, 66, 97,
			99, 107, 114, 111, 111, 109, 115, 124, 72, 111,
			111, 107, 0, 0, 0, 0, 8, 124, 75, 105,
			108, 108, 66, 111, 120, 0, 0, 0, 0, 19,
			124, 76, 105, 103, 104, 116, 70, 108, 105, 99,
			107, 101, 114, 69, 102, 102, 101, 99, 116, 0,
			0, 0, 0, 16, 66, 97, 99, 107, 114, 111,
			111, 109, 115, 124, 76, 111, 97, 100, 101, 114,
			0, 0, 0, 0, 13, 124, 76, 111, 111, 107,
			65, 116, 80, 108, 97, 121, 101, 114, 0, 0,
			0, 0, 20, 66, 97, 99, 107, 114, 111, 111,
			109, 115, 124, 83, 111, 117, 110, 100, 80, 97,
			116, 99, 104, 0, 0, 0, 0, 16, 66, 97,
			99, 107, 114, 111, 111, 109, 115, 124, 83, 109,
			105, 108, 101, 114, 0, 0, 0, 0, 14, 124,
			83, 112, 97, 119, 110, 80, 111, 115, 105, 116,
			105, 111, 110
		};
		result.TotalFiles = 11;
		result.TotalTypes = 11;
		result.IsEditorOnly = false;
		return result;
	}
}
namespace Backrooms;

public class BackroomsHelper : MonoBehaviour
{
	public bool HasBeenInTheBackrooms;

	private void Start()
	{
	}

	private void Update()
	{
	}
}
public class Backrooms : NetworkBehaviour
{
	public static Backrooms Instance;

	public GameObject Floor;

	public GameObject Wall;

	public GameObject Ceiling;

	public GameObject LightlessCeiling;

	public GameObject Pillar;

	public GameObject Room;

	public static float Offset = -500f;

	private int Width = 30;

	private int Height = 30;

	public List<Vector2> PossibleSpawnPoint;

	public List<PlayerControllerB> playerInBackrooms;

	public NetworkVariable<float> SharedOdds = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

	private float initialValue;

	public DungeonFlow Flow;

	public GameObject Child;

	public override void OnNetworkSpawn()
	{
		if (((NetworkBehaviour)this).IsServer)
		{
			initialValue = Loader.TeleportationOdds.Value;
			SharedOdds.Value = initialValue;
			((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback += NetworkManager_OnClientConnectedCallback;
			return;
		}
		if (SharedOdds.Value != initialValue)
		{
			Debug.LogWarning((object)($"NetworkVariable was {SharedOdds.Value} upon being spawned" + $" when it should have been {initialValue}"));
		}
		else
		{
			Debug.Log((object)$"NetworkVariable is {SharedOdds.Value} when spawned.");
		}
		NetworkVariable<float> sharedOdds = SharedOdds;
		sharedOdds.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Combine((Delegate?)(object)sharedOdds.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<float>(OnSomeValueChanged));
	}

	private void NetworkManager_OnClientConnectedCallback(ulong obj)
	{
		StartChangingNetworkVariable();
	}

	private void OnSomeValueChanged(float previous, float current)
	{
		Debug.Log((object)$"Detected NetworkVariable Change: Previous: {previous} | Current: {current}");
	}

	private void StartChangingNetworkVariable()
	{
		((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback -= NetworkManager_OnClientConnectedCallback;
	}

	private void Awake()
	{
		PossibleSpawnPoint = new List<Vector2>();
		playerInBackrooms = new List<PlayerControllerB>();
	}

	private void Start()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
	}

	private IEnumerator Teleport()
	{
		yield return (object)new WaitForSeconds(10f);
		for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
		{
			if (StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled)
			{
				TeleportToBackroomsClientRpc(i);
			}
		}
	}

	public void ServerGenerate()
	{
		int seed = Random.Range(0, 1000000);
		GenerateClientRpc(seed);
	}

	public void ServerClean()
	{
		Smiler[] array = Object.FindObjectsOfType<Smiler>();
		for (int i = 0; i < array.Length; i++)
		{
			((Component)array[i]).GetComponent<NetworkObject>().Despawn(true);
		}
		playerInBackrooms.Clear();
		CleanBackroomsClientRpc();
	}

	[ClientRpc]
	public void CleanBackroomsClientRpc()
	{
		//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_00cf: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2180494496u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2180494496u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
		{
			return;
		}
		foreach (Transform item in ((Component)this).transform)
		{
			Object.Destroy((Object)(object)((Component)item).gameObject);
		}
		PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
		for (int i = 0; i < allPlayerScripts.Length; i++)
		{
			((Component)allPlayerScripts[i]).GetComponent<BackroomsHelper>().HasBeenInTheBackrooms = false;
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void TeleportToBackroomsServerRpc(int client)
	{
		//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2541916904u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, client);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2541916904u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				TeleportToBackroomsClientRpc(client);
			}
		}
	}

	[ClientRpc]
	public void TeleportToBackroomsClientRpc(int client)
	{
		//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)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3078584200u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, client);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3078584200u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[client];
			Random.InitState(client);
			Vector2 val4 = PossibleSpawnPoint[Random.Range(0, PossibleSpawnPoint.Count)];
			val3.TeleportPlayer(new Vector3(val4.x, Offset, val4.y), false, 0f, false, true);
			val3.isInsideFactory = true;
			val3.ResetFallGravity();
			((Component)val3).GetComponent<BackroomsHelper>().HasBeenInTheBackrooms = true;
			if (((NetworkBehaviour)this).IsServer)
			{
				playerInBackrooms.Add(val3);
			}
		}
	}

	[ClientRpc]
	public void TeleportOutOfBackroomsClientRpc(int client)
	{
		//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)
		//IL_00e1: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1623403188u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, client);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1623403188u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB obj = StartOfRound.Instance.allPlayerScripts[client];
				obj.TeleportPlayer(StartOfRound.Instance.playerSpawnPositions[0].position, false, 0f, false, true);
				obj.isInsideFactory = false;
			}
		}
	}

	[ClientRpc]
	public void GenerateClientRpc(int seed)
	{
		//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)
		//IL_0120: 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)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		//IL_0345: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0387: Unknown result type (might be due to invalid IL or missing references)
		//IL_0545: Unknown result type (might be due to invalid IL or missing references)
		//IL_054a: Unknown result type (might be due to invalid IL or missing references)
		//IL_054d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0559: Unknown result type (might be due to invalid IL or missing references)
		//IL_0560: Unknown result type (might be due to invalid IL or missing references)
		//IL_0565: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_049a: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0417: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(890432861u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, seed);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 890432861u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
		{
			return;
		}
		PossibleSpawnPoint.Clear();
		playerInBackrooms.Clear();
		Random random = new Random(seed);
		Debug.Log((object)"Generate floor and ceiling");
		for (int i = -Width / 2; i < Width / 2; i++)
		{
			for (int j = -Height / 2; j < Height / 2; j++)
			{
				Object.Instantiate<GameObject>(Floor, new Vector3((float)(i * 6), Offset, (float)(j * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform);
				if (random.Next(100) < 85)
				{
					Object.Instantiate<GameObject>(LightlessCeiling, new Vector3((float)(i * 6), Offset + 5f, (float)(j * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform);
				}
				else
				{
					Object.Instantiate<GameObject>(Ceiling, new Vector3((float)(i * 6), Offset + 5f, (float)(j * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform);
				}
			}
		}
		Debug.Log((object)"Generate walls");
		for (int k = -Width / 2; k < Width / 2; k++)
		{
			Object.Instantiate<GameObject>(Wall, new Vector3((float)(-Width / 2 * 6 - 3), Offset, (float)(k * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform);
			if (k != 0)
			{
				Object.Instantiate<GameObject>(Wall, new Vector3((float)(Width / 2 * 6 - 3), Offset, (float)(k * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform);
				continue;
			}
			Debug.Log((object)"Generate room");
			Object.Instantiate<GameObject>(Room, new Vector3((float)(Width / 2 * 6 - 3), Offset, (float)(k * 6)), Quaternion.Euler(0f, 90f, 0f), ((Component)this).transform);
		}
		Debug.Log((object)"Generate walls 2");
		for (int l = -Width / 2; l < Width / 2; l++)
		{
			Object.Instantiate<GameObject>(Wall, new Vector3((float)(l * 6), Offset, (float)(-Height / 2 * 6 - 3)), Quaternion.Euler(-90f, 90f, 0f), ((Component)this).transform);
			Object.Instantiate<GameObject>(Wall, new Vector3((float)(l * 6), Offset, (float)(Height / 2 * 6 - 3)), Quaternion.Euler(-90f, 90f, 0f), ((Component)this).transform);
		}
		Debug.Log((object)"Generate inside 2");
		for (int m = -Width / 2; m < Width / 2; m++)
		{
			for (int n = -Height / 2; n < Height / 2; n++)
			{
				if (m == 0 && n == 0)
				{
					continue;
				}
				int num = random.Next(20);
				if (num < 15)
				{
					if (random.Next(10) < 5)
					{
						Object.Instantiate<GameObject>(Wall, new Vector3((float)(m * 6 - 3), Offset, (float)(n * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform);
					}
					else
					{
						Object.Instantiate<GameObject>(Wall, new Vector3((float)(m * 6), Offset, (float)(n * 6 - 3)), Quaternion.Euler(-90f, 90f, 0f), ((Component)this).transform);
					}
				}
				else if (num == 16)
				{
					Object.Instantiate<GameObject>(Pillar, new Vector3((float)(m * 6), Offset, (float)(n * 6)), Quaternion.Euler(-90f, 0f, 0f), ((Component)this).transform);
				}
				else
				{
					PossibleSpawnPoint.Add(new Vector2((float)(m * 6), (float)(n * 6)));
				}
			}
		}
		if (((NetworkBehaviour)this).IsServer)
		{
			((Component)this).GetComponent<NavMeshSurface>().BuildNavMesh();
			GameObject val3 = Loader.AssetBundle.LoadAsset<GameObject>("assets/backrooms/smile.prefab");
			for (int num2 = 0; num2 < Loader.NumberOfSmilers.Value; num2++)
			{
				Vector2 val4 = PossibleSpawnPoint[Random.Range(0, PossibleSpawnPoint.Count)];
				Object.Instantiate<GameObject>(val3, new Vector3(val4.x, Offset, val4.y), Quaternion.identity, ((Component)this).transform).GetComponent<NetworkObject>().Spawn(false);
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void TeleportOutOfBackroomsServerRpc(ulong clientId)
	{
		//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3409688981u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3409688981u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				TeleportOutOfBackroomsClientRpc((int)clientId);
			}
		}
	}

	protected override void __initializeVariables()
	{
		if (SharedOdds == null)
		{
			throw new Exception("Backrooms.SharedOdds cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)SharedOdds).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SharedOdds, "SharedOdds");
		base.NetworkVariableFields.Add((NetworkVariableBase)(object)SharedOdds);
		((NetworkBehaviour)this).__initializeVariables();
	}

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_Backrooms()
	{
		//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(2180494496u, new RpcReceiveHandler(__rpc_handler_2180494496));
		NetworkManager.__rpc_func_table.Add(2541916904u, new RpcReceiveHandler(__rpc_handler_2541916904));
		NetworkManager.__rpc_func_table.Add(3078584200u, new RpcReceiveHandler(__rpc_handler_3078584200));
		NetworkManager.__rpc_func_table.Add(1623403188u, new RpcReceiveHandler(__rpc_handler_1623403188));
		NetworkManager.__rpc_func_table.Add(890432861u, new RpcReceiveHandler(__rpc_handler_890432861));
		NetworkManager.__rpc_func_table.Add(3409688981u, new RpcReceiveHandler(__rpc_handler_3409688981));
	}

	private static void __rpc_handler_2180494496(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;
			((Backrooms)(object)target).CleanBackroomsClientRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2541916904(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 client = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref client);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((Backrooms)(object)target).TeleportToBackroomsServerRpc(client);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3078584200(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 client = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref client);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((Backrooms)(object)target).TeleportToBackroomsClientRpc(client);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1623403188(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 client = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref client);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((Backrooms)(object)target).TeleportOutOfBackroomsClientRpc(client);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_890432861(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 seed = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref seed);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((Backrooms)(object)target).GenerateClientRpc(seed);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3409688981(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)
		{
			ulong clientId = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((Backrooms)(object)target).TeleportOutOfBackroomsServerRpc(clientId);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "Backrooms";
	}
}
public class Exit : MonoBehaviour
{
	private void Start()
	{
	}

	private IEnumerator Teleport(ulong playerClientId)
	{
		StartOfRound.Instance.allPlayerScripts[playerClientId].beamOutParticle.Play();
		yield return (object)new WaitForSeconds(3f);
		Backrooms.Instance.TeleportOutOfBackroomsServerRpc(playerClientId);
	}

	private void OnTriggerEnter(Collider other)
	{
		PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
		if ((Object)(object)component != (Object)null)
		{
			((MonoBehaviour)this).StartCoroutine(Teleport(component.playerClientId));
			Backrooms.Instance.TeleportOutOfBackroomsServerRpc(component.playerClientId);
		}
	}
}
public static class Hook
{
	[HarmonyPatch(typeof(KillLocalPlayer), "KillPlayer")]
	[HarmonyPrefix]
	private static bool BeforeKilling(PlayerControllerB playerWhoTriggered)
	{
		if (playerWhoTriggered.isPlayerDead || !playerWhoTriggered.AllowPlayerDeath())
		{
			return true;
		}
		if (((Component)playerWhoTriggered).GetComponent<BackroomsHelper>().HasBeenInTheBackrooms)
		{
			return true;
		}
		Debug.Log((object)$"Killzone {Backrooms.Instance.SharedOdds.Value}");
		if ((float)Random.Range(0, 100) < Backrooms.Instance.SharedOdds.Value)
		{
			Backrooms.Instance.TeleportToBackroomsServerRpc((int)playerWhoTriggered.playerClientId);
			return false;
		}
		return true;
	}

	[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
	[HarmonyPrefix]
	private static bool BeforeDamage(PlayerControllerB __instance)
	{
		if (__instance.isPlayerDead || !__instance.AllowPlayerDeath())
		{
			return true;
		}
		if (((Component)__instance).GetComponent<BackroomsHelper>().HasBeenInTheBackrooms)
		{
			return true;
		}
		Debug.Log((object)$"Damage taken {Backrooms.Instance.SharedOdds.Value}");
		if ((float)Random.Range(0, 100) < Backrooms.Instance.SharedOdds.Value)
		{
			Backrooms.Instance.TeleportToBackroomsServerRpc((int)__instance.playerClientId);
			return false;
		}
		return true;
	}

	[HarmonyPatch(typeof(PlayerControllerB), "Start")]
	[HarmonyPostfix]
	private static void AddComponents(PlayerControllerB __instance)
	{
		((Component)__instance).gameObject.AddComponent<BackroomsHelper>();
	}

	[HarmonyPatch(typeof(RoundManager), "Start")]
	[HarmonyPostfix]
	private static void SpawnBackrooms(RoundManager __instance)
	{
		//IL_0031: 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)
		if (((NetworkBehaviour)__instance).IsServer)
		{
			Debug.Log((object)"Spawning backrooms");
			Object.Instantiate<GameObject>(Loader.AssetBundle.LoadAsset<GameObject>("assets/backrooms/backrooms.prefab"), new Vector3(0f, Backrooms.Offset, 0f), Quaternion.identity).GetComponent<NetworkObject>().Spawn(false);
		}
	}

	[HarmonyPatch(typeof(RoundManager), "UnloadSceneObjectsEarly")]
	[HarmonyPostfix]
	public static void DeleteBackrooms(RoundManager __instance)
	{
		if (((NetworkBehaviour)__instance).IsServer)
		{
			Backrooms.Instance.ServerClean();
		}
	}

	[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
	[HarmonyPrefix]
	public static void GenerateBackrooms(RoundManager __instance)
	{
		if (((NetworkBehaviour)__instance).IsServer)
		{
			Backrooms.Instance.ServerGenerate();
		}
	}

	[HarmonyPatch(typeof(StartOfRound), "WritePlayerNotes")]
	[HarmonyPostfix]
	public static void BackroomsPlayerNote(StartOfRound __instance)
	{
		for (int i = 0; i < __instance.gameStats.allPlayerStats.Length; i++)
		{
			if (__instance.gameStats.allPlayerStats[i].isActivePlayer && ((Component)__instance.allPlayerScripts[i]).GetComponent<BackroomsHelper>().HasBeenInTheBackrooms)
			{
				if (__instance.allPlayerScripts[i].isPlayerDead)
				{
					__instance.gameStats.allPlayerStats[i].playerNotes.Add("Should have been more careful in the Backrooms.");
				}
				else
				{
					__instance.gameStats.allPlayerStats[i].playerNotes.Add("Had a blast in the Backrooms.");
				}
			}
		}
	}

	[HarmonyPatch(typeof(MenuManager), "Start")]
	[HarmonyPostfix]
	public static void NetworkManagerPatch(MenuManager __instance)
	{
		if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs.Select((NetworkPrefab pref) => ((Object)pref.Prefab).name).Contains("backrooms"))
		{
			Debug.Log((object)"Load prefabs to Network Manager");
			string[] array = new string[2] { "assets/backrooms/backrooms.prefab", "assets/backrooms/smile.prefab" };
			foreach (string text in array)
			{
				GameObject val = Loader.AssetBundle.LoadAsset<GameObject>(text);
				NetworkManager.Singleton.AddNetworkPrefab(val);
			}
		}
	}
}
[BepInPlugin("Neekhaulas.Backrooms", "Backrooms", "0.1.3")]
public class Loader : BaseUnityPlugin
{
	public static AssetBundle AssetBundle { get; private set; }

	public static ConfigEntry<float> TeleportationOdds { get; private set; }

	public static ConfigEntry<int> NumberOfSmilers { get; private set; }

	private void Awake()
	{
		TeleportationOdds = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Teleportation odds", 3f, "Odds to be teleported (in %) - This settings has to be changed by the host");
		NumberOfSmilers = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Number of smilers", 1, "Number of smilers to spawn in the Backrooms - This settings has to be changed by the host");
		AssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "backrooms"));
		Harmony.CreateAndPatchAll(typeof(Hook), (string)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Backrooms is loaded!");
		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);
				}
			}
		}
	}
}
public class SoundPatch : MonoBehaviour
{
	private void Start()
	{
		((Component)this).gameObject.AddComponent<OccludeAudio>();
		((Component)this).GetComponent<AudioSource>().Play();
	}
}
public class Smiler : NetworkBehaviour
{
	private NavMeshAgent NavMeshAgent;

	private PlayerControllerB Target;

	private void Start()
	{
		NavMeshAgent = ((Component)this).GetComponent<NavMeshAgent>();
	}

	private void Update()
	{
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		if (!((NetworkBehaviour)this).IsServer)
		{
			return;
		}
		if ((Object)(object)Target != (Object)null && Target.isPlayerDead)
		{
			Target = null;
			NavMeshAgent.speed = 2f;
		}
		if (!NavMeshAgent.pathPending && NavMeshAgent.remainingDistance <= NavMeshAgent.stoppingDistance)
		{
			if (NavMeshAgent.hasPath)
			{
				Vector3 velocity = NavMeshAgent.velocity;
				if (((Vector3)(ref velocity)).sqrMagnitude != 0f)
				{
					goto IL_00f0;
				}
			}
			if ((Object)(object)Target != (Object)null)
			{
				NavMeshAgent.SetDestination(((Component)Target).transform.position);
			}
			else
			{
				int index = Random.Range(0, Backrooms.Instance.PossibleSpawnPoint.Count);
				NavMeshAgent.SetDestination(Vector2.op_Implicit(Backrooms.Instance.PossibleSpawnPoint[index]));
			}
		}
		goto IL_00f0;
		IL_00f0:
		for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
		{
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
			if (val.isPlayerControlled && !val.isPlayerDead)
			{
				if (val.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up, 45f, 15, -1f))
				{
					Target = val;
					NavMeshAgent.SetDestination(((Component)val).transform.position);
					NavMeshAgent.speed = 7f;
					break;
				}
				bool flag = false;
				if ((Object)(object)val.currentlyHeldObjectServer != (Object)null && ((object)val.currentlyHeldObjectServer).GetType() == typeof(FlashlightItem) && val.currentlyHeldObjectServer.isBeingUsed)
				{
					flag = true;
				}
				if ((Object)(object)val.pocketedFlashlight != (Object)null && ((object)val.pocketedFlashlight).GetType() == typeof(FlashlightItem) && val.pocketedFlashlight.isBeingUsed)
				{
					flag = true;
				}
				if (flag && val.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up, 45f, 100, -1f))
				{
					Target = val;
					NavMeshAgent.SetDestination(((Component)val).transform.position);
					NavMeshAgent.speed = 7f;
				}
			}
		}
	}

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

	protected internal override string __getTypeName()
	{
		return "Smiler";
	}
}

plugins/LethalCompanyInputUtils/LethalCompanyInputUtils.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalCompanyInputUtils.Components;
using LethalCompanyInputUtils.Components.Section;
using LethalCompanyInputUtils.Data;
using LethalCompanyInputUtils.Glyphs;
using LethalCompanyInputUtils.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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("LethalCompanyInputUtils")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+913017c58a6ad55b5050a44817920ad9c63ce200")]
[assembly: AssemblyProduct("LethalCompanyInputUtils")]
[assembly: AssemblyTitle("LethalCompanyInputUtils")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalCompanyInputUtils
{
	public static class LcInputActionApi
	{
		private static readonly Dictionary<string, LcInputActions> InputActionsMap = new Dictionary<string, LcInputActions>();

		internal static bool PrefabLoaded;

		internal static RemapContainerController? ContainerInstance;

		internal static IReadOnlyCollection<LcInputActions> InputActions => InputActionsMap.Values;

		internal static void LoadIntoUI(KepRemapPanel panel)
		{
			//IL_002a: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			AdjustSizeAndPos(panel);
			LayoutElement val = EnsureLayoutElement(panel);
			panel.LoadKeybindsUI();
			float horizontalOffset = panel.horizontalOffset;
			Rect rect = ((Component)((Transform)panel.keyRemapContainer).parent).GetComponent<RectTransform>().rect;
			float num = Mathf.Floor(((Rect)(ref rect)).width / horizontalOffset);
			int count = panel.keySlots.Count;
			int num2 = NumberOfActualKeys(panel.keySlots);
			int num3 = count - num2;
			panel.maxVertical = (float)num2 / num + (float)num3;
			if (ContainerInstance != null && ContainerInstance.legacyButton != null)
			{
				((TMP_Text)((Component)ContainerInstance.legacyButton).GetComponentInChildren<TextMeshProUGUI>()).SetText($"> Show Legacy Controls ({num2} present)", true);
			}
			if (count == 0)
			{
				return;
			}
			val.minHeight = (panel.maxVertical + 1f) * panel.verticalOffset;
			int num4 = 0;
			int num5 = 0;
			foreach (GameObject keySlot in panel.keySlots)
			{
				if ((float)num5 > num)
				{
					num4++;
					num5 = 0;
				}
				keySlot.GetComponent<RectTransform>().anchoredPosition = new Vector2((float)num5 * panel.horizontalOffset, (float)num4 * (0f - panel.verticalOffset));
				if (keySlot.GetComponentInChildren<SettingsOption>() == null)
				{
					num5 = 0;
					num4++;
				}
				else
				{
					num5++;
				}
			}
		}

		public static bool RemapContainerVisible()
		{
			if (ContainerInstance == null)
			{
				return false;
			}
			return ContainerInstance.LayerShown > 0;
		}

		private static int NumberOfActualKeys(List<GameObject> keySlots)
		{
			int num = 0;
			foreach (GameObject keySlot in keySlots)
			{
				if (keySlot.GetComponentInChildren<SettingsOption>() != null)
				{
					num++;
				}
			}
			return num;
		}

		internal static void CloseContainerLayer()
		{
			if (ContainerInstance != null)
			{
				ContainerInstance.HideHighestLayer();
			}
		}

		private static void AdjustSizeAndPos(KepRemapPanel panel)
		{
			GameObject gameObject = ((Component)((Transform)panel.keyRemapContainer).parent).gameObject;
			if (gameObject.GetComponent<ContentSizeFitter>() == null)
			{
				panel.keyRemapContainer.SetPivotY(1f);
				panel.keyRemapContainer.SetAnchorMinY(1f);
				panel.keyRemapContainer.SetAnchorMaxY(1f);
				panel.keyRemapContainer.SetAnchoredPosY(0f);
				panel.keyRemapContainer.SetLocalPosY(0f);
				ContentSizeFitter obj = gameObject.AddComponent<ContentSizeFitter>();
				obj.horizontalFit = (FitMode)0;
				obj.verticalFit = (FitMode)1;
			}
		}

		private static LayoutElement EnsureLayoutElement(KepRemapPanel panel)
		{
			GameObject gameObject = ((Component)((Transform)panel.keyRemapContainer).parent).gameObject;
			LayoutElement component = gameObject.GetComponent<LayoutElement>();
			if (component != null)
			{
				return component;
			}
			return gameObject.AddComponent<LayoutElement>();
		}

		internal static void CalculateVerticalMaxForGamepad(KepRemapPanel panel)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			int num = panel.remappableKeys.Count((RemappableKey key) => key.gamepadOnly);
			float horizontalOffset = panel.horizontalOffset;
			Rect rect = ((Component)((Transform)panel.keyRemapContainer).parent).GetComponent<RectTransform>().rect;
			float num2 = Mathf.Floor(((Rect)(ref rect)).width / horizontalOffset);
			panel.maxVertical = (float)num / num2;
			LayoutElement obj = EnsureLayoutElement(panel);
			obj.minHeight += (panel.maxVertical + 3f) * panel.verticalOffset;
		}

		internal static void ResetLoadedInputActions()
		{
			PrefabLoaded = false;
			foreach (LcInputActions inputAction in InputActions)
			{
				inputAction.Loaded = false;
			}
		}

		internal static void RegisterInputActions(LcInputActions lcInputActions, InputActionMapBuilder builder)
		{
			if (!InputActionsMap.TryAdd(lcInputActions.Id, lcInputActions))
			{
				Logging.Warn("The mod [" + lcInputActions.Plugin.GUID + "] instantiated an Actions class [" + lcInputActions.GetType().Name + "] more than once!\n\t These classes should be treated as singletons!, do not instantiate more than once!");
			}
			else
			{
				lcInputActions.CreateInputActions(in builder);
				InputActionSetupExtensions.AddActionMap(lcInputActions.GetAsset(), builder.Build());
				lcInputActions.GetAsset().Enable();
				lcInputActions.OnAssetLoaded();
				lcInputActions.Load();
				lcInputActions.BuildActionRefs();
			}
		}

		internal static void DisableForRebind()
		{
			foreach (LcInputActions inputAction in InputActions)
			{
				if (inputAction.Enabled)
				{
					inputAction.Disable();
				}
			}
		}

		internal static void ReEnableFromRebind()
		{
			foreach (LcInputActions inputAction in InputActions)
			{
				if (inputAction.WasEnabled)
				{
					inputAction.Enable();
				}
			}
		}

		internal static void SaveOverrides()
		{
			foreach (LcInputActions inputAction in InputActions)
			{
				inputAction.Save();
			}
		}

		internal static void LoadOverrides()
		{
			foreach (LcInputActions inputAction in InputActions)
			{
				inputAction.Load();
			}
		}
	}
	[BepInPlugin("com.rune580.LethalCompanyInputUtils", "Lethal Company Input Utils", "0.6.3")]
	public class LethalCompanyInputUtilsPlugin : BaseUnityPlugin
	{
		public const string ModId = "com.rune580.LethalCompanyInputUtils";

		public const string ModName = "Lethal Company Input Utils";

		public const string ModVersion = "0.6.3";

		private Harmony? _harmony;

		private void Awake()
		{
			Logging.SetLogSource(((BaseUnityPlugin)this).Logger);
			_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.rune580.LethalCompanyInputUtils");
			SceneManager.activeSceneChanged += OnSceneChanged;
			InputSystem.onDeviceChange += OnDeviceChanged;
			LoadAssetBundles();
			ControllerGlyph.LoadGlyphs();
			FsUtils.EnsureControlsDir();
			RegisterExtendedMouseLayout();
			Logging.Info("InputUtils 0.6.3 has finished loading!");
		}

		private void LoadAssetBundles()
		{
			Assets.AddBundle("ui-assets");
		}

		private static void OnSceneChanged(Scene current, Scene next)
		{
			LcInputActionApi.ResetLoadedInputActions();
			CameraUtils.ClearUiCameraReference();
			BindsListController.OffsetCompensation = ((((Scene)(ref next)).name != "MainMenu") ? 20 : 0);
		}

		private static void OnDeviceChanged(InputDevice device, InputDeviceChange state)
		{
			RebindButton.ReloadGlyphs();
		}

		private static void RegisterExtendedMouseLayout()
		{
			InputSystem.RegisterLayoutOverride("{\n   \"name\": \"InputUtilsExtendedMouse\",\n   \"extend\": \"Mouse\",\n   \"controls\": [\n       {\n           \"name\": \"scroll/up\",\n           \"layout\": \"Button\",\n           \"useStateFrom\": \"scroll/up\",\n           \"format\": \"BIT\",\n           \"synthetic\": true\n       },\n       {\n           \"name\": \"scroll/down\",\n           \"layout\": \"Button\",\n           \"useStateFrom\": \"scroll/down\",\n           \"format\": \"BIT\",\n           \"synthetic\": true\n       },\n       {\n           \"name\": \"scroll/left\",\n           \"layout\": \"Button\",\n           \"useStateFrom\": \"scroll/left\",\n           \"format\": \"BIT\",\n           \"synthetic\": true\n       },\n       {\n           \"name\": \"scroll/right\",\n           \"layout\": \"Button\",\n           \"useStateFrom\": \"scroll/right\",\n           \"format\": \"BIT\",\n           \"synthetic\": true\n       }\n   ]\n}", (string)null);
			Logging.Info("Registered InputUtilsExtendedMouse Layout Override!");
		}
	}
}
namespace LethalCompanyInputUtils.Utils
{
	internal static class AssemblyUtils
	{
		public static BepInPlugin? GetBepInPlugin(this Assembly assembly)
		{
			foreach (Type validType in assembly.GetValidTypes())
			{
				BepInPlugin customAttribute = ((MemberInfo)validType).GetCustomAttribute<BepInPlugin>();
				if (customAttribute != null)
				{
					return customAttribute;
				}
			}
			return null;
		}

		public static IEnumerable<Type> GetValidTypes(this Assembly assembly)
		{
			try
			{
				return assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				return ex.Types.Where((Type type) => (object)type != null);
			}
		}
	}
	internal static class Assets
	{
		private static readonly List<AssetBundle> AssetBundles = new List<AssetBundle>();

		private static readonly Dictionary<string, int> AssetIndices = new Dictionary<string, int>();

		public static void AddBundle(string bundleName)
		{
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(FsUtils.AssetBundlesDir, bundleName));
			int count = AssetBundles.Count;
			AssetBundles.Add(val);
			string[] allAssetNames = val.GetAllAssetNames();
			for (int i = 0; i < allAssetNames.Length; i++)
			{
				string text = allAssetNames[i].ToLowerInvariant();
				if (text.StartsWith("assets/"))
				{
					string text2 = text;
					int length = "assets/".Length;
					text = text2.Substring(length, text2.Length - length);
				}
				AssetIndices[text] = count;
			}
		}

		public static T? Load<T>(string assetName) where T : Object
		{
			try
			{
				assetName = assetName.ToLowerInvariant();
				if (assetName.StartsWith("assets/"))
				{
					string text = assetName;
					int length = "assets/".Length;
					assetName = text.Substring(length, text.Length - length);
				}
				int index = AssetIndices[assetName];
				return AssetBundles[index].LoadAsset<T>("assets/" + assetName);
			}
			catch (Exception arg)
			{
				Logging.Error($"Couldn't load asset [{assetName}] exception: {arg}");
				return default(T);
			}
		}
	}
	internal static class CameraUtils
	{
		private static Camera? _uiCamera;

		public static Camera GetBestUiCamera()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (_uiCamera != null && Object.op_Implicit((Object)(object)_uiCamera))
			{
				return _uiCamera;
			}
			_uiCamera = null;
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "MainMenu")
			{
				GameObject val = ((IEnumerable<GameObject>)((Scene)(ref activeScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject go) => ((Object)go).name == "UICamera"));
				if (val == null)
				{
					Logging.Warn("Failed to find UICamera at MainMenu, falling back to Camera.current!");
					return Camera.current;
				}
				Camera component = val.GetComponent<Camera>();
				if (component == null)
				{
					Logging.Warn("Failed to find Camera component on UICamera, falling back to Camera.current!");
					return Camera.current;
				}
				_uiCamera = component;
			}
			else
			{
				GameObject val2 = ((IEnumerable<GameObject>)((Scene)(ref activeScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject go) => ((Object)go).name == "Systems"));
				if (val2 == null)
				{
					Logging.Warn("Failed to find UICamera in active scene, falling back to Camera.current!");
					return Camera.current;
				}
				Transform val3 = val2.transform.Find("UI/UICamera");
				if (val3 == null)
				{
					Logging.Warn("Failed to find UICamera at MainMenu, falling back to Camera.current!");
					return Camera.current;
				}
				Camera component2 = ((Component)val3).GetComponent<Camera>();
				if (component2 == null)
				{
					Logging.Warn("Failed to find Camera component on UICamera, falling back to Camera.current!");
					return Camera.current;
				}
				_uiCamera = component2;
			}
			return _uiCamera;
		}

		public static void ClearUiCameraReference()
		{
			_uiCamera = null;
		}
	}
	internal static class DebugUtils
	{
		public static string ToPrettyString<TKey, TValue>(this IDictionary<TKey, TValue> dictionary)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("{");
			using (IEnumerator<KeyValuePair<TKey, TValue>> enumerator = dictionary.GetEnumerator())
			{
				string[] obj;
				object obj3;
				for (; enumerator.MoveNext(); obj[3] = (string)obj3, obj[4] = "\",", stringBuilder.AppendLine(string.Concat(obj)))
				{
					enumerator.Current.Deconstruct(out var key, out var value);
					TKey val = key;
					TValue val2 = value;
					obj = new string[5] { "\t\"", null, null, null, null };
					ref TKey reference = ref val;
					key = default(TKey);
					object obj2;
					if (key == null)
					{
						key = reference;
						reference = ref key;
						if (key == null)
						{
							obj2 = null;
							goto IL_007c;
						}
					}
					obj2 = reference.ToString();
					goto IL_007c;
					IL_007c:
					obj[1] = (string)obj2;
					obj[2] = "\": \"";
					ref TValue reference2 = ref val2;
					value = default(TValue);
					if (value == null)
					{
						value = reference2;
						reference2 = ref value;
						if (value == null)
						{
							obj3 = null;
							continue;
						}
					}
					obj3 = reference2.ToString();
				}
			}
			stringBuilder.Remove(stringBuilder.Length - 1, 1);
			stringBuilder.AppendLine("}");
			return stringBuilder.ToString();
		}

		public static void DrawGizmoUiRectWorld(this RectTransform rectTransform)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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)
			float z = ((Transform)rectTransform).position.z;
			Rect val = rectTransform.UiBoundsWorld();
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(((Rect)(ref val)).min.x, ((Rect)(ref val)).min.y, z);
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(((Rect)(ref val)).min.x, ((Rect)(ref val)).max.y, z);
			Vector3 val4 = default(Vector3);
			((Vector3)(ref val4))..ctor(((Rect)(ref val)).max.x, ((Rect)(ref val)).max.y, z);
			Vector3 val5 = default(Vector3);
			((Vector3)(ref val5))..ctor(((Rect)(ref val)).max.x, ((Rect)(ref val)).min.y, z);
			Gizmos.DrawLine(val2, val3);
			Gizmos.DrawLine(val3, val4);
			Gizmos.DrawLine(val4, val5);
			Gizmos.DrawLine(val5, val2);
		}

		public static void DrawGizmoUiRect(this RectTransform rectTransform, Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			float z = position.z;
			Rect val = rectTransform.UiBounds(position);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(((Rect)(ref val)).min.x, ((Rect)(ref val)).min.y, z);
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(((Rect)(ref val)).min.x, ((Rect)(ref val)).max.y, z);
			Vector3 val4 = default(Vector3);
			((Vector3)(ref val4))..ctor(((Rect)(ref val)).max.x, ((Rect)(ref val)).max.y, z);
			Vector3 val5 = default(Vector3);
			((Vector3)(ref val5))..ctor(((Rect)(ref val)).max.x, ((Rect)(ref val)).min.y, z);
			Gizmos.DrawLine(val2, val3);
			Gizmos.DrawLine(val3, val4);
			Gizmos.DrawLine(val4, val5);
			Gizmos.DrawLine(val5, val2);
		}

		public static void DrawGizmoRect(this Rect rect, Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			float z = position.z;
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(((Rect)(ref rect)).min.x + position.x, ((Rect)(ref rect)).min.y + position.y, z);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(((Rect)(ref rect)).min.x + position.x, ((Rect)(ref rect)).max.y + position.y, z);
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(((Rect)(ref rect)).max.x + position.x, ((Rect)(ref rect)).max.y + position.y, z);
			Vector3 val4 = default(Vector3);
			((Vector3)(ref val4))..ctor(((Rect)(ref rect)).max.x + position.x, ((Rect)(ref rect)).min.y + position.y, z);
			Gizmos.DrawLine(val, val2);
			Gizmos.DrawLine(val2, val3);
			Gizmos.DrawLine(val3, val4);
			Gizmos.DrawLine(val4, val);
		}
	}
	internal static class DeconstructUtils
	{
		public static void Deconstruct(this Rect rect, out Vector2 min, out Vector2 max)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			min = new Vector2(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMin);
			max = new Vector2(((Rect)(ref rect)).xMax, ((Rect)(ref rect)).yMax);
		}

		public static void Deconstruct(this Vector3 vector, out float x, out float y, out float z)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			x = vector.x;
			y = vector.y;
			z = vector.z;
		}
	}
	internal static class FsUtils
	{
		private static string? _assetBundlesDir;

		public static string SaveDir { get; } = GetSaveDir();


		public static string Pre041ControlsDir { get; } = Path.Combine(Paths.BepInExRootPath, "controls");


		public static string ControlsDir { get; } = Path.Combine(Paths.ConfigPath, "controls");


		public static string AssetBundlesDir
		{
			get
			{
				if (_assetBundlesDir == null)
				{
					_assetBundlesDir = GetAssetBundlesDir();
				}
				if (string.IsNullOrEmpty(_assetBundlesDir))
				{
					string text = Chainloader.PluginInfos.ToPrettyString();
					Logging.Warn("InputUtils is loading in an invalid state!\n\tOne of the following mods may be the culprit:\n" + text);
					return "";
				}
				return _assetBundlesDir;
			}
		}

		private static string GetSaveDir()
		{
			string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
			return Path.Combine(folderPath, "AppData", "LocalLow", "ZeekerssRBLX", "Lethal Company");
		}

		public static void EnsureControlsDir()
		{
			if (!Directory.Exists(ControlsDir))
			{
				Directory.CreateDirectory(ControlsDir);
			}
		}

		private static string? GetAssetBundlesDir()
		{
			if (!Chainloader.PluginInfos.TryGetValue("com.rune580.LethalCompanyInputUtils", out var value))
			{
				return null;
			}
			string text = Path.Combine((Directory.GetParent(value.Location) ?? throw new NotSupportedException(BadInstallError())).FullName, "AssetBundles");
			if (!Directory.Exists(text))
			{
				throw new NotSupportedException(BadInstallError());
			}
			return text;
			static string BadInstallError()
			{
				Logging.Error("InputUtils can't find it's required AssetBundles! This will cause many issues!\nThis either means your mod manager incorrectly installed InputUtilsor if you've manually installed InputUtils, you've done so incorrectly. If you manually installed don't bother reporting the issue, I only provide support to people who use mod managers.");
				return "InputUtils can't find it's required AssetBundles! This will cause many issues!\nThis either means your mod manager incorrectly installed InputUtilsor if you've manually installed InputUtils, you've done so incorrectly. If you manually installed don't bother reporting the issue, I only provide support to people who use mod managers.";
			}
		}
	}
	internal static class InputSystemUtils
	{
		public static bool IsGamepadOnly(this InputAction action)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return ((IEnumerable<InputBinding>)(object)action.bindings).All((InputBinding binding) => !binding.IsKbmBind());
		}

		public static bool IsKbmBind(this InputBinding binding)
		{
			string path = ((InputBinding)(ref binding)).path;
			if (string.Equals(path, "<InputUtils-Kbm-Not-Bound>"))
			{
				return true;
			}
			if (path.StartsWith("<Keyboard>", StringComparison.InvariantCultureIgnoreCase))
			{
				return true;
			}
			if (path.StartsWith("<Mouse>", StringComparison.InvariantCultureIgnoreCase))
			{
				return true;
			}
			return false;
		}
	}
	internal static class Logging
	{
		private static ManualLogSource? _logSource;

		internal static void SetLogSource(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		public static void Error(object data)
		{
			Error(data.ToString());
		}

		public static void Warn(object data)
		{
			Warn(data.ToString());
		}

		public static void Info(object data)
		{
			Info(data.ToString());
		}

		public static void Error(string msg)
		{
			if (_logSource == null)
			{
				Debug.LogError((object)("[Lethal Company Input Utils] [Error] " + msg));
			}
			else
			{
				_logSource.LogError((object)msg);
			}
		}

		public static void Warn(string msg)
		{
			if (_logSource == null)
			{
				Debug.LogWarning((object)("[Lethal Company Input Utils] [Warning] " + msg));
			}
			else
			{
				_logSource.LogWarning((object)msg);
			}
		}

		public static void Info(string msg)
		{
			if (_logSource == null)
			{
				Debug.Log((object)("[Lethal Company Input Utils] [Info] " + msg));
			}
			else
			{
				_logSource.LogInfo((object)msg);
			}
		}
	}
	internal static class RectTransformExtensions
	{
		public static void SetLocalPosX(this RectTransform rectTransform, float x)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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)
			Vector3 localPosition = ((Transform)rectTransform).localPosition;
			((Transform)rectTransform).localPosition = new Vector3(x, localPosition.y, localPosition.z);
		}

		public static void SetLocalPosY(this RectTransform rectTransform, float y)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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)
			Vector3 localPosition = ((Transform)rectTransform).localPosition;
			((Transform)rectTransform).localPosition = new Vector3(localPosition.x, y, localPosition.z);
		}

		public static void SetPivotY(this RectTransform rectTransform, float y)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.pivot = new Vector2(rectTransform.pivot.x, y);
		}

		public static void SetAnchorMinY(this RectTransform rectTransform, float y)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchorMin = new Vector2(rectTransform.anchorMin.x, y);
		}

		public static void SetAnchorMaxY(this RectTransform rectTransform, float y)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchorMax = new Vector2(rectTransform.anchorMax.x, y);
		}

		public static void SetAnchoredPosX(this RectTransform rectTransform, float x)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchoredPosition = new Vector2(x, rectTransform.anchoredPosition.y);
		}

		public static void SetAnchoredPosY(this RectTransform rectTransform, float y)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, y);
		}

		public static void SetSizeDeltaX(this RectTransform rectTransform, float x)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.sizeDelta = new Vector2(x, rectTransform.sizeDelta.y);
		}

		public static Rect UiBoundsWorld(this RectTransform rectTransform)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0046: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Transform)rectTransform).position;
			Rect rect = rectTransform.rect;
			Vector3 lossyScale = ((Transform)rectTransform).lossyScale;
			return new Rect(((Rect)(ref rect)).x * lossyScale.x + position.x, ((Rect)(ref rect)).y * lossyScale.y + position.y, ((Rect)(ref rect)).width * lossyScale.x, ((Rect)(ref rect)).height * lossyScale.y);
		}

		[Obsolete("Use GetRelativeRect")]
		public static Rect UiBounds(this RectTransform rectTransform, Vector3 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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)
			//IL_004d: 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)
			Rect rect = rectTransform.rect;
			Vector3 lossyScale = ((Transform)rectTransform).lossyScale;
			return new Rect(((Rect)(ref rect)).x * lossyScale.x + position.x, ((Rect)(ref rect)).y * lossyScale.y + position.y, ((Rect)(ref rect)).width * lossyScale.x, ((Rect)(ref rect)).height * lossyScale.y);
		}

		public static Rect GetRelativeRect(this RectTransform rectTransform, RectTransform worldRectTransform)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			Camera bestUiCamera = CameraUtils.GetBestUiCamera();
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			worldRectTransform.GetWorldCorners(array);
			Vector2[] array2 = (Vector2[])(object)new Vector2[4];
			for (int i = 0; i < array.Length; i++)
			{
				array2[i] = RectTransformUtility.WorldToScreenPoint(bestUiCamera, array[i]);
			}
			Vector2[] array3 = (Vector2[])(object)new Vector2[4];
			for (int j = 0; j < array2.Length; j++)
			{
				RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, array2[j], bestUiCamera, ref array3[j]);
			}
			Vector2 val = array3[0];
			Vector2 val2 = array3[0];
			Vector2[] array4 = array3;
			foreach (Vector2 val3 in array4)
			{
				val = Vector2.Min(val, val3);
				val2 = Vector2.Max(val2, val3);
			}
			Vector2 val4 = val2 - val;
			return new Rect(val.x, val.y, val4.x, val4.y);
		}

		public static Vector2 WorldToLocalPoint(this RectTransform rectTransform, Vector3 worldPoint)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			Camera bestUiCamera = CameraUtils.GetBestUiCamera();
			Vector2 val = RectTransformUtility.WorldToScreenPoint(bestUiCamera, worldPoint);
			Vector2 result = default(Vector2);
			RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, val, bestUiCamera, ref result);
			return result;
		}

		public static Vector2 WorldToLocalPoint(this RectTransform rectTransform, RectTransform other)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return rectTransform.WorldToLocalPoint(((Transform)other).position);
		}

		public static float WorldMaxY(this RectTransform rectTransform)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Rect val = rectTransform.UiBoundsWorld();
			return ((Rect)(ref val)).max.y;
		}

		public static float WorldMinY(this RectTransform rectTransform)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Rect val = rectTransform.UiBoundsWorld();
			return ((Rect)(ref val)).min.y;
		}
	}
	internal static class RectUtils
	{
		public static Vector2 CenteredPos(this Rect rect)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return ((Rect)(ref rect)).min + ((Rect)(ref rect)).size / 2f;
		}
	}
	internal static class RuntimeHelper
	{
		public static Vector3 LocalPositionRelativeTo(this Transform transform, Transform parent)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0014: 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)
			Vector3 val = Vector3.zero;
			Transform val2 = transform;
			do
			{
				val += transform.localPosition;
				val2 = val2.parent;
			}
			while ((Object)(object)val2 != (Object)(object)parent);
			return val;
		}

		public static void DisableKeys(this IEnumerable<RemappableKey> keys)
		{
			foreach (RemappableKey key in keys)
			{
				key.currentInput.action.Disable();
			}
		}

		public static void EnableKeys(this IEnumerable<RemappableKey> keys)
		{
			foreach (RemappableKey key in keys)
			{
				key.currentInput.action.Enable();
			}
		}
	}
	internal static class VectorUtils
	{
		public static Vector3 Mul(this Vector3 left, Vector3 right)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(left.x * right.x, left.y * right.y, left.z * right.z);
		}
	}
}
namespace LethalCompanyInputUtils.Utils.Anim
{
	public interface ITweenValue
	{
		bool IgnoreTimeScale { get; }

		float Duration { get; }

		void TweenValue(float percentage);

		bool ValidTarget();
	}
	public class TweenRunner<T> where T : struct, ITweenValue
	{
		protected MonoBehaviour? CoroutineContainer;

		protected IEnumerator? Tween;

		private static IEnumerator Start(T tweenValue)
		{
			if (tweenValue.ValidTarget())
			{
				float elapsedTime = 0f;
				while (elapsedTime < tweenValue.Duration)
				{
					elapsedTime += (tweenValue.IgnoreTimeScale ? Time.unscaledDeltaTime : Time.deltaTime);
					float percentage = Mathf.Clamp01(elapsedTime / tweenValue.Duration);
					tweenValue.TweenValue(percentage);
					yield return null;
				}
				tweenValue.TweenValue(1f);
			}
		}

		public void Init(MonoBehaviour coroutineContainer)
		{
			CoroutineContainer = coroutineContainer;
		}

		public void StartTween(T tweenValue)
		{
			if (CoroutineContainer != null)
			{
				if (Tween != null)
				{
					CoroutineContainer.StopCoroutine(Tween);
					Tween = null;
				}
				if (!((Component)CoroutineContainer).gameObject.activeInHierarchy)
				{
					tweenValue.TweenValue(1f);
					return;
				}
				Tween = Start(tweenValue);
				CoroutineContainer.StartCoroutine(Tween);
			}
		}

		public void StopTween()
		{
			if (Tween != null && CoroutineContainer != null)
			{
				CoroutineContainer.StopCoroutine(Tween);
				Tween = null;
			}
		}
	}
}
namespace LethalCompanyInputUtils.Utils.Anim.TweenValues
{
	public struct Vector3Tween : ITweenValue
	{
		private class Vector3TweenCallback : UnityEvent<Vector3>
		{
		}

		private Vector3TweenCallback? _target;

		public float Duration { get; set; }

		public Vector3 StartValue { get; set; }

		public Vector3 TargetValue { get; set; }

		public bool IgnoreTimeScale { get; set; }

		public void TweenValue(float percentage)
		{
			//IL_000a: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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)
			if (ValidTarget())
			{
				Vector3 val = Vector3.Lerp(StartValue, TargetValue, percentage);
				((UnityEvent<Vector3>)_target).Invoke(val);
			}
		}

		public void AddOnChangedCallback(UnityAction<Vector3> callback)
		{
			if (_target == null)
			{
				_target = new Vector3TweenCallback();
			}
			((UnityEvent<Vector3>)_target).AddListener(callback);
		}

		public bool ValidTarget()
		{
			return _target != null;
		}
	}
}
namespace LethalCompanyInputUtils.Patches
{
	public static class InGamePlayerSettingsPatches
	{
		[HarmonyPatch(typeof(IngamePlayerSettings), "SaveChangedSettings")]
		public static class SaveChangedSettingsPatch
		{
			public static void Prefix()
			{
				LcInputActionApi.SaveOverrides();
			}
		}

		[HarmonyPatch(typeof(IngamePlayerSettings), "DiscardChangedSettings")]
		public static class DiscardChangedSettingsPatch
		{
			public static void Prefix()
			{
				LcInputActionApi.LoadOverrides();
			}
		}
	}
	public static class InputControlPathPatches
	{
		[HarmonyPatch]
		public static class ToHumanReadableStringPatch
		{
			public static IEnumerable<MethodBase> TargetMethods()
			{
				return from method in AccessTools.GetDeclaredMethods(typeof(InputControlPath))
					where method.Name == "ToHumanReadableString" && method.ReturnType == typeof(string)
					select method;
			}

			public static void Postfix(ref string __result)
			{
				string text = __result;
				if ((text == "<InputUtils-Gamepad-Not-Bound>" || text == "<InputUtils-Kbm-Not-Bound>") ? true : false)
				{
					__result = "";
				}
			}
		}
	}
	public static class KeyRemapPanelPatches
	{
		[HarmonyPatch(typeof(KepRemapPanel), "OnEnable")]
		public static class LoadKeybindsUIPatch
		{
			[CompilerGenerated]
			private static class <>O
			{
				public static UnityAction <0>__CloseContainerLayer;
			}

			public static void Prefix(KepRemapPanel __instance)
			{
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Expected O, but got Unknown
				//IL_011f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0129: Expected O, but got Unknown
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: Unknown result type (might be due to invalid IL or missing references)
				//IL_0182: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0202: Expected O, but got Unknown
				//IL_023b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0245: Expected O, but got Unknown
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Expected O, but got Unknown
				LcInputActionApi.DisableForRebind();
				if (LcInputActionApi.PrefabLoaded && LcInputActionApi.ContainerInstance != null)
				{
					LcInputActionApi.ContainerInstance.baseGameKeys.DisableKeys();
					return;
				}
				GameObject val = Object.Instantiate<GameObject>(Assets.Load<GameObject>("Prefabs/InputUtilsRemapContainer.prefab"), ((Component)__instance).transform);
				GameObject val2 = Object.Instantiate<GameObject>(Assets.Load<GameObject>("Prefabs/Legacy Holder.prefab"), ((Component)__instance).transform);
				if (val == null || val2 == null)
				{
					return;
				}
				Transform val3 = ((Component)__instance).transform.Find("Scroll View");
				if (val3 != null)
				{
					val3.SetParent(val2.transform);
					List<RemappableKey> remappableKeys = __instance.remappableKeys;
					__instance.remappableKeys = new List<RemappableKey>();
					val2.SetActive(false);
					GameObject gameObject = ((Component)((Component)__instance).transform.Find("Back")).gameObject;
					Button component = gameObject.GetComponent<Button>();
					GameObject obj = Object.Instantiate<GameObject>(gameObject, val2.transform, true);
					Object.DestroyImmediate((Object)(object)obj.GetComponentInChildren<SettingsOption>());
					Button component2 = obj.GetComponent<Button>();
					component2.onClick = new ButtonClickedEvent();
					ButtonClickedEvent onClick = component2.onClick;
					object obj2 = <>O.<0>__CloseContainerLayer;
					if (obj2 == null)
					{
						UnityAction val4 = LcInputActionApi.CloseContainerLayer;
						<>O.<0>__CloseContainerLayer = val4;
						obj2 = (object)val4;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj2);
					GameObject obj3 = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
					Object.DestroyImmediate((Object)(object)obj3.GetComponentInChildren<SettingsOption>());
					Button component3 = obj3.GetComponent<Button>();
					component3.onClick = new ButtonClickedEvent();
					RectTransform component4 = obj3.GetComponent<RectTransform>();
					component4.SetAnchoredPosY(component4.anchoredPosition.y + 25f);
					component4.SetSizeDeltaX(component4.sizeDelta.x + 180f);
					RectTransform component5 = ((Component)((Transform)component4).Find("SelectionHighlight")).GetComponent<RectTransform>();
					component5.SetSizeDeltaX(410f);
					component5.offsetMax = new Vector2(410f, component5.offsetMax.y);
					component5.offsetMin = new Vector2(0f, component5.offsetMin.y);
					RemapContainerController component6 = val.GetComponent<RemapContainerController>();
					component6.baseGameKeys = remappableKeys;
					component6.backButton = component;
					component6.legacyButton = component3;
					component6.legacyHolder = val2;
					component6.baseGameKeys.DisableKeys();
					((UnityEvent)component3.onClick).AddListener(new UnityAction(component6.ShowLegacyUi));
					component6.LoadUi();
					Button component7 = ((Component)((Component)__instance).transform.Find("SetDefault")).gameObject.GetComponent<Button>();
					((UnityEventBase)component7.onClick).RemoveAllListeners();
					((UnityEvent)component7.onClick).AddListener(new UnityAction(component6.OnSetToDefault));
					val2.transform.SetAsLastSibling();
					LcInputActionApi.PrefabLoaded = true;
				}
			}

			public static void Postfix(KepRemapPanel __instance)
			{
				LcInputActionApi.LoadIntoUI(__instance);
			}
		}

		[HarmonyPatch(typeof(KepRemapPanel), "OnDisable")]
		public static class UnloadKeybindsUIPatch
		{
			public static void Prefix()
			{
				if (LcInputActionApi.ContainerInstance != null)
				{
					LcInputActionApi.ContainerInstance.baseGameKeys.EnableKeys();
				}
			}
		}
	}
	public static class QuickMenuManagerPatches
	{
		[HarmonyPatch(typeof(QuickMenuManager), "CloseQuickMenu")]
		public static class OpenMenuPerformedPatch
		{
			public static bool Prefix(QuickMenuManager __instance)
			{
				if (LcInputActionApi.RemapContainerVisible() && __instance.isMenuOpen)
				{
					LcInputActionApi.CloseContainerLayer();
					return false;
				}
				return true;
			}
		}
	}
	public static class SettingsOptionPatches
	{
		[HarmonyPatch(typeof(SettingsOption), "SetBindingToCurrentSetting")]
		public static class SetBindingToCurrentSettingPatch
		{
			public static bool Prefix(SettingsOption __instance)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Invalid comparison between Unknown and I4
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				if ((int)__instance.optionType != 6)
				{
					return true;
				}
				Enumerator<InputBinding> enumerator = __instance.rebindableAction.action.bindings.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						InputBinding current = enumerator.Current;
						if (__instance.gamepadOnlyRebinding)
						{
							if (!string.Equals(((InputBinding)(ref current)).effectivePath, "<InputUtils-Gamepad-Not-Bound>"))
							{
								continue;
							}
						}
						else if (!string.Equals(((InputBinding)(ref current)).effectivePath, "<InputUtils-Kbm-Not-Bound>"))
						{
							continue;
						}
						((TMP_Text)__instance.currentlyUsedKeyText).SetText("", true);
						return false;
					}
				}
				finally
				{
					((IDisposable)enumerator).Dispose();
				}
				return true;
			}
		}
	}
}
namespace LethalCompanyInputUtils.Glyphs
{
	[CreateAssetMenu]
	public class ControllerGlyph : ScriptableObject
	{
		public List<string> validGamepadTypes = new List<string>();

		public List<GlyphDef> glyphSet = new List<GlyphDef>();

		private readonly Dictionary<string, Sprite?> _glyphLut = new Dictionary<string, Sprite>();

		private static readonly List<ControllerGlyph> Instances = new List<ControllerGlyph>();

		private static bool _loaded;

		public static ControllerGlyph? MouseGlyphs { get; private set; }

		public bool IsCurrent
		{
			get
			{
				Gamepad current = Gamepad.current;
				if (current == null)
				{
					return false;
				}
				return validGamepadTypes.Any((string gamepadTypeName) => string.Equals(gamepadTypeName, ((object)current).GetType().Name));
			}
		}

		public Sprite this[string controlPath]
		{
			get
			{
				if (_glyphLut.Count == 0)
				{
					UpdateLut();
				}
				return _glyphLut.GetValueOrDefault(controlPath, null);
			}
		}

		public static ControllerGlyph? GetBestMatching()
		{
			if (Instances.Count == 0)
			{
				return null;
			}
			foreach (ControllerGlyph instance in Instances)
			{
				if (instance.IsCurrent)
				{
					return instance;
				}
			}
			return Instances[0];
		}

		internal static void LoadGlyphs()
		{
			if (!_loaded)
			{
				Assets.Load<ControllerGlyph>("controller glyphs/xbox series x glyphs.asset");
				Assets.Load<ControllerGlyph>("controller glyphs/dualsense glyphs.asset");
				MouseGlyphs = Assets.Load<ControllerGlyph>("controller glyphs/mouse glyphs.asset");
				_loaded = true;
			}
		}

		private void Awake()
		{
			if (!Instances.Contains(this))
			{
				Instances.Add(this);
			}
		}

		private void UpdateLut()
		{
			foreach (GlyphDef item in glyphSet)
			{
				_glyphLut[item.controlPath] = item.glyphSprite;
			}
		}

		private void OnDestroy()
		{
			if (Instances.Contains(this))
			{
				Instances.Remove(this);
			}
		}
	}
	[CreateAssetMenu]
	public class GlyphDef : ScriptableObject
	{
		public string controlPath = "";

		public Sprite? glyphSprite;
	}
}
namespace LethalCompanyInputUtils.Data
{
	[Serializable]
	public struct BindingOverride
	{
		public string? action;

		public string? origPath;

		public string? path;
	}
	[Serializable]
	public class BindingOverrides
	{
		public List<BindingOverride> overrides;

		private BindingOverrides()
		{
			overrides = new List<BindingOverride>();
		}

		public BindingOverrides(IEnumerable<InputBinding> bindings)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			overrides = new List<BindingOverride>();
			foreach (InputBinding binding in bindings)
			{
				InputBinding current = binding;
				if (((InputBinding)(ref current)).hasOverrides)
				{
					BindingOverride item = new BindingOverride
					{
						action = ((InputBinding)(ref current)).action,
						origPath = ((InputBinding)(ref current)).path,
						path = ((InputBinding)(ref current)).overridePath
					};
					overrides.Add(item);
				}
			}
		}

		public void LoadInto(InputActionAsset asset)
		{
			foreach (BindingOverride @override in overrides)
			{
				InputAction obj = asset.FindAction(@override.action, false);
				if (obj != null)
				{
					InputActionRebindingExtensions.ApplyBindingOverride(obj, @override.path, (string)null, @override.origPath);
				}
			}
		}

		public static BindingOverrides FromJson(string json)
		{
			BindingOverrides bindingOverrides = new BindingOverrides();
			JToken value = JsonConvert.DeserializeObject<JObject>(json).GetValue("overrides");
			bindingOverrides.overrides = value.ToObject<List<BindingOverride>>();
			return bindingOverrides;
		}
	}
}
namespace LethalCompanyInputUtils.Components
{
	[RequireComponent(typeof(RectTransform))]
	public class BindsListController : MonoBehaviour
	{
		public GameObject? sectionHeaderPrefab;

		public GameObject? sectionAnchorPrefab;

		public GameObject? rebindItemPrefab;

		public GameObject? spacerPrefab;

		public ScrollRect? scrollRect;

		public RectTransform? headerContainer;

		public UnityEvent<int> OnSectionChanged = new UnityEvent<int>();

		public static float OffsetCompensation;

		private RectTransform? _rectTransform;

		private RectTransform? _scrollRectTransform;

		private RectTransform? _content;

		private VerticalLayoutGroup? _verticalLayoutGroup;

		private int _currentSection;

		private float _sectionHeight;

		private float _spacing;

		private readonly List<SectionHeaderAnchor> _anchors = new List<SectionHeaderAnchor>();

		private void Awake()
		{
			//IL_007c: 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)
			//IL_00f2: 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)
			if (_rectTransform == null)
			{
				_rectTransform = ((Component)this).GetComponent<RectTransform>();
			}
			if (scrollRect == null)
			{
				scrollRect = ((Component)this).GetComponentInChildren<ScrollRect>();
			}
			if (_verticalLayoutGroup == null)
			{
				_verticalLayoutGroup = ((Component)scrollRect.content).GetComponent<VerticalLayoutGroup>();
			}
			_spacing = ((HorizontalOrVerticalLayoutGroup)_verticalLayoutGroup).spacing;
			if (sectionAnchorPrefab != null && rebindItemPrefab != null && spacerPrefab != null)
			{
				_sectionHeight = sectionAnchorPrefab.GetComponent<RectTransform>().sizeDelta.y;
				_scrollRectTransform = ((Component)scrollRect).GetComponent<RectTransform>();
				_content = scrollRect.content;
				if (headerContainer != null)
				{
					headerContainer.drivenByObject = (Object)(object)this;
					headerContainer.drivenProperties = (DrivenTransformProperties)3840;
					headerContainer.anchorMin = new Vector2(0f, 1f);
					headerContainer.anchorMax = Vector2.one;
					((UnityEvent<Vector2>)(object)scrollRect.onValueChanged).AddListener((UnityAction<Vector2>)OnScroll);
					OnScroll(Vector2.zero);
				}
			}
		}

		private void Start()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			OnScroll(Vector2.zero);
		}

		private void OnEnable()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			OnScroll(Vector2.zero);
		}

		public void JumpTo(int sectionIndex)
		{
			//IL_006c: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			if (_content == null || scrollRect == null || _scrollRectTransform == null)
			{
				return;
			}
			int count = _anchors.Count;
			if (sectionIndex < count && sectionIndex >= 0)
			{
				Canvas.ForceUpdateCanvases();
				scrollRect.StopMovement();
				if (sectionIndex == 0)
				{
					scrollRect.verticalNormalizedPosition = 1f;
				}
				else
				{
					SectionHeaderAnchor sectionHeaderAnchor = _anchors[sectionIndex];
					float y = Vector2.op_Implicit(((Transform)_scrollRectTransform).InverseTransformPoint(((Transform)_content).position) - ((Transform)_scrollRectTransform).InverseTransformPoint(((Transform)sectionHeaderAnchor.RectTransform).position)).y + _sectionHeight / 2f - _spacing;
					_content.SetAnchoredPosY(y);
				}
				if (_currentSection != sectionIndex)
				{
					OnSectionChanged.Invoke(sectionIndex);
				}
				_currentSection = sectionIndex;
			}
		}

		public void AddSection(string sectionName)
		{
			//IL_0070: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			if (((Behaviour)this).isActiveAndEnabled && sectionHeaderPrefab != null && sectionAnchorPrefab != null && scrollRect != null)
			{
				SectionHeaderAnchor component = Object.Instantiate<GameObject>(sectionAnchorPrefab, (Transform)(object)_content).GetComponent<SectionHeaderAnchor>();
				SectionHeader component2 = Object.Instantiate<GameObject>(sectionHeaderPrefab, (Transform)(object)headerContainer).GetComponent<SectionHeader>();
				RectTransform rectTransform = component2.RectTransform;
				rectTransform.drivenByObject = (Object)(object)this;
				rectTransform.drivenProperties = (DrivenTransformProperties)1286;
				rectTransform.anchorMin = new Vector2(0f, rectTransform.anchorMin.y);
				rectTransform.anchorMax = new Vector2(1f, rectTransform.anchorMax.y);
				component2.anchor = component;
				component.sectionHeader = component2;
				component2.SetText(sectionName);
				OnScroll(Vector2.zero);
				if (_anchors.Count == 0)
				{
					component.RectTransform.sizeDelta = default(Vector2);
				}
				_currentSection = _anchors.Count;
				_anchors.Add(component);
			}
		}

		public void AddBinds(RemappableKey? kbmKey, RemappableKey? gamepadKey, bool isBaseGame = false, string controlName = "")
		{
			if (((Behaviour)this).isActiveAndEnabled && rebindItemPrefab != null && scrollRect != null)
			{
				if (kbmKey != null && string.IsNullOrEmpty(controlName))
				{
					controlName = kbmKey.ControlName;
				}
				else if (gamepadKey != null && string.IsNullOrEmpty(controlName))
				{
					controlName = gamepadKey.ControlName;
				}
				Object.Instantiate<GameObject>(rebindItemPrefab, (Transform)(object)_content).GetComponent<RebindItem>().SetBind(controlName, kbmKey, gamepadKey, isBaseGame);
			}
		}

		public void AddFooter()
		{
			if (((Behaviour)this).isActiveAndEnabled && spacerPrefab != null)
			{
				Object.Instantiate<GameObject>(spacerPrefab, (Transform)(object)_content);
			}
		}

		private void OnScroll(Vector2 delta)
		{
			//IL_00af: 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)
			if (_scrollRectTransform == null || headerContainer == null || _rectTransform == null)
			{
				return;
			}
			float maxY = GetMaxY(headerContainer);
			int num = -1;
			for (int i = 0; i < _anchors.Count; i++)
			{
				SectionHeaderAnchor sectionHeaderAnchor = _anchors[i];
				SectionHeader sectionHeader = sectionHeaderAnchor.sectionHeader;
				if (i == 0)
				{
					sectionHeader.RectTransform.SetLocalPosY(maxY - (_sectionHeight / 2f - _spacing));
					num = i;
					continue;
				}
				SectionHeader sectionHeader2 = _anchors[i - 1].sectionHeader;
				float num2 = CalculateHeaderRawYPos(sectionHeaderAnchor);
				sectionHeader.RectTransform.SetLocalPosY(num2);
				float num3 = GetMaxY(sectionHeader.RectTransform) + ((Transform)sectionHeader.RectTransform).localPosition.y;
				float num4 = GetMinY(sectionHeader2.RectTransform) + ((Transform)sectionHeader2.RectTransform).localPosition.y;
				if (num3 + _sectionHeight / 2f + _spacing >= num4)
				{
					sectionHeader2.RectTransform.SetLocalPosY(num2 + _sectionHeight);
				}
				if (num3 + _spacing / 2f >= maxY - _sectionHeight / 2f)
				{
					num = i;
					sectionHeader.RectTransform.SetLocalPosY(maxY - (_sectionHeight / 2f - _spacing));
				}
			}
			if (_currentSection != num)
			{
				OnSectionChanged.Invoke(num);
			}
			_currentSection = num;
		}

		private float CalculateHeaderRawYPos(SectionHeaderAnchor anchor)
		{
			//IL_0055: 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)
			if (_content == null || headerContainer == null || _scrollRectTransform == null)
			{
				return 0f;
			}
			float num = GetMaxY(headerContainer) - GetMaxY(_scrollRectTransform);
			num += _sectionHeight / 2f;
			num -= OffsetCompensation;
			return ((Transform)anchor.RectTransform).localPosition.y - (num + 50f) + ((Transform)_content).localPosition.y;
		}

		private void OnDrawGizmos()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (_rectTransform != null && headerContainer != null)
			{
				Color color = Gizmos.color;
				_rectTransform.DrawGizmoUiRectWorld();
				Gizmos.color = color;
			}
		}

		private float GetMaxY(RectTransform element)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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)
			if (_rectTransform == null)
			{
				_rectTransform = ((Component)this).GetComponent<RectTransform>();
			}
			Rect val = element.UiBounds(Vector3.zero);
			return ((Rect)(ref val)).max.y;
		}

		private float GetMinY(RectTransform element)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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)
			if (_rectTransform == null)
			{
				_rectTransform = ((Component)this).GetComponent<RectTransform>();
			}
			Rect val = element.UiBounds(Vector3.zero);
			return ((Rect)(ref val)).min.y;
		}
	}
	public class RebindButton : MonoBehaviour
	{
		public Selectable? button;

		public TextMeshProUGUI? bindLabel;

		public Image? glyphLabel;

		public Image? notSupportedImage;

		public RebindIndicator? rebindIndicator;

		public Button? resetButton;

		public Button? removeButton;

		public float timeout = 5f;

		private RemappableKey? _key;

		private bool _isBaseGame;

		private RebindingOperation? _rebindingOperation;

		private bool _rebinding;

		private float _timeoutTimer;

		private static MethodInfo? _setChangesNotAppliedMethodInfo;

		private static readonly List<RebindButton> Instances = new List<RebindButton>();

		public void SetKey(RemappableKey? key, bool isBaseGame)
		{
			_key = key;
			_isBaseGame = isBaseGame;
			UpdateState();
		}

		public void UpdateState()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			if (bindLabel == null || glyphLabel == null || button == null || notSupportedImage == null || resetButton == null || removeButton == null)
			{
				return;
			}
			if (_key == null)
			{
				SetAsUnsupported();
				return;
			}
			int rebindingIndex = GetRebindingIndex();
			InputAction action = _key.currentInput.action;
			if (rebindingIndex >= action.bindings.Count)
			{
				SetAsUnsupported();
				return;
			}
			GameObject gameObject = ((Component)resetButton).gameObject;
			InputBinding val = action.bindings[rebindingIndex];
			gameObject.SetActive(((InputBinding)(ref val)).hasOverrides);
			val = action.bindings[rebindingIndex];
			string effectivePath = ((InputBinding)(ref val)).effectivePath;
			string bindPath = InputControlPath.ToHumanReadableString(effectivePath, (HumanReadableStringOptions)2, (InputControl)null);
			if (_key.gamepadOnly)
			{
				((TMP_Text)bindLabel).SetText("", true);
				if (effectivePath == "<InputUtils-Gamepad-Not-Bound>")
				{
					((Component)removeButton).gameObject.SetActive(false);
					((Behaviour)glyphLabel).enabled = false;
					return;
				}
				((Component)removeButton).gameObject.SetActive(true);
				ControllerGlyph bestMatching = ControllerGlyph.GetBestMatching();
				if (bestMatching == null)
				{
					((TMP_Text)bindLabel).SetText(effectivePath, true);
					((Behaviour)glyphLabel).enabled = false;
					return;
				}
				Sprite val2 = bestMatching[effectivePath];
				if (val2 == null)
				{
					((TMP_Text)bindLabel).SetText(effectivePath, true);
					((Behaviour)glyphLabel).enabled = false;
				}
				else
				{
					glyphLabel.sprite = val2;
					((Behaviour)glyphLabel).enabled = true;
				}
			}
			else
			{
				((Component)removeButton).gameObject.SetActive(!string.Equals(effectivePath, "<InputUtils-Kbm-Not-Bound>"));
				HandleKbmGlyphOrLabel(effectivePath, bindPath);
			}
		}

		private void HandleKbmGlyphOrLabel(string effectivePath, string bindPath)
		{
			if (bindLabel == null || glyphLabel == null)
			{
				return;
			}
			if (ControllerGlyph.MouseGlyphs != null)
			{
				Sprite val = ControllerGlyph.MouseGlyphs[effectivePath];
				if (val != null)
				{
					((TMP_Text)bindLabel).SetText("", true);
					glyphLabel.sprite = val;
					((Behaviour)glyphLabel).enabled = true;
					return;
				}
			}
			((Behaviour)glyphLabel).enabled = false;
			((TMP_Text)bindLabel).SetText(bindPath, true);
		}

		private void SetAsUnsupported()
		{
			if (button != null && bindLabel != null && glyphLabel != null && notSupportedImage != null && resetButton != null && removeButton != null)
			{
				button.interactable = false;
				button.targetGraphic.raycastTarget = false;
				((Behaviour)button.targetGraphic).enabled = false;
				((TMP_Text)bindLabel).SetText("", true);
				((Behaviour)glyphLabel).enabled = false;
				((Component)notSupportedImage).gameObject.SetActive(true);
				((Component)resetButton).gameObject.SetActive(false);
				((Component)removeButton).gameObject.SetActive(false);
			}
		}

		private int GetRebindingIndex()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_004b: 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)
			if (_key == null)
			{
				return -1;
			}
			InputAction action = _key.currentInput.action;
			if (action.controls.Count == 0)
			{
				if (action.bindings.Count == 0)
				{
					return -1;
				}
				if (_key.gamepadOnly && action.bindings.Count > 1)
				{
					return 1;
				}
				return 0;
			}
			if (_key.rebindingIndex >= 0)
			{
				return _key.rebindingIndex;
			}
			return InputActionRebindingExtensions.GetBindingIndexForControl(action, action.controls[0]);
		}

		public void StartRebinding()
		{
			if (_key != null && bindLabel != null && glyphLabel != null && rebindIndicator != null && resetButton != null && removeButton != null)
			{
				int rebindingIndex = GetRebindingIndex();
				((Selectable)resetButton).interactable = false;
				((Selectable)removeButton).interactable = false;
				((Behaviour)glyphLabel).enabled = false;
				if (_key.gamepadOnly)
				{
					((Behaviour)rebindIndicator).enabled = true;
					RebindGamepad(_key.currentInput, rebindingIndex);
				}
				else
				{
					((TMP_Text)bindLabel).SetText("", true);
					((Behaviour)rebindIndicator).enabled = true;
					RebindKbm(_key.currentInput, rebindingIndex);
				}
				_timeoutTimer = timeout;
				_rebinding = true;
			}
		}

		private void FinishRebinding()
		{
			if (_key != null && rebindIndicator != null && resetButton != null && removeButton != null)
			{
				((Behaviour)rebindIndicator).enabled = false;
				_rebinding = false;
				if (_rebindingOperation != null)
				{
					_rebindingOperation = null;
				}
				((Selectable)resetButton).interactable = true;
				((Selectable)removeButton).interactable = true;
				UpdateState();
			}
		}

		public void ResetToDefault()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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)
			FinishRebinding();
			if (_key == null)
			{
				return;
			}
			int rebindingIndex = GetRebindingIndex();
			InputAction action = _key.currentInput.action;
			InputBinding val = action.bindings[rebindingIndex];
			if (((InputBinding)(ref val)).hasOverrides)
			{
				InputActionRebindingExtensions.RemoveBindingOverride(action, rebindingIndex);
				if (_isBaseGame)
				{
					BaseGameUnsavedChanges();
				}
				MarkSettingsAsDirty();
				UpdateState();
			}
		}

		public void RemoveBind()
		{
			FinishRebinding();
			if (_key != null)
			{
				int rebindingIndex = GetRebindingIndex();
				InputActionRebindingExtensions.ApplyBindingOverride(_key.currentInput.action, rebindingIndex, _key.gamepadOnly ? "<InputUtils-Gamepad-Not-Bound>" : "<InputUtils-Kbm-Not-Bound>");
				if (_isBaseGame)
				{
					BaseGameUnsavedChanges();
				}
				MarkSettingsAsDirty();
				UpdateState();
			}
		}

		private void OnEnable()
		{
			Instances.Add(this);
			if (_key != null)
			{
				UpdateState();
			}
		}

		private void OnDisable()
		{
			FinishRebinding();
			Instances.Remove(this);
		}

		private void Update()
		{
			if (!_rebinding)
			{
				return;
			}
			_timeoutTimer -= Time.deltaTime;
			if (!(_timeoutTimer > 0f))
			{
				if (_rebindingOperation == null)
				{
					FinishRebinding();
					return;
				}
				_rebindingOperation.Cancel();
				FinishRebinding();
			}
		}

		private void RebindKbm(InputActionReference inputActionRef, int rebindIndex)
		{
			_rebindingOperation = InputActionRebindingExtensions.PerformInteractiveRebinding(inputActionRef.action, rebindIndex).OnMatchWaitForAnother(0.1f).WithControlsHavingToMatchPath("<Keyboard>")
				.WithControlsHavingToMatchPath("<Mouse>")
				.WithControlsHavingToMatchPath("<InputUtilsExtendedMouse>")
				.WithControlsExcluding("<Mouse>/scroll/y")
				.WithControlsExcluding("<Mouse>/scroll/x")
				.WithCancelingThrough("<Keyboard>/escape")
				.OnComplete((Action<RebindingOperation>)delegate(RebindingOperation operation)
				{
					OnRebindComplete(operation, this);
				})
				.OnCancel((Action<RebindingOperation>)delegate
				{
					FinishRebinding();
				})
				.Start();
		}

		private void RebindGamepad(InputActionReference inputActionRef, int rebindIndex)
		{
			_rebindingOperation = InputActionRebindingExtensions.PerformInteractiveRebinding(inputActionRef.action, rebindIndex).OnMatchWaitForAnother(0.1f).WithControlsHavingToMatchPath("<Gamepad>")
				.OnComplete((Action<RebindingOperation>)delegate(RebindingOperation operation)
				{
					OnRebindComplete(operation, this);
				})
				.Start();
		}

		private static void OnRebindComplete(RebindingOperation operation, RebindButton instance)
		{
			if (operation.completed)
			{
				if (instance._isBaseGame)
				{
					BaseGameUnsavedChanges();
				}
				MarkSettingsAsDirty();
				instance.FinishRebinding();
			}
		}

		private static void BaseGameUnsavedChanges()
		{
			IngamePlayerSettings.Instance.unsavedSettings.keyBindings = InputActionRebindingExtensions.SaveBindingOverridesAsJson((IInputActionCollection2)(object)IngamePlayerSettings.Instance.playerInput.actions);
		}

		private static void MarkSettingsAsDirty()
		{
			if ((object)_setChangesNotAppliedMethodInfo == null)
			{
				_setChangesNotAppliedMethodInfo = AccessTools.Method(typeof(IngamePlayerSettings), "SetChangesNotAppliedTextVisible", (Type[])null, (Type[])null);
			}
			_setChangesNotAppliedMethodInfo.Invoke(IngamePlayerSettings.Instance, new object[1] { true });
		}

		public static void ReloadGlyphs()
		{
			foreach (RebindButton instance in Instances)
			{
				instance.UpdateState();
			}
		}

		public static void ResetAllToDefaults()
		{
			foreach (RebindButton instance in Instances)
			{
				instance.ResetToDefault();
			}
		}
	}
	public class RebindIndicator : MonoBehaviour
	{
		public TextMeshProUGUI? label;

		public int maxTicks = 5;

		public float timeBetweenTicks = 1f;

		private int _ticks = 1;

		private float _timer;

		private void OnEnable()
		{
			_ticks = 1;
			_timer = timeBetweenTicks;
			((TMP_Text)label).SetText(GetText(), true);
		}

		private void OnDisable()
		{
			_ticks = 1;
			_timer = timeBetweenTicks;
			((TMP_Text)label).SetText("", true);
		}

		private void Update()
		{
			_timer -= Time.unscaledDeltaTime;
			if (!(_timer > 0f))
			{
				_ticks++;
				if (_ticks > maxTicks)
				{
					_ticks = 1;
				}
				((TMP_Text)label).SetText(GetText(), true);
				_timer = timeBetweenTicks;
			}
		}

		private string GetText()
		{
			string text = "";
			for (int i = 0; i < _ticks; i++)
			{
				text += ".";
			}
			return text;
		}
	}
	public class RebindItem : MonoBehaviour
	{
		public TextMeshProUGUI? controlNameLabel;

		public RebindButton? kbmButton;

		public RebindButton? gamepadButton;

		public void SetBind(string controlName, RemappableKey? kbmKey, RemappableKey? gamepadKey, bool isBaseGame = false)
		{
			if (controlNameLabel != null)
			{
				((TMP_Text)controlNameLabel).SetText(controlName, true);
				if (kbmButton != null)
				{
					kbmButton.SetKey(kbmKey, isBaseGame);
				}
				if (gamepadButton != null)
				{
					gamepadButton.SetKey(gamepadKey, isBaseGame);
				}
			}
		}
	}
	public class RemapContainerController : MonoBehaviour
	{
		public BindsListController? bindsList;

		public SectionListController? sectionList;

		public Button? backButton;

		public Button? legacyButton;

		public GameObject? legacyHolder;

		public List<RemappableKey> baseGameKeys = new List<RemappableKey>();

		internal int LayerShown;

		private void Awake()
		{
			if (bindsList == null)
			{
				bindsList = ((Component)this).GetComponentInChildren<BindsListController>();
			}
			if (sectionList == null)
			{
				sectionList = ((Component)this).GetComponentInChildren<SectionListController>();
			}
			bindsList.OnSectionChanged.AddListener((UnityAction<int>)HandleSectionChanged);
			LcInputActionApi.ContainerInstance = this;
		}

		public void JumpTo(int sectionIndex)
		{
			if (bindsList != null)
			{
				bindsList.JumpTo(sectionIndex);
			}
		}

		public void LoadUi()
		{
			GenerateBaseGameSection();
			GenerateApiSections();
			FinishUi();
		}

		private void GenerateBaseGameSection()
		{
			if (bindsList == null || sectionList == null)
			{
				return;
			}
			Dictionary<string, (RemappableKey, RemappableKey)> dictionary = new Dictionary<string, (RemappableKey, RemappableKey)>();
			string key;
			foreach (RemappableKey baseGameKey in baseGameKeys)
			{
				RemappableKey item = null;
				RemappableKey item2 = null;
				string text = baseGameKey.ControlName.ToLower();
				if (text.StartsWith("walk"))
				{
					key = text;
					text = "move" + key.Substring(4, key.Length - 4);
				}
				baseGameKey.ControlName = baseGameKey.ControlName.Replace("primary", "Primary");
				if (dictionary.TryGetValue(text, out var value))
				{
					if (baseGameKey.gamepadOnly)
					{
						(item, _) = value;
					}
					else
					{
						item2 = value.Item2;
					}
				}
				if (baseGameKey.gamepadOnly)
				{
					item2 = baseGameKey;
				}
				else
				{
					item = baseGameKey;
				}
				dictionary[text] = (item, item2);
			}
			bindsList.AddSection("Lethal Company");
			sectionList.AddSection("Lethal Company");
			foreach (KeyValuePair<string, (RemappableKey, RemappableKey)> item3 in dictionary)
			{
				item3.Deconstruct(out key, out var value2);
				var (kbmKey, gamepadKey) = value2;
				bindsList.AddBinds(kbmKey, gamepadKey, isBaseGame: true);
			}
		}

		public void OnSetToDefault()
		{
			RebindButton.ResetAllToDefaults();
		}

		public void HideHighestLayer()
		{
			if (backButton != null && legacyHolder != null)
			{
				if (LayerShown > 1)
				{
					legacyHolder.SetActive(false);
					LayerShown--;
				}
				else if (LayerShown > 0)
				{
					((UnityEvent)backButton.onClick).Invoke();
				}
			}
		}

		public void ShowLegacyUi()
		{
			if (((Behaviour)this).isActiveAndEnabled && legacyHolder != null)
			{
				legacyHolder.SetActive(true);
				LayerShown++;
			}
		}

		private void GenerateApiSections()
		{
			//IL_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			if (bindsList == null || sectionList == null)
			{
				return;
			}
			foreach (IGrouping<string, LcInputActions> item in from lc in LcInputActionApi.InputActions
				group lc by lc.Plugin.Name)
			{
				bindsList.AddSection(item.Key);
				sectionList.AddSection(item.Key);
				foreach (LcInputActions item2 in item)
				{
					if (item2.Loaded)
					{
						continue;
					}
					foreach (InputActionReference actionRef in item2.ActionRefs)
					{
						InputAction action = actionRef.action;
						InputBinding val = ((IEnumerable<InputBinding>)(object)action.bindings).First();
						string name = ((InputBinding)(ref val)).name;
						RemappableKey kbmKey = new RemappableKey
						{
							ControlName = name,
							currentInput = actionRef,
							rebindingIndex = 0,
							gamepadOnly = false
						};
						RemappableKey val2 = new RemappableKey
						{
							ControlName = name,
							currentInput = actionRef,
							rebindingIndex = 1,
							gamepadOnly = true
						};
						if (action.IsGamepadOnly())
						{
							val2.rebindingIndex = 0;
							bindsList.AddBinds(null, val2);
						}
						else
						{
							bindsList.AddBinds(kbmKey, val2);
						}
					}
					item2.Loaded = true;
				}
			}
		}

		private void FinishUi()
		{
			if (bindsList != null)
			{
				bindsList.AddFooter();
				JumpTo(0);
			}
		}

		private void HandleSectionChanged(int sectionIndex)
		{
			if (sectionList != null && bindsList != null)
			{
				sectionList.SelectSection(sectionIndex);
			}
		}

		private void OnEnable()
		{
			JumpTo(0);
			LayerShown = 1;
		}

		private void OnDisable()
		{
			LcInputActionApi.ReEnableFromRebind();
			LayerShown = 0;
		}

		private void OnDestroy()
		{
			LcInputActionApi.ContainerInstance = null;
			LayerShown = 0;
		}
	}
}
namespace LethalCompanyInputUtils.Components.Section
{
	[RequireComponent(typeof(Button), typeof(RectTransform))]
	public class SectionEntry : MonoBehaviour
	{
		public TextMeshProUGUI? indicator;

		public TextMeshProUGUI? label;

		public Button? button;

		public int sectionIndex;

		public UnityEvent<int> OnEntrySelected = new UnityEvent<int>();

		private RectTransform? _rectTransform;

		public RectTransform RectTransform
		{
			get
			{
				if (_rectTransform == null)
				{
					_rectTransform = ((Component)this).GetComponent<RectTransform>();
				}
				return _rectTransform;
			}
		}

		private void Awake()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			if (button == null)
			{
				button = ((Component)this).GetComponent<Button>();
			}
			((UnityEvent)button.onClick).AddListener(new UnityAction(SelectEntry));
		}

		public void SetText(string text)
		{
			if (label != null)
			{
				((TMP_Text)label).SetText(text, true);
			}
		}

		public void SetIndicator(bool indicated)
		{
			if (indicator != null)
			{
				((Behaviour)indicator).enabled = indicated;
			}
		}

		private void SelectEntry()
		{
			OnEntrySelected.Invoke(sectionIndex);
		}
	}
	[RequireComponent(typeof(RectTransform))]
	public class SectionHeader : MonoBehaviour
	{
		public SectionHeaderAnchor? anchor;

		public TextMeshProUGUI? label;

		private RectTransform? _rectTransform;

		public RectTransform RectTransform
		{
			get
			{
				if (_rectTransform == null)
				{
					_rectTransform = ((Component)this).GetComponent<RectTransform>();
				}
				return _rectTransform;
			}
		}

		public void SetText(string text)
		{
			if (label != null)
			{
				((TMP_Text)label).SetText(text, true);
			}
		}
	}
	[RequireComponent(typeof(RectTransform))]
	public class SectionHeaderAnchor : MonoBehaviour
	{
		public SectionHeader? sectionHeader;

		private RectTransform? _rectTransform;

		public RectTransform RectTransform
		{
			get
			{
				if (_rectTransform == null)
				{
					_rectTransform = ((Component)this).GetComponent<RectTransform>();
				}
				return _rectTransform;
			}
		}

		private void Awake()
		{
			if (_rectTransform == null)
			{
				_rectTransform = ((Component)this).GetComponent<RectTransform>();
			}
		}
	}
	public class SectionListController : MonoBehaviour
	{
		public GameObject? sectionEntryPrefab;

		public ScrollRect? scrollRect;

		public RemapContainerController? remapContainer;

		private RectTransform? _viewport;

		private RectTransform? _content;

		private readonly List<SectionEntry> _sectionEntries = new List<SectionEntry>();

		private void Awake()
		{
			if (remapContainer == null)
			{
				remapContainer = ((Component)this).GetComponentInParent<RemapContainerController>();
			}
			if (scrollRect == null)
			{
				scrollRect = ((Component)this).GetComponentInChildren<ScrollRect>();
			}
			_viewport = scrollRect.viewport;
			_content = scrollRect.content;
		}

		public void AddSection(string sectionName)
		{
			if (_content != null && sectionEntryPrefab != null)
			{
				SectionEntry component = Object.Instantiate<GameObject>(sectionEntryPrefab, (Transform)(object)_content).GetComponent<SectionEntry>();
				component.SetText(sectionName);
				component.sectionIndex = _sectionEntries.Count;
				component.OnEntrySelected.AddListener((UnityAction<int>)OnSectionEntryPressed);
				_sectionEntries.Add(component);
			}
		}

		public void SelectSection(int sectionIndex)
		{
			int count = _sectionEntries.Count;
			if (sectionIndex >= count || sectionIndex < 0)
			{
				return;
			}
			foreach (SectionEntry sectionEntry2 in _sectionEntries)
			{
				sectionEntry2.SetIndicator(indicated: false);
			}
			SectionEntry sectionEntry = _sectionEntries[sectionIndex];
			sectionEntry.SetIndicator(indicated: true);
			if (scrollRect != null)
			{
				UpdateScrollPosToFit(sectionEntry);
			}
		}

		private void UpdateScrollPosToFit(SectionEntry sectionEntry)
		{
			//IL_006d: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			if (_viewport == null || _content == null || scrollRect == null)
			{
				return;
			}
			RectTransform rectTransform = sectionEntry.RectTransform;
			float num = rectTransform.WorldMinY();
			float num2 = rectTransform.WorldMaxY();
			float num3 = _viewport.WorldMinY();
			float num4 = _viewport.WorldMaxY();
			if (!(num > num3) || !(num2 < num4))
			{
				scrollRect.StopMovement();
				float num5 = 0f;
				if (num2 > num4)
				{
					num5 = num4 - num2 - rectTransform.sizeDelta.y;
				}
				else if (num < num3)
				{
					num5 = num3 - num + rectTransform.sizeDelta.y;
				}
				float y = _content.anchoredPosition.y;
				_content.SetAnchoredPosY(y + num5);
			}
		}

		private void OnSectionEntryPressed(int sectionIndex)
		{
			if (remapContainer != null)
			{
				remapContainer.JumpTo(sectionIndex);
			}
		}
	}
}
namespace LethalCompanyInputUtils.Components.PopOvers
{
	[RequireComponent(typeof(RectTransform))]
	public class PopOver : MonoBehaviour
	{
		public enum Placement
		{
			Top,
			Bottom,
			Left,
			Right
		}

		public RectTransform? popOverLayer;

		public PopOverTextContainer? textContainer;

		public RectTransform? pivotPoint;

		public GameObject? background;

		public PopOverArrow? arrow;

		public CanvasGroup? canvasGroup;

		public float maxWidth = 300f;

		private RectTransform? _rectTransform;

		private RectTransform? _target;

		private Placement _placement;

		public void SetTarget(RectTransform target, Placement placement)
		{
			if (background != null && canvasGroup != null)
			{
				background.SetActive(true);
				_target = target;
				_placement = placement;
				SetPivot();
				SetArrow();
			}
		}

		public void ClearTarget()
		{
			if (background != null && canvasGroup != null)
			{
				canvasGroup.alpha = 0f;
				_target = null;
				background.SetActive(false);
			}
		}

		private void MoveTo(RectTransform target)
		{
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0034: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (pivotPoint != null)
			{
				Vector3 val = Vector2.op_Implicit(GetTargetPosition(target));
				Vector3 val2 = Vector2.op_Implicit(GetTargetPivotOffset(target));
				Vector3 val3 = Vector2.op_Implicit(GetLabelPivotOffset());
				Vector3 targetPos = val + val2 + val3;
				MovePopOverToTarget(targetPos);
				AdjustArrowPosToTarget(target);
			}
		}

		private void SetPivot()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (pivotPoint != null)
			{
				RectTransform val = pivotPoint;
				val.pivot = (Vector2)(_placement switch
				{
					Placement.Top => new Vector2(0.5f, 0f), 
					Placement.Bottom => new Vector2(0.5f, 1f), 
					Placement.Left => new Vector2(1f, 0.5f), 
					Placement.Right => new Vector2(0f, 0.5f), 
					_ => throw new ArgumentOutOfRangeException(), 
				});
			}
		}

		private void SetArrow()
		{
			if (arrow != null)
			{
				switch (_placement)
				{
				case Placement.Top:
					arrow.PointToBottom();
					break;
				case Placement.Bottom:
					arrow.PointToTop();
					break;
				case Placement.Left:
					arrow.PointToRight();
					break;
				case Placement.Right:
					arrow.PointToLeft();
					break;
				default:
					throw new ArgumentOutOfRangeException();
				}
			}
		}

		private Vector2 GetTargetPosition(RectTransform target)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (popOverLayer == null)
			{
				return Vector2.zero;
			}
			return popOverLayer.WorldToLocalPoint(target);
		}

		private Vector2 GetTargetPivotOffset(RectTransform target)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_009c: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if (popOverLayer == null)
			{
				return Vector2.zero;
			}
			Rect relativeRect = popOverLayer.GetRelativeRect(target);
			return (Vector2)(_placement switch
			{
				Placement.Top => new Vector2(0f, 2f + ((Rect)(ref relativeRect)).height / 2f), 
				Placement.Bottom => new Vector2(0f, -2f + (0f - ((Rect)(ref relativeRect)).height) / 2f), 
				Placement.Left => new Vector2(-2f + (0f - ((Rect)(ref relativeRect)).width) / 2f, 0f), 
				Placement.Right => new Vector2(2f + ((Rect)(ref relativeRect)).width / 2f, 0f), 
				_ => throw new ArgumentOutOfRangeException(), 
			});
		}

		private Vector2 GetLabelPivotOffset()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			if (textContainer == null || textContainer.rectTransform == null || _rectTransform == null || popOverLayer == null)
			{
				return Vector2.zero;
			}
			Rect relativeRect = popOverLayer.GetRelativeRect(_rectTransform);
			Rect relativeRect2 = popOverLayer.GetRelativeRect(textContainer.rectTransform);
			return (Vector2)(_placement switch
			{
				Placement.Top => new Vector2(0f, 0f - (((Rect)(ref relativeRect)).height - ((Rect)(ref relativeRect2)).height) / 2f), 
				Placement.Bottom => new Vector2(0f, (((Rect)(ref relativeRect)).height - ((Rect)(ref relativeRect2)).height) / 2f), 
				Placement.Left => new Vector2((((Rect)(ref relativeRect)).width - ((Rect)(ref relativeRect2)).width) / 2f, 0f), 
				Placement.Right => new Vector2(0f - (((Rect)(ref relativeRect)).width - ((Rect)(ref relativeRect2)).width) / 2f, 0f), 
				_ => throw new ArgumentOutOfRangeException(), 
			});
		}

		private void MovePopOverToTarget(Vector3 targetPos)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0039: 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)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid 

plugins/LethalConfig/LethalConfig.dll

Decompiled 7 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalConfig.AutoConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalConfig.Mods;
using LethalConfig.MonoBehaviours;
using LethalConfig.MonoBehaviours.Components;
using LethalConfig.MonoBehaviours.Managers;
using LethalConfig.Settings;
using LethalConfig.Utils;
using Newtonsoft.Json;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[CompilerGenerated]
[EditorBrowsable(EditorBrowsableState.Never)]
[GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)]
internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
{
	private struct MonoScriptData
	{
		public byte[] FilePathsData;

		public byte[] TypesData;

		public int TotalTypes;

		public int TotalFiles;

		public bool IsEditorOnly;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static MonoScriptData Get()
	{
		MonoScriptData result = default(MonoScriptData);
		result.FilePathsData = new byte[3641]
		{
			0, 0, 0, 2, 0, 0, 0, 49, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 65, 117, 116, 111, 67, 111,
			110, 102, 105, 103, 92, 65, 117, 116, 111, 67,
			111, 110, 102, 105, 103, 71, 101, 110, 101, 114,
			97, 116, 111, 114, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 45, 92, 65, 115, 115, 101,
			116, 115, 92, 83, 99, 114, 105, 112, 116, 115,
			92, 65, 117, 116, 111, 67, 111, 110, 102, 105,
			103, 92, 67, 111, 110, 102, 105, 103, 69, 110,
			116, 114, 121, 80, 97, 116, 104, 46, 99, 115,
			0, 0, 0, 2, 0, 0, 0, 45, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 67, 111, 110, 102, 105, 103,
			73, 116, 101, 109, 115, 92, 66, 97, 115, 101,
			67, 111, 110, 102, 105, 103, 73, 116, 101, 109,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			53, 92, 65, 115, 115, 101, 116, 115, 92, 83,
			99, 114, 105, 112, 116, 115, 92, 67, 111, 110,
			102, 105, 103, 73, 116, 101, 109, 115, 92, 66,
			111, 111, 108, 67, 104, 101, 99, 107, 66, 111,
			120, 67, 111, 110, 102, 105, 103, 73, 116, 101,
			109, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 53, 92, 65, 115, 115, 101, 116, 115, 92,
			83, 99, 114, 105, 112, 116, 115, 92, 67, 111,
			110, 102, 105, 103, 73, 116, 101, 109, 115, 92,
			69, 110, 117, 109, 68, 114, 111, 112, 68, 111,
			119, 110, 67, 111, 110, 102, 105, 103, 73, 116,
			101, 109, 46, 99, 115, 0, 0, 0, 1, 0,
			0, 0, 56, 92, 65, 115, 115, 101, 116, 115,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 67,
			111, 110, 102, 105, 103, 73, 116, 101, 109, 115,
			92, 70, 108, 111, 97, 116, 73, 110, 112, 117,
			116, 70, 105, 101, 108, 100, 67, 111, 110, 102,
			105, 103, 73, 116, 101, 109, 46, 99, 115, 0,
			0, 0, 1, 0, 0, 0, 52, 92, 65, 115,
			115, 101, 116, 115, 92, 83, 99, 114, 105, 112,
			116, 115, 92, 67, 111, 110, 102, 105, 103, 73,
			116, 101, 109, 115, 92, 70, 108, 111, 97, 116,
			83, 108, 105, 100, 101, 114, 67, 111, 110, 102,
			105, 103, 73, 116, 101, 109, 46, 99, 115, 0,
			0, 0, 1, 0, 0, 0, 56, 92, 65, 115,
			115, 101, 116, 115, 92, 83, 99, 114, 105, 112,
			116, 115, 92, 67, 111, 110, 102, 105, 103, 73,
			116, 101, 109, 115, 92, 70, 108, 111, 97, 116,
			83, 116, 101, 112, 83, 108, 105, 100, 101, 114,
			67, 111, 110, 102, 105, 103, 73, 116, 101, 109,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			54, 92, 65, 115, 115, 101, 116, 115, 92, 83,
			99, 114, 105, 112, 116, 115, 92, 67, 111, 110,
			102, 105, 103, 73, 116, 101, 109, 115, 92, 71,
			101, 110, 101, 114, 105, 99, 66, 117, 116, 116,
			111, 110, 67, 111, 110, 102, 105, 103, 73, 116,
			101, 109, 46, 99, 115, 0, 0, 0, 1, 0,
			0, 0, 54, 92, 65, 115, 115, 101, 116, 115,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 67,
			111, 110, 102, 105, 103, 73, 116, 101, 109, 115,
			92, 73, 110, 116, 73, 110, 112, 117, 116, 70,
			105, 101, 108, 100, 67, 111, 110, 102, 105, 103,
			73, 116, 101, 109, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 50, 92, 65, 115, 115, 101,
			116, 115, 92, 83, 99, 114, 105, 112, 116, 115,
			92, 67, 111, 110, 102, 105, 103, 73, 116, 101,
			109, 115, 92, 73, 110, 116, 83, 108, 105, 100,
			101, 114, 67, 111, 110, 102, 105, 103, 73, 116,
			101, 109, 46, 99, 115, 0, 0, 0, 1, 0,
			0, 0, 50, 92, 65, 115, 115, 101, 116, 115,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 67,
			111, 110, 102, 105, 103, 73, 116, 101, 109, 115,
			92, 79, 112, 116, 105, 111, 110, 115, 92, 66,
			97, 115, 101, 79, 112, 116, 105, 111, 110, 115,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			55, 92, 65, 115, 115, 101, 116, 115, 92, 83,
			99, 114, 105, 112, 116, 115, 92, 67, 111, 110,
			102, 105, 103, 73, 116, 101, 109, 115, 92, 79,
			112, 116, 105, 111, 110, 115, 92, 66, 97, 115,
			101, 82, 97, 110, 103, 101, 79, 112, 116, 105,
			111, 110, 115, 46, 99, 115, 0, 0, 0, 1,
			0, 0, 0, 58, 92, 65, 115, 115, 101, 116,
			115, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			67, 111, 110, 102, 105, 103, 73, 116, 101, 109,
			115, 92, 79, 112, 116, 105, 111, 110, 115, 92,
			66, 111, 111, 108, 67, 104, 101, 99, 107, 66,
			111, 120, 79, 112, 116, 105, 111, 110, 115, 46,
			99, 115, 0, 0, 0, 1, 0, 0, 0, 54,
			92, 65, 115, 115, 101, 116, 115, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 67, 111, 110, 102,
			105, 103, 73, 116, 101, 109, 115, 92, 79, 112,
			116, 105, 111, 110, 115, 92, 67, 97, 110, 77,
			111, 100, 105, 102, 121, 82, 101, 115, 117, 108,
			116, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 58, 92, 65, 115, 115, 101, 116, 115, 92,
			83, 99, 114, 105, 112, 116, 115, 92, 67, 111,
			110, 102, 105, 103, 73, 116, 101, 109, 115, 92,
			79, 112, 116, 105, 111, 110, 115, 92, 69, 110,
			117, 109, 68, 114, 111, 112, 68, 111, 119, 110,
			79, 112, 116, 105, 111, 110, 115, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 61, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 67, 111, 110, 102, 105, 103,
			73, 116, 101, 109, 115, 92, 79, 112, 116, 105,
			111, 110, 115, 92, 70, 108, 111, 97, 116, 73,
			110, 112, 117, 116, 70, 105, 101, 108, 100, 79,
			112, 116, 105, 111, 110, 115, 46, 99, 115, 0,
			0, 0, 1, 0, 0, 0, 57, 92, 65, 115,
			115, 101, 116, 115, 92, 83, 99, 114, 105, 112,
			116, 115, 92, 67, 111, 110, 102, 105, 103, 73,
			116, 101, 109, 115, 92, 79, 112, 116, 105, 111,
			110, 115, 92, 70, 108, 111, 97, 116, 83, 108,
			105, 100, 101, 114, 79, 112, 116, 105, 111, 110,
			115, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 61, 92, 65, 115, 115, 101, 116, 115, 92,
			83, 99, 114, 105, 112, 116, 115, 92, 67, 111,
			110, 102, 105, 103, 73, 116, 101, 109, 115, 92,
			79, 112, 116, 105, 111, 110, 115, 92, 70, 108,
			111, 97, 116, 83, 116, 101, 112, 83, 108, 105,
			100, 101, 114, 79, 112, 116, 105, 111, 110, 115,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			59, 92, 65, 115, 115, 101, 116, 115, 92, 83,
			99, 114, 105, 112, 116, 115, 92, 67, 111, 110,
			102, 105, 103, 73, 116, 101, 109, 115, 92, 79,
			112, 116, 105, 111, 110, 115, 92, 71, 101, 110,
			101, 114, 105, 99, 66, 117, 116, 116, 111, 110,
			79, 112, 116, 105, 111, 110, 115, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 59, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 67, 111, 110, 102, 105, 103,
			73, 116, 101, 109, 115, 92, 79, 112, 116, 105,
			111, 110, 115, 92, 73, 110, 116, 73, 110, 112,
			117, 116, 70, 105, 101, 108, 100, 79, 112, 116,
			105, 111, 110, 115, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 55, 92, 65, 115, 115, 101,
			116, 115, 92, 83, 99, 114, 105, 112, 116, 115,
			92, 67, 111, 110, 102, 105, 103, 73, 116, 101,
			109, 115, 92, 79, 112, 116, 105, 111, 110, 115,
			92, 73, 110, 116, 83, 108, 105, 100, 101, 114,
			79, 112, 116, 105, 111, 110, 115, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 60, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 67, 111, 110, 102, 105, 103,
			73, 116, 101, 109, 115, 92, 79, 112, 116, 105,
			111, 110, 115, 92, 84, 101, 120, 116, 73, 110,
			112, 117, 116, 70, 105, 101, 108, 100, 79, 112,
			116, 105, 111, 110, 115, 46, 99, 115, 0, 0,
			0, 1, 0, 0, 0, 55, 92, 65, 115, 115,
			101, 116, 115, 92, 83, 99, 114, 105, 112, 116,
			115, 92, 67, 111, 110, 102, 105, 103, 73, 116,
			101, 109, 115, 92, 84, 101, 120, 116, 73, 110,
			112, 117, 116, 70, 105, 101, 108, 100, 67, 111,
			110, 102, 105, 103, 73, 116, 101, 109, 46, 99,
			115, 0, 0, 0, 1, 0, 0, 0, 38, 92,
			65, 115, 115, 101, 116, 115, 92, 83, 99, 114,
			105, 112, 116, 115, 92, 76, 101, 116, 104, 97,
			108, 67, 111, 110, 102, 105, 103, 77, 97, 110,
			97, 103, 101, 114, 46, 99, 115, 0, 0, 0,
			2, 0, 0, 0, 37, 92, 65, 115, 115, 101,
			116, 115, 92, 83, 99, 114, 105, 112, 116, 115,
			92, 76, 101, 116, 104, 97, 108, 67, 111, 110,
			102, 105, 103, 80, 108, 117, 103, 105, 110, 46,
			99, 115, 0, 0, 0, 1, 0, 0, 0, 27,
			92, 65, 115, 115, 101, 116, 115, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 77, 111, 100, 115,
			92, 77, 111, 100, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 31, 92, 65, 115, 115, 101,
			116, 115, 92, 83, 99, 114, 105, 112, 116, 115,
			92, 77, 111, 100, 115, 92, 77, 111, 100, 73,
			110, 102, 111, 46, 99, 115, 0, 0, 0, 1,
			0, 0, 0, 44, 92, 65, 115, 115, 101, 116,
			115, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			77, 111, 100, 115, 92, 84, 104, 117, 110, 100,
			101, 114, 115, 116, 111, 114, 101, 77, 97, 110,
			105, 102, 101, 115, 116, 46, 99, 115, 0, 0,
			0, 1, 0, 0, 0, 67, 92, 65, 115, 115,
			101, 116, 115, 92, 83, 99, 114, 105, 112, 116,
			115, 92, 77, 111, 110, 111, 66, 101, 104, 97,
			118, 105, 111, 117, 114, 115, 92, 67, 111, 109,
			112, 111, 110, 101, 110, 116, 115, 92, 66, 111,
			111, 108, 67, 104, 101, 99, 107, 66, 111, 120,
			67, 111, 110, 116, 114, 111, 108, 108, 101, 114,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			67, 92, 65, 115, 115, 101, 116, 115, 92, 83,
			99, 114, 105, 112, 116, 115, 92, 77, 111, 110,
			111, 66, 101, 104, 97, 118, 105, 111, 117, 114,
			115, 92, 67, 111, 109, 112, 111, 110, 101, 110,
			116, 115, 92, 69, 110, 117, 109, 68, 114, 111,
			112, 68, 111, 119, 110, 67, 111, 110, 116, 114,
			111, 108, 108, 101, 114, 46, 99, 115, 0, 0,
			0, 1, 0, 0, 0, 70, 92, 65, 115, 115,
			101, 116, 115, 92, 83, 99, 114, 105, 112, 116,
			115, 92, 77, 111, 110, 111, 66, 101, 104, 97,
			118, 105, 111, 117, 114, 115, 92, 67, 111, 109,
			112, 111, 110, 101, 110, 116, 115, 92, 70, 108,
			111, 97, 116, 73, 110, 112, 117, 116, 70, 105,
			101, 108, 100, 67, 111, 110, 116, 114, 111, 108,
			108, 101, 114, 46, 99, 115, 0, 0, 0, 1,
			0, 0, 0, 66, 92, 65, 115, 115, 101, 116,
			115, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			77, 111, 110, 111, 66, 101, 104, 97, 118, 105,
			111, 117, 114, 115, 92, 67, 111, 109, 112, 111,
			110, 101, 110, 116, 115, 92, 70, 108, 111, 97,
			116, 83, 108, 105, 100, 101, 114, 67, 111, 110,
			116, 114, 111, 108, 108, 101, 114, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 70, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 77, 111, 110, 111, 66, 101,
			104, 97, 118, 105, 111, 117, 114, 115, 92, 67,
			111, 109, 112, 111, 110, 101, 110, 116, 115, 92,
			70, 108, 111, 97, 116, 83, 116, 101, 112, 83,
			108, 105, 100, 101, 114, 67, 111, 110, 116, 114,
			111, 108, 108, 101, 114, 46, 99, 115, 0, 0,
			0, 1, 0, 0, 0, 68, 92, 65, 115, 115,
			101, 116, 115, 92, 83, 99, 114, 105, 112, 116,
			115, 92, 77, 111, 110, 111, 66, 101, 104, 97,
			118, 105, 111, 117, 114, 115, 92, 67, 111, 109,
			112, 111, 110, 101, 110, 116, 115, 92, 71, 101,
			110, 101, 114, 105, 99, 66, 117, 116, 116, 111,
			110, 67, 111, 110, 116, 114, 111, 108, 108, 101,
			114, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 68, 92, 65, 115, 115, 101, 116, 115, 92,
			83, 99, 114, 105, 112, 116, 115, 92, 77, 111,
			110, 111, 66, 101, 104, 97, 118, 105, 111, 117,
			114, 115, 92, 67, 111, 109, 112, 111, 110, 101,
			110, 116, 115, 92, 73, 110, 116, 73, 110, 112,
			117, 116, 70, 105, 101, 108, 100, 67, 111, 110,
			116, 114, 111, 108, 108, 101, 114, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 64, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 77, 111, 110, 111, 66, 101,
			104, 97, 118, 105, 111, 117, 114, 115, 92, 67,
			111, 109, 112, 111, 110, 101, 110, 116, 115, 92,
			73, 110, 116, 83, 108, 105, 100, 101, 114, 67,
			111, 110, 116, 114, 111, 108, 108, 101, 114, 46,
			99, 115, 0, 0, 0, 2, 0, 0, 0, 64,
			92, 65, 115, 115, 101, 116, 115, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 77, 111, 110, 111,
			66, 101, 104, 97, 118, 105, 111, 117, 114, 115,
			92, 67, 111, 109, 112, 111, 110, 101, 110, 116,
			115, 92, 77, 111, 100, 67, 111, 110, 102, 105,
			103, 67, 111, 110, 116, 114, 111, 108, 108, 101,
			114, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 69, 92, 65, 115, 115, 101, 116, 115, 92,
			83, 99, 114, 105, 112, 116, 115, 92, 77, 111,
			110, 111, 66, 101, 104, 97, 118, 105, 111, 117,
			114, 115, 92, 67, 111, 109, 112, 111, 110, 101,
			110, 116, 115, 92, 84, 101, 120, 116, 73, 110,
			112, 117, 116, 70, 105, 101, 108, 100, 67, 111,
			110, 116, 114, 111, 108, 108, 101, 114, 46, 99,
			115, 0, 0, 0, 1, 0, 0, 0, 47, 92,
			65, 115, 115, 101, 116, 115, 92, 83, 99, 114,
			105, 112, 116, 115, 92, 77, 111, 110, 111, 66,
			101, 104, 97, 118, 105, 111, 117, 114, 115, 92,
			67, 111, 110, 102, 105, 103, 73, 110, 102, 111,
			66, 111, 120, 46, 99, 115, 0, 0, 0, 1,
			0, 0, 0, 44, 92, 65, 115, 115, 101, 116,
			115, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			77, 111, 110, 111, 66, 101, 104, 97, 118, 105,
			111, 117, 114, 115, 92, 67, 111, 110, 102, 105,
			103, 76, 105, 115, 116, 46, 99, 115, 0, 0,
			0, 1, 0, 0, 0, 44, 92, 65, 115, 115,
			101, 116, 115, 92, 83, 99, 114, 105, 112, 116,
			115, 92, 77, 111, 110, 111, 66, 101, 104, 97,
			118, 105, 111, 117, 114, 115, 92, 67, 111, 110,
			102, 105, 103, 77, 101, 110, 117, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 56, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 77, 111, 110, 111, 66, 101,
			104, 97, 118, 105, 111, 117, 114, 115, 92, 67,
			111, 110, 102, 105, 103, 77, 101, 110, 117, 78,
			111, 116, 105, 102, 105, 99, 97, 116, 105, 111,
			110, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 48, 92, 65, 115, 115, 101, 116, 115, 92,
			83, 99, 114, 105, 112, 116, 115, 92, 77, 111,
			110, 111, 66, 101, 104, 97, 118, 105, 111, 117,
			114, 115, 92, 68, 101, 115, 99, 114, 105, 112,
			116, 105, 111, 110, 66, 111, 120, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 65, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 77, 111, 110, 111, 66, 101,
			104, 97, 118, 105, 111, 117, 114, 115, 92, 77,
			97, 110, 97, 103, 101, 114, 115, 92, 67, 111,
			110, 102, 105, 103, 77, 101, 110, 117, 65, 117,
			100, 105, 111, 77, 97, 110, 97, 103, 101, 114,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			60, 92, 65, 115, 115, 101, 116, 115, 92, 83,
			99, 114, 105, 112, 116, 115, 92, 77, 111, 110,
			111, 66, 101, 104, 97, 118, 105, 111, 117, 114,
			115, 92, 77, 97, 110, 97, 103, 101, 114, 115,
			92, 67, 111, 110, 102, 105, 103, 77, 101, 110,
			117, 77, 97, 110, 97, 103, 101, 114, 46, 99,
			115, 0, 0, 0, 1, 0, 0, 0, 44, 92,
			65, 115, 115, 101, 116, 115, 92, 83, 99, 114,
			105, 112, 116, 115, 92, 77, 111, 110, 111, 66,
			101, 104, 97, 118, 105, 111, 117, 114, 115, 92,
			77, 111, 100, 73, 110, 102, 111, 66, 111, 120,
			46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
			41, 92, 65, 115, 115, 101, 116, 115, 92, 83,
			99, 114, 105, 112, 116, 115, 92, 77, 111, 110,
			111, 66, 101, 104, 97, 118, 105, 111, 117, 114,
			115, 92, 77, 111, 100, 76, 105, 115, 116, 46,
			99, 115, 0, 0, 0, 1, 0, 0, 0, 45,
			92, 65, 115, 115, 101, 116, 115, 92, 83, 99,
			114, 105, 112, 116, 115, 92, 77, 111, 110, 111,
			66, 101, 104, 97, 118, 105, 111, 117, 114, 115,
			92, 77, 111, 100, 76, 105, 115, 116, 73, 116,
			101, 109, 46, 99, 115, 0, 0, 0, 1, 0,
			0, 0, 47, 92, 65, 115, 115, 101, 116, 115,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 77,
			111, 110, 111, 66, 101, 104, 97, 118, 105, 111,
			117, 114, 115, 92, 83, 101, 99, 116, 105, 111,
			110, 72, 101, 97, 100, 101, 114, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 41, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 77, 111, 110, 111, 66, 101,
			104, 97, 118, 105, 111, 117, 114, 115, 92, 84,
			111, 111, 108, 116, 105, 112, 46, 99, 115, 0,
			0, 0, 1, 0, 0, 0, 47, 92, 65, 115,
			115, 101, 116, 115, 92, 83, 99, 114, 105, 112,
			116, 115, 92, 77, 111, 110, 111, 66, 101, 104,
			97, 118, 105, 111, 117, 114, 115, 92, 84, 111,
			111, 108, 116, 105, 112, 83, 121, 115, 116, 101,
			109, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 48, 92, 65, 115, 115, 101, 116, 115, 92,
			83, 99, 114, 105, 112, 116, 115, 92, 77, 111,
			110, 111, 66, 101, 104, 97, 118, 105, 111, 117,
			114, 115, 92, 84, 111, 111, 108, 116, 105, 112,
			84, 114, 105, 103, 103, 101, 114, 46, 99, 115,
			0, 0, 0, 1, 0, 0, 0, 46, 92, 65,
			115, 115, 101, 116, 115, 92, 83, 99, 114, 105,
			112, 116, 115, 92, 77, 111, 110, 111, 66, 101,
			104, 97, 118, 105, 111, 117, 114, 115, 92, 86,
			101, 114, 115, 105, 111, 110, 76, 97, 98, 101,
			108, 46, 99, 115, 0, 0, 0, 1, 0, 0,
			0, 45, 92, 65, 115, 115, 101, 116, 115, 92,
			83, 99, 114, 105, 112, 116, 115, 92, 80, 97,
			116, 99, 104, 101, 115, 92, 77, 101, 110, 117,
			77, 97, 110, 97, 103, 101, 114, 80, 97, 116,
			99, 104, 101, 115, 46, 99, 115, 0, 0, 0,
			1, 0, 0, 0, 50, 92, 65, 115, 115, 101,
			116, 115, 92, 83, 99, 114, 105, 112, 116, 115,
			92, 80, 97, 116, 99, 104, 101, 115, 92, 81,
			117, 105, 99, 107, 77, 101, 110, 117, 77, 97,
			110, 97, 103, 101, 114, 80, 97, 116, 99, 104,
			101, 115, 46, 99, 115, 0, 0, 0, 1, 0,
			0, 0, 43, 92, 65, 115, 115, 101, 116, 115,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 85,
			116, 105, 108, 115, 92, 65, 115, 115, 101, 109,
			98, 108, 121, 69, 120, 116, 101, 110, 115, 105,
			111, 110, 115, 46, 99, 115, 0, 0, 0, 1,
			0, 0, 0, 31, 92, 65, 115, 115, 101, 116,
			115, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			85, 116, 105, 108, 115, 92, 65, 115, 115, 101,
			116, 115, 46, 99, 115, 0, 0, 0, 1, 0,
			0, 0, 33, 92, 65, 115, 115, 101, 116, 115,
			92, 83, 99, 114, 105, 112, 116, 115, 92, 85,
			116, 105, 108, 115, 92, 76, 111, 103, 85, 116,
			105, 108, 115, 46, 99, 115, 0, 0, 0, 1,
			0, 0, 0, 35, 92, 65, 115, 115, 101, 116,
			115, 92, 83, 99, 114, 105, 112, 116, 115, 92,
			85, 116, 105, 108, 115, 92, 77, 101, 110, 117,
			115, 85, 116, 105, 108, 115, 46, 99, 115, 0,
			0, 0, 1, 0, 0, 0, 34, 92, 65, 115,
			115, 101, 116, 115, 92, 83, 99, 114, 105, 112,
			116, 115, 92, 85, 116, 105, 108, 115, 92, 80,
			97, 116, 104, 85, 116, 105, 108, 115, 46, 99,
			115
		};
		result.TypesData = new byte[3298]
		{
			0, 0, 0, 0, 43, 76, 101, 116, 104, 97,
			108, 67, 111, 110, 102, 105, 103, 46, 65, 117,
			116, 111, 67, 111, 110, 102, 105, 103, 124, 65,
			117, 116, 111, 67, 111, 110, 102, 105, 103, 71,
			101, 110, 101, 114, 97, 116, 111, 114, 0, 0,
			0, 0, 58, 76, 101, 116, 104, 97, 108, 67,
			111, 110, 102, 105, 103, 46, 65, 117, 116, 111,
			67, 111, 110, 102, 105, 103, 46, 65, 117, 116,
			111, 67, 111, 110, 102, 105, 103, 71, 101, 110,
			101, 114, 97, 116, 111, 114, 124, 65, 117, 116,
			111, 67, 111, 110, 102, 105, 103, 73, 116, 101,
			109, 0, 0, 0, 0, 39, 76, 101, 116, 104,
			97, 108, 67, 111, 110, 102, 105, 103, 46, 65,
			117, 116, 111, 67, 111, 110, 102, 105, 103, 124,
			67, 111, 110, 102, 105, 103, 69, 110, 116, 114,
			121, 80, 97, 116, 104, 0, 0, 0, 0, 39,
			76, 101, 116, 104, 97, 108, 67, 111, 110, 102,
			105, 103, 46, 67, 111, 110, 102, 105, 103, 73,
			116, 101, 109, 115, 124, 66, 97, 115, 101, 67,
			111, 110, 102, 105, 103, 73, 116, 101, 109, 0,
			0, 0, 0, 44, 76, 101, 116, 104, 97, 108,
			67, 111, 110, 102, 105, 103, 46, 67, 111, 110,
			102, 105, 103, 73, 116, 101, 109, 115, 124, 66,
			97, 115, 101, 86, 97, 108, 117, 101, 67, 111,
			110, 102, 105, 103, 73, 116, 101, 109, 0, 0,
			0, 0, 47, 76, 101, 116, 104, 97, 108, 67,
			111, 110, 102, 105, 103, 46, 67, 111, 110, 102,
			105, 103, 73, 116, 101, 109, 115, 124, 66, 111,
			111, 108, 67, 104, 101, 99, 107, 66, 111, 120,
			67, 111, 110, 102, 105, 103, 73, 116, 101, 109,
			0, 0, 0, 0, 47, 76, 101, 116, 104, 97,
			108, 67, 111, 110, 102, 105, 103, 46, 67, 111,
			110, 102, 105, 103, 73, 116, 101, 109, 115, 124,
			69, 110, 117, 109, 68, 114, 111, 112, 68, 111,
			119, 110, 67, 111, 110, 102, 105, 103, 73, 116,
			101, 109, 0, 0, 0, 0, 50, 76, 101, 116,
			104, 97, 108, 67, 111, 110, 102, 105, 103, 46,
			67, 111, 110, 102, 105, 103, 73, 116, 101, 109,
			115, 124, 70, 108, 111, 97, 116, 73, 110, 112,
			117, 116, 70, 105, 101, 108, 100, 67, 111, 110,
			102, 105, 103, 73, 116, 101, 109, 0, 0, 0,
			0, 46, 76, 101, 116, 104, 97, 108, 67, 111,
			110, 102, 105, 103, 46, 67, 111, 110, 102, 105,
			103, 73, 116, 101, 109, 115, 124, 70, 108, 111,
			97, 116, 83, 108, 105, 100, 101, 114, 67, 111,
			110, 102, 105, 103, 73, 116, 101, 109, 0, 0,
			0, 0, 50, 76, 101, 116, 104, 97, 108, 67,
			111, 110, 102, 105, 103, 46, 67, 111, 110, 102,
			105, 103, 73, 116, 101, 109, 115, 124, 70, 108,
			111, 97, 116, 83, 116, 101, 112, 83, 108, 105,
			100, 101, 114, 67, 111, 110, 102, 105, 103, 73,
			116, 101, 109, 0, 0, 0, 0, 48, 76, 101,
			116, 104, 97, 108, 67, 111, 110, 102, 105, 103,
			46, 67, 111, 110, 102, 105, 103, 73, 116, 101,
			109, 115, 124, 71, 101, 110, 101, 114, 105, 99,
			66, 117, 116, 116, 111, 110, 67, 111, 110, 102,
			105, 103, 73, 116, 101, 109, 0, 0, 0, 0,
			48, 76, 101, 116, 104, 97, 108, 67, 111, 110,
			102, 105, 103, 46, 67, 111, 110, 102, 105, 103,
			73, 116, 101, 109, 115, 124, 73, 110, 116, 73,
			110, 112, 117, 116, 70, 105, 101, 108, 100, 67,
			111, 110, 102, 105, 103, 73, 116, 101, 109, 0,
			0, 0, 0, 44, 76, 101, 116, 104, 97, 108,
			67, 111, 110, 102, 105, 103, 46, 67, 111, 110,
			102, 105, 103, 73, 116, 101, 109, 115, 124, 73,
			110, 116, 83, 108, 105, 100, 101, 114, 67, 111,
			110, 102, 105, 103, 73, 116, 101, 109, 0, 0,
			0, 0, 44, 76, 101, 116, 104, 97, 108, 67,
			111, 110, 102, 105, 103, 46, 67, 111, 110, 102,
			105, 103, 73, 116, 101, 109, 115, 46, 79, 112,
			116, 105, 111, 110, 115, 124, 66, 97, 115, 101,
			79, 112, 116, 105, 111, 110, 115, 0, 0, 0,
			0, 49, 76, 101, 116, 104, 97, 108, 67, 111,
			110, 102, 105, 103, 46, 67, 111, 110, 102, 105,
			103, 73, 116, 101, 109, 115, 46, 79, 112, 116,
			105, 111, 110, 115, 124, 66, 97, 115, 101, 82,
			97, 110, 103, 101, 79, 112, 116, 105, 111, 110,
			115, 0, 0, 0, 0, 52, 76, 101, 116, 104,
			97, 108, 67, 111, 110, 102, 105, 103, 46, 67,
			111, 110, 102, 105, 103, 73, 116, 101, 109, 115,
			46, 79, 112, 116, 105, 111, 110, 115, 124, 66,
			111, 111, 108, 67, 104, 101, 99, 107, 66, 111,
			120, 79, 112, 116, 105, 111, 110, 115, 0, 0,
			0, 0, 48, 76, 101, 116, 104, 97, 108, 67,
			111, 110, 102, 105, 103, 46, 67, 111, 110, 102,
			105, 103, 73, 116, 101, 109, 115, 46, 79, 112,
			116, 105, 111, 110, 115, 124, 67, 97, 110, 77,
			111, 100, 105, 102, 121, 82, 101, 115, 117, 108,
			116, 0, 0, 0, 0, 52, 76, 101, 116, 104,
			97, 108, 67, 111, 110, 102, 105, 103, 46, 67,
			111, 110, 102, 105, 103, 73, 116, 101, 109, 115,
			46, 79, 112, 116, 105, 111, 110, 115, 124, 69,
			110, 117, 109, 68, 114, 111, 112, 68, 111, 119,
			110, 79, 112, 116, 105, 111, 110, 115, 0, 0,
			0, 0, 55, 76, 101, 116, 104, 97, 108, 67,
			111, 110, 102, 105, 103, 46, 67, 111, 110, 102,
			105, 103, 73, 116, 101, 109, 115, 46, 79, 112,
			116, 105, 111, 110, 115, 124, 70, 108, 111, 97,
			116, 73, 110, 112, 117, 116, 70, 105, 101, 108,
			100, 79, 112, 116, 105, 111, 110, 115, 0, 0,
			0, 0, 51, 76, 101, 116, 104, 97, 108, 67,
			111, 110, 102, 105, 103, 46, 67, 111, 110, 102,
			105, 103, 73, 116, 101, 109, 115, 46, 79, 112,
			116, 105, 111, 110, 115, 124, 70, 108, 111, 97,
			116, 83, 108, 105, 100, 101, 114, 79, 112, 116,
			105, 111, 110, 115, 0, 0, 0, 0, 55, 76,
			101, 116, 104, 97, 108, 67, 111, 110, 102, 105,
			103, 46, 67, 111, 110, 102, 105, 103, 73, 116,
			101, 109, 115, 46, 79, 112, 116, 105, 111, 110,
			115, 124, 70, 108, 111, 97, 116, 83, 116, 101,
			112, 83, 108, 105, 100, 101, 114, 79, 112, 116,
			105, 111, 110, 115, 0, 0, 0, 0, 53, 76,
			101, 116, 104, 97, 108, 67, 111, 110, 102, 105,
			103, 46, 67, 111, 110, 102, 105, 103, 73, 116,
			101, 109, 115, 46, 79, 112, 116, 105, 111, 110,
			115, 124, 71, 101, 110, 101, 114, 105, 99, 66,
			117, 116, 116, 111, 110, 79, 112, 116, 105, 111,
			110, 115, 0, 0, 0, 0, 53, 76, 101, 116,
			104, 97, 108, 67, 111, 110, 102, 105, 103, 46,
			67, 111, 110, 102, 105, 103, 73, 116, 101, 109,
			115, 46, 79, 112, 116, 105, 111, 110, 115, 124,
			73, 110, 116, 73, 110, 112, 117, 116, 70, 105,
			101, 108, 100, 79, 112, 116, 105, 111, 110, 115,
			0, 0, 0, 0, 49, 76, 101, 116, 104, 97,
			108, 67, 111, 110, 102, 105, 103, 46, 67, 111,
			110, 102, 105, 103, 73, 116, 101, 109, 115, 46,
			79, 112, 116, 105, 111, 110, 115, 124, 73, 110,
			116, 83, 108, 105, 100, 101, 114, 79, 112, 116,
			105, 111, 110, 115, 0, 0, 0, 0, 54, 76,
			101, 116, 104, 97, 108, 67, 111, 110, 102, 105,
			103, 46, 67, 111, 110, 102, 105, 103, 73, 116,
			101, 109, 115, 46, 79, 112, 116, 105, 111, 110,
			115, 124, 84, 101, 120, 116, 73, 110, 112, 117,
			116, 70, 105, 101, 108, 100, 79, 112, 116, 105,
			111, 110, 115, 0, 0, 0, 0, 49, 76, 101,
			116, 104, 97, 108, 67, 111, 110, 102, 105, 103,
			46, 67, 111, 110, 102, 105, 103, 73, 116, 101,
			109, 115, 124, 84, 101, 120, 116, 73, 110, 112,
			117, 116, 70, 105, 101, 108, 100, 67, 111, 110,
			102, 105, 103, 73, 116, 101, 109, 0, 0, 0,
			0, 32, 76, 101, 116, 104, 97, 108, 67, 111,
			110, 102, 105, 103, 124, 76, 101, 116, 104, 97,
			108, 67, 111, 110, 102, 105, 103, 77, 97, 110,
			97, 103, 101, 114, 0, 0, 0, 0, 23, 76,
			101, 116, 104, 97, 108, 67, 111, 110, 102, 105,
			103, 124, 80, 108, 117, 103, 105, 110, 73, 110,
			102, 111, 0, 0, 0, 0, 31, 76, 101, 116,
			104, 97, 108, 67, 111, 110, 102, 105, 103, 124,
			76, 101, 116, 104, 97, 108, 67, 111, 110, 102,
			105, 103, 80, 108, 117, 103, 105, 110, 0, 0,
			0, 0, 21, 76, 101, 116, 104, 97, 108, 67,
			111, 110, 102, 105, 103, 46, 77, 111, 100, 115,
			124, 77, 111, 100, 0, 0, 0, 0, 25, 76,
			101, 116, 104, 97, 108, 67, 111, 110, 102, 105,
			103, 46, 77, 111, 100, 115, 124, 77, 111, 100,
			73, 110, 102, 111, 0, 0, 0, 0, 38, 76,
			101, 116, 104, 97, 108, 67, 111, 110, 102, 105,
			103, 46, 77, 111, 100, 115, 124, 84, 104, 117,
			110, 100, 101, 114, 115, 116, 111, 114, 101, 77,
			97, 110, 105, 102, 101, 115, 116, 0, 0, 0,
			0, 61, 76, 101, 116, 104, 97, 108, 67, 111,
			110, 102, 105, 103, 46, 77, 111, 110, 111, 66,
			101, 104, 97, 118, 105, 111, 117, 114, 115, 46,
			67, 111, 109, 112, 111, 110, 101, 110, 116, 115,
			124, 66, 111, 111, 108, 67, 104, 101, 99, 107,
			66, 111, 120, 67, 111, 110, 116, 114, 111, 108,
			108, 101, 114, 0, 0, 0, 0, 61, 76, 101,
			116, 104, 97, 108, 67, 111, 110, 102, 105, 103,
			46, 77, 111, 110, 111, 66, 101, 104, 97, 118,
			105, 111, 117, 114, 115, 46, 67, 111, 109, 112,
			111, 110, 101, 110, 116, 115, 124, 69, 110, 117,
			109, 68, 114, 111, 112, 68, 111, 119, 110, 67,
			111, 110, 116, 114, 111, 108, 108, 101, 114, 0,
			0, 0, 0, 64, 76, 101, 116, 104, 97, 108,
			67, 111, 110, 102, 105, 103, 46, 77, 111, 110,
			111, 66, 101, 104, 97, 118, 105, 111, 117, 114,
			115, 46, 67, 111, 109, 112, 111, 110, 101, 110,
			116, 115, 124, 70, 108, 111, 97, 116, 73, 110,
			112, 117, 116, 70, 105, 101, 108, 100, 67, 111,
			110, 116, 114, 111, 108, 108, 101, 114, 0, 0,
			0, 0, 60, 76, 101, 116, 104, 97, 108, 67,
			111, 110, 102, 105, 103, 46, 77, 111, 110, 111,
			66, 101, 104, 97, 118, 105, 111, 117, 114, 115,
			46, 67, 111, 109, 112, 111, 110, 101, 110, 116,
			115, 124, 70, 108, 111, 97, 116, 83, 108, 105,
			100, 101, 114, 67, 111, 110, 116, 114, 111, 108,
			108, 101, 114, 0, 0, 0, 0, 64, 76, 101,
			116, 104, 97, 108, 67, 111, 110, 102, 105, 103,
			46, 77, 111, 110, 111, 66, 101, 104, 97, 118,
			105, 111, 117, 114, 115, 46, 67, 111, 109, 112,
			111, 110, 101, 110, 116, 115, 124, 70, 108, 111,
			97, 116, 83, 116, 101, 112, 83, 108, 105, 100,
			101, 114, 67, 111, 110, 116, 114, 111, 108, 108,
			101, 114, 0, 0, 0, 0, 62, 76, 101, 116,
			104, 97, 108, 67, 111, 110, 102, 105, 103, 46,
			77, 111, 110, 111, 66, 101, 104, 97, 118, 105,
			111, 117, 114, 115, 46, 67, 111, 109, 112, 111,
			110, 101, 110, 116, 115, 124, 71, 101, 110, 101,
			114, 105, 99, 66, 117, 116, 116, 111, 110, 67,
			111, 110, 116, 114, 111, 108, 108, 101, 114, 0,
			0, 0, 0, 62, 76, 101, 116, 104, 97, 108,
			67, 111, 110, 102, 105, 103, 46, 77, 111, 110,
			111, 66, 101, 104, 97, 118, 105, 111, 117, 114,
			115, 46, 67, 111, 109, 112, 111, 110, 101, 110,
			116, 115, 124, 73, 110, 116, 73, 110, 112, 117,
			116, 70, 105, 101, 108, 100, 67, 111, 110, 116,
			114, 111, 108, 108, 101, 114, 0, 0, 0, 0,
			58, 76, 101, 116, 104, 97, 108, 67, 111, 110,
			102, 105, 103, 46, 77, 111, 110, 111, 66, 101,
			104, 97, 118, 105, 111, 117, 114, 115, 46, 67,
			111, 109, 112, 111, 110, 101, 110, 116, 115, 124,
			73, 110, 116, 83, 108, 105, 100, 101, 114, 67,
			111, 110, 116, 114, 111, 108, 108, 101, 114, 1,
			0, 0, 0, 58, 76, 101, 116, 104, 97, 108,
			67, 111, 110, 102, 105, 103, 46, 77, 111, 110,
			111, 66, 101, 104, 97, 118, 105, 111, 117, 114,
			115, 46, 67, 111, 109, 112, 111, 110, 101, 110,
			116, 115, 124, 77, 111, 100, 67, 111, 110, 102,
			105, 103, 67, 111, 110, 116, 114, 111, 108, 108,
			101, 114, 1, 0, 0, 0, 58, 76, 101, 116,
			104, 97, 108, 67, 111, 110, 102, 105, 103, 46,
			77, 111, 110, 111, 66, 101, 104, 97, 118, 105,
			111, 117, 114, 115, 46, 67, 111, 109, 112, 111,
			110, 101, 110, 116, 115, 124, 77, 111, 100, 67,
			111, 110, 102, 105, 103, 67, 111, 110, 116, 114,
			111, 108, 108, 101, 114, 0, 0, 0, 0, 63,
			76, 101, 116, 104, 97, 108, 67, 111, 110, 102,
			105, 103, 46, 77, 111, 110, 111, 66, 101, 104,
			97, 118, 105, 111, 117, 114, 115, 46, 67, 111,
			109, 112, 111, 110, 101, 110, 116, 115, 124, 84,
			101, 120, 116, 73, 110, 112, 117, 116, 70, 105,
			101, 108, 100, 67, 111, 110, 116, 114, 111, 108,
			108, 101, 114, 0, 0, 0, 0, 41, 76, 101,
			116, 104, 97, 108, 67, 111, 110, 102, 105, 103,
			46, 77, 111, 110, 111, 66, 101, 104, 97, 118,
			105, 111, 117, 114, 115, 124, 67, 111, 110, 102,
			105, 103, 73, 110, 102, 111, 66, 111, 120, 0,
			0, 0, 0, 38, 76, 101, 116, 104, 97, 108,
			67, 111, 110, 102, 105, 103, 46, 77, 111, 110,
			111, 66, 101, 104, 97, 118, 105, 111, 117, 114,
			115, 124, 67, 111, 110, 102, 105, 103, 76, 105,
			115, 116, 0, 0, 0, 0, 38, 76, 101, 116,
			104, 97, 108, 67, 111, 110, 102, 105, 103, 46,
			77, 111, 110, 111, 66, 101, 104, 97, 118, 105,
			111, 117, 114, 115, 124, 67, 111, 110, 102, 105,
			103, 77, 101, 110, 117, 0, 0, 0, 0, 50,
			76, 101, 116, 104, 97, 108, 67, 111, 110, 102,
			105, 103, 46, 77, 111, 110, 111, 66, 101, 104,
			97, 118, 105, 111, 117, 114, 115, 124, 67, 111,
			110, 102, 105, 103, 77, 101, 110, 117, 78, 111,
			116, 105, 102, 105, 99, 97, 116, 105, 111, 110,
			0, 0, 0, 0, 42, 76, 101, 116, 104, 97,
			108, 67, 111, 110, 102, 105, 103, 46, 77, 111,
			110, 111, 66, 101, 104, 97, 118, 105, 111, 117,
			114, 115, 124, 68, 101, 115, 99, 114, 105, 112,
			116, 105, 111, 110, 66, 111, 120, 0, 0, 0,
			0, 59, 76, 101, 116, 104, 97, 108, 67, 111,
			110, 102, 105, 103, 46, 77, 111, 110, 111, 66,
			101, 104, 97, 118, 105, 111, 117, 114, 115, 46,
			77, 97, 110, 97, 103, 101, 114, 115, 124, 67,
			111, 110, 102, 105, 103, 77, 101, 110, 117, 65,
			117, 100, 105, 111, 77, 97, 110, 97, 103, 101,
			114, 0, 0, 0, 0, 54, 76, 101, 116, 104,
			97, 108, 67, 111, 110, 102, 105, 103, 46, 77,
			111, 110, 111, 66, 101, 104, 97, 118, 105, 111,
			117, 114, 115, 46, 77, 97, 110, 97, 103, 101,
			114, 115, 124, 67, 111, 110, 102, 105, 103, 77,
			101, 110, 117, 77, 97, 110, 97, 103, 101, 114,
			0, 0, 0, 0, 38, 76, 101, 116, 104, 97,
			108, 67, 111, 110, 102, 105, 103, 46, 77, 111,
			110, 111, 66, 101, 104, 97, 118, 105, 111, 117,
			114, 115, 124, 77, 111, 100, 73, 110, 102, 111,
			66, 111, 120, 0, 0, 0, 0, 35, 76, 101,
			116, 104, 97, 108, 67, 111, 110, 102, 105, 103,
			46, 77, 111, 110, 111, 66, 101, 104, 97, 118,
			105, 111, 117, 114, 115, 124, 77, 111, 100, 76,
			105, 115, 116, 0, 0, 0, 0, 39, 76, 101,
			116, 104, 97, 108, 67, 111, 110, 102, 105, 103,
			46, 77, 111, 110, 111, 66, 101, 104, 97, 118,
			105, 111, 117, 114, 115, 124, 77, 111, 100, 76,
			105, 115, 116, 73, 116, 101, 109, 0, 0, 0,
			0, 41, 76, 101, 116, 104, 97, 108, 67, 111,
			110, 102, 105, 103, 46, 77, 111, 110, 111, 66,
			101, 104, 97, 118, 105, 111, 117, 114, 115, 124,
			83, 101, 99, 116, 105, 111, 110, 72, 101, 97,
			100, 101, 114, 0, 0, 0, 0, 35, 76, 101,
			116, 104, 97, 108, 67, 111, 110, 102, 105, 103,
			46, 77, 111, 110, 111, 66, 101, 104, 97, 118,
			105, 111, 117, 114, 115, 124, 84, 111, 111, 108,
			116, 105, 112, 0, 0, 0, 0, 41, 76, 101,
			116, 104, 97, 108, 67, 111, 110, 102, 105, 103,
			46, 77, 111, 110, 111, 66, 101, 104, 97, 118,
			105, 111, 117, 114, 115, 124, 84, 111, 111, 108,
			116, 105, 112, 83, 121, 115, 116, 101, 109, 0,
			0, 0, 0, 42, 76, 101, 116, 104, 97, 108,
			67, 111, 110, 102, 105, 103, 46, 77, 111, 110,
			111, 66, 101, 104, 97, 118, 105, 111, 117, 114,
			115, 124, 84, 111, 111, 108, 116, 105, 112, 84,
			114, 105, 103, 103, 101, 114, 0, 0, 0, 0,
			40, 76, 101, 116, 104, 97, 108, 67, 111, 110,
			102, 105, 103, 46, 77, 111, 110, 111, 66, 101,
			104, 97, 118, 105, 111, 117, 114, 115, 124, 86,
			101, 114, 115, 105, 111, 110, 76, 97, 98, 101,
			108, 0, 0, 0, 0, 39, 76, 101, 116, 104,
			97, 108, 67, 111, 110, 102, 105, 103, 46, 80,
			97, 116, 99, 104, 101, 115, 124, 77, 101, 110,
			117, 77, 97, 110, 97, 103, 101, 114, 80, 97,
			116, 99, 104, 101, 115, 0, 0, 0, 0, 44,
			76, 101, 116, 104, 97, 108, 67, 111, 110, 102,
			105, 103, 46, 80, 97, 116, 99, 104, 101, 115,
			124, 81, 117, 105, 99, 107, 77, 101, 110, 117,
			77, 97, 110, 97, 103, 101, 114, 80, 97, 116,
			99, 104, 101, 115, 0, 0, 0, 0, 37, 76,
			101, 116, 104, 97, 108, 67, 111, 110, 102, 105,
			103, 46, 85, 116, 105, 108, 115, 124, 65, 115,
			115, 101, 109, 98, 108, 121, 69, 120, 116, 101,
			110, 115, 105, 111, 110, 115, 0, 0, 0, 0,
			25, 76, 101, 116, 104, 97, 108, 67, 111, 110,
			102, 105, 103, 46, 85, 116, 105, 108, 115, 124,
			65, 115, 115, 101, 116, 115, 0, 0, 0, 0,
			27, 76, 101, 116, 104, 97, 108, 67, 111, 110,
			102, 105, 103, 46, 85, 116, 105, 108, 115, 124,
			76, 111, 103, 85, 116, 105, 108, 115, 0, 0,
			0, 0, 32, 76, 101, 116, 104, 97, 108, 67,
			111, 110, 102, 105, 103, 46, 83, 101, 116, 116,
			105, 110, 103, 115, 124, 77, 101, 110, 117, 115,
			85, 116, 105, 108, 115, 0, 0, 0, 0, 28,
			76, 101, 116, 104, 97, 108, 67, 111, 110, 102,
			105, 103, 46, 85, 116, 105, 108, 115, 124, 80,
			97, 116, 104, 85, 116, 105, 108, 115
		};
		result.TotalFiles = 61;
		result.TotalTypes = 65;
		result.IsEditorOnly = false;
		return result;
	}
}
namespace LethalConfig
{
	public static class LethalConfigManager
	{
		private static bool hasGeneratedMissingConfigs = false;

		internal static Dictionary<string, Mod> Mods { get; private set; } = new Dictionary<string, Mod>();


		private static Dictionary<Mod, Assembly> ModToAssemblyMap { get; set; } = new Dictionary<Mod, Assembly>();


		internal static void AutoGenerateMissingConfigsIfNeeded()
		{
			if (hasGeneratedMissingConfigs)
			{
				return;
			}
			Mod[] second = Mods.Values.ToArray();
			IEnumerable<BaseConfigItem> existingConfigsFlat = Mods.SelectMany((KeyValuePair<string, Mod> kv) => kv.Value.configItems);
			AutoConfigGenerator.AutoConfigItem[] array = AutoConfigGenerator.AutoGenerateConfigs();
			Dictionary<Mod, IEnumerable<BaseConfigItem>> dictionary = (from c in array
				group c.ConfigItem by ModForAssembly(c.Assembly) into kv
				where kv.Key != null
				select kv).SelectMany((IGrouping<Mod, BaseConfigItem> kv) => from c in kv.Select(delegate(BaseConfigItem c)
				{
					c.Owner = kv.Key;
					return c;
				})
				where !kv.Key.entriesToSkipAutoGen.Any((ConfigEntryPath path) => path.Matches(c))
				where existingConfigsFlat.FirstOrDefault((BaseConfigItem ec) => c.IsSameConfig(ec)) == null
				group c by c.Owner).ToDictionary((IGrouping<Mod, BaseConfigItem> kv) => kv.Key, (IGrouping<Mod, BaseConfigItem> kv) => kv.Select((BaseConfigItem c) => c));
			Mod[] array2 = dictionary.Keys.Except(second).ToArray();
			Mod[] array3 = array2;
			foreach (Mod obj in array3)
			{
				obj.IsAutoGenerated = true;
				obj.modInfo.Description += "\n*This mod entry was automatically generated as it does not use LethalConfig directly.";
			}
			foreach (KeyValuePair<Mod, IEnumerable<BaseConfigItem>> item in dictionary)
			{
				Assembly valueOrDefault = ModToAssemblyMap.GetValueOrDefault(item.Key);
				if (!(valueOrDefault != null))
				{
					continue;
				}
				foreach (BaseConfigItem item2 in item.Value)
				{
					AddConfigItemForAssembly(item2, valueOrDefault);
				}
			}
			LogUtils.LogInfo($"Generated {array2.Count()} mod entries.");
			LogUtils.LogInfo($"Generated {array.Length} configs, of which {dictionary.SelectMany((KeyValuePair<Mod, IEnumerable<BaseConfigItem>> kv) => kv.Value).Count()} were missing and registered.");
			hasGeneratedMissingConfigs = true;
		}

		public static void AddConfigItem(BaseConfigItem configItem)
		{
			if (AddConfigItemForAssembly(configItem, Assembly.GetCallingAssembly()))
			{
				LogUtils.LogInfo($"Registered config \"{configItem}\"");
			}
		}

		private static bool AddConfigItemForAssembly(BaseConfigItem configItem, Assembly assembly)
		{
			Mod mod = ModForAssembly(assembly);
			if (mod == null)
			{
				LogUtils.LogWarning("Mod for assembly not found.");
				return false;
			}
			configItem.Owner = mod;
			if (mod.configItems.Where((BaseConfigItem c) => c.IsSameConfig(configItem)).Count() > 0)
			{
				LogUtils.LogWarning($"Ignoring duplicated config \"{configItem}\"");
				return false;
			}
			mod.AddConfigItem(configItem);
			return true;
		}

		private static Mod ModForAssembly(Assembly assembly)
		{
			if (assembly.TryGetModInfo(out var modInfo))
			{
				if (Mods.TryGetValue(modInfo.GUID, out var value))
				{
					return value;
				}
				Mod mod = new Mod(modInfo);
				Mods.Add(modInfo.GUID, mod);
				ModToAssemblyMap.Add(mod, assembly);
				return mod;
			}
			return null;
		}

		public static void SetModIcon(Sprite sprite)
		{
			if (!((Object)(object)sprite == (Object)null))
			{
				Mod mod = ModForAssembly(Assembly.GetCallingAssembly());
				if (mod != null)
				{
					mod.modInfo.Icon = sprite;
				}
			}
		}

		public static void SetModDescription(string description)
		{
			if (description != null)
			{
				Mod mod = ModForAssembly(Assembly.GetCallingAssembly());
				if (mod != null)
				{
					mod.modInfo.Description = description;
				}
			}
		}

		public static void SkipAutoGenFor(string configSection)
		{
			ModForAssembly(Assembly.GetCallingAssembly())?.entriesToSkipAutoGen.Add(new ConfigEntryPath(configSection, "*"));
		}

		public static void SkipAutoGenFor(ConfigEntryBase configEntryBase)
		{
			ModForAssembly(Assembly.GetCallingAssembly())?.entriesToSkipAutoGen.Add(new ConfigEntryPath(configEntryBase.Definition.Section, configEntryBase.Definition.Key));
		}

		public static void SkipAutoGen()
		{
			ModForAssembly(Assembly.GetCallingAssembly())?.entriesToSkipAutoGen.Add(new ConfigEntryPath("*", "*"));
		}
	}
	internal static class PluginInfo
	{
		public const string Guid = "ainavt.lc.lethalconfig";

		public const string Name = "LethalConfig";

		public const string Version = "1.3.4";
	}
	[BepInPlugin("ainavt.lc.lethalconfig", "LethalConfig", "1.3.4")]
	internal class LethalConfigPlugin : BaseUnityPlugin
	{
		private enum TestEnum
		{
			None,
			First,
			Second
		}

		private static LethalConfigPlugin instance;

		private static Harmony harmony;

		private void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			LogUtils.Init("ainavt.lc.lethalconfig");
			Assets.Init();
			harmony = new Harmony("ainavt.lc.lethalconfig");
			harmony.PatchAll();
			CreateExampleConfigs();
			LogUtils.LogInfo("LethalConfig loaded!");
		}

		private void CreateExampleConfigs()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			ConfigEntry<int> configEntry = ((BaseUnityPlugin)this).Config.Bind<int>("Example", "Int Slider", 30, new ConfigDescription("This is an integer slider. You can also type a value in the input field to the right of the slider.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			ConfigEntry<float> configEntry2 = ((BaseUnityPlugin)this).Config.Bind<float>("Example", "Float Slider", 0f, new ConfigDescription("This is a float slider. You can also type a value in the input field to the right of the slider.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1f), Array.Empty<object>()));
			ConfigEntry<float> configEntry3 = ((BaseUnityPlugin)this).Config.Bind<float>("Example", "Float Step Slider", 0f, new ConfigDescription("This is a float step slider. It set values in increments. You can also type a value in the input field to the right of the slider.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1f), Array.Empty<object>()));
			ConfigEntry<bool> configEntry4 = ((BaseUnityPlugin)this).Config.Bind<bool>("Example", "Bool Checkbox", false, new ConfigDescription("This is a bool checkbox.", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigEntry<TestEnum> configEntry5 = ((BaseUnityPlugin)this).Config.Bind<TestEnum>("Example", "Enum Dropdown", TestEnum.None, new ConfigDescription("This is a enum dropdown.", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigEntry<string> configEntry6 = ((BaseUnityPlugin)this).Config.Bind<string>("Example", "Text Input", "Example", "This is a text input field. It can have a limit of characters too.");
			ConfigEntry<int> configEntry7 = ((BaseUnityPlugin)this).Config.Bind<int>("Example", "Int Input", 50, "This is an integer input field.");
			ConfigEntry<float> configEntry8 = ((BaseUnityPlugin)this).Config.Bind<float>("Example", "Float Input", 0.5f, "This is a float input field.");
			LethalConfigManager.AddConfigItem(new IntSliderConfigItem(configEntry, requiresRestart: false));
			LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(configEntry2, requiresRestart: false));
			LethalConfigManager.AddConfigItem(new FloatStepSliderConfigItem(configEntry3, new FloatStepSliderOptions
			{
				Step = 0.1f,
				RequiresRestart = false,
				Min = -1f,
				Max = 1f
			}));
			LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(configEntry4, requiresRestart: false));
			LethalConfigManager.AddConfigItem(new EnumDropDownConfigItem<TestEnum>(configEntry5, requiresRestart: false));
			LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(configEntry6, requiresRestart: false));
			LethalConfigManager.AddConfigItem(new GenericButtonConfigItem("Example", "Button", "This is a test button with a callback", "Open", delegate
			{
				ConfigMenuManager.Instance?.DisplayNotification("Buttons can be used to open custom menus or other things.", "OK");
			}));
			LethalConfigManager.AddConfigItem(new IntInputFieldConfigItem(configEntry7, new IntInputFieldOptions
			{
				Max = 150
			}));
			LethalConfigManager.AddConfigItem(new FloatInputFieldConfigItem(configEntry8, new FloatInputFieldOptions
			{
				Max = 2.5f
			}));
		}
	}
}
namespace LethalConfig.Settings
{
	internal static class MenusUtils
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__0_0;

			public static UnityAction <>9__0_1;

			public static Func<Button, GameObject> <>9__0_2;

			public static Func<GameObject, RectTransform> <>9__0_4;

			public static Func<RectTransform, float> <>9__0_5;

			public static Func<float, float, float> <>9__0_6;

			internal void <InjectMenu>b__0_0()
			{
				ConfigMenuManager.Instance.ShowConfigMenu();
			}

			internal void <InjectMenu>b__0_1()
			{
				ConfigMenuManager.Instance.menuAudio.PlayConfirmSFX();
			}

			internal GameObject <InjectMenu>b__0_2(Button b)
			{
				return ((Component)b).gameObject;
			}

			internal RectTransform <InjectMenu>b__0_4(GameObject b)
			{
				Transform transform = b.transform;
				return (RectTransform)(object)((transform is RectTransform) ? transform : null);
			}

			internal float <InjectMenu>b__0_5(RectTransform t)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return t.anchoredPosition.y;
			}

			internal float <InjectMenu>b__0_6(float y1, float y2)
			{
				return Mathf.Abs(y2 - y1);
			}
		}

		internal static void InjectMenu(Transform parentTransform, Transform mainButtonsTransform, GameObject quitButton)
		{
			//IL_0028: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			//IL_012c: 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_0137: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Expected O, but got Unknown
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(Assets.ConfigMenuManagerPrefab);
			obj.transform.SetParent(parentTransform);
			obj.transform.localPosition = Vector3.zero;
			GameObject obj2 = Object.Instantiate<GameObject>(Assets.ConfigMenuPrefab);
			obj2.transform.SetParent(parentTransform, false);
			obj2.transform.localPosition = Vector3.zero;
			obj2.transform.localScale = Vector3.one;
			obj2.transform.localRotation = Quaternion.identity;
			obj2.SetActive(false);
			GameObject obj3 = Object.Instantiate<GameObject>(Assets.ConfigMenuNotificationPrefab);
			obj3.transform.SetParent(parentTransform, false);
			obj3.transform.localPosition = Vector3.zero;
			obj3.transform.localScale = Vector3.one;
			obj3.transform.localRotation = Quaternion.identity;
			obj3.SetActive(false);
			GameObject clonedButton = Object.Instantiate<GameObject>(quitButton, mainButtonsTransform);
			((UnityEventBase)clonedButton.GetComponent<Button>().onClick).RemoveAllListeners();
			clonedButton.GetComponent<Button>().onClick = new ButtonClickedEvent();
			ButtonClickedEvent onClick = clonedButton.GetComponent<Button>().onClick;
			object obj4 = <>c.<>9__0_0;
			if (obj4 == null)
			{
				UnityAction val = delegate
				{
					ConfigMenuManager.Instance.ShowConfigMenu();
				};
				<>c.<>9__0_0 = val;
				obj4 = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj4);
			ButtonClickedEvent onClick2 = clonedButton.GetComponent<Button>().onClick;
			object obj5 = <>c.<>9__0_1;
			if (obj5 == null)
			{
				UnityAction val2 = delegate
				{
					ConfigMenuManager.Instance.menuAudio.PlayConfirmSFX();
				};
				<>c.<>9__0_1 = val2;
				obj5 = (object)val2;
			}
			((UnityEvent)onClick2).AddListener((UnityAction)obj5);
			((TMP_Text)clonedButton.GetComponentInChildren<TextMeshProUGUI>()).text = "> LethalConfig";
			IEnumerable<GameObject> source = from b in ((Component)mainButtonsTransform).GetComponentsInChildren<Button>()
				select ((Component)b).gameObject;
			IEnumerable<float> enumerable = from t in source.Where((GameObject b) => (Object)(object)b != (Object)(object)clonedButton).Select(delegate(GameObject b)
				{
					Transform transform = b.transform;
					return (RectTransform)(object)((transform is RectTransform) ? transform : null);
				})
				select t.anchoredPosition.y;
			float num = enumerable.Zip(enumerable.Skip(1), (float y1, float y2) => Mathf.Abs(y2 - y1)).Min();
			foreach (GameObject item in source.Where((GameObject g) => (Object)(object)g != (Object)(object)quitButton))
			{
				RectTransform component = item.GetComponent<RectTransform>();
				component.anchoredPosition += new Vector2(0f, num);
			}
			clonedButton.GetComponent<RectTransform>().anchoredPosition = quitButton.GetComponent<RectTransform>().anchoredPosition + new Vector2(0f, num);
		}
	}
}
namespace LethalConfig.Utils
{
	internal static class AssemblyExtensions
	{
		internal static bool TryGetModInfo(this Assembly assembly, out ModInfo modInfo)
		{
			modInfo = new ModInfo();
			BepInPlugin val = assembly.FindPluginAttribute();
			if (val == null)
			{
				return false;
			}
			modInfo.Name = val.Name;
			modInfo.GUID = val.GUID;
			modInfo.Version = val.Version.ToString();
			return true;
		}

		internal static BepInPlugin FindPluginAttribute(this Assembly assembly)
		{
			Type[] array;
			try
			{
				array = assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				array = ex.Types.Where((Type t) => t != null).ToArray();
			}
			Type[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				BepInPlugin customAttribute = ((MemberInfo)array2[i]).GetCustomAttribute<BepInPlugin>();
				if (customAttribute != null)
				{
					return customAttribute;
				}
			}
			return null;
		}
	}
	internal static class Assets
	{
		private static AssetBundle assetBundle;

		internal static GameObject ConfigMenuManagerPrefab;

		internal static GameObject ConfigMenuNotificationPrefab;

		internal static GameObject ConfigMenuPrefab;

		internal static GameObject ModListItemPrefab;

		internal static GameObject SectionHeaderPrefab;

		internal static GameObject IntSliderPrefab;

		internal static GameObject FloatSliderPrefab;

		internal static GameObject FloatStepSliderPrefab;

		internal static GameObject BoolCheckBoxPrefab;

		internal static GameObject EnumDropDownPrefab;

		internal static GameObject TextInputFieldPrefab;

		internal static GameObject IntInputFieldPrefab;

		internal static GameObject FloatInputFieldPrefab;

		internal static GameObject GenericButtonPrefab;

		internal static Sprite DefaultModIcon;

		internal static Sprite LethalConfigModIcon;

		internal static void Init()
		{
			assetBundle = AssetBundle.LoadFromFile(PathUtils.PathForResourceInAssembly("ainavt_lethalconfig"));
			if ((Object)(object)assetBundle == (Object)null)
			{
				LogUtils.LogError("Failed to load LethalConfig bundle.");
				return;
			}
			LoadAsset<GameObject>("prefabs/ConfigMenuManager.prefab", out ConfigMenuManagerPrefab);
			LoadAsset<GameObject>("prefabs/ConfigMenuNotification.prefab", out ConfigMenuNotificationPrefab);
			LoadAsset<GameObject>("prefabs/ConfigMenu.prefab", out ConfigMenuPrefab);
			LoadAsset<GameObject>("prefabs/ModListItem.prefab", out ModListItemPrefab);
			LoadAsset<GameObject>("prefabs/components/SectionHeader.prefab", out SectionHeaderPrefab);
			LoadAsset<GameObject>("prefabs/components/IntSliderItem.prefab", out IntSliderPrefab);
			LoadAsset<GameObject>("prefabs/components/FloatSliderItem.prefab", out FloatSliderPrefab);
			LoadAsset<GameObject>("prefabs/components/FloatStepSliderItem.prefab", out FloatStepSliderPrefab);
			LoadAsset<GameObject>("prefabs/components/BoolCheckBoxItem.prefab", out BoolCheckBoxPrefab);
			LoadAsset<GameObject>("prefabs/components/EnumDropDownItem.prefab", out EnumDropDownPrefab);
			LoadAsset<GameObject>("prefabs/components/TextInputFieldItem.prefab", out TextInputFieldPrefab);
			LoadAsset<GameObject>("prefabs/components/IntInputFieldItem.prefab", out IntInputFieldPrefab);
			LoadAsset<GameObject>("prefabs/components/FloatInputFieldItem.prefab", out FloatInputFieldPrefab);
			LoadAsset<GameObject>("prefabs/components/GenericButtonItem.prefab", out GenericButtonPrefab);
			LoadAsset<Sprite>("sprite/unknown-icon.png", out DefaultModIcon);
			LoadAsset<Sprite>("icon.png", out LethalConfigModIcon);
			LogUtils.LogInfo("Finished loading assets.");
		}

		private static void LoadAsset<T>(string assetName, out T asset) where T : Object
		{
			string text = "Assets/" + assetName;
			asset = assetBundle.LoadAsset<T>(text);
			if ((Object)(object)asset == (Object)null)
			{
				LogUtils.LogError("Failed to load asset (" + text + ")");
			}
		}
	}
	internal static class LogUtils
	{
		private static Dictionary<Assembly, ManualLogSource> logSources = new Dictionary<Assembly, ManualLogSource>();

		public static void Init(string pluginGuid)
		{
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			if (!logSources.ContainsKey(callingAssembly))
			{
				logSources.Add(callingAssembly, Logger.CreateLogSource(pluginGuid));
			}
		}

		public static void LogInfo(string message)
		{
			logSources[Assembly.GetCallingAssembly()].LogInfo((object)message);
		}

		public static void LogWarning(string message)
		{
			logSources[Assembly.GetCallingAssembly()].LogWarning((object)message);
		}

		public static void LogError(string message)
		{
			logSources[Assembly.GetCallingAssembly()].LogError((object)message);
		}

		public static void LogFatal(string message)
		{
			logSources[Assembly.GetCallingAssembly()].LogFatal((object)message);
		}
	}
	internal static class PathUtils
	{
		public static string PathForResourceInAssembly(string resourceName, Assembly assembly = null)
		{
			return Path.Combine(Path.GetDirectoryName((assembly ?? Assembly.GetCallingAssembly()).Location), resourceName);
		}
	}
}
namespace LethalConfig.Patches
{
	[HarmonyPatch(typeof(MenuManager))]
	internal class MenuManagerPatches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void StartPostFix(MenuManager __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(DelayedMainMenuInjection());
		}

		private static IEnumerator DelayedMainMenuInjection()
		{
			yield return (object)new WaitForSeconds(0f);
			InjectToMainMenu();
		}

		private static void InjectToMainMenu()
		{
			LogUtils.LogInfo("Injecting mod config menu into main menu...");
			GameObject val = GameObject.Find("MenuContainer");
			Transform val2 = ((val != null) ? val.transform.Find("MainButtons") : null);
			object obj;
			if (val2 == null)
			{
				obj = null;
			}
			else
			{
				Transform obj2 = val2.Find("QuitButton");
				obj = ((obj2 != null) ? ((Component)obj2).gameObject : null);
			}
			GameObject val3 = (GameObject)obj;
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null) && !((Object)(object)val3 == (Object)null))
			{
				MenusUtils.InjectMenu(val.transform, val2, val3);
			}
		}
	}
	[HarmonyPatch(typeof(QuickMenuManager))]
	internal class QuickMenuManagerPatches
	{
		[HarmonyPatch("CloseQuickMenuPanels")]
		[HarmonyPostfix]
		public static void CloseQuickMenuPanelsPostFix(QuickMenuManager __instance)
		{
			ConfigMenu componentInChildren = ((Component)__instance.menuContainer.transform).GetComponentInChildren<ConfigMenu>(true);
			ConfigMenuNotification componentInChildren2 = ((Component)__instance.menuContainer.transform).GetComponentInChildren<ConfigMenuNotification>(true);
			componentInChildren?.Close(animated: false);
			componentInChildren2?.Close(animated: false);
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void StartPostFix(QuickMenuManager __instance)
		{
			LogUtils.LogInfo("Injecting mod config menu into quick menu...");
			GameObject menuContainer = __instance.menuContainer;
			Transform val = ((menuContainer != null) ? menuContainer.transform.Find("MainButtons") : null);
			GameObject val2 = ((val != null) ? ((Component)val.Find("Quit")).gameObject : null);
			if (!((Object)(object)menuContainer == (Object)null) && !((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null))
			{
				MenusUtils.InjectMenu(menuContainer.transform, val, val2);
			}
		}
	}
}
namespace LethalConfig.MonoBehaviours
{
	internal class ConfigInfoBox : MonoBehaviour
	{
		public TextMeshProUGUI configInfoText;

		public void SetConfigInfo(string configInfo)
		{
			((TMP_Text)configInfoText).text = configInfo;
		}
	}
	internal class ConfigList : MonoBehaviour
	{
		public GameObject listContainerObject;

		public DescriptionBox descriptionBox;

		internal void LoadConfigsForMod(Mod mod)
		{
			//IL_0079: 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_0098: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			ClearConfigList();
			foreach (IGrouping<string, BaseConfigItem> item in from c in mod.configItems
				group c by c.Section)
			{
				GameObject obj = Object.Instantiate<GameObject>(Assets.SectionHeaderPrefab);
				obj.GetComponent<SectionHeader>().SetSectionName(item.Key);
				obj.transform.SetParent(listContainerObject.transform);
				obj.transform.localPosition = Vector3.zero;
				obj.transform.localScale = Vector3.one;
				obj.transform.localRotation = Quaternion.identity;
				foreach (BaseConfigItem item2 in item)
				{
					GameObject val = item2.CreateGameObjectForConfig();
					ModConfigController controller = val.GetComponent<ModConfigController>();
					if (!controller.SetConfigItem(item2))
					{
						Object.DestroyImmediate((Object)(object)val.gameObject);
						return;
					}
					val.transform.SetParent(listContainerObject.transform);
					val.transform.localPosition = Vector3.zero;
					val.transform.localScale = Vector3.one;
					val.transform.localRotation = Quaternion.identity;
					controller.OnHoverEnter += delegate
					{
						descriptionBox.ShowConfigInfo(controller.GetDescription());
						ConfigMenuManager.Instance.menuAudio.PlayHoverSFX();
					};
				}
			}
		}

		private void ClearConfigList()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			foreach (Transform item in listContainerObject.transform)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
		}
	}
	internal class ConfigMenu : MonoBehaviour
	{
		public ConfigList configList;

		public Animator menuAnimator;

		private void Awake()
		{
			LethalConfigManager.AutoGenerateMissingConfigsIfNeeded();
		}

		public void Open()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			AnimatorStateInfo currentAnimatorStateInfo = menuAnimator.GetCurrentAnimatorStateInfo(0);
			if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("ConfigMenuNormal") && !((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("ConfigMenuAppear"))
			{
				((Component)this).gameObject.SetActive(true);
				menuAnimator.SetTrigger("Open");
				((Component)this).transform.SetAsLastSibling();
			}
		}

		public void Close(bool animated = true)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			AnimatorStateInfo currentAnimatorStateInfo = menuAnimator.GetCurrentAnimatorStateInfo(0);
			if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("ConfigMenuClosed") || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("ConfigMenuDisappear"))
			{
				return;
			}
			foreach (BaseConfigItem item in LethalConfigManager.Mods.SelectMany((KeyValuePair<string, Mod> m) => m.Value.configItems))
			{
				item.CancelChanges();
			}
			UpdateAppearanceOfCurrentComponents();
			if (!animated)
			{
				((Component)this).gameObject.SetActive(false);
				menuAnimator.SetTrigger("ForceClose");
			}
			else
			{
				menuAnimator.SetTrigger("Close");
			}
		}

		public void OnCloseAnimationEnd()
		{
			((Component)this).gameObject.SetActive(false);
		}

		public void OnCancelButtonClicked()
		{
			Close();
			ConfigMenuManager.Instance.menuAudio.PlayCancelSFX();
		}

		public void OnApplyButtonClicked()
		{
			List<BaseConfigItem> list = (from c in LethalConfigManager.Mods.SelectMany((KeyValuePair<string, Mod> m) => m.Value.configItems)
				where c.HasValueChanged
				select c).ToList();
			List<BaseConfigItem> list2 = list.Where((BaseConfigItem c) => c.RequiresRestart).ToList();
			foreach (BaseConfigItem item in list)
			{
				item.ApplyChanges();
			}
			UpdateAppearanceOfCurrentComponents();
			ConfigMenuManager.Instance.menuAudio.PlayConfirmSFX();
			LogUtils.LogInfo($"Saved config values for {list.Count} items.");
			LogUtils.LogInfo($"Modified {list2.Count} item(s) that requires a restart.");
			if (list2.Count > 0)
			{
				ConfigMenuManager.Instance.DisplayNotification("Some of the modified settings may require a restart to take effect.", "OK");
			}
		}

		private void UpdateAppearanceOfCurrentComponents()
		{
			ModConfigController[] componentsInChildren = ((Component)configList).GetComponentsInChildren<ModConfigController>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].UpdateAppearance();
			}
		}
	}
	internal class ConfigMenuNotification : MonoBehaviour
	{
		public TextMeshProUGUI messageTextComponent;

		public TextMeshProUGUI buttonTextComponent;

		public Animator notificationAnimator;

		public void SetNotificationContent(string text, string button)
		{
			((TMP_Text)messageTextComponent).text = text;
			((TMP_Text)buttonTextComponent).text = "[" + button + "]";
		}

		public void Open()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			AnimatorStateInfo currentAnimatorStateInfo = notificationAnimator.GetCurrentAnimatorStateInfo(0);
			if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("NotificationNormal") && !((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("NotificationAppear"))
			{
				((Component)this).gameObject.SetActive(true);
				notificationAnimator.SetTrigger("Open");
				((Component)this).transform.SetAsLastSibling();
			}
		}

		public void Close(bool animated = true)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			AnimatorStateInfo currentAnimatorStateInfo = notificationAnimator.GetCurrentAnimatorStateInfo(0);
			if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("NotificationClosed") && !((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("NotificationDisappear"))
			{
				if (!animated)
				{
					((Component)this).gameObject.SetActive(false);
					notificationAnimator.SetTrigger("ForceClose");
				}
				else
				{
					notificationAnimator.SetTrigger("Close");
				}
			}
		}

		public void OnButtonClick()
		{
			Close();
			ConfigMenuManager.Instance.menuAudio.PlayConfirmSFX();
		}

		public void OnCloseAnimationEnd()
		{
			((Component)this).gameObject.SetActive(false);
		}
	}
	internal class DescriptionBox : MonoBehaviour
	{
		public ModInfoBox modInfoBox;

		public ConfigInfoBox configInfoBox;

		private void Awake()
		{
			((Component)modInfoBox).gameObject.SetActive(false);
			((Component)configInfoBox).gameObject.SetActive(false);
		}

		public void ShowConfigInfo(string configInfo)
		{
			((Component)configInfoBox).gameObject.SetActive(true);
			configInfoBox.SetConfigInfo(configInfo);
			HideModInfo();
		}

		public void HideConfigInfo()
		{
			((Component)configInfoBox).gameObject.SetActive(false);
		}

		public void ShowModInfo(Mod mod)
		{
			((Component)modInfoBox).gameObject.SetActive(true);
			modInfoBox.SetModInfo(mod);
			HideConfigInfo();
		}

		public void HideModInfo()
		{
			((Component)modInfoBox).gameObject.SetActive(false);
		}
	}
	internal class ModInfoBox : MonoBehaviour
	{
		public Image modIconImage;

		public TextMeshProUGUI modInfoText;

		public void SetModInfo(Mod mod)
		{
			modIconImage.sprite = mod.modInfo.Icon;
			_ = $"{mod.modInfo}";
			((TMP_Text)modInfoText).text = $"{mod.modInfo}";
		}
	}
	internal class ModList : MonoBehaviour
	{
		public GameObject modItemPrefab;

		public GameObject listContainerObject;

		public ConfigList configList;

		public DescriptionBox descriptionBox;

		private List<ModListItem> _items;

		private void Awake()
		{
			_items = new List<ModListItem>();
			BuildModList();
		}

		private void BuildModList()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			_items.Clear();
			foreach (Transform item in listContainerObject.transform)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			foreach (Mod mod in from m in LethalConfigManager.Mods.Values
				orderby m.modInfo.GUID != "ainavt.lc.lethalconfig", m.IsAutoGenerated, m.modInfo.Name
				select m)
			{
				GameObject val = Object.Instantiate<GameObject>(modItemPrefab, listContainerObject.transform);
				val.transform.localScale = Vector3.one;
				val.transform.localPosition = Vector3.zero;
				val.transform.localRotation = Quaternion.identity;
				ModListItem component = val.GetComponent<ModListItem>();
				component.mod = mod;
				component.modSelected += ModSelected;
				component.OnHoverEnter += delegate
				{
					descriptionBox.ShowModInfo(mod);
					ConfigMenuManager.Instance.menuAudio.PlayHoverSFX();
				};
				component.OnHoverExit += delegate
				{
					descriptionBox.HideModInfo();
				};
				_items.Add(val.GetComponent<ModListItem>());
			}
		}

		private void ModSelected(Mod mod)
		{
			ConfigMenuManager.Instance.menuAudio.PlayConfirmSFX();
			configList.LoadConfigsForMod(mod);
			_items.First((ModListItem i) => i.mod == mod).SetSelected(selected: true);
			foreach (ModListItem item in _items.Where((ModListItem i) => i.mod != mod))
			{
				item.SetSelected(selected: false);
			}
		}
	}
	internal class ModListItem : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public delegate void OnHoverHandler();

		internal delegate void ModSelectedHandler(Mod mod);

		public TextMeshProUGUI textMesh;

		public GameObject selectedBorder;

		public Image modIcon;

		private Mod _mod;

		internal Mod mod
		{
			get
			{
				return _mod;
			}
			set
			{
				_mod = value;
				((TMP_Text)textMesh).text = _mod.modInfo.Name;
				modIcon.sprite = _mod.modInfo.Icon;
			}
		}

		public event OnHoverHandler OnHoverEnter;

		public event OnHoverHandler OnHoverExit;

		internal event ModSelectedHandler modSelected;

		public void OnClick()
		{
			this.modSelected(_mod);
		}

		public void SetSelected(bool selected)
		{
			selectedBorder.SetActive(selected);
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			this.OnHoverEnter?.Invoke();
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			this.OnHoverExit?.Invoke();
		}

		public string GetDescription()
		{
			return _mod.modInfo.Name + "\n" + _mod.modInfo.GUID + "\n" + _mod.modInfo.Version;
		}
	}
	internal class SectionHeader : MonoBehaviour
	{
		public TextMeshProUGUI textMesh;

		public void SetSectionName(string sectionName)
		{
			((TMP_Text)textMesh).text = "[" + sectionName + "]";
		}
	}
	internal class Tooltip : MonoBehaviour
	{
		public TextMeshProUGUI textComponent;

		private RectTransform rectTransform;

		private Camera uiCamera;

		public void SetText(string text)
		{
			((TMP_Text)textComponent).text = text;
		}

		public void SetTarget(GameObject gameObject)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = gameObject.transform.position;
		}
	}
	internal class TooltipSystem : MonoBehaviour
	{
		private static TooltipSystem instance;

		public Tooltip tooltip;

		private void Awake()
		{
			instance = this;
		}

		public static void Show(string content, GameObject target)
		{
			if (!((Object)(object)instance == (Object)null))
			{
				((Component)instance.tooltip).gameObject.SetActive(true);
				instance.tooltip.SetText(content);
				instance.tooltip.SetTarget(target);
			}
		}

		public static void Hide()
		{
			if (!((Object)(object)instance == (Object)null))
			{
				((Component)instance.tooltip).gameObject.SetActive(false);
			}
		}
	}
	internal class TooltipTrigger : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public string tooltipText;

		public void OnPointerEnter(PointerEventData eventData)
		{
			TooltipSystem.Show(tooltipText, ((Component)this).gameObject);
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			TooltipSystem.Hide();
		}
	}
	internal class VersionLabel : MonoBehaviour
	{
		private void Start()
		{
			((TMP_Text)((Component)this).GetComponent<TextMeshProUGUI>()).text = "LethalConfig v1.3.4";
		}
	}
}
namespace LethalConfig.MonoBehaviours.Managers
{
	internal class ConfigMenuAudioManager : MonoBehaviour
	{
		public AudioClip confirmSFX;

		public AudioClip cancelSFX;

		public AudioClip selectSFX;

		public AudioClip hoverSFX;

		public AudioClip changeValueSFX;

		public AudioSource audioSource;

		public void PlayConfirmSFX()
		{
			audioSource.PlayOneShot(confirmSFX);
		}

		public void PlayCancelSFX()
		{
			audioSource.PlayOneShot(cancelSFX);
		}

		public void PlayHoverSFX()
		{
			audioSource.PlayOneShot(hoverSFX);
		}

		public void PlaySelectSFX()
		{
			audioSource.PlayOneShot(selectSFX);
		}

		public void PlayChangeValueSFX()
		{
			audioSource.PlayOneShot(changeValueSFX);
		}
	}
	internal class ConfigMenuManager : MonoBehaviour
	{
		public ConfigMenuAudioManager menuAudio;

		public static ConfigMenuManager Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		private void OnDestroy()
		{
			Instance = null;
		}

		public void ShowConfigMenu()
		{
			Object.FindObjectOfType<ConfigMenu>(true)?.Open();
		}

		public void DisplayNotification(string message, string button)
		{
			ConfigMenuNotification configMenuNotification = Object.FindObjectOfType<ConfigMenuNotification>(true);
			if ((Object)(object)configMenuNotification == (Object)null)
			{
				LogUtils.LogWarning("Notification object not found");
				return;
			}
			configMenuNotification.SetNotificationContent(message, button);
			configMenuNotification.Open();
			EventSystem.current.SetSelectedGameObject(((Component)((Component)configMenuNotification).GetComponentInChildren<Button>()).gameObject);
		}
	}
}
namespace LethalConfig.MonoBehaviours.Components
{
	internal class BoolCheckBoxController : ModConfigController<BoolCheckBoxConfigItem, bool>
	{
		public Toggle toggleComponent;

		public override void UpdateAppearance()
		{
			base.UpdateAppearance();
			toggleComponent.SetIsOnWithoutNotify(base.ConfigItem.CurrentValue);
		}

		protected override void OnSetConfigItem()
		{
			toggleComponent.SetIsOnWithoutNotify(base.ConfigItem.CurrentValue);
			UpdateAppearance();
		}

		public void OnCheckBoxValueChanged(bool value)
		{
			base.ConfigItem.CurrentValue = value;
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}
	}
	internal class EnumDropDownController : ModConfigController
	{
		public TMP_Dropdown dropdownComponent;

		private Type _enumType;

		private List<string> _enumNames = new List<string>();

		public override string GetDescription()
		{
			return base.GetDescription() + "\n\nDefault: " + Enum.GetName(_enumType, baseConfigItem.BoxedDefaultValue);
		}

		public override void UpdateAppearance()
		{
			base.UpdateAppearance();
			int valueWithoutNotify = _enumNames.FindIndex((string e) => e == Enum.GetName(_enumType, baseConfigItem.CurrentBoxedValue));
			dropdownComponent.SetValueWithoutNotify(valueWithoutNotify);
		}

		protected override void OnSetConfigItem()
		{
			_enumType = baseConfigItem.BaseConfigEntry.SettingType;
			_enumNames = Enum.GetNames(_enumType).ToList();
			dropdownComponent.ClearOptions();
			dropdownComponent.AddOptions(_enumNames);
			int valueWithoutNotify = _enumNames.FindIndex((string e) => e == Enum.GetName(_enumType, baseConfigItem.CurrentBoxedValue));
			dropdownComponent.SetValueWithoutNotify(valueWithoutNotify);
			UpdateAppearance();
		}

		public void OnDropDownValueChanged(int index)
		{
			baseConfigItem.CurrentBoxedValue = Enum.Parse(_enumType, _enumNames[index]);
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}
	}
	internal class FloatInputFieldController : ModConfigController<FloatInputFieldConfigItem, float>
	{
		public TMP_InputField textInputField;

		public override string GetDescription()
		{
			string text = base.GetDescription();
			if (base.ConfigItem.MinValue != float.MinValue)
			{
				text += $"\nMin: {base.ConfigItem.MinValue:0.0#}";
			}
			if (base.ConfigItem.MaxValue != float.MaxValue)
			{
				text += $"\nMax: {base.ConfigItem.MaxValue:0.0#}";
			}
			return text;
		}

		protected override void OnSetConfigItem()
		{
			textInputField.SetTextWithoutNotify($"{base.ConfigItem.CurrentValue}");
			UpdateAppearance();
		}

		public void OnInputFieldEndEdit(string value)
		{
			if (float.TryParse(value, out var result))
			{
				base.ConfigItem.CurrentValue = Math.Clamp(result, base.ConfigItem.MinValue, base.ConfigItem.MaxValue);
			}
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}

		public override void UpdateAppearance()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			base.UpdateAppearance();
			textInputField.SetTextWithoutNotify($"{base.ConfigItem.CurrentValue}");
			((Transform)textInputField.textComponent.rectTransform).localPosition = Vector3.zero;
		}
	}
	internal class FloatSliderController : ModConfigController<FloatSliderConfigItem, float>
	{
		public Slider sliderComponent;

		public TMP_InputField valueInputField;

		public override string GetDescription()
		{
			return $"{base.GetDescription()}\nMin: {base.ConfigItem.MinValue:0.0#}\nMax: {base.ConfigItem.MaxValue:0.0#}";
		}

		protected override void OnSetConfigItem()
		{
			sliderComponent.SetValueWithoutNotify(base.ConfigItem.CurrentValue);
			sliderComponent.maxValue = base.ConfigItem.MaxValue;
			sliderComponent.minValue = base.ConfigItem.MinValue;
			UpdateAppearance();
		}

		public void OnSliderValueChanged(float value)
		{
			base.ConfigItem.CurrentValue = value;
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}

		public void OnInputFieldEndEdit(string value)
		{
			if (float.TryParse(value, out var result))
			{
				base.ConfigItem.CurrentValue = Math.Clamp(result, base.ConfigItem.MinValue, base.ConfigItem.MaxValue);
			}
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}

		public override void UpdateAppearance()
		{
			base.UpdateAppearance();
			sliderComponent.SetValueWithoutNotify(base.ConfigItem.CurrentValue);
			valueInputField.SetTextWithoutNotify($"{base.ConfigItem.CurrentValue:0.0#}");
		}
	}
	internal class FloatStepSliderController : ModConfigController<FloatStepSliderConfigItem, float>
	{
		public Slider sliderComponent;

		public TMP_InputField valueInputField;

		public override string GetDescription()
		{
			return $"{base.GetDescription()}\nMin: {base.ConfigItem.MinValue:0.0#}\nMax: {base.ConfigItem.MaxValue:0.0#}";
		}

		protected override void OnSetConfigItem()
		{
			sliderComponent.SetValueWithoutNotify(base.ConfigItem.CurrentValue);
			int num = (int)MathF.Ceiling((base.ConfigItem.MaxValue - base.ConfigItem.MinValue) / MathF.Max(base.ConfigItem.Step, float.Epsilon));
			sliderComponent.maxValue = num;
			sliderComponent.minValue = 0f;
			sliderComponent.wholeNumbers = true;
			UpdateAppearance();
		}

		public void OnSliderValueChanged(float value)
		{
			base.ConfigItem.CurrentValue = MathF.Round(base.ConfigItem.MinValue + base.ConfigItem.Step * (float)(int)value, 4);
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}

		public void OnInputFieldEndEdit(string value)
		{
			if (float.TryParse(value, out var result))
			{
				base.ConfigItem.CurrentValue = Math.Clamp(result, base.ConfigItem.MinValue, base.ConfigItem.MaxValue);
			}
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}

		public override void UpdateAppearance()
		{
			base.UpdateAppearance();
			sliderComponent.SetValueWithoutNotify((base.ConfigItem.CurrentValue - base.ConfigItem.MinValue) / MathF.Max(base.ConfigItem.Step, float.Epsilon));
			valueInputField.SetTextWithoutNotify($"{base.ConfigItem.CurrentValue:0.0#}");
		}
	}
	internal class GenericButtonController : ModConfigController
	{
		public TextMeshProUGUI buttonTextComponent;

		private GenericButtonConfigItem ConfigItem => baseConfigItem as GenericButtonConfigItem;

		public override void UpdateAppearance()
		{
			base.UpdateAppearance();
			((TMP_Text)buttonTextComponent).text = ConfigItem?.ButtonOptions?.ButtonText ?? "Button";
		}

		protected override void OnSetConfigItem()
		{
			UpdateAppearance();
		}

		public void OnButtonClicked()
		{
			ConfigMenuManager.Instance.menuAudio.PlayConfirmSFX();
			ConfigItem?.ButtonOptions?.ButtonHandler?.Invoke();
		}
	}
	internal class IntInputFieldController : ModConfigController<IntInputFieldConfigItem, int>
	{
		public TMP_InputField textInputField;

		public override string GetDescription()
		{
			string text = base.GetDescription();
			if (base.ConfigItem.MinValue != int.MinValue)
			{
				text += $"\nMin: {base.ConfigItem.MinValue}";
			}
			if (base.ConfigItem.MaxValue != int.MaxValue)
			{
				text += $"\nMax: {base.ConfigItem.MaxValue}";
			}
			return text;
		}

		protected override void OnSetConfigItem()
		{
			textInputField.SetTextWithoutNotify($"{base.ConfigItem.CurrentValue}");
			UpdateAppearance();
		}

		public void OnInputFieldEndEdit(string value)
		{
			if (int.TryParse(value, out var result))
			{
				base.ConfigItem.CurrentValue = Math.Clamp(result, base.ConfigItem.MinValue, base.ConfigItem.MaxValue);
			}
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}

		public override void UpdateAppearance()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			base.UpdateAppearance();
			textInputField.SetTextWithoutNotify($"{base.ConfigItem.CurrentValue}");
			((Transform)textInputField.textComponent.rectTransform).localPosition = Vector3.zero;
		}
	}
	internal class IntSliderController : ModConfigController<IntSliderConfigItem, int>
	{
		public Slider sliderComponent;

		public TMP_InputField valueInputField;

		public override string GetDescription()
		{
			return $"{base.GetDescription()}\nMin: {base.ConfigItem.MinValue}\nMax: {base.ConfigItem.MaxValue}";
		}

		protected override void OnSetConfigItem()
		{
			sliderComponent.SetValueWithoutNotify((float)base.ConfigItem.CurrentValue);
			sliderComponent.maxValue = base.ConfigItem.MaxValue;
			sliderComponent.minValue = base.ConfigItem.MinValue;
			UpdateAppearance();
		}

		public void OnSliderValueChanged(float value)
		{
			base.ConfigItem.CurrentValue = (int)value;
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}

		public void OnInputFieldEndEdit(string value)
		{
			if (int.TryParse(value, out var result))
			{
				base.ConfigItem.CurrentValue = Math.Clamp(result, base.ConfigItem.MinValue, base.ConfigItem.MaxValue);
			}
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}

		public override void UpdateAppearance()
		{
			base.UpdateAppearance();
			sliderComponent.SetValueWithoutNotify((float)base.ConfigItem.CurrentValue);
			valueInputField.SetTextWithoutNotify($"{base.ConfigItem.CurrentValue}");
		}
	}
	internal abstract class ModConfigController : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public delegate void OnHoverHandler();

		private readonly List<Selectable> _selectables = new List<Selectable>();

		protected BaseConfigItem baseConfigItem;

		protected bool isOnSetup;

		public TextMeshProUGUI nameTextComponent;

		public TooltipTrigger tooltipTrigger;

		protected CanModifyResult CanModify
		{
			get
			{
				if (baseConfigItem.Options.CanModifyCallback == null)
				{
					return true;
				}
				return baseConfigItem.Options.CanModifyCallback();
			}
		}

		public event OnHoverHandler OnHoverEnter;

		public event OnHoverHandler OnHoverExit;

		protected virtual void Awake()
		{
			((Behaviour)tooltipTrigger).enabled = false;
			if (_selectables.Count <= 0)
			{
				_selectables.AddRange(((Component)this).GetComponentsInChildren<Selectable>());
			}
		}

		public virtual bool SetConfigItem(BaseConfigItem configItem)
		{
			baseConfigItem = configItem;
			isOnSetup = true;
			OnSetConfigItem();
			isOnSetup = false;
			if (baseConfigItem.Options.CanModifyCallback != null)
			{
				tooltipTrigger.tooltipText = "<b>Modifying this entry is currently disabled:</b>\n<b>" + CanModify.Reason + "</b>";
			}
			return true;
		}

		protected abstract void OnSetConfigItem();

		public virtual void UpdateAppearance()
		{
			((TMP_Text)nameTextComponent).text = (baseConfigItem.HasValueChanged ? "* " : "") + baseConfigItem.Name;
			CanModifyResult canModify = CanModify;
			foreach (Selectable selectable in _selectables)
			{
				selectable.interactable = canModify;
			}
			((Behaviour)tooltipTrigger).enabled = !canModify;
		}

		public virtual void ResetToDefault()
		{
			ConfigMenuManager.Instance.menuAudio.PlayConfirmSFX();
			baseConfigItem.ChangeToDefault();
			UpdateAppearance();
		}

		public virtual string GetDescription()
		{
			string text = "<b>" + baseConfigItem.Name + "</b>";
			if (baseConfigItem.IsAutoGenerated)
			{
				text += "\n\n<b>*This config entry was automatically generated and may require a restart*</b>";
			}
			else if (baseConfigItem.RequiresRestart)
			{
				text += "\n\n<b>*REQUIRES RESTART*</b>";
			}
			return text + "\n\n" + baseConfigItem.Description;
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			this.OnHoverEnter?.Invoke();
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			this.OnHoverExit?.Invoke();
		}
	}
	internal abstract class ModConfigController<T, V> : ModConfigController where T : BaseValueConfigItem<V>
	{
		public T ConfigItem => (T)baseConfigItem;

		public override string GetDescription()
		{
			return $"{base.GetDescription()}\n\nDefault: {ConfigItem.Defaultvalue}";
		}

		public override bool SetConfigItem(BaseConfigItem configItem)
		{
			if (!(configItem is T))
			{
				LogUtils.LogError("Expected config item of type " + typeof(T).Name + ", but got " + configItem.GetType().Name + " instead.");
				return false;
			}
			return base.SetConfigItem(configItem);
		}
	}
	internal class TextInputFieldController : ModConfigController<TextInputFieldConfigItem, string>
	{
		public TMP_InputField textInputField;

		protected override void OnSetConfigItem()
		{
			textInputField.SetTextWithoutNotify(base.ConfigItem.CurrentValue);
			UpdateAppearance();
		}

		public void OnInputFieldEndEdit(string value)
		{
			base.ConfigItem.CurrentValue = value;
			UpdateAppearance();
			ConfigMenuManager.Instance.menuAudio.PlayChangeValueSFX();
		}

		public override void UpdateAppearance()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			base.UpdateAppearance();
			textInputField.SetTextWithoutNotify(base.ConfigItem.CurrentValue);
			((Transform)textInputField.textComponent.rectTransform).localPosition = Vector3.zero;
		}
	}
}
namespace LethalConfig.Mods
{
	internal class Mod
	{
		public ModInfo modInfo;

		public bool IsAutoGenerated;

		public List<BaseConfigItem> configItems;

		public List<ConfigEntryPath> entriesToSkipAutoGen;

		internal Mod(ModInfo modInfo)
		{
			configItems = new List<BaseConfigItem>();
			entriesToSkipAutoGen = new List<ConfigEntryPath>();
			this.modInfo = modInfo;
			TryResolveIconAndDesc();
		}

		internal void TryResolveIconAndDesc()
		{
			if (modInfo.TryGetPluginInfo(out var pluginInfo))
			{
				string text = Path.GetFullPath(pluginInfo.Location);
				DirectoryInfo parent = Directory.GetParent(text);
				while (parent != null && !string.Equals(parent.Name, "plugins", StringComparison.OrdinalIgnoreCase))
				{
					text = parent.FullName;
					parent = Directory.GetParent(text);
				}
				if (!text.EndsWith(".dll"))
				{
					string iconPath = Directory.EnumerateFiles(text, "icon.png", SearchOption.AllDirectories).FirstOrDefault();
					LoadIcon(iconPath);
					string manifestPath = Directory.EnumerateFiles(text, "manifest.json", SearchOption.AllDirectories).FirstOrDefault();
					LoadDesc(manifestPath);
				}
			}
		}

		private void LoadIcon(string iconPath)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (iconPath != null)
				{
					Texture2D val = new Texture2D(256, 256);
					if (ImageConversion.LoadImage(val, File.ReadAllBytes(iconPath)))
					{
						modInfo.Icon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
					}
				}
			}
			catch
			{
			}
		}

		private void LoadDesc(string manifestPath)
		{
			try
			{
				if (manifestPath != null)
				{
					ThunderstoreManifest thunderstoreManifest = JsonConvert.DeserializeObject<ThunderstoreManifest>(File.ReadAllText(manifestPath));
					if (thunderstoreManifest != null)
					{
						modInfo.Description = thunderstoreManifest.Description;
					}
				}
			}
			catch
			{
			}
		}

		internal void AddConfigItem(BaseConfigItem item)
		{
			configItems.Add(item);
		}
	}
	internal class ModInfo
	{
		internal string Name { get; set; }

		internal string GUID { get; set; }

		internal string Version { get; set; }

		internal string Description { get; set; } = "";


		internal Sprite Icon { get; set; } = Assets.DefaultModIcon;


		public override string ToString()
		{
			return "<b>" + Name + "</b>\n" + GUID + "\nv" + Version + "\n\n" + Description;
		}

		public bool TryGetPluginInfo(out PluginInfo pluginInfo)
		{
			return Chainloader.PluginInfos.TryGetValue(GUID, out pluginInfo);
		}
	}
	internal class ThunderstoreManifest
	{
		[JsonProperty("name")]
		public string Name { get; set; }

		[JsonProperty("version_number")]
		public string VersionNumber { get; set; }

		[JsonProperty("website_url")]
		public string WebsiteURL { get; set; }

		[JsonProperty("description")]
		public string Description { get; set; }

		[JsonProperty("dependencies")]
		public IList<string> Dependencies { get; set; }
	}
}
namespace LethalConfig.ConfigItems
{
	public abstract class BaseConfigItem
	{
		internal ConfigEntryBase BaseConfigEntry { get; private set; }

		internal BaseOptions Options { get; }

		internal bool RequiresRestart => Options.RequiresRestart;

		internal Mod Owner { get; set; }

		internal bool IsAutoGenerated { get; set; }

		private string UnderlyingSection
		{
			get
			{
				ConfigEntryBase baseConfigEntry = BaseConfigEntry;
				return ((baseConfigEntry != null) ? baseConfigEntry.Definition.Section : null) ?? string.Empty;
			}
		}

		private string UnderlyingName
		{
			get
			{
				ConfigEntryBase baseConfigEntry = BaseConfigEntry;
				return ((baseConfigEntry != null) ? baseConfigEntry.Definition.Key : null) ?? string.Empty;
			}
		}

		private string UnderlyingDescription
		{
			get
			{
				ConfigEntryBase baseConfigEntry = BaseConfigEntry;
				return ((baseConfigEntry != null) ? baseConfigEntry.Description.Description : null) ?? string.Empty;
			}
		}

		internal string Section => Options.Section ?? UnderlyingSection;

		internal string Name => Options.Name ?? UnderlyingName;

		internal string Description => Options.Description ?? UnderlyingDescription;

		internal object CurrentBoxedValue { get; set; }

		internal object OriginalBoxedValue
		{
			get
			{
				ConfigEntryBase baseConfigEntry = BaseConfigEntry;
				if (baseConfigEntry == null)
				{
					return null;
				}
				return baseConfigEntry.BoxedValue;
			}
		}

		internal object BoxedDefaultValue
		{
			get
			{
				ConfigEntryBase baseConfigEntry = BaseConfigEntry;
				if (baseConfigEntry == null)
				{
					return null;
				}
				return baseConfigEntry.DefaultValue;
			}
		}

		internal bool HasValueChanged
		{
			get
			{
				object currentBoxedValue = CurrentBoxedValue;
				if (currentBoxedValue == null)
				{
					return false;
				}
				return !currentBoxedValue.Equals(OriginalBoxedValue);
			}
		}

		internal abstract GameObject CreateGameObjectForConfig();

		internal void ApplyChanges()
		{
			if (BaseConfigEntry != null)
			{
				BaseConfigEntry.BoxedValue = CurrentBoxedValue;
			}
		}

		internal void CancelChanges()
		{
			CurrentBoxedValue = OriginalBoxedValue;
		}

		internal void ChangeToDefault()
		{
			CurrentBoxedValue = BoxedDefaultValue;
		}

		internal BaseConfigItem(BaseOptions options)
			: this(null, options)
		{
		}

		internal BaseConfigItem(ConfigEntryBase configEntry, BaseOptions options)
		{
			BaseConfigEntry = configEntry;
			Options = options;
			CurrentBoxedValue = OriginalBoxedValue;
		}

		internal bool IsSameConfig(BaseConfigItem configItem)
		{
			bool num = configItem.UnderlyingSection == UnderlyingSection;
			bool flag = configItem.UnderlyingName == UnderlyingName;
			bool flag2 = configItem.Owner.modInfo.GUID == Owner.modInfo.GUID;
			return num && flag && flag2;
		}
	}
	public abstract class BaseValueConfigItem<T> : BaseConfigItem
	{
		internal ConfigEntry<T> ConfigEntry => (ConfigEntry<T>)(object)base.BaseConfigEntry;

		internal T CurrentValue
		{
			get
			{
				return (T)base.CurrentBoxedValue;
			}
			set
			{
				base.CurrentBoxedValue = value;
			}
		}

		internal T OriginalValue => ConfigEntry.Value;

		internal T Defaultvalue => (T)((ConfigEntryBase)ConfigEntry).DefaultValue;

		internal BaseValueConfigItem(ConfigEntry<T> configEntry, BaseOptions options)
			: base((ConfigEntryBase)(object)configEntry, options)
		{
			CurrentValue = OriginalValue;
		}

		public override string ToString()
		{
			return base.Owner.modInfo.Name + "/" + ((ConfigEntryBase)ConfigEntry).Definition.Section + "/" + ((ConfigEntryBase)ConfigEntry).Definition.Key;
		}
	}
	public class BoolCheckBoxConfigItem : BaseValueConfigItem<bool>
	{
		public BoolCheckBoxConfigItem(ConfigEntry<bool> configEntry)
			: this(configEntry, requiresRestart: true)
		{
		}

		public BoolCheckBoxConfigItem(ConfigEntry<bool> configEntry, bool requiresRestart)
			: this(configEntry, new BoolCheckBoxOptions
			{
				RequiresRestart = requiresRestart
			})
		{
		}

		public BoolCheckBoxConfigItem(ConfigEntry<bool> configEntry, BoolCheckBoxOptions options)
			: base(configEntry, (BaseOptions)options)
		{
		}

		internal override GameObject CreateGameObjectForConfig()
		{
			return Object.Instantiate<GameObject>(Assets.BoolCheckBoxPrefab);
		}
	}
	public class EnumDropDownConfigItem<T> : BaseValueConfigItem<T> where T : Enum
	{
		public EnumDropDownConfigItem(ConfigEntry<T> configEntry)
			: this(configEntry, requiresRestart: true)
		{
		}

		public EnumDropDownConfigItem(ConfigEntry<T> configEntry, bool requiresRestart)
			: this(configEntry, new EnumDropDownOptions
			{
				RequiresRestart = requiresRestart
			})
		{
		}

		public EnumDropDownConfigItem(ConfigEntry<T> configEntry, EnumDropDownOptions options)
			: base(configEntry, (BaseOptions)options)
		{
		}

		internal override GameObject CreateGameObjectForConfig()
		{
			return Object.Instantiate<GameObject>(Assets.EnumDropDownPrefab);
		}
	}
	public sealed class FloatInputFieldConfigItem : BaseValueConfigItem<float>
	{
		internal float MaxValue { get; private set; }

		internal float MinValue { get; private set; }

		public FloatInputFieldConfigItem(ConfigEntry<float> configEntry)
			: this(configEntry, requiresRestart: true)
		{
		}

		public FloatInputFieldConfigItem(ConfigEntry<float> configEntry, bool requiresRestart)
			: this(configEntry, GetDefaultOptions(configEntry, requiresRestart))
		{
		}

		public FloatInputFieldConfigItem(ConfigEntry<float> configEntry, FloatInputFieldOptions options)
			: base(configEntry, (BaseOptions)options)
		{
			AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues;
			MinValue = (options.IsMinSet ? options.Min : ((acceptableValues as AcceptableValueRange<float>)?.MinValue ?? 0f));
			MaxValue = (options.IsMaxSet ? options.Max : ((acceptableValues as AcceptableValueRange<float>)?.MaxValue ?? 1f));
		}

		internal override GameObject CreateGameObjectForConfig()
		{
			return Object.Instantiate<GameObject>(Assets.FloatInputFieldPrefab);
		}

		private static FloatInputFieldOptions GetDefaultOptions(ConfigEntry<float> configEntry, bool requiresRestart = true)
		{
			AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues;
			return new FloatInputFieldOptions
			{
				Min = ((acceptableValues as AcceptableValueRange<float>)?.MinValue ?? float.MinValue),
				Max = ((acceptableValues as AcceptableValueRange<float>)?.MaxValue ?? float.MaxValue),
				RequiresRestart = requiresRestart
			};
		}
	}
	public sealed class FloatSliderConfigItem : BaseValueConfigItem<float>
	{
		internal float MaxValue { get; private set; }

		internal float MinValue { get; private set; }

		public FloatSliderConfigItem(ConfigEntry<float> configEntry)
			: this(configEntry, requiresRestart: true)
		{
		}

		public FloatSliderConfigItem(ConfigEntry<float> configEntry, bool requiresRestart)
			: this(configEntry, GetDefaultOptions(configEntry, requiresRestart))
		{
		}

		public FloatSliderConfigItem(ConfigEntry<float> configEntry, FloatSliderOptions options)
			: base(configEntry, (BaseOptions)options)
		{
			AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues;
			MinValue = (options.IsMinSet ? options.Min : ((acceptableValues as AcceptableValueRange<float>)?.MinValue ?? 0f));
			MaxValue = (options.IsMaxSet ? options.Max : ((acceptableValues as AcceptableValueRange<float>)?.MaxValue ?? 1f));
		}

		internal override GameObject CreateGameObjectForConfig()
		{
			return Object.Instantiate<GameObject>(Assets.FloatSliderPrefab);
		}

		private static FloatSliderOptions GetDefaultOptions(ConfigEntry<float> configEntry, bool requiresRestart = true)
		{
			AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues;
			return new FloatSliderOptions
			{
				Min = ((acceptableValues as AcceptableValueRange<float>)?.MinValue ?? 0f),
				Max = ((acceptableValues as AcceptableValueRange<float>)?.MaxValue ?? 1f),
				RequiresRestart = requiresRestart
			};
		}
	}
	public sealed class FloatStepSliderConfigItem : BaseValueConfigItem<float>
	{
		internal float MaxValue { get; private set; }

		internal float MinValue { get; private set; }

		internal float Step { get; private set; }

		public FloatStepSliderConfigItem(ConfigEntry<float> configEntry)
			: this(configEntry, requiresRestart: true)
		{
		}

		public FloatStepSliderConfigItem(ConfigEntry<float> configEntry, bool requiresRestart)
			: this(configEntry, GetDefaultOptions(configEntry, requiresRestart))
		{
		}

		public FloatStepSliderConfigItem(ConfigEntry<float> configEntry, FloatStepSliderOptions options)
			: base(configEntry, (BaseOptions)options)
		{
			AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues;
			MinValue = (options.IsMinSet ? options.Min : ((acceptableValues as AcceptableValueRange<float>)?.MinValue ?? 0f));
			MaxValue = (options.IsMaxSet ? options.Max : ((acceptableValues as AcceptableValueRange<float>)?.MaxValue ?? 1f));
			Step = options.Step;
		}

		internal override GameObject CreateGameObjectForConfig()
		{
			return Object.Instantiate<GameObject>(Assets.FloatStepSliderPrefab);
		}

		private static FloatStepSliderOptions GetDefaultOptions(ConfigEntry<float> configEntry, bool requiresRestart = true)
		{
			AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues;
			return new FloatStepSliderOptions
			{
				Min = ((acceptableValues as AcceptableValueRange<float>)?.MinValue ?? 0f),
				Max = ((acceptableValues as AcceptableValueRange<float>)?.MaxValue ?? 1f),
				Step = 0.1f,
				RequiresRestart = requiresRestart
			};
		}
	}
	public class GenericButtonConfigItem : BaseConfigItem
	{
		public GenericButtonOptions ButtonOptions => base.Options as GenericButtonOptions;

		public GenericButtonConfigItem(string section, string name, string description, string buttonText, GenericButtonOptions.GenericButtonHandler buttonHandler)
			: base(new GenericButtonOptions
			{
				Section = section,
				Name = name,
				Description = description,
				ButtonText = buttonText,
				ButtonHandler = buttonHandler,
				RequiresRestart = false
			})
		{
		}

		internal override GameObject CreateGameObjectForConfig()
		{
			return Object.Instantiate<GameObject>(Assets.GenericButtonPrefab);
		}
	}
	public sealed class IntInputFieldConfigItem : BaseValueConfigItem<int>
	{
		internal int MaxValue { get; private set; }

		internal int MinValue { get; private set; }

		public IntInputFieldConfigItem(ConfigEntry<int> configEntry)
			: this(configEntry, requiresRestart: true)
		{
		}

		public IntInputFieldConfigItem(ConfigEntry<int> configEntry, bool requiresRestart)
			: this(configEntry, GetDefaultOptions(configEntry, requiresRestart))
		{
		}

		public IntInputFieldConfigItem(ConfigEntry<int> configEntry, IntInputFieldOptions options)
			: base(configEntry, (BaseOptions)options)
		{
			AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues;
			MinValue = (options.IsMinSet ? options.Min : ((acceptableValues as AcceptableValueRange<int>)?.MinValue ?? 0));
			MaxValue = (options.IsMaxSet ? options.Max : ((acceptableValues as AcceptableValueRange<int>)?.MaxValue ?? 100));
		}

		internal override GameObject CreateGameObjectForConfig()
		{
			return Object.Instantiate<GameObject>(Assets.IntInputFieldPrefab);
		}

		private static IntInputFieldOptions GetDefaultOptions(ConfigEntry<int> configEntry, bool requiresRestart = true)
		{
			AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues;
			return new IntInputFieldOptions
			{
				Min = ((acceptableValues as AcceptableValueRange<int>)?.MinValue ?? int.MinValue),
				Max = ((acceptableValues as AcceptableValueRange<int>)?.MaxValue ?? int.MaxValue),
				RequiresRestart = requiresRestart
			};
		}
	}
	public sealed class IntSliderConfigItem : BaseValueConfigItem<int>
	{
		internal int MaxValue { get; private set; }

		internal int MinValue { get; private set; }

		public IntSliderConfigItem(ConfigEntry<int> configEntry)
			: this(configEntry, requiresRestart: true)
		{
		}

		public IntSliderConfigItem(ConfigEntry<int> configEntry, bool requiresRestart)
			: this(configEntry, GetDefaultOptions(configEntry, requiresRestart))
		{
		}

		public IntSliderConfigItem(ConfigEntry<int> configEntry, IntSliderOptions options)
			: base(configEntry, (BaseOptions)options)
		{
			AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues;
			MinValue = (options.IsMinSet ? options.Min : ((acceptableValues as AcceptableValueRange<int>)?.MinValue ?? 0));
			MaxValue = (options.IsMaxSet ? options.Max : ((acceptableValues as AcceptableValueRange<int>)?.MaxValue ?? 100));
		}

		internal override GameObject CreateGameObjectForConfig()
		{
			return Object.Instantiate<GameObject>(A

plugins/LethalEscape/LethalEscape.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("LethalEscape")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalEscape")]
[assembly: AssemblyTitle("LethalEscape")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[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 LethalEscape
{
	internal class LETimerFunctions : MonoBehaviour
	{
		public static float MinuteEscapeTimerPuffer;

		public static float MinuteEscapeTimerBracken;

		public static float MinuteEscapeTimerHoardingBug;

		public static LETimerFunctions instance;

		private void Awake()
		{
			instance = this;
		}

		private void Update()
		{
			MinuteEscapeTimerBracken += Time.deltaTime;
			MinuteEscapeTimerHoardingBug += Time.deltaTime;
			MinuteEscapeTimerPuffer += Time.deltaTime;
		}
	}
	[BepInPlugin("xCeezy.LethalEscape", "Lethal Escape", "0.8.2")]
	public class Plugin : BaseUnityPlugin
	{
		public static GameObject ExtraValues;

		private const string modGUID = "xCeezy.LethalEscape";

		private const string modName = "Lethal Escape";

		private const string modVersion = "0.8.2";

		private Harmony _harmony = new Harmony("LethalEscape");

		public static ManualLogSource mls;

		public static float TimeStartTeleport;

		public static ConfigEntry<bool> CanThumperEscape;

		public static ConfigEntry<bool> CanBrackenEscape;

		public static ConfigEntry<bool> CanJesterEscape;

		public static ConfigEntry<bool> CanHoardingBugEscape;

		public static ConfigEntry<bool> CanCoilHeadEscape;

		public static ConfigEntry<bool> CanSpiderEscape;

		public static ConfigEntry<bool> CanNutCrackerEscape;

		public static ConfigEntry<bool> CanHygrodereEscape;

		public static ConfigEntry<bool> CanPufferEscape;

		public static float JesterSpeedWindup;

		public static ConfigEntry<float> BrackenChanceToEscapeEveryMinute;

		public static ConfigEntry<float> PufferChanceToEscapeEveryMinute;

		public static ConfigEntry<float> HoardingBugChanceToEscapeEveryMinute;

		public static ConfigEntry<float> HoardingBugChanceToNestNearShip;

		public static ConfigEntry<float> HoardingBugChanceToSpawnOutside;

		public static ConfigEntry<float> BrackenChanceToSpawnOutside;

		public static ConfigEntry<float> PufferChanceToSpawnOutside;

		public static ConfigEntry<float> JesterChanceToSpawnOutside;

		public static ConfigEntry<float> HygrodereChanceToSpawnOutside;

		public static ConfigEntry<float> NutCrackerChanceToSpawnOutside;

		public static ConfigEntry<float> ThumperChanceToSpawnOutside;

		public static ConfigEntry<float> SpiderChanceToSpawnOutside;

		public static ConfigEntry<float> JesterSpeedIncreasePerSecond;

		public static ConfigEntry<float> MaxJesterOutsideSpeed;

		public static ConfigEntry<float> BrackenEscapeDelay;

		public static ConfigEntry<float> ThumperEscapeDelay;

		public static ConfigEntry<int> SpiderMinWebsOutside;

		public static ConfigEntry<int> SpiderMaxWebsOutside;

		private void Awake()
		{
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Expected O, but got Unknown
			CanThumperEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "ThumperEscape", true, "Whether or not the Thumper can escape");
			CanBrackenEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "BrackenEscape", true, "Whether or not the Bracken can escape");
			CanJesterEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "JesterEscape", true, "Whether or not the Jester can escape");
			CanHoardingBugEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "HoardingBugEscape", true, "Whether or not the Hoarding Bugs can escape");
			CanCoilHeadEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "CoilHeadEscape", true, "Whether or not Coil Head can escape");
			CanSpiderEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "SpiderEscape", true, "Whether or not the Spider can escape");
			CanNutCrackerEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "NutCrackerEscape", true, "Whether or not the Nut Cracker can escape");
			CanHygrodereEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "HygrodereEscape", false, "Whether or not the Hygrodere/Slime can escape");
			CanPufferEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "CanPufferEscape", true, "Whether or not the Puffer/Spore Lizard can escape");
			ThumperChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "ThumperSpawnOutsideChance", 5f, "The chance that the Thumper will spawn outside");
			BrackenChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "BrackenSpawnOutsideChance", 10f, "The chance that the Bracken will spawn outside");
			JesterChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "JesterSpawnOutsideChance", 0f, "The chance that the Jester will spawn outside");
			HoardingBugChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "HoardingBugSpawnOutsideChance", 30f, "The chance that the Hoarding Bug will spawn outside");
			SpiderChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "SpiderSpawnOutsideChance", 5f, "The chance that the Spider will spawn outside");
			NutCrackerChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "NutCrackerSpawnOutsideChance", 5f, "The chance that the NutCracker will spawn outside");
			HygrodereChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "HygrodereSpawnOutsideChance", 0f, "The chance that the Hygrodere will spawn outside");
			PufferChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "PufferSpawnOutsideChance", 5f, "The chance that the Puffer will spawn outside");
			PufferChanceToEscapeEveryMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Puffer Escape Chance", 10f, "The chance that the Puffer/Spore Lizard will escape randomly every minute");
			BrackenChanceToEscapeEveryMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Bracken Escape Chance", 10f, "The chance that the Bracken will escape randomly every minute");
			HoardingBugChanceToEscapeEveryMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "HoardingBug Escape Chance", 15f, "The chance that the Hoarding Bug will escape randomly every minute");
			HoardingBugChanceToNestNearShip = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "HoardingBugShipNestChance", 50f, "The chance that the Hoarding Bug will make their nest at/near the ship");
			BrackenEscapeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Bracken Escape Delay", 5f, "Time it takes for the Bracken to follow a player outside");
			ThumperEscapeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Thumper Escape Delay", -5f, "Time it takes for the Thumper to follow a player outside which is based on how long the player was seen minus this value (Might break when under -15 and will force thumper outside when it sees someone when above 0)");
			SpiderMaxWebsOutside = ((BaseUnityPlugin)this).Config.Bind<int>("Escape Settings", "Max Spider Webs Outside", 28, "The maximum amount of spider webs the game will allow the spider to create webs outside (Vanilla game is 7 or 9 if update 47)");
			SpiderMinWebsOutside = ((BaseUnityPlugin)this).Config.Bind<int>("Escape Settings", "Min Spider Webs Outside", 20, "The minimum amount of spider webs the game will allow the spider to create webs outside (Vanilla game is 4 or 6 if update 47)");
			JesterSpeedIncreasePerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Jester Speed Increase", 1.35f, "How much speed the jester gets per second");
			MaxJesterOutsideSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Jester Outside Speed", 10f, "The max speed the Jester moves while outside (5 is the speed its at while in the box and 18 is jesters max speed inside the facility)");
			if ((Object)(object)ExtraValues == (Object)null)
			{
				ExtraValues = new GameObject();
				Object.DontDestroyOnLoad((Object)(object)ExtraValues);
				((Object)ExtraValues).hideFlags = (HideFlags)61;
				ExtraValues.AddComponent<LETimerFunctions>();
			}
			mls = Logger.CreateLogSource("GameMaster");
			mls.LogInfo((object)"Loaded xCeezy.LethalEscape. Patching.");
			_harmony.PatchAll(typeof(Plugin));
		}

		[HarmonyPatch(typeof(CrawlerAI), "Update")]
		[HarmonyPrefix]
		private static void CrawlerLEPrefixAI(CrawlerAI __instance)
		{
			if (((EnemyAI)__instance).isEnemyDead || !CanThumperEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				return;
			}
			if (!((EnemyAI)__instance).isOutside)
			{
				if (((EnemyAI)__instance).currentBehaviourStateIndex != 0 && __instance.noticePlayerTimer < ThumperEscapeDelay.Value && (Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
			else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
		}

		[HarmonyPatch(typeof(CrawlerAI), "OnCollideWithPlayer")]
		[HarmonyPostfix]
		public static void ThumperAILEOutsideAttack(CrawlerAI __instance, ref Collider other)
		{
			//IL_00d6: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !((double)__instance.timeSinceHittingPlayer <= 0.65) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f))
				{
					__instance.timeSinceHittingPlayer = 0f;
					((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
					component.DamagePlayer(40, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					component.DamagePlayerFromOtherClientServerRpc(40, Vector3.zero, -1);
					((EnemyAI)__instance).agent.speed = 0f;
					__instance.HitPlayerServerRpc((int)component.playerClientId);
					component.JumpToFearLevel(1f, true);
				}
			}
		}

		[HarmonyPatch(typeof(CrawlerAI), "Start")]
		[HarmonyPostfix]
		private static void CrawlerAILEPostfixStart(CrawlerAI __instance)
		{
			if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ThumperChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= ThumperChanceToSpawnOutside.Value)
			{
				SendEnemyOutside((EnemyAI)(object)__instance);
			}
		}

		[HarmonyPatch(typeof(JesterAI), "Update")]
		[HarmonyPrefix]
		private static void JesterLEPrefixAI(JesterAI __instance)
		{
			if (((EnemyAI)__instance).isEnemyDead || !CanJesterEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				return;
			}
			if (!((EnemyAI)__instance).isOutside)
			{
				if (((EnemyAI)__instance).currentBehaviourStateIndex == 2 && (Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
				{
					JesterSpeedWindup = 0f;
					SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false);
				}
			}
			else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
		}

		[HarmonyPatch(typeof(JesterAI), "Update")]
		[HarmonyPostfix]
		private static void JesterLEPostfixAI(JesterAI __instance)
		{
			if (!CanJesterEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost || !((EnemyAI)__instance).isOutside)
			{
				return;
			}
			if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
			bool flag = false;
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				if (StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled && !StartOfRound.Instance.allPlayerScripts[i].isInsideFactory)
				{
					flag = true;
				}
			}
			if (flag)
			{
				((EnemyAI)__instance).SwitchToBehaviourState(2);
				((EnemyAI)__instance).agent.stoppingDistance = 0f;
			}
			JesterSpeedWindup = Mathf.Clamp(JesterSpeedWindup + Time.deltaTime * JesterSpeedIncreasePerSecond.Value, 0f, MaxJesterOutsideSpeed.Value);
			((EnemyAI)__instance).agent.speed = JesterSpeedWindup;
		}

		[HarmonyPatch(typeof(JesterAI), "OnCollideWithPlayer")]
		[HarmonyPostfix]
		public static void JesterAILEOutsideAttack(JesterAI __instance, ref Collider other)
		{
			if (!((EnemyAI)__instance).isEnemyDead && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ((EnemyAI)__instance).isOutside)
			{
				if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
				{
					((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
				}
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>()) && ((EnemyAI)__instance).currentBehaviourStateIndex == 2)
				{
					__instance.KillPlayerServerRpc((int)component.playerClientId);
				}
			}
		}

		[HarmonyPatch(typeof(JesterAI), "Start")]
		[HarmonyPostfix]
		private static void JesterAILEPostfixStart(JesterAI __instance)
		{
			if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && JesterChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= JesterChanceToSpawnOutside.Value)
			{
				SendEnemyOutside((EnemyAI)(object)__instance);
			}
		}

		[HarmonyPatch(typeof(FlowermanAI), "Update")]
		[HarmonyPrefix]
		private static void FlowermanAILEPrefixAI(FlowermanAI __instance)
		{
			if (((EnemyAI)__instance).isEnemyDead || !CanBrackenEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				return;
			}
			if (!((EnemyAI)__instance).isOutside)
			{
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory && (((EnemyAI)__instance).currentBehaviourStateIndex == 1 || __instance.evadeStealthTimer > 0f) && Time.time - TimeStartTeleport >= BrackenEscapeDelay.Value + 5f)
				{
					TimeStartTeleport = Time.time;
				}
				if (Time.time - TimeStartTeleport > BrackenEscapeDelay.Value && Time.time - TimeStartTeleport < BrackenEscapeDelay.Value + 5f)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
				else if (LETimerFunctions.MinuteEscapeTimerBracken >= 60f && (Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null)
				{
					LETimerFunctions.MinuteEscapeTimerBracken = 0f;
					if (BrackenChanceToEscapeEveryMinute.Value != 0f && (float)Random.Range(1, 100) <= BrackenChanceToEscapeEveryMinute.Value)
					{
						SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false);
					}
				}
			}
			else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
		}

		[HarmonyPatch(typeof(FlowermanAI), "Update")]
		[HarmonyPostfix]
		private static void FlowermanAILEPostfixAI(FlowermanAI __instance)
		{
			if (!((EnemyAI)__instance).isEnemyDead && CanBrackenEscape.Value && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
		}

		[HarmonyPatch(typeof(FlowermanAI), "OnCollideWithPlayer")]
		[HarmonyPostfix]
		public static void FlowerManAILEOutsideAttack(FlowermanAI __instance, ref Collider other, bool ___startingKillAnimationLocalClient)
		{
			if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !__instance.inKillAnimation && !___startingKillAnimationLocalClient)
				{
					__instance.KillPlayerAnimationServerRpc((int)component.playerClientId);
					___startingKillAnimationLocalClient = true;
				}
			}
		}

		[HarmonyPatch(typeof(FlowermanAI), "Start")]
		[HarmonyPostfix]
		private static void FlowermanAILEPostfixStart(FlowermanAI __instance)
		{
			TimeStartTeleport = 0f;
			if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && BrackenChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= BrackenChanceToSpawnOutside.Value)
			{
				SendEnemyOutside((EnemyAI)(object)__instance);
			}
		}

		[HarmonyPatch(typeof(HoarderBugAI), "Update")]
		[HarmonyPrefix]
		private static void HoardingBugAILEPrefixAI(HoarderBugAI __instance)
		{
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			if (((EnemyAI)__instance).isEnemyDead || !CanHoardingBugEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				return;
			}
			if (!((EnemyAI)__instance).isOutside)
			{
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory && __instance.searchForPlayer.inProgress)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
				else
				{
					if (!(LETimerFunctions.MinuteEscapeTimerHoardingBug >= 60f) || !((Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null))
					{
						return;
					}
					LETimerFunctions.MinuteEscapeTimerHoardingBug = 0f;
					if ((float)Random.Range(1, 100) <= HoardingBugChanceToEscapeEveryMinute.Value / (float)Object.FindObjectsOfType(typeof(HoarderBugAI)).Length)
					{
						SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false);
						if (HoardingBugChanceToNestNearShip.Value != 0f && (float)Random.Range(1, 100) <= HoardingBugChanceToNestNearShip.Value)
						{
							StartOfRound val = (StartOfRound)Object.FindObjectOfType(typeof(StartOfRound));
							Transform val2 = ((EnemyAI)__instance).ChooseClosestNodeToPosition(val.elevatorTransform.position, false, 0);
							__instance.nestPosition = val2.position;
						}
					}
				}
			}
			else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
		}

		[HarmonyPatch(typeof(HoarderBugAI), "OnCollideWithPlayer")]
		[HarmonyPostfix]
		public static void HoardingBugAILEOutsideAttack(HoarderBugAI __instance, ref Collider other)
		{
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !((double)__instance.timeSinceHittingPlayer <= 0.5) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f) && __instance.inChase)
				{
					__instance.timeSinceHittingPlayer = 0f;
					component.DamagePlayer(30, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					component.DamagePlayerFromOtherClientServerRpc(30, Vector3.zero, -1);
					__instance.HitPlayerServerRpc();
				}
			}
		}

		[HarmonyPatch(typeof(HoarderBugAI), "Start")]
		[HarmonyPostfix]
		private static void HoardingBugAILEPostfixStart(HoarderBugAI __instance)
		{
			if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && HoardingBugChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= HoardingBugChanceToSpawnOutside.Value)
			{
				SendEnemyOutside((EnemyAI)(object)__instance);
			}
		}

		[HarmonyPatch(typeof(SpringManAI), "Update")]
		[HarmonyPrefix]
		private static void CoilHeadAILEPrefixAI(SpringManAI __instance)
		{
			if (((EnemyAI)__instance).isEnemyDead || !CanCoilHeadEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				return;
			}
			if (!((EnemyAI)__instance).isOutside)
			{
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
				{
					SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false);
				}
			}
			else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
		}

		[HarmonyPatch(typeof(SpringManAI), "OnCollideWithPlayer")]
		[HarmonyPostfix]
		public static void CoilHeadAILEOutsideAttack(SpringManAI __instance, ref Collider other)
		{
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !__instance.stoppingMovement && ((EnemyAI)__instance).currentBehaviourStateIndex == 1 && !(__instance.timeSinceHittingPlayer >= 0f) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f))
				{
					__instance.timeSinceHittingPlayer = 0.2f;
					component.DamagePlayer(90, true, true, (CauseOfDeath)6, 2, false, default(Vector3));
					component.DamagePlayerFromOtherClientServerRpc(90, Vector3.zero, -1);
					component.JumpToFearLevel(1f, true);
				}
			}
		}

		[HarmonyPatch(typeof(SandSpiderAI), "Update")]
		[HarmonyPrefix]
		private static void SpiderAILEPrefixAI(SandSpiderAI __instance)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			if (((EnemyAI)__instance).isEnemyDead || !CanSpiderEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				return;
			}
			if (!((EnemyAI)__instance).isOutside)
			{
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
				{
					SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false);
					__instance.meshContainerPosition = ((EnemyAI)__instance).serverPosition;
					__instance.meshContainerTarget = ((EnemyAI)__instance).serverPosition;
					__instance.maxWebTrapsToPlace += Random.Range(SpiderMinWebsOutside.Value, SpiderMaxWebsOutside.Value);
				}
			}
			else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
		}

		[HarmonyPatch(typeof(SandSpiderAI), "OnCollideWithPlayer")]
		[HarmonyPostfix]
		public static void SpiderAILEOutsideAttack(SandSpiderAI __instance, ref Collider other)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !__instance.onWall && !(__instance.timeSinceHittingPlayer <= 1f) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f))
				{
					__instance.timeSinceHittingPlayer = 0f;
					component.DamagePlayer(90, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					component.DamagePlayerFromOtherClientServerRpc(90, Vector3.zero, -1);
					__instance.HitPlayerServerRpc((int)component.playerClientId);
				}
			}
		}

		[HarmonyPatch(typeof(SandSpiderAI), "Start")]
		[HarmonyPostfix]
		private static void SpiderAILEPostfixStart(SandSpiderAI __instance)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && SpiderChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= SpiderChanceToSpawnOutside.Value)
			{
				SendEnemyOutside((EnemyAI)(object)__instance);
				__instance.meshContainerPosition = ((EnemyAI)__instance).serverPosition;
				__instance.meshContainerTarget = ((EnemyAI)__instance).serverPosition;
				__instance.maxWebTrapsToPlace = Random.Range(SpiderMinWebsOutside.Value, SpiderMaxWebsOutside.Value);
			}
		}

		[HarmonyPatch(typeof(NutcrackerEnemyAI), "Update")]
		[HarmonyPrefix]
		private static void NutCrackerAILEPrefixAI(NutcrackerEnemyAI __instance)
		{
			if (((EnemyAI)__instance).isEnemyDead || !CanNutCrackerEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				return;
			}
			if (!((EnemyAI)__instance).isOutside)
			{
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
				{
					SendEnemyOutside((EnemyAI)(object)__instance);
				}
			}
			else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
		}

		[HarmonyPatch(typeof(NutcrackerEnemyAI), "OnCollideWithPlayer")]
		[HarmonyPostfix]
		public static void NutCrackerAILEOutsideAttack(NutcrackerEnemyAI __instance, ref Collider other)
		{
			if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !(((EnemyAI)__instance).stunNormalizedTimer >= 0f) && !(__instance.timeSinceHittingPlayer < 1f))
				{
					__instance.timeSinceHittingPlayer = 0f;
					__instance.LegKickPlayerServerRpc((int)component.playerClientId);
				}
			}
		}

		[HarmonyPatch(typeof(NutcrackerEnemyAI), "Start")]
		[HarmonyPostfix]
		private static void NutCrackerAILEPostfixStart(NutcrackerEnemyAI __instance)
		{
			if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && NutCrackerChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= NutCrackerChanceToSpawnOutside.Value)
			{
				SendEnemyOutside((EnemyAI)(object)__instance);
			}
		}

		[HarmonyPatch(typeof(BlobAI), "Update")]
		[HarmonyPrefix]
		private static void BlobAILEPrefixAI(BlobAI __instance)
		{
			if (((EnemyAI)__instance).isEnemyDead || !CanHygrodereEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				return;
			}
			if (!((EnemyAI)__instance).isOutside)
			{
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
				{
					SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false);
					__instance.centerPoint = ((Component)__instance).transform;
				}
			}
			else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
		}

		[HarmonyPatch(typeof(BlobAI), "OnCollideWithPlayer")]
		[HarmonyPostfix]
		public static void BlobAILEOutsideAttack(BlobAI __instance, ref Collider other)
		{
			//IL_00be: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			if (((EnemyAI)__instance).isEnemyDead || !((EnemyAI)__instance).isOutside || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				return;
			}
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !(__instance.timeSinceHittingLocalPlayer < 0.25f) && (!(__instance.tamedTimer > 0f) || !(__instance.angeredTimer < 0f)))
			{
				__instance.timeSinceHittingLocalPlayer = 0f;
				component.DamagePlayerFromOtherClientServerRpc(35, Vector3.zero, -1);
				component.DamagePlayer(35, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				if (component.isPlayerDead)
				{
					__instance.SlimeKillPlayerEffectServerRpc((int)component.playerClientId);
				}
			}
		}

		[HarmonyPatch(typeof(BlobAI), "Start")]
		[HarmonyPostfix]
		private static void HygrodereAILEPostfixStart(BlobAI __instance)
		{
			if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && HygrodereChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= HygrodereChanceToSpawnOutside.Value)
			{
				SendEnemyOutside((EnemyAI)(object)__instance);
				__instance.centerPoint = ((Component)__instance).transform;
			}
		}

		[HarmonyPatch(typeof(PufferAI), "Update")]
		[HarmonyPrefix]
		private static void PufferAILEPrefixAI(PufferAI __instance)
		{
			if (((EnemyAI)__instance).isEnemyDead || !CanPufferEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				return;
			}
			if (!((EnemyAI)__instance).isOutside)
			{
				if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory)
				{
					SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false);
				}
				else if (LETimerFunctions.MinuteEscapeTimerPuffer >= 60f && (Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null)
				{
					LETimerFunctions.MinuteEscapeTimerPuffer = 0f;
					if (PufferChanceToEscapeEveryMinute.Value != 0f && (float)Random.Range(1, 100) <= PufferChanceToEscapeEveryMinute.Value)
					{
						SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false);
					}
				}
			}
			else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
		}

		[HarmonyPatch(typeof(PufferAI), "OnCollideWithPlayer")]
		[HarmonyPostfix]
		public static void PufferAILEOutsideAttack(PufferAI __instance, ref Collider other)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !(__instance.timeSinceHittingPlayer <= 1f))
				{
					__instance.timeSinceHittingPlayer = 0f;
					component.DamagePlayer(20, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					component.DamagePlayerFromOtherClientServerRpc(20, Vector3.zero, -1);
					__instance.BitePlayerServerRpc((int)component.playerClientId);
				}
			}
		}

		[HarmonyPatch(typeof(PufferAI), "Start")]
		[HarmonyPostfix]
		private static void PufferAILEPostfixStart(PufferAI __instance)
		{
			if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && PufferChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= PufferChanceToSpawnOutside.Value)
			{
				SendEnemyOutside((EnemyAI)(object)__instance);
			}
		}

		public static void SendEnemyInside(EnemyAI __instance)
		{
			//IL_0069: 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)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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)
			//IL_00a1: 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_004a: 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)
			__instance.isOutside = false;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false);
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].entranceId == 0 && !array[i].isEntranceToBuilding)
				{
					__instance.serverPosition = array[i].entrancePoint.position;
					break;
				}
			}
			Transform val = __instance.ChooseClosestNodeToPosition(__instance.serverPosition, false, 0);
			if (Vector3.Magnitude(val.position - __instance.serverPosition) > 10f)
			{
				__instance.serverPosition = val.position;
				((Component)__instance).transform.position = __instance.serverPosition;
			}
			((Component)__instance).transform.position = __instance.serverPosition;
			__instance.agent.Warp(__instance.serverPosition);
			__instance.SyncPositionToClients();
		}

		public static void SendEnemyOutside(EnemyAI __instance, bool SpawnOnDoor = true)
		{
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			__instance.isOutside = true;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false);
			float num = 999f;
			for (int i = 0; i < array.Length; i++)
			{
				if (!array[i].isEntranceToBuilding)
				{
					continue;
				}
				for (int j = 0; j < StartOfRound.Instance.connectedPlayersAmount + 1; j++)
				{
					if (!StartOfRound.Instance.allPlayerScripts[j].isInsideFactory & (Vector3.Magnitude(((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position - array[i].entrancePoint.position) < num))
					{
						num = Vector3.Magnitude(((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position - array[i].entrancePoint.position);
						__instance.serverPosition = array[i].entrancePoint.position;
					}
				}
			}
			if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
			{
				__instance.ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
			}
			Transform val = __instance.ChooseClosestNodeToPosition(__instance.serverPosition, false, 0);
			if (Vector3.Magnitude(val.position - __instance.serverPosition) > 10f || !SpawnOnDoor)
			{
				__instance.serverPosition = val.position;
			}
			((Component)__instance).transform.position = __instance.serverPosition;
			__instance.agent.Warp(__instance.serverPosition);
			__instance.SyncPositionToClients();
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				__instance.EnableEnemyMesh(!StartOfRound.Instance.hangarDoorsClosed || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom, false);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

plugins/LethalNetworkAPI/LethalNetworkAPI.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalNetworkAPI.NetcodePatcher;
using LethalNetworkAPI.Networking;
using LethalNetworkAPI.Serializable;
using Microsoft.CodeAnalysis;
using OdinSerializer;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RegisterFormatter(typeof(NetworkBehaviourFormatter), 0)]
[assembly: RegisterFormatter(typeof(NetworkBehaviourReferenceFormatter), 0)]
[assembly: RegisterFormatter(typeof(NetworkObjectFormatter), 0)]
[assembly: RegisterFormatter(typeof(GameObjectFormatter), 0)]
[assembly: RegisterFormatter(typeof(NetworkObjectReferenceFormatter), 0)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("Xilophor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Easily create networked mods.")]
[assembly: AssemblyFileVersion("2.1.5.0")]
[assembly: AssemblyInformationalVersion("2.1.5+2f35e1a0cb179e39855d38fbb4f6a156ebc64887")]
[assembly: AssemblyProduct("LethalNetworkAPI")]
[assembly: AssemblyTitle("LethalNetworkAPI")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Xilophor/LethalNetworkAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalNetworkAPI
{
	public sealed class LethalClientEvent : LNetworkEvent
	{
		public event Action? OnReceived;

		public event Action<ulong>? OnReceivedFromClient;

		public LethalClientEvent(string identifier, Action? onReceived = null, Action<ulong>? onReceivedFromClient = null)
			: base(identifier)
		{
			NetworkHandler.OnClientEvent += ReceiveClientEvent;
			NetworkHandler.OnSyncedClientEvent += ReceiveSyncedClientEvent;
			OnReceived += onReceived;
			OnReceivedFromClient += onReceivedFromClient;
		}

		public void InvokeServer()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNetworkHandlerNull())
			{
				NetworkHandler.Instance.EventServerRpc(Identifier);
			}
		}

		public void InvokeAllClients(bool includeLocalClient = true, bool waitForServerResponse = false)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNetworkHandlerNull())
			{
				NetworkHandler.Instance.EventServerRpc(Identifier, toOtherClients: true, includeLocalClient && waitForServerResponse);
				if (includeLocalClient && !waitForServerResponse)
				{
					this.OnReceivedFromClient?.Invoke(NetworkManager.Singleton.LocalClientId);
				}
			}
		}

		public void InvokeAllClientsSynced()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNetworkHandlerNull())
			{
				NetworkTime localTime = NetworkManager.Singleton.LocalTime;
				double time = ((NetworkTime)(ref localTime)).Time;
				NetworkHandler.Instance.SyncedEventServerRpc(Identifier, time);
				ReceiveClientEvent(Identifier, NetworkManager.Singleton.LocalClientId);
			}
		}

		private void ReceiveClientEvent(string identifier, ulong originatorClientId)
		{
			if (!(identifier != Identifier))
			{
				if (originatorClientId == 99999)
				{
					this.OnReceived?.Invoke();
				}
				else
				{
					this.OnReceivedFromClient?.Invoke(originatorClientId);
				}
			}
		}

		private void ReceiveSyncedClientEvent(string identifier, double time, ulong originatorClientId)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (!(identifier != Identifier) && !((Object)(object)NetworkHandler.Instance == (Object)null))
			{
				NetworkTime serverTime = NetworkManager.Singleton.ServerTime;
				double num = time - ((NetworkTime)(ref serverTime)).Time;
				((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(WaitAndInvokeEvent((float)num, originatorClientId));
			}
		}

		private IEnumerator WaitAndInvokeEvent(float timeToWait, ulong originatorClientId)
		{
			if (timeToWait > 0f)
			{
				yield return (object)new WaitForSeconds(timeToWait);
			}
			ReceiveClientEvent(Identifier, originatorClientId);
		}
	}
	public sealed class LethalServerEvent : LNetworkEvent
	{
		public event Action<ulong>? OnReceived;

		public LethalServerEvent(string identifier, Action<ulong>? onReceived = null)
			: base(identifier)
		{
			NetworkHandler.OnServerEvent += ReceiveServerEvent;
			NetworkHandler.OnSyncedServerEvent += ReceiveSyncedServerEvent;
			OnReceived += onReceived;
		}

		public void InvokeClient(ulong clientId)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNetworkHandlerNull() && IsHostOrServer())
			{
				NetworkHandler.Instance.EventClientRpc(Identifier, 99999uL, GenerateClientParams(clientId));
			}
		}

		public void InvokeClients(IEnumerable<ulong> clientIds)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNetworkHandlerNull() && IsHostOrServer())
			{
				NetworkHandler.Instance.EventClientRpc(Identifier, 99999uL, GenerateClientParams(clientIds));
			}
		}

		public void InvokeAllClients(bool receiveOnHost = true)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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)
			if (!IsNetworkHandlerNull() && IsHostOrServer())
			{
				if (receiveOnHost)
				{
					NetworkHandler.Instance.EventClientRpc(Identifier, 99999uL);
				}
				else
				{
					NetworkHandler.Instance.EventClientRpc(Identifier, 99999uL, GenerateClientParamsExceptHost());
				}
			}
		}

		private void ReceiveServerEvent(string identifier, ulong originClientId)
		{
			if (!(identifier != Identifier))
			{
				this.OnReceived?.Invoke(originClientId);
			}
		}

		private void ReceiveSyncedServerEvent(string identifier, double time, ulong originatorClientId)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (!(identifier != Identifier) && !IsNetworkHandlerNull())
			{
				NetworkTime serverTime = NetworkManager.Singleton.ServerTime;
				double num = time - ((NetworkTime)(ref serverTime)).Time;
				NetworkHandler.Instance.SyncedEventClientRpc(identifier, time, originatorClientId, GenerateClientParamsExcept(originatorClientId));
				((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(WaitAndInvokeEvent((float)num, originatorClientId));
			}
		}

		private IEnumerator WaitAndInvokeEvent(float timeToWait, ulong clientId)
		{
			if (timeToWait > 0f)
			{
				yield return (object)new WaitForSeconds(timeToWait);
			}
			this.OnReceived?.Invoke(clientId);
		}
	}
	public abstract class LNetworkEvent : LethalNetwork
	{
		protected LNetworkEvent(string identifier)
			: base("evt." + identifier, "Event")
		{
		}
	}
	public abstract class LethalNetwork
	{
		internal readonly string Identifier;

		private readonly string _networkType;

		protected LethalNetwork(string identifier, string networkType, int frameIndex = 3)
		{
			try
			{
				MethodBase method = new StackTrace().GetFrame(frameIndex).GetMethod();
				Assembly assembly = method.ReflectedType.Assembly;
				Type type2 = AccessTools.GetTypesFromAssembly(assembly).First((Type type) => type.GetCustomAttributes(typeof(BepInPlugin), inherit: false).Any());
				Identifier = MetadataHelper.GetMetadata(type2).GUID + "." + identifier;
				_networkType = networkType;
			}
			catch (Exception arg)
			{
				LethalNetworkAPIPlugin.Logger.LogError((object)$"Unable to find plugin info for calling mod for {_networkType.ToLower()} with identifier \"{Identifier}\". Are you using BepInEx? \n Stacktrace: {arg}");
			}
		}

		protected bool IsNetworkHandlerNull(bool log = true)
		{
			if ((Object)(object)NetworkHandler.Instance != (Object)null)
			{
				return false;
			}
			if (log)
			{
				LethalNetworkAPIPlugin.Logger.LogError((object)string.Format("Unable to invoke the {1} with identifier \"{0}\". Is the player in a lobby?", _networkType.ToLower(), Identifier));
			}
			return true;
		}

		protected bool IsHostOrServer(bool log = true)
		{
			if ((Object)(object)NetworkManager.Singleton == (Object)null)
			{
				return false;
			}
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				return true;
			}
			if (log)
			{
				LethalNetworkAPIPlugin.Logger.LogError((object)$"The client {NetworkManager.Singleton.LocalClientId} cannot use server methods. {_networkType} Identifier: \"{Identifier}\"");
			}
			return false;
		}

		private bool DoClientsExist(IEnumerable<ulong> clientIds, bool log = true)
		{
			if (clientIds.Any())
			{
				return true;
			}
			if (log)
			{
				LethalNetworkAPIPlugin.Logger.LogError((object)$"None of the specified clients {clientIds} are connected. {_networkType} Identifier: \"{Identifier}\"");
			}
			return false;
		}

		private ClientRpcParams GenerateClientParams(IEnumerable<ulong> clientIds, bool allExcept)
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			ulong[] enumerable = (clientIds as ulong[]) ?? clientIds.ToArray();
			NativeArray<ulong> val = default(NativeArray<ulong>);
			if (!enumerable.Any() && allExcept)
			{
				val..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != 0).ToArray(), (Allocator)4);
			}
			else if (allExcept)
			{
				val..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => enumerable.All((ulong j) => i != j)).ToArray(), (Allocator)4);
			}
			else
			{
				val..ctor(enumerable.Where((ulong i) => NetworkManager.Singleton.ConnectedClientsIds.Contains(i)).ToArray(), (Allocator)4);
			}
			if (!DoClientsExist((IEnumerable<ulong>)(object)val))
			{
				return default(ClientRpcParams);
			}
			ClientRpcParams result = default(ClientRpcParams);
			result.Send = new ClientRpcSendParams
			{
				TargetClientIdsNativeArray = val
			};
			return result;
		}

		protected ClientRpcParams GenerateClientParams(IEnumerable<ulong> clientIds)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return GenerateClientParams(clientIds, allExcept: false);
		}

		protected ClientRpcParams GenerateClientParams(ulong clientId)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return GenerateClientParams(new <>z__ReadOnlyArray<ulong>(new ulong[1] { clientId }), allExcept: false);
		}

		protected ClientRpcParams GenerateClientParamsExcept(IEnumerable<ulong> clientIds)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return GenerateClientParams(clientIds, allExcept: true);
		}

		protected ClientRpcParams GenerateClientParamsExcept(ulong clientId)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return GenerateClientParams(new <>z__ReadOnlyArray<ulong>(new ulong[1] { clientId }), allExcept: true);
		}

		protected ClientRpcParams GenerateClientParamsExceptHost()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return GenerateClientParams(Array.Empty<ulong>(), allExcept: true);
		}
	}
	[BepInPlugin("LethalNetworkAPI", "LethalNetworkAPI", "2.1.5")]
	public class LethalNetworkAPIPlugin : BaseUnityPlugin
	{
		public static LethalNetworkAPIPlugin Instance;

		private static Harmony _harmony;

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			_harmony = new Harmony("LethalNetworkAPI");
			NetcodePatcher();
			_harmony.PatchAll(typeof(NetworkObjectManager));
			Logger.LogInfo((object)"LethalNetworkAPI v2.1.5 has Loaded.");
		}

		private static void NetcodePatcher()
		{
			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);
					}
				}
			}
		}
	}
	public static class LethalNetworkExtensions
	{
		public static PlayerControllerB? GetPlayerController(this ulong clientId)
		{
			return StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[clientId]];
		}

		[Obsolete("GetPlayerFromId is deprecated, please use GetPlayerController instead.")]
		public static PlayerControllerB? GetPlayerFromId(this ulong clientId)
		{
			return clientId.GetPlayerController();
		}

		public static ulong GetClientId(this PlayerControllerB player)
		{
			return player.actualClientId;
		}

		public static LethalNetworkVariable<TData>? GetNetworkVariable<TData>(this NetworkBehaviour networkBehaviour, string identifier, bool serverOwned = false)
		{
			return ((Component)networkBehaviour).gameObject.NetworkVariable<TData>(identifier, serverOwned);
		}

		public static LethalNetworkVariable<TData>? GetNetworkVariable<TData>(this NetworkObject networkObject, string identifier, bool serverOwned = false)
		{
			return ((Component)networkObject).gameObject.NetworkVariable<TData>(identifier, serverOwned);
		}

		public static LethalNetworkVariable<TData>? GetNetworkVariable<TData>(this GameObject gameObject, string identifier, bool serverOwned = false)
		{
			return gameObject.NetworkVariable<TData>(identifier, serverOwned);
		}

		private static LethalNetworkVariable<TData>? NetworkVariable<TData>(this GameObject gameObject, string identifier, bool serverOwned)
		{
			string identifier2 = identifier;
			NetworkObject networkObjectComp = default(NetworkObject);
			if (!gameObject.TryGetComponent<NetworkObject>(ref networkObjectComp))
			{
				LethalNetworkAPIPlugin.Logger.LogError((object)$"Unable to find the network object component. Are you adding variable \"{identifier2}\" to a network object?");
				return null;
			}
			LethalNetworkVariable<TData> lethalNetworkVariable = (LethalNetworkVariable<TData>)NetworkHandler.Instance.ObjectNetworkVariableList.FirstOrDefault((ILethalNetVar i) => ((LethalNetworkVariable<TData>)i).Identifier == $"{identifier2}.{networkObjectComp.GlobalObjectIdHash}");
			if (lethalNetworkVariable != null)
			{
				return lethalNetworkVariable;
			}
			lethalNetworkVariable = new LethalNetworkVariable<TData>($"{identifier2}.{networkObjectComp.GlobalObjectIdHash}", networkObjectComp, serverOwned, 3);
			NetworkHandler.Instance.ObjectNetworkVariableList.Add(lethalNetworkVariable);
			return lethalNetworkVariable;
		}
	}
	public sealed class LethalClientMessage<TData> : LNetworkMessage
	{
		public event Action<TData>? OnReceived;

		public event Action<TData, ulong>? OnReceivedFromClient;

		public LethalClientMessage(string identifier, Action<TData>? onReceived = null, Action<TData, ulong>? onReceivedFromClient = null)
			: base(identifier)
		{
			NetworkHandler.OnClientMessage += ReceiveMessage;
			OnReceived += onReceived;
			OnReceivedFromClient += onReceivedFromClient;
		}

		public void SendServer(TData data)
		{
			//IL_001f: 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)
			if (!IsNetworkHandlerNull())
			{
				NetworkHandler.Instance.MessageServerRpc(Identifier, LethalNetworkSerializer.Serialize(data));
			}
		}

		public void SendAllClients(TData data, bool includeLocalClient = true, bool waitForServerResponse = false)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNetworkHandlerNull())
			{
				NetworkHandler.Instance.MessageServerRpc(Identifier, LethalNetworkSerializer.Serialize(data), toOtherClients: true, includeLocalClient && waitForServerResponse);
				if (includeLocalClient && !waitForServerResponse)
				{
					this.OnReceivedFromClient?.Invoke(data, NetworkManager.Singleton.LocalClientId);
				}
			}
		}

		private void ReceiveMessage(string identifier, byte[] data, ulong originatorClient)
		{
			if (!(identifier != Identifier))
			{
				if (originatorClient == 99999)
				{
					this.OnReceived?.Invoke(LethalNetworkSerializer.Deserialize<TData>(data));
				}
				else
				{
					this.OnReceivedFromClient?.Invoke(LethalNetworkSerializer.Deserialize<TData>(data), originatorClient);
				}
			}
		}
	}
	public class LethalServerMessage<TData> : LNetworkMessage
	{
		public event Action<TData, ulong>? OnReceived;

		public LethalServerMessage(string identifier, Action<TData, ulong>? onReceived = null)
			: base(identifier)
		{
			NetworkHandler.OnServerMessage += ReceiveServerMessage;
			OnReceived += onReceived;
		}

		public void SendClient(TData data, ulong clientId)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNetworkHandlerNull() && IsHostOrServer())
			{
				NetworkHandler.Instance.MessageClientRpc(Identifier, LethalNetworkSerializer.Serialize(data), 99999uL, GenerateClientParams(clientId));
			}
		}

		public void SendClients(TData data, IEnumerable<ulong> clientIds)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNetworkHandlerNull() && IsHostOrServer())
			{
				NetworkHandler.Instance.MessageClientRpc(Identifier, LethalNetworkSerializer.Serialize(data), 99999uL, GenerateClientParams(clientIds));
			}
		}

		public void SendAllClients(TData data, bool receiveOnHost = true)
		{
			//IL_0054: 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)
			if (!IsNetworkHandlerNull() && IsHostOrServer())
			{
				if (receiveOnHost)
				{
					NetworkHandler.Instance.MessageClientRpc(Identifier, LethalNetworkSerializer.Serialize(data), 99999uL);
				}
				else
				{
					NetworkHandler.Instance.MessageClientRpc(Identifier, LethalNetworkSerializer.Serialize(data), 99999uL, GenerateClientParamsExceptHost());
				}
			}
		}

		private void ReceiveServerMessage(string identifier, byte[] data, ulong originClientId)
		{
			if (!(identifier != Identifier))
			{
				this.OnReceived?.Invoke(LethalNetworkSerializer.Deserialize<TData>(data), originClientId);
			}
		}
	}
	public abstract class LNetworkMessage : LethalNetwork
	{
		protected LNetworkMessage(string identifier)
			: base("msg." + identifier, "Message")
		{
		}
	}
	internal static class TextDefinitions
	{
		internal const string NotInLobbyMessage = "Unable to send the {0} with identifier \"{1}\" and data {{{2}}}. Is the player in a lobby?";

		internal const string UnableToFindGuid = "Unable to find plugin info for calling mod for {0} with identifier \"{1}\". Are you using BepInEx? \n Stacktrace: {2}";

		internal const string NotServerInfo = "The client {0} cannot use server methods. {1} Identifier: \"{2}\"";

		internal const string NotInLobbyEvent = "Unable to invoke the {1} with identifier \"{0}\". Is the player in a lobby?";

		internal const string NetworkHandlerDoesNotExist = "The NetworkHandler does not exist. This shouldn't occur!";

		internal const string TargetClientNotConnected = "The specified client {0} is not connected. {1} Identifier: \"{2}\"";

		internal const string TargetClientsNotConnected = "None of the specified clients {0} are connected. {1} Identifier: \"{2}\"";

		internal const string UnableToLocateNetworkObjectComponent = "Unable to find the network object component. Are you adding variable \"{0}\" to a network object?";
	}
	internal interface ILethalNetVar
	{
	}
	public sealed class LethalNetworkVariable<TData> : LethalNetwork, ILethalNetVar
	{
		private readonly bool _public;

		private readonly NetworkObject? _ownerObject;

		private bool _isDirty;

		private TData _value;

		public TData Value
		{
			get
			{
				return _value;
			}
			set
			{
				if ((_public || (Object)(object)NetworkManager.Singleton == (Object)null || (_ownerObject == null && NetworkManager.Singleton.IsServer) || (_ownerObject != null && _ownerObject.OwnerClientId == NetworkManager.Singleton.LocalClientId)) && value != null && !value.Equals(_value))
				{
					_value = value;
					_isDirty = true;
					this.OnValueChanged?.Invoke(_value);
				}
			}
		}

		public event Action<TData>? OnValueChanged;

		public LethalNetworkVariable(string identifier)
			: this(identifier, (NetworkObject?)null, serverOwned: true, 2)
		{
		}

		internal LethalNetworkVariable(string identifier, NetworkObject? owner, bool serverOwned, int frameIndex)
			: base(identifier, "Variable", frameIndex + 1)
		{
			//IL_00bb: 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)
			_ownerObject = ((!serverOwned) ? owner : null);
			NetworkHandler.OnVariableUpdate += ReceiveUpdate;
			NetworkHandler.NetworkTick += OnNetworkTick;
			NetworkHandler.NetworkSpawn += delegate
			{
				if (!IsNetworkHandlerNull() && IsHostOrServer(log: false))
				{
					NetworkHandler.OnPlayerJoin += OnPlayerJoin;
					NetworkHandler.NetworkDespawn += ClearSubscriptions;
				}
			};
			NetworkHandler.GetVariableValue += delegate(string id, ulong clientId)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				if (!(id != Identifier) && !IsNetworkHandlerNull() && IsHostOrServer())
				{
					NetworkHandler.Instance.UpdateVariableClientRpc(Identifier, LethalNetworkSerializer.Serialize(_value), GenerateClientParams(clientId));
				}
			};
			if (typeof(LethalNetworkVariable<TData>).GetCustomAttributes(typeof(PublicNetworkVariableAttribute), inherit: true).Any())
			{
				_public = true;
			}
			if (!IsNetworkHandlerNull(log: false))
			{
				if (IsHostOrServer())
				{
					NetworkHandler.OnPlayerJoin += OnPlayerJoin;
				}
				else
				{
					NetworkHandler.Instance.GetVariableValueServerRpc(Identifier);
				}
			}
		}

		private void OnPlayerJoin(ulong clientId)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNetworkHandlerNull() && IsHostOrServer())
			{
				NetworkHandler.Instance.UpdateVariableClientRpc(Identifier, LethalNetworkSerializer.Serialize(_value), GenerateClientParams(clientId));
			}
		}

		private void ClearSubscriptions()
		{
			NetworkHandler.OnPlayerJoin -= OnPlayerJoin;
			NetworkHandler.NetworkDespawn -= ClearSubscriptions;
		}

		private void SendUpdate()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (!IsNetworkHandlerNull())
			{
				NetworkHandler.Instance.UpdateVariableServerRpc(Identifier, LethalNetworkSerializer.Serialize(_value));
			}
		}

		private void ReceiveUpdate(string identifier, byte[] data)
		{
			if (!(identifier != Identifier))
			{
				TData val = LethalNetworkSerializer.Deserialize<TData>(data);
				if (val != null)
				{
					_value = val;
					this.OnValueChanged?.Invoke(val);
				}
			}
		}

		private void OnNetworkTick()
		{
			if (_isDirty && _value != null)
			{
				SendUpdate();
				_isDirty = false;
			}
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
	public class PublicNetworkVariableAttribute : Attribute
	{
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LethalNetworkAPI";

		public const string PLUGIN_NAME = "LethalNetworkAPI";

		public const string PLUGIN_VERSION = "2.1.5";
	}
}
namespace LethalNetworkAPI.Serializable
{
	internal static class LethalNetworkSerializer
	{
		internal static byte[] Serialize<T>(T value)
		{
			return SerializationUtility.SerializeValue<T>(value, (DataFormat)0, (SerializationContext)null);
		}

		internal static T Deserialize<T>(byte[] data)
		{
			return SerializationUtility.DeserializeValue<T>(data, (DataFormat)0, (DeserializationContext)null);
		}
	}
	public class NetworkBehaviourFormatter : MinimalBaseFormatter<NetworkBehaviour>
	{
		private static readonly Serializer<NetworkBehaviourReference> NetworkBehaviourReferenceSerializer = Serializer.Get<NetworkBehaviourReference>();

		protected override void Read(ref NetworkBehaviour value, IDataReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			value = NetworkBehaviourReference.op_Implicit(NetworkBehaviourReferenceSerializer.ReadValue(reader));
		}

		protected override void Write(ref NetworkBehaviour value, IDataWriter writer)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			NetworkBehaviourReferenceSerializer.WriteValue(NetworkBehaviourReference.op_Implicit(value), writer);
		}
	}
	public class NetworkBehaviourReferenceFormatter : MinimalBaseFormatter<NetworkBehaviourReference>
	{
		private static readonly Serializer<ushort> UInt16Serializer = Serializer.Get<ushort>();

		private static readonly Serializer<NetworkObjectReference> NetworkObjectReferenceSerializer = Serializer.Get<NetworkObjectReference>();

		protected override void Read(ref NetworkBehaviourReference value, IDataReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			value.m_NetworkObjectReference = NetworkObjectReferenceSerializer.ReadValue(reader);
			value.m_NetworkBehaviourId = UInt16Serializer.ReadValue(reader);
		}

		protected override void Write(ref NetworkBehaviourReference value, IDataWriter writer)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			NetworkObjectReferenceSerializer.WriteValue(value.m_NetworkObjectReference, writer);
			UInt16Serializer.WriteValue(value.m_NetworkBehaviourId, writer);
		}
	}
	public class NetworkObjectFormatter : MinimalBaseFormatter<NetworkObject>
	{
		private static readonly Serializer<NetworkObjectReference> NetworkObjectReferenceSerializer = Serializer.Get<NetworkObjectReference>();

		protected override void Read(ref NetworkObject value, IDataReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			value = NetworkObjectReference.op_Implicit(NetworkObjectReferenceSerializer.ReadValue(reader));
		}

		protected override void Write(ref NetworkObject value, IDataWriter writer)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			NetworkObjectReferenceSerializer.WriteValue(NetworkObjectReference.op_Implicit(value), writer);
		}
	}
	public class GameObjectFormatter : MinimalBaseFormatter<GameObject>
	{
		private static readonly Serializer<NetworkObjectReference> NetworkObjectReferenceSerializer = Serializer.Get<NetworkObjectReference>();

		protected override void Read(ref GameObject value, IDataReader reader)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			value = NetworkObjectReference.op_Implicit(NetworkObjectReferenceSerializer.ReadValue(reader));
		}

		protected override void Write(ref GameObject value, IDataWriter writer)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			NetworkObjectReferenceSerializer.WriteValue(NetworkObjectReference.op_Implicit(value), writer);
		}
	}
	internal class NetworkObjectReferenceFormatter : MinimalBaseFormatter<NetworkObjectReference>
	{
		private static readonly Serializer<ulong> UInt64Serializer = Serializer.Get<ulong>();

		protected override void Read(ref NetworkObjectReference value, IDataReader reader)
		{
			((NetworkObjectReference)(ref value)).NetworkObjectId = UInt64Serializer.ReadValue(reader);
		}

		protected override void Write(ref NetworkObjectReference value, IDataWriter writer)
		{
			UInt64Serializer.WriteValue(((NetworkObjectReference)(ref value)).NetworkObjectId, writer);
		}
	}
}
namespace LethalNetworkAPI.Networking
{
	internal class NetworkHandler : NetworkBehaviour
	{
		internal readonly List<ILethalNetVar> ObjectNetworkVariableList = new List<ILethalNetVar>();

		internal static NetworkHandler? Instance { get; private set; }

		internal static event Action? NetworkSpawn;

		internal static event Action? NetworkDespawn;

		internal static event Action? NetworkTick;

		internal static event Action<ulong>? OnPlayerJoin;

		internal static event Action<string, byte[], ulong>? OnServerMessage;

		internal static event Action<string, byte[], ulong>? OnClientMessage;

		internal static event Action<string, byte[]>? OnVariableUpdate;

		internal static event Action<string, ulong>? GetVariableValue;

		internal static event Action<string, ulong>? OnServerEvent;

		internal static event Action<string, ulong>? OnClientEvent;

		internal static event Action<string, double, ulong>? OnSyncedServerEvent;

		internal static event Action<string, double, ulong>? OnSyncedClientEvent;

		public override void OnNetworkSpawn()
		{
			if ((Object)(object)Instance != (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			Instance = this;
			NetworkHandler.NetworkSpawn?.Invoke();
			((NetworkBehaviour)this).NetworkManager.NetworkTickSystem.Tick += NetworkHandler.NetworkTick;
			NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnectedCallback;
		}

		internal void Clean()
		{
			NetworkHandler.NetworkDespawn?.Invoke();
			NetworkHandler.OnPlayerJoin = null;
			NetworkHandler.NetworkDespawn = null;
			Instance = null;
		}

		private void OnClientConnectedCallback(ulong client)
		{
			NetworkHandler.OnPlayerJoin?.Invoke(client);
		}

		[ServerRpc(RequireOwnership = false)]
		internal void MessageServerRpc(string identifier, byte[] data, bool toOtherClients = false, bool sendToOriginator = false, ServerRpcParams serverRpcParams = default(ServerRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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)
			//IL_0106: 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)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: 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.IsClient || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3629803754u, serverRpcParams, (RpcDelivery)0);
				bool flag = identifier != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
				}
				bool flag2 = data != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<byte>(data, default(ForPrimitives));
				}
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref toOtherClients, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref sendToOriginator, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 3629803754u, serverRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			ServerRpcParams serverRpcParams2 = serverRpcParams;
			if (!toOtherClients)
			{
				NetworkHandler.OnServerMessage?.Invoke(identifier, data, serverRpcParams2.Receive.SenderClientId);
			}
			else if (!sendToOriginator)
			{
				NativeArray<ulong> val2 = default(NativeArray<ulong>);
				val2..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != serverRpcParams2.Receive.SenderClientId).ToArray(), (Allocator)4);
				if (((IEnumerable<ulong>)(object)val2).Any())
				{
					MessageClientRpc(identifier, data, serverRpcParams2.Receive.SenderClientId, new ClientRpcParams
					{
						Send = new ClientRpcSendParams
						{
							TargetClientIdsNativeArray = val2
						}
					});
				}
			}
			else
			{
				MessageClientRpc(identifier, data, serverRpcParams2.Receive.SenderClientId);
			}
		}

		[ClientRpc]
		internal void MessageClientRpc(string identifier, byte[] data, ulong originatorClient = 99999uL, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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)
			//IL_00fa: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3740138170u, clientRpcParams, (RpcDelivery)0);
				bool flag = identifier != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
				}
				bool flag2 = data != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<byte>(data, default(ForPrimitives));
				}
				BytePacker.WriteValueBitPacked(val, originatorClient);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3740138170u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkHandler.OnClientMessage?.Invoke(identifier, data, originatorClient);
				clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		internal void EventServerRpc(string identifier, bool toOtherClients = false, bool sendToOriginator = false, ServerRpcParams serverRpcParams = default(ServerRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00d6: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: 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.IsClient || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1959733556u, serverRpcParams, (RpcDelivery)0);
				bool flag = identifier != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
				}
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref toOtherClients, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref sendToOriginator, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 1959733556u, serverRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			ServerRpcParams serverRpcParams2 = serverRpcParams;
			if (!toOtherClients)
			{
				NetworkHandler.OnServerEvent?.Invoke(identifier, serverRpcParams2.Receive.SenderClientId);
			}
			else if (!sendToOriginator)
			{
				NativeArray<ulong> val2 = default(NativeArray<ulong>);
				val2..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != serverRpcParams2.Receive.SenderClientId).ToArray(), (Allocator)4);
				if (((IEnumerable<ulong>)(object)val2).Any())
				{
					EventClientRpc(identifier, serverRpcParams2.Receive.SenderClientId, new ClientRpcParams
					{
						Send = new ClientRpcSendParams
						{
							TargetClientIdsNativeArray = val2
						}
					});
				}
			}
			else
			{
				EventClientRpc(identifier, serverRpcParams2.Receive.SenderClientId);
			}
		}

		[ClientRpc]
		internal void EventClientRpc(string identifier, ulong originatorClient = 99999uL, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(53735464u, clientRpcParams, (RpcDelivery)0);
				bool flag = identifier != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
				}
				BytePacker.WriteValueBitPacked(val, originatorClient);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 53735464u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkHandler.OnClientEvent?.Invoke(identifier, originatorClient);
				clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		internal void SyncedEventServerRpc(string identifier, double time, ServerRpcParams serverRpcParams = default(ServerRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2669215490u, serverRpcParams, (RpcDelivery)0);
				bool flag = identifier != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
				}
				((FastBufferWriter)(ref val)).WriteValueSafe<double>(ref time, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2669215490u, serverRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				NetworkHandler.OnSyncedServerEvent?.Invoke(identifier, time, serverRpcParams.Receive.SenderClientId);
			}
		}

		[ClientRpc]
		internal void SyncedEventClientRpc(string identifier, double time, ulong originatorClient, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00ca: 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)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(899832842u, clientRpcParams, (RpcDelivery)0);
				bool flag = identifier != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
				}
				((FastBufferWriter)(ref val)).WriteValueSafe<double>(ref time, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val, originatorClient);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 899832842u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkHandler.OnSyncedClientEvent?.Invoke(identifier, time, originatorClient);
				clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		internal void UpdateVariableServerRpc(string identifier, byte[] data, ServerRpcParams serverRpcParams = default(ServerRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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)
			//IL_019d: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: 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.IsClient || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1359429614u, serverRpcParams, (RpcDelivery)0);
				bool flag = identifier != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
				}
				bool flag2 = data != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<byte>(data, default(ForPrimitives));
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 1359429614u, serverRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ServerRpcParams serverRpcParams2 = serverRpcParams;
				if (serverRpcParams2.Receive.SenderClientId != 0L)
				{
					NetworkHandler.OnVariableUpdate?.Invoke(identifier, data);
				}
				NativeArray<ulong> val2 = default(NativeArray<ulong>);
				val2..ctor(NetworkManager.Singleton.ConnectedClientsIds.Where((ulong i) => i != serverRpcParams2.Receive.SenderClientId).ToArray(), (Allocator)4);
				if (((IEnumerable<ulong>)(object)val2).Any())
				{
					UpdateVariableClientRpc(identifier, data, new ClientRpcParams
					{
						Send = new ClientRpcSendParams
						{
							TargetClientIdsNativeArray = val2
						}
					});
				}
			}
		}

		[ClientRpc]
		internal void UpdateVariableClientRpc(string identifier, byte[] data, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1641402893u, clientRpcParams, (RpcDelivery)0);
				bool flag = identifier != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
				}
				bool flag2 = data != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<byte>(data, default(ForPrimitives));
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1641402893u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkHandler.OnVariableUpdate?.Invoke(identifier, data);
				clientRpcParams.Send.TargetClientIdsNativeArray?.Dispose();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		internal void GetVariableValueServerRpc(string identifier, ServerRpcParams serverRpcParams = default(ServerRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2442151635u, serverRpcParams, (RpcDelivery)0);
				bool flag = identifier != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(identifier, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2442151635u, serverRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				NetworkHandler.GetVariableValue?.Invoke(identifier, serverRpcParams.Receive.SenderClientId);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_NetworkHandler()
		{
			//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
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3629803754u, new RpcReceiveHandler(__rpc_handler_3629803754));
			NetworkManager.__rpc_func_table.Add(3740138170u, new RpcReceiveHandler(__rpc_handler_3740138170));
			NetworkManager.__rpc_func_table.Add(1959733556u, new RpcReceiveHandler(__rpc_handler_1959733556));
			NetworkManager.__rpc_func_table.Add(53735464u, new RpcReceiveHandler(__rpc_handler_53735464));
			NetworkManager.__rpc_func_table.Add(2669215490u, new RpcReceiveHandler(__rpc_handler_2669215490));
			NetworkManager.__rpc_func_table.Add(899832842u, new RpcReceiveHandler(__rpc_handler_899832842));
			NetworkManager.__rpc_func_table.Add(1359429614u, new RpcReceiveHandler(__rpc_handler_1359429614));
			NetworkManager.__rpc_func_table.Add(1641402893u, new RpcReceiveHandler(__rpc_handler_1641402893));
			NetworkManager.__rpc_func_table.Add(2442151635u, new RpcReceiveHandler(__rpc_handler_2442151635));
		}

		private static void __rpc_handler_3629803754(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_0067: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string identifier = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				byte[] data = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref data, default(ForPrimitives));
				}
				bool toOtherClients = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref toOtherClients, default(ForPrimitives));
				bool sendToOriginator = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sendToOriginator, default(ForPrimitives));
				ServerRpcParams server = rpcParams.Server;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).MessageServerRpc(identifier, data, toOtherClients, sendToOriginator, server);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3740138170(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_0067: 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_00a0: 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_00ae: 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_00bd: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string identifier = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				byte[] data = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref data, default(ForPrimitives));
				}
				ulong originatorClient = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref originatorClient);
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandler)(object)target).MessageClientRpc(identifier, data, originatorClient, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1959733556(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_0067: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string identifier = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
				}
				bool toOtherClients = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref toOtherClients, default(ForPrimitives));
				bool sendToOriginator = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sendToOriginator, default(ForPrimitives));
				ServerRpcParams server = rpcParams.Server;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).EventServerRpc(identifier, toOtherClients, sendToOriginator, server);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_53735464(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_005b: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string identifier = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
				}
				ulong originatorClient = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref originatorClient);
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandler)(object)target).EventClientRpc(identifier, originatorClient, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2669215490(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_0067: 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_0076: 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)
			//IL_007c: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string identifier = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
				}
				double time = default(double);
				((FastBufferReader)(ref reader)).ReadValueSafe<double>(ref time, default(ForPrimitives));
				ServerRpcParams server = rpcParams.Server;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).SyncedEventServerRpc(identifier, time, server);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_899832842(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_0067: 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_0076: 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_0084: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string identifier = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
				}
				double time = default(double);
				((FastBufferReader)(ref reader)).ReadValueSafe<double>(ref time, default(ForPrimitives));
				ulong originatorClient = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref originatorClient);
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandler)(object)target).SyncedEventClientRpc(identifier, time, originatorClient, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1359429614(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_0067: 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_00a0: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string identifier = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				byte[] data = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref data, default(ForPrimitives));
				}
				ServerRpcParams server = rpcParams.Server;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).UpdateVariableServerRpc(identifier, data, server);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1641402893(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_0067: 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_00a0: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string identifier = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				byte[] data = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref data, default(ForPrimitives));
				}
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandler)(object)target).UpdateVariableClientRpc(identifier, data, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2442151635(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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string identifier = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref identifier, false);
				}
				ServerRpcParams server = rpcParams.Server;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).GetVariableValueServerRpc(identifier, server);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string? __getTypeName()
		{
			return "NetworkHandler";
		}
	}
	[HarmonyPatch]
	[HarmonyPriority(800)]
	[HarmonyWrapSafe]
	internal class NetworkObjectManager
	{
		private static GameObject _networkPrefab;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		private static void Init()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			if (!((Object)(object)_networkPrefab != (Object)null))
			{
				GameObject val = new GameObject("NetworkAPIContainer")
				{
					hideFlags = (HideFlags)61
				};
				val.SetActive(false);
				_networkPrefab = MakePrefab<NetworkHandler>("LethalNetworkAPI.Handler", val, 889887688u);
			}
		}

		private static GameObject MakePrefab<T>(string name, GameObject parent, uint overrideGuid = 0u) where T : NetworkBehaviour
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent.transform);
			val.AddComponent<NetworkObject>();
			val.AddComponent<T>();
			((Object)val).hideFlags = (HideFlags)61;
			if (overrideGuid != 0)
			{
				val.GetComponent<NetworkObject>().GlobalObjectIdHash = overrideGuid;
			}
			else
			{
				uint globalObjectIdHash = BitConverter.ToUInt32(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetExecutingAssembly().GetName().Name + name)), 0);
				val.GetComponent<NetworkObject>().GlobalObjectIdHash = globalObjectIdHash;
			}
			NetworkManager.Singleton.AddNetworkPrefab(val);
			return val;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		private static void SpawnNetworkHandler()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(_networkPrefab, Vector3.zero, Quaternion.identity, ((Component)StartOfRound.Instance).transform);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
		private static void OnDisconnect()
		{
			NetworkHandler.Instance.Clean();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
namespace LethalNetworkAPI.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

plugins/LethalThings/LethalThings.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Extras;
using LethalLib.Modules;
using LethalThings.Extensions;
using LethalThings.MonoBehaviours;
using LethalThings.NetcodePatcher;
using LethalThings.Patches;
using Microsoft.CodeAnalysis;
using On;
using On.GameNetcodeStuff;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("LethalThings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+dffd1fa1a88c1099e7d37ac2a79e708256ab06a6")]
[assembly: AssemblyProduct("LethalThings")]
[assembly: AssemblyTitle("LethalThings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<Vector3>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<Vector3>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<HackingTool.HackState>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<HackingTool.HackState>();
	}
}
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 LethalLib.Modules
{
	public class SaveData
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_ResetSavedGameValues <0>__GameNetworkManager_ResetSavedGameValues;

			public static hook_SaveItemsInShip <1>__GameNetworkManager_SaveItemsInShip;

			public static hook_LoadShipGrabbableItems <2>__StartOfRound_LoadShipGrabbableItems;
		}

		public static List<string> saveKeys = new List<string>();

		public static void Init()
		{
			//IL_0011: 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)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			object obj = <>O.<0>__GameNetworkManager_ResetSavedGameValues;
			if (obj == null)
			{
				hook_ResetSavedGameValues val = GameNetworkManager_ResetSavedGameValues;
				<>O.<0>__GameNetworkManager_ResetSavedGameValues = val;
				obj = (object)val;
			}
			GameNetworkManager.ResetSavedGameValues += (hook_ResetSavedGameValues)obj;
			object obj2 = <>O.<1>__GameNetworkManager_SaveItemsInShip;
			if (obj2 == null)
			{
				hook_SaveItemsInShip val2 = GameNetworkManager_SaveItemsInShip;
				<>O.<1>__GameNetworkManager_SaveItemsInShip = val2;
				obj2 = (object)val2;
			}
			GameNetworkManager.SaveItemsInShip += (hook_SaveItemsInShip)obj2;
			object obj3 = <>O.<2>__StartOfRound_LoadShipGrabbableItems;
			if (obj3 == null)
			{
				hook_LoadShipGrabbableItems val3 = StartOfRound_LoadShipGrabbableItems;
				<>O.<2>__StartOfRound_LoadShipGrabbableItems = val3;
				obj3 = (object)val3;
			}
			StartOfRound.LoadShipGrabbableItems += (hook_LoadShipGrabbableItems)obj3;
		}

		private static void StartOfRound_LoadShipGrabbableItems(orig_LoadShipGrabbableItems orig, StartOfRound self)
		{
			orig.Invoke(self);
			SaveableObject[] array = Object.FindObjectsOfType<SaveableObject>();
			SaveableNetworkBehaviour[] array2 = Object.FindObjectsOfType<SaveableNetworkBehaviour>();
			SaveableObject[] array3 = array;
			foreach (SaveableObject saveableObject in array3)
			{
				saveableObject.LoadObjectData();
			}
			SaveableNetworkBehaviour[] array4 = array2;
			foreach (SaveableNetworkBehaviour saveableNetworkBehaviour in array4)
			{
				saveableNetworkBehaviour.LoadObjectData();
			}
			if (ES3.KeyExists("LethalLibItemSaveKeys", GameNetworkManager.Instance.currentSaveFileName))
			{
				saveKeys = ES3.Load<List<string>>("LethalLibItemSaveKeys", GameNetworkManager.Instance.currentSaveFileName);
			}
		}

		private static void GameNetworkManager_SaveItemsInShip(orig_SaveItemsInShip orig, GameNetworkManager self)
		{
			orig.Invoke(self);
			SaveableObject[] array = Object.FindObjectsOfType<SaveableObject>();
			SaveableNetworkBehaviour[] array2 = Object.FindObjectsOfType<SaveableNetworkBehaviour>();
			SaveableObject[] array3 = array;
			foreach (SaveableObject saveableObject in array3)
			{
				saveableObject.SaveObjectData();
			}
			SaveableNetworkBehaviour[] array4 = array2;
			foreach (SaveableNetworkBehaviour saveableNetworkBehaviour in array4)
			{
				saveableNetworkBehaviour.SaveObjectData();
			}
			ES3.Save<List<string>>("LethalLibItemSaveKeys", saveKeys, GameNetworkManager.Instance.currentSaveFileName);
		}

		private static void GameNetworkManager_ResetSavedGameValues(orig_ResetSavedGameValues orig, GameNetworkManager self)
		{
			orig.Invoke(self);
			foreach (string saveKey in saveKeys)
			{
				ES3.DeleteKey(saveKey, GameNetworkManager.Instance.currentSaveFileName);
			}
			saveKeys.Clear();
		}

		public static void SaveObjectData<T>(string key, T data, int objectId)
		{
			List<T> list = new List<T>();
			if (ES3.KeyExists("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName))
			{
				list = ES3.Load<List<T>>("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName);
			}
			List<int> list2 = new List<int>();
			if (ES3.KeyExists("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName))
			{
				list2 = ES3.Load<List<int>>("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName);
			}
			list.Add(data);
			list2.Add(objectId);
			if (!saveKeys.Contains("LethalThingsSave_" + key))
			{
				saveKeys.Add("LethalThingsSave_" + key);
			}
			if (!saveKeys.Contains("LethalThingsSave_objectIds_" + key))
			{
				saveKeys.Add("LethalThingsSave_objectIds_" + key);
			}
			ES3.Save<List<T>>("LethalThingsSave_" + key, list, GameNetworkManager.Instance.currentSaveFileName);
			ES3.Save<List<int>>("LethalThingsSave_objectIds_" + key, list2, GameNetworkManager.Instance.currentSaveFileName);
		}

		public static T LoadObjectData<T>(string key, int objectId)
		{
			List<T> list = new List<T>();
			if (ES3.KeyExists("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName))
			{
				list = ES3.Load<List<T>>("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName);
			}
			List<int> list2 = new List<int>();
			if (ES3.KeyExists("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName))
			{
				list2 = ES3.Load<List<int>>("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName);
			}
			if (!saveKeys.Contains("LethalThingsSave_" + key))
			{
				saveKeys.Add("LethalThingsSave_" + key);
			}
			if (!saveKeys.Contains("LethalThingsSave_objectIds_" + key))
			{
				saveKeys.Add("LethalThingsSave_objectIds_" + key);
			}
			if (list2.Contains(objectId))
			{
				int index = list2.IndexOf(objectId);
				return list[index];
			}
			return default(T);
		}
	}
}
namespace LethalThings
{
	public class Content
	{
		public static AssetBundle MainAssets;

		public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		public static ContentLoader ContentLoader;

		public static GameObject devMenuPrefab;

		public static GameObject configManagerPrefab;

		public static void Init()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Expected O, but got Unknown
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Expected O, but got Unknown
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Expected O, but got Unknown
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Expected O, but got Unknown
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Expected O, but got Unknown
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Expected O, but got Unknown
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Expected O, but got Unknown
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Expected O, but got Unknown
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Expected O, but got Unknown
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Expected O, but got Unknown
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Expected O, but got Unknown
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Expected O, but got Unknown
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Expected O, but got Unknown
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Expected O, but got Unknown
			MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalthings"));
			configManagerPrefab = MainAssets.LoadAsset<GameObject>("Assets/Custom/LethalThings/LTNetworkConfig.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(configManagerPrefab);
			ContentLoader = new ContentLoader(Plugin.pluginInfo, MainAssets, (Action<CustomContent, GameObject>)delegate(CustomContent content, GameObject prefab)
			{
				Prefabs.Add(content.ID, prefab);
			});
			CustomContent[] array = (CustomContent[])(object)new CustomContent[26]
			{
				(CustomContent)new ScrapItem("Arson", "Assets/Custom/LethalThings/Scrap/Arson/ArsonPlush.asset", NetworkConfig.arsonSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Cookie", "Assets/Custom/LethalThings/Scrap/Cookie/CookieFumo.asset", NetworkConfig.cookieSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Bilka", "Assets/Custom/LethalThings/Scrap/Toimari/ToimariPlush.asset", NetworkConfig.toimariSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Hamis", "Assets/Custom/LethalThings/Scrap/Hamis/HamisPlush.asset", NetworkConfig.hamisSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("ArsonDirty", "Assets/Custom/LethalThings/Scrap/Arson/ArsonPlushDirty.asset", NetworkConfig.dirtyArsonSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Maxwell", "Assets/Custom/LethalThings/Scrap/Maxwell/Dingus.asset", NetworkConfig.maxwellSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Glizzy", "Assets/Custom/LethalThings/Scrap/glizzy/glizzy.asset", NetworkConfig.glizzySpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Revolver", "Assets/Custom/LethalThings/Scrap/Flaggun/Toygun.asset", NetworkConfig.revolverSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("GremlinEnergy", "Assets/Custom/LethalThings/Scrap/GremlinEnergy/GremlinEnergy.asset", NetworkConfig.gremlinSodaSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("ToyHammerScrap", "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammer.asset", NetworkConfig.toyHammerScrapSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Gnarpy", "Assets/Custom/LethalThings/Scrap/Gnarpy/GnarpyPlush.asset", NetworkConfig.gnarpySpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ShopItem("RocketLauncher", "Assets/Custom/LethalThings/Items/RocketLauncher/RocketLauncher.asset", NetworkConfig.rocketLauncherPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/RocketLauncher/RocketLauncherInfo.asset", (Action<Item>)delegate(Item item)
				{
					NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<RocketLauncher>().missilePrefab);
				}),
				(CustomContent)new ShopItem("Flaregun", "Assets/Custom/LethalThings/Items/Flaregun/Flaregun.asset", NetworkConfig.flareGunPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Flaregun/FlaregunInfo.asset", (Action<Item>)delegate(Item item)
				{
					NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<ProjectileWeapon>().projectilePrefab);
				}),
				(CustomContent)new ShopItem("FlaregunAmmo", "Assets/Custom/LethalThings/Items/Flaregun/FlaregunAmmo.asset", NetworkConfig.flareGunAmmoPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Flaregun/FlaregunAmmoInfo.asset", (Action<Item>)null),
				(CustomContent)new ShopItem("ToyHammerShop", "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammer.asset", NetworkConfig.toyHammerPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammerInfo.asset", (Action<Item>)null),
				(CustomContent)new ShopItem("RemoteRadar", "Assets/Custom/LethalThings/Items/Radar/HandheldRadar.asset", NetworkConfig.remoteRadarPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Radar/HandheldRadarInfo.asset", (Action<Item>)null),
				(CustomContent)new ShopItem("PouchyBelt", "Assets/Custom/LethalThings/Items/Pouch/Pouch.asset", NetworkConfig.pouchyBeltPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Pouch/PouchInfo.asset", (Action<Item>)null),
				(CustomContent)new ShopItem("HackingTool", "Assets/Custom/LethalThings/Items/HackingTool/HackingTool.asset", NetworkConfig.hackingToolPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/HackingTool/HackingToolInfo.asset", (Action<Item>)null),
				(CustomContent)new ShopItem("Pinger", "Assets/Custom/LethalThings/Items/PingingTool/PingTool.asset", NetworkConfig.pingerPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/PingingTool/PingToolInfo.asset", (Action<Item>)delegate(Item item)
				{
					NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<Pinger>().pingMarkerPrefab);
				}),
				(CustomContent)new CustomItem("Dart", "Assets/Custom/LethalThings/Unlockables/dartboard/Dart.asset", (Action<Item>)null),
				(CustomContent)new Unlockable("SmallRug", "Assets/Custom/LethalThings/Unlockables/Rug/SmallRug.asset", NetworkConfig.smallRugPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Rug/RugInfo.asset", (StoreType)2, (Action<UnlockableItem>)null),
				(CustomContent)new Unlockable("LargeRug", "Assets/Custom/LethalThings/Unlockables/Rug/LargeRug.asset", NetworkConfig.largeRugPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Rug/RugInfo.asset", (StoreType)2, (Action<UnlockableItem>)null),
				(CustomContent)new Unlockable("FatalitiesSign", "Assets/Custom/LethalThings/Unlockables/Sign/Sign.asset", NetworkConfig.fatalitiesSignPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Sign/SignInfo.asset", (StoreType)2, (Action<UnlockableItem>)null),
				(CustomContent)new Unlockable("Dartboard", "Assets/Custom/LethalThings/Unlockables/dartboard/Dartboard.asset", NetworkConfig.dartBoardPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/dartboard/DartboardInfo.asset", (StoreType)2, (Action<UnlockableItem>)null),
				(CustomContent)new CustomEnemy("Boomba", "Assets/Custom/LethalThings/Enemies/Roomba/Boomba.asset", NetworkConfig.boombaSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, (string[])null, "Assets/Custom/LethalThings/Enemies/Roomba/BoombaFile.asset", (string)null, (Action<EnemyType>)null),
				(CustomContent)new MapHazard("TeleporterTrap", "Assets/Custom/LethalThings/hazards/TeleporterTrap/TeleporterTrap.asset", (LevelTypes)(-1), (string[])null, (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => new AnimationCurve((Keyframe[])(object)new Keyframe[2]
				{
					new Keyframe(0f, 0f),
					new Keyframe(1f, 4f)
				})), (Action<SpawnableMapObjectDef>)null)
			};
			ContentLoader.RegisterAll(array);
			foreach (KeyValuePair<string, GameObject> prefab in Prefabs)
			{
				GameObject value = prefab.Value;
				string key = prefab.Key;
				AudioSource[] componentsInChildren = value.GetComponentsInChildren<AudioSource>();
				if (componentsInChildren.Length != 0)
				{
					ConfigEntry<float> val = NetworkConfig.VolumeConfig.Bind<float>("Volume", key ?? "", 100f, "Audio volume for " + key + " (0 - 100)");
					AudioSource[] array2 = componentsInChildren;
					foreach (AudioSource val2 in array2)
					{
						val2.volume *= val.Value / 100f;
					}
				}
			}
			GameObject val3 = MainAssets.LoadAsset<GameObject>("Assets/Custom/LethalThings/DevMenu.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val3);
			devMenuPrefab = val3;
			try
			{
				IEnumerable<Type> loadableTypes = Assembly.GetExecutingAssembly().GetLoadableTypes();
				foreach (Type item in loadableTypes)
				{
					MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
					MethodInfo[] array3 = methods;
					foreach (MethodInfo methodInfo in array3)
					{
						object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
						if (customAttributes.Length != 0)
						{
							methodInfo.Invoke(null, null);
						}
					}
				}
			}
			catch (Exception)
			{
			}
		}
	}
	public static class InputCompat
	{
		public static InputActionAsset Asset;

		public static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.LethalCompanyInputUtils");

		public static InputAction LTUtilityBeltQuick1 => Keybinds.Instance.LTUtilityBeltQuick1;

		public static InputAction LTUtilityBeltQuick2 => Keybinds.Instance.LTUtilityBeltQuick2;

		public static InputAction LTUtilityBeltQuick3 => Keybinds.Instance.LTUtilityBeltQuick3;

		public static InputAction LTUtilityBeltQuick4 => Keybinds.Instance.LTUtilityBeltQuick4;

		public static void Init()
		{
			Keybinds.Instance = new Keybinds();
			Asset = Keybinds.Instance.GetAsset();
		}
	}
	public class Keybinds : LcInputActions
	{
		public static Keybinds Instance;

		[InputAction("", Name = "[LT] Utility Belt Quick 1")]
		public InputAction LTUtilityBeltQuick1 { get; set; }

		[InputAction("", Name = "[LT] Utility Belt Quick 2")]
		public InputAction LTUtilityBeltQuick2 { get; set; }

		[InputAction("", Name = "[LT] Utility Belt Quick 3")]
		public InputAction LTUtilityBeltQuick3 { get; set; }

		[InputAction("", Name = "[LT] Utility Belt Quick 4")]
		public InputAction LTUtilityBeltQuick4 { get; set; }

		public InputActionAsset GetAsset()
		{
			return ((LcInputActions)this).Asset;
		}
	}
	public class Dingus : SaveableObject
	{
		public AudioSource noiseAudio;

		public AudioSource noiseAudioFar;

		public AudioSource musicAudio;

		public AudioSource musicAudioFar;

		[Space(3f)]
		public AudioClip[] noiseSFX;

		public AudioClip[] noiseSFXFar;

		public AudioClip evilNoise;

		[Space(3f)]
		public float noiseRange;

		public float maxLoudness;

		public float minLoudness;

		public float minPitch;

		public float maxPitch;

		private Random noisemakerRandom;

		public Animator triggerAnimator;

		private int timesPlayedWithoutTurningOff = 0;

		private RoundManager roundManager;

		private float noiseInterval = 1f;

		public Animator danceAnimator;

		public bool wasLoadedFromSave = false;

		public bool exploding = false;

		private NetworkVariable<bool> isEvil = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public GameObject evilObject;

		public NetworkVariable<bool> isPlayingMusic = new NetworkVariable<bool>(NetworkConfig.maxwellPlayMusicDefault.Value, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1);

		public NetworkVariable<bool> isPipebomb = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public override void SaveObjectData()
		{
			SaveData.SaveObjectData("dingusBeEvil", isEvil.Value, uniqueId);
		}

		public override void LoadObjectData()
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				bool flag = SaveData.LoadObjectData<bool>("dingusBeEvil", uniqueId);
				Plugin.logger.LogInfo((object)$"Loading object[{uniqueId}] save data, evil? {flag}");
				if (flag)
				{
					isEvil.Value = flag;
				}
			}
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
			roundManager = Object.FindObjectOfType<RoundManager>();
			noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
			Debug.Log((object)"Making the dingus dance");
		}

		public override void OnNetworkSpawn()
		{
			base.OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsOwner)
			{
				isPlayingMusic.Value = NetworkConfig.Instance.maxwellPlayMusicDefaultNetVar.Value;
			}
			if (((NetworkBehaviour)this).IsHost)
			{
				isEvil.Value = Random.Range(0f, 100f) <= NetworkConfig.evilMaxwellChance.Value;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				int num = noisemakerRandom.Next(0, noiseSFX.Length);
				float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
				float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
				noiseAudio.pitch = pitch;
				noiseAudio.PlayOneShot(noiseSFX[num], num2);
				if ((Object)(object)noiseAudioFar != (Object)null)
				{
					noiseAudioFar.pitch = pitch;
					noiseAudioFar.PlayOneShot(noiseSFXFar[num], num2);
				}
				if ((Object)(object)triggerAnimator != (Object)null)
				{
					triggerAnimator.SetTrigger("playAnim");
				}
				WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num], num2);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num2, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			}
		}

		public override void DiscardItem()
		{
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			}
			((GrabbableObject)this).isBeingUsed = false;
			((GrabbableObject)this).DiscardItem();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true;
			danceAnimator.Play("dingusIdle");
			Debug.Log((object)"Making the dingus idle");
		}

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (!right && ((NetworkBehaviour)this).IsOwner)
			{
				isPlayingMusic.Value = !isPlayingMusic.Value;
			}
		}

		public override void InteractItem()
		{
			((GrabbableObject)this).InteractItem();
			if (isEvil.Value && !exploding && !isPipebomb.Value)
			{
				EvilMaxwellServerRpc();
			}
		}

		public void EvilMaxwellTruly()
		{
			danceAnimator.Play("dingusIdle");
			if (musicAudio.isPlaying)
			{
				musicAudio.Pause();
				musicAudioFar.Pause();
			}
			((MonoBehaviour)this).StartCoroutine(evilMaxwellMoment());
		}

		[ServerRpc(RequireOwnership = false)]
		public void EvilMaxwellServerRpc()
		{
			//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(88404199u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 88404199u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					isPipebomb.Value = true;
					EvilMaxwellClientRpc();
				}
			}
		}

		[ClientRpc]
		public void EvilMaxwellClientRpc()
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1120322383u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1120322383u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				EvilMaxwellTruly();
				exploding = true;
				if (((NetworkBehaviour)this).IsOwner)
				{
					isPlayingMusic.Value = false;
				}
				timesPlayedWithoutTurningOff = 0;
				danceAnimator.Play("dingusIdle");
				if (musicAudio.isPlaying)
				{
					musicAudio.Pause();
					musicAudioFar.Pause();
				}
				Plugin.logger.LogInfo((object)"Evil maxwell moment");
			}
		}

		public IEnumerator evilMaxwellMoment()
		{
			yield return (object)new WaitForSeconds(1f);
			noiseAudio.PlayOneShot(evilNoise, 1f);
			evilObject.SetActive(true);
			((Renderer)((GrabbableObject)this).mainObjectRenderer).enabled = false;
			if ((Object)(object)noiseAudioFar != (Object)null)
			{
				noiseAudioFar.PlayOneShot(evilNoise, 1f);
			}
			if ((Object)(object)triggerAnimator != (Object)null)
			{
				triggerAnimator.SetTrigger("playAnim");
			}
			WalkieTalkie.TransmitOneShotAudio(noiseAudio, evilNoise, 1f);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, 1f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			yield return (object)new WaitForSeconds(1.5f);
			Utilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 100, 0f, 6.4f, 6, (CauseOfDeath)3);
			Rigidbody[] componentsInChildren = evilObject.GetComponentsInChildren<Rigidbody>();
			foreach (Rigidbody rb in componentsInChildren)
			{
				rb.isKinematic = false;
				rb.AddExplosionForce(1000f, evilObject.transform.position, 100f);
			}
			yield return (object)new WaitForSeconds(2f);
			if (((NetworkBehaviour)this).IsServer)
			{
				((Component)this).GetComponent<NetworkObject>().Despawn(true);
			}
		}

		public override void Update()
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (isEvil.Value)
			{
				((GrabbableObject)this).grabbable = false;
				((GrabbableObject)this).grabbableToEnemies = false;
			}
			if (isPlayingMusic.Value && !exploding)
			{
				if (!musicAudio.isPlaying)
				{
					musicAudio.Play();
					musicAudioFar.Play();
				}
				if (!((GrabbableObject)this).isHeld)
				{
					danceAnimator.Play("dingusDance");
				}
				else
				{
					danceAnimator.Play("dingusIdle");
				}
				if (noiseInterval <= 0f)
				{
					noiseInterval = 1f;
					timesPlayedWithoutTurningOff++;
					roundManager.PlayAudibleNoise(((Component)this).transform.position, 16f, 0.9f, timesPlayedWithoutTurningOff, false, 5);
				}
				else
				{
					noiseInterval -= Time.deltaTime;
				}
			}
			else
			{
				timesPlayedWithoutTurningOff = 0;
				danceAnimator.Play("dingusIdle");
				if (musicAudio.isPlaying)
				{
					musicAudio.Pause();
					musicAudioFar.Pause();
				}
			}
		}

		protected override void __initializeVariables()
		{
			if (isEvil == null)
			{
				throw new Exception("Dingus.isEvil cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)isEvil).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isEvil, "isEvil");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isEvil);
			if (isPlayingMusic == null)
			{
				throw new Exception("Dingus.isPlayingMusic cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)isPlayingMusic).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isPlayingMusic, "isPlayingMusic");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isPlayingMusic);
			if (isPipebomb == null)
			{
				throw new Exception("Dingus.isPipebomb cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)isPipebomb).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isPipebomb, "isPipebomb");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isPipebomb);
			base.__initializeVariables();
		}

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

		private static void __rpc_handler_88404199(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;
				((Dingus)(object)target).EvilMaxwellServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1120322383(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;
				((Dingus)(object)target).EvilMaxwellClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "Dingus";
		}
	}
	public class Missile : NetworkBehaviour
	{
		public int damage = 50;

		public float maxDistance = 10f;

		public float minDistance = 0f;

		public float gravity = 2.4f;

		public float flightDelay = 0.5f;

		public float flightForce = 150f;

		public float flightTime = 2f;

		public float autoDestroyTime = 3f;

		private float timeAlive = 0f;

		public float LobForce = 100f;

		public ParticleSystem particleSystem;

		private void OnCollisionEnter(Collision collision)
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				Boom();
				BoomClientRpc();
			}
			else
			{
				BoomServerRpc();
			}
		}

		private void Start()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).GetComponent<Rigidbody>().useGravity = false;
			if (((NetworkBehaviour)this).IsHost)
			{
				((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * LobForce, (ForceMode)1);
			}
		}

		[ClientRpc]
		public void BoomClientRpc()
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3331368301u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3331368301u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Boom();
				}
			}
		}

		[ServerRpc]
		public void BoomServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(452316787u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 452316787u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Boom();
				BoomClientRpc();
			}
		}

		public void CreateExplosion()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB attacker = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => ((NetworkBehaviour)x).OwnerClientId == ((NetworkBehaviour)this).OwnerClientId));
			Utilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, damage, minDistance, maxDistance, 10, (CauseOfDeath)3, attacker);
		}

		public void Boom()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)particleSystem == (Object)null)
			{
				Debug.LogError((object)"No particle system set on missile, destruction time!!");
				CreateExplosion();
				if (((NetworkBehaviour)this).IsHost)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				return;
			}
			particleSystem.Stop(true, (ParticleSystemStopBehavior)1);
			((Component)particleSystem).transform.SetParent((Transform)null);
			((Component)particleSystem).transform.localScale = Vector3.one;
			GameObject gameObject = ((Component)particleSystem).gameObject;
			MainModule main = particleSystem.main;
			float duration = ((MainModule)(ref main)).duration;
			main = particleSystem.main;
			MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
			Object.Destroy((Object)(object)gameObject, duration + ((MinMaxCurve)(ref startLifetime)).constant);
			CreateExplosion();
			if (((NetworkBehaviour)this).IsHost)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void FixedUpdate()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsHost)
			{
				return;
			}
			((Component)this).GetComponent<Rigidbody>().useGravity = false;
			((Component)this).GetComponent<Rigidbody>().AddForce(Vector3.down * gravity);
			if (timeAlive <= flightTime && timeAlive >= flightDelay)
			{
				((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * flightForce);
			}
			timeAlive += Time.fixedDeltaTime;
			if (timeAlive > autoDestroyTime)
			{
				if (((NetworkBehaviour)this).IsHost)
				{
					Boom();
					BoomClientRpc();
				}
				else
				{
					BoomServerRpc();
				}
			}
			else
			{
				Debug.Log((object)("Time alive: " + timeAlive + " / " + autoDestroyTime));
			}
		}

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

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

		private static void __rpc_handler_3331368301(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;
				((Missile)(object)target).BoomClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_452316787(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Missile)(object)target).BoomServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "Missile";
		}
	}
	public class PouchyBelt : GrabbableObject
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SetHoverTipAndCurrentInteractTrigger <0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger;

			public static hook_BeginGrabObject <1>__PlayerControllerB_BeginGrabObject;
		}

		public Transform beltCosmetic;

		public Vector3 beltCosmeticPositionOffset = new Vector3(0f, 0f, 0f);

		public Vector3 beltCosmeticRotationOffset = new Vector3(0f, 0f, 0f);

		public int beltCapacity = 3;

		private PlayerControllerB previousPlayerHeldBy;

		public List<int> slotIndexes = new List<int>();

		public static void Initialize()
		{
			//IL_0011: 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)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			object obj = <>O.<0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger;
			if (obj == null)
			{
				hook_SetHoverTipAndCurrentInteractTrigger val = PlayerControllerB_SetHoverTipAndCurrentInteractTrigger;
				<>O.<0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger = val;
				obj = (object)val;
			}
			PlayerControllerB.SetHoverTipAndCurrentInteractTrigger += (hook_SetHoverTipAndCurrentInteractTrigger)obj;
			object obj2 = <>O.<1>__PlayerControllerB_BeginGrabObject;
			if (obj2 == null)
			{
				hook_BeginGrabObject val2 = PlayerControllerB_BeginGrabObject;
				<>O.<1>__PlayerControllerB_BeginGrabObject = val2;
				obj2 = (object)val2;
			}
			PlayerControllerB.BeginGrabObject += (hook_BeginGrabObject)obj2;
		}

		public void Awake()
		{
			if (InputCompat.Enabled)
			{
				InputCompat.LTUtilityBeltQuick1.started += InputReceived;
				InputCompat.LTUtilityBeltQuick2.started += InputReceived;
				InputCompat.LTUtilityBeltQuick3.started += InputReceived;
				InputCompat.LTUtilityBeltQuick4.started += InputReceived;
			}
		}

		private static void PlayerControllerB_BeginGrabObject(orig_BeginGrabObject orig, PlayerControllerB self)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			self.interactRay = new Ray(((Component)self.gameplayCamera).transform.position, ((Component)self.gameplayCamera).transform.forward);
			if (!Physics.Raycast(self.interactRay, ref self.hit, self.grabDistance, self.interactableObjectsMask) || ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref self.hit)).collider).tag == "PhysicsProp") || self.twoHanded || self.sinkingValue > 0.73f)
			{
				return;
			}
			self.currentlyGrabbingObject = ((Component)((Component)((RaycastHit)(ref self.hit)).collider).transform).gameObject.GetComponent<GrabbableObject>();
			if ((!GameNetworkManager.Instance.gameHasStarted && !self.currentlyGrabbingObject.itemProperties.canBeGrabbedBeforeGameStart && ((Object)(object)StartOfRound.Instance.testRoom == (Object)null || !StartOfRound.Instance.testRoom.activeSelf)) || (Object)(object)self.currentlyGrabbingObject == (Object)null || self.inSpecialInteractAnimation || self.currentlyGrabbingObject.isHeld || self.currentlyGrabbingObject.isPocketed)
			{
				return;
			}
			NetworkObject networkObject = ((NetworkBehaviour)self.currentlyGrabbingObject).NetworkObject;
			if (!((Object)(object)networkObject == (Object)null) && networkObject.IsSpawned)
			{
				if (self.currentlyGrabbingObject is PouchyBelt && self.ItemSlots.Any((GrabbableObject x) => (Object)(object)x != (Object)null && x is PouchyBelt))
				{
					self.currentlyGrabbingObject.grabbable = false;
				}
				orig.Invoke(self);
				if (self.currentlyGrabbingObject is PouchyBelt)
				{
					self.currentlyGrabbingObject.grabbable = true;
				}
			}
		}

		private static void PlayerControllerB_SetHoverTipAndCurrentInteractTrigger(orig_SetHoverTipAndCurrentInteractTrigger orig, PlayerControllerB self)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!Physics.Raycast(self.interactRay, ref self.hit, self.grabDistance, self.interactableObjectsMask) || ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.layer == 8)
			{
				return;
			}
			string tag = ((Component)((RaycastHit)(ref self.hit)).collider).tag;
			if (!(tag == "PhysicsProp"))
			{
				return;
			}
			if (self.FirstEmptyItemSlot() == -1)
			{
				((TMP_Text)self.cursorTip).text = "Inventory full!";
				return;
			}
			GrabbableObject component = ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.GetComponent<GrabbableObject>();
			if (component is PouchyBelt)
			{
				if (self.ItemSlots.Any((GrabbableObject x) => (Object)(object)x != (Object)null && x is PouchyBelt))
				{
					((TMP_Text)self.cursorTip).text = "(Cannot hold more than 1 belt)";
				}
				else
				{
					((TMP_Text)self.cursorTip).text = "Pick up belt";
				}
			}
		}

		public void InputReceived(CallbackContext context)
		{
			if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null && ((CallbackContext)(ref context)).started)
			{
				int num = -1;
				if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick1)
				{
					num = 0;
				}
				else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick2)
				{
					num = 1;
				}
				else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick3)
				{
					num = 2;
				}
				else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick4)
				{
					num = 3;
				}
				if (num != -1 && num < slotIndexes.Count)
				{
					base.playerHeldBy.SwitchItemSlots(slotIndexes[num]);
				}
			}
		}

		public override void LateUpdate()
		{
			//IL_0083: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).LateUpdate();
			if ((Object)(object)previousPlayerHeldBy != (Object)null)
			{
				((Component)beltCosmetic).gameObject.SetActive(true);
				beltCosmetic.SetParent((Transform)null);
				((Renderer)((Component)beltCosmetic).GetComponent<MeshRenderer>()).enabled = true;
				if (((NetworkBehaviour)this).IsOwner)
				{
					((Renderer)((Component)beltCosmetic).GetComponent<MeshRenderer>()).enabled = false;
				}
				Transform parent = previousPlayerHeldBy.lowerSpine.parent;
				beltCosmetic.position = parent.position + beltCosmeticPositionOffset;
				Quaternion rotation = parent.rotation;
				Quaternion rotation2 = Quaternion.Euler(((Quaternion)(ref rotation)).eulerAngles + beltCosmeticRotationOffset);
				beltCosmetic.rotation = rotation2;
				((Renderer)base.mainObjectRenderer).enabled = false;
				((Component)this).gameObject.SetActive(true);
			}
			else
			{
				((Component)beltCosmetic).gameObject.SetActive(false);
				((Renderer)base.mainObjectRenderer).enabled = true;
				beltCosmetic.SetParent(((Component)this).transform);
			}
		}

		public void UpdateHUD(bool add)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			slotIndexes.Clear();
			HUDManager instance = HUDManager.Instance;
			if (add)
			{
				int num = 0;
				GrabbableObject[] itemSlots = GameNetworkManager.Instance.localPlayerController.ItemSlots;
				foreach (GrabbableObject val in itemSlots)
				{
					if (val is PouchyBelt)
					{
						num++;
					}
				}
				Image val2 = instance.itemSlotIconFrames[0];
				Image val3 = instance.itemSlotIcons[0];
				int num2 = instance.itemSlotIconFrames.Length;
				CanvasScaler componentInParent = ((Component)val2).GetComponentInParent<CanvasScaler>();
				AspectRatioFitter componentInParent2 = ((Component)val2).GetComponentInParent<AspectRatioFitter>();
				float x = ((Graphic)val2).rectTransform.sizeDelta.x;
				float y = ((Graphic)val2).rectTransform.sizeDelta.y;
				float num3 = ((Graphic)val2).rectTransform.anchoredPosition.y + 1.125f * y * (float)num;
				Vector3 localEulerAngles = ((Transform)((Graphic)val2).rectTransform).localEulerAngles;
				Vector3 localEulerAngles2 = ((Transform)((Graphic)val3).rectTransform).localEulerAngles;
				List<Image> list = instance.itemSlotIconFrames.ToList();
				List<Image> list2 = instance.itemSlotIcons.ToList();
				int count = list.Count;
				float num4 = (float)beltCapacity * x + (float)(beltCapacity - 1) * 15f;
				Debug.Log((object)$"Adding {beltCapacity} item slots! Surely this will go well..");
				Debug.Log((object)$"Adding after index: {count}");
				for (int j = 0; j < beltCapacity; j++)
				{
					float num5 = 0f - ((Component)((Transform)((Graphic)val2).rectTransform).parent).GetComponent<RectTransform>().sizeDelta.x / 2f - 3f;
					float num6 = num5 + (float)j * x + (float)j * 15f;
					Image val4 = list[0];
					Image val5 = Object.Instantiate<Image>(val4, ((Component)val2).transform.parent);
					((Object)val5).name = $"Slot{num2 + j}[LethalThingsBelt]";
					((Graphic)val5).rectTransform.anchoredPosition = new Vector2(num6, num3);
					((Transform)((Graphic)val5).rectTransform).eulerAngles = localEulerAngles;
					Image component = ((Component)((Component)val5).transform.GetChild(0)).GetComponent<Image>();
					((Object)component).name = "icon";
					((Behaviour)component).enabled = false;
					((Transform)((Graphic)component).rectTransform).eulerAngles = localEulerAngles2;
					((Transform)((Graphic)component).rectTransform).Rotate(new Vector3(0f, 0f, -90f));
					int num7 = count + j;
					list.Insert(num7, val5);
					list2.Insert(num7, component);
					slotIndexes.Add(num7);
					((Component)val5).transform.SetSiblingIndex(num7);
				}
				instance.itemSlotIconFrames = list.ToArray();
				instance.itemSlotIcons = list2.ToArray();
				Debug.Log((object)$"Added {beltCapacity} item slots!");
				return;
			}
			List<Image> list3 = instance.itemSlotIconFrames.ToList();
			List<Image> list4 = instance.itemSlotIcons.ToList();
			int count2 = list3.Count;
			int num8 = 0;
			for (int num9 = count2 - 1; num9 >= 0; num9--)
			{
				if (((Object)list3[num9]).name.Contains("[LethalThingsBelt]"))
				{
					num8++;
					Image val6 = list3[num9];
					list3.RemoveAt(num9);
					list4.RemoveAt(num9);
					Object.Destroy((Object)(object)((Component)val6).gameObject);
					if (num8 >= beltCapacity)
					{
						break;
					}
				}
			}
			instance.itemSlotIconFrames = list3.ToArray();
			instance.itemSlotIcons = list4.ToArray();
			Debug.Log((object)$"Removed {beltCapacity} item slots!");
		}

		public void AddItemSlots()
		{
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				List<GrabbableObject> list = base.playerHeldBy.ItemSlots.ToList();
				base.playerHeldBy.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[list.Count + beltCapacity];
				for (int i = 0; i < list.Count; i++)
				{
					base.playerHeldBy.ItemSlots[i] = list[i];
				}
				if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					UpdateHUD(add: true);
				}
			}
		}

		public void RemoveItemSlots()
		{
			if (!((Object)(object)base.playerHeldBy != (Object)null))
			{
				return;
			}
			int num = base.playerHeldBy.ItemSlots.Length - beltCapacity;
			int currentItemSlot = base.playerHeldBy.currentItemSlot;
			for (int i = 0; i < beltCapacity; i++)
			{
				GrabbableObject val = base.playerHeldBy.ItemSlots[num + i];
				if ((Object)(object)val != (Object)null)
				{
					base.playerHeldBy.DropItem(val, num + i);
				}
			}
			int currentItemSlot2 = base.playerHeldBy.currentItemSlot;
			currentItemSlot2 = ((currentItemSlot < base.playerHeldBy.ItemSlots.Length) ? currentItemSlot : 0);
			List<GrabbableObject> list = base.playerHeldBy.ItemSlots.ToList();
			base.playerHeldBy.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[list.Count - beltCapacity];
			for (int j = 0; j < base.playerHeldBy.ItemSlots.Length; j++)
			{
				base.playerHeldBy.ItemSlots[j] = list[j];
			}
			if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				UpdateHUD(add: false);
			}
			base.playerHeldBy.SwitchItemSlots(currentItemSlot2);
		}

		public override void DiscardItem()
		{
			RemoveItemSlots();
			previousPlayerHeldBy = null;
			((GrabbableObject)this).DiscardItem();
		}

		public override void OnNetworkDespawn()
		{
			RemoveItemSlots();
			previousPlayerHeldBy = null;
			((NetworkBehaviour)this).OnNetworkDespawn();
		}

		public void GrabItemOnClient()
		{
			((GrabbableObject)this).GrabItemOnClient();
		}

		public override void OnDestroy()
		{
			if (InputCompat.Enabled)
			{
				InputCompat.LTUtilityBeltQuick1.started -= InputReceived;
				InputCompat.LTUtilityBeltQuick2.started -= InputReceived;
				InputCompat.LTUtilityBeltQuick3.started -= InputReceived;
				InputCompat.LTUtilityBeltQuick4.started -= InputReceived;
			}
			((NetworkBehaviour)this).OnDestroy();
		}

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PouchyBelt";
		}
	}
	public class PowerOutletStun : NetworkBehaviour
	{
		private Coroutine electrocutionCoroutine;

		public AudioSource strikeAudio;

		public ParticleSystem strikeParticle;

		private NetworkVariable<int> damage = new NetworkVariable<int>(20, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public void Electrocute(ItemCharger socket)
		{
			Debug.Log((object)"Attempting electrocution");
			if (electrocutionCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(electrocutionCoroutine);
			}
			electrocutionCoroutine = ((MonoBehaviour)this).StartCoroutine(electrocutionDelayed(socket));
		}

		public void Awake()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			StormyWeather val = Object.FindObjectOfType<StormyWeather>(true);
			GameObject gameObject = ((Component)val.targetedStrikeAudio).gameObject;
			strikeAudio = Object.Instantiate<GameObject>(gameObject, ((Component)this).transform).GetComponent<AudioSource>();
			((Component)strikeAudio).transform.localPosition = Vector3.zero;
			((Component)strikeAudio).gameObject.SetActive(true);
			strikeParticle = Object.Instantiate<GameObject>(((Component)val.explosionEffectParticle).gameObject, ((Component)this).transform).GetComponent<ParticleSystem>();
			((Component)strikeParticle).transform.localPosition = Vector3.zero;
			((Component)strikeParticle).gameObject.SetActive(true);
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsHost)
			{
				damage.Value = NetworkConfig.itemChargerElectrocutionDamage.Value;
			}
		}

		private IEnumerator electrocutionDelayed(ItemCharger socket)
		{
			Debug.Log((object)"Electrocution started");
			socket.zapAudio.Play();
			yield return (object)new WaitForSeconds(0.75f);
			socket.chargeStationAnimator.SetTrigger("zap");
			Debug.Log((object)"Electrocution finished");
			if (((NetworkBehaviour)this).NetworkObject.IsOwner && !((NetworkBehaviour)this).NetworkObject.IsOwnedByServer)
			{
				Debug.Log((object)"Sending stun to server!!");
				ElectrocutedServerRpc(((Component)this).transform.position);
			}
			else if (((NetworkBehaviour)this).NetworkObject.IsOwner && ((NetworkBehaviour)this).NetworkObject.IsOwnedByServer)
			{
				Debug.Log((object)"Sending stun to clients!!");
				ElectrocutedClientRpc(((Component)this).transform.position);
				Electrocuted(((Component)this).transform.position);
			}
		}

		[ClientRpc]
		private void ElectrocutedClientRpc(Vector3 position)
		{
			//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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(328188188u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 328188188u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Debug.Log((object)"Stun received!!");
					Electrocuted(position);
				}
			}
		}

		private void Electrocuted(Vector3 position)
		{
			//IL_0008: 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)
			StormyWeather val = Object.FindObjectOfType<StormyWeather>(true);
			Utilities.CreateExplosion(position, spawnExplosionEffect: false, damage.Value, 0f, 5f, 3, (CauseOfDeath)11);
			strikeParticle.Play();
			val.PlayThunderEffects(position, strikeAudio);
		}

		[ServerRpc]
		private void ElectrocutedServerRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00cf: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2844681185u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2844681185u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ElectrocutedClientRpc(position);
			}
		}

		protected override void __initializeVariables()
		{
			if (damage == null)
			{
				throw new Exception("PowerOutletStun.damage cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)damage).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)damage, "damage");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)damage);
			((NetworkBehaviour)this).__initializeVariables();
		}

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

		private static void __rpc_handler_328188188(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PowerOutletStun)(object)target).ElectrocutedClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2844681185(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PowerOutletStun)(object)target).ElectrocutedServerRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PowerOutletStun";
		}
	}
	public class ProjectileWeapon : SaveableObject
	{
		public AudioSource mainAudio;

		public AudioClip[] activateClips;

		public AudioClip[] noAmmoSounds;

		public AudioClip[] reloadSounds;

		public Transform aimDirection;

		public int maxAmmo = 4;

		[HideInInspector]
		private NetworkVariable<int> currentAmmo = new NetworkVariable<int>(4, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public GameObject projectilePrefab;

		public float LobForce = 100f;

		private float timeSinceLastShot;

		private PlayerControllerB previousPlayerHeldBy;

		public Animator Animator;

		public ParticleSystem particleSystem;

		public Item ammoItem;

		public int ammoSlotToUse = -1;

		public override void SaveObjectData()
		{
			SaveData.SaveObjectData("projectileWeaponAmmoData", currentAmmo.Value, uniqueId);
		}

		public override void LoadObjectData()
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				currentAmmo.Value = SaveData.LoadObjectData<int>("projectileWeaponAmmoData", uniqueId);
			}
		}

		public static void Init()
		{
		}

		private static bool GrabbableObject_UseItemBatteries(orig_UseItemBatteries orig, GrabbableObject self)
		{
			if (self is ProjectileWeapon)
			{
				return true;
			}
			return orig.Invoke(self);
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
		}

		public override void OnDestroy()
		{
			((NetworkBehaviour)this).OnDestroy();
		}

		public override void OnNetworkSpawn()
		{
			base.OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsServer)
			{
				currentAmmo.Value = maxAmmo;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (currentAmmo.Value > 0)
			{
				if (((NetworkBehaviour)this).IsHost)
				{
					NetworkVariable<int> obj = currentAmmo;
					int value = obj.Value;
					obj.Value = value - 1;
				}
				PlayRandomAudio(mainAudio, activateClips);
				Animator.Play("fire");
				particleSystem.Play();
				timeSinceLastShot = 0f;
				if (((NetworkBehaviour)this).IsOwner)
				{
					if (((NetworkBehaviour)this).IsHost)
					{
						ProjectileSpawner(aimDirection.position, aimDirection.rotation, aimDirection.forward);
					}
					else
					{
						SpawnProjectileServerRpc(aimDirection.position, aimDirection.rotation, aimDirection.forward);
					}
				}
			}
			else
			{
				PlayRandomAudio(mainAudio, noAmmoSounds);
			}
		}

		private bool ReloadedGun()
		{
			int num = FindAmmoInInventory();
			if (num == -1)
			{
				return false;
			}
			ammoSlotToUse = num;
			return true;
		}

		private int FindAmmoInInventory()
		{
			for (int i = 0; i < ((GrabbableObject)this).playerHeldBy.ItemSlots.Length; i++)
			{
				if (!((Object)(object)((GrabbableObject)this).playerHeldBy.ItemSlots[i] == (Object)null) && ((GrabbableObject)this).playerHeldBy.ItemSlots[i].itemProperties.itemId == ammoItem.itemId)
				{
					return i;
				}
			}
			return -1;
		}

		[ServerRpc]
		private void FixWeightServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(43845628u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 43845628u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				FixWeightClientRpc();
			}
		}

		[ClientRpc]
		private void FixWeightClientRpc()
		{
			//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(948021082u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 948021082u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
				{
					PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
					playerHeldBy.carryWeight -= Mathf.Clamp(ammoItem.weight - 1f, 0f, 10f);
				}
			}
		}

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (right || !((NetworkBehaviour)this).IsOwner)
			{
				return;
			}
			if (ReloadedGun())
			{
				if (currentAmmo.Value > 0)
				{
					HUDManager.Instance.DisplayTip("Item already loaded.", "You can reload once you use up all the ammo.", false, false, "LC_Tip1");
					return;
				}
				ReloadAmmoServerRpc();
				DestroyItemInSlotAndSync(ammoSlotToUse);
				ammoSlotToUse = -1;
			}
			else
			{
				HUDManager.Instance.DisplayTip("No ammo found.", "Buy " + ammoItem.itemName + " from the Terminal to reload.", false, false, "LC_Tip1");
			}
		}

		[ServerRpc]
		private void ReloadAmmoServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1064596822u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1064596822u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				currentAmmo.Value = maxAmmo;
				ReloadAmmoSoundClientRpc();
			}
		}

		[ClientRpc]
		private void ReloadAmmoSoundClientRpc()
		{
			//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(3520251861u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3520251861u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PlayRandomAudio(mainAudio, reloadSounds);
					Animator.Play("reload");
				}
			}
		}

		[ServerRpc]
		private void SpawnProjectileServerRpc(Vector3 aimPosition, Quaternion aimRotation, Vector3 forward)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Invalid comparison between Unknown and I4
			//IL_012a: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00e9: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1043162412u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimPosition);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimRotation);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1043162412u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ProjectileSpawner(aimPosition, aimRotation, forward);
			}
		}

		private void ProjectileSpawner(Vector3 aimPosition, Quaternion aimRotation, Vector3 forward)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(projectilePrefab, aimPosition, aimRotation);
			val.GetComponent<NetworkObject>().SpawnWithOwnership(((NetworkBehaviour)this).OwnerClientId, false);
			ApplyProjectileForceClientRpc(NetworkObjectReference.op_Implicit(val.GetComponent<NetworkObject>()), aimPosition, aimRotation, forward);
		}

		[ClientRpc]
		public void ApplyProjectileForceClientRpc(NetworkObjectReference projectile, Vector3 aimPosition, Quaternion aimRotation, Vector3 forward)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			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(2170744407u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref projectile, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimPosition);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimRotation);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2170744407u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref projectile)).TryGet(ref val3, (NetworkManager)null))
				{
					GameObject gameObject = ((Component)val3).gameObject;
					gameObject.transform.position = aimPosition;
					gameObject.transform.rotation = aimRotation;
					gameObject.GetComponent<Rigidbody>().AddForce(forward * LobForce, (ForceMode)1);
				}
			}
		}

		private void PlayRandomAudio(AudioSource audioSource, AudioClip[] audioClips)
		{
			if (audioClips.Length != 0)
			{
				audioSource.PlayOneShot(audioClips[Random.Range(0, audioClips.Length)]);
			}
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			timeSinceLastShot += Time.deltaTime;
		}

		private void OnEnable()
		{
		}

		private void OnDisable()
		{
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			}
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true;
		}

		public void DestroyItemInSlotAndSync(int itemSlot)
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (itemSlot >= ((GrabbableObject)this).playerHeldBy.ItemSlots.Length || (Object)(object)((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot] == (Object)null)
				{
					Debug.LogError((object)$"Destroy item in slot called for a slot (slot {itemSlot}) which is empty or incorrect");
				}
				DestroyItemInSlotServerRpc(itemSlot);
			}
		}

		[ServerRpc]
		public void DestroyItemInSlotServerRpc(int itemSlot)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3656085789u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, itemSlot);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3656085789u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				DestroyItemInSlotClientRpc(itemSlot);
			}
		}

		[ClientRpc]
		public void DestroyItemInSlotClientRpc(int itemSlot)
		{
			//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(314723133u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, itemSlot);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 314723133u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					DestroyItemInSlot(itemSlot);
				}
			}
		}

		public void DestroyItemInSlot(int itemSlot)
		{
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.ShutdownInProgress)
			{
				return;
			}
			GrabbableObject val = ((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot];
			if ((Object)(object)val == (Object)null || (Object)(object)val.itemProperties == (Object)null)
			{
				Plugin.logger.LogError((object)"Item properties are null, cannot destroy item in slot");
				return;
			}
			PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
			playerHeldBy.carryWeight -= Mathf.Clamp(val.itemProperties.weight - 1f, 0f, 10f);
			if (((GrabbableObject)this).playerHeldBy.currentItemSlot == itemSlot)
			{
				((GrabbableObject)this).playerHeldBy.isHoldingObject = false;
				((GrabbableObject)this).playerHeldBy.twoHanded = false;
				if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner)
				{
					((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("cancelHolding", true);
					((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("Throw");
					((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false;
					HUDManager.Instance.ClearControlTips();
					((GrabbableObject)this).playerHeldBy.activatingItem = false;
				}
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				((Behaviour)HUDManager.Instance.itemSlotIcons[itemSlot]).enabled = false;
			}
			if ((Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer != (Object)null && (Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer == (Object)(object)val)
			{
				if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner)
				{
					((GrabbableObject)this).playerHeldBy.SetSpecialGrabAnimationBool(false, ((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer);
					((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer.DiscardItemOnClient();
				}
				((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer = null;
			}
			((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot] = null;
			if (((NetworkBehaviour)this).IsServer)
			{
				((NetworkBehaviour)val).NetworkObject.Despawn(true);
			}
		}

		protected override void __initializeVariables()
		{
			if (currentAmmo == null)
			{
				throw new Exception("ProjectileWeapon.currentAmmo cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)currentAmmo).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)currentAmmo, "currentAmmo");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)currentAmmo);
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ProjectileWeapon()
		{
			//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
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(43845628u, new RpcReceiveHandler(__rpc_handler_43845628));
			NetworkManager.__rpc_func_table.Add(948021082u, new RpcReceiveHandler(__rpc_handler_948021082));
			NetworkManager.__rpc_func_table.Add(1064596822u, new RpcReceiveHandler(__rpc_handler_1064596822));
			NetworkManager.__rpc_func_table.Add(3520251861u, new RpcReceiv

plugins/MoreInteriors/MoreInteriorsDunGen.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen.Graph;
using HarmonyLib;
using LethalLevelLoader;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("MoreInteriorsDunGen")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyProduct("MoreInteriorsDunGen")]
[assembly: AssemblyTitle("MoreInteriorsDunGen")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[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 MoreInteriorsDunGen
{
	[BepInPlugin("MoreInteriors", "MoreInteriors", "2.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MoreInteriorsDunGen : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Object))]
		private class ItemGroupPatch
		{
			[HarmonyPatch("Equals")]
			[HarmonyPrefix]
			public static bool FixItemGroupEquals(ref bool __result, object __instance, object other)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				ItemGroup val = (ItemGroup)((__instance is ItemGroup) ? __instance : null);
				if ((Object)(object)val != (Object)null)
				{
					ItemGroup val2 = (ItemGroup)((other is ItemGroup) ? other : null);
					if ((Object)(object)val2 != (Object)null)
					{
						__result = val.itemSpawnTypeName == val2.itemSpawnTypeName;
						return false;
					}
				}
				return true;
			}
		}

		private readonly Harmony harmony = new Harmony("MoreInteriors");

		public static MoreInteriorsDunGen Instance;

		public GameObject netManagerPrefab;

		internal ManualLogSource mls;

		public static AssetBundle BunkerAssets;

		private ConfigEntry<int> configBunkerRarity;

		private ConfigEntry<string> configBunkerMoons;

		private ConfigEntry<string> configBunkerMoonsList;

		private ConfigEntry<bool> configGuaranteedBunker;

		private ConfigEntry<int> configLengthOverride;

		private string[] configBunkerMoonsValues = new string[6] { "vanilla", "modded", "all", "paid", "free", "list" };

		public GameObject energyCorePrefab;

		public GameObject energyCorePrefabTurnedOff;

		public GameObject EnergyCores;

		private void Awake()
		{
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Expected O, but got Unknown
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Expected O, but got Unknown
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Expected O, but got Unknown
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Expected O, but got Unknown
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Expected O, but got Unknown
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Expected O, but got Unknown
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Expected O, but got Unknown
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			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);
						mls.LogInfo((object)"Invoked method with RuntimeInitializeOnLoadMethodAttribute");
					}
				}
			}
			mls = Logger.CreateLogSource("MoreInteriorsDunGen");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			BunkerAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "moreinterior_dungen"));
			if ((Object)(object)BunkerAssets == (Object)null)
			{
				mls.LogError((object)"Failed to load Bunker Dungeon assets.");
			}
			else
			{
				mls.LogInfo((object)"Bunker Assets loaded successfully");
			}
			DungeonFlow val = BunkerAssets.LoadAsset<DungeonFlow>("assets/lethalbunker/bunker data/bunkerflow.asset");
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load Bunker Dungeon Flow.");
			}
			AudioClip val2 = BunkerAssets.LoadAsset<AudioClip>("Assets/LethalBunker/ScrapPrefabs/AnimateClips/Bunker Entrance.ogg");
			if ((Object)(object)val2 == (Object)null)
			{
				mls.LogError((object)"Failed to load Bunker Dungeon Flow.");
			}
			else
			{
				mls.LogInfo((object)"Was loaded was called");
			}
			configBunkerRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Bunker Interior", "BunkerRarity", 150, new ConfigDescription("The chance that the bunker tileset will be chosen. The higher the value, the higher the chance. By default, the bunker will appear on valid moons with a roughly one in two chance.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 300), Array.Empty<object>()));
			configBunkerMoons = ((BaseUnityPlugin)this).Config.Bind<string>("Bunker Interior", "BunkerMoons", "list", new ConfigDescription("The moon(s) Preset moons that the bunker can appear at. \nThe following strings: \"all\", \"vanilla\", \"modded\", \"paid\", \"free\", \"list\" are dynamic presets which add the dungeon to that specified group (string must only contain one of these,).\nIndvivual moons (including modded) can be specified 'list' and altering the BunkerMoonsList config Entry. Default dungeon generation size is balanced around the dungeon scale multiplier of (1.3), moons with significantly different dungeon size multipliers (see Lethal Company wiki for values) may result in dungeons that are extremely small/large.", (AcceptableValueBase)(object)new AcceptableValueList<string>(configBunkerMoonsValues), Array.Empty<object>()));
			configBunkerMoonsList = ((BaseUnityPlugin)this).Config.Bind<string>("Bunker Interior", "BunkerDungeonMoonsList", "March150,Offense150", new ConfigDescription("Note: Requires 'BunkerMoons' to be set to 'list'. \nCan be used to specify a list of moons with individual rarities for moons to spawn on. \nRarity values will override the default rarity value provided in Bunker Rarity and will override BunkerGuaranteed. To guarantee dungeon spawning on a moon, assign arbitrarily high rarity value (e.g. 99999). \nMoons and rarities should be provided as a comma seperated list in the following format: 'NameRarity' Example: rend300,dine20,experimentation13 \nNote: Moon names are checked by string matching, i.e. the moon name 'dine' would enable spawning on 'dine', 'diner' and 'undine'. Be careful with modded moon names.", (AcceptableValueBase)null, Array.Empty<object>()));
			configGuaranteedBunker = ((BaseUnityPlugin)this).Config.Bind<bool>("Bunker Interior", "BunkerGuaranteed", false, new ConfigDescription("If enabled, the bunker will be effectively guaranteed to spawn. Only recommended for debugging/sightseeing purposes.", (AcceptableValueBase)null, Array.Empty<object>()));
			configLengthOverride = ((BaseUnityPlugin)this).Config.Bind<int>("Bunker Length", "BunkerLengthOverride", -1, new ConfigDescription(string.Format("if not -1, Overrides the Bunker length to whatever you wish.Adjusts how large Dungeon Generates ", "2.2.0", val.Length.Min), (AcceptableValueBase)null, Array.Empty<object>()));
			if (configLengthOverride.Value != -1)
			{
				mls.LogInfo((object)$"Bunker Length Override has been set to {configLengthOverride.Value}. Be careful with this value");
				val.Length.Min = configLengthOverride.Value;
				val.Length.Max = configLengthOverride.Value;
			}
			ExtendedDungeonFlow val3 = ScriptableObject.CreateInstance<ExtendedDungeonFlow>();
			val3.contentSourceName = "MoreInteriors";
			val3.dungeonFlow = val;
			val3.dungeonFirstTimeAudio = val2;
			val3.dungeonDefaultRarity = 0;
			int num = (configGuaranteedBunker.Value ? 99999 : configBunkerRarity.Value);
			if (configBunkerMoons.Value.ToLowerInvariant() == "all")
			{
				val3.manualContentSourceNameReferenceList.Add(new StringWithRarity("Lethal Company", num));
				val3.manualContentSourceNameReferenceList.Add(new StringWithRarity("Custom", num));
				mls.LogInfo((object)"Registered Bunker Interior on all Moons, Includes Modded Moons.");
			}
			else if (configBunkerMoons.Value.ToLowerInvariant() == "vanilla")
			{
				val3.manualContentSourceNameReferenceList.Add(new StringWithRarity("Lethal Company", num));
				mls.LogInfo((object)"Registered Bunker Interior on all vanilla moons.");
			}
			else if (configBunkerMoons.Value.ToLowerInvariant() == "modded")
			{
				val3.manualContentSourceNameReferenceList.Add(new StringWithRarity("Custom", num));
				mls.LogInfo((object)"Registered Bunker Interior on all modded moons.");
			}
			else if (configBunkerMoons.Value.ToLowerInvariant() == "paid")
			{
				val3.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(1f, 9999f), num));
				mls.LogInfo((object)"Registered Bunker Interior on all paid moons.");
			}
			else if (configBunkerMoons.Value.ToLowerInvariant() == "free")
			{
				val3.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(0f, 0f), num));
				mls.LogInfo((object)"Registered Bunker Interior on all free moons.");
			}
			else if ((configBunkerMoons.Value.ToLowerInvariant() == "list") & (configBunkerMoonsList.Value != null))
			{
				string[] array3 = configBunkerMoonsList.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries);
				string[] array4 = array3;
				foreach (string text in array4)
				{
					StringWithRarity val4 = ParseMoonString(text);
					if (val4 != null)
					{
						val3.manualPlanetNameReferenceList.Add(val4);
						mls.LogInfo((object)("Registered Bunker Interior on moon name " + val4.Name + " with rarity " + val4.Rarity));
					}
					else
					{
						mls.LogError((object)("Invalid moon list value!: " + text));
					}
				}
			}
			else
			{
				mls.LogError((object)"Invalid 'BunkerDungeonMoons' config value! ");
			}
			PatchedContent.RegisterExtendedDungeonFlow(val3);
			mls.LogInfo((object)"Loaded Extended DungeonFlow");
			val3.dungeonSizeMin = 1f;
			val3.dungeonSizeMax = 2f;
			val3.dungeonSizeLerpPercentage = 0f;
			harmony.PatchAll(typeof(MoreInteriorsDunGen));
			harmony.PatchAll(typeof(Object));
			Item val5 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/Bunker Data/EnergyCore.asset");
			Items.RegisterItem(val5);
			NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab);
			Object.Instantiate<Item>(val5);
			if ((Object)(object)val5 == (Object)null)
			{
				mls.LogError((object)"EnergyCore is null");
			}
			energyCorePrefab = BunkerAssets.LoadAsset<GameObject>("Assets/LethalBunker/Prefab Pieces/EnergyCore.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(energyCorePrefab);
			if ((Object)(object)energyCorePrefab == (Object)null)
			{
				mls.LogError((object)"energyCorePrefab is null");
			}
			energyCorePrefabTurnedOff = BunkerAssets.LoadAsset<GameObject>("Assets/LethalBunker/Prefab Pieces/EnergyCoreTurnedoff.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(energyCorePrefab);
			if ((Object)(object)energyCorePrefabTurnedOff == (Object)null)
			{
				mls.LogError((object)"energyCorePrefabTurnedOff is null");
			}
			int num2 = 1;
			Item val6 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/ArmyHelmet.asset");
			mls.LogInfo((object)val6);
			if ((Object)(object)val6 == (Object)null)
			{
				mls.LogError((object)"Failed to load ArmyHelmet asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
			if ((Object)(object)val6.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register ArmyHelmet spawn prefab.");
				return;
			}
			Items.RegisterScrap(val6, num2, (LevelTypes)(-1));
			if ((Object)(object)val6 == (Object)null)
			{
				mls.LogError((object)"Failed to register ArmyHelmet item.");
				return;
			}
			int num3 = 1;
			Item val7 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/ArmyCanteen.asset");
			mls.LogInfo((object)val7);
			if ((Object)(object)val7 == (Object)null)
			{
				mls.LogError((object)"Failed to load Canteen asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val7.spawnPrefab);
			if ((Object)(object)val7.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register Canteen spawn prefab.");
				return;
			}
			Items.RegisterScrap(val7, num3, (LevelTypes)(-1));
			if ((Object)(object)val7 == (Object)null)
			{
				mls.LogError((object)"Failed to register Canteen item.");
				return;
			}
			int num4 = 1;
			Item val8 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/Gramophone.asset");
			mls.LogInfo((object)val8);
			if ((Object)(object)val8 == (Object)null)
			{
				mls.LogError((object)"Failed to load Gramophone asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab);
			if ((Object)(object)val8.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register Gramophone spawn prefab.");
				return;
			}
			Items.RegisterScrap(val8, num4, (LevelTypes)(-1));
			if ((Object)(object)val8 == (Object)null)
			{
				mls.LogError((object)"Failed to register Gramophone item.");
				return;
			}
			int num5 = 1;
			Item val9 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/OldRadio.asset");
			mls.LogInfo((object)val9);
			if ((Object)(object)val9 == (Object)null)
			{
				mls.LogError((object)"Failed to load OldRadio asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
			if ((Object)(object)val9.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register OldRadio spawn prefab.");
				return;
			}
			Items.RegisterScrap(val9, num5, (LevelTypes)(-1));
			if ((Object)(object)val9 == (Object)null)
			{
				mls.LogError((object)"Failed to register OldRadio item.");
				return;
			}
			int num6 = 1;
			Item val10 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/RockingHorse.asset");
			mls.LogInfo((object)val10);
			if ((Object)(object)val10 == (Object)null)
			{
				mls.LogError((object)"Failed to load RockingHorse asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab);
			if ((Object)(object)val10.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register RockingHorse spawn prefab.");
				return;
			}
			Items.RegisterScrap(val10, num6, (LevelTypes)(-1));
			if ((Object)(object)val10 == (Object)null)
			{
				mls.LogError((object)"Failed to register RockingHorse item.");
				return;
			}
			int num7 = 1;
			Item val11 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/TypeWriter.asset");
			mls.LogInfo((object)val11);
			if ((Object)(object)val11 == (Object)null)
			{
				mls.LogError((object)"Failed to load TypeWriter asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val11.spawnPrefab);
			if ((Object)(object)val11.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register TypeWriter spawn prefab.");
				return;
			}
			Items.RegisterScrap(val11, num7, (LevelTypes)(-1));
			if ((Object)(object)val11 == (Object)null)
			{
				mls.LogError((object)"Failed to register TypeWriter item.");
				return;
			}
			int num8 = 1;
			Item val12 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/WheelRim.asset");
			mls.LogInfo((object)val12);
			if ((Object)(object)val12 == (Object)null)
			{
				mls.LogError((object)"Failed to load WheelRim asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val12.spawnPrefab);
			if ((Object)(object)val12.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register WheelRim spawn prefab.");
				return;
			}
			Items.RegisterScrap(val12, num8, (LevelTypes)(-1));
			if ((Object)(object)val12 == (Object)null)
			{
				mls.LogError((object)"Failed to register WheelRim item.");
				return;
			}
			int num9 = 1;
			Item val13 = BunkerAssets.LoadAsset<Item>("Assets/LethalBunker/ScrapPrefabs/WireSpool.asset");
			mls.LogInfo((object)val13);
			if ((Object)(object)val13 == (Object)null)
			{
				mls.LogError((object)"Failed to load WireSpool asset.");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab);
			if ((Object)(object)val13.spawnPrefab == (Object)null)
			{
				mls.LogError((object)"Failed to register WireSpool spawn prefab.");
				return;
			}
			Items.RegisterScrap(val13, num9, (LevelTypes)(-1));
			if ((Object)(object)val13 == (Object)null)
			{
				mls.LogError((object)"Failed to register WireSpool item.");
				return;
			}
			mls.LogInfo((object)"Successfully Registed all Items and Energycores");
			mls.LogInfo((object)"More interiors for Lethal Company [Version 2.2.0] successfully loaded.");
		}

		public static StringWithRarity ParseMoonString(string moonString)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			if (string.IsNullOrEmpty(moonString))
			{
				return null;
			}
			int num = moonString.Length - 1;
			while (num >= 0 && char.IsDigit(moonString[num]))
			{
				num--;
			}
			if (num < 0 || num == moonString.Length - 1)
			{
				return null;
			}
			try
			{
				string text = moonString.Substring(0, num + 1);
				int num2 = int.Parse(moonString.Substring(num + 1));
				return new StringWithRarity(text, num2);
			}
			catch (FormatException)
			{
				return null;
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MoreInteriorsDunGen";

		public const string PLUGIN_NAME = "MoreInteriorsDunGen";

		public const string PLUGIN_VERSION = "2.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

plugins/MoreShipUpgrades/MoreShipUpgrades.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MoreShipUpgrades.Managers;
using MoreShipUpgrades.Misc;
using MoreShipUpgrades.UpgradeComponents.Commands;
using MoreShipUpgrades.UpgradeComponents.Contracts;
using MoreShipUpgrades.UpgradeComponents.Items;
using MoreShipUpgrades.UpgradeComponents.Items.Contracts.BombDefusal;
using MoreShipUpgrades.UpgradeComponents.Items.Contracts.DataRetrieval;
using MoreShipUpgrades.UpgradeComponents.Items.Contracts.Exorcism;
using MoreShipUpgrades.UpgradeComponents.Items.Contracts.Exterminator;
using MoreShipUpgrades.UpgradeComponents.Items.Contracts.Extraction;
using MoreShipUpgrades.UpgradeComponents.Items.PortableTeleporter;
using MoreShipUpgrades.UpgradeComponents.Items.Wheelbarrow;
using MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades;
using MoreShipUpgrades.UpgradeComponents.TierUpgrades;
using Newtonsoft.Json;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MoreShipUpgrades
{
	[BepInPlugin("com.malco.lethalcompany.moreshipupgrades", "More Ship Upgrades", "3.1.1")]
	[BepInDependency("evaisa.lethallib", "0.13.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.malco.lethalcompany.moreshipupgrades");

		public static Plugin instance;

		public static ManualLogSource mls;

		private AudioClip itemBreak;

		private AudioClip buttonPressed;

		private AudioClip error;

		private string root = "Assets/ShipUpgrades/";

		private AudioClip[] wheelbarrowSound;

		private AudioClip[] shoppingCartSound;

		public static PluginConfig cfg { get; private set; }

		private void Awake()
		{
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			cfg = new PluginConfig(((BaseUnityPlugin)this).Config);
			cfg.InitBindings();
			mls = Logger.CreateLogSource("More Ship Upgrades");
			instance = this;
			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);
					}
				}
			}
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "shipupgrades");
			AssetBundle bundle = AssetBundle.LoadFromFile(text);
			GameObject val = new GameObject("UpgradeBus");
			val.AddComponent<UpgradeBus>();
			UpgradeBus.instance.version = "3.1.1";
			UpgradeBus.instance.UpgradeAssets = bundle;
			UpgradeBus.instance.internNames = AssetBundleHandler.GetInfoFromJSON("InternNames").Split(",");
			UpgradeBus.instance.internInterests = AssetBundleHandler.GetInfoFromJSON("InternInterests").Split(",");
			SetupModStore(ref bundle);
			SetupIntroScreen(ref bundle);
			SetupItems();
			SetupPerks();
			SetupContractMapObjects(ref bundle);
			harmony.PatchAll();
			mls.LogDebug((object)"LGU has been patched");
		}

		public void sendModInfo()
		{
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				if (pluginInfo.Value.Metadata.GUID.Contains("ModSync"))
				{
					try
					{
						List<string> list = new List<string> { "malco", "LateGameUpgrades" };
						((Component)pluginInfo.Value.Instance).BroadcastMessage("getModInfo", (object)list, (SendMessageOptions)1);
						break;
					}
					catch (Exception)
					{
						mls.LogDebug((object)"Failed to send info to ModSync, go yell at Minx");
						break;
					}
				}
			}
		}

		private void SetupContractMapObjects(ref AssetBundle bundle)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 1f),
				new Keyframe(1f, 1f)
			});
			SetupScavContract(ref bundle, curve);
			SetupExterminatorContract(ref bundle, curve);
			SetupDataContract(ref bundle, curve);
			SetupExorcismContract(ref bundle, curve);
			SetupBombContract(ref bundle, curve);
		}

		private void SetupBombContract(ref AssetBundle bundle, AnimationCurve curve)
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "BombItem.asset");
			if (!((Object)(object)val == (Object)null))
			{
				val.isConductiveMetal = false;
				DefusalContract defusalContract = val.spawnPrefab.AddComponent<DefusalContract>();
				defusalContract.SetPosition = true;
				BombDefusalScript bombDefusalScript = val.spawnPrefab.AddComponent<BombDefusalScript>();
				bombDefusalScript.snip = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "scissors.mp3");
				bombDefusalScript.tick = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "tick.mp3");
				Utilities.FixMixerGroups(val.spawnPrefab);
				NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
				Items.RegisterItem(val);
				SpawnableMapObjectDef val2 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val2.spawnableMapObject = new SpawnableMapObject();
				val2.spawnableMapObject.prefabToSpawn = val.spawnPrefab;
				MapObjects.RegisterMapObject(val2, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
			}
		}

		private void SetupExorcismContract(ref AssetBundle bundle, AnimationCurve curve)
		{
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "ExorcLootItem.asset");
			val.spawnPrefab.AddComponent<ScrapValueSyncer>();
			Items.RegisterItem(val);
			Utilities.FixMixerGroups(val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Item val2 = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "PentagramItem.asset");
			string[] array = new string[5] { "Heart.asset", "Crucifix.asset", "candelabraItem.asset", "Teddy Bear.asset", "Bones.asset" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				Item val3 = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "RitualItems/" + text);
				ExorcismContract exorcismContract = val3.spawnPrefab.AddComponent<ExorcismContract>();
				Items.RegisterItem(val3);
				Utilities.FixMixerGroups(val3.spawnPrefab);
				NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
				SpawnableMapObjectDef val4 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val4.spawnableMapObject = new SpawnableMapObject();
				val4.spawnableMapObject.prefabToSpawn = val3.spawnPrefab;
				MapObjects.RegisterMapObject(val4, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => new AnimationCurve((Keyframe[])(object)new Keyframe[2]
				{
					new Keyframe(0f, 3f),
					new Keyframe(1f, 3f)
				})));
			}
			if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val == (Object)null))
			{
				ExorcismContract exorcismContract2 = val2.spawnPrefab.AddComponent<ExorcismContract>();
				exorcismContract2.SetPosition = true;
				PentagramScript pentagramScript = val2.spawnPrefab.AddComponent<PentagramScript>();
				pentagramScript.loot = val.spawnPrefab;
				pentagramScript.chant = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "ritualSFX.mp3");
				pentagramScript.portal = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "portal.mp3");
				Utilities.FixMixerGroups(val2.spawnPrefab);
				NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
				Items.RegisterItem(val2);
				SpawnableMapObjectDef val5 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val5.spawnableMapObject = new SpawnableMapObject();
				val5.spawnableMapObject.prefabToSpawn = val2.spawnPrefab;
				MapObjects.RegisterMapObject(val5, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
			}
		}

		private void SetupExterminatorContract(ref AssetBundle bundle, AnimationCurve curve)
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "EggLootItem.asset");
			Items.RegisterItem(val);
			Utilities.FixMixerGroups(val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Item val2 = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "HoardingEggItem.asset");
			if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val == (Object)null))
			{
				ExterminatorContract exterminatorContract = val2.spawnPrefab.AddComponent<ExterminatorContract>();
				exterminatorContract.SetPosition = true;
				BugNestScript bugNestScript = val2.spawnPrefab.AddComponent<BugNestScript>();
				bugNestScript.loot = val.spawnPrefab;
				Utilities.FixMixerGroups(val2.spawnPrefab);
				NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
				Items.RegisterItem(val2);
				SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val3.spawnableMapObject = new SpawnableMapObject();
				val3.spawnableMapObject.prefabToSpawn = val2.spawnPrefab;
				MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
			}
		}

		private void SetupScavContract(ref AssetBundle bundle, AnimationCurve curve)
		{
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "ScavItem.asset");
			if (!((Object)(object)val == (Object)null))
			{
				val.weight = UpgradeBus.instance.cfg.CONTRACT_EXTRACT_WEIGHT;
				ExtractionContract extractionContract = val.spawnPrefab.AddComponent<ExtractionContract>();
				extractionContract.SetPosition = true;
				ExtractPlayerScript extractPlayerScript = val.spawnPrefab.AddComponent<ExtractPlayerScript>();
				TextAsset val2 = AssetBundleHandler.TryLoadOtherAsset<TextAsset>(ref bundle, root + "scavSounds/scavAudio.json");
				Dictionary<string, string[]> dictionary = JsonConvert.DeserializeObject<Dictionary<string, string[]>>(val2.text);
				ExtractPlayerScript.clipDict.Add("lost", CreateAudioClipArray(dictionary["lost"], ref bundle));
				ExtractPlayerScript.clipDict.Add("heal", CreateAudioClipArray(dictionary["heal"], ref bundle));
				ExtractPlayerScript.clipDict.Add("safe", CreateAudioClipArray(dictionary["safe"], ref bundle));
				ExtractPlayerScript.clipDict.Add("held", CreateAudioClipArray(dictionary["held"], ref bundle));
				Utilities.FixMixerGroups(val.spawnPrefab);
				NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
				Items.RegisterItem(val);
				SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val3.spawnableMapObject = new SpawnableMapObject();
				val3.spawnableMapObject.prefabToSpawn = val.spawnPrefab;
				MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
			}
		}

		private void SetupDataContract(ref AssetBundle bundle, AnimationCurve curve)
		{
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "DiscItem.asset");
			Items.RegisterItem(val);
			Utilities.FixMixerGroups(val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Item val2 = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "DataPCItem.asset");
			if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val == (Object)null))
			{
				DataRetrievalContract dataRetrievalContract = val2.spawnPrefab.AddComponent<DataRetrievalContract>();
				dataRetrievalContract.SetPosition = true;
				DataPCScript dataPCScript = val2.spawnPrefab.AddComponent<DataPCScript>();
				dataPCScript.error = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "winError.mp3");
				dataPCScript.startup = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "startup.mp3");
				dataPCScript.loot = val.spawnPrefab;
				Utilities.FixMixerGroups(val2.spawnPrefab);
				NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
				Items.RegisterItem(val2);
				SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val3.spawnableMapObject = new SpawnableMapObject();
				val3.spawnableMapObject.prefabToSpawn = val2.spawnPrefab;
				MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
			}
		}

		private AudioClip[] CreateAudioClipArray(string[] paths, ref AssetBundle bundle)
		{
			AudioClip[] array = (AudioClip[])(object)new AudioClip[paths.Length];
			for (int i = 0; i < paths.Length; i++)
			{
				array[i] = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, paths[i]);
			}
			return array;
		}

		private void SetupModStore(ref AssetBundle bundle)
		{
			GameObject val = AssetBundleHandler.TryLoadGameObjectAsset(ref bundle, "Assets/ShipUpgrades/LGUStore.prefab");
			if (!((Object)(object)val == (Object)null))
			{
				val.AddComponent<LGUStore>();
				NetworkPrefabs.RegisterNetworkPrefab(val);
				UpgradeBus.instance.modStorePrefab = val;
			}
		}

		private void SetupIntroScreen(ref AssetBundle bundle)
		{
			UpgradeBus.instance.introScreen = AssetBundleHandler.TryLoadGameObjectAsset(ref bundle, "Assets/ShipUpgrades/IntroScreen.prefab");
			if ((Object)(object)UpgradeBus.instance.introScreen != (Object)null)
			{
				UpgradeBus.instance.introScreen.AddComponent<IntroScreenScript>();
			}
		}

		private void SetupItems()
		{
			SetupTeleporterButtons();
			SetupNightVision();
			SetupMedkit();
			SetupPeeper();
			SetupSamples();
			SetupHelmet();
			SetupDivingKit();
			SetupWheelbarrows();
		}

		private void SetupSamples()
		{
			Dictionary<string, int> dictionary = new Dictionary<string, int>
			{
				{ "centipede", cfg.SNARE_FLEA_SAMPLE_MINIMUM_VALUE },
				{ "bunker spider", cfg.BUNKER_SPIDER_SAMPLE_MINIMUM_VALUE },
				{ "hoarding bug", cfg.HOARDING_BUG_SAMPLE_MINIMUM_VALUE },
				{ "flowerman", cfg.BRACKEN_SAMPLE_MINIMUM_VALUE },
				{ "mouthdog", cfg.EYELESS_DOG_SAMPLE_MINIMUM_VALUE },
				{ "baboon hawk", cfg.BABOON_HAWK_SAMPLE_MINIMUM_VALUE },
				{ "crawler", cfg.THUMPER_SAMPLE_MINIMUM_VALUE }
			};
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>
			{
				{ "centipede", cfg.SNARE_FLEA_SAMPLE_MAXIMUM_VALUE },
				{ "bunker spider", cfg.BUNKER_SPIDER_SAMPLE_MAXIMUM_VALUE },
				{ "hoarding bug", cfg.HOARDING_BUG_SAMPLE_MAXIMUM_VALUE },
				{ "flowerman", cfg.BRACKEN_SAMPLE_MAXIMUM_VALUE },
				{ "mouthdog", cfg.EYELESS_DOG_SAMPLE_MAXIMUM_VALUE },
				{ "baboon hawk", cfg.BABOON_HAWK_SAMPLE_MAXIMUM_VALUE },
				{ "crawler", cfg.THUMPER_SAMPLE_MAXIMUM_VALUE }
			};
			foreach (string key in AssetBundleHandler.samplePaths.Keys)
			{
				Item itemObject = AssetBundleHandler.GetItemObject(key);
				MonsterSample monsterSample = itemObject.spawnPrefab.AddComponent<MonsterSample>();
				((GrabbableObject)monsterSample).grabbable = true;
				((GrabbableObject)monsterSample).grabbableToEnemies = true;
				((GrabbableObject)monsterSample).itemProperties = itemObject;
				((GrabbableObject)monsterSample).itemProperties.minValue = dictionary[key];
				((GrabbableObject)monsterSample).itemProperties.maxValue = dictionary2[key];
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.instance.samplePrefabs.Add(key, itemObject.spawnPrefab);
			}
		}

		private void SetupTeleporterButtons()
		{
			itemBreak = AssetBundleHandler.GetAudioClip("Break");
			error = AssetBundleHandler.GetAudioClip("Error");
			buttonPressed = AssetBundleHandler.GetAudioClip("Button Press");
			if (!((Object)(object)itemBreak == (Object)null) && !((Object)(object)error == (Object)null) && !((Object)(object)buttonPressed == (Object)null))
			{
				SetupRegularTeleporterButton();
				SetupAdvancedTeleporterButton();
			}
		}

		private void SetupHelmet()
		{
			Item itemObject = AssetBundleHandler.GetItemObject("HelmetItem");
			UpgradeBus.instance.helmetModel = AssetBundleHandler.GetPerkGameObject("HelmetModel");
			if (!((Object)(object)itemObject == (Object)null))
			{
				UpgradeBus.instance.SFX.Add("helmet", AssetBundleHandler.GetAudioClip("HelmetHit"));
				UpgradeBus.instance.SFX.Add("breakWood", AssetBundleHandler.GetAudioClip("breakWood"));
				Helmet helmet = itemObject.spawnPrefab.AddComponent<Helmet>();
				((GrabbableObject)helmet).itemProperties = itemObject;
				((GrabbableObject)helmet).grabbable = true;
				((GrabbableObject)helmet).grabbableToEnemies = true;
				itemObject.creditsWorth = cfg.HELMET_PRICE;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.instance.ItemsToSync.Add("Helmet", itemObject);
				TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
				val.displayText = string.Format(AssetBundleHandler.GetInfoFromJSON("Helmet"), cfg.HELMET_HITS_BLOCKED);
				Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth);
			}
		}

		private void SetupRegularTeleporterButton()
		{
			Item itemObject = AssetBundleHandler.GetItemObject("Portable Tele");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.itemName = "Portable Tele";
				itemObject.itemId = 492012;
				RegularPortableTeleporter regularPortableTeleporter = itemObject.spawnPrefab.AddComponent<RegularPortableTeleporter>();
				((GrabbableObject)regularPortableTeleporter).itemProperties = itemObject;
				((GrabbableObject)regularPortableTeleporter).grabbable = true;
				((GrabbableObject)regularPortableTeleporter).grabbableToEnemies = true;
				regularPortableTeleporter.ItemBreak = itemBreak;
				((GrabbableObject)regularPortableTeleporter).useCooldown = 2f;
				regularPortableTeleporter.error = error;
				regularPortableTeleporter.buttonPress = buttonPressed;
				itemObject.creditsWorth = cfg.WEAK_TELE_PRICE;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.instance.ItemsToSync.Add("Tele", itemObject);
				TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
				val.displayText = string.Format(AssetBundleHandler.GetInfoFromJSON("Portable Tele"), (int)(cfg.CHANCE_TO_BREAK * 100f));
				Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth);
			}
		}

		private void SetupAdvancedTeleporterButton()
		{
			Item itemObject = AssetBundleHandler.GetItemObject("Advanced Portable Tele");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.creditsWorth = cfg.ADVANCED_TELE_PRICE;
				itemObject.itemName = "Advanced Portable Tele";
				itemObject.itemId = 492013;
				AdvancedPortableTeleporter advancedPortableTeleporter = itemObject.spawnPrefab.AddComponent<AdvancedPortableTeleporter>();
				((GrabbableObject)advancedPortableTeleporter).itemProperties = itemObject;
				((GrabbableObject)advancedPortableTeleporter).grabbable = true;
				((GrabbableObject)advancedPortableTeleporter).useCooldown = 2f;
				((GrabbableObject)advancedPortableTeleporter).grabbableToEnemies = true;
				advancedPortableTeleporter.ItemBreak = itemBreak;
				advancedPortableTeleporter.error = error;
				advancedPortableTeleporter.buttonPress = buttonPressed;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.instance.ItemsToSync.Add("AdvTele", itemObject);
				TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
				val.displayText = string.Format(AssetBundleHandler.GetInfoFromJSON("Advanced Portable Tele"), (int)(cfg.ADV_CHANCE_TO_BREAK * 100f));
				Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth);
			}
		}

		private void SetupNightVision()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			Item itemObject = AssetBundleHandler.GetItemObject("Night Vision");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.creditsWorth = cfg.NIGHT_VISION_PRICE;
				itemObject.spawnPrefab.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
				itemObject.itemId = 492014;
				NightVisionGoggles nightVisionGoggles = itemObject.spawnPrefab.AddComponent<NightVisionGoggles>();
				((GrabbableObject)nightVisionGoggles).itemProperties = itemObject;
				((GrabbableObject)nightVisionGoggles).grabbable = true;
				((GrabbableObject)nightVisionGoggles).useCooldown = 2f;
				((GrabbableObject)nightVisionGoggles).grabbableToEnemies = true;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.instance.nightVisionPrefab = itemObject.spawnPrefab;
				UpgradeBus.instance.ItemsToSync.Add("Night", itemObject);
				TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
				string arg = ((cfg.NIGHT_VISION_INDIVIDUAL || UpgradeBus.instance.cfg.SHARED_UPGRADES) ? "one" : "all");
				string arg2 = (cfg.LOSE_NIGHT_VIS_ON_DEATH ? "be" : "not be");
				val.displayText = string.Format(AssetBundleHandler.GetInfoFromJSON("Night Vision"), arg, arg2);
				Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth);
			}
		}

		private void SetupDivingKit()
		{
			Item itemObject = AssetBundleHandler.GetItemObject("Diving Kit");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.creditsWorth = cfg.DIVEKIT_PRICE;
				itemObject.itemId = 492015;
				itemObject.twoHanded = cfg.DIVEKIT_TWO_HANDED;
				itemObject.weight = cfg.DIVEKIT_WEIGHT;
				itemObject.itemSpawnsOnGround = true;
				DivingKit divingKit = itemObject.spawnPrefab.AddComponent<DivingKit>();
				((GrabbableObject)divingKit).itemProperties = itemObject;
				((GrabbableObject)divingKit).grabbable = true;
				((GrabbableObject)divingKit).grabbableToEnemies = true;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.instance.ItemsToSync.Add("Dive", itemObject);
				TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
				string arg = (cfg.DIVEKIT_TWO_HANDED ? "two" : "one");
				val.displayText = $"DIVING KIT - ${cfg.DIVEKIT_PRICE}\n\nBreath underwater.\nWeights {Mathf.RoundToInt((itemObject.weight - 1f) * 100f)} lbs and is {arg} handed.\n\n";
				Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth);
			}
		}

		private void SetupMedkit()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Expected O, but got Unknown
			Item itemObject = AssetBundleHandler.GetItemObject("Medkit");
			if ((Object)(object)itemObject == (Object)null)
			{
				return;
			}
			AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 3f),
				new Keyframe(1f, 3f)
			});
			itemObject.creditsWorth = cfg.MEDKIT_PRICE;
			itemObject.itemId = 492016;
			Medkit medkit = itemObject.spawnPrefab.AddComponent<Medkit>();
			((GrabbableObject)medkit).itemProperties = itemObject;
			((GrabbableObject)medkit).grabbable = true;
			((GrabbableObject)medkit).useCooldown = 2f;
			((GrabbableObject)medkit).grabbableToEnemies = true;
			medkit.error = error;
			medkit.use = buttonPressed;
			NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.displayText = $"MEDKIT - ${cfg.MEDKIT_PRICE}\n\nLeft click to heal yourself for {cfg.MEDKIT_HEAL_VALUE} health.\nCan be used {cfg.MEDKIT_USES} times.\n";
			Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth);
			Item itemObject2 = AssetBundleHandler.GetItemObject("MedkitMapItem");
			if (!((Object)(object)itemObject2 == (Object)null))
			{
				Medkit medkit2 = itemObject2.spawnPrefab.AddComponent<Medkit>();
				ExtractionContract extractionContract = itemObject2.spawnPrefab.AddComponent<ExtractionContract>();
				((GrabbableObject)medkit2).itemProperties = itemObject2;
				((GrabbableObject)medkit2).grabbable = true;
				((GrabbableObject)medkit2).useCooldown = 2f;
				((GrabbableObject)medkit2).grabbableToEnemies = true;
				medkit2.error = error;
				medkit2.use = buttonPressed;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject2.spawnPrefab);
				SpawnableMapObjectDef val2 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val2.spawnableMapObject = new SpawnableMapObject();
				val2.spawnableMapObject.prefabToSpawn = itemObject2.spawnPrefab;
				MapObjects.RegisterMapObject(val2, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
				UpgradeBus.instance.ItemsToSync.Add("Medkit", itemObject);
			}
		}

		private void SetupPeeper()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			Item itemObject = AssetBundleHandler.GetItemObject("Peeper");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.creditsWorth = cfg.PEEPER_PRICE;
				itemObject.twoHanded = false;
				itemObject.itemId = 492017;
				itemObject.twoHandedAnimation = false;
				itemObject.spawnPrefab.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
				Peeper peeper = itemObject.spawnPrefab.AddComponent<Peeper>();
				((GrabbableObject)peeper).itemProperties = itemObject;
				((GrabbableObject)peeper).grabbable = true;
				((GrabbableObject)peeper).grabbableToEnemies = true;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				UpgradeBus.instance.ItemsToSync.Add("Peeper", itemObject);
				TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
				val.displayText = "Looks at coil heads, don't lose it\n";
				Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth);
			}
		}

		private void SetupWheelbarrows()
		{
			wheelbarrowSound = GetAudioClipList("Wheelbarrow Sound", 4);
			shoppingCartSound = GetAudioClipList("Scrap Wheelbarrow Sound", 4);
			SetupStoreWheelbarrow();
			SetupScrapWheelbarrow();
		}

		private AudioClip[] GetAudioClipList(string name, int length)
		{
			AudioClip[] array = (AudioClip[])(object)new AudioClip[length];
			for (int i = 0; i < length; i++)
			{
				array[i] = AssetBundleHandler.GetAudioClip($"{name} {i}");
			}
			return array;
		}

		private void SetupScrapWheelbarrow()
		{
			//IL_0080: 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_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Expected O, but got Unknown
			Item itemObject = AssetBundleHandler.GetItemObject("Scrap Wheelbarrow");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.itemId = 492018;
				itemObject.minValue = cfg.SCRAP_WHEELBARROW_MINIMUM_VALUE;
				itemObject.maxValue = cfg.SCRAP_WHEELBARROW_MAXIMUM_VALUE;
				itemObject.twoHanded = true;
				itemObject.twoHandedAnimation = true;
				itemObject.grabAnim = "HoldJetpack";
				itemObject.floorYOffset = -90;
				itemObject.positionOffset = new Vector3(0f, -1.7f, 0.35f);
				itemObject.allowDroppingAheadOfPlayer = true;
				itemObject.isConductiveMetal = true;
				itemObject.isScrap = true;
				itemObject.weight = 0.99f + cfg.SCRAP_WHEELBARROW_WEIGHT / 100f;
				itemObject.toolTips = new string[1] { "Drop all items: [MMB]" };
				itemObject.canBeGrabbedBeforeGameStart = true;
				ScrapWheelbarrow scrapWheelbarrow = itemObject.spawnPrefab.AddComponent<ScrapWheelbarrow>();
				((GrabbableObject)scrapWheelbarrow).itemProperties = itemObject;
				scrapWheelbarrow.wheelsClip = shoppingCartSound;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				Items.RegisterItem(itemObject);
				Utilities.FixMixerGroups(itemObject.spawnPrefab);
				int num = (cfg.SCRAP_WHEELBARROW_ENABLED ? 1 : 0);
				AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
				{
					new Keyframe(0f, 0f),
					new Keyframe(1f - cfg.SCRAP_WHEELBARROW_RARITY, (float)num),
					new Keyframe(1f, (float)num)
				});
				SpawnableMapObjectDef val = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
				val.spawnableMapObject = new SpawnableMapObject();
				val.spawnableMapObject.prefabToSpawn = itemObject.spawnPrefab;
				MapObjects.RegisterMapObject(val, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve));
			}
		}

		private void SetupStoreWheelbarrow()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			Item itemObject = AssetBundleHandler.GetItemObject("Store Wheelbarrow");
			if (!((Object)(object)itemObject == (Object)null))
			{
				itemObject.itemId = 492019;
				itemObject.creditsWorth = cfg.WHEELBARROW_PRICE;
				itemObject.twoHanded = true;
				itemObject.twoHandedAnimation = true;
				itemObject.grabAnim = "HoldJetpack";
				itemObject.floorYOffset = -90;
				itemObject.verticalOffset = 0.3f;
				itemObject.positionOffset = new Vector3(0f, -0.7f, 1.4f);
				itemObject.allowDroppingAheadOfPlayer = true;
				itemObject.isConductiveMetal = true;
				itemObject.weight = 0.99f + cfg.WHEELBARROW_WEIGHT / 100f;
				itemObject.toolTips = new string[1] { "Drop all items: [MMB] " };
				itemObject.canBeGrabbedBeforeGameStart = true;
				StoreWheelbarrow storeWheelbarrow = itemObject.spawnPrefab.AddComponent<StoreWheelbarrow>();
				((GrabbableObject)storeWheelbarrow).itemProperties = itemObject;
				storeWheelbarrow.wheelsClip = wheelbarrowSound;
				NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab);
				Utilities.FixMixerGroups(itemObject.spawnPrefab);
				UpgradeBus.instance.ItemsToSync.Add("Wheel", itemObject);
				TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
				val.displayText = $"A portable container which has a maximum capacity of {cfg.WHEELBARROW_MAXIMUM_AMOUNT_ITEMS} and reduces the effective weight of the inserted items by {cfg.WHEELBARROW_WEIGHT_REDUCTION_MULTIPLIER * 100f} %.\nIt weighs {1f + cfg.WHEELBARROW_WEIGHT / 100f} lbs";
				Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth);
			}
		}

		private void SetupPerks()
		{
			SetupBeekeeper();
			SetupProteinPowder();
			SetupBiggerLungs();
			SetupRunningShoes();
			SetupStrongLegs();
			SetupMalwareBroadcaster();
			SetupNightVisionBattery();
			SetupDiscombobulator();
			SetupBetterScanner();
			SetupWalkieGPS();
			SetupBackMuscles();
			SetupInterns();
			SetupPager();
			SetupLightningRod();
			SetupLocksmith();
			SetupPlayerHealth();
			SetupHunter();
			SetupContract();
			SetupSickBeats();
			SetupExtendDeadline();
			SetupDoorsHydraulicsBattery();
			SetupScrapInsurance();
		}

		private void SetupSickBeats()
		{
			SetupGenericPerk<BeatScript>(BeatScript.UPGRADE_NAME);
		}

		private void SetupContract()
		{
			SetupGenericPerk<ContractScript>(ContractScript.UPGRADE_NAME);
		}

		private void SetupBeekeeper()
		{
			SetupGenericPerk<beekeeperScript>(beekeeperScript.UPGRADE_NAME);
		}

		private void SetupHunter()
		{
			SetupGenericPerk<hunterScript>(hunterScript.UPGRADE_NAME);
		}

		private void SetupProteinPowder()
		{
			SetupGenericPerk<proteinPowderScript>(proteinPowderScript.UPGRADE_NAME);
		}

		private void SetupBiggerLungs()
		{
			SetupGenericPerk<biggerLungScript>(biggerLungScript.UPGRADE_NAME);
		}

		private void SetupRunningShoes()
		{
			SetupGenericPerk<runningShoeScript>(runningShoeScript.UPGRADE_NAME);
		}

		private void SetupStrongLegs()
		{
			SetupGenericPerk<strongLegsScript>(strongLegsScript.UPGRADE_NAME);
		}

		private void SetupMalwareBroadcaster()
		{
			SetupGenericPerk<trapDestroyerScript>(trapDestroyerScript.UPGRADE_NAME);
		}

		private void SetupNightVisionBattery()
		{
			SetupGenericPerk<nightVisionScript>(nightVisionScript.UPGRADE_NAME);
		}

		private void SetupDiscombobulator()
		{
			AudioClip audioClip = AssetBundleHandler.GetAudioClip("Flashbang");
			if ((Object)(object)audioClip != (Object)null)
			{
				UpgradeBus.instance.flashNoise = audioClip;
			}
			SetupGenericPerk<terminalFlashScript>(terminalFlashScript.UPGRADE_NAME);
		}

		private void SetupBetterScanner()
		{
			SetupGenericPerk<strongerScannerScript>(strongerScannerScript.UPGRADE_NAME);
		}

		private void SetupWalkieGPS()
		{
			SetupGenericPerk<walkieScript>(walkieScript.UPGRADE_NAME);
		}

		private void SetupBackMuscles()
		{
			SetupGenericPerk<exoskeletonScript>(exoskeletonScript.UPGRADE_NAME);
		}

		private void SetupInterns()
		{
			SetupGenericPerk<defibScript>(defibScript.UPGRADE_NAME);
		}

		private void SetupPager()
		{
			SetupGenericPerk<pagerScript>(pagerScript.UPGRADE_NAME);
		}

		private void SetupLightningRod()
		{
			SetupGenericPerk<lightningRodScript>(lightningRodScript.UPGRADE_NAME);
		}

		private void SetupLocksmith()
		{
			SetupGenericPerk<lockSmithScript>(lockSmithScript.UPGRADE_NAME);
		}

		private void SetupPlayerHealth()
		{
			SetupGenericPerk<playerHealthScript>(playerHealthScript.UPGRADE_NAME);
		}

		private void SetupExtendDeadline()
		{
			SetupGenericPerk<ExtendDeadlineScript>(ExtendDeadlineScript.UPGRADE_NAME);
		}

		private void SetupDoorsHydraulicsBattery()
		{
			SetupGenericPerk<DoorsHydraulicsBattery>("Shutter Batteries");
		}

		private void SetupScrapInsurance()
		{
			SetupGenericPerk<ScrapInsurance>(ScrapInsurance.COMMAND_NAME);
		}

		private void SetupGenericPerk<T>(string upgradeName) where T : Component
		{
			GameObject perkGameObject = AssetBundleHandler.GetPerkGameObject(upgradeName);
			if (Object.op_Implicit((Object)(object)perkGameObject))
			{
				perkGameObject.AddComponent<T>();
				NetworkPrefabs.RegisterNetworkPrefab(perkGameObject);
			}
		}
	}
}
namespace MoreShipUpgrades.UpgradeComponents.TierUpgrades
{
	internal class beekeeperScript : BaseUpgrade
	{
		private static LGULogger logger = new LGULogger(UPGRADE_NAME);

		public static string UPGRADE_NAME = "Beekeeper";

		public static string PRICES_DEFAULT = "225,280,340";

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		public override void Increment()
		{
			UpgradeBus.instance.beeLevel++;
			if (UpgradeBus.instance.beeLevel == UpgradeBus.instance.cfg.BEEKEEPER_UPGRADE_PRICES.Split(',').Length)
			{
				LGUStore.instance.ToggleIncreaseHivePriceServerRpc();
			}
		}

		public override void load()
		{
			base.load();
			UpgradeBus.instance.beekeeper = true;
		}

		public override void Register()
		{
			base.Register();
		}

		public override void Unwind()
		{
			base.Unwind();
			UpgradeBus.instance.beeLevel = 0;
			UpgradeBus.instance.beekeeper = false;
		}

		public static int CalculateBeeDamage(int damageNumber)
		{
			if (!UpgradeBus.instance.beekeeper)
			{
				return damageNumber;
			}
			return Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT)), 0, damageNumber);
		}

		public static int GetHiveScrapValue(int originalValue)
		{
			if (!UpgradeBus.instance.increaseHivePrice)
			{
				return originalValue;
			}
			return (int)((float)originalValue * UpgradeBus.instance.cfg.BEEKEEPER_HIVE_VALUE_INCREASE);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "beekeeperScript";
		}
	}
	internal class biggerLungScript : BaseUpgrade
	{
		private static LGULogger logger;

		public static string UPGRADE_NAME = "Bigger Lungs";

		public static string PRICES_DEFAULT = "350,450,550";

		private int currentLevel = 0;

		private static bool active = false;

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			logger = new LGULogger(UPGRADE_NAME);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		public override void Increment()
		{
			PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer();
			localPlayer.sprintTime += UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT;
			logger.LogDebug($"Adding {UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT} to the player's sprint time...");
			UpgradeBus.instance.lungLevel++;
			currentLevel++;
		}

		public override void load()
		{
			PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer();
			if (!active)
			{
				logger.LogDebug($"Adding {UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE_UNLOCK} to the player's sprint time...");
				localPlayer.sprintTime += UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE_UNLOCK;
			}
			UpgradeBus.instance.biggerLungs = true;
			active = true;
			base.load();
			float num = 0f;
			for (int i = 1; i < UpgradeBus.instance.lungLevel + 1; i++)
			{
				if (i > currentLevel)
				{
					logger.LogDebug($"Adding {UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT} to the player's sprint time...");
					num += UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT;
				}
			}
			localPlayer.sprintTime += num;
			currentLevel = UpgradeBus.instance.lungLevel;
		}

		public override void Unwind()
		{
			PlayerControllerB player = UpgradeBus.instance.GetLocalPlayer();
			if (active)
			{
				ResetBiggerLungsBuff(ref player);
			}
			base.Unwind();
			UpgradeBus.instance.biggerLungs = false;
			UpgradeBus.instance.lungLevel = 0;
			active = false;
			currentLevel = 0;
		}

		public override void Register()
		{
			base.Register();
		}

		public static void ResetBiggerLungsBuff(ref PlayerControllerB player)
		{
			float num = UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE_UNLOCK;
			for (int i = 0; i < UpgradeBus.instance.lungLevel; i++)
			{
				num += UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT;
			}
			logger.LogDebug($"Removing {player.playerUsername}'s sprint time boost ({player.sprintTime}) with a boost of {num}");
			PlayerControllerB obj = player;
			obj.sprintTime -= num;
			logger.LogDebug("Upgrade reset on " + player.playerUsername);
			active = false;
		}

		public static float ApplyPossibleIncreasedStaminaRegen(float regenValue)
		{
			if (!UpgradeBus.instance.biggerLungs || UpgradeBus.instance.lungLevel < 0)
			{
				return regenValue * UpgradeBus.instance.staminaDrainCoefficient;
			}
			return regenValue * UpgradeBus.instance.cfg.BIGGER_LUNGS_STAMINA_REGEN_INCREASE * UpgradeBus.instance.staminaDrainCoefficient;
		}

		public static float ApplyPossibleReducedJumpStaminaCost(float jumpCost)
		{
			if (!UpgradeBus.instance.biggerLungs || UpgradeBus.instance.lungLevel < 1)
			{
				return jumpCost;
			}
			return jumpCost * UpgradeBus.instance.cfg.BIGGER_LUNGS_JUMP_STAMINA_COST_DECREASE;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "biggerLungScript";
		}
	}
	internal class DoorsHydraulicsBattery : BaseUpgrade
	{
		private static LGULogger logger;

		public const string UPGRADE_NAME = "Shutter Batteries";

		public const string PRICES_DEFAULT = "200,300,400";

		public static string ENABLED_SECTION = "Enable Shutter Batteries";

		public static string ENABLED_DESCRIPTION = "Increases the amount of time the doors can remain shut";

		public static string PRICE_SECTION = "Price of Shutter Batteries";

		public static int PRICE_DEFAULT = 300;

		public static string INITIAL_SECTION = "Initial battery boost";

		public static float INITIAL_DEFAULT = 5f;

		public static string INITIAL_DESCRIPTION = "Initial battery boost for the doors' lock on first purchase";

		public static string INCREMENTAL_SECTION = "Incremental battery boost";

		public static float INCREMENTAL_DEFAULT = 5f;

		public static string INCREMENTAL_DESCRIPTION = "Incremental battery boost for the doors' lock after purchase";

		private static bool active;

		private int currentLevel;

		private void Start()
		{
			upgradeName = "Shutter Batteries";
			logger = new LGULogger(upgradeName);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		public override void load()
		{
			HangarShipDoor shipDoors = UpgradeBus.instance.GetShipDoors();
			if (!active)
			{
				logger.LogDebug($"Adding initial {UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INITIAL} to the door's power duration...");
				shipDoors.doorPowerDuration += UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INITIAL;
			}
			UpgradeBus.instance.doorsHydraulicsBattery = true;
			active = true;
			base.load();
			float num = 0f;
			for (int i = 1; i < UpgradeBus.instance.doorsHydraulicsBatteryLevel + 1; i++)
			{
				if (i > currentLevel)
				{
					logger.LogDebug($"Adding incremental {UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INCREMENTAL} to the door's power duration...");
					num += UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INCREMENTAL;
				}
			}
			logger.LogDebug(num);
			logger.LogDebug(shipDoors.doorPowerDuration);
			shipDoors.doorPowerDuration += num;
			currentLevel = UpgradeBus.instance.doorsHydraulicsBatteryLevel;
		}

		public override void Increment()
		{
			HangarShipDoor shipDoors = UpgradeBus.instance.GetShipDoors();
			shipDoors.doorPowerDuration += UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INCREMENTAL;
			logger.LogDebug($"Adding incremental {UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INCREMENTAL} to the ship door's battery...");
			UpgradeBus.instance.doorsHydraulicsBatteryLevel++;
			currentLevel++;
		}

		public override void Unwind()
		{
			HangarShipDoor shipDoors = UpgradeBus.instance.GetShipDoors();
			if (active)
			{
				ResetDoorsHydraulicsBattery(ref shipDoors);
			}
			base.Unwind();
			UpgradeBus.instance.doorsHydraulicsBattery = false;
			UpgradeBus.instance.doorsHydraulicsBatteryLevel = 0;
			active = false;
			currentLevel = 0;
		}

		public static void ResetDoorsHydraulicsBattery(ref HangarShipDoor shipDoors)
		{
			float num = UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INITIAL;
			for (int i = 0; i < UpgradeBus.instance.doorsHydraulicsBatteryLevel; i++)
			{
				num += UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INCREMENTAL;
			}
			logger.LogDebug($"Removing ship door's battery boost ({shipDoors.doorPowerDuration}) with a boost of {num}");
			HangarShipDoor obj = shipDoors;
			obj.doorPowerDuration -= num;
			logger.LogDebug("Upgrade reset on ship doors");
			active = false;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "DoorsHydraulicsBattery";
		}
	}
	internal class exoskeletonScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Back Muscles";

		public static string PRICES_DEFAULT = "600,700,800";

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		public override void Increment()
		{
			UpgradeBus.instance.backLevel++;
			UpdatePlayerWeight();
		}

		public override void load()
		{
			base.load();
			UpgradeBus.instance.exoskeleton = true;
			UpdatePlayerWeight();
		}

		public override void Unwind()
		{
			base.Unwind();
			UpgradeBus.instance.exoskeleton = false;
			UpgradeBus.instance.backLevel = 0;
			UpdatePlayerWeight();
		}

		public override void Register()
		{
			base.Register();
		}

		public static float DecreasePossibleWeight(float defaultWeight)
		{
			if (!UpgradeBus.instance.exoskeleton)
			{
				return defaultWeight;
			}
			return defaultWeight * (UpgradeBus.instance.cfg.CARRY_WEIGHT_REDUCTION - (float)UpgradeBus.instance.backLevel * UpgradeBus.instance.cfg.CARRY_WEIGHT_INCREMENT);
		}

		public static void UpdatePlayerWeight()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (localPlayerController.ItemSlots.Length == 0)
			{
				return;
			}
			UpgradeBus.instance.alteredWeight = 1f;
			for (int i = 0; i < localPlayerController.ItemSlots.Length; i++)
			{
				GrabbableObject val = localPlayerController.ItemSlots[i];
				if (!((Object)(object)val == (Object)null))
				{
					UpgradeBus.instance.alteredWeight += Mathf.Clamp(DecreasePossibleWeight(val.itemProperties.weight - 1f), 0f, 10f);
				}
			}
			localPlayerController.carryWeight = UpgradeBus.instance.alteredWeight;
			if (localPlayerController.carryWeight < 1f)
			{
				localPlayerController.carryWeight = 1f;
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "exoskeletonScript";
		}
	}
	internal class hunterScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Hunter";

		private static LGULogger logger = new LGULogger(UPGRADE_NAME);

		private static Dictionary<string, string> monsterNames = new Dictionary<string, string>
		{
			{ "hoarding", "Hoarding Bug" },
			{ "hoarding bug", "Hoarding Bug" },
			{ "snare", "Snare Flea" },
			{ "flea", "Snare Flea" },
			{ "snare flea", "Snare Flea" },
			{ "centipede", "Snare Flea" },
			{ "bunker spider", "Bunker Spider" },
			{ "bunker", "Bunker Spider" },
			{ "bunk", "Bunker Spider" },
			{ "spider", "Bunker Spider" },
			{ "baboon hawk", "Baboon Hawk" },
			{ "baboon", "Baboon Hawk" },
			{ "hawk", "Baboon Hawk" },
			{ "flowerman", "Bracken" },
			{ "bracken", "Bracken" },
			{ "crawler", "Half/Thumper" },
			{ "half", "Half/Thumper" },
			{ "thumper", "Half/Thumper" },
			{ "mouthdog", "Eyeless Dog" },
			{ "eyeless dog", "Eyeless Dog" },
			{ "eyeless", "Eyeless Dog" },
			{ "dog", "Eyeless Dog" }
		};

		public static Dictionary<int, string[]> tiers;

		public static void SetupTierList()
		{
			logger = new LGULogger(UPGRADE_NAME);
			tiers = new Dictionary<int, string[]>();
			string[] array = UpgradeBus.instance.cfg.HUNTER_SAMPLE_TIERS.ToLower().Split('-');
			tiers[0] = (from x in array[0].Split(",")
				select x.Trim()).ToArray();
			for (int i = 1; i < array.Length; i++)
			{
				tiers[i] = tiers[i - 1].Concat(from x in array[i].Split(",")
					select x.Trim()).ToArray();
			}
		}

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		public override void Increment()
		{
			UpgradeBus.instance.huntLevel++;
		}

		public override void load()
		{
			base.load();
			UpgradeBus.instance.hunter = true;
		}

		public override void Unwind()
		{
			base.Unwind();
			UpgradeBus.instance.hunter = false;
			UpgradeBus.instance.huntLevel = 0;
		}

		public override void Register()
		{
			base.Register();
		}

		public static string GetHunterInfo(int level, int price)
		{
			string text = ((level == 1) ? string.Join(", ", tiers[level - 1]) : string.Join(", ", tiers[level - 1].Except(tiers[level - 2]).ToArray()));
			string text2 = "";
			string[] array = text.Split(", ");
			foreach (string text3 in array)
			{
				logger.LogDebug(text3.Trim().ToLower());
				logger.LogDebug(monsterNames[text3.Trim().ToLower()]);
				text2 = text2 + monsterNames[text3.Trim().ToLower()] + ", ";
			}
			text2 = text2.Substring(0, text2.Length - 2);
			text2 += "\n";
			return string.Format(AssetBundleHandler.GetInfoFromJSON(UPGRADE_NAME), level, price, text2);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "hunterScript";
		}
	}
	internal class nightVisionScript : BaseUpgrade
	{
		private float nightBattery;

		private Transform batteryBar;

		private PlayerControllerB client;

		private bool batteryExhaustion;

		private Key toggleKey;

		public static string UPGRADE_NAME = "NV Headset Batteries";

		public static string PRICES_DEFAULT = "300,400,500";

		private static LGULogger logger = new LGULogger(UPGRADE_NAME);

		private void Start()
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			upgradeName = UPGRADE_NAME;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
			batteryBar = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).transform;
			((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
			if (Enum.TryParse<Key>(UpgradeBus.instance.cfg.TOGGLE_NIGHT_VISION_KEY, out Key result))
			{
				toggleKey = result;
				return;
			}
			logger.LogWarning("Error parsing the key for toggle night vision, defaulted to LeftAlt");
			toggleKey = (Key)53;
		}

		public override void Register()
		{
			base.Register();
		}

		private void LateUpdate()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)client == (Object)null)
			{
				return;
			}
			if (((ButtonControl)Keyboard.current[toggleKey]).wasPressedThisFrame && !batteryExhaustion)
			{
				Toggle();
			}
			float num = UpgradeBus.instance.cfg.NIGHT_BATTERY_MAX + (float)UpgradeBus.instance.nightVisionLevel * UpgradeBus.instance.cfg.NIGHT_VIS_BATTERY_INCREMENT;
			if (UpgradeBus.instance.nightVisionActive)
			{
				nightBattery -= Time.deltaTime * (UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_SPEED - (float)UpgradeBus.instance.nightVisionLevel * UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_INCREMENT);
				nightBattery = Mathf.Clamp(nightBattery, 0f, num);
				((Component)batteryBar.parent).gameObject.SetActive(true);
				if (nightBattery <= 0f)
				{
					TurnOff(exhaust: true);
				}
			}
			else if (!batteryExhaustion)
			{
				nightBattery += Time.deltaTime * (UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_SPEED + (float)UpgradeBus.instance.nightVisionLevel * UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_INCREMENT);
				nightBattery = Mathf.Clamp(nightBattery, 0f, num);
				if (nightBattery >= num)
				{
					((Component)batteryBar.parent).gameObject.SetActive(false);
				}
				else
				{
					((Component)batteryBar.parent).gameObject.SetActive(true);
				}
			}
			if (client.isInsideFactory || UpgradeBus.instance.nightVisionActive)
			{
				((Behaviour)client.nightVision).enabled = true;
			}
			else
			{
				((Behaviour)client.nightVision).enabled = false;
			}
			float num2 = nightBattery / num;
			batteryBar.localScale = new Vector3(num2, 1f, 1f);
		}

		private void Toggle()
		{
			UpgradeBus.instance.nightVisionActive = !UpgradeBus.instance.nightVisionActive;
			if (UpgradeBus.instance.nightVisionActive)
			{
				TurnOn();
			}
			else
			{
				TurnOff();
			}
		}

		private void TurnOff(bool exhaust = false)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			UpgradeBus.instance.nightVisionActive = false;
			client.nightVision.color = UpgradeBus.instance.nightVisColor;
			client.nightVision.range = UpgradeBus.instance.nightVisRange;
			client.nightVision.intensity = UpgradeBus.instance.nightVisIntensity;
			if (exhaust)
			{
				batteryExhaustion = true;
				((MonoBehaviour)this).StartCoroutine(BatteryRecovery());
			}
		}

		private void TurnOn()
		{
			//IL_0011: 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)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			UpgradeBus.instance.nightVisColor = client.nightVision.color;
			UpgradeBus.instance.nightVisRange = client.nightVision.range;
			UpgradeBus.instance.nightVisIntensity = client.nightVision.intensity;
			client.nightVision.color = UpgradeBus.instance.cfg.NIGHT_VIS_COLOR;
			client.nightVision.range = UpgradeBus.instance.cfg.NIGHT_VIS_RANGE + (float)UpgradeBus.instance.nightVisionLevel * UpgradeBus.instance.cfg.NIGHT_VIS_RANGE_INCREMENT;
			client.nightVision.intensity = UpgradeBus.instance.cfg.NIGHT_VIS_INTENSITY + (float)UpgradeBus.instance.nightVisionLevel * UpgradeBus.instance.cfg.NIGHT_VIS_INTENSITY_INCREMENT;
			nightBattery -= UpgradeBus.instance.cfg.NIGHT_VIS_STARTUP;
		}

		private IEnumerator BatteryRecovery()
		{
			yield return (object)new WaitForSeconds(UpgradeBus.instance.cfg.NIGHT_VIS_EXHAUST);
			batteryExhaustion = false;
		}

		public override void Increment()
		{
			UpgradeBus.instance.nightVisionLevel++;
			LGUStore.instance.UpdateLGUSaveServerRpc(GameNetworkManager.Instance.localPlayerController.playerSteamId, JsonConvert.SerializeObject((object)new SaveInfo()));
		}

		public override void load()
		{
			EnableOnClient(save: false);
		}

		public override void Unwind()
		{
			base.Unwind();
			UpgradeBus.instance.nightVision = false;
			UpgradeBus.instance.nightVisionLevel = 0;
			DisableOnClient();
		}

		public void EnableOnClient(bool save = true)
		{
			if ((Object)(object)client == (Object)null)
			{
				client = GameNetworkManager.Instance.localPlayerController;
			}
			((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(true);
			UpgradeBus.instance.nightVision = true;
			if (save)
			{
				LGUStore.instance.UpdateLGUSaveServerRpc(client.playerSteamId, JsonConvert.SerializeObject((object)new SaveInfo()));
			}
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Press " + UpgradeBus.instance.cfg.TOGGLE_NIGHT_VISION_KEY + " to toggle Night Vision!!!</color>";
		}

		public void DisableOnClient()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			UpgradeBus.instance.nightVisionActive = false;
			client.nightVision.color = UpgradeBus.instance.nightVisColor;
			client.nightVision.range = UpgradeBus.instance.nightVisRange;
			client.nightVision.intensity = UpgradeBus.instance.nightVisIntensity;
			((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
			UpgradeBus.instance.nightVision = false;
			LGUStore.instance.UpdateLGUSaveServerRpc(client.playerSteamId, JsonConvert.SerializeObject((object)new SaveInfo()));
			client = null;
		}

		public static string GetNightVisionInfo(int level, int price)
		{
			if (level == 1)
			{
				float num = (UpgradeBus.instance.cfg.NIGHT_BATTERY_MAX - UpgradeBus.instance.cfg.NIGHT_BATTERY_MAX * UpgradeBus.instance.cfg.NIGHT_VIS_STARTUP) / UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_SPEED;
				float num2 = UpgradeBus.instance.cfg.NIGHT_BATTERY_MAX / UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_SPEED;
				return string.Format(AssetBundleHandler.GetInfoFromJSON(UPGRADE_NAME), level, price, num, num2);
			}
			float num3 = Mathf.Clamp(UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_SPEED + UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_INCREMENT * (float)(level - 1), 0f, 1000f);
			float num4 = Mathf.Clamp(UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_SPEED - UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_INCREMENT * (float)(level - 1), 0f, 1000f);
			float num5 = UpgradeBus.instance.cfg.NIGHT_BATTERY_MAX + UpgradeBus.instance.cfg.NIGHT_VIS_BATTERY_INCREMENT * (float)(level - 1);
			string text = "infinite";
			if (num4 != 0f)
			{
				text = ((num5 - num5 * UpgradeBus.instance.cfg.NIGHT_VIS_STARTUP) / num4).ToString("F2");
			}
			string text2 = "infinite";
			if (num3 != 0f)
			{
				text2 = (num5 / num3).ToString("F2");
			}
			return string.Format(AssetBundleHandler.GetInfoFromJSON(UPGRADE_NAME), level, price, text, text2);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "nightVisionScript";
		}
	}
	internal class playerHealthScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Stimpack";

		private static bool active;

		private int previousLevel;

		private static LGULogger logger;

		public static string ENABLED_SECTION = "Enable " + UPGRADE_NAME + " Upgrade";

		public static bool ENABLED_DEFAULT = true;

		public static string ENABLED_DESCRIPTION = "Increases player's health.";

		public static string PRICE_SECTION = UPGRADE_NAME + " Price";

		public static int PRICE_DEFAULT = 600;

		public static string PRICES_DEFAULT = "300, 450, 600";

		public static string ADDITIONAL_HEALTH_UNLOCK_SECTION = "Initial health boost";

		public static int ADDITIONAL_HEALTH_UNLOCK_DEFAULT = 20;

		public static string ADDITIONAL_HEALTH_UNLOCK_DESCRIPTION = "Amount of health gained when unlocking the upgrade";

		public static string ADDITIONAL_HEALTH_INCREMENT_SECTION = "Additional health boost";

		public static int ADDITIONAL_HEALTH_INCREMENT_DEFAULT = 20;

		public static string ADDITIONAL_HEALTH_INCREMENT_DESCRIPTION = "Every time " + UPGRADE_NAME + " is upgraded this value will be added to the value above.";

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			UpgradeBus.instance.UpgradeObjects.Add(UPGRADE_NAME, ((Component)this).gameObject);
			logger = new LGULogger(UPGRADE_NAME);
		}

		public override void Increment()
		{
			PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer();
			localPlayer.health += UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT;
			logger.LogDebug($"Adding {UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT} to the player's health...");
			UpgradeBus.instance.playerHealthLevel++;
			previousLevel++;
			LGUStore.instance.PlayerHealthUpdateLevelServerRpc(localPlayer.playerSteamId, UpgradeBus.instance.playerHealthLevel);
		}

		public override void load()
		{
			PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer();
			if (!active)
			{
				logger.LogDebug($"Adding {UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK} to the player's health on unlock...");
				localPlayer.health += UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK;
			}
			base.load();
			UpgradeBus.instance.playerHealth = true;
			active = true;
			int num = 0;
			for (int i = 1; i < UpgradeBus.instance.playerHealthLevel + 1; i++)
			{
				if (i > previousLevel)
				{
					logger.LogDebug($"Adding {UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT} to the player's health on increment...");
					num += UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT;
				}
			}
			localPlayer.health += num;
			previousLevel = UpgradeBus.instance.playerHealthLevel;
			LGUStore.instance.PlayerHealthUpdateLevelServerRpc(localPlayer.playerSteamId, UpgradeBus.instance.playerHealthLevel);
		}

		public override void Register()
		{
			base.Register();
		}

		public override void Unwind()
		{
			PlayerControllerB player = UpgradeBus.instance.GetLocalPlayer();
			if (active)
			{
				ResetStimpackBuff(ref player);
			}
			base.Unwind();
			UpgradeBus.instance.playerHealthLevel = 0;
			UpgradeBus.instance.playerHealth = false;
			previousLevel = 0;
			active = false;
			LGUStore.instance.PlayerHealthUpdateLevelServerRpc(player.playerSteamId, -1);
		}

		public static int CheckForAdditionalHealth(int health)
		{
			PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer();
			if (!UpgradeBus.instance.playerHealthLevels.ContainsKey(localPlayer.playerSteamId))
			{
				return health;
			}
			int num = UpgradeBus.instance.playerHealthLevels[localPlayer.playerSteamId];
			return health + UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK + num * UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT;
		}

		public static int GetHealthFromPlayer(int health, ulong steamId)
		{
			int num = UpgradeBus.instance.playerHealthLevels[steamId];
			return health + UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK + num * UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT;
		}

		public static void ResetStimpackBuff(ref PlayerControllerB player)
		{
			int num = UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK;
			for (int i = 0; i < UpgradeBus.instance.playerHealthLevel; i++)
			{
				num += UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT;
			}
			logger.LogDebug($"Removing {player.playerUsername}'s health boost ({player.health}) with a boost of {num}");
			PlayerControllerB obj = player;
			obj.health -= num;
			logger.LogDebug("Upgrade reset on " + player.playerUsername);
			active = false;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "playerHealthScript";
		}
	}
	internal class proteinPowderScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Protein Powder";

		private static int CRIT_DAMAGE_VALUE = 100;

		public static string ENABLED_SECTION = "Enable " + UPGRADE_NAME + " Upgrade";

		public static bool ENABLED_DEFAULT = true;

		public static string ENABLED_DESCRIPTION = "Do more damage with shovels";

		public static string PRICE_SECTION = "Price of " + UPGRADE_NAME + " Upgrade";

		public static int PRICE_DEFAULT = 1000;

		public static string UNLOCK_FORCE_SECTION = "Initial additional hit force";

		public static int UNLOCK_FORCE_DEFAULT = 1;

		public static string UNLOCK_FORCE_DESCRIPTION = "The value added to hit force on initial unlock.";

		public static string INCREMENT_FORCE_SECTION = "Additional hit force per level";

		public static int INCREMENT_FORCE_DEFAULT = 1;

		public static string INCREMENT_FORCE_DESCRIPTION = "Every time " + UPGRADE_NAME + " is upgraded this value will be added to the value above.";

		public static string PRICES_DEFAULT = "700";

		public static string CRIT_CHANCE_SECTION = "Chance of dealing a crit which will instakill the enemy.";

		public static float CRIT_CHANCE_DEFAULT = 0.01f;

		public static string CRIT_CHANCE_DESCRIPTION = "This value is only valid when maxed out " + UPGRADE_NAME + ". Any previous levels will not apply crit.";

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		public override void Increment()
		{
			UpgradeBus.instance.proteinLevel++;
		}

		public override void load()
		{
			base.load();
			UpgradeBus.instance.proteinPowder = true;
		}

		public override void Register()
		{
			base.Register();
		}

		public override void Unwind()
		{
			base.Unwind();
			UpgradeBus.instance.proteinLevel = 0;
			UpgradeBus.instance.proteinPowder = false;
		}

		public static int GetShovelHitForce(int force)
		{
			return ((!UpgradeBus.instance.proteinPowder) ? force : (TryToCritEnemy() ? CRIT_DAMAGE_VALUE : (UpgradeBus.instance.cfg.PROTEIN_INCREMENT * UpgradeBus.instance.proteinLevel + UpgradeBus.instance.cfg.PROTEIN_UNLOCK_FORCE + force))) + UpgradeBus.instance.damageBoost;
		}

		private static bool TryToCritEnemy()
		{
			int num = UpgradeBus.instance.cfg.PROTEIN_UPGRADE_PRICES.Split(',').Length;
			int proteinLevel = UpgradeBus.instance.proteinLevel;
			if (proteinLevel != num)
			{
				return false;
			}
			return Random.value < UpgradeBus.instance.cfg.PROTEIN_CRIT_CHANCE;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "proteinPowderScript";
		}
	}
	internal class runningShoeScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Running Shoes";

		private static LGULogger logger;

		public static string PRICES_DEFAULT = "500,750,1000";

		private int currentLevel = 0;

		private static bool active = false;

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			logger = new LGULogger(UPGRADE_NAME);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		public override void Increment()
		{
			PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer();
			localPlayer.movementSpeed += UpgradeBus.instance.cfg.MOVEMENT_INCREMENT;
			logger.LogDebug($"Adding {UpgradeBus.instance.cfg.MOVEMENT_INCREMENT} to the player's movement speed...");
			UpgradeBus.instance.runningLevel++;
			currentLevel++;
		}

		public override void Unwind()
		{
			base.Unwind();
			PlayerControllerB player = UpgradeBus.instance.GetLocalPlayer();
			if (UpgradeBus.instance.runningShoes)
			{
				ResetRunningShoesBuff(ref player);
			}
			UpgradeBus.instance.runningShoes = false;
			UpgradeBus.instance.runningLevel = 0;
			active = false;
			currentLevel = 0;
		}

		public override void Register()
		{
			base.Register();
		}

		public override void load()
		{
			base.load();
			UpgradeBus.instance.runningShoes = true;
			PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer();
			if (!active)
			{
				logger.LogDebug($"Adding {UpgradeBus.instance.cfg.MOVEMENT_SPEED_UNLOCK} to the player's movement speed...");
				localPlayer.movementSpeed += UpgradeBus.instance.cfg.MOVEMENT_SPEED_UNLOCK;
			}
			float num = 0f;
			for (int i = 1; i < UpgradeBus.instance.runningLevel + 1; i++)
			{
				if (i > currentLevel)
				{
					logger.LogDebug($"Adding {UpgradeBus.instance.cfg.MOVEMENT_INCREMENT} to the player's movement speed...");
					num += UpgradeBus.instance.cfg.MOVEMENT_INCREMENT;
				}
			}
			logger.LogDebug($"Adding player's movement speed ({localPlayer.movementSpeed}) with {num}");
			localPlayer.movementSpeed += num;
			active = true;
			currentLevel = UpgradeBus.instance.runningLevel;
		}

		public static void ResetRunningShoesBuff(ref PlayerControllerB player)
		{
			float num = UpgradeBus.instance.cfg.MOVEMENT_SPEED_UNLOCK;
			for (int i = 0; i < UpgradeBus.instance.runningLevel; i++)
			{
				num += UpgradeBus.instance.cfg.MOVEMENT_INCREMENT;
			}
			logger.LogDebug($"Removing {player.playerUsername}'s movement speed boost ({player.movementSpeed}) with a boost of {num}");
			PlayerControllerB obj = player;
			obj.movementSpeed -= num;
			logger.LogDebug("Upgrade reset on " + player.playerUsername);
			active = false;
		}

		public static float ApplyPossibleReducedNoiseRange(float defaultValue)
		{
			if (!UpgradeBus.instance.runningShoes || UpgradeBus.instance.runningLevel != UpgradeBus.instance.cfg.RUNNING_SHOES_UPGRADE_PRICES.Split(',').Length)
			{
				return defaultValue;
			}
			return Mathf.Clamp(defaultValue - UpgradeBus.instance.cfg.NOISE_REDUCTION, 0f, defaultValue);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "runningShoeScript";
		}
	}
	internal class strongerScannerScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Better Scanner";

		private static LGULogger logger;

		private void Awake()
		{
			logger = new LGULogger(UPGRADE_NAME);
		}

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		public override void Increment()
		{
			UpgradeBus.instance.scanLevel++;
		}

		public override void load()
		{
			base.load();
			UpgradeBus.instance.scannerUpgrade = true;
		}

		public override void Unwind()
		{
			base.Unwind();
			UpgradeBus.instance.scannerUpgrade = false;
			UpgradeBus.instance.scanLevel = 0;
		}

		public override void Register()
		{
			base.Register();
		}

		public static void AddScannerNodeToValve(ref SteamValveHazard steamValveHazard)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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)
			if (UpgradeBus.instance.scannerUpgrade)
			{
				logger.LogDebug("Inserting a Scan Node on a broken steam valve...");
				GameObject val = Object.Instantiate<GameObject>(GameObject.Find("ScanNode"), ((Component)steamValveHazard).transform.position, Quaternion.Euler(Vector3.zero), ((Component)steamValveHazard).transform);
				ScanNodeProperties component = val.GetComponent<ScanNodeProperties>();
				component.headerText = "Bursted Steam Valve";
				component.subText = "Fix it to get rid of the steam";
				component.nodeType = 0;
				component.creatureScanID = -1;
			}
		}

		public static void RemoveScannerNodeFromValve(ref SteamValveHazard steamValveHazard)
		{
			logger.LogDebug("Removing the Scan Node from a fixed steam valve...");
			Object.Destroy((Object)(object)((Component)steamValveHazard).gameObject.GetComponentInChildren<ScanNodeProperties>());
		}

		public static string GetBetterScannerInfo(int level, int price)
		{
			switch (level)
			{
			case 1:
				return string.Format(AssetBundleHandler.GetInfoFromJSON("Better Scanner1"), level, price, UpgradeBus.instance.cfg.NODE_DISTANCE_INCREASE, UpgradeBus.instance.cfg.SHIP_AND_ENTRANCE_DISTANCE_INCREASE);
			case 2:
				return string.Format(AssetBundleHandler.GetInfoFromJSON("Better Scanner2"), level, price);
			case 3:
			{
				string text = string.Format(AssetBundleHandler.GetInfoFromJSON("Better Scanner3"), level, price, UpgradeBus.instance.cfg.BETTER_SCANNER_ENEMIES ? " and enemies" : "");
				return text + "hives and scrap command display the location of the most valuable hives and scrap on the map.\n";
			}
			default:
				return "";
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "strongerScannerScript";
		}
	}
	internal class strongLegsScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Strong Legs";

		private static LGULogger logger;

		public static string PRICES_DEFAULT = "150,190,250";

		private int currentLevel = 0;

		private static bool active = false;

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			logger = new LGULogger(UPGRADE_NAME);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		public override void Increment()
		{
			PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer();
			localPlayer.jumpForce += UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT;
			UpgradeBus.instance.legLevel++;
			currentLevel++;
		}

		public override void Unwind()
		{
			base.Unwind();
			PlayerControllerB player = UpgradeBus.instance.GetLocalPlayer();
			logger.LogDebug($"Adding {UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT} to the player's jump force...");
			if (UpgradeBus.instance.strongLegs)
			{
				ResetStrongLegsBuff(ref player);
			}
			UpgradeBus.instance.strongLegs = false;
			UpgradeBus.instance.legLevel = 0;
			active = false;
			currentLevel = 0;
		}

		public override void Register()
		{
			base.Register();
		}

		public override void load()
		{
			base.load();
			UpgradeBus.instance.strongLegs = true;
			PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer();
			if (!active)
			{
				logger.LogDebug($"Adding {UpgradeBus.instance.cfg.JUMP_FORCE_UNLOCK} to the player's jump force...");
				localPlayer.jumpForce += UpgradeBus.instance.cfg.JUMP_FORCE_UNLOCK;
			}
			float num = 0f;
			for (int i = 1; i < UpgradeBus.instance.legLevel + 1; i++)
			{
				if (i > currentLevel)
				{
					logger.LogDebug($"Adding {UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT} to the player's jump force...");
					num += UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT;
				}
			}
			localPlayer.jumpForce += num;
			active = true;
			currentLevel = UpgradeBus.instance.legLevel;
		}

		public static void ResetStrongLegsBuff(ref PlayerControllerB player)
		{
			float num = UpgradeBus.instance.cfg.JUMP_FORCE_UNLOCK;
			for (int i = 0; i < UpgradeBus.instance.legLevel; i++)
			{
				num += UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT;
			}
			logger.LogDebug($"Removing {player.playerUsername}'s jump force boost ({player.jumpForce}) with a boost of {num}");
			PlayerControllerB obj = player;
			obj.jumpForce -= num;
			logger.LogDebug("Upgrade reset on " + player.playerUsername);
			active = false;
		}

		public static int ReduceFallDamage(int defaultValue)
		{
			if (!UpgradeBus.instance.strongLegs || UpgradeBus.instance.legLevel != UpgradeBus.instance.cfg.STRONG_LEGS_UPGRADE_PRICES.Split(',').Length)
			{
				return defaultValue;
			}
			return (int)((float)defaultValue * (1f - UpgradeBus.instance.cfg.STRONG_LEGS_REDUCE_FALL_DAMAGE_MULTIPLIER));
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "strongLegsScript";
		}
	}
	public class terminalFlashScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Discombobulator";

		public static string PRICES_DEFAULT = "330,460,620";

		private static LGULogger logger = new LGULogger("terminalFlashScript");

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		private void Update()
		{
			if (UpgradeBus.instance.flashCooldown > 0f)
			{
				UpgradeBus.instance.flashCooldown -= Time.deltaTime;
			}
		}

		public override void load()
		{
			UpgradeBus.instance.terminalFlash = true;
			UpgradeBus.instance.flashScript = this;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Discombobulator is active!\nType 'cooldown' into the terminal for info!!!</color>";
		}

		public override void Register()
		{
			base.Register();
		}

		public override void Increment()
		{
			UpgradeBus.instance.discoLevel++;
		}

		public override void Unwind()
		{
			base.Unwind();
			UpgradeBus.instance.terminalFlash = false;
			UpgradeBus.instance.discoLevel = 0;
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlayAudioAndUpdateCooldownServerRpc()
		{
			//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(418065963u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 418065963u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayAudioAndUpdateCooldownClientRpc();
				}
			}
		}

		[ClientRpc]
		private void PlayAudioAndUpdateCooldownClientRpc()
		{
			//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_011b: 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(524331225u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 524331225u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Terminal terminal = UpgradeBus.instance.GetTerminal();
			terminal.terminalAudio.maxDistance = 100f;
			terminal.terminalAudio.PlayOneShot(UpgradeBus.instance.flashNoise);
			((MonoBehaviour)this).StartCoroutine(ResetRange(terminal));
			UpgradeBus.instance.flashCooldown = UpgradeBus.instance.cfg.DISCOMBOBULATOR_COOLDOWN;
			Collider[] array = Physics.OverlapSphere(((Component)terminal).transform.position, UpgradeBus.instance.cfg.DISCOMBOBULATOR_RADIUS, 524288);
			if (array.Length == 0)
			{
				return;
			}
			for (int i = 0; i < array.Length; i++)
			{
				EnemyAICollisionDetect component = ((Component)array[i]).GetComponent<EnemyAICollisionDetect>();
				if (!((Object)(object)component == (Object)null))
				{
					EnemyAI mainScript = component.mainScript;
					if (CanDealDamage())
					{
						int num = UpgradeBus.instance.cfg.DISCOMBOBULATOR_INITIAL_DAMAGE + UpgradeBus.instance.cfg.DISCOMBOBULATOR_DAMAGE_INCREASE * (UpgradeBus.instance.discoLevel - UpgradeBus.instance.cfg.DISCOMBOBULATOR_DAMAGE_LEVEL);
						mainScript.HitEnemy(num, (PlayerControllerB)null, false);
					}
					if (!mainScript.isEnemyDead)
					{
						mainScript.SetEnemyStunned(true, UpgradeBus.instance.cfg.DISCOMBOBULATOR_STUN_DURATION + UpgradeBus.instance.cfg.DISCOMBOBULATOR_INCREMENT * (float)UpgradeBus.instance.discoLevel, (PlayerControllerB)null);
					}
				}
			}
		}

		private bool CanDealDamage()
		{
			return UpgradeBus.instance.cfg.DISCOMBOBULATOR_DAMAGE_LEVEL > 0 && UpgradeBus.instance.discoLevel + 1 >= UpgradeBus.instance.cfg.DISCOMBOBULATOR_DAMAGE_LEVEL;
		}

		private IEnumerator ResetRange(Terminal terminal)
		{
			yield return (object)new WaitForSeconds(2f);
			terminal.terminalAudio.maxDistance = 17f;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

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

		private static void __rpc_handler_418065963(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;
				((terminalFlashScript)(object)target).PlayAudioAndUpdateCooldownServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_524331225(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;
				((terminalFlashScript)(object)target).PlayAudioAndUpdateCooldownClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "terminalFlashScript";
		}
	}
}
namespace MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades
{
	public class BeatScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Sick Beats";

		private static LGULogger logger = new LGULogger(UPGRADE_NAME);

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
			UpgradeBus.instance.BoomboxIcon = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).gameObject;
		}

		public override void load()
		{
			base.load();
			UpgradeBus.instance.sickBeats = true;
		}

		public override void Register()
		{
			base.Register();
		}

		public override void Unwind()
		{
			base.Unwind();
			UpgradeBus.instance.sickBeats = false;
		}

		public static void HandlePlayerEffects(PlayerControllerB player)
		{
			UpgradeBus.instance.BoomboxIcon.SetActive(UpgradeBus.instance.EffectsActive);
			if (UpgradeBus.instance.EffectsActive)
			{
				logger.LogDebug("Applying effects!");
				logger.LogDebug($"Updating player's movement speed ({player.movementSpeed})");
				if (UpgradeBus.instance.cfg.BEATS_SPEED)
				{
					player.movementSpeed += UpgradeBus.instance.cfg.BEATS_SPEED_INC;
				}
				logger.LogDebug($"Updated player's movement speed ({player.movementSpeed})");
				if (UpgradeBus.instance.cfg.BEATS_STAMINA)
				{
					UpgradeBus.instance.staminaDrainCoefficient = UpgradeBus.instance.cfg.BEATS_STAMINA_CO;
				}
				if (UpgradeBus.instance.cfg.BEATS_DEF)
				{
					UpgradeBus.instance.incomingDamageCoefficient = UpgradeBus.instance.cfg.BEATS_DEF_CO;
				}
				if (UpgradeBus.instance.cfg.BEATS_DMG)
				{
					UpgradeBus.instance.damageBoost = UpgradeBus.instance.cfg.BEATS_DMG_INC;
				}
			}
			else
			{
				logger.LogDebug("Removing effects!");
				logger.LogDebug($"Updating player's movement speed ({player.movementSpeed})");
				if (UpgradeBus.instance.cfg.BEATS_SPEED)
				{
					player.movementSpeed -= UpgradeBus.instance.cfg.BEATS_SPEED_INC;
				}
				logger.LogDebug($"Updated player's movement speed ({player.movementSpeed})");
				UpgradeBus.instance.staminaDrainCoefficient = 1f;
				UpgradeBus.instance.incomingDamageCoefficient = 1f;
				UpgradeBus.instance.damageBoost = 0;
			}
		}

		public static int CalculateDefense(int dmg)
		{
			if (!UpgradeBus.instance.sickBeats || dmg < 0)
			{
				return dmg;
			}
			return (int)((float)dmg * UpgradeBus.instance.incomingDamageCoefficient);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "BeatScript";
		}
	}
	internal class lightningRodScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Lightning Rod";

		public static lightningRodScript instance;

		private static LGULogger logger;

		public static string ENABLED_SECTION = "Enable " + UPGRADE_NAME + " Upgrade";

		public static bool ENABLED_DEFAULT = true;

		public static string ENABLED_DESCRIPTION = "A device which redirects lightning bolts to the ship.";

		public static string PRICE_SECTION = UPGRADE_NAME + " Price";

		public static int PRICE_DEFAULT = 1000;

		public static string ACTIVE_SECTION = "Active on Purchase";

		public static bool ACTIVE_DEFAULT = true;

		public static string ACTIVE_DESCRIPTION = "If true: " + UPGRADE_NAME + " will be active on purchase.";

		private static string LOAD_COLOUR = "#FF0000";

		private static string LOAD_MESSAGE = "\n<color=" + LOAD_COLOUR + ">" + UPGRADE_NAME + " is active!</color>";

		private static string UNLOAD_COLOUR = LOAD_COLOUR;

		private static string UNLOAD_MESSAGE = "\n<color=" + UNLOAD_COLOUR + ">" + UPGRADE_NAME + " has been disabled</color>";

		public static string ACCESS_DENIED_MESSAGE = "You don't have access to this command yet. Purchase the '" + UPGRADE_NAME + "'.\n";

		public static string TOGGLE_ON_MESSAGE = UPGRADE_NAME + " has been enabled. Lightning bolts will now be redirected to the ship.\n";

		public static string TOGGLE_OFF_MESSAGE = UPGRADE_NAME + " has been disabled. Lightning bolts will no longer be redirected to the ship.\n";

		public static string DIST_SECTION = "Effective Distance of " + UPGRADE_NAME + ".";

		public static float DIST_DEFAULT = 175f;

		public static string DIST_DESCRIPTION = "The closer you are the more likely the rod will reroute lightning.";

		public bool CanTryInterceptLightning { get; internal set; }

		public bool LightningIntercepted { get; internal set; }

		private void Awake()
		{
			instance = this;
			logger = new LGULogger(UPGRADE_NAME);
		}

		private void Start()
		{
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			UpgradeBus.instance.UpgradeObjects.Add(UPGRADE_NAME, ((Component)this).gameObject);
		}

		public override void Increment()
		{
		}

		public override void load()
		{
			UpgradeBus.instance.lightningRod = true;
			UpgradeBus.instance.lightningRodActive = UpgradeBus.instance.cfg.LIGHTNING_ROD_ACTIVE;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + LOAD_MESSAGE;
		}

		public override void Register()
		{
			if (!UpgradeBus.instance.UpgradeObjects.ContainsKey(UPGRADE_NAME))
			{
				UpgradeBus.instance.UpgradeObjects.Add(UPGRADE_NAME, ((Component)this).gameObject);
			}
		}

		public override void Unwind()
		{
			UpgradeBus.instance.lightningRod = false;
			UpgradeBus.instance.lightningRodActive = false;
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + UNLOAD_MESSAGE;
		}

		public static void TryInterceptLightning(ref StormyWeather __instance, ref GrabbableObject ___targetingMetalObject)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (!instance.CanTryInterceptLightning)
			{
				return;
			}
			instance.CanTryInterceptLightning = false;
			Terminal terminal = UpgradeBus.instance.GetTerminal();
			float num = Vector3.Distance(((Component)___targetingMetalObject).transform.position, ((Component)terminal).transform.position);
			logger.LogDebug($"Distance from ship: {num}");
			logger.LogDebug($"Effective distance of the lightning rod: {UpgradeBus.instance.cfg.LIGHTNING_ROD_DIST}");
			if (!(num > UpgradeBus.instance.cfg.LIGHTNING_ROD_DIST))
			{
				num /= UpgradeBus.instance.cfg.LIGHTNING_ROD_DIST;
				float num2 = 1f - num;
				float value = Random.value;
				logger.LogDebug($"Number to beat: {num2}");
				logger.LogDebug($"Number: {value}");
				if (value < num2)
				{
					logger.LogDebug("Planning interception...");
					__instance.staticElectricityParticle.Stop();
					instance.LightningIntercepted = true;
					LGUStore.instance.CoordinateInterceptionClientRpc();
				}
			}
		}

		public static void RerouteLightningBolt(ref Vector3 strikePosition, ref StormyWeather __instance)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			logger.LogDebug("Intercepted Lightning Strike...");
			Terminal terminal = UpgradeBus.instance.GetTerminal();
			strikePosition = ((Component)terminal).transform.position;
			instance.LightningIntercepted = false;
			((Component)__instance.staticElectricityParticle).gameObject.SetActive(true);
		}

		public static void ToggleLightningRod(ref TerminalNode __result)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			UpgradeBus.instance.lightningRodActive = !UpgradeBus.instance.lightningRodActive;
			TerminalNode val = new TerminalNode();
			val.displayText = (UpgradeBus.instance.lightningRodActive ? TOGGLE_ON_MESSAGE : TOGGLE_OFF_MESSAGE);
			val.clearPreviousText = true;
			__result = val;
		}

		public static void AccessDeniedMessage(ref TerminalNode __result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			TerminalNode val = new TerminalNode();
			val.displayText = ACCESS_DENIED_MESSAGE;
			val.clearPreviousText = true;
			__result = val;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "lightningRodScript";
		}
	}
	public class lockSmithScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Locksmith";

		private GameObject pin1;

		private GameObject pin2;

		private GameObject pin3;

		private GameObject pin4;

		private GameObject pin5;

		private List<GameObject> pins;

		private List<int> order = new List<int> { 0, 1, 2, 3, 4 };

		private int currentPin = 0;

		public DoorLock currentDoor = null;

		private bool canPick = false;

		public int timesStruck;

		private void Start()
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected O, but got Unknown
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			upgradeName = UPGRADE_NAME;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
			Transform child = ((Component)this).transform.GetChild(0).GetChild(0).GetChild(0);
			pin1 = ((Component)child.GetChild(0)).gameObject;
			pin2 = ((Component)child.GetChild(1)).gameObject;
			pin3 = ((Component)child.GetChild(2)).gameObject;
			pin4 = ((Component)child.GetChild(3)).gameObject;
			pin5 = ((Component)child.GetChild(4)).gameObject;
			((UnityEvent)((Component)pin1.transform.GetChild(0)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				StrikePin(0);
			});
			((UnityEvent)((Component)pin2.transform.GetChild(0)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				StrikePin(1);
			});
			((UnityEvent)((Component)pin3.transform.GetChild(0)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				StrikePin(2);
			});
			((UnityEvent)((Component)pin4.transform.GetChild(0)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				StrikePin(3);
			});
			((UnityEvent)((Component)pin5.transform.GetChild(0)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				StrikePin(4);
			});
			pins = new List<GameObject> { pin1, pin2, pin3, pin4, pin5 };
		}

		public override void load()
		{
			base.load();
			UpgradeBus.instance.lockSmith = true;
			UpgradeBus.instance.lockScript = this;
		}

		public override void Register()
		{
			base.Register();
		}

		private void Update()
		{
			if (((ButtonControl)Keyboard.current[(Key)60]).wasPressedThisFrame && ((Component)((Component)this).transform.GetChild(0)).gameObject.activeInHierarchy)
			{
				((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
				Cursor.visible = false;
				Cursor.lockState = (CursorLockMode)1;
			}
		}

		public void BeginLockPick()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(true);
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)0;
			canPick = false;
			currentPin = 0;
			for (int i = 0; i < pins.Count; i++)
			{
				float num = Random.Range(40f, 90f);
				pins[i].transform.localPosition = new Vector3(pins[i].transform.localPosition.x, num, pins[i].transform.localPosition.z);
			}
			RandomizeListOrder(order);
			((MonoBehaviour)this).StartCoroutine(CommunicateOrder(order));
		}

		public override void Unwind()
		{
			base.Unwind();
			UpgradeBus.instance.lockSmith = false;
		}

		public void StrikePin(int i)
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			if (!canPick)
			{
				return;
			}
			timesStruck++;
			if (i != order[currentPin])
			{
				BeginLockPick();
				RoundManager.Instance.PlayAudibleNoise(((Component)currentDoor).transform.position, 30f, 0.65f, timesStruck, false, 0);
				return;
			}
			currentPin++;
			pins[i].transform.localPosition = new Vector3(pins[i].transform.localPosition.x, 35f, pins[i].transform.localPosition.z);
			if (currentPin == 5)
			{
				Cursor.visible = false;
				Cursor.lockState = (CursorLockMode)1;
				((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
				currentDoor.UnlockDoorSyncWithServer();
			}
			RoundManager.Instance.PlayAudibleNoise(((Component)currentDoor).transform.position, 10f, 0.65f, timesStruck, false, 0);
		}

		private void RandomizeListOrder<T>(List<T> list)
		{
			int num = list.Count;
			Random random = new Random();
			while (num > 1)
			{
				num--;
				int index = random.Next(num + 1);
				T value = list[index];
				list[index] = list[num];
				list[num] = value;
			}
		}

		private IEnumerator CommunicateOrder(List<int> lst)
		{
			yield return (object)new WaitForSeconds(0.75f);
			for (int i = 0; i < lst.Count; i++)
			{
				((Graphic)pins[lst[i]].GetComponent<Image>()).color = Color.green;
				yield return (object)new WaitForSeconds(0.25f);
				((Graphic)pins[lst[i]].GetComponent<Image>()).color = Color.white;
			}
			canPick = true;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "lockSmithScript";
		}
	}
	public class pagerScript : BaseUpgrade
	{
		public static string UPGRADE_NAME = "Fast Encryption";

		private static LGULogger logger;

		private void Start()
		{
			upgradeName = UPGRADE_NAME;
			logger = new LGULogger(upgradeName);
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Register();
		}

		public override void load()
		{
			base.load();
			UpgradeBus.instance.pager = true;
			UpgradeBus.instance.pageScript = this;
		}

		public override void Register()
		{
			base.Register();
		}

		[ServerRpc(RequireOwnership = false)]
		public void ReqBroadcastChatServerRpc(string msg)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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(3873629904u, val, (RpcDelivery)0);
				bool flag = msg != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(msg, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3873629904u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				logger.LogInfo("Instructing clients to print broadcasted message...");
				ReceiveChatClientRpc(msg);
			}
		}

		[ClientRpc]
		public void ReceiveChatClientRpc(string msg)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00