Decompiled source of ChatCommands v1.1.92

ChatCommands.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ChatCommands;
using ChatCommands.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ChatCommands")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChatCommands")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d9d7c116-3da7-4a2a-8b87-f83dac82c4cb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Networking
{
	public class CCMDNetworking : NetworkBehaviour
	{
		[SerializeField]
		private string netHostCommandPrefix = "[COMMAND]";

		[SerializeField]
		private string netCommandPostfix = "[/COMMAND]";

		public static CCMDNetworking instance;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Debug.LogWarning((object)"Multiple instances of CustomNetworkManager found!");
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		internal static void SendHostCommand(string commandInput)
		{
			if ((Object)(object)instance == (Object)null)
			{
				Debug.LogError((object)"CCMDNetworking instance is not initialized!");
				return;
			}
			string command = instance.netHostCommandPrefix + commandInput + instance.netCommandPostfix;
			global::ChatCommands.ChatCommands.DisplayChatMessage("Host Command: " + commandInput + "\nsending to clients via RPC");
			instance.RpcExecuteCommandOnClients(command);
		}

		[ClientRpc]
		private void RpcExecuteCommandOnClients(string command)
		{
			global::ChatCommands.ChatCommands.DisplayChatMessage("Client Command: " + command);
			global::ChatCommands.ChatCommands.ProcessNetHostCommand(command);
		}
	}
}
namespace ChatCommands
{
	public class Commands
	{
		public static string SetCustomDeadline(string text)
		{
			string[] array = text.Split(new char[1] { ' ' });
			if (array.Length > 1)
			{
				if (int.TryParse(array[1], out var result))
				{
					ChatCommands.CustomDeadline = result;
					ChatCommands.msgtitle = "Deadline";
					ChatCommands.msgbody = "Deadline set to: " + ChatCommands.CustomDeadline;
				}
				else
				{
					ChatCommands.CustomDeadline = int.MinValue;
					ChatCommands.msgtitle = "Deadline";
					ChatCommands.msgbody = "Deadline set to default";
				}
			}
			else
			{
				ChatCommands.CustomDeadline = int.MinValue;
				ChatCommands.msgtitle = "Deadline";
				ChatCommands.msgbody = "Deadline set to default";
			}
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string Teleport(string text)
		{
			//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_032f: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: 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)
			Vector3 val = Vector3.zero;
			string[] array = text.Split(new char[1] { ' ' });
			string text2 = "random";
			if (array.Length > 1)
			{
				if (array[1].ToLower().StartsWith("p="))
				{
					text2 = array[1].ToLower().Substring(2);
					if (text2 != "random")
					{
						val = CalculateSpawnPosition(text2);
						if (val == Vector3.zero && text2 != "random")
						{
							ChatCommands.mls.LogWarning((object)"Position Invalid, Using Default 'random'");
							text2 = "random";
						}
					}
					if (text2 == "random" && (Object)(object)ChatCommands.currentRound != (Object)null && (Object)(object)ChatCommands.currentLevel != (Object)null)
					{
						Random random = new Random(StartOfRound.Instance.randomMapSeed + 17 + (int)GameNetworkManager.Instance.localPlayerController.playerClientId);
						Vector3 position = RoundManager.Instance.insideAINodes[random.Next(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
						Debug.DrawRay(position, Vector3.up * 1f, Color.red);
						position = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), random, -1);
						Debug.DrawRay(position + Vector3.right * 0.01f, Vector3.up * 3f, Color.green);
						val = position;
					}
					GameNetworkManager.Instance.localPlayerController.beamUpParticle.Play();
					GameNetworkManager.Instance.localPlayerController.beamOutBuildupParticle.Play();
					GameNetworkManager.Instance.localPlayerController.TeleportPlayer(val, false, 0f, false, true);
					ChatCommands.msgtitle = "Teleported";
					ChatCommands.msgbody = "Teleported to " + text2;
				}
				else
				{
					string name = array[1].ToLower();
					name = ChatCommands.ConvertPlayername(name);
					PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
					PlayerControllerB[] array2 = allPlayerScripts;
					foreach (PlayerControllerB val2 in array2)
					{
						if (val2.playerUsername.ToLower().Contains(name))
						{
							GameNetworkManager.Instance.localPlayerController.beamUpParticle.Play();
							GameNetworkManager.Instance.localPlayerController.beamOutBuildupParticle.Play();
							GameNetworkManager.Instance.localPlayerController.TeleportPlayer(((Component)val2).transform.position, false, 0f, false, true);
							ChatCommands.msgtitle = "Teleported";
							ChatCommands.msgbody = "Teleported to Player:" + val2.playerUsername;
						}
					}
				}
			}
			else
			{
				Terminal val3 = Object.FindObjectOfType<Terminal>();
				if ((Object)(object)val3 != (Object)null)
				{
					GameNetworkManager.Instance.localPlayerController.beamUpParticle.Play();
					GameNetworkManager.Instance.localPlayerController.beamOutBuildupParticle.Play();
					GameNetworkManager.Instance.localPlayerController.TeleportPlayer(((Component)val3).transform.position, false, 0f, false, true);
					ChatCommands.msgtitle = "Teleported";
					ChatCommands.msgbody = "Teleported to Terminal";
				}
			}
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string SpawnEnemyFunc(string text)
		{
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: 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_0315: Unknown result type (might be due to invalid IL or missing references)
			ChatCommands.msgtitle = "Spawned Enemies";
			string[] array = text.Split(new char[1] { ' ' });
			if ((Object)(object)ChatCommands.currentLevel == (Object)null || ChatCommands.levelEnemySpawns == null || ChatCommands.currentLevel.Enemies == null)
			{
				ChatCommands.msgtitle = "Command";
				ChatCommands.msgbody = (((Object)(object)ChatCommands.currentLevel == (Object)null) ? "Unable to send command since currentLevel is null." : "Unable to send command since levelEnemySpawns is null.");
				ChatCommands.DisplayChatError(ChatCommands.msgtitle + "\n" + ChatCommands.msgbody);
				return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
			}
			if (array.Length < 2)
			{
				ChatCommands.msgtitle = "Command Error";
				ChatCommands.msgbody = "Missing Arguments For Spawn\n'/spawnenemy <name> (amount=<amount>) (state=<state>) (position={random, @me, @<playername>})";
				ChatCommands.DisplayChatError(ChatCommands.msgtitle + "\n" + ChatCommands.msgbody);
				ChatCommands.mls.LogWarning((object)"Missing Arguments For Spawn\n'/spawnenemy <name> (amount=<amount>) (state=<state>) (position={random, @me, @<playername>})");
				return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
			}
			int num = 1;
			string text2 = "alive";
			Vector3 val = Vector3.zero;
			string text3 = "random";
			IEnumerable<string> enumerable = array.Skip(2);
			foreach (string item in enumerable)
			{
				string[] array2 = item.Split(new char[1] { '=' });
				switch (array2[0])
				{
				case "a":
				case "amount":
					num = int.Parse(array2[1]);
					ChatCommands.mls.LogInfo((object)$"{num}");
					break;
				case "s":
				case "state":
					text2 = array2[1];
					ChatCommands.mls.LogInfo((object)text2);
					break;
				case "p":
				case "position":
					text3 = array2[1];
					ChatCommands.mls.LogInfo((object)text3);
					break;
				}
			}
			if (text3 != "random")
			{
				val = CalculateSpawnPosition(text3);
				if (val == Vector3.zero && text3 != "random")
				{
					ChatCommands.mls.LogWarning((object)"Position Invalid, Using Default 'random'");
					text3 = "random";
				}
			}
			if (array.Length > 1)
			{
				bool flag = false;
				string text4 = "";
				foreach (SpawnableEnemyWithRarity enemy in ChatCommands.currentLevel.Enemies)
				{
					if (!enemy.enemyType.enemyName.ToLower().Contains(array[1].ToLower()))
					{
						continue;
					}
					try
					{
						flag = true;
						text4 = enemy.enemyType.enemyName;
						if (text3 == "random")
						{
							ChatCommands.SpawnEnemy(enemy, num, inside: true, new Vector3(0f, 0f, 0f));
						}
						else
						{
							ChatCommands.SpawnEnemy(enemy, num, inside: true, val);
						}
						ChatCommands.mls.LogInfo((object)("Spawned " + enemy.enemyType.enemyName));
					}
					catch
					{
						ChatCommands.mls.LogInfo((object)"Could not spawn enemy");
					}
					ChatCommands.msgbody = "Spawned: " + text4;
					break;
				}
				if (!flag)
				{
					foreach (SpawnableEnemyWithRarity outsideEnemy in ChatCommands.currentLevel.OutsideEnemies)
					{
						if (!outsideEnemy.enemyType.enemyName.ToLower().Contains(array[1].ToLower()))
						{
							continue;
						}
						try
						{
							flag = true;
							text4 = outsideEnemy.enemyType.enemyName;
							ChatCommands.mls.LogInfo((object)outsideEnemy.enemyType.enemyName);
							ChatCommands.mls.LogInfo((object)("The index of " + outsideEnemy.enemyType.enemyName + " is " + ChatCommands.currentLevel.OutsideEnemies.IndexOf(outsideEnemy)));
							if (text3 == "random")
							{
								ChatCommands.SpawnEnemy(outsideEnemy, num, inside: false, new Vector3(0f, 0f, 0f));
							}
							else
							{
								ChatCommands.SpawnEnemy(outsideEnemy, num, inside: false, val);
							}
							ChatCommands.mls.LogInfo((object)("Spawned " + outsideEnemy.enemyType.enemyName));
						}
						catch (Exception ex)
						{
							ChatCommands.mls.LogInfo((object)"Could not spawn enemy");
							ChatCommands.mls.LogInfo((object)("The game tossed an error: " + ex.Message));
						}
						ChatCommands.msgbody = "Spawned " + num + " " + text4 + ((num > 1) ? "s" : "");
						break;
					}
				}
			}
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string ToggleLights()
		{
			BreakerBox val = Object.FindObjectOfType<BreakerBox>();
			if ((Object)(object)val != (Object)null)
			{
				ChatCommands.msgtitle = "Light Change";
				if (val.isPowerOn)
				{
					ChatCommands.currentRound.TurnBreakerSwitchesOff();
					ChatCommands.currentRound.TurnOnAllLights(false);
					val.isPowerOn = false;
					ChatCommands.msgbody = "Turned the lights off";
				}
				else
				{
					ChatCommands.currentRound.PowerSwitchOnClientRpc();
					ChatCommands.msgbody = "Turned the lights on";
				}
			}
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string SpawnMapObj(string text)
		{
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: 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)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ChatCommands.currentLevel == (Object)null || ChatCommands.currentRound.currentLevel.spawnableMapObjects == null)
			{
				ChatCommands.mls.LogWarning((object)"Unable to send command since currentLevel or spawnableMapObjects is null.");
				ChatCommands.msgtitle = "Command Error";
				ChatCommands.msgbody = "Unable to send command since currentLevel or spawnableMapObjects is null.";
				ChatCommands.DisplayChatError(ChatCommands.msgtitle + "\n" + ChatCommands.msgbody);
				return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
			}
			string[] array = text.Substring(1).Split(new char[1] { ' ' });
			if (array.Length < 2)
			{
				ChatCommands.mls.LogWarning((object)"Missing Arguments For Spawn\n'/spawnmapobj <name> (amount=<amount>) (position={random, @me, @<playername>})");
				ChatCommands.msgtitle = "Command Error";
				ChatCommands.msgbody = "Missing Arguments For Spawn\n'/spawnmapobj <name> (amount=<amount>) (position={random, @me, @<playername>})";
				ChatCommands.DisplayChatError(ChatCommands.msgtitle + "\n" + ChatCommands.msgbody);
				return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
			}
			string text2 = array[1].ToLower();
			int num = 1;
			Vector3 val = Vector3.zero;
			string text3 = "random";
			IEnumerable<string> enumerable = array.Skip(2);
			foreach (string item in enumerable)
			{
				string[] array2 = item.Split(new char[1] { '=' });
				switch (array2[0])
				{
				case "a":
				case "amount":
					num = int.Parse(array2[1]);
					ChatCommands.mls.LogInfo((object)$"Amount {num}");
					break;
				case "p":
				case "position":
					text3 = array2[1];
					ChatCommands.mls.LogInfo((object)text3);
					break;
				}
			}
			if (text3 != "random")
			{
				val = CalculateSpawnPosition(text3);
				if (val == Vector3.zero && text3 != "random")
				{
					ChatCommands.mls.LogWarning((object)"Position Invalid, Using Default 'random'");
					text3 = "random";
				}
			}
			Vector3 val2;
			if (text2 == "mine")
			{
				if (ChatCommands.mine == -1)
				{
					ChatCommands.mls.LogWarning((object)"Mine not found");
					ChatCommands.msgtitle = "Command Error";
					ChatCommands.msgbody = "Mine not spawnable on map";
					return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
				}
				for (int i = 0; i < num; i++)
				{
					if (text3 == "random")
					{
					}
					ManualLogSource mls = ChatCommands.mls;
					val2 = val;
					mls.LogInfo((object)("Spawning mine at position:" + ((object)(Vector3)(ref val2)).ToString()));
					GameObject val3 = Object.Instantiate<GameObject>(ChatCommands.currentRound.currentLevel.spawnableMapObjects[ChatCommands.mine].prefabToSpawn, val, Quaternion.identity, ChatCommands.currentRound.mapPropsContainer.transform);
					val3.GetComponent<NetworkObject>().Spawn(true);
					ChatCommands.msgtitle = "Spawned mine";
					val2 = val;
					ChatCommands.msgbody = "Spawned mine at position:" + ((object)(Vector3)(ref val2)).ToString();
				}
			}
			else if (text2 == "turret")
			{
				if (ChatCommands.turret == -1)
				{
					ChatCommands.mls.LogWarning((object)"Turret not found");
					ChatCommands.msgtitle = "Command Error";
					ChatCommands.msgbody = "Turret not spawnable on map";
					return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
				}
				for (int j = 0; j < num; j++)
				{
					if (text3 == "random")
					{
					}
					ManualLogSource mls2 = ChatCommands.mls;
					val2 = val;
					mls2.LogInfo((object)("Spawning turret at position:" + ((object)(Vector3)(ref val2)).ToString()));
					GameObject val4 = Object.Instantiate<GameObject>(ChatCommands.currentRound.currentLevel.spawnableMapObjects[ChatCommands.turret].prefabToSpawn, val, Quaternion.identity, ChatCommands.currentRound.mapPropsContainer.transform);
					val4.GetComponent<NetworkObject>().Spawn(true);
					ChatCommands.msgtitle = "Spawned turret";
					val2 = val;
					ChatCommands.msgbody = "Spawned turret at position:" + ((object)(Vector3)(ref val2)).ToString();
				}
			}
			return ChatCommands.msgtitle + "/" + ChatCommands.msgbody;
		}

		public static string SpawnScrapFunc(string text)
		{
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0600: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_062b: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06be: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ChatCommands.currentLevel == (Object)null)
			{
				ChatCommands.mls.LogWarning((object)"Unable to send command since currentLevel is null.");
				ChatCommands.msgtitle = "Command Error";
				ChatCommands.msgbody = "Unable to send command since currentLevel is null.";
				ChatCommands.DisplayChatError(ChatCommands.msgtitle + "\n" + ChatCommands.msgbody);
				return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
			}
			string[] array = text.Substring(1).Split(new char[1] { ' ' });
			if (array.Length < 2)
			{
				ChatCommands.mls.LogWarning((object)"Missing Arguments For Spawn\n'/spawnscrap <name> (amount=<amount>) (position={random, @me, @<playername>})");
				ChatCommands.msgtitle = "Command Error";
				ChatCommands.msgbody = "Missing Arguments For Spawn\n'/spawnscrap <name> (amount=<amount>) (position={random, @me, @<playername>})";
				HUDManager.Instance.DisplayTip(ChatCommands.msgtitle, ChatCommands.msgbody, true, false, "LC_Tip1");
				return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
			}
			string text2 = array[1].ToLower();
			int num = 1;
			Vector3 val = Vector3.zero;
			string text3 = "random";
			int num2 = 1000;
			IEnumerable<string> enumerable = array.Skip(2);
			foreach (string item in enumerable)
			{
				string[] array2 = item.Split(new char[1] { '=' });
				switch (array2[0])
				{
				case "v":
				case "value":
					num2 = int.Parse(array2[1]);
					ChatCommands.mls.LogInfo((object)$"Value {num2}");
					break;
				case "a":
				case "amount":
					num = int.Parse(array2[1]);
					ChatCommands.mls.LogInfo((object)$"Amount {num}");
					break;
				case "p":
				case "position":
					text3 = array2[1];
					ChatCommands.mls.LogInfo((object)text3);
					break;
				}
			}
			if (text3 != "random")
			{
				val = CalculateSpawnPosition(text3);
				if (val == Vector3.zero && text3 != "random")
				{
					ChatCommands.mls.LogWarning((object)"Position Invalid, Using Default 'random'");
					text3 = "random";
				}
			}
			Vector3 val4;
			if (text2 == "gun")
			{
				for (int i = 0; i < ChatCommands.currentRound.currentLevel.Enemies.Count(); i++)
				{
					if (((Object)ChatCommands.currentRound.currentLevel.Enemies[i].enemyType).name == "Nutcracker")
					{
						GameObject val2 = Object.Instantiate<GameObject>(ChatCommands.currentRound.currentLevel.Enemies[i].enemyType.enemyPrefab, new Vector3(float.MinValue, float.MinValue, float.MinValue), Quaternion.identity);
						NutcrackerEnemyAI component = val2.GetComponent<NutcrackerEnemyAI>();
						ChatCommands.mls.LogInfo((object)("Spawning " + num + " gun" + ((num > 1) ? "s" : "")));
						for (int j = 0; j < num; j++)
						{
							GameObject val3 = Object.Instantiate<GameObject>(component.gunPrefab, val, Quaternion.identity, ChatCommands.currentRound.spawnedScrapContainer);
							GrabbableObject component2 = val3.GetComponent<GrabbableObject>();
							component2.startFallingPosition = val;
							component2.targetFloorPosition = component2.GetItemFloorPosition(val);
							component2.SetScrapValue(num2);
							((NetworkBehaviour)component2).NetworkObject.Spawn(false);
						}
						ChatCommands.msgtitle = "Spawned gun";
						string[] obj = new string[8]
						{
							"Spawned ",
							num.ToString(),
							" gun",
							(num > 1) ? "s" : "",
							"with value of:",
							num2.ToString(),
							"\n at position: ",
							null
						};
						val4 = val;
						obj[7] = ((object)(Vector3)(ref val4)).ToString();
						ChatCommands.msgbody = string.Concat(obj);
						break;
					}
				}
			}
			int num3 = ChatCommands.currentRound.currentLevel.spawnableScrap.Count();
			bool flag = false;
			for (int k = 0; k < num3; k++)
			{
				Item scrap = ChatCommands.currentRound.currentLevel.spawnableScrap[k].spawnableItem;
				if (!(((Object)scrap.spawnPrefab).name.ToLower() == text2))
				{
					continue;
				}
				GameObject spawnPrefab = scrap.spawnPrefab;
				bool flag2 = text3 == "random";
				List<RandomScrapSpawn> list = null;
				if (flag2)
				{
					RandomScrapSpawn[] source = Object.FindObjectsOfType<RandomScrapSpawn>();
					list = ((scrap.spawnPositionTypes != null && scrap.spawnPositionTypes.Count != 0) ? source.Where((RandomScrapSpawn x) => scrap.spawnPositionTypes.Contains(x.spawnableItems) && !x.spawnUsed).ToList() : source.ToList());
				}
				ChatCommands.mls.LogInfo((object)("Spawning " + num + " " + ((Object)spawnPrefab).name + ((num > 1) ? "s" : "")));
				for (int l = 0; l < num; l++)
				{
					if (flag2)
					{
						RandomScrapSpawn val5 = list[ChatCommands.currentRound.AnomalyRandom.Next(0, list.Count)];
						val = ChatCommands.currentRound.GetRandomNavMeshPositionInRadiusSpherical(((Component)val5).transform.position, val5.itemSpawnRange, ChatCommands.currentRound.navHit) + Vector3.up * scrap.verticalOffset;
					}
					GameObject val6 = Object.Instantiate<GameObject>(spawnPrefab, val, Quaternion.identity, ChatCommands.currentRound.spawnedScrapContainer);
					GrabbableObject component3 = val6.GetComponent<GrabbableObject>();
					component3.startFallingPosition = val;
					component3.targetFloorPosition = component3.GetItemFloorPosition(val);
					component3.SetScrapValue(num2);
					((NetworkBehaviour)component3).NetworkObject.Spawn(false);
					ChatCommands.msgtitle = "Spawned " + ((Object)spawnPrefab).name;
					string[] obj2 = new string[9]
					{
						"Spawned ",
						num.ToString(),
						" ",
						((Object)spawnPrefab).name,
						(num > 1) ? "s" : "",
						" with value of:",
						num2.ToString(),
						"\n at position: ",
						null
					};
					val4 = val;
					obj2[8] = ((object)(Vector3)(ref val4)).ToString();
					ChatCommands.msgbody = string.Concat(obj2);
				}
				flag = true;
				break;
			}
			if (!flag)
			{
				ChatCommands.mls.LogWarning((object)("Could not spawn " + text2));
				ChatCommands.msgtitle = "Command Error";
				ChatCommands.msgbody = "Could not spawn " + text2 + ".\nHave you checked using /getscrap if the scrap you are trying to spawn\n is even spawnable?";
			}
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string ChangeWeather(string text)
		{
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			ChatCommands.msgtitle = "Weather Change";
			string[] array = text.Split(new char[1] { ' ' });
			if (array.Length > 1)
			{
				switch (array[1].ToLower())
				{
				case "rain":
					ChatCommands.currentRound.timeScript.currentLevelWeather = (LevelWeatherType)1;
					ChatCommands.mls.LogInfo((object)("tried to change the weather to " + array[1]));
					break;
				case "eclipse":
					ChatCommands.currentRound.timeScript.currentLevelWeather = (LevelWeatherType)5;
					ChatCommands.mls.LogInfo((object)("tried to change the weather to " + array[1]));
					break;
				case "flood":
					ChatCommands.currentRound.timeScript.currentLevelWeather = (LevelWeatherType)4;
					ChatCommands.mls.LogInfo((object)("tried to change the weather to " + array[1]));
					break;
				case "dust":
				case "mist":
				case "fog":
					ChatCommands.currentRound.timeScript.currentLevelWeather = (LevelWeatherType)0;
					ChatCommands.mls.LogInfo((object)("tried to change the weather to " + array[1]));
					break;
				case "storm":
					ChatCommands.currentRound.timeScript.currentLevelWeather = (LevelWeatherType)2;
					ChatCommands.mls.LogInfo((object)("tried to change the weather to " + array[1]));
					break;
				case "none":
					ChatCommands.currentRound.timeScript.currentLevelWeather = (LevelWeatherType)(-1);
					ChatCommands.mls.LogInfo((object)("tried to change the weather to " + array[1]));
					break;
				default:
					ChatCommands.mls.LogInfo((object)("Couldn't figure out what [ " + array[1] + " ] was."));
					ChatCommands.msgbody = "Couldn't figure out what [ " + array[1] + " ] was.";
					break;
				}
				ChatCommands.msgbody = "tried to change the weather to " + array[1];
			}
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string TerminalFunc()
		{
			ChatCommands.usingTerminal = !ChatCommands.usingTerminal;
			if (ChatCommands.usingTerminal)
			{
				ChatCommands.msgtitle = "Began Using Terminal";
				ChatCommands.msgbody = " ";
				Terminal val = Object.FindObjectOfType<Terminal>();
				if ((Object)(object)val == (Object)null)
				{
					return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
				}
				if (!val.terminalInUse)
				{
					val.BeginUsingTerminal();
					HUDManager.Instance.ChangeControlTip(0, string.Empty, true);
					GameNetworkManager.Instance.localPlayerController.inSpecialInteractAnimation = true;
				}
			}
			else
			{
				Terminal val2 = Object.FindObjectOfType<Terminal>();
				if ((Object)(object)val2 == (Object)null)
				{
					return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
				}
				val2.QuitTerminal();
				GameNetworkManager.Instance.localPlayerController.inSpecialInteractAnimation = false;
				ChatCommands.msgtitle = "Stopped using terminal";
				ChatCommands.msgbody = " ";
			}
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string BuyFunc(string text)
		{
			ChatCommands.msgtitle = "Item Buying";
			Terminal val = Object.FindObjectOfType<Terminal>();
			if ((Object)(object)val != (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[] array = text.Split(new char[1] { ' ' });
				if (array.Length > 1)
				{
					bool flag = false;
					if (array.Length > 2)
					{
						if (!int.TryParse(array[2], out var result))
						{
							ChatCommands.mls.LogInfo((object)("Couldn't parse command [ " + array[2] + " ]"));
							ChatCommands.DisplayChatError("Couldn't parse command [ " + array[2] + " ]");
							return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
						}
						foreach (string item in list)
						{
							if (item.ToLower().Contains(array[1]))
							{
								flag = true;
								List<int> list2 = new List<int>();
								for (int i = 0; i < result; i++)
								{
									list2.Add(dictionary[item]);
								}
								val.BuyItemsServerRpc(list2.ToArray(), val.groupCredits, 0);
								ChatCommands.msgbody = "Bought " + result + " " + item + "s";
								break;
							}
						}
						if (!flag)
						{
							ChatCommands.mls.LogInfo((object)("Couldn't figure out what [ " + array[1] + " ] was."));
							ChatCommands.DisplayChatError("Couldn't figure out what [ " + array[1] + " ] was.");
							return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
						}
					}
					if (!flag)
					{
						bool flag2 = false;
						foreach (string item2 in list)
						{
							if (item2.ToLower().Contains(array[1]))
							{
								flag2 = true;
								int[] array2 = new int[1] { dictionary[item2] };
								val.BuyItemsServerRpc(array2, val.groupCredits, 0);
								ChatCommands.msgbody = "Bought " + 1 + " " + item2;
							}
						}
						if (!flag2)
						{
							ChatCommands.mls.LogInfo((object)("Couldn't figure out what [ " + array[1] + " ] was. Trying via int parser."));
						}
						if (!int.TryParse(array[1], out var result2))
						{
							ChatCommands.mls.LogInfo((object)("Couldn't figure out what [ " + array[1] + " ] was. Int parser failed, please try again."));
							ChatCommands.DisplayChatError("Couldn't figure out what [ " + array[1] + " ] was. Int parser failed, please try again.");
							return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
						}
						int[] array3 = new int[1] { result2 };
						val.BuyItemsServerRpc(array3, val.groupCredits, 0);
						ChatCommands.msgbody = "Bought item with ID [" + result2 + "]";
					}
				}
			}
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string GetEnemies()
		{
			string text = "";
			SelectableLevel currentLevel = ChatCommands.currentLevel;
			ChatCommands.msgtitle = "Enemies:";
			if ((Object)(object)currentLevel == (Object)null)
			{
				ChatCommands.DisplayChatError("Level is null.");
				Debug.LogError((object)"newLevel is null.");
				return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
			}
			if (ChatCommands.levelEnemySpawns == null)
			{
				ChatCommands.DisplayChatError("levelEnemySpawns is null.");
				Debug.LogError((object)"levelEnemySpawns is null.");
				return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
			}
			if (ChatCommands.levelEnemySpawns.TryGetValue(currentLevel, out var value))
			{
				currentLevel.Enemies = value;
				text += "<color=#FF00FF>Inside: </color><color=#FFFF00>";
				ChatCommands.msgbody = "<color=#FF00FF>Inside: </color><color=#FFFF00>";
				if (currentLevel.Enemies.Count == 0)
				{
					text += "None";
					ChatCommands.msgbody += "None";
				}
				else
				{
					foreach (SpawnableEnemyWithRarity enemy in currentLevel.Enemies)
					{
						ChatCommands.mls.LogInfo((object)("Inside: " + enemy.enemyType.enemyName));
						text = text + enemy.enemyType.enemyName + ", ";
						ChatCommands.msgbody = ChatCommands.msgbody + enemy.enemyType.enemyName + ", ";
					}
				}
				text += "\n</color><color=#FF00FF>Outside: </color>";
				ChatCommands.msgbody += "\n</color><color=#FF00FF>Outside: </color>";
				if (currentLevel.OutsideEnemies.Count == 0)
				{
					text += "None";
					ChatCommands.msgbody += "None";
				}
				else
				{
					foreach (SpawnableEnemyWithRarity outsideEnemy in currentLevel.OutsideEnemies)
					{
						ChatCommands.mls.LogInfo((object)("Outside: " + outsideEnemy.enemyType.enemyName));
						text = text + outsideEnemy.enemyType.enemyName + ", ";
						ChatCommands.msgbody = ChatCommands.msgbody + outsideEnemy.enemyType.enemyName + ", ";
					}
				}
				ChatCommands.DisplayChatMessage(text);
			}
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string GetScrap()
		{
			SelectableLevel currentLevel = ChatCommands.currentLevel;
			if ((Object)(object)currentLevel == (Object)null)
			{
				ChatCommands.DisplayChatError("Level is null.");
				Debug.LogError((object)"Current Level is null.");
				return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
			}
			int num = ChatCommands.currentRound.currentLevel.spawnableScrap.Count();
			string text = ((Object)ChatCommands.currentRound.currentLevel.spawnableScrap[0].spawnableItem.spawnPrefab).name;
			for (int i = 1; i < num; i++)
			{
				text += ", ";
				text += ((Object)ChatCommands.currentRound.currentLevel.spawnableScrap[i].spawnableItem.spawnPrefab).name;
			}
			ChatCommands.msgtitle = "Spawnable Scrap";
			ChatCommands.msgbody = "listed in chat";
			ChatCommands.DisplayChatMessage("Spawnable Scrap: " + text);
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string SetHostCmds(string playername)
		{
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			bool flag = false;
			PlayerControllerB[] array = allPlayerScripts;
			foreach (PlayerControllerB val in array)
			{
				if (val.playerUsername.ToLower().Contains(playername.ToLower()))
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				ChatCommands.mls.LogWarning((object)"Player not found");
				ChatCommands.DisplayChatError("Player " + playername + " not found!!!");
				ChatCommands.msgtitle = "Set Host Command allowance";
				ChatCommands.msgbody = "Player not found! Check your command";
				return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
			}
			bool flag2 = false;
			ChatCommands.msgtitle = "Set Host Command allowance";
			foreach (AllowedHostPlayer allowedHostPlayer in ChatCommands.AllowedHostPlayers)
			{
				if (allowedHostPlayer.Name.ToLower().Contains(playername.ToLower()))
				{
					allowedHostPlayer.AllowHostCMD = !allowedHostPlayer.AllowHostCMD;
					ChatCommands.msgbody = "Host Commands for " + playername + " set to" + allowedHostPlayer.AllowHostCMD;
					flag2 = true;
					break;
				}
			}
			if (!flag2)
			{
				ChatCommands.AllowedHostPlayers.Add(new AllowedHostPlayer(playername, isActive: true));
				ChatCommands.msgbody = "Host Commands for " + playername + " set to true";
			}
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string GetHelp()
		{
			ChatCommands.msgtitle = "Available Commands";
			ChatCommands.msgbody = "/buy item - Buy an item \n /togglelights - Toggle lights inside building \n /spawn - help for spawning \n /morehelp - see more commands \n /credits - List credits";
			ChatCommands.DisplayChatMessage("<color=#FF00FF>" + ChatCommands.msgtitle + "</color>\n" + ChatCommands.msgbody);
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string GetMoreHelp()
		{
			ChatCommands.msgtitle = "More Commands";
			ChatCommands.msgbody = "/enemies - See all enemies available to spawn. \n /weather weatherName - Attempt to change weather \n /cheats - list cheat commands \n /override - Override Enemy spawns";
			ChatCommands.DisplayChatMessage("<color=#FF00FF>" + ChatCommands.msgtitle + "</color>\n" + ChatCommands.msgbody);
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string GetCredits()
		{
			ChatCommands.msgtitle = "Credits";
			ChatCommands.msgbody = "ChatCommands by Toemmsen96 and Chrigi";
			ChatCommands.DisplayChatMessage("<color=#FF00FF>" + ChatCommands.msgtitle + "</color>\n" + ChatCommands.msgbody);
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string GetCheats()
		{
			ChatCommands.msgtitle = "Cheats";
			ChatCommands.msgbody = "/god - Toggle GodMode \n /speed - Toggle SpeedHack \n /togglelights - Toggle lights inside building \n /tp - Teleports you to the terminal in your ship, keeping all items on you! \n /tp <playername> teleports you to that player";
			ChatCommands.DisplayChatMessage("<color=#FF00FF>" + ChatCommands.msgtitle + "</color>\n" + ChatCommands.msgbody);
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string GetSpawn()
		{
			ChatCommands.msgtitle = "How To";
			ChatCommands.msgbody = "Spawn an enemy: /spawnenemy or /spweny\nSpawn scrap items: /spawnscrap or /spwscr\nSpawn map objects: /spawnmapobj or /spwobj\nafter that put the name of what you want to spawn\noptions: a=<num> or amount=<num> for how many to spawn\np=<pos> or position=<pos> for position where to spawn\n<pos> can be either @me for your coordinates, @playername for coords of player with specific name or random";
			ChatCommands.DisplayChatMessage("<color=#FF00FF>" + ChatCommands.msgtitle + "</color>\n" + ChatCommands.msgbody);
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static string GetPos()
		{
			//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)
			ChatCommands.msgtitle = "Position";
			Vector3 position = ((Component)ChatCommands.playerRef).transform.position;
			ChatCommands.msgbody = "Your Position is: " + ((object)(Vector3)(ref position)).ToString();
			ChatCommands.DisplayChatMessage("<color=#FF00FF>" + ChatCommands.msgtitle + "</color>\n" + ChatCommands.msgbody);
			return ChatCommands.msgbody + "/" + ChatCommands.msgtitle;
		}

		public static bool CheckPrefix(string text)
		{
			string text2 = "/";
			if (ChatCommands.PrefixSetting.Value != "")
			{
				text2 = ChatCommands.PrefixSetting.Value;
			}
			if (!text.ToLower().StartsWith(text2.ToLower()))
			{
				return false;
			}
			return true;
		}

		private static Vector3 CalculateSpawnPosition(string sposition)
		{
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: 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_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			if (sposition == "random")
			{
				return val;
			}
			if (sposition.StartsWith("@"))
			{
				if (sposition == "@me")
				{
					PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
					PlayerControllerB[] array = allPlayerScripts;
					foreach (PlayerControllerB val2 in array)
					{
						ChatCommands.mls.LogInfo((object)("Checking Playername " + val2.playerUsername));
						if (val2.playerUsername.Replace(" ", "").ToLower().Contains(ChatCommands.playerwhocalled.ToLower()))
						{
							ChatCommands.mls.LogInfo((object)("Found player " + val2.playerUsername));
							val = ((Component)val2).transform.position;
							ChatCommands.msgbody = ChatCommands.msgbody + "@" + val2.playerUsername;
							break;
						}
					}
				}
				else
				{
					string text = sposition.Substring(1);
					string text2 = ChatCommands.ConvertPlayername(text);
					PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts;
					bool flag = false;
					ChatCommands.mls.LogInfo((object)("Looking for Playername " + text2 + " or Playername " + text + "..."));
					PlayerControllerB[] array2 = allPlayerScripts2;
					foreach (PlayerControllerB val3 in array2)
					{
						ChatCommands.mls.LogInfo((object)("Checking Playername " + val3.playerUsername.Replace(" ", "")));
						if (val3.playerUsername.Replace(" ", "").ToLower().Contains(text2.ToLower()) || val3.playerUsername.Replace(" ", "").ToLower().Contains(text.ToLower()))
						{
							val = ((Component)val3).transform.position;
							ChatCommands.msgbody = ChatCommands.msgbody + "@" + val3.playerUsername;
							flag = true;
							ChatCommands.mls.LogInfo((object)("Found player " + val3.playerUsername));
							break;
						}
					}
					if (!flag)
					{
						ChatCommands.mls.LogWarning((object)"Player not found");
						ChatCommands.DisplayChatMessage("Player not found, spawning in random position");
					}
				}
			}
			else
			{
				string[] array3 = sposition.Split(new char[1] { ',' });
				if (array3.Length == 3)
				{
					((Vector3)(ref val))..ctor(float.Parse(array3[0]), float.Parse(array3[1]), float.Parse(array3[2]));
					string msgbody = ChatCommands.msgbody;
					Vector3 val4 = val;
					ChatCommands.msgbody = msgbody + "position: " + ((object)(Vector3)(ref val4)).ToString();
				}
				else
				{
					ChatCommands.mls.LogWarning((object)"Position Invalid, Using Default 'random'");
					ChatCommands.msgbody += "position: random";
				}
			}
			return val;
		}

		public static void ToggleOverrideSpawns()
		{
			ChatCommands.OverrideSpawns = !ChatCommands.OverrideSpawns;
		}
	}
	[BepInPlugin("toemmsen.ChatCommands", "ChatCommands", "1.1.92")]
	public class ChatCommands : BaseUnityPlugin
	{
		private const string modGUID = "toemmsen.ChatCommands";

		private const string modName = "ChatCommands";

		private const string modVersion = "1.1.92";

		private readonly Harmony harmony = new Harmony("toemmsen.ChatCommands");

		private static ChatCommands instance;

		internal static ManualLogSource mls = Logger.CreateLogSource("toemmsen.ChatCommands");

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

		public static Dictionary<SpawnableEnemyWithRarity, int> enemyRaritys;

		public static Dictionary<SpawnableEnemyWithRarity, AnimationCurve> enemyPropCurves;

		internal static SelectableLevel currentLevel;

		internal static EnemyVent[] currentLevelVents;

		internal static RoundManager currentRound;

		internal static bool EnableInfiniteAmmo = false;

		internal static ConfigEntry<string> PrefixSetting;

		internal static ConfigEntry<bool> HostSetting;

		internal static ConfigEntry<bool> SendHostCommandsSetting;

		internal static ConfigEntry<bool> OverrideSpawnsSetting;

		internal static bool OverrideSpawns = false;

		internal static bool AllowHostCommands = false;

		internal static bool enableGod;

		internal static bool EnableInfiniteCredits = false;

		internal static int CustomDeadline = int.MinValue;

		internal static bool usingTerminal = false;

		internal static PlayerControllerB playerRef;

		internal static bool isHost;

		internal static bool speedHack;

		internal static string msgtitle;

		internal static string msgbody;

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

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

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

		internal static string playerwhocalled;

		internal static List<AllowedHostPlayer> AllowedHostPlayers = new List<AllowedHostPlayer>();

		internal static int mine = -1;

		internal static int turret = -1;

		public TextMeshProUGUI chatText;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			PrefixSetting = ((BaseUnityPlugin)instance).Config.Bind<string>("Command Settings", "Command Prefix", "/", "An optional prefix for chat commands");
			HostSetting = ((BaseUnityPlugin)instance).Config.Bind<bool>("Command Settings", "Has to be Host", true, "(for server host only): determines if clients can also use the host commands");
			SendHostCommandsSetting = ((BaseUnityPlugin)instance).Config.Bind<bool>("Command Settings", "Send Host Commands", true, "(for server host only): determines if commands get sent to the clients, so for example god mode is enabled for them too");
			OverrideSpawnsSetting = ((BaseUnityPlugin)instance).Config.Bind<bool>("Command Settings", "Override Spawns", true, "(for server host only): determines if the spawn command overrides the default spawns. If enabled there can be spawned more than one girl etc. Can be toggled ingame by using /override command.");
			OverrideSpawns = OverrideSpawnsSetting.Value;
			AllowHostCommands = HostSetting.Value;
			enemyRaritys = new Dictionary<SpawnableEnemyWithRarity, int>();
			levelEnemySpawns = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>();
			enemyPropCurves = new Dictionary<SpawnableEnemyWithRarity, AnimationCurve>();
			speedHack = false;
			enableGod = false;
			harmony.PatchAll(typeof(ChatCommands));
			harmony.PatchAll(typeof(global::ChatCommands.Patches.Patches));
			mls.LogWarning((object)("\r\n" + "  ______                                                                                                       \r\n /_  __/  ____   ___    ____ ___    ____ ___    _____  ___    ____    _____                                    \r\n  / /    / __ \\ / _ \\  / __ `__ \\  / __ `__ \\  / ___/ / _ \\  / __ \\  / ___/                                    \r\n / /    / /_/ //  __/ / / / / / / / / / / / / (__  ) /  __/ / / / / (__  )                                     \r\n/_/_____\\____/_\\___/ /_/ /_/_/_/ /_/ /_/ /_/_/____/  \\___/ /_/ /_/ /____/                            __        \r\n  / ____/   / /_   ____ _  / /_         / ____/  ____    ____ ___    ____ ___   ____ _   ____   ____/ /   _____\r\n / /       / __ \\ / __ `/ / __/        / /      / __ \\  / __ `__ \\  / __ `__ \\ / __ `/  / __ \\ / __  /   / ___/\r\n/ /___    / / / // /_/ / / /_         / /___   / /_/ / / / / / / / / / / / / // /_/ /  / / / // /_/ /   (__  ) \r\n\\____/   /_/ /_/ \\__,_/  \\__/         \\____/   \\____/ /_/ /_/ /_/ /_/ /_/ /_/ \\__,_/  /_/ /_/ \\__,_/   /____/  \r\n"));
			mls.LogInfo((object)"ChatCommands loaded");
		}

		private static bool ToggleGodMode()
		{
			if (isHost)
			{
				enableGod = !enableGod;
			}
			return enableGod;
		}

		private static bool ToggleSpeedHack()
		{
			if (isHost)
			{
				speedHack = !playerRef.isSpeedCheating;
				playerRef.isSpeedCheating = speedHack;
			}
			return speedHack;
		}

		internal static void SpawnEnemy(SpawnableEnemyWithRarity enemy, int amount, bool inside, Vector3 location)
		{
			//IL_0013: 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_002d: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			if (!isHost)
			{
				return;
			}
			if (location.x != 0f && location.y != 0f && location.z != 0f && inside)
			{
				try
				{
					for (int i = 0; i < amount; i++)
					{
						currentRound.SpawnEnemyOnServer(location, 0f, currentLevel.Enemies.IndexOf(enemy));
					}
					return;
				}
				catch
				{
					mls.LogInfo((object)"Failed to spawn enemies, check your command.");
					return;
				}
			}
			if (location.x != 0f && location.y != 0f && location.z != 0f && !inside)
			{
				try
				{
					int j;
					for (j = 0; j < amount; j++)
					{
						Object.Instantiate<GameObject>(currentLevel.OutsideEnemies[currentLevel.OutsideEnemies.IndexOf(enemy)].enemyType.enemyPrefab, location, Quaternion.Euler(Vector3.zero)).gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
					}
					mls.LogInfo((object)$"You wanted to spawn: {amount} enemies");
					ManualLogSource obj2 = mls;
					string text = j.ToString();
					Vector3 val = location;
					obj2.LogInfo((object)("Spawned an enemy. Total Spawned: " + text + "at position:" + ((object)(Vector3)(ref val)).ToString()));
					return;
				}
				catch
				{
					mls.LogInfo((object)"Failed to spawn enemies, check your command.");
					return;
				}
			}
			if (inside)
			{
				try
				{
					int k;
					for (k = 0; k < amount; k++)
					{
						currentRound.SpawnEnemyOnServer(currentRound.allEnemyVents[Random.Range(0, currentRound.allEnemyVents.Length)].floorNode.position, currentRound.allEnemyVents[k].floorNode.eulerAngles.y, currentLevel.Enemies.IndexOf(enemy));
					}
					mls.LogInfo((object)$"You wanted to spawn: {amount} enemies");
					mls.LogInfo((object)("Total Spawned: " + k));
					return;
				}
				catch
				{
					mls.LogInfo((object)"Failed to spawn enemies, check your command.");
					return;
				}
			}
			int l;
			for (l = 0; l < amount; l++)
			{
				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);
			}
			mls.LogInfo((object)$"You wanted to spawn: {amount} enemies");
			mls.LogInfo((object)("Total Spawned: " + l));
		}

		internal static bool NonHostCommands(string command)
		{
			bool result = true;
			switch (command.ToLower())
			{
			case "help":
				Commands.GetHelp();
				break;
			case "position":
			case "pos":
				Commands.GetPos();
				break;
			case "morehelp":
				Commands.GetMoreHelp();
				break;
			case "credits":
				Commands.GetCredits();
				break;
			case "cheats":
				Commands.GetCheats();
				break;
			case "spawn":
				Commands.GetSpawn();
				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(new char[1] { ' ' });
			if (NonHostCommands(command))
			{
				HUDManager.Instance.DisplayTip(msgtitle, msgbody, false, false, "LC_Tip1");
				return;
			}
			if (!isHost)
			{
				msgtitle = "Command";
				msgbody = "Unable to send command since you are not host.";
				HUDManager.Instance.DisplayTip(msgtitle, msgbody, false, false, "LC_Tip1");
				return;
			}
			switch (array[0])
			{
			case "enemies":
				Commands.GetEnemies();
				break;
			case "getscrap":
				Commands.GetScrap();
				break;
			case "spawnenemy":
			case "spweny":
				Commands.SpawnEnemyFunc(command);
				break;
			case "spawnscrap":
			case "spwscr":
				Commands.SpawnScrapFunc(command);
				break;
			case "weather":
				Commands.ChangeWeather(command);
				break;
			case "togglelights":
				Commands.ToggleLights();
				break;
			case "buy":
				Commands.BuyFunc(command);
				break;
			case "god":
				msgtitle = "God Mode";
				msgbody = "God Mode set to: " + ToggleGodMode();
				SendHostCommand(command);
				break;
			case "speed":
				msgtitle = "Speed hack";
				msgbody = "Speed hack set to: " + ToggleSpeedHack();
				SendHostCommand(command);
				break;
			case "deadline":
			case "dl":
				Commands.SetCustomDeadline(command);
				break;
			case "tp":
				Commands.Teleport(command);
				break;
			case "money":
				EnableInfiniteCredits = !EnableInfiniteCredits;
				msgtitle = "Infinite Credits";
				msgbody = "Infinite Credits: " + EnableInfiniteCredits;
				break;
			case "infammo":
			case "ammo":
				EnableInfiniteAmmo = !EnableInfiniteAmmo;
				msgtitle = "Infinite Ammo";
				msgbody = "Infinite Ammo: " + EnableInfiniteAmmo;
				SendHostCommand(command);
				break;
			case "terminal":
			case "term":
				Commands.TerminalFunc();
				break;
			case "hostcmd":
			case "cohost":
				Commands.SetHostCmds(array[1]);
				break;
			case "thcmd":
			case "togglehostcmd":
				AllowHostCommands = !AllowHostCommands;
				break;
			case "spwobj":
			case "spawnmapobj":
				Commands.SpawnMapObj(command);
				break;
			case "override":
			case "ovr":
				Commands.ToggleOverrideSpawns();
				msgtitle = "Override Spawns";
				msgbody = "Override Spawns set to: " + OverrideSpawns;
				break;
			default:
				msgtitle = "Command";
				msgbody = "Unknown command: " + array[0];
				DisplayChatError(msgbody);
				break;
			}
			HUDManager.Instance.DisplayTip(msgtitle, msgbody, false, false, "LC_Tip1");
		}

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

		public static void ProcessNetHostCommand(string commandInput)
		{
			if (commandInput.ToLower().Contains("god"))
			{
				enableGod = !enableGod;
				msgtitle = "Host sent command:";
				msgbody = "God Mode set to: " + enableGod;
			}
			if (commandInput.ToLower().Contains("speed"))
			{
				speedHack = !playerRef.isSpeedCheating;
				playerRef.isSpeedCheating = speedHack;
				msgtitle = "Host sent command:";
				msgbody = "Speed hack set to: " + speedHack;
			}
			if (commandInput.ToLower().Contains("infammo") || commandInput.ToLower().Contains("ammo"))
			{
				EnableInfiniteAmmo = !EnableInfiniteAmmo;
				msgtitle = "Host sent command:";
				msgbody = "Infinite Ammo: " + EnableInfiniteAmmo;
			}
			HUDManager.Instance.DisplayTip(msgtitle, msgbody, false, false, "LC_Tip1");
		}

		public static void ProcessCommand(string commandInput)
		{
			ProcessCommandInput(commandInput);
			HUDManager.Instance.DisplayTip(msgtitle, msgbody, false, false, "LC_Tip1");
		}

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

		public static void DisplayChatError(string errorMessage)
		{
			string item = "<color=#FF0000>CCMD: 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);
		}

		internal static string ConvertPlayername(string name)
		{
			mls.LogInfo((object)("Converting name: " + name));
			string input = new string(name.Where((char c) => char.IsLetter(c)).ToArray());
			input = Regex.Replace(input, "[^\\w\\._]", "");
			mls.LogInfo((object)("Converted name: " + input));
			return input;
		}
	}
	internal class AllowedHostPlayer
	{
		public string Name { get; set; }

		public bool AllowHostCMD { get; set; }

		public AllowedHostPlayer(string name, bool isActive)
		{
			Name = name;
			AllowHostCMD = isActive;
		}
	}
}
namespace ChatCommands.Patches
{
	internal class Patches
	{
		private static string NetCommandPrefix = ChatCommands.NetCommandPrefix;

		private static string NetHostCommandPrefix = ChatCommands.NetHostCommandPrefix;

		private static string NetCommandPostfix = ChatCommands.NetCommandPostfix;

		private static float defaultJumpForce;

		private static string nullChatMessage = "";

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

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

		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		[HarmonyPrefix]
		private static void ChatCommandsSubmitted(HUDManager __instance)
		{
			string text = __instance.chatTextField.text;
			string username = GameNetworkManager.Instance.username;
			ChatCommands.mls.LogInfo((object)("Received chat input: " + text));
			if (!string.IsNullOrEmpty(text) && text.ToLower().StartsWith(ChatCommands.PrefixSetting.Value))
			{
				if (!ChatCommands.NonHostCommands(text))
				{
					if (!ChatCommands.isHost)
					{
						string text2 = text.Substring(ChatCommands.PrefixSetting.Value.Length);
						__instance.chatTextField.text = NetCommandPrefix + text + NetCommandPostfix;
						ChatCommands.mls.LogInfo((object)("Not Host, trying to send command:" + text2));
						return;
					}
					if (text.ToLower().Contains("p=@me"))
					{
						ChatCommands.playerwhocalled = ChatCommands.ConvertPlayername(username);
						ChatCommands.mls.LogInfo((object)("Player who called: " + ChatCommands.playerwhocalled));
					}
					string command = text.Substring(ChatCommands.PrefixSetting.Value.Length);
					ChatCommands.ProcessCommandInput(command);
					__instance.chatTextField.text = nullChatMessage;
				}
				else
				{
					__instance.chatTextField.text = nullChatMessage;
				}
			}
			else
			{
				ChatCommands.mls.LogWarning((object)"Invalid input for a command or null chat.");
			}
		}

		[HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageClientRpc")]
		[HarmonyPrefix]
		private static void ReadChatMessage(HUDManager __instance, ref string chatMessage, ref int playerId)
		{
			string playerUsername = __instance.playersManager.allPlayerScripts[playerId].playerUsername;
			ChatCommands.mls.LogInfo((object)("Chat Message: " + chatMessage + " sent by: " + playerUsername));
			if (chatMessage.StartsWith(NetCommandPrefix) && ChatCommands.isHost && ChatCommands.AllowHostCommands)
			{
				string text = chatMessage.Substring(NetCommandPrefix.Length);
				string[] array = text.Split(new char[1] { '<' });
				string text2 = array[0];
				if (text2.ToLower().Contains("p=@me"))
				{
					ChatCommands.playerwhocalled = ChatCommands.ConvertPlayername(playerUsername);
				}
				ChatCommands.mls.LogInfo((object)("Host, trying to handle command: " + text2));
				ChatCommands.DisplayChatMessage(playerUsername + " sent command: " + ChatCommands.PrefixSetting.Value + text2);
				ChatCommands.ProcessCommandInput(text2);
				chatMessage = nullChatMessage;
				playerUsername = nullChatMessage;
			}
			else if (chatMessage.StartsWith(NetCommandPrefix) && ChatCommands.isHost && !ChatCommands.AllowHostCommands)
			{
				ChatCommands.mls.LogWarning((object)"Host, but not allowing commands, checking player for allowance");
				foreach (AllowedHostPlayer allowedHostPlayer in ChatCommands.AllowedHostPlayers)
				{
					if (allowedHostPlayer.Name.ToLower().Contains(playerUsername.ToLower()))
					{
						ChatCommands.mls.LogInfo((object)"Player is allowed to send commands");
						string text3 = chatMessage.Substring(NetCommandPrefix.Length);
						string[] array2 = text3.Split(new char[1] { '<' });
						string text4 = array2[0];
						if (text4.ToLower().Contains("p=@me"))
						{
							ChatCommands.playerwhocalled = playerUsername;
						}
						ChatCommands.mls.LogInfo((object)("Host, trying to handle command: " + text4));
						ChatCommands.DisplayChatMessage(playerUsername + " sent command: " + ChatCommands.PrefixSetting.Value + text4);
						ChatCommands.ProcessCommandInput(text4);
						chatMessage = nullChatMessage;
						playerUsername = nullChatMessage;
						return;
					}
				}
				ChatCommands.DisplayChatMessage("Host, but not allowing commands");
			}
			else if (chatMessage.StartsWith(NetHostCommandPrefix) && !ChatCommands.isHost)
			{
				string text5 = chatMessage.Substring(NetHostCommandPrefix.Length);
				string[] array3 = text5.Split(new char[1] { '<' });
				string text6 = array3[0];
				ChatCommands.mls.LogInfo((object)("Recieved command from Host, trying to handle command: " + text6));
				ChatCommands.ProcessNetHostCommand(text6);
			}
		}

		[HarmonyPatch(typeof(ShotgunItem), "ItemActivate")]
		[HarmonyPrefix]
		private static void ItemActivateGunPatch(ref ShotgunItem __instance)
		{
			if (ChatCommands.EnableInfiniteAmmo)
			{
				__instance.shellsLoaded = 2;
			}
		}

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPostfix]
		private static void UpdateNewInfo(ref EnemyVent[] ___allEnemyVents, ref SelectableLevel ___currentLevel)
		{
			ChatCommands.currentLevel = ___currentLevel;
			ChatCommands.currentLevelVents = ___allEnemyVents;
			HUDManager.Instance.chatTextField.characterLimit = 999;
		}

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

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPrefix]
		private static bool ModifyLevel(ref SelectableLevel newLevel)
		{
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			ChatCommands.currentRound = RoundManager.Instance;
			if (!ChatCommands.levelEnemySpawns.ContainsKey(newLevel))
			{
				List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
				foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
				{
					list.Add(enemy);
				}
				ChatCommands.levelEnemySpawns.Add(newLevel, list);
			}
			ChatCommands.levelEnemySpawns.TryGetValue(newLevel, out var value);
			newLevel.Enemies = value;
			foreach (SpawnableEnemyWithRarity enemy2 in newLevel.Enemies)
			{
				ChatCommands.mls.LogInfo((object)("Inside: " + enemy2.enemyType.enemyName));
				if (!ChatCommands.enemyRaritys.ContainsKey(enemy2))
				{
					ChatCommands.enemyRaritys.Add(enemy2, enemy2.rarity);
				}
				ChatCommands.enemyRaritys.TryGetValue(enemy2, out var value2);
				enemy2.rarity = value2;
			}
			foreach (SpawnableEnemyWithRarity outsideEnemy in newLevel.OutsideEnemies)
			{
				ChatCommands.mls.LogInfo((object)("Outside: " + outsideEnemy.enemyType.enemyName));
				if (!ChatCommands.enemyRaritys.ContainsKey(outsideEnemy))
				{
					ChatCommands.enemyRaritys.Add(outsideEnemy, outsideEnemy.rarity);
				}
				ChatCommands.enemyRaritys.TryGetValue(outsideEnemy, out var value3);
				outsideEnemy.rarity = value3;
			}
			foreach (SpawnableEnemyWithRarity enemy3 in newLevel.Enemies)
			{
				if (!ChatCommands.enemyPropCurves.ContainsKey(enemy3))
				{
					ChatCommands.enemyPropCurves.Add(enemy3, enemy3.enemyType.probabilityCurve);
				}
				AnimationCurve value4 = new AnimationCurve();
				ChatCommands.enemyPropCurves.TryGetValue(enemy3, out value4);
				enemy3.enemyType.probabilityCurve = value4;
			}
			return true;
		}

		[HarmonyPatch(typeof(TimeOfDay), "SetNewProfitQuota")]
		[HarmonyPostfix]
		private static void PatchDeadline(TimeOfDay __instance)
		{
			if (ChatCommands.isHost && ChatCommands.CustomDeadline != int.MinValue)
			{
				__instance.quotaVariables.deadlineDaysAmount = ChatCommands.CustomDeadline;
				__instance.timeUntilDeadline = (float)(__instance.quotaVariables.deadlineDaysAmount + ChatCommands.CustomDeadline) * __instance.totalTime;
				TimeOfDay.Instance.timeUntilDeadline = (int)(TimeOfDay.Instance.totalTime * (float)TimeOfDay.Instance.quotaVariables.deadlineDaysAmount);
				TimeOfDay.Instance.SyncTimeClientRpc(__instance.globalTime, (int)__instance.timeUntilDeadline);
				((TMP_Text)StartOfRound.Instance.deadlineMonitorText).text = "DEADLINE:\n " + TimeOfDay.Instance.daysUntilDeadline;
			}
		}

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

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

		[HarmonyPatch(typeof(MouthDogAI), "OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static bool OverrideDeath2()
		{
			return !ChatCommands.enableGod;
		}

		[HarmonyPatch(typeof(ForestGiantAI), "GrabPlayerServerRpc")]
		[HarmonyPrefix]
		private static bool OverrideDeath3()
		{
			return !ChatCommands.enableGod;
		}

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

		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		[HarmonyPostfix]
		private static void SpeedHackFunc(ref float ___jumpForce, ref float ___sprintMeter, ref float ___sprintMultiplier, ref bool ___isSprinting)
		{
			if (ChatCommands.speedHack)
			{
				___jumpForce = 25f;
				___sprintMeter = 1f;
				if (___isSprinting)
				{
					___sprintMultiplier = 10f;
				}
			}
			else
			{
				___jumpForce = defaultJumpForce;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "Start")]
		[HarmonyPrefix]
		private static void GetPlayerRef(ref PlayerControllerB __instance)
		{
			ChatCommands.playerRef = __instance;
			defaultJumpForce = __instance.jumpForce;
			ChatCommands.mls.LogInfo((object)("Default Jump Force: " + defaultJumpForce));
		}

		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")]
		[HarmonyPrefix]
		private static void GetRoundManagerRef(ref RoundManager __instance)
		{
			if (!ChatCommands.isHost)
			{
				return;
			}
			ChatCommands.mls.LogInfo((object)"Host, getting mine ref...");
			int num = ChatCommands.currentRound.currentLevel.spawnableMapObjects.Count();
			for (int i = 0; i < num; i++)
			{
				if (((Object)ChatCommands.currentRound.currentLevel.spawnableMapObjects[i].prefabToSpawn).name == "Landmine")
				{
					ChatCommands.mls.LogInfo((object)("Found Mine Index: " + i));
					ChatCommands.mine = i;
					break;
				}
				if (((Object)ChatCommands.currentRound.currentLevel.spawnableMapObjects[i].prefabToSpawn).name == "Turret")
				{
					ChatCommands.mls.LogInfo((object)("Found Turret Index: " + i));
					ChatCommands.turret = i;
					break;
				}
			}
		}
	}
}