Decompiled source of LethalMystery v0.4.1

zeeblo.LethalMystery.dll

Decompiled a day 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.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalMystery.MainGame;
using LethalMystery.Maps;
using LethalMystery.Maps.Sabotages;
using LethalMystery.Network;
using LethalMystery.Patches;
using LethalMystery.Players;
using LethalMystery.Players.Abilities;
using LethalMystery.UI;
using LethalMystery.Utils;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
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: AssemblyCompany("zeeblo.LethalMystery")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.4.1.0")]
[assembly: AssemblyInformationalVersion("0.4.1+70c30e930de268e2d059d04fb9f93369a2fcdcc8")]
[assembly: AssemblyProduct("LethalMystery")]
[assembly: AssemblyTitle("zeeblo.LethalMystery")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.1.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 LethalMystery
{
	public class Commands
	{
		public static readonly Dictionary<string, string> HelpCmds = new Dictionary<string, string> { { "vote", "/vote playerID - use in a meeting to vote a specific user. To see everyone's playerID type /ids \n /vote skip - use in a meeting to skip votting" } };

		public static GrabbableObject? randomObject;

		public static ShotgunItem? gunObject;

		internal static string? msgtitle;

		internal static string? msgbody;

		internal static string NetCommandPrefix = "<size=0>LCMD:";

		internal static string NetHostCommandPrefix = "<size=0>LMCMD:";

		internal static string NetCommandPostfix = "</size>";

		internal static string? playerwhocalled;

		internal static bool NonHostCommands(string command)
		{
			bool result = true;
			string[] array = command.Split(' ');
			int num = array.Length;
			if (num > 1)
			{
				foreach (KeyValuePair<string, string> helpCmd in HelpCmds)
				{
					if (command.StartsWith("help") && array[1].ToLower().Contains(helpCmd.Key))
					{
						msgtitle = helpCmd.Key;
						msgbody = helpCmd.Value;
						DisplayChatMessage("<color=#FF00FF>" + msgtitle + "</color>\n" + msgbody);
						return result;
					}
				}
				string text = array[0];
				string text2 = text;
				if (text2 == "vote")
				{
					SetVote(array[1]);
				}
				else
				{
					result = false;
				}
				return result;
			}
			switch (command)
			{
			case "help":
				GetHelp();
				break;
			case "hosthelp":
				GetHostHelp();
				break;
			case "ids":
				GetPlayerIDs();
				break;
			case "role":
				GetRole();
				break;
			case "clear":
				ClearChat();
				break;
			default:
				result = false;
				break;
			}
			return result;
		}

		internal static void ProcessCommandInput(string command)
		{
			msgtitle = "default";
			msgbody = "<color=#FF0000>ERR</color>: unknown";
			string[] array = command.Split(' ');
			if (NonHostCommands(command))
			{
				return;
			}
			if (!Plugin.isHost)
			{
				msgtitle = "Command";
				msgbody = "Unable to send command since you are not host.";
				return;
			}
			string text = array[0];
			string text2 = text;
			if (text2 == "set")
			{
				SetCommands(array, array.Length);
			}
		}

		internal static void SendHostCommand(string commandInput)
		{
			if (Plugin.isHost)
			{
				string text = NetHostCommandPrefix + commandInput + NetCommandPostfix;
				HUDManager.Instance.AddTextToChatOnServer(text, -1);
			}
		}

		public static void ProcessNetHostCommand(string commandInput)
		{
		}

		public static void ProcessCommand(string commandInput)
		{
			ProcessCommandInput(commandInput);
		}

		public static void DisplayChatMessage(string chatMessage)
		{
			string item = "<color=#FFFF00>" + chatMessage + "</color>";
			HUDManager.Instance.ChatMessageHistory.Add(item);
			UpdateChatText();
		}

		public static void DisplayChatError(string errorMessage)
		{
			string item = "<color=#FF0000>ERROR</color>: <color=#FF0000>" + errorMessage + "</color>";
			HUDManager.Instance.ChatMessageHistory.Add(item);
			UpdateChatText();
		}

		private static void UpdateChatText()
		{
			((TMP_Text)HUDManager.Instance.chatText).text = string.Join("\n", HUDManager.Instance.ChatMessageHistory);
		}

		public static string GetHelp()
		{
			msgtitle = "Available Commands:";
			msgbody = Data.GetInfo("help");
			DisplayChatMessage("<color=#FF00FF>" + msgtitle + "</color>\n" + msgbody);
			return msgbody + "/" + msgtitle;
		}

		public static string GetHostHelp()
		{
			msgtitle = "Host Commands:";
			msgbody = Data.GetInfo("hosthelp");
			DisplayChatMessage("<color=#FF00FF>" + msgtitle + "</color>\n" + msgbody);
			return msgbody + "/" + msgtitle;
		}

		public static string GetRole()
		{
			msgtitle = "Role:";
			msgbody = "You currently have no role.";
			if (Roles.CurrentRole != null)
			{
				msgbody = Roles.CurrentRole.Name + ": " + Roles.CurrentRole.Desc;
			}
			DisplayChatMessage("<color=#FF00FF>" + msgtitle + "</color>\n" + msgbody);
			return msgbody + "/" + msgtitle;
		}

		public static string GetPlayerIDs()
		{
			string text = "";
			foreach (KeyValuePair<ulong, int> clientPlayer in StartOfRound.Instance.ClientPlayerList)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[clientPlayer.Key]];
				text += $"{val.playerUsername} || ID: {val.playerClientId}\n";
			}
			msgtitle = "IDs:";
			msgbody = text;
			DisplayChatMessage("<color=#FF00FF>" + msgtitle + "</color>\n" + msgbody);
			return msgbody + "/" + msgtitle;
		}

		public static string SetVote(string vote)
		{
			msgtitle = "Vote:";
			if (GameNetworkManager.Instance.localPlayerController.playersManager.inShipPhase)
			{
				msgbody = "You can only vote in a meeting.";
			}
			else if (vote.ToLower() == "skip")
			{
				msgbody = "You voted to skip!";
			}
			else
			{
				if (!ulong.TryParse(vote, out var result) || !StartOfRound.Instance.ClientPlayerList.Keys.Contains(result))
				{
					msgbody = "Invalid. Type \"/ids\" to see the available IDs \n Type \"/help vote\" to properly use this command";
					DisplayChatError("<color=#FF00FF>" + msgtitle + "</color>\n" + msgbody);
					return msgbody + "/" + msgtitle;
				}
				result = ulong.Parse(vote);
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val in allPlayerScripts)
				{
					if (val.playerClientId == result)
					{
						msgbody = "You voted " + val.playerUsername + " (ID: " + result + ")";
					}
				}
			}
			DisplayChatMessage("<color=#FF00FF>" + msgtitle + "</color>\n" + msgbody);
			return msgbody + "/" + msgtitle;
		}

		private static void SetCommands(string[] command, int args)
		{
			switch (args)
			{
			case 1:
				DisplayChatMessage("You need to specify a set command.");
				break;
			case 3:
				SetRoleAmount(command[1], command[2]);
				break;
			}
		}

		public static void SetRoleAmount(string role, string num)
		{
			if (!Roles.specialRoleAmount.ContainsKey(role))
			{
				DisplayChatError("Invalid Command");
				Plugin.mls.LogInfo((object)(">>> role: " + role + " | num: " + num + " "));
			}
			else
			{
				int num2 = StringAddons.ConvertToInt(num);
				int num3 = ((num2 != 0 && num2 != 1 && num2 != 2) ? 1 : num2);
				Roles.specialRoleAmount[role] = num3;
				DisplayChatMessage($"Set {role} amount to {num3}");
			}
		}

		public static void ClearChat()
		{
			HUDManager.Instance.ChatMessageHistory.Clear();
			UpdateChatText();
		}

		public static void SpawnScrapFunc(string toSpawn, bool toInventory = false)
		{
			//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_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)
			//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_00c2: 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_00cc: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)CustomLvl.CurrentInside == (Object)null)
			{
				return;
			}
			Vector3 zero = Vector3.zero;
			zero = CalculateSpawnPosition();
			if (!((Object)(object)Plugin.currentRound != (Object)null))
			{
				return;
			}
			int num = Plugin.currentRound.currentLevel.spawnableScrap.Count();
			bool flag = false;
			for (int i = 0; i < num; i++)
			{
				Item spawnableItem = Plugin.currentRound.currentLevel.spawnableScrap[i].spawnableItem;
				if (((Object)spawnableItem.spawnPrefab).name.ToLower().Contains(toSpawn.ToLower()))
				{
					GameObject spawnPrefab = spawnableItem.spawnPrefab;
					GameObject val = Object.Instantiate<GameObject>(spawnPrefab, zero, Quaternion.identity, Plugin.currentRound.spawnedScrapContainer);
					GrabbableObject component = val.GetComponent<GrabbableObject>();
					component.startFallingPosition = zero;
					component.targetFloorPosition = component.GetItemFloorPosition(zero);
					component.SetScrapValue(10);
					((NetworkBehaviour)component).NetworkObject.Spawn(false);
					flag = true;
					if (toInventory)
					{
						randomObject = component;
					}
					break;
				}
			}
			if (flag)
			{
			}
		}

		private static Vector3 CalculateSpawnPosition()
		{
			//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_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_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_0031: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			Random random = new Random();
			int index = random.Next(0, InsideMap.scrapLocations.ToArray().Length);
			return InsideMap.scrapLocations[index];
		}

		public static void SpawnWeapons(string name)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(12f, -60f, 15f);
			SelectableLevel val2 = RoundManager.Instance.playersManager.levels[6];
			if (name.ToLower().Contains("knife") || name == "all")
			{
				Object.Instantiate<GameObject>(val2.Enemies[11].enemyType.enemyPrefab, val, Quaternion.identity).gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
			}
			if (name.ToLower().Contains("shotgun") || name == "all")
			{
				Object.Instantiate<GameObject>(val2.Enemies[9].enemyType.enemyPrefab, val, Quaternion.identity).gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
			}
		}

		public static void SpawnBaby()
		{
			//IL_000d: 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_003b: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(((Component)Plugin.localPlayer).transform.position.x, ((Component)Plugin.localPlayer).transform.position.y + 4f, ((Component)Plugin.localPlayer).transform.position.z);
			SelectableLevel[] levels = RoundManager.Instance.playersManager.levels;
			for (int i = 0; i < levels.Length; i++)
			{
				foreach (SpawnableEnemyWithRarity enemy in levels[i].Enemies)
				{
					if (enemy.enemyType.enemyName.Contains("Maneater"))
					{
						Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, val, Quaternion.identity).gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
					}
				}
			}
		}
	}
	[BepInPlugin("LethalMystery.zeeblo.dev", "zeeblo.LethalMystery", "0.4.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "LethalMystery.zeeblo.dev";

		public const string modName = "zeeblo.LethalMystery";

		public const string modVersion = "0.4.1";

		private readonly Harmony _harmony = new Harmony("LethalMystery.zeeblo.dev");

		public static Plugin? instance;

		public static string MainDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace("file:\\", "");

		internal static ManualLogSource mls = Logger.CreateLogSource("LethalMystery.zeeblo.dev");

		public static bool inTestMode = true;

		internal static SelectableLevel? currentLevel;

		internal static EnemyVent[]? currentLevelVents;

		internal static RoundManager? currentRound;

		internal static bool isHost;

		public static GameObject shipInstance;

		public static GameObject? sidebar;

		public static TextMeshProUGUI? sidebarHeaderText;

		public static TextMeshProUGUI? sidebarBodyText;

		public static PlayerControllerB localPlayer;

		public static Terminal terminal;

		public static EnemyVent enemyVent;

		public static string firedText = "Ejected";

		public static string firedTextSub = "";

		public static ulong localID;

		public static NetHandler netHandler { get; set; }

		private void Awake()
		{
			netHandler = new NetHandler();
			LMConfig.AllConfigs(((BaseUnityPlugin)this).Config);
			PatchAllStuff();
			LMAssets.LoadAllAssets();
			Roles.AppendRoles();
			Controls.InitControls();
		}

		private void PatchAllStuff()
		{
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
		}

		public static void ResetVariables()
		{
			if ((Object)(object)HUDManager.Instance != (Object)null)
			{
				((Behaviour)HUDManager.Instance.loadingText).enabled = false;
			}
			if ((Object)(object)VotingUI.votingGUI != (Object)null)
			{
				Object.Destroy((Object)(object)VotingUI.votingGUI.gameObject);
			}
			UnlockableSuitPatch.ResetVars();
			Meeting.MeetingDefaults();
			Roles.ResetVariables();
			CharacterDisplay.ResetVariables();
			Tasks.ResetVariables();
			AutoGiveItem.ResetVariables();
			EjectPlayers.ResetVars();
			Ability.ResetVars();
			Controls.ResetVars();
			Start.ResetVars();
			Sabotage.ResetVars();
			InsideMap.ResetVars();
		}

		public static void RemoveEnvironment(bool value = true)
		{
			//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)
			GameObject obj = GameObject.Find("OutOfBoundsTerrain");
			if (obj != null)
			{
				GameObject gameObject = obj.gameObject;
				if (gameObject != null)
				{
					gameObject.SetActive(!value);
				}
			}
			Scene sceneAt = SceneManager.GetSceneAt(1);
			GameObject[] rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects();
			foreach (GameObject val in rootGameObjects)
			{
				if (((Object)val).name == "Environment")
				{
					val.SetActive(!value);
					break;
				}
			}
		}

		public static void DespawnEnemies()
		{
			//IL_0010: 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)
			if (!isHost)
			{
				return;
			}
			Scene sceneAt = SceneManager.GetSceneAt(0);
			GameObject[] rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects();
			foreach (GameObject val in rootGameObjects)
			{
				if (((Object)val).name.Contains("Nutcracker"))
				{
					Object.Destroy((Object)(object)val.gameObject);
				}
				if (((Object)val).name.Contains("Butler"))
				{
					Object.Destroy((Object)(object)val.gameObject);
				}
			}
		}

		public static bool FoundThisMod(string modID)
		{
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				BepInPlugin metadata = pluginInfo.Value.Metadata;
				if (metadata.GUID.Equals(modID))
				{
					return true;
				}
			}
			return false;
		}

		public static string GetAssetPath(string file, string parent = "Assetbundles")
		{
			string text = MainDir + "\\Assets\\" + parent + "\\" + file;
			string result = MainDir + "/" + file;
			if (File.Exists(text))
			{
				return text;
			}
			return result;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "zeeblo.LethalMystery";

		public const string PLUGIN_NAME = "LethalMystery";

		public const string PLUGIN_VERSION = "0.4.1";
	}
}
namespace LethalMystery.Utils
{
	public class Data
	{
		private class CMDInfo
		{
			public List<string>? help { get; set; }

			public List<string>? hosthelp { get; set; }
		}

		public static string GetInfo(string key)
		{
			string assetPath = Plugin.GetAssetPath("info.json", "data");
			string text = File.ReadAllText(assetPath);
			CMDInfo cMDInfo = JsonConvert.DeserializeObject<CMDInfo>(text);
			string text2 = "";
			string newValue = ((LMConfig.PrefixSetting != null) ? LMConfig.PrefixSetting.Value : "/");
			if (cMDInfo == null)
			{
				return text2;
			}
			if (key == "help" && cMDInfo.help != null)
			{
				foreach (string item in cMDInfo.help)
				{
					text2 = text2 + item.Replace("[PX]", newValue) + "\n";
				}
			}
			else if (key == "hosthelp" && cMDInfo.hosthelp != null)
			{
				foreach (string item2 in cMDInfo.hosthelp)
				{
					text2 = text2 + item2.Replace("[PX]", newValue) + "\n";
				}
			}
			return text2;
		}
	}
	public class GOTools
	{
		public static void CheckForWeaponInInventoryNotif()
		{
			if (Roles.CurrentRole != null && (Roles.CurrentRole.Type == Roles.RoleType.monster || Roles.CurrentRole.Name == "sheriff") && !CheckForExistingWeapon())
			{
				Commands.DisplayChatMessage("Press <color=#FF0000>\"" + LMConfig.spawnItemBind.Value.ToUpper() + "\"</color> to spawn and equip your weapon. (this takes a few seconds)");
			}
		}

		public static bool CheckForExistingWeapon()
		{
			for (int i = 0; i < GameNetworkManager.Instance.localPlayerController.ItemSlots.Length; i++)
			{
				if ((Object)(object)GameNetworkManager.Instance.localPlayerController.ItemSlots[i] != (Object)null && (((Object)GameNetworkManager.Instance.localPlayerController.ItemSlots[i]).name.ToLower().Contains("shotgun") || ((Object)GameNetworkManager.Instance.localPlayerController.ItemSlots[i]).name.ToLower().Contains("knife")))
				{
					return true;
				}
			}
			return false;
		}

		public static List<Transform> GetAllChildrenAdvanced(Transform parent, List<Transform> children = null)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if (children == null)
			{
				children = new List<Transform>();
			}
			foreach (Transform item in parent)
			{
				Transform val = item;
				children.Add(val);
				GetAllChildrenAdvanced(val, children);
			}
			return children;
		}

		public static List<GameObject> GetAllChildren(GameObject parent)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			List<GameObject> list = new List<GameObject>();
			foreach (Transform item in parent.transform)
			{
				Transform val = item;
				list.Add(((Component)val).gameObject);
			}
			return list;
		}

		public static void ClearInventory()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			for (int i = 0; i < localPlayerController.ItemSlots.Count(); i++)
			{
				if ((Object)(object)localPlayerController.ItemSlots[i] != (Object)null)
				{
					localPlayerController.DestroyItemInSlotAndSync(i);
					((Behaviour)HUDManager.Instance.itemSlotIcons[i]).enabled = false;
				}
			}
		}

		public static void CleanSlot()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			for (int i = 0; i < localPlayerController.ItemSlots.Count(); i++)
			{
				((Behaviour)HUDManager.Instance.itemSlotIcons[i]).enabled = false;
			}
		}

		public static void RemoveItem(int slot)
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			GrabbableObject val = localPlayerController.ItemSlots[slot];
			localPlayerController.currentlyHeldObjectServer.DiscardItemOnClient();
			localPlayerController.currentlyHeldObjectServer = null;
			localPlayerController.ItemSlots[slot] = null;
		}

		public static int UlongToPlayerID(ulong id)
		{
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.actualClientId == id)
				{
					return (int)val.playerClientId;
				}
			}
			return -1;
		}

		public static GameObject GetObjectPlayerIsLookingAt()
		{
			//IL_0063: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Plugin.localPlayer == (Object)null)
			{
				return Plugin.shipInstance.gameObject;
			}
			Camera gameplayCamera = Plugin.localPlayer.gameplayCamera;
			float grabDistance = Plugin.localPlayer.grabDistance;
			bool twoHanded = Plugin.localPlayer.twoHanded;
			float sinkingValue = Plugin.localPlayer.sinkingValue;
			Transform transform = ((Component)Plugin.localPlayer).transform;
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(((Component)gameplayCamera).transform.position, ((Component)gameplayCamera).transform.forward);
			int num = (int)Traverse.Create((object)GameNetworkManager.Instance.localPlayerController).Field("interactableObjectsMask").GetValue();
			RaycastHit val2 = default(RaycastHit);
			if (!Physics.Raycast(val, ref val2, grabDistance, num) || ((Component)((RaycastHit)(ref val2)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref val2)).collider).tag == "PhysicsProp") || twoHanded || sinkingValue > 0.73f || Physics.Linecast(((Component)gameplayCamera).transform.position, ((Component)((RaycastHit)(ref val2)).collider).transform.position + transform.up * 0.16f, 1073741824, (QueryTriggerInteraction)1))
			{
				if ((Object)(object)((RaycastHit)(ref val2)).collider != (Object)null)
				{
					return ((Component)((Component)((RaycastHit)(ref val2)).collider).transform).gameObject;
				}
				return Plugin.shipInstance.gameObject;
			}
			return ((Component)((Component)((RaycastHit)(ref val2)).collider).transform).gameObject;
		}

		public static void RemoveGameObject(string tag, string name)
		{
			GameObject[] array = GameObject.FindGameObjectsWithTag(tag);
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				string text = name.ToLower().Replace("(clone)", "");
				string text2 = ((Object)val).name.ToLower().Replace("(clone)", "");
				if (text == text2)
				{
					Object.Destroy((Object)(object)val);
				}
			}
		}

		public static void HideEnvironment(bool value, string ignore = "")
		{
			//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)
			GameObject obj = GameObject.Find("OutOfBoundsTerrain");
			if (obj != null)
			{
				GameObject gameObject = obj.gameObject;
				if (gameObject != null)
				{
					gameObject.SetActive(!value);
				}
			}
			Scene sceneAt = SceneManager.GetSceneAt(1);
			GameObject[] rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects();
			foreach (GameObject val in rootGameObjects)
			{
				if (!(((Object)val).name == "Environment"))
				{
					continue;
				}
				foreach (GameObject allChild in GetAllChildren(val))
				{
					if (((Object)allChild).name == ignore)
					{
						allChild.SetActive(value);
					}
					else if (allChild.activeSelf)
					{
						allChild.SetActive(!value);
					}
				}
			}
		}

		public static void HideVanillaDungeon(bool value = true)
		{
			//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)
			Scene sceneAt = SceneManager.GetSceneAt(1);
			GameObject[] rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects();
			foreach (GameObject val in rootGameObjects)
			{
				if (((Object)val).name == "Systems")
				{
					((Component)val.transform.Find("LevelGeneration")).gameObject.SetActive(!value);
				}
			}
		}

		public static void HidePlayerModel(bool value = true)
		{
			((Component)Plugin.localPlayer.thisPlayerModelArms).gameObject.SetActive(!value);
			((Component)Plugin.localPlayer.thisPlayerModelLOD1).gameObject.SetActive(!value);
			((Component)Plugin.localPlayer.thisPlayerModelLOD2).gameObject.SetActive(!value);
			((Component)Plugin.localPlayer.playerGlobalHead).gameObject.SetActive(!value);
			((Component)Plugin.localPlayer.headCostumeContainer).gameObject.SetActive(!value);
			((Component)Plugin.localPlayer.headCostumeContainerLocal).gameObject.SetActive(!value);
			((Component)Plugin.localPlayer.playerModelArmsMetarig).gameObject.SetActive(!value);
			((Component)Plugin.localPlayer.playerBadgeMesh).gameObject.SetActive(!value);
			((Component)Plugin.localPlayer.playerBetaBadgeMesh).gameObject.SetActive(!value);
			((Component)Plugin.localPlayer.localVisor).gameObject.SetActive(!value);
			if (!((Object)(object)Plugin.localPlayer.currentlyHeldObjectServer == (Object)null) && !((Object)(object)((Component)Plugin.localPlayer.currentlyHeldObjectServer).gameObject.GetComponent<MeshRenderer>() == (Object)null))
			{
				((Renderer)((Component)Plugin.localPlayer.currentlyHeldObjectServer).gameObject.GetComponent<MeshRenderer>()).enabled = !value;
			}
		}

		public static void TurnLightsRed(bool value = true)
		{
			//IL_0045: 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)
			GameObject parent = GameObject.Find("Environment/HangarShip/ShipElectricLights");
			foreach (GameObject allChild in GetAllChildren(parent))
			{
				if ((Object)(object)allChild.GetComponent<Light>() != (Object)null)
				{
					allChild.GetComponent<Light>().color = (value ? Color.red : Color.white);
				}
			}
		}

		public static void AddScanNode(GameObject obj, string headerText, string subText = "", int nodeType = 0, int maxRange = 17, int minRange = 2, bool requiresLineOfSight = true)
		{
			obj.layer = LayerMask.NameToLayer("ScanNode");
			obj.AddComponent<BoxCollider>();
			ScanNodeProperties val = obj.AddComponent<ScanNodeProperties>();
			val.headerText = headerText;
			val.subText = subText;
			val.nodeType = nodeType;
			val.maxRange = maxRange;
			val.minRange = minRange;
			val.requiresLineOfSight = requiresLineOfSight;
		}

		public static void AddInteractTrig(GameObject obj, string hoverTip = "HOLD", float time = 1.8f)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			Sprite hoverIcon = Object.FindObjectOfType<InteractTrigger>().hoverIcon;
			obj.tag = "InteractTrigger";
			obj.layer = LayerMask.NameToLayer("InteractableObject");
			InteractTrigger val = obj.AddComponent<InteractTrigger>();
			val.hoverTip = hoverTip + " : [LMB]";
			val.timeToHold = time;
			val.holdInteraction = true;
			val.hoverIcon = hoverIcon;
			val.holdingInteractEvent = new InteractEventFloat();
			val.onInteractEarlyOtherClients = new InteractEvent();
			val.onInteract = new InteractEvent();
			val.onInteractEarly = new InteractEvent();
			val.onStopInteract = new InteractEvent();
			val.onCancelAnimation = new InteractEvent();
		}

		public static void HideLMInsideDungeon(bool value = true)
		{
			//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)
			if ((Object)(object)CustomLvl.CurrentInside == (Object)null)
			{
				return;
			}
			Scene sceneByName = SceneManager.GetSceneByName("SampleSceneRelay");
			GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects();
			foreach (GameObject val in rootGameObjects)
			{
				if (((Object)val).name.Contains(((Object)CustomLvl.CurrentInside).name))
				{
					val.SetActive(!value);
					break;
				}
			}
		}
	}
	internal class LMAssets
	{
		public static Sprite? KnifeIcon;

		public static Sprite? LethalMysteryLogo;

		public static Sprite? LethalMysteryBanner;

		public static Sprite? CheckboxEmptyIcon;

		public static Sprite? CheckboxEnabledIcon;

		public static Sprite? MapIcon;

		public static Sprite? VoteIcon;

		public static Sprite? MapIconHover;

		public static Sprite? PlainArrow;

		public static Sprite? PlainArrowHover;

		public static Sprite? LightSwitch;

		public static Sprite? LightSwitchHover;

		public static Sprite? LightSwitchSelect;

		public static AudioClip SFX_VentOpen;

		public static AudioClip SFX_VentLeave;

		public static AudioClip SFX_VentSwitch;

		public static GameObject SkeldMap;

		public static GameObject OfficeMap;

		public static void LoadAllAssets()
		{
			ItemsLoader();
			DefaultMapLoader();
		}

		private static void ItemsLoader()
		{
			//IL_00d8: 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)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: 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_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: 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_01f7: 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_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			string assetPath = Plugin.GetAssetPath("items");
			AssetBundle val = AssetBundle.LoadFromFile(assetPath);
			Texture2D val2 = val.LoadAsset<Texture2D>("sprite_knife.png");
			Texture2D val3 = val.LoadAsset<Texture2D>("logo_a.png");
			Texture2D val4 = val.LoadAsset<Texture2D>("default_banner.jpg");
			Texture2D val5 = val.LoadAsset<Texture2D>("btn_empty.png");
			Texture2D val6 = val.LoadAsset<Texture2D>("btn_check.png");
			Texture2D val7 = val.LoadAsset<Texture2D>("mapIcon.png");
			Texture2D val8 = val.LoadAsset<Texture2D>("mapIcon_hover.png");
			Texture2D val9 = val.LoadAsset<Texture2D>("voteIcon.png");
			Texture2D val10 = val.LoadAsset<Texture2D>("plain-arrow.png");
			Texture2D val11 = val.LoadAsset<Texture2D>("plain-arrow_hover.png");
			Texture2D val12 = val.LoadAsset<Texture2D>("light-bulb.png");
			Texture2D val13 = val.LoadAsset<Texture2D>("light-bulb_hover.png");
			Texture2D val14 = val.LoadAsset<Texture2D>("light-bulb_selected.png");
			KnifeIcon = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0f, 0f));
			LethalMysteryLogo = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0f, 0f));
			LethalMysteryBanner = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0f, 0f));
			CheckboxEmptyIcon = Sprite.Create(val5, new Rect(0f, 0f, (float)((Texture)val5).width, (float)((Texture)val5).height), new Vector2(0f, 0f));
			CheckboxEnabledIcon = Sprite.Create(val6, new Rect(0f, 0f, (float)((Texture)val6).width, (float)((Texture)val6).height), new Vector2(0f, 0f));
			MapIcon = Sprite.Create(val7, new Rect(0f, 0f, (float)((Texture)val7).width, (float)((Texture)val7).height), new Vector2(0f, 0f));
			VoteIcon = Sprite.Create(val9, new Rect(0f, 0f, (float)((Texture)val9).width, (float)((Texture)val9).height), new Vector2(0f, 0f));
			MapIconHover = Sprite.Create(val8, new Rect(0f, 0f, (float)((Texture)val8).width, (float)((Texture)val8).height), new Vector2(0f, 0f));
			PlainArrow = Sprite.Create(val10, new Rect(0f, 0f, (float)((Texture)val10).width, (float)((Texture)val10).height), new Vector2(0f, 0f));
			PlainArrowHover = Sprite.Create(val11, new Rect(0f, 0f, (float)((Texture)val11).width, (float)((Texture)val11).height), new Vector2(0f, 0f));
			LightSwitch = Sprite.Create(val12, new Rect(0f, 0f, (float)((Texture)val12).width, (float)((Texture)val12).height), new Vector2(0f, 0f));
			LightSwitchHover = Sprite.Create(val13, new Rect(0f, 0f, (float)((Texture)val13).width, (float)((Texture)val13).height), new Vector2(0f, 0f));
			LightSwitchSelect = Sprite.Create(val14, new Rect(0f, 0f, (float)((Texture)val14).width, (float)((Texture)val14).height), new Vector2(0f, 0f));
			AudioLoader(val);
		}

		private static void AudioLoader(AssetBundle bundle)
		{
			SFX_VentOpen = bundle.LoadAsset<AudioClip>("vent_open.wav");
			SFX_VentLeave = bundle.LoadAsset<AudioClip>("vent_leave.wav");
			SFX_VentSwitch = bundle.LoadAsset<AudioClip>("vent_switch.MP3");
		}

		private static void DefaultMapLoader()
		{
			string assetPath = Plugin.GetAssetPath("lm_maps");
			AssetBundle val = AssetBundle.LoadFromFile(assetPath);
			SkeldMap = val.LoadAsset<GameObject>("Skeld.prefab");
			OfficeMap = val.LoadAsset<GameObject>("Office.prefab");
		}
	}
	public class LMConfig
	{
		public enum MonsterAmt
		{
			One,
			Two
		}

		public enum SheriffAmt
		{
			Zero,
			One,
			Two
		}

		public static ConfigFile _config;

		[Header("Keybinds")]
		public static ConfigEntry<string> PrefixSetting;

		public static ConfigEntry<string> shapeshiftBind;

		public static ConfigEntry<string> selfcleanBind;

		public static ConfigEntry<string> spawnItemBind;

		public static ConfigEntry<string> showMapBind;

		public static ConfigEntry<string> showVoteBind;

		public static List<ConfigEntry<string>> AllHotkeys = new List<ConfigEntry<string>>();

		[Header("Host Settings")]
		public static ConfigEntry<MonsterAmt> defaultImposterAmt;

		public static ConfigEntry<SheriffAmt> defaultSheriffAmt;

		public static ConfigEntry<float> defaultDiscussTime;

		public static ConfigEntry<float> defaultVoteTime;

		public static float defaultMeetingTime;

		public static ConfigEntry<float> defaultMeetingCooldown;

		public static ConfigEntry<int> defaultMeetingNum;

		public static ConfigEntry<float> defaultGracePeriodTime;

		public static ConfigEntry<float> defaultKillCooldown;

		public static ConfigEntry<float> defaultScrapTimer;

		public static ConfigEntry<bool> enableChat;

		public static void AllConfigs(ConfigFile cfg)
		{
			_config = cfg;
			PrefixSetting = cfg.Bind<string>("Command Settings", "Command Prefix", "/", "Prefix for chat commands");
			shapeshiftBind = cfg.Bind<string>("Monster Controls", "Shapeshift", "8", "Disguise yourself");
			selfcleanBind = cfg.Bind<string>("Monster Controls", "Self Clean", "f", "Clean the blood on you");
			spawnItemBind = cfg.Bind<string>("Player Controls", "Spawn Item", "t", "Spawn your role specific item");
			showMapBind = cfg.Bind<string>("Player Controls", "Show Map", "m", "A full view of the map");
			showVoteBind = cfg.Bind<string>("Player Controls", "Show Votes", "v", "Displays everyone that can be voted");
			AllHotkeys.Add(PrefixSetting);
			AllHotkeys.Add(shapeshiftBind);
			AllHotkeys.Add(selfcleanBind);
			AllHotkeys.Add(spawnItemBind);
			AllHotkeys.Add(showMapBind);
			AllHotkeys.Add(showVoteBind);
			defaultImposterAmt = cfg.Bind<MonsterAmt>("Host Settings", "Imposter Amount", MonsterAmt.One, "Number of imposters");
			defaultSheriffAmt = cfg.Bind<SheriffAmt>("Host Settings", "Sheriff Amount", SheriffAmt.One, "Number of Sheriffs");
			defaultDiscussTime = cfg.Bind<float>("Host Settings", "Discuss Time", 35f, (ConfigDescription)null);
			defaultVoteTime = cfg.Bind<float>("Host Settings", "Vote Time", 95f, (ConfigDescription)null);
			defaultMeetingCooldown = cfg.Bind<float>("Host Settings", "Meeting Cooldown", 10f, "Time until you can call a meeting again");
			defaultMeetingNum = cfg.Bind<int>("Host Settings", "Meeting Amount", 1, "Amount of times a specific user can call a meeting");
			defaultGracePeriodTime = cfg.Bind<float>("Host Settings", "Grace Period", 20f, "Time until people can take damage after a meeting and when a round first starts");
			defaultKillCooldown = cfg.Bind<float>("Host Settings", "Kill Cooldown", 20f, "Time until monsters can instakill");
			defaultScrapTimer = cfg.Bind<float>("Host Settings", "Scrap Spawn Timer", 15f, "Time until scraps will spawn on custom moons");
			enableChat = cfg.Bind<bool>("Host Settings", "Enable Chat", false, "Allow players to type in chat during a round");
			defaultImposterAmt.SettingChanged += DefaultImposterAmt_SettingChanged;
			defaultSheriffAmt.SettingChanged += DefaultSheriffAmt_SettingChanged;
			defaultDiscussTime.SettingChanged += DefaultDiscussTime_SettingChanged;
			defaultVoteTime.SettingChanged += DefaultVoteTime_SettingChanged;
			defaultMeetingCooldown.SettingChanged += DefaultMeetingCooldown_SettingChanged;
			defaultMeetingNum.SettingChanged += DefaultMeetingNum_SettingChanged;
			defaultGracePeriodTime.SettingChanged += DefaultGracePeriodTime_SettingChanged;
			defaultKillCooldown.SettingChanged += DefaultKillCooldown_SettingChanged;
			defaultScrapTimer.SettingChanged += DefaultScrapTimer_SettingChanged;
			enableChat.SettingChanged += EnableChat_SettingChanged;
			LethalConfigAddons();
		}

		private static void LethalConfigAddons()
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_004e: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_007e: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00ae: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00d7: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_00de: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_0108: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_0139: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_016a: Expected O, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			LethalConfigManager.SkipAutoGen();
			EnumDropDownConfigItem<MonsterAmt> val = new EnumDropDownConfigItem<MonsterAmt>(defaultImposterAmt, false);
			EnumDropDownConfigItem<SheriffAmt> val2 = new EnumDropDownConfigItem<SheriffAmt>(defaultSheriffAmt, false);
			ConfigEntry<float> obj = defaultDiscussTime;
			FloatSliderOptions val3 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val3).Min = 10f;
			((BaseRangeOptions<float>)val3).Max = 360f;
			FloatSliderConfigItem val4 = new FloatSliderConfigItem(obj, val3);
			ConfigEntry<float> obj2 = defaultVoteTime;
			FloatSliderOptions val5 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val5).Min = 10f;
			((BaseRangeOptions<float>)val5).Max = 360f;
			FloatSliderConfigItem val6 = new FloatSliderConfigItem(obj2, val5);
			ConfigEntry<float> obj3 = defaultMeetingCooldown;
			FloatSliderOptions val7 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val7).Min = 10f;
			((BaseRangeOptions<float>)val7).Max = 180f;
			FloatSliderConfigItem val8 = new FloatSliderConfigItem(obj3, val7);
			ConfigEntry<int> obj4 = defaultMeetingNum;
			IntInputFieldOptions val9 = new IntInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<int>)val9).Min = 0;
			((BaseRangeOptions<int>)val9).Max = 5;
			IntInputFieldConfigItem val10 = new IntInputFieldConfigItem(obj4, val9);
			ConfigEntry<float> obj5 = defaultGracePeriodTime;
			FloatSliderOptions val11 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val11).Min = 10f;
			((BaseRangeOptions<float>)val11).Max = 120f;
			FloatSliderConfigItem val12 = new FloatSliderConfigItem(obj5, val11);
			ConfigEntry<float> obj6 = defaultKillCooldown;
			FloatSliderOptions val13 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val13).Min = 10f;
			((BaseRangeOptions<float>)val13).Max = 60f;
			FloatSliderConfigItem val14 = new FloatSliderConfigItem(obj6, val13);
			ConfigEntry<float> obj7 = defaultScrapTimer;
			FloatSliderOptions val15 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val15).Min = 10f;
			((BaseRangeOptions<float>)val15).Max = 60f;
			FloatSliderConfigItem val16 = new FloatSliderConfigItem(obj7, val15);
			BoolCheckBoxConfigItem val17 = new BoolCheckBoxConfigItem(enableChat, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val10);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val12);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val14);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val16);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val17);
		}

		public static void SetHostConfigs(int playerID = -1)
		{
			foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item in _config)
			{
				string section = item.Key.Section;
				string key = item.Key.Key;
				string arg = $"{item.Value.BoxedValue}";
				if (!(section != "Host Settings"))
				{
					Plugin.netHandler.SetHostConfigsReceive($"{key}/{arg}/{playerID}");
				}
			}
		}

		private static void DefaultImposterAmt_SettingChanged(object sender, EventArgs e)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase)
			{
				Roles.specialRoleAmount["monster"] = (int)defaultImposterAmt.Value;
			}
		}

		private static void DefaultSheriffAmt_SettingChanged(object sender, EventArgs e)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase)
			{
				Roles.specialRoleAmount["sheriff"] = (int)defaultSheriffAmt.Value;
			}
		}

		private static void DefaultDiscussTime_SettingChanged(object sender, EventArgs e)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase)
			{
				Plugin.netHandler.SetHostConfigsReceive($"Discuss Time/{defaultDiscussTime.Value}/-1");
			}
		}

		private static void DefaultVoteTime_SettingChanged(object sender, EventArgs e)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase)
			{
				Plugin.netHandler.SetHostConfigsReceive($"Vote Time/{defaultVoteTime.Value}/-1");
			}
		}

		private static void DefaultMeetingCooldown_SettingChanged(object sender, EventArgs e)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase)
			{
				Plugin.netHandler.SetHostConfigsReceive($"Meeting Cooldown/{defaultMeetingCooldown.Value}/-1");
			}
		}

		private static void DefaultMeetingNum_SettingChanged(object sender, EventArgs e)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase)
			{
				Plugin.netHandler.SetHostConfigsReceive($"Meeting Amount/{defaultMeetingNum.Value}/-1");
			}
		}

		private static void DefaultGracePeriodTime_SettingChanged(object sender, EventArgs e)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase)
			{
				Plugin.netHandler.SetHostConfigsReceive($"Grace Period/{defaultGracePeriodTime.Value}/-1");
			}
		}

		private static void DefaultKillCooldown_SettingChanged(object sender, EventArgs e)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase)
			{
				Plugin.netHandler.SetHostConfigsReceive($"Kill Cooldown/{defaultKillCooldown.Value}/-1");
			}
		}

		private static void DefaultScrapTimer_SettingChanged(object sender, EventArgs e)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase)
			{
				Plugin.netHandler.SetHostConfigsReceive($"Scrap Spawn Timer/{defaultScrapTimer.Value}/-1");
			}
		}

		private static void EnableChat_SettingChanged(object sender, EventArgs e)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase)
			{
				Plugin.netHandler.SetHostConfigsReceive($"Enable Chat/{enableChat.Value}/-1");
			}
		}
	}
	public class StringAddons
	{
		public static readonly Dictionary<char, string> convertableChars = new Dictionary<char, string>
		{
			{ ';', "&/59" },
			{ '=', "&/61" },
			{ '[', "&/91" },
			{ ']', "&/93" }
		};

		public static string UseDefaultPrefix()
		{
			string text = "/";
			if (LMConfig.PrefixSetting != null)
			{
				LMConfig.PrefixSetting.Value = text;
				((ConfigEntryBase)LMConfig.PrefixSetting).ConfigFile.Save();
			}
			Plugin.mls.LogInfo((object)"setting prefix back to /");
			return text;
		}

		public static string ConvertToSymbols(string input)
		{
			foreach (char key in convertableChars.Keys)
			{
				if (key.ToString() == input)
				{
					return convertableChars[key];
				}
			}
			return input;
		}

		public static string ConvertToPrefix(string input)
		{
			foreach (char key in convertableChars.Keys)
			{
				if (convertableChars[key] == input)
				{
					return key.ToString();
				}
			}
			return input;
		}

		public static bool InConvertableChars(string input = "", string prefix = "")
		{
			if (!string.IsNullOrEmpty(input))
			{
				foreach (char key in convertableChars.Keys)
				{
					if (convertableChars[key] == input)
					{
						return true;
					}
				}
			}
			else if (!string.IsNullOrEmpty(prefix))
			{
				foreach (char key2 in convertableChars.Keys)
				{
					if (key2.ToString() == prefix)
					{
						return true;
					}
				}
			}
			return false;
		}

		public static string CleanPrefix(string prefix)
		{
			if (string.IsNullOrEmpty(prefix))
			{
				return UseDefaultPrefix();
			}
			if (InConvertableChars("", prefix.ToString()))
			{
				return prefix;
			}
			if (prefix.Length > 1)
			{
				return UseDefaultPrefix();
			}
			return prefix;
		}

		public static bool CheckPrefix(string prefix)
		{
			if (LMConfig.PrefixSetting != null && !string.IsNullOrEmpty(prefix.Trim()) && (prefix == LMConfig.PrefixSetting.Value || InConvertableChars("", prefix)))
			{
				prefix = CleanPrefix(prefix);
				return ConvertToSymbols(prefix) == LMConfig.PrefixSetting.Value;
			}
			return false;
		}

		public static string Title(string input)
		{
			if (string.IsNullOrEmpty(input))
			{
				return input;
			}
			return char.ToUpper(input[0]) + input.Substring(1);
		}

		public static bool ContainsWhitelistedItem(string input)
		{
			if (string.IsNullOrEmpty(input))
			{
				return false;
			}
			foreach (string allScrap in Tasks.allScraps)
			{
				if (allScrap.ToLower().Contains(input.ToLower()))
				{
					return true;
				}
			}
			return false;
		}

		public static bool ContainsSpecialMapID(string input)
		{
			if (string.IsNullOrEmpty(input))
			{
				return false;
			}
			string[] specialMapID = CustomLvl.specialMapID;
			foreach (string text in specialMapID)
			{
				if (text.ToLower().Contains(input.ToLower()))
				{
					return true;
				}
			}
			return false;
		}

		public static bool ContainsString(string input, List<string> array)
		{
			foreach (string item in array)
			{
				if (item.Contains(input.ToLower()))
				{
					return true;
				}
			}
			return false;
		}

		public static bool ConvertToBool(string input)
		{
			if (string.IsNullOrEmpty(input) || input == "false")
			{
				return false;
			}
			if (input.ToLower() == "true")
			{
				return true;
			}
			return false;
		}

		public static int ConvertToInt(string input)
		{
			int.TryParse(input, out var result);
			return result;
		}

		public static float ConvertToFloat(string input)
		{
			float.TryParse(input, out var result);
			return result;
		}

		public static Vector3 ConvertToVector3(string input)
		{
			//IL_0052: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			string text = input;
			text = text.Trim('(', ')');
			string[] array = text.Split(',');
			Vector3 result = default(Vector3);
			((Vector3)(ref result))..ctor(float.Parse(array[0].Trim()), float.Parse(array[1].Trim()), float.Parse(array[2].Trim()));
			return result;
		}

		public static LMConfig.MonsterAmt ConvertToMonsterAmt(string input)
		{
			if (!(input == "One"))
			{
				if (input == "Two")
				{
					return LMConfig.MonsterAmt.Two;
				}
				return LMConfig.MonsterAmt.One;
			}
			return LMConfig.MonsterAmt.One;
		}

		public static LMConfig.SheriffAmt ConvertToSheriffAmt(string input)
		{
			return input switch
			{
				"Zero" => LMConfig.SheriffAmt.Zero, 
				"One" => LMConfig.SheriffAmt.One, 
				"Two" => LMConfig.SheriffAmt.Two, 
				_ => LMConfig.SheriffAmt.One, 
			};
		}

		public static int AddInts(string a, int b)
		{
			int num = ConvertToInt(a);
			return num += b;
		}

		public static int NameToID(string name)
		{
			int result = -1;
			foreach (KeyValuePair<ulong, int> clientPlayer in StartOfRound.Instance.ClientPlayerList)
			{
				if (StartOfRound.Instance.allPlayerScripts[clientPlayer.Value].playerUsername.ToLower() == name.ToLower())
				{
					return (int)StartOfRound.Instance.allPlayerScripts[clientPlayer.Value].playerClientId;
				}
			}
			return result;
		}

		public static int GetLastId(string name)
		{
			MatchCollection matchCollection = Regex.Matches(name, "#(\\d+)");
			if (matchCollection.Count > 0)
			{
				return int.Parse(matchCollection[matchCollection.Count - 1].Groups[1].Value);
			}
			return -1;
		}
	}
}
namespace LethalMystery.UI
{
	[HarmonyPatch]
	internal class KeybindsUI
	{
		private static List<string> ControlNames = new List<string>();

		private static int LMysteryYOffset = 0;

		[HarmonyPatch(typeof(KepRemapPanel), "LoadKeybindsUI")]
		[HarmonyPrefix]
		private static bool LoadBindsPatch(KepRemapPanel __instance)
		{
			//IL_0087: 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_00d9: 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_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			Controls.monsterControls.Disable();
			Controls.playerControls.Disable();
			GameObject val = GameObject.Find("Canvas/MenuContainer/SettingsPanel/KeybindsPanel/Scroll View");
			GameObject val2 = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel/KeybindsPanel/Scroll View");
			GameObject val3 = (Object.op_Implicit((Object)(object)val) ? val : val2);
			ScrollRect component = val3.GetComponent<ScrollRect>();
			__instance.currentVertical = 0;
			__instance.currentHorizontal = 0;
			int num = 0;
			LMysteryYOffset = 0;
			Vector2 val4 = default(Vector2);
			((Vector2)(ref val4))..ctor(__instance.horizontalOffset * (float)__instance.currentHorizontal, __instance.verticalOffset * (float)__instance.currentVertical);
			component.content.anchorMax = new Vector2(component.content.anchorMax.x, 1f);
			GameObject val5 = Object.Instantiate<GameObject>(__instance.sectionTextPrefab, (Transform)(object)__instance.keyRemapContainer);
			__instance.keySlots.Add(val5);
			val5.GetComponent<RectTransform>().anchoredPosition = new Vector2(-40f, (0f - __instance.verticalOffset) * (float)num);
			((TMP_Text)val5.GetComponentInChildren<TextMeshProUGUI>()).text = "Lethal Mystery";
			num++;
			for (int i = 0; i < LMConfig.AllHotkeys.Count; i++)
			{
				GameObject val6 = Object.Instantiate<GameObject>(__instance.keyRemapSlotPrefab, (Transform)(object)__instance.keyRemapContainer);
				__instance.keySlots.Add(val6);
				((TMP_Text)val6.GetComponentInChildren<TextMeshProUGUI>()).text = ((ConfigEntryBase)LMConfig.AllHotkeys[i]).Definition.Key;
				val6.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, (float)LMysteryYOffset);
				SettingsOption componentInChildren = val6.GetComponentInChildren<SettingsOption>();
				((TMP_Text)componentInChildren.currentlyUsedKeyText).text = StringAddons.ConvertToPrefix(LMConfig.AllHotkeys[i].Value);
				string text = ((ConfigEntryBase)LMConfig.AllHotkeys[i]).Definition.Key.ToLower();
				if (Controls.inputRefs.ContainsKey(text))
				{
					Plugin.mls.LogInfo((object)(">> Found |  Key: " + text));
					componentInChildren.rebindableAction = Controls.inputRefs[text];
				}
				else
				{
					Plugin.mls.LogInfo((object)(">>Placeholder |  Key: " + text));
					componentInChildren.rebindableAction = Controls.shapeshiftRef;
				}
				LMysteryYOffset -= 40;
				num++;
			}
			__instance.currentVertical = 0;
			__instance.currentHorizontal = 0;
			((Vector2)(ref val4))..ctor(__instance.horizontalOffset * (float)__instance.currentHorizontal, __instance.verticalOffset * (float)(__instance.currentVertical + num));
			GameObject val7 = Object.Instantiate<GameObject>(__instance.sectionTextPrefab, (Transform)(object)__instance.keyRemapContainer);
			__instance.keySlots.Add(val7);
			val7.GetComponent<RectTransform>().anchoredPosition = new Vector2(-40f, (float)(LMysteryYOffset - 60));
			((TMP_Text)val7.GetComponentInChildren<TextMeshProUGUI>()).text = "Normal";
			component.content.anchorMax = new Vector2(component.content.anchorMax.x, component.content.anchorMax.y + (float)Math.Abs(LMysteryYOffset) / 100f);
			return true;
		}

		[HarmonyPatch(typeof(KepRemapPanel), "LoadKeybindsUI")]
		[HarmonyPostfix]
		private static void PositionBindsPatch(KepRemapPanel __instance)
		{
			//IL_011a: 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_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Canvas/MenuContainer/SettingsPanel/KeybindsPanel/Scroll View/Viewport/Content/RemapKeysContainer");
			GameObject val2 = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel/KeybindsPanel/Scroll View/Viewport/Content/RemapKeysContainer");
			GameObject parent = (Object.op_Implicit((Object)(object)val) ? val : val2);
			List<GameObject> allChildren = GOTools.GetAllChildren(parent);
			ControlNames.Clear();
			for (int i = 0; i < __instance.remappableKeys.Count; i++)
			{
				ControlNames.Add(__instance.remappableKeys[i].ControlName.ToLower());
			}
			foreach (GameObject item in allChildren)
			{
				List<GameObject> allChildren2 = GOTools.GetAllChildren(item);
				foreach (GameObject objChild in allChildren2)
				{
					if ((Object)(object)objChild.gameObject.GetComponent<TextMeshProUGUI>() != (Object)null)
					{
						string value = Array.Find(ControlNames.ToArray(), (string elem) => elem.Equals(((TMP_Text)objChild.gameObject.GetComponent<TextMeshProUGUI>()).text.ToLower()));
						if (!string.IsNullOrEmpty(value))
						{
							RectTransform component = item.GetComponent<RectTransform>();
							component.anchoredPosition = new Vector2(component.anchoredPosition.x, component.anchoredPosition.y + (float)LMysteryYOffset - 60f);
						}
					}
				}
				if ((Object)(object)item.gameObject.GetComponent<TextMeshProUGUI>() != (Object)null)
				{
					string text = ((TMP_Text)item.gameObject.GetComponent<TextMeshProUGUI>()).text;
					if (text.ToLower() == "rebind controllers")
					{
						RectTransform component2 = item.GetComponent<RectTransform>();
						component2.anchoredPosition = new Vector2(component2.anchoredPosition.x, component2.anchoredPosition.y + (float)LMysteryYOffset - 60f);
					}
				}
				RectTransform component3 = item.GetComponent<RectTransform>();
				component3.anchoredPosition = new Vector2(component3.anchoredPosition.x, component3.anchoredPosition.y - (float)LMysteryYOffset);
				GameObject val3 = GameObject.Find("Canvas/MenuContainer/SettingsPanel/KeybindsPanel/Scroll View/");
				GameObject val4 = GameObject.Find("Systems/UI/Canvas/QuickMenu/SettingsPanel/KeybindsPanel/Scroll View");
				GameObject val5 = (Object.op_Implicit((Object)(object)val3) ? val3 : val4);
				ScrollRect component4 = val5.GetComponent<ScrollRect>();
				component4.normalizedPosition = new Vector2(component4.normalizedPosition.x, 1f);
			}
		}

		[HarmonyPatch(typeof(IngamePlayerSettings), "CompleteRebind")]
		[HarmonyPostfix]
		private static void CompleteRebindPatch(SettingsOption optionUI)
		{
			for (int i = 0; i < LMConfig.AllHotkeys.Count; i++)
			{
				if (!(((ConfigEntryBase)LMConfig.AllHotkeys[i]).Definition.Key.ToLower() == ((TMP_Text)optionUI.textElement).text.ToLower()))
				{
					continue;
				}
				if (StringAddons.InConvertableChars("", ((TMP_Text)optionUI.currentlyUsedKeyText).text))
				{
					LMConfig.AllHotkeys[i].Value = StringAddons.ConvertToSymbols(((TMP_Text)optionUI.currentlyUsedKeyText).text);
					((ConfigEntryBase)LMConfig.AllHotkeys[i]).ConfigFile.Save();
					break;
				}
				LMConfig.AllHotkeys[i].Value = ((TMP_Text)optionUI.currentlyUsedKeyText).text;
				((ConfigEntryBase)LMConfig.AllHotkeys[i]).ConfigFile.Save();
				InputAction val = Controls.monsterControls.FindAction(((ConfigEntryBase)LMConfig.AllHotkeys[i]).Definition.Key.ToLower(), false);
				InputAction val2 = Controls.playerControls.FindAction(((ConfigEntryBase)LMConfig.AllHotkeys[i]).Definition.Key.ToLower(), false);
				if (val != null)
				{
					InputActionRebindingExtensions.ApplyBindingOverride(Controls.monsterControls.FindAction(((ConfigEntryBase)LMConfig.AllHotkeys[i]).Definition.Key.ToLower(), false), "<Keyboard>/" + ((TMP_Text)optionUI.currentlyUsedKeyText).text.ToLower(), (string)null, (string)null);
				}
				if (val2 != null)
				{
					InputActionRebindingExtensions.ApplyBindingOverride(Controls.playerControls.FindAction(((ConfigEntryBase)LMConfig.AllHotkeys[i]).Definition.Key.ToLower(), false), "<Keyboard>/" + ((TMP_Text)optionUI.currentlyUsedKeyText).text.ToLower(), (string)null, (string)null);
				}
				break;
			}
		}

		[HarmonyPatch(typeof(KepRemapPanel), "OnDisable")]
		[HarmonyPostfix]
		private static void KepOnDisablePatch()
		{
			if (Roles.CurrentRole != null)
			{
				if (!Controls.monsterControls.enabled && Roles.CurrentRole.Type == Roles.RoleType.monster)
				{
					Controls.monsterControls.Enable();
				}
				if (!Controls.playerControls.enabled)
				{
					Controls.playerControls.Enable();
				}
			}
		}
	}
	[HarmonyPatch]
	internal class MainMenu
	{
		[HarmonyPatch(typeof(MenuManager), "Start")]
		[HarmonyPostfix]
		[HarmonyAfter(new string[] { "me.swipez.melonloader.morecompany" })]
		private static void StartPatch()
		{
			CreateLMMainMenu();
		}

		private static void CreateLMMainMenu()
		{
			//IL_0006: 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_008d: 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_00af: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			Image val = new GameObject("Banner").AddComponent<Image>();
			GameObject val2 = GameObject.Find("Canvas/MenuContainer/MainButtons/HeaderImage");
			GameObject val3 = GameObject.Find("Canvas/MenuContainer/LoadingScreen/Image");
			if ((Object)(object)val2 != (Object)null && (Object)(object)LMAssets.LethalMysteryLogo != (Object)null && (Object)(object)val != (Object)null)
			{
				((Component)val).transform.SetParent(GameObject.Find("Canvas/MenuContainer/MainButtons/").transform);
				((Component)val).transform.SetAsFirstSibling();
				((Graphic)val).rectTransform.offsetMin = Vector2.zero;
				((Graphic)val).rectTransform.offsetMax = Vector2.zero;
				((Graphic)val).rectTransform.anchorMin = Vector2.zero;
				((Graphic)val).rectTransform.anchorMax = Vector2.one;
				((Transform)((Graphic)val).rectTransform).localPosition = Vector3.zero;
				((Component)val).transform.localScale = new Vector3(1.1125f, 0.9253f, 5.1671f);
				val.sprite = LMAssets.LethalMysteryBanner;
				val2.GetComponent<Image>().sprite = LMAssets.LethalMysteryLogo;
				val3.GetComponent<Image>().sprite = LMAssets.LethalMysteryLogo;
			}
		}
	}
	[HarmonyPatch]
	internal class MinimapUI
	{
		public class ArrowPointer : MonoBehaviour
		{
			public Transform arrow;

			public GameObject pointer;

			public void Start()
			{
				SpawnPointer();
			}

			public void Update()
			{
				AdjustPosition();
			}

			private void SpawnPointer()
			{
				//IL_001d: 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_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: 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)
				if (!StartOfRound.Instance.inShipPhase)
				{
					Vector3 val = default(Vector3);
					((Vector3)(ref val))..ctor(((Component)Plugin.localPlayer).transform.position.x - 5f, ((Component)Plugin.localPlayer).transform.position.y, ((Component)Plugin.localPlayer).transform.position.z);
					pointer = Object.Instantiate<GameObject>(Minimap.waypointPrefab, val, Quaternion.identity);
					pointer.SetActive(true);
					((Renderer)pointer.GetComponent<MeshRenderer>()).enabled = false;
				}
			}

			private void AdjustPosition()
			{
				//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_0030: 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_005d: 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_008b: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)pointer == (Object)null))
				{
					Vector3 position = StartOfRound.Instance.playerSpawnPositions[0].position;
					pointer.transform.LookAt(position);
					Vector3 position2 = default(Vector3);
					((Vector3)(ref position2))..ctor(((Component)Plugin.localPlayer).transform.position.x - 5f, ((Component)Plugin.localPlayer).transform.position.y, ((Component)Plugin.localPlayer).transform.position.z);
					pointer.transform.position = position2;
				}
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__18_2;

			public static UnityAction <>9__19_2;

			public static UnityAction <>9__20_2;

			internal void <LeftButtonUI>b__18_2()
			{
				Minimap.SwitchPlayerButton(forward: false);
			}

			internal void <RightButtonUI>b__19_2()
			{
				Minimap.SwitchPlayerButton(forward: true);
			}

			internal void <CreateLightSabotage>b__20_2()
			{
				Generator.BreakGenerator();
			}
		}

		public static GameObject minimap;

		public static GameObject minimapCam;

		public static GameObject border;

		public static GameObject mapIcon;

		public static Image lightIcon;

		public static TextMeshProUGUI playerNameTXT;

		public static List<GameObject> allMinimapObjects = new List<GameObject>();

		public static List<GameObject> slotObjects = new List<GameObject>();

		public static GameObject SlotHolder;

		private static RectTransform slotRect;

		public static void DestroyUI()
		{
			foreach (GameObject allMinimapObject in allMinimapObjects)
			{
				if ((Object)(object)allMinimapObject != (Object)null)
				{
					Object.Destroy((Object)(object)allMinimapObject);
				}
			}
			foreach (GameObject slotObject in slotObjects)
			{
				if ((Object)(object)slotObject != (Object)null)
				{
					Object.Destroy((Object)(object)slotObject);
				}
			}
			slotObjects.Clear();
			allMinimapObjects.Clear();
			Minimap.ResetVars();
		}

		public static void CreateMapIcon()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_007c: 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_00a8: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD");
			mapIcon = new GameObject("minimapIcon");
			mapIcon.transform.SetParent(val.transform, false);
			mapIcon.layer = 5;
			mapIcon.transform.SetSiblingIndex(1);
			Image val2 = mapIcon.AddComponent<Image>();
			val2.sprite = LMAssets.MapIcon;
			RectTransform component = mapIcon.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(64f, 64f);
			component.anchorMin = new Vector2(1f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(1f, 1f);
			component.anchoredPosition = new Vector2(0f, 0f);
			allMinimapObjects.Add(mapIcon);
			ShowMapIconKeybind();
		}

		private static void ShowMapIconKeybind()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_004c: 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_007f: 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_00ab: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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)
			GameObject val = new GameObject("background");
			val.transform.SetParent(mapIcon.transform, false);
			val.transform.SetSiblingIndex(0);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = new Color(0f, 0f, 0f, 1f);
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(32f, 16f);
			component.anchorMin = new Vector2(1f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(1.5f, 4.5f);
			component.anchoredPosition = Vector2.zero;
			GameObject val3 = new GameObject("keybind");
			val3.transform.SetParent(mapIcon.transform, false);
			val3.transform.SetSiblingIndex(1);
			TextMeshProUGUI val4 = val3.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val4).text = "[ " + LMConfig.showMapBind.Value.ToUpper() + " ]";
			((TMP_Text)val4).fontSize = 9f;
			((TMP_Text)val4).fontWeight = (FontWeight)800;
			((TMP_Text)val4).alignment = (TextAlignmentOptions)514;
			((Graphic)val4).color = new Color(0.996f, 0.095f, 0f, 1f);
			RectTransform component2 = val3.GetComponent<RectTransform>();
			component2.sizeDelta = new Vector2(280f, 80f);
			component2.pivot = new Vector2(0.5f, 0.9f);
			component2.anchoredPosition = Vector2.zero;
		}

		private static void CreateBorder()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0052: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Systems/UI/Canvas");
			border = new GameObject("Minimap");
			border.transform.SetParent(val.transform, false);
			Image val2 = border.AddComponent<Image>();
			((Graphic)val2).color = new Color(0.996f, 0.095f, 0f, 1f);
			border.layer = 5;
			border.transform.SetSiblingIndex(13);
			RectTransform component = border.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(450f, 450f);
			component.anchoredPosition = Vector2.zero;
			allMinimapObjects.Add(border);
		}

		public static void CreateMinimap()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_00f4: 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)
			CreateBorder();
			minimap = new GameObject("MinimapScreen");
			minimap.transform.SetParent(border.transform, false);
			minimapCam = Object.Instantiate<GameObject>(GameObject.Find("Systems/GameSystems/ItemSystems/MapCamera"));
			((Object)minimapCam).name = "MinimapCam";
			GameObject val = new GameObject("MapScript");
			val.transform.SetParent(minimap.transform);
			ManualCameraRenderer val2 = val.AddComponent<ManualCameraRenderer>();
			SetRenderVars(val2);
			GameObject val3 = Object.Instantiate<GameObject>(GameObject.Find("Systems/GameSystems/ItemSystems/MapScreenUI/ArrowUI"));
			val3.transform.SetParent(minimap.transform, false);
			val3.SetActive(false);
			RawImage val4 = minimap.AddComponent<RawImage>();
			val4.texture = (Texture)(object)val2.mapCamera.targetTexture;
			minimap.layer = 5;
			RectTransform component = minimap.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(448f, 448f);
			component.anchoredPosition = Vector2.zero;
			Minimap.MinimapWaypoint minimapWaypoint = minimap.AddComponent<Minimap.MinimapWaypoint>();
			minimapWaypoint.minimapCamera = minimapCam.GetComponent<Camera>();
			minimapWaypoint.minimapRectTransform = minimap.GetComponent<RectTransform>();
			Minimap.waypointPrefab = ((Component)((Component)Plugin.localPlayer).transform.Find("Misc/MapDot")).gameObject;
			allMinimapObjects.Add(minimap);
			allMinimapObjects.Add(minimapCam);
			CreateName();
			LeftButtonUI();
			RightButtonUI();
			CreateLightSabotage();
			CreateMapList();
		}

		private static void SetRenderVars(ManualCameraRenderer camRender)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			ManualCameraRenderer component = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001/CameraMonitorScript").GetComponent<ManualCameraRenderer>();
			Camera component2 = minimapCam.GetComponent<Camera>();
			RenderTexture targetTexture = new RenderTexture(512, 512, 16);
			component2.targetTexture = targetTexture;
			camRender.cam = component2;
			camRender.cameraViews = component.cameraViews;
			camRender.cameraViewIndex = component.cameraViewIndex;
			camRender.currentCameraDisabled = false;
			camRender.mesh = component.mesh;
			camRender.offScreenMat = component.offScreenMat;
			camRender.onScreenMat = component.onScreenMat;
			camRender.materialIndex = component.materialIndex;
			camRender.overrideCameraForOtherUse = false;
			camRender.renderAtLowerFramerate = false;
			camRender.targetedPlayer = Plugin.localPlayer;
			camRender.radarTargets = component.radarTargets;
			camRender.targetTransformIndex = component.targetTransformIndex;
			camRender.mapCamera = component2;
			camRender.mapCameraAnimator = component.mapCameraAnimator;
			camRender.mapCameraStationaryUI = component.mapCameraStationaryUI;
			camRender.shipArrowPointer = component.shipArrowPointer;
			camRender.shipArrowUI = component.shipArrowUI;
		}

		private static void CreateName()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0089: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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)
			GameObject val = new GameObject("playerName");
			val.transform.SetParent(minimap.transform, false);
			playerNameTXT = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)playerNameTXT).font = ((TMP_Text)StartOfRound.Instance.mapScreenPlayerName).font;
			((TMP_Text)playerNameTXT).fontSize = ((TMP_Text)StartOfRound.Instance.mapScreenPlayerName).fontSize;
			((TMP_Text)playerNameTXT).text = Plugin.localPlayer.playerUsername;
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(280f, 80f);
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(0f, 1f);
			component.pivot = new Vector2(0f, 1f);
			component.anchoredPosition = Vector2.zero;
		}

		private static void LeftButtonUI()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0075: 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_009a: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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)
			//IL_0144: 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_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			GameObject val = new GameObject("LswitchBtn");
			val.transform.SetParent(minimap.transform, false);
			Button val2 = val.AddComponent<Button>();
			Image Limg = val.AddComponent<Image>();
			Sprite arrowImg = LMAssets.PlainArrow;
			Sprite arrowImgHover = LMAssets.PlainArrowHover;
			Limg.sprite = arrowImg;
			EventTrigger val3 = val.AddComponent<EventTrigger>();
			Entry val4 = new Entry();
			val4.eventID = (EventTriggerType)0;
			((UnityEvent<BaseEventData>)(object)val4.callback).AddListener((UnityAction<BaseEventData>)delegate
			{
				Limg.sprite = arrowImgHover;
			});
			Entry val5 = new Entry();
			val5.eventID = (EventTriggerType)1;
			((UnityEvent<BaseEventData>)(object)val5.callback).AddListener((UnityAction<BaseEventData>)delegate
			{
				Limg.sprite = arrowImg;
			});
			val3.triggers.Add(val4);
			val3.triggers.Add(val5);
			ButtonClickedEvent onClick = val2.onClick;
			object obj = <>c.<>9__18_2;
			if (obj == null)
			{
				UnityAction val6 = delegate
				{
					Minimap.SwitchPlayerButton(forward: false);
				};
				<>c.<>9__18_2 = val6;
				obj = (object)val6;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(32f, 32f);
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(0f, 0f);
			component.pivot = new Vector2(1f, 0f);
			component.anchoredPosition = new Vector2(8f, 2f);
			((Transform)component).rotation = Quaternion.Euler(0f, 0f, -90f);
		}

		private static void RightButtonUI()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0075: 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_009a: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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)
			//IL_0144: 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_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			GameObject val = new GameObject("RswitchBtn");
			val.transform.SetParent(minimap.transform, false);
			Button val2 = val.AddComponent<Button>();
			Image Rimg = val.AddComponent<Image>();
			Sprite arrowImg = LMAssets.PlainArrow;
			Sprite arrowImgHover = LMAssets.PlainArrowHover;
			Rimg.sprite = arrowImg;
			EventTrigger val3 = val.AddComponent<EventTrigger>();
			Entry val4 = new Entry();
			val4.eventID = (EventTriggerType)0;
			((UnityEvent<BaseEventData>)(object)val4.callback).AddListener((UnityAction<BaseEventData>)delegate
			{
				Rimg.sprite = arrowImgHover;
			});
			Entry val5 = new Entry();
			val5.eventID = (EventTriggerType)1;
			((UnityEvent<BaseEventData>)(object)val5.callback).AddListener((UnityAction<BaseEventData>)delegate
			{
				Rimg.sprite = arrowImg;
			});
			val3.triggers.Add(val4);
			val3.triggers.Add(val5);
			ButtonClickedEvent onClick = val2.onClick;
			object obj = <>c.<>9__19_2;
			if (obj == null)
			{
				UnityAction val6 = delegate
				{
					Minimap.SwitchPlayerButton(forward: true);
				};
				<>c.<>9__19_2 = val6;
				obj = (object)val6;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(32f, 32f);
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(0f, 0f);
			component.pivot = new Vector2(0f, 1f);
			component.anchoredPosition = new Vector2(80f, 0f);
			((Transform)component).rotation = Quaternion.Euler(0f, 0f, 90f);
		}

		private static void CreateLightSabotage()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_00a0: 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_00c5: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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_011c: 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: Expected O, but got Unknown
			if (Roles.CurrentRole != null && Roles.CurrentRole.Type == Roles.RoleType.employee)
			{
				return;
			}
			GameObject val = new GameObject("LightSwitchBtn");
			val.transform.SetParent(minimap.transform, false);
			Button val2 = val.AddComponent<Button>();
			lightIcon = val.AddComponent<Image>();
			Sprite baseImg = LMAssets.LightSwitch;
			Sprite imgHover = LMAssets.LightSwitchHover;
			Sprite imgSelect = LMAssets.LightSwitchSelect;
			lightIcon.sprite = baseImg;
			EventTrigger val3 = val.AddComponent<EventTrigger>();
			Entry val4 = new Entry();
			val4.eventID = (EventTriggerType)0;
			((UnityEvent<BaseEventData>)(object)val4.callback).AddListener((UnityAction<BaseEventData>)delegate
			{
				lightIcon.sprite = ((!Sabotage.generatorFixed || Sabotage.fogTimerStarted) ? imgSelect : imgHover);
			});
			Entry val5 = new Entry();
			val5.eventID = (EventTriggerType)1;
			((UnityEvent<BaseEventData>)(object)val5.callback).AddListener((UnityAction<BaseEventData>)delegate
			{
				lightIcon.sprite = ((!Sabotage.generatorFixed || Sabotage.fogTimerStarted) ? imgSelect : baseImg);
			});
			val3.triggers.Add(val4);
			val3.triggers.Add(val5);
			ButtonClickedEvent onClick = val2.onClick;
			object obj = <>c.<>9__20_2;
			if (obj == null)
			{
				UnityAction val6 = delegate
				{
					Generator.BreakGenerator();
				};
				<>c.<>9__20_2 = val6;
				obj = (object)val6;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(32f, 32f);
			component.anchorMin = new Vector2(1f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(1f, 1f);
			component.anchoredPosition = new Vector2(-3f, -8f);
			allMinimapObjects.Add(val);
		}

		private static GameObject CreateMapList()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_003f: 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)
			//IL_007a: 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_00a6: 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_00e3: 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)
			GameObject val = new GameObject("MapList");
			val.transform.SetParent(border.transform, false);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = new Color(0.4627f, 0f, 0f, 1f);
			val.layer = 5;
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(140f, 300f);
			component.anchoredPosition = new Vector2(0f, 0f);
			component.anchorMin = new Vector2(0f, 0.5f);
			component.anchorMax = new Vector2(0f, 0.5f);
			component.pivot = new Vector2(1f, 0.5f);
			Outline val3 = val.AddComponent<Outline>();
			((Shadow)val3).effectColor = new Color(0.996f, 0.095f, 0f, 1f);
			((Shadow)val3).effectDistance = new Vector2(2f, 2f);
			val.AddComponent<Mask>();
			slotObjects.Clear();
			CreatePlayerList(val);
			return val;
		}

		private static void CreatePlayerList(GameObject voteList)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("PlayerList");
			val.transform.SetParent(voteList.transform, false);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = new Color(0.4627f, 0f, 0f, 1f);
			val.layer = 5;
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(250f, 230f);
			ScrollRect val3 = val.AddComponent<ScrollRect>();
			val3.horizontal = false;
			val3.content = CreatePlayerSlotHolder(val);
			val.AddComponent<Mask>();
		}

		private static RectTransform CreatePlayerSlotHolder(GameObject playerList)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0047: 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_0096: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			SlotHolder = new GameObject("PlayerSlotHolder");
			SlotHolder.transform.SetParent(playerList.transform, false);
			Image val = SlotHolder.AddComponent<Image>();
			((Graphic)val).color = new Color(0.4627f, 0f, 0f, 1f);
			SlotHolder.layer = 5;
			slotRect = SlotHolder.GetComponent<RectTransform>();
			slotRect.sizeDelta = new Vector2(250f, 30f);
			slotRect.anchorMin = new Vector2(0f, 1f);
			slotRect.anchorMax = new Vector2(1f, 1f);
			slotRect.pivot = new Vector2(0.5f, 1f);
			GridLayoutGroup val2 = SlotHolder.AddComponent<GridLayoutGroup>();
			val2.cellSize = new Vector2(245f, 50f);
			((LayoutGroup)val2).childAlignment = (TextAnchor)1;
			val2.constraint = (Constraint)1;
			val2.constraintCount = 1;
			return slotRect;
		}

		public static void CreatePlayerSlot(ulong playerID, Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_003f: 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)
			//IL_007a: 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_00a6: 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_00cc: 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_00f6: 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)
			GameObject val = new GameObject("playerSlot");
			val.transform.SetParent(SlotHolder.transform, false);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = new Color(1f, 0f, 0f, 0f);
			val.layer = 5;
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(200f, 30f);
			component.anchoredPosition = new Vector2(10f, 0f);
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(0f, 1f);
			component.pivot = new Vector2(0f, 1f);
			float x = slotRect.sizeDelta.x;
			float num = slotRect.sizeDelta.y + 55f;
			slotRect.sizeDelta = new Vector2(x, num);
			PlayerSlot playerSlot = val.AddComponent<PlayerSlot>();
			playerSlot.playerID = playerID;
			playerSlot.playerSlot = val;
			GameObject val3 = NameTagBg(val);
			NameTag(val3, playerID);
			PositionText(val3, playerID, position);
			slotObjects.Add(val);
		}

		private static GameObject NameTagBg(GameObject playerSlot)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0046: 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_0077: 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_00a3: 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)
			GameObject val = GameObject.Find("Systems/UI/Canvas");
			GameObject val2 = new GameObject("nametag");
			val2.transform.SetParent(playerSlot.transform, false);
			Image val3 = val2.AddComponent<Image>();
			((Graphic)val3).color = new Color(0.6509f, 0.2091f, 0.0031f, 1f);
			val2.layer = 5;
			RectTransform component = val2.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(75f, 40f);
			component.anchoredPosition = Vector2.zero;
			component.anchorMax = new Vector2(1f, 0f);
			component.anchorMin = new Vector2(0.5f, 0f);
			component.pivot = new Vector2(1f, 0f);
			return val2;
		}

		private static void NameTag(GameObject nametagBG, ulong playerID)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0052: 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_0099: 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_010f: 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_0130: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Expected O, but got Unknown
			GameObject val = new GameObject("username");
			val.transform.SetParent(nametagBG.transform, false);
			TextMeshProUGUI text = val.AddComponent<TextMeshProUGUI>();
			((Graphic)text).color = new Color(1f, 0.5897f, 0f, 1f);
			((TMP_Text)text).fontSize = 16f;
			((TMP_Text)text).alignment = (TextAlignmentOptions)513;
			((TMP_Text)text).margin = Vector4.op_Implicit(new Vector3(8f, 0f, 0f));
			((TMP_Text)text).overflowMode = (TextOverflowModes)1;
			((TMP_Text)text).text = $"#{playerID} {StartOfRound.Instance.allPlayerScripts[(uint)playerID].playerUsername}";
			val.layer = 5;
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(180f, 20f);
			component.ancho