Decompiled source of GameMaster v3.2.0

GameMaster3.2Public.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyTestMod.Component;
using Steamworks.Data;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LethalCompanyTestMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalCompanyTestMod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d4f6b961-e8ae-4e4b-950c-37644e42d4ca")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalCompanyTestMod
{
	[BepInPlugin("Posiedon.GameMaster", "Lethal Company GameMaster", "1.0.0.0")]
	public class TestMod : BaseUnityPlugin
	{
		private const string modGUID = "Posiedon.GameMaster";

		private const string modName = "Lethal Company GameMaster";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Posiedon.GameMaster");

		public static Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> levelEnemySpawns;

		public static Dictionary<SpawnableEnemyWithRarity, int> enemyRaritys;

		public static Dictionary<SpawnableEnemyWithRarity, AnimationCurve> enemyPropCurves;

		public static ManualLogSource mls;

		private static ConfigEntry<string> ServerName;

		private static ConfigEntry<string> RoundPost;

		private static ConfigEntry<string> PrefixSetting;

		private static ConfigEntry<bool> ShouldEnemiesSpawnNaturally;

		private static ConfigEntry<float> SpringSpeed;

		private static ConfigEntry<float> PopUpTimer;

		private static ConfigEntry<float> MaxJesterSpeed;

		private static ConfigEntry<float> CrankingTimer;

		private static ConfigEntry<float> JesterResetTimer;

		private static ConfigEntry<int> MinScrap;

		private static ConfigEntry<int> MaxScrap;

		private static ConfigEntry<int> MinScrapValue;

		private static ConfigEntry<int> MaxScrapValue;

		private static ConfigEntry<bool> HideCommandMessages;

		private static ConfigEntry<bool> HideEnemySpawnMessages;

		private static ConfigEntry<bool> EnableInfiniteSprint;

		private static ConfigEntry<bool> EnableInfiniteCredits;

		private static ConfigEntry<bool> EnableInfiniteDeadline;

		private static ConfigEntry<int> XPChange;

		private static ConfigEntry<bool> CustomCompanyBuyRate;

		private static ConfigEntry<bool> UseRandomBuyRate;

		private static ConfigEntry<float> MinimumCompanyBuyRate;

		private static ConfigEntry<float> MaximumCompanyBuyRate;

		private static ConfigEntry<bool> CustomTimeScale;

		private static ConfigEntry<bool> UseRandomTimeScale;

		private static ConfigEntry<float> MinimumTimeScale;

		private static ConfigEntry<float> MaximumTimeScale;

		private static ConfigEntry<bool> CustomDeadline;

		private static ConfigEntry<bool> UseRandomDeadline;

		private static ConfigEntry<int> MinimumDeadline;

		private static ConfigEntry<int> MaximumDeadline;

		private static ConfigEntry<bool> SpawnSelectedEnemy;

		private static ConfigEntry<string> SelectedEnemy;

		private static ConfigEntry<bool> cfgNightVision;

		private static ConfigEntry<bool> cfgSpeedHack;

		private static ConfigEntry<bool> cfgGodMode;

		private static ConfigEntry<bool> EnableAIModifiers;

		private static ConfigEntry<bool> EnableScrapModifiers;

		private static SelectableLevel currentLevel;

		private static EnemyVent[] currentLevelVents;

		private static RoundManager currentRound;

		private static SpawnableEnemyWithRarity jesterRef;

		private static GUILoader myGUI;

		private static bool noClipEnabled;

		private static bool enableGod;

		private static bool nightVision;

		private static PlayerControllerB playerRef;

		private static bool speedHack;

		private static float nightVisionIntensity;

		private static float nightVisionRange;

		private static Color nightVisionColor;

		private static bool hasGUISynced;

		private static bool isHost;

		private static TestMod Instance;

		private static bool fullRegen;

		private void Awake()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0072: 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)
			Instance = this;
			mls = Logger.CreateLogSource("GameMaster");
			mls.LogInfo((object)"Loaded GameMaster. Patching.");
			harmony.PatchAll(typeof(TestMod));
			mls = ((BaseUnityPlugin)this).Logger;
			enemyRaritys = new Dictionary<SpawnableEnemyWithRarity, int>();
			levelEnemySpawns = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>();
			enemyPropCurves = new Dictionary<SpawnableEnemyWithRarity, AnimationCurve>();
			GameObject val = new GameObject("GUILoader");
			Object.DontDestroyOnLoad((Object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<GUILoader>();
			myGUI = (GUILoader)(object)val.GetComponent("GUILoader");
			SetBindings();
			setGUIVars();
			noClipEnabled = false;
			enableGod = false;
			SceneManager.activeSceneChanged += SceneManagerOnactiveSceneChanged;
		}

		private void setGUIVars()
		{
			myGUI.guiHideCommandMessage = HideCommandMessages.Value;
			myGUI.guiHideEnemySpawnMessages = HideEnemySpawnMessages.Value;
			myGUI.guiShouldEnemiesSpawnNaturally = ShouldEnemiesSpawnNaturally.Value;
			myGUI.guiEnableAIModifiers = EnableAIModifiers.Value;
			myGUI.guiEnableInfiniteSprint = EnableInfiniteSprint.Value;
			myGUI.guiEnableInfiniteCredits = EnableInfiniteCredits.Value;
			myGUI.guiEnableGod = cfgGodMode.Value;
			myGUI.guiEnableNightVision = cfgNightVision.Value;
			myGUI.guiEnableSpeedHack = cfgSpeedHack.Value;
			myGUI.guiEnableScrapModifiers = EnableScrapModifiers.Value;
			myGUI.guiEnableCustomBuyRate = CustomCompanyBuyRate.Value;
			myGUI.guiUseRandomBuyRate = UseRandomBuyRate.Value;
			myGUI.guiUseCustomTimeScale = CustomTimeScale.Value;
			myGUI.guiUseRandomTimeScale = UseRandomTimeScale.Value;
			myGUI.guiEnableInfiniteDeadline = EnableInfiniteDeadline.Value;
			myGUI.guiEnableCustomDeadline = CustomDeadline.Value;
			myGUI.guiUseRandomDeadline = UseRandomDeadline.Value;
			myGUI.guiServerName = ServerName.Value;
			myGUI.guiRoundPost = RoundPost.Value;
			myGUI.guiXPChange = XPChange.Value.ToString();
			myGUI.guiSelectedEnemy = SelectedEnemy.Value;
			myGUI.guiPrefix = PrefixSetting.Value;
			myGUI.guiMinScrap = MinScrap.Value;
			myGUI.guiMaxScrap = MaxScrap.Value;
			myGUI.guiMinScrapValue = MinScrapValue.Value;
			myGUI.guiMaxScrapValue = MaxScrapValue.Value;
			myGUI.guiMinimumDeadline = MinimumDeadline.Value;
			myGUI.guiMaximumDeadline = MaximumDeadline.Value;
			myGUI.guiSpringSpeed = SpringSpeed.Value;
			myGUI.guiPopupTimer = PopUpTimer.Value;
			myGUI.guiMaxJesterSpeed = MaxJesterSpeed.Value;
			myGUI.guiCrankingTimer = CrankingTimer.Value;
			myGUI.guiJesterResetTimer = JesterResetTimer.Value;
			myGUI.guiMinTimeScale = MinimumTimeScale.Value;
			myGUI.guiMaxTimeScale = MaximumTimeScale.Value;
			myGUI.guiMinBuyRate = MinimumCompanyBuyRate.Value;
			myGUI.guiMaxBuyRate = MaximumCompanyBuyRate.Value;
			hasGUISynced = true;
		}

		private void UpdateCFGVarsFromGUI()
		{
			if (!hasGUISynced)
			{
				setGUIVars();
			}
			HideCommandMessages.Value = myGUI.guiHideCommandMessage;
			HideEnemySpawnMessages.Value = myGUI.guiHideEnemySpawnMessages;
			ShouldEnemiesSpawnNaturally.Value = myGUI.guiShouldEnemiesSpawnNaturally;
			EnableAIModifiers.Value = myGUI.guiEnableAIModifiers;
			EnableInfiniteSprint.Value = myGUI.guiEnableInfiniteSprint;
			EnableInfiniteCredits.Value = myGUI.guiEnableInfiniteCredits;
			cfgGodMode.Value = myGUI.guiEnableGod;
			cfgNightVision.Value = myGUI.guiEnableNightVision;
			cfgSpeedHack.Value = myGUI.guiEnableSpeedHack;
			EnableScrapModifiers.Value = myGUI.guiEnableScrapModifiers;
			CustomCompanyBuyRate.Value = myGUI.guiEnableCustomBuyRate;
			UseRandomBuyRate.Value = myGUI.guiUseRandomBuyRate;
			CustomTimeScale.Value = myGUI.guiUseCustomTimeScale;
			UseRandomTimeScale.Value = myGUI.guiUseRandomTimeScale;
			EnableInfiniteDeadline.Value = myGUI.guiEnableInfiniteDeadline;
			CustomDeadline.Value = myGUI.guiEnableCustomDeadline;
			UseRandomDeadline.Value = myGUI.guiUseRandomDeadline;
			ServerName.Value = myGUI.guiServerName;
			RoundPost.Value = myGUI.guiRoundPost;
			XPChange.Value = int.Parse(myGUI.guiXPChange);
			SelectedEnemy.Value = myGUI.guiSelectedEnemy;
			PrefixSetting.Value = myGUI.guiPrefix;
			MinScrap.Value = myGUI.guiMinScrap;
			MaxScrap.Value = myGUI.guiMaxScrap;
			MinScrapValue.Value = myGUI.guiMinScrapValue;
			MaxScrapValue.Value = myGUI.guiMaxScrapValue;
			MinimumDeadline.Value = myGUI.guiMinimumDeadline;
			MaximumDeadline.Value = myGUI.guiMaximumDeadline;
			SpringSpeed.Value = myGUI.guiSpringSpeed;
			PopUpTimer.Value = myGUI.guiPopupTimer;
			MaxJesterSpeed.Value = myGUI.guiMaxJesterSpeed;
			CrankingTimer.Value = myGUI.guiCrankingTimer;
			JesterResetTimer.Value = myGUI.guiJesterResetTimer;
			MinimumTimeScale.Value = myGUI.guiMinTimeScale;
			MaximumTimeScale.Value = myGUI.guiMaxTimeScale;
			MinimumCompanyBuyRate.Value = myGUI.guiMinBuyRate;
			MaximumCompanyBuyRate.Value = myGUI.guiMaxBuyRate;
		}

		private void Update()
		{
		}

		private void SetBindings()
		{
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Expected O, but got Unknown
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Expected O, but got Unknown
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Expected O, but got Unknown
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Expected O, but got Unknown
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: Expected O, but got Unknown
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Expected O, but got Unknown
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Expected O, but got Unknown
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Expected O, but got Unknown
			ServerName = ((BaseUnityPlugin)this).Config.Bind<string>("Server Settings", "Server Name", "", "Set the server name when creating a server");
			RoundPost = ((BaseUnityPlugin)this).Config.Bind<string>("Server Settings", "Round Comment", "", "A message that the server sends every round");
			HideCommandMessages = ((BaseUnityPlugin)this).Config.Bind<bool>("Command Settings", "Hide Spawn Messages", true, "Should the server hide your commands? true will hide, false will show");
			HideEnemySpawnMessages = ((BaseUnityPlugin)this).Config.Bind<bool>("Command Settings", "Hide Enemy Spawn Messages", true, "Should the server hide messages an enemy may send when it spawns? true will hide, false will show.");
			PrefixSetting = ((BaseUnityPlugin)this).Config.Bind<string>("Command Settings", "Command Prefix", "/", "An optional prefix for chat commands");
			ShouldEnemiesSpawnNaturally = ((BaseUnityPlugin)this).Config.Bind<bool>("AI Settings", "Natural enemy spawn", true, "If true, enemies will spawn naturally. If false, enemies will spawn only when told to by this script.");
			SpringSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("AI Settings", "Spring Head - Speed", 100f, new ConfigDescription("Base speed for springhead", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 150f), Array.Empty<object>()));
			PopUpTimer = ((BaseUnityPlugin)this).Config.Bind<float>("AI Settings", "Jester - PopUp", 0.5f, new ConfigDescription("How long it takes the jester to popup", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 100f), Array.Empty<object>()));
			MaxJesterSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("AI Settings", "Jester - Max Speed Multiplier", 5f, new ConfigDescription("The maximum speed the jester can go, multiplier", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			CrankingTimer = ((BaseUnityPlugin)this).Config.Bind<float>("AI Settings", "Jester - Cranking", 0.5f, new ConfigDescription("The time it takes the jester to begin cranking", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 100f), Array.Empty<object>()));
			JesterResetTimer = ((BaseUnityPlugin)this).Config.Bind<float>("AI Settings", "Jester - Reset", 5000f, new ConfigDescription("The time it takes for the jester to reset when no one is in the building", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 5000f), Array.Empty<object>()));
			EnableAIModifiers = ((BaseUnityPlugin)this).Config.Bind<bool>("AI Settings", "Enable AI modifiers", false, "If enabled, the server will override the AI settings, if disabled, it will use default settings.");
			SpawnSelectedEnemy = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Spawning", "Spawn Selected enemy", false, "On click, this will spawn the selected enemy then get set back to false. Only to be used with configuration manager.");
			SelectedEnemy = ((BaseUnityPlugin)this).Config.Bind<string>("Enemy Spawning", "Name of Enemy", "Spring", "Enter the name of the enemy you'd like to spawn. Can be partial, use the github or web to find a list of names. Only to be used with configuration manager.");
			XPChange = ((BaseUnityPlugin)this).Config.Bind<int>("Host Settings", "XP Change", 25, "Sets the amount of XP to additionally gain or lose. Can be negative.");
			EnableInfiniteSprint = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Settings", "Enable infinite sprint", true, "If true, stamina will never deplete, if false, stamina will work as normal.");
			EnableInfiniteCredits = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Settings", "Enable infinite credits", false, "If true, credits will always revert back to the preset value.  If false, they will work as normal.");
			cfgGodMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Settings", "Enable God Mode", false, "If true, you cannot die. *note if you fall down into a pit you may not be able to get out. Disabling will not kill you immediately.");
			cfgNightVision = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Settings", "Enable Night Vision", false, "If true, you will be able to see in the dark");
			cfgSpeedHack = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Settings", "Enable Speed Hack", false, "If true, will enable the built in speed hack, it's very fast.");
			cfgGodMode.SettingChanged += godModeCFGChanged;
			cfgNightVision.SettingChanged += nightVisionCFGChanged;
			cfgSpeedHack.SettingChanged += speedHackCFGChanged;
			EnableScrapModifiers = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Settings", "Enable Scrap mofifiers", false, "If enabled, will use our scrap modifiers, if disabled, will use the game generated scrap settings");
			MinScrap = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap Settings", "Minimum Scap", 20, "Set the minimum pieces of scrap in the level");
			MaxScrap = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap Settings", "Maximum Scap", 45, "Set the maximum pieces of scrap in the level");
			MinScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap Settings", "Minimum Scap value", 3000, "Set the minimum value of scrap in the level");
			MaxScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap Settings", "Maximum Scap value", 8000, "Set the maximum value of scrap in the level");
			CustomCompanyBuyRate = ((BaseUnityPlugin)this).Config.Bind<bool>("Company Scrap Buying Settings", "Override Company Buying Rate", false, "Recommended if using infinite deadline, overrides in game calculation of the company buy rate if true to use our method.");
			UseRandomBuyRate = ((BaseUnityPlugin)this).Config.Bind<bool>("Company Scrap Buying Settings", "Make custom buying rate Random", false, "If true, will pick a random value in between your minimum and maximum buy rate every day. If false, will use your MAXIMUM buying rate settting.");
			MinimumCompanyBuyRate = ((BaseUnityPlugin)this).Config.Bind<float>("Company Scrap Buying Settings", "Minimum buying rate", 0.1f, new ConfigDescription("Minimum buy rate for random", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 10f), Array.Empty<object>()));
			MaximumCompanyBuyRate = ((BaseUnityPlugin)this).Config.Bind<float>("Company Scrap Buying Settings", "Maximum buying rate", 1f, new ConfigDescription("Maximum buy rate for random, OR if random is off, the buy rate used every day", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 10f), Array.Empty<object>()));
			CustomTimeScale = ((BaseUnityPlugin)this).Config.Bind<bool>("Time Settings", "Override day speed", false, "If true, will use either random speed multiplier between min and max, or if random is turned off, the maximum");
			UseRandomTimeScale = ((BaseUnityPlugin)this).Config.Bind<bool>("Time Settings", "Make day speed random", false, "If true, will pick a random multiplier between the minimum and maximum, if false, will use maximum");
			MinimumTimeScale = ((BaseUnityPlugin)this).Config.Bind<float>("Time Settings", "Minimum day speed", 0.1f, new ConfigDescription("Minimum speed for random day length", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			MaximumTimeScale = ((BaseUnityPlugin)this).Config.Bind<float>("Time Settings", "Maximum day speed", 1f, new ConfigDescription("Maximum speed for random day length, or the set value if not random", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			EnableInfiniteDeadline = ((BaseUnityPlugin)this).Config.Bind<bool>("Deadline settings", "Enable infinite deadline", false, "If true, the deadline will never go down and will always stay at 8 days. If false, it will drop like normal. Overrides custom deadline.");
			CustomDeadline = ((BaseUnityPlugin)this).Config.Bind<bool>("Deadline settings", "Override deadline", false, "If true, will use either a random deadline between the min and max, or if random is truned off, the maximum.");
			UseRandomDeadline = ((BaseUnityPlugin)this).Config.Bind<bool>("Deadline settings", "Use random deadline", false, "If true, will use a randomy deadline between the minimum and maximum. If false, will use maximum.");
			MinimumDeadline = ((BaseUnityPlugin)this).Config.Bind<int>("Deadline settings", "Minimum deadline", 1, new ConfigDescription("Minimum amount of days for random deadline", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()));
			MaximumDeadline = ((BaseUnityPlugin)this).Config.Bind<int>("Deadline settings", "Maximum deadline", 3, new ConfigDescription("Maximum amount of days for random deadline, or the set value if not random", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()));
		}

		private void speedHackCFGChanged(object sender, EventArgs e)
		{
			if (isHost)
			{
				toggleSpeedHack();
			}
		}

		private void nightVisionCFGChanged(object sender, EventArgs e)
		{
			if (isHost)
			{
				nightVision = cfgNightVision.Value;
			}
		}

		private void godModeCFGChanged(object sender, EventArgs e)
		{
			if (isHost)
			{
				enableGod = cfgGodMode.Value;
			}
		}

		public void EnableNoClip()
		{
			if (!isHost)
			{
				return;
			}
			noClipEnabled = !noClipEnabled;
			mls.LogInfo((object)"noclip function called");
			if (noClipEnabled)
			{
				Collider[] array = Object.FindObjectsByType<Collider>((FindObjectsInactive)0, (FindObjectsSortMode)0);
				for (int i = 0; i < array.Length; i++)
				{
					array[i].enabled = false;
				}
			}
		}

		private static bool toggleNightVision()
		{
			if (isHost)
			{
				nightVision = !nightVision;
				cfgNightVision.Value = nightVision;
			}
			return nightVision;
		}

		private static bool toggleGodMode()
		{
			if (isHost)
			{
				enableGod = !enableGod;
				cfgGodMode.Value = enableGod;
			}
			return enableGod;
		}

		private static void toggleSpeedHack()
		{
			if (isHost)
			{
				speedHack = !playerRef.isSpeedCheating;
				playerRef.isSpeedCheating = speedHack;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPrefix]
		private static void patchControllerUpdate()
		{
			myGUI.guiIsHost = isHost;
			Instance.UpdateCFGVarsFromGUI();
			if (myGUI.shouldSpawnEnemy)
			{
				myGUI.shouldSpawnEnemy = false;
				mls.LogInfo((object)"Spawn an enemy");
				SpawnEnemyWithConfigManager(myGUI.guiSelectedEnemy);
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Start")]
		[HarmonyPrefix]
		private static void getNightVision(ref PlayerControllerB __instance)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			playerRef = __instance;
			nightVision = ((Behaviour)playerRef.nightVision).enabled;
			nightVisionIntensity = playerRef.nightVision.intensity;
			nightVisionColor = playerRef.nightVision.color;
			nightVisionRange = playerRef.nightVision.range;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "SetNightVisionEnabled")]
		[HarmonyPostfix]
		private static void updateNightVision()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (nightVision)
			{
				GameNetworkManager.Instance.localPlayerController.nightVision.color = Color.white;
				GameNetworkManager.Instance.localPlayerController.nightVision.intensity = 1000f;
				GameNetworkManager.Instance.localPlayerController.nightVision.range = 10000f;
			}
			else
			{
				GameNetworkManager.Instance.localPlayerController.nightVision.color = nightVisionColor;
				GameNetworkManager.Instance.localPlayerController.nightVision.intensity = nightVisionIntensity;
				GameNetworkManager.Instance.localPlayerController.nightVision.range = nightVisionRange;
			}
			((Behaviour)GameNetworkManager.Instance.localPlayerController.nightVision).enabled = true;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "AllowPlayerDeath")]
		[HarmonyPrefix]
		private static bool OverrideDeath()
		{
			if (isHost)
			{
				return !enableGod;
			}
			return true;
		}

		[HarmonyPatch(typeof(Terminal), "RunTerminalEvents")]
		[HarmonyPostfix]
		private static void NeverLoseCredits(ref int ___groupCredits)
		{
			if (isHost && EnableInfiniteCredits.Value)
			{
				___groupCredits = 50000;
			}
		}

		[HarmonyPatch(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyCreated")]
		[HarmonyPrefix]
		private static void UpdateServerSettings(ref HostSettings ___lobbyHostSettings, ref Lobby lobby)
		{
			if (ServerName.Value != "")
			{
				___lobbyHostSettings.lobbyName = ServerName.Value;
			}
		}

		[HarmonyPatch(typeof(TimeOfDay), "MoveGlobalTime")]
		[HarmonyPostfix]
		private static void InfiniteDeadline(ref float ___timeUntilDeadline)
		{
			if (isHost && EnableInfiniteDeadline.Value)
			{
				___timeUntilDeadline = 10000f;
			}
		}

		[HarmonyPatch(typeof(TimeOfDay), "SetBuyingRateForDay")]
		[HarmonyPostfix]
		private static void FixScrapBuyingRate()
		{
			if (isHost && CustomCompanyBuyRate.Value)
			{
				float companyBuyingRate = MaximumCompanyBuyRate.Value;
				if (UseRandomBuyRate.Value)
				{
					companyBuyingRate = Random.Range(MinimumCompanyBuyRate.Value, MaximumCompanyBuyRate.Value);
				}
				StartOfRound.Instance.companyBuyingRate = companyBuyingRate;
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPrefix]
		private static bool patchDeadline()
		{
			if (isHost)
			{
				if (CustomDeadline.Value)
				{
					TimeOfDay.Instance.quotaVariables.deadlineDaysAmount = MaximumDeadline.Value;
					if (UseRandomDeadline.Value)
					{
						TimeOfDay.Instance.quotaVariables.deadlineDaysAmount = Random.Range(MinimumDeadline.Value, MaximumDeadline.Value);
					}
				}
				return true;
			}
			return false;
		}

		[HarmonyPatch(typeof(TimeOfDay), "Start")]
		[HarmonyPostfix]
		private static void customizableTimeScale(TimeOfDay __instance)
		{
			if (isHost && CustomTimeScale.Value)
			{
				__instance.globalTimeSpeedMultiplier = MaximumTimeScale.Value;
				if (UseRandomTimeScale.Value)
				{
					__instance.globalTimeSpeedMultiplier = Random.Range(MinimumTimeScale.Value, MaximumTimeScale.Value);
				}
			}
		}

		[HarmonyPatch(typeof(HUDManager), "SetPlayerLevelSmoothly")]
		[HarmonyPrefix]
		private static void OverrideXPGain(ref int XPGain)
		{
			if (isHost)
			{
				XPGain += XPChange.Value;
			}
		}

		[HarmonyPatch(typeof(RoundManager), "Start")]
		[HarmonyPrefix]
		private static void setIsHost()
		{
			mls.LogInfo((object)("Host Status: " + ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost));
			isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost;
		}

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPrefix]
		private static bool ModifyLevel(ref SelectableLevel newLevel)
		{
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Expected O, but got Unknown
			currentRound = RoundManager.Instance;
			if (!levelEnemySpawns.ContainsKey(newLevel))
			{
				List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
				foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
				{
					list.Add(enemy);
				}
				levelEnemySpawns.Add(newLevel, list);
			}
			levelEnemySpawns.TryGetValue(newLevel, out var value);
			newLevel.Enemies = value;
			foreach (SpawnableEnemyWithRarity enemy2 in newLevel.Enemies)
			{
				mls.LogInfo((object)("Inside: " + enemy2.enemyType.enemyName));
				if (!enemyRaritys.ContainsKey(enemy2))
				{
					enemyRaritys.Add(enemy2, enemy2.rarity);
				}
				int value2 = 0;
				enemyRaritys.TryGetValue(enemy2, out value2);
				enemy2.rarity = value2;
			}
			foreach (SpawnableEnemyWithRarity outsideEnemy in newLevel.OutsideEnemies)
			{
				mls.LogInfo((object)("Outside: " + outsideEnemy.enemyType.enemyName));
				if (!enemyRaritys.ContainsKey(outsideEnemy))
				{
					enemyRaritys.Add(outsideEnemy, outsideEnemy.rarity);
				}
				int value3 = 0;
				enemyRaritys.TryGetValue(outsideEnemy, out value3);
				outsideEnemy.rarity = value3;
			}
			foreach (SpawnableEnemyWithRarity enemy3 in newLevel.Enemies)
			{
				if (!enemyPropCurves.ContainsKey(enemy3))
				{
					enemyPropCurves.Add(enemy3, enemy3.enemyType.probabilityCurve);
				}
				AnimationCurve value4 = new AnimationCurve();
				enemyPropCurves.TryGetValue(enemy3, out value4);
				enemy3.enemyType.probabilityCurve = value4;
			}
			HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
			if (RoundPost.Value != "")
			{
				HUDManager.Instance.AddTextToChatOnServer(RoundPost.Value, -1);
			}
			GameObject.Find("/JesterEnemy");
			if (!ShouldEnemiesSpawnNaturally.Value)
			{
				bool flag = false;
				foreach (SpawnableEnemyWithRarity enemy4 in newLevel.Enemies)
				{
					enemy4.rarity = 0;
					if (enemy4.enemyType.enemyName.ToLower().Contains("jester"))
					{
						mls.LogInfo((object)"Found a jester, yoinking that reference");
						flag = true;
						jesterRef = enemy4;
					}
				}
				if (!flag)
				{
					if (jesterRef != null)
					{
						mls.LogInfo((object)"Didn't find a jester, but we can use the ref");
						newLevel.Enemies.Add(jesterRef);
					}
					else
					{
						mls.LogInfo((object)"We couldn't add a jester to this level");
					}
				}
				foreach (SpawnableEnemyWithRarity outsideEnemy2 in newLevel.OutsideEnemies)
				{
					outsideEnemy2.rarity = 0;
				}
			}
			SelectableLevel val = newLevel;
			if (EnableScrapModifiers.Value)
			{
				val.minScrap = MinScrap.Value;
				val.maxScrap = MaxScrap.Value;
				val.minTotalScrapValue = MinScrapValue.Value;
				val.maxTotalScrapValue = MaxScrapValue.Value;
			}
			SpawnableMapObject[] spawnableMapObjects = val.spawnableMapObjects;
			for (int i = 0; i < spawnableMapObjects.Length; i++)
			{
			}
			newLevel = val;
			return true;
		}

		[HarmonyPatch(typeof(RoundManager), "AdvanceHourAndSpawnNewBatchOfEnemies")]
		[HarmonyPrefix]
		private static void updateCurrentLevelInfo(ref EnemyVent[] ___allEnemyVents, ref SelectableLevel ___currentLevel)
		{
			currentLevel = ___currentLevel;
			currentLevelVents = ___allEnemyVents;
		}

		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		[HarmonyPrefix]
		private static void GameMasterCommands(HUDManager __instance)
		{
			string text = __instance.chatTextField.text;
			string text2 = "/";
			mls.LogInfo((object)text);
			if (PrefixSetting.Value != "")
			{
				text2 = PrefixSetting.Value;
			}
			if (text.ToLower().StartsWith(text2.ToLower()))
			{
				ProcessCommandInput(__instance.chatTextField.text);
				if (HideCommandMessages.Value)
				{
					__instance.chatTextField.text = "";
				}
			}
		}

		private static void SpawnEnemyWithConfigManager(string enemyName)
		{
			if (!isHost)
			{
				return;
			}
			mls.LogInfo((object)"CFGMGR tried to spawn an enemy");
			bool flag = false;
			foreach (SpawnableEnemyWithRarity enemy in currentLevel.Enemies)
			{
				if (enemy.enemyType.enemyName.ToLower().Contains(enemyName.ToLower()))
				{
					try
					{
						flag = true;
						_ = enemy.enemyType.enemyName;
						SpawnEnemy(enemy, 1, inside: true);
						mls.LogInfo((object)("Spawned " + enemy.enemyType.enemyName));
					}
					catch
					{
						mls.LogInfo((object)"Could not spawn enemy");
					}
					break;
				}
			}
			if (flag)
			{
				return;
			}
			foreach (SpawnableEnemyWithRarity outsideEnemy in currentLevel.OutsideEnemies)
			{
				if (outsideEnemy.enemyType.enemyName.ToLower().Contains(enemyName.ToLower()))
				{
					try
					{
						flag = true;
						_ = outsideEnemy.enemyType.enemyName;
						mls.LogInfo((object)outsideEnemy.enemyType.enemyName);
						mls.LogInfo((object)("The index of " + outsideEnemy.enemyType.enemyName + " is " + currentLevel.OutsideEnemies.IndexOf(outsideEnemy)));
						SpawnEnemy(outsideEnemy, 1, inside: false);
						mls.LogInfo((object)("Spawned " + outsideEnemy.enemyType.enemyName));
						break;
					}
					catch (Exception ex)
					{
						mls.LogInfo((object)"Could not spawn enemy");
						mls.LogInfo((object)("The game tossed an error: " + ex.Message));
						break;
					}
				}
			}
		}

		private static void SpawnEnemy(SpawnableEnemyWithRarity enemy, int amount, bool inside)
		{
			//IL_0128: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			if (!isHost)
			{
				return;
			}
			mls.LogInfo((object)"Got to the main SpawnEnemy function");
			if (inside)
			{
				try
				{
					for (int i = 0; i < amount; i++)
					{
						currentRound.SpawnEnemyOnServer(currentRound.allEnemyVents[Random.Range(0, currentRound.allEnemyVents.Length)].floorNode.position, currentRound.allEnemyVents[i].floorNode.eulerAngles.y, currentLevel.Enemies.IndexOf(enemy));
					}
					return;
				}
				catch
				{
					mls.LogInfo((object)"Failed to spawn enemies, check your command.");
					return;
				}
			}
			for (int j = 0; j < amount; j++)
			{
				mls.LogInfo((object)$"You wanted to spawn: {amount} enemies");
				mls.LogInfo((object)("Spawned an enemy. Total Spawned: " + j));
				Object.Instantiate<GameObject>(currentLevel.OutsideEnemies[currentLevel.OutsideEnemies.IndexOf(enemy)].enemyType.enemyPrefab, GameObject.FindGameObjectsWithTag("OutsideAINode")[Random.Range(0, GameObject.FindGameObjectsWithTag("OutsideAINode").Length - 1)].transform.position, Quaternion.Euler(Vector3.zero)).gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
			}
		}

		[HarmonyPatch(typeof(RoundManager), "SpawnEnemyFromVent")]
		[HarmonyPrefix]
		private static void logSpawnEnemyFromVent()
		{
			mls.LogInfo((object)"Attempting to spawn an enemy");
		}

		[HarmonyPatch(typeof(RoundManager), "EnemyCannotBeSpawned")]
		[HarmonyPrefix]
		private static bool OverrideCannotSpawn()
		{
			return false;
		}

		[HarmonyPatch(typeof(DressGirlAI), "Start")]
		[HarmonyPrefix]
		private static void IncreaseHaunt(ref float ___hauntInterval)
		{
			if (isHost && EnableAIModifiers.Value)
			{
				___hauntInterval = 2f;
				if (!HideEnemySpawnMessages.Value)
				{
					HUDManager.Instance.AddTextToChatOnServer("<color=red>Demon spawned.</color>", -1);
				}
			}
		}

		[HarmonyPatch(typeof(DressGirlAI), "BeginChasing")]
		[HarmonyPostfix]
		private static void IncreaseChaseTimer(ref int ___currentBehaviourStateIndex, ref float ___chaseTimer)
		{
			if (isHost && EnableAIModifiers.Value)
			{
				___chaseTimer = 60f;
			}
		}

		[HarmonyPatch(typeof(SpringManAI), "Update")]
		[HarmonyPrefix]
		private static void IncreaseSpring(ref float ___currentChaseSpeed, ref float ___currentAnimSpeed)
		{
			if (isHost && !EnableAIModifiers.Value)
			{
				___currentChaseSpeed = SpringSpeed.Value;
			}
		}

		[HarmonyPatch(typeof(JesterAI), "SetJesterInitialValues")]
		[HarmonyPostfix]
		private static void JesterDangerous(ref float ___popUpTimer, ref float ___beginCrankingTimer, ref float ___noPlayersToChaseTimer, ref float ___maxAnimSpeed)
		{
			if (EnableAIModifiers.Value && isHost)
			{
				___popUpTimer = PopUpTimer.Value;
				___beginCrankingTimer = CrankingTimer.Value;
				___noPlayersToChaseTimer = JesterResetTimer.Value;
				___maxAnimSpeed = MaxJesterSpeed.Value;
				if (!HideEnemySpawnMessages.Value)
				{
					HUDManager.Instance.AddTextToChatOnServer("<color=blue>Boing.</color>", -1);
				}
			}
		}

		[HarmonyPatch(typeof(JesterAI), "Update")]
		[HarmonyPrefix]
		private static void RemoveRewind(ref float ___noPlayersToChaseTimer)
		{
			if (EnableAIModifiers.Value && isHost)
			{
				___noPlayersToChaseTimer = JesterResetTimer.Value;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		private static void InfiniteSprint(ref float ___sprintMeter)
		{
			if (EnableInfiniteSprint.Value)
			{
				Mathf.Clamp(___sprintMeter += 0.02f, 0f, 1f);
			}
		}

		[HarmonyPatch(typeof(CrawlerAI), "HitEnemy")]
		[HarmonyPrefix]
		private static void PatchThumperDeath()
		{
		}

		[HarmonyPatch(typeof(CrawlerAI), "Start")]
		[HarmonyPrefix]
		private static void ThumperSpeed(ref float ___agentSpeedWithNegative, ref float ___maxSearchAndRoamRadius)
		{
			if (EnableAIModifiers.Value && isHost)
			{
				___maxSearchAndRoamRadius = 300f;
				if (!HideEnemySpawnMessages.Value)
				{
					HUDManager.Instance.AddTextToChatOnServer("<color=red> >:) </color>", -1);
				}
			}
		}

		private static void RunTerminal()
		{
			Terminal val = Object.FindObjectOfType<Terminal>();
			if (!((Object)(object)val == (Object)null) && !val.terminalInUse)
			{
				val.BeginUsingTerminal();
				HUDManager.Instance.ChangeControlTip(0, string.Empty, true);
			}
		}

		private void SceneManagerOnactiveSceneChanged(Scene arg0, Scene arg1)
		{
			Terminal val = Object.FindObjectOfType<Terminal>();
			if (!((Object)(object)val == (Object)null))
			{
				val.terminalUIScreen.renderMode = (RenderMode)0;
				Canvas terminalUIScreen = val.terminalUIScreen;
				terminalUIScreen.scaleFactor += 1.35f;
			}
		}

		[HarmonyPatch(typeof(ManualCameraRenderer), "MeetsCameraEnabledConditions")]
		[HarmonyPrefix]
		private static bool MeetsCameraEnabledConditions(ref bool __result)
		{
			__result = true;
			return false;
		}

		[HarmonyPatch(typeof(Terminal), "QuitTerminal")]
		[HarmonyPostfix]
		private static void ReturnPlayerControl()
		{
			GameNetworkManager.Instance.localPlayerController.inSpecialInteractAnimation = false;
		}

		public static void ProcessCommandInput(string text)
		{
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_065a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca3: Unknown result type (might be due to invalid IL or missing references)
			string text2 = "/";
			mls.LogInfo((object)text);
			if (PrefixSetting.Value != "")
			{
				text2 = PrefixSetting.Value;
			}
			if (!text.ToLower().StartsWith(text2.ToLower()))
			{
				return;
			}
			string text3 = "Default Title";
			string text4 = "Default Body";
			if (!isHost)
			{
				text3 = "Command";
				text4 = "Unable to send command since you are not host.";
				HUDManager.Instance.DisplayTip(text3, text4, false, false, "LC_Tip1");
				_ = HideCommandMessages.Value;
				return;
			}
			if (text.ToLower().StartsWith(text2 + "spawn"))
			{
				text3 = "Spawned Enemies";
				string[] array = text.Split(new char[1] { ' ' });
				if (array.Length == 2)
				{
					bool flag = false;
					string text5 = "";
					foreach (SpawnableEnemyWithRarity enemy in currentLevel.Enemies)
					{
						if (enemy.enemyType.enemyName.ToLower().Contains(array[1].ToLower()))
						{
							try
							{
								flag = true;
								text5 = enemy.enemyType.enemyName;
								SpawnEnemy(enemy, 1, inside: true);
								mls.LogInfo((object)("Spawned " + enemy.enemyType.enemyName));
							}
							catch
							{
								mls.LogInfo((object)"Could not spawn enemy");
							}
							text4 = "Spawned: " + text5;
							break;
						}
					}
					if (!flag)
					{
						foreach (SpawnableEnemyWithRarity outsideEnemy in currentLevel.OutsideEnemies)
						{
							if (outsideEnemy.enemyType.enemyName.ToLower().Contains(array[1].ToLower()))
							{
								try
								{
									flag = true;
									text5 = outsideEnemy.enemyType.enemyName;
									mls.LogInfo((object)outsideEnemy.enemyType.enemyName);
									mls.LogInfo((object)("The index of " + outsideEnemy.enemyType.enemyName + " is " + currentLevel.OutsideEnemies.IndexOf(outsideEnemy)));
									SpawnEnemy(outsideEnemy, 1, inside: false);
									mls.LogInfo((object)("Spawned " + outsideEnemy.enemyType.enemyName));
								}
								catch (Exception ex)
								{
									mls.LogInfo((object)"Could not spawn enemy");
									mls.LogInfo((object)("The game tossed an error: " + ex.Message));
								}
								text4 = "Spawned: " + text5;
								break;
							}
						}
					}
				}
				if (array.Length > 2)
				{
					bool flag2 = false;
					if (int.TryParse(array[2], out var result))
					{
						string text6 = "";
						foreach (SpawnableEnemyWithRarity enemy2 in currentLevel.Enemies)
						{
							if (enemy2.enemyType.enemyName.ToLower().Contains(array[1].ToLower()))
							{
								flag2 = true;
								text6 = enemy2.enemyType.enemyName;
								SpawnEnemy(enemy2, result, inside: true);
								if (flag2)
								{
									text4 = "Spawned " + result + " " + text6 + "s";
									break;
								}
							}
						}
						if (!flag2)
						{
							foreach (SpawnableEnemyWithRarity outsideEnemy2 in currentLevel.OutsideEnemies)
							{
								if (outsideEnemy2.enemyType.enemyName.ToLower().Contains(array[1].ToLower()))
								{
									flag2 = true;
									text6 = outsideEnemy2.enemyType.enemyName;
									try
									{
										mls.LogInfo((object)("The index of " + outsideEnemy2.enemyType.enemyName + " is " + currentLevel.OutsideEnemies.IndexOf(outsideEnemy2)));
										SpawnEnemy(outsideEnemy2, result, inside: false);
										mls.LogInfo((object)("Spawned another " + outsideEnemy2.enemyType.enemyName));
									}
									catch
									{
										mls.LogInfo((object)"Failed to spawn enemies, check your command.");
									}
									if (flag2)
									{
										text4 = "Spawned " + result + " " + text6 + "s";
										break;
									}
								}
							}
						}
					}
					else
					{
						mls.LogInfo((object)"Failed to spawn enemies, check your command.");
					}
					mls.LogInfo((object)("Length of input array: " + array.Length));
				}
			}
			if (text.ToLower().StartsWith(text2 + "weather"))
			{
				text3 = "Weather Change";
				string[] array2 = text.Split(new char[1] { ' ' });
				if (array2.Length > 1)
				{
					if (array2[1].ToLower().Contains("rain"))
					{
						currentRound.timeScript.currentLevelWeather = (LevelWeatherType)1;
						mls.LogInfo((object)("tried to change the weather to " + array2[1]));
					}
					if (array2[1].ToLower().Contains("eclipse"))
					{
						currentRound.timeScript.currentLevelWeather = (LevelWeatherType)5;
						mls.LogInfo((object)("tried to change the weather to " + array2[1]));
					}
					if (array2[1].ToLower().Contains("flood"))
					{
						currentRound.timeScript.currentLevelWeather = (LevelWeatherType)4;
						mls.LogInfo((object)("tried to change the weather to " + array2[1]));
					}
					if (array2[1].ToLower().Contains("dust") || array2[1].ToLower().Contains("fog") || array2[1].ToLower().Contains("mist"))
					{
						currentRound.timeScript.currentLevelWeather = (LevelWeatherType)0;
						mls.LogInfo((object)("tried to change the weather to " + array2[1]));
					}
					if (array2[1].ToLower().Contains("storm"))
					{
						currentRound.timeScript.currentLevelWeather = (LevelWeatherType)2;
						mls.LogInfo((object)("tried to change the weather to " + array2[1]));
					}
					if (array2[1].ToLower().Contains("none"))
					{
						currentRound.timeScript.currentLevelWeather = (LevelWeatherType)(-1);
						mls.LogInfo((object)("tried to change the weather to " + array2[1]));
					}
					text4 = "tried to change the weather to " + array2[1];
				}
			}
			if (text.ToLower().StartsWith(text2 + "togglelights"))
			{
				BreakerBox val = Object.FindObjectOfType<BreakerBox>();
				if ((Object)(object)val != (Object)null)
				{
					text3 = "Light Change";
					if (val.isPowerOn)
					{
						currentRound.TurnBreakerSwitchesOff();
						currentRound.TurnOnAllLights(false);
						val.isPowerOn = false;
						text4 = "Turned the lights off";
					}
					else
					{
						currentRound.PowerSwitchOnClientRpc();
						text4 = "Turned the lights on";
					}
				}
			}
			if (text.ToLower().StartsWith(text2 + "buy"))
			{
				text3 = "Item Buying";
				Terminal val2 = Object.FindObjectOfType<Terminal>();
				if ((Object)(object)val2 != (Object)null)
				{
					List<string> list = new List<string>
					{
						"Walkie-Talkie", "Pro Flashlight", "Normal Flashlight", "Shovel", "Lockpicker", "Stun Grenade", "Boom Box", "Inhaler", "Stun Gun", "Jet Pack",
						"Extension Ladder", "Radar Booster"
					};
					Dictionary<string, int> dictionary = new Dictionary<string, int>
					{
						{ "Walkie-Talkie", 0 },
						{ "Pro Flashlight", 4 },
						{ "Normal Flashlight", 1 },
						{ "Shovel", 2 },
						{ "Lockpicker", 3 },
						{ "Stun Grenade", 5 },
						{ "Boom Box", 6 },
						{ "Inhaler", 7 },
						{ "Stun Gun", 8 },
						{ "Jet Pack", 9 },
						{ "Extension Ladder", 10 },
						{ "Radar Booster", 11 }
					};
					string[] array3 = text.Split(new char[1] { ' ' });
					if (array3.Length > 1)
					{
						bool flag3 = false;
						if (array3.Length > 2)
						{
							if (!int.TryParse(array3[2], out var result2))
							{
								mls.LogInfo((object)("Couldn't parse command [ " + array3[2] + " ]"));
								_ = HideCommandMessages.Value;
								return;
							}
							foreach (string item in list)
							{
								if (item.ToLower().Contains(array3[1]))
								{
									flag3 = true;
									List<int> list2 = new List<int>();
									for (int i = 0; i < result2; i++)
									{
										list2.Add(dictionary[item]);
									}
									val2.BuyItemsServerRpc(list2.ToArray(), val2.groupCredits, 0);
									text4 = "Bought " + result2 + " " + item + "s";
									break;
								}
							}
							if (!flag3)
							{
								mls.LogInfo((object)("Couldn't figure out what [ " + array3[1] + " ] was."));
								_ = HideCommandMessages.Value;
								return;
							}
						}
						if (!flag3)
						{
							bool flag4 = false;
							foreach (string item2 in list)
							{
								if (item2.ToLower().Contains(array3[1]))
								{
									flag4 = true;
									int[] array4 = new int[1] { dictionary[item2] };
									val2.BuyItemsServerRpc(array4, val2.groupCredits, 0);
									text4 = "Bought " + 1 + " " + item2;
								}
							}
							if (!flag4)
							{
								mls.LogInfo((object)("Couldn't figure out what [ " + array3[1] + " ] was. Trying via int parser."));
							}
							if (!int.TryParse(array3[1], out var result3))
							{
								mls.LogInfo((object)("Couldn't figure out what [ " + array3[1] + " ] was. Int parser failed, please try again."));
								_ = HideCommandMessages.Value;
								return;
							}
							int[] array5 = new int[1] { result3 };
							val2.BuyItemsServerRpc(array5, val2.groupCredits, 0);
							text4 = "Bought item with ID [" + result3 + "]";
						}
					}
				}
			}
			if (text.ToLower().Contains("god"))
			{
				cfgGodMode.Value = !cfgGodMode.Value;
				hasGUISynced = false;
				text3 = "God Mode";
				text4 = "God Mode set to: " + enableGod;
			}
			if (text.ToLower().Contains("night") || text.ToLower().Contains("vision"))
			{
				text4 = ((!toggleNightVision()) ? "Disabled Night Vision" : "Enabled Night Vision");
				text3 = "Night Vision";
				hasGUISynced = false;
			}
			if (text.ToLower().Contains("speed"))
			{
				cfgSpeedHack.Value = !cfgSpeedHack.Value;
				hasGUISynced = false;
				text4 = "Speed hack set to: " + speedHack;
				text3 = "Speed hack";
			}
			if (text.ToLower().Contains("morehelp"))
			{
				text3 = "More Commands";
				text4 = "/tp - Teleports you to the terminal in your ship, keeping all items on you! \n /enemies - See all enemies available to spawn.";
			}
			if (text.ToLower().Contains("help"))
			{
				text3 = "Commands";
				text4 = "/vision or /night - Toggles Night Vision \n /buy item - Buy an item \n /god - Toggle GodMode \n /speed - Toggle SpeedHack \n /togglelights - Toggle all lights inside building \n /weather weatherName - Attempt to change weather \n /spawn enemyName - Attempt to spawn an enemy \n /morehelp - see more commands";
			}
			if (text.ToLower().Contains("tp"))
			{
				string[] array6 = text.Split(new char[1] { ' ' });
				if (array6.Length > 1)
				{
					string value = array6[1].ToLower();
					PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val3 in allPlayerScripts)
					{
						if (val3.playerUsername.ToLower().Contains(value))
						{
							GameNetworkManager.Instance.localPlayerController.beamUpParticle.Play();
							GameNetworkManager.Instance.localPlayerController.beamOutBuildupParticle.Play();
							GameNetworkManager.Instance.localPlayerController.TeleportPlayer(((Component)val3).transform.position, false, 0f, false, true);
						}
					}
				}
				else
				{
					Terminal val4 = Object.FindObjectOfType<Terminal>();
					if ((Object)(object)val4 != (Object)null)
					{
						GameNetworkManager.Instance.localPlayerController.beamUpParticle.Play();
						GameNetworkManager.Instance.localPlayerController.beamOutBuildupParticle.Play();
						GameNetworkManager.Instance.localPlayerController.TeleportPlayer(((Component)val4).transform.position, false, 0f, false, true);
					}
				}
			}
			if (text.ToLower().Contains("enemies"))
			{
				text3 = "Enemies:";
				text4 = "Inside: Girl, Lasso, Bunker Spider, Centipede, \nBlob, Flowerman, Spring, Crawler, Hoarding bug, \nJester, Puffer\nOutside: ForestGiant, MouthDog, Earth Leviathan, Baboon Bird";
			}
			if (text.ToLower().Contains("term"))
			{
				Terminal val5 = Object.FindObjectOfType<Terminal>();
				if ((Object)(object)val5 == (Object)null)
				{
					return;
				}
				if (!val5.terminalInUse)
				{
					val5.BeginUsingTerminal();
					HUDManager.Instance.ChangeControlTip(0, string.Empty, true);
					GameNetworkManager.Instance.localPlayerController.inSpecialInteractAnimation = true;
					text3 = "Began using terminal";
					text4 = " ";
				}
			}
			if (text.ToLower().Contains("regen"))
			{
				fullRegen = !fullRegen;
				text3 = "Regen to max health?";
				text4 = fullRegen.ToString();
			}
			HUDManager.Instance.DisplayTip(text3, text4, false, false, "LC_Tip1");
			_ = HideCommandMessages.Value;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
		[HarmonyPrefix]
		private static bool LateUpdate()
		{
			if (fullRegen && GameNetworkManager.Instance.localPlayerController.health < 100)
			{
				if (GameNetworkManager.Instance.localPlayerController.healthRegenerateTimer <= 0f)
				{
					GameNetworkManager.Instance.localPlayerController.healthRegenerateTimer = 1f;
					PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
					localPlayerController.health++;
					if (GameNetworkManager.Instance.localPlayerController.health >= 20)
					{
						GameNetworkManager.Instance.localPlayerController.MakeCriticallyInjured(false);
					}
					HUDManager.Instance.UpdateHealthUI(GameNetworkManager.Instance.localPlayerController.health, false);
					return true;
				}
				PlayerControllerB localPlayerController2 = GameNetworkManager.Instance.localPlayerController;
				localPlayerController2.healthRegenerateTimer -= Time.deltaTime;
			}
			return true;
		}
	}
}
namespace LethalCompanyTestMod.Component
{
	internal class GUILoader : MonoBehaviour
	{
		private KeyboardShortcut openCloseMenu;

		private bool isMenuOpen;

		public bool noClipButton;

		internal bool wasKeyDown;

		private int toolbarInt;

		private string[] toolbarStrings = new string[5] { "AI Modification/Spawning", "Host Settings", "Time Settings", "Scrap Settings", "CMD" };

		private int MENUWIDTH = 600;

		private int MENUHEIGHT = 800;

		private int MENUX;

		private int MENUY;

		private int ITEMWIDTH = 300;

		private int CENTERX;

		public bool guiHideCommandMessage;

		public bool guiHideEnemySpawnMessages;

		public bool guiShouldEnemiesSpawnNaturally;

		public bool guiEnableAIModifiers;

		public bool guiEnableInfiniteSprint;

		public bool guiEnableInfiniteCredits;

		public bool guiEnableGod;

		public bool guiEnableNightVision;

		public bool guiEnableSpeedHack;

		public bool guiEnableScrapModifiers;

		public bool guiEnableCustomBuyRate;

		public bool guiUseRandomBuyRate;

		public bool guiUseCustomTimeScale;

		public bool guiUseRandomTimeScale;

		public bool guiEnableInfiniteDeadline;

		public bool guiEnableCustomDeadline;

		public bool guiUseRandomDeadline;

		public bool guiSpawnButtonPressed;

		public string guiServerName;

		public string guiRoundPost;

		public string guiXPChange;

		public string guiSelectedEnemy;

		public string guiPrefix;

		public int guiMinScrap;

		public int guiMaxScrap;

		public int guiMinScrapValue;

		public int guiMaxScrapValue;

		public int guiMinimumDeadline;

		public int guiMaximumDeadline;

		public float guiSpringSpeed;

		public float guiPopupTimer;

		public float guiMaxJesterSpeed;

		public float guiCrankingTimer;

		public float guiJesterResetTimer;

		public float guiMinTimeScale;

		public float guiMaxTimeScale;

		public float guiMinBuyRate;

		public float guiMaxBuyRate;

		private GUIStyle menuStyle;

		private GUIStyle buttonStyle;

		private GUIStyle labelStyle;

		private GUIStyle toggleStyle;

		private GUIStyle hScrollStyle;

		public bool guiIsHost;

		internal bool shouldSpawnEnemy;

		private GUIStyle boldLabelStyle;

		private GUIStyle regularLabelStyle;

		private Vector2 scrollPosition;

		private void Awake()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			TestMod.mls.LogInfo((object)"GUILoader loaded.");
			openCloseMenu = new KeyboardShortcut((KeyCode)277, Array.Empty<KeyCode>());
			isMenuOpen = false;
			MENUX = Screen.width / 2;
			MENUY = Screen.height / 2;
			CENTERX = MENUX + (MENUWIDTH / 2 - ITEMWIDTH / 2);
		}

		private Texture2D MakeTex(int width, int height, Color col)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0034: Expected O, but got Unknown
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = col;
			}
			Texture2D val = new Texture2D(width, height);
			val.SetPixels(array);
			val.Apply();
			return val;
		}

		private void intitializeMenu()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_007f: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			if (menuStyle == null)
			{
				menuStyle = new GUIStyle(GUI.skin.box);
				buttonStyle = new GUIStyle(GUI.skin.button);
				labelStyle = new GUIStyle(GUI.skin.label);
				toggleStyle = new GUIStyle(GUI.skin.toggle);
				hScrollStyle = new GUIStyle(GUI.skin.horizontalSlider);
				menuStyle.normal.textColor = Color.white;
				menuStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.01f, 0.1f, 0.9f));
				menuStyle.fontSize = 18;
				((Object)menuStyle.normal.background).hideFlags = (HideFlags)61;
				buttonStyle.normal.textColor = Color.white;
				buttonStyle.fontSize = 18;
				labelStyle.normal.textColor = Color.white;
				labelStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.01f, 0.1f, 0.9f));
				labelStyle.fontSize = 18;
				labelStyle.alignment = (TextAnchor)4;
				((Object)labelStyle.normal.background).hideFlags = (HideFlags)61;
				toggleStyle.normal.textColor = Color.white;
				toggleStyle.fontSize = 18;
				hScrollStyle.normal.textColor = Color.white;
				hScrollStyle.normal.background = MakeTex(2, 2, new Color(0f, 0f, 0.2f, 0.9f));
				((Object)hScrollStyle.normal.background).hideFlags = (HideFlags)61;
			}
		}

		public void OnDestroy()
		{
			TestMod.mls.LogInfo((object)"The GUILoader was destroyed :(");
		}

		public void onSpawnClicked()
		{
			shouldSpawnEnemy = true;
		}

		public void Update()
		{
			if (((KeyboardShortcut)(ref openCloseMenu)).IsDown() && !wasKeyDown)
			{
				wasKeyDown = true;
			}
			if (((KeyboardShortcut)(ref openCloseMenu)).IsUp() && wasKeyDown)
			{
				wasKeyDown = false;
				isMenuOpen = !isMenuOpen;
				if (isMenuOpen)
				{
					Cursor.visible = true;
					Cursor.lockState = (CursorLockMode)2;
				}
				else
				{
					Cursor.visible = false;
				}
			}
		}

		public void OnGUI()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0574: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0615: Unknown result type (might be due to invalid IL or missing references)
			//IL_0656: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0719: Unknown result type (might be due to invalid IL or missing references)
			//IL_075b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0799: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0817: Unknown result type (might be due to invalid IL or missing references)
			//IL_085d: Unknown result type (might be due to invalid IL or missing references)
			//IL_089e: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0926: Unknown result type (might be due to invalid IL or missing references)
			//IL_0967: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c76: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cbc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cfd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f64: Unknown result type (might be due to invalid IL or missing references)
			if (!guiIsHost)
			{
				return;
			}
			if (menuStyle == null)
			{
				intitializeMenu();
			}
			if (!isMenuOpen)
			{
				return;
			}
			GUI.Box(new Rect((float)MENUX, (float)MENUY, (float)MENUWIDTH, (float)MENUHEIGHT), "GameMaster", menuStyle);
			toolbarInt = GUI.Toolbar(new Rect((float)MENUX, (float)(MENUY - 30), (float)MENUWIDTH, 30f), toolbarInt, toolbarStrings, buttonStyle);
			switch (toolbarInt)
			{
			case 0:
				guiSelectedEnemy = GUI.TextField(new Rect((float)(MENUX + (MENUWIDTH / 2 - ITEMWIDTH)), (float)(MENUY + 30), (float)ITEMWIDTH, 30f), guiSelectedEnemy);
				if (GUI.Button(new Rect((float)(MENUX + MENUWIDTH / 2), (float)(MENUY + 30), (float)ITEMWIDTH, 30f), "Spawn Enemy", buttonStyle))
				{
					onSpawnClicked();
				}
				guiSpringSpeed = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), guiSpringSpeed, 0.1f, 150f);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "Speed of the CoilHead " + guiSpringSpeed, labelStyle);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 200), (float)ITEMWIDTH, 30f), "Jester Popup speed " + guiPopupTimer, labelStyle);
				guiPopupTimer = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 230), (float)ITEMWIDTH, 30f), guiPopupTimer, 0.1f, 100f);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 270), (float)ITEMWIDTH, 30f), "Jester cranking speed " + guiCrankingTimer, labelStyle);
				guiCrankingTimer = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 300), (float)ITEMWIDTH, 30f), guiCrankingTimer, 0.1f, 10f);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 340), (float)ITEMWIDTH, 30f), "Jester reset speed " + guiJesterResetTimer, labelStyle);
				guiJesterResetTimer = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 370), (float)ITEMWIDTH, 30f), guiJesterResetTimer, 5f, 5000f);
				guiEnableAIModifiers = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 410), (float)ITEMWIDTH, 30f), guiEnableAIModifiers, "Enable AI Modifications", toggleStyle);
				guiShouldEnemiesSpawnNaturally = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 440), (float)ITEMWIDTH, 30f), guiShouldEnemiesSpawnNaturally, "Should Enemies Spawn Naturally", toggleStyle);
				break;
			case 1:
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 30), (float)ITEMWIDTH, 30f), "Server Name", labelStyle);
				guiServerName = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 60), (float)ITEMWIDTH, 30f), guiServerName);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 100), (float)ITEMWIDTH, 30f), "Server Message", labelStyle);
				guiRoundPost = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), guiRoundPost);
				guiHideCommandMessage = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 170), (float)ITEMWIDTH, 30f), guiHideCommandMessage, "Hide Command Messages", toggleStyle);
				guiHideEnemySpawnMessages = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 200), (float)ITEMWIDTH, 30f), guiHideEnemySpawnMessages, "Hide Enemy Spawn Messages", toggleStyle);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 230), (float)ITEMWIDTH, 30f), "Command Prefix", labelStyle);
				guiPrefix = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 260), (float)ITEMWIDTH, 30f), guiPrefix);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 300), (float)ITEMWIDTH, 30f), "XP Change", labelStyle);
				guiXPChange = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 330), (float)ITEMWIDTH, 30f), guiXPChange);
				guiEnableInfiniteSprint = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 360), (float)ITEMWIDTH, 30f), guiEnableInfiniteSprint, "Infinite Sprint", toggleStyle);
				guiEnableInfiniteCredits = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 390), (float)ITEMWIDTH, 30f), guiEnableInfiniteCredits, "Infinite Credits", toggleStyle);
				guiEnableGod = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 420), (float)ITEMWIDTH, 30f), guiEnableGod, "God Mode", toggleStyle);
				guiEnableNightVision = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 450), (float)ITEMWIDTH, 30f), guiEnableNightVision, "NightVision", toggleStyle);
				guiEnableSpeedHack = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 480), (float)ITEMWIDTH, 30f), guiEnableSpeedHack, "SpeedHack", toggleStyle);
				break;
			case 2:
				guiEnableInfiniteDeadline = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 30), (float)(ITEMWIDTH + 100), 30f), guiEnableInfiniteDeadline, "Infinite Deadline(overrides all deadline settings)", toggleStyle);
				guiEnableCustomDeadline = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 60), (float)ITEMWIDTH, 30f), guiEnableCustomDeadline, "Custom Deadline", toggleStyle);
				guiUseRandomDeadline = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 90), (float)ITEMWIDTH, 30f), guiUseRandomDeadline, "Random Deadline", toggleStyle);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "Minimum Deadline " + guiMinimumDeadline, labelStyle);
				guiMinimumDeadline = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), (float)guiMinimumDeadline, 1f, 20f);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 200), (float)ITEMWIDTH, 30f), "Maximum Deadline " + guiMaximumDeadline, labelStyle);
				guiMaximumDeadline = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 230), (float)ITEMWIDTH, 30f), (float)guiMaximumDeadline, 1f, 20f);
				guiUseCustomTimeScale = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 270), (float)ITEMWIDTH, 30f), guiUseCustomTimeScale, "Custom Timescale", toggleStyle);
				guiUseRandomTimeScale = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 300), (float)ITEMWIDTH, 30f), guiUseRandomTimeScale, "Random Timescale", toggleStyle);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 330), (float)ITEMWIDTH, 30f), "Minimum Timescale " + guiMinTimeScale, labelStyle);
				guiMinTimeScale = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 360), (float)ITEMWIDTH, 30f), guiMinTimeScale, 0.1f, 10f);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 400), (float)ITEMWIDTH, 30f), "Maximum Timescale " + guiMaxTimeScale, labelStyle);
				guiMaxTimeScale = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 430), (float)ITEMWIDTH, 30f), guiMaxTimeScale, 0.1f, 10f);
				break;
			case 3:
				guiEnableCustomBuyRate = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 30), (float)ITEMWIDTH, 30f), guiEnableCustomBuyRate, "Custom Buyrate", toggleStyle);
				guiUseRandomBuyRate = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 60), (float)ITEMWIDTH, 30f), guiUseRandomBuyRate, "Random Buyrate", toggleStyle);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 110), (float)ITEMWIDTH, 30f), "Min Buy Rate " + guiMinBuyRate, labelStyle);
				guiMinBuyRate = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 140), (float)ITEMWIDTH, 30f), guiMinBuyRate, -1f, 10f);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 180), (float)ITEMWIDTH, 30f), "Max Buy Rate " + guiMaxBuyRate, labelStyle);
				guiMaxBuyRate = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 210), (float)ITEMWIDTH, 30f), guiMaxBuyRate, -1f, 10f);
				guiEnableScrapModifiers = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 260), (float)ITEMWIDTH, 30f), guiEnableScrapModifiers, "Enable Scrap Modifiers", toggleStyle);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 310), (float)ITEMWIDTH, 30f), "Minimum Amount of Scrap " + guiMinScrap, labelStyle);
				guiMinScrap = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 340), (float)ITEMWIDTH, 30f), (float)guiMinScrap, 0f, 500f);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 380), (float)ITEMWIDTH, 30f), "Maximum Amount of Scrap " + guiMaxScrap, labelStyle);
				guiMaxScrap = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 410), (float)ITEMWIDTH, 30f), (float)guiMaxScrap, 0f, 500f);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 450), (float)ITEMWIDTH, 30f), "Min Scrap Value " + guiMinScrapValue, labelStyle);
				guiMinScrapValue = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 480), (float)ITEMWIDTH, 30f), (float)guiMinScrapValue, 0f, 100000f);
				GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 520), (float)ITEMWIDTH, 30f), "Max Scrap Value " + guiMaxScrapValue, labelStyle);
				guiMaxScrapValue = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 550), (float)ITEMWIDTH, 30f), (float)guiMaxScrapValue, 0f, 100000f);
				break;
			case 4:
			{
				Rect val = default(Rect);
				((Rect)(ref val))..ctor((float)MENUX, (float)MENUY, (float)MENUWIDTH, (float)MENUHEIGHT);
				GUILayout.BeginArea(val, menuStyle);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				guiSelectedEnemy = GUILayout.TextField(guiSelectedEnemy, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Height(30f),
					GUILayout.MaxWidth(((Rect)(ref val)).width - 110f)
				});
				if (GUILayout.Button("Enter", (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(100f),
					GUILayout.Height(30f)
				}))
				{
					ProcessCommand(guiSelectedEnemy);
					guiSelectedEnemy = "";
				}
				GUILayout.EndHorizontal();
				float num = ((Rect)(ref val)).height - 60f;
				scrollPosition = GUILayout.BeginScrollView(scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(((Rect)(ref val)).width),
					GUILayout.Height(num)
				});
				InitializeGUIStyles();
				GUILayout.Label("Inside:", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("Girl, Lasso, Bunker Spider, Centipede, Blob, Flowerman, Spring, Crawler, Hoarding bug, Jester, Puffer, Nutcracker", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("Outside:", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("ForestGiant, MouthDog, Earth Leviathan, Baboon Bird, Masked", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/tp", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- Teleports you to the terminal in your ship, keeping all items on you!", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/tp playerName", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- Teleports you to another player, keeping all items on you!", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/enemies", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- See all enemies available to spawn", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/vision or /night", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- Toggles Night Vision", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/buy item", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- Buy an item", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/god", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- Toggle GodMode", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/speed", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- Toggle SpeedHack", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/togglelights", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- Toggle all lights inside building", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/weather weatherName", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- Attempt to change weather", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/spawn enemyName", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- Attempt to spawn an enemy", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/morehelp", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("- See more commands", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("/regen", boldLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("Toggle the ability to passively regen to max health.", regularLabelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.EndScrollView();
				GUILayout.EndArea();
				break;
			}
			}
		}

		private void InitializeGUIStyles()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			boldLabelStyle = new GUIStyle(GUI.skin.label);
			boldLabelStyle.fontStyle = (FontStyle)1;
			boldLabelStyle.fontSize = 24;
			regularLabelStyle = new GUIStyle(GUI.skin.label);
			regularLabelStyle.alignment = (TextAnchor)3;
			regularLabelStyle.wordWrap = true;
			regularLabelStyle.fontSize = 20;
		}

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