Decompiled source of SimpleCommands v1.4.0

BepInEx/plugins/SimpleCommands/Simple-Commands.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using JLL;
using JLL.API;
using JLL.API.Compatability;
using JLL.API.LevelProperties;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Simple-Commands.NetcodePatcher;
using SimpleCommands;
using SimpleCommands.Commands;
using SimpleCommands.Components;
using SimpleCommands.Managers;
using SimpleCommands.Patches;
using Simple_Commands.Commands;
using Simple_Commands.Commands.Compatability;
using Simple_Commands.Patches;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using WeatherRegistry;

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Simple_Commands.Patches
{
	[HarmonyPatch(typeof(Terminal))]
	internal class TerminalPatch
	{
		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(Terminal), "CallFunctionInAccessibleTerminalObject")]
		public static void terminalObjectRequest(Terminal instance, string word)
		{
			throw new NotImplementedException("It's a stub");
		}
	}
}
namespace Simple_Commands.Commands
{
	public class SimplePrefabs
	{
		public class SimplePrefab
		{
			public GameObject prefab;

			public Vector3 spawnOffset = Vector3.zero;

			public void SpawnPrefab(Vector3 pos, Quaternion rot)
			{
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)prefab.GetComponent<NetworkObject>()))
				{
					if (((NetworkBehaviour)RoundManager.Instance).IsServer || ((NetworkBehaviour)RoundManager.Instance).IsClient)
					{
						GameObject val = Object.Instantiate<GameObject>(prefab);
						SetPrefabProperties(ref val, pos, rot);
						val.GetComponent<NetworkObject>().Spawn(false);
					}
				}
				else
				{
					GameObject val2 = Object.Instantiate<GameObject>(prefab);
					SetPrefabProperties(ref val2, pos, rot);
				}
			}

			public virtual void SetPrefabProperties(ref GameObject prefab, Vector3 pos, Quaternion rot)
			{
				//IL_0008: 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)
				prefab.transform.position = pos;
				prefab.transform.rotation = rot;
			}
		}

		public class CruiserPrefab : SimplePrefab
		{
			public override void SetPrefabProperties(ref GameObject prefab, Vector3 pos, Quaternion rot)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				base.SetPrefabProperties(ref prefab, pos, rot);
				VehicleController val = default(VehicleController);
				if (prefab.TryGetComponent<VehicleController>(ref val))
				{
					val.hasBeenSpawned = true;
					val.inDropshipAnimation = false;
				}
			}
		}

		internal class PrefabCommand : SimpleCommand
		{
			public PrefabCommand()
				: base("prefab", "spawn registered prefabs")
			{
				instructions.Add("[/cmd] [name] - Spawns prefab at the player.");
				instructions.Add("[/cmd] [target] [name] - Spawns prefab at the target.");
				instructions.Add("[/cmd] [name] [x] [y] [z] - Spawns prefab at specified coordinates.");
			}

			public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
				success = false;
				if (!parameters.IsEmpty())
				{
					string @string = parameters.GetString();
					Vector3 val = ((Component)sender).transform.position;
					bool flag = false;
					if (parameters.Count() >= 4)
					{
						if (!parameters.GetRelativeVector(((Component)sender).transform.position, out var vector))
						{
							return SimpleCommand.UnknownVectorException();
						}
						val = vector;
						flag = true;
					}
					else if (parameters.Count() >= 2)
					{
						PlayerControllerB player = SimpleCommand.GetPlayer(@string);
						if (!((Object)(object)player != (Object)null))
						{
							return SimpleCommand.UnknownPlayerException(@string);
						}
						val = ((Component)player).transform.position;
						@string = parameters.GetString();
					}
					List<KeyValuePair<string, SimplePrefab>> list = new List<KeyValuePair<string, SimplePrefab>>();
					foreach (KeyValuePair<string, SimplePrefab> prefab in Prefabs)
					{
						if (prefab.Key.ToLower().StartsWith(@string.ToLower()))
						{
							list.Add(prefab);
						}
					}
					if (list.Count > 0)
					{
						int index = 0;
						for (int i = 0; i < list.Count; i++)
						{
							if (list[i].Key.Length < list[index].Key.Length)
							{
								index = i;
							}
						}
						if (Prefabs.ContainsKey(list[index].Key))
						{
							SimplePrefab simplePrefab = Prefabs[list[index].Key];
							simplePrefab.SpawnPrefab(val + (flag ? Vector3.zero : simplePrefab.spawnOffset), ((Component)sender).transform.rotation);
							success = true;
							return "Spawned " + list[index].Key + "!";
						}
					}
					return "Unknown Prefab: " + @string;
				}
				return "";
			}
		}

		internal class PrefabsCommand : SimpleCommand
		{
			public PrefabsCommand()
				: base("prefabs", "list spawnable prefabs")
			{
				instructions.Add("[/cmd] - Lists spawnable prefabs");
				instructions.Add("[/cmd] [page]");
			}

			public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
			{
				int page = 0;
				if (!parameters.IsEmpty())
				{
					page = parameters.GetNumber();
				}
				success = true;
				SimpleCommand.ClearChat();
				return PagedList("Spawnable Prefabs:", Prefabs.Keys.ToList(), page, 8);
			}
		}

		private static readonly Dictionary<string, SimplePrefab> Prefabs = new Dictionary<string, SimplePrefab>();

		private static bool registeredBasePrefabs = false;

		public static void RegisterSimplePrefab(string name, SimplePrefab prefab)
		{
			if (!Prefabs.ContainsKey(name))
			{
				Prefabs.Add(name.Replace(' ', '_'), prefab);
			}
		}

		public static void RegisterSimplePrefab(string name, GameObject prefab)
		{
			RegisterSimplePrefab(name, new SimplePrefab
			{
				prefab = prefab
			});
		}

		internal static void RegisterBasePrefabs()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (registeredBasePrefabs)
			{
				return;
			}
			registeredBasePrefabs = true;
			SimpleCommandsBase.LogInfo("Registering Base Game Prefabs.", (JLogLevel)2);
			Terminal terminal = JLevelPropertyRegistry.GetTerminal();
			RegisterSimplePrefab("Cruiser", (SimplePrefab)new CruiserPrefab
			{
				prefab = terminal.buyableVehicles[0].vehiclePrefab,
				spawnOffset = new Vector3(0f, 14f, 0f)
			});
			SimpleCommandsBase.LogInfo($"Vanilla Map Hazards: {terminal.moonsCatalogueList[1].spawnableMapObjects.Length}", (JLogLevel)2);
			SpawnableMapObject[] spawnableMapObjects = terminal.moonsCatalogueList[1].spawnableMapObjects;
			foreach (SpawnableMapObject val in spawnableMapObjects)
			{
				string name = ((Object)val.prefabToSpawn).name;
				if (1 == 0)
				{
				}
				string text = ((name == "SpikeRoofTrapHazard") ? "SpikeRoofTrap" : ((!(name == "TurretContainer")) ? name : "Turret"));
				if (1 == 0)
				{
				}
				name = text;
				RegisterSimplePrefab(name, new SimplePrefab
				{
					prefab = val.prefabToSpawn
				});
			}
			SimpleCommandsBase.LogInfo($"LethalLib Map Hazards: {MapObjects.mapObjects.Count}", (JLogLevel)2);
			foreach (RegisteredMapObject mapObject in MapObjects.mapObjects)
			{
				RegisterSimplePrefab(((Object)mapObject.mapObject.prefabToSpawn).name, new SimplePrefab
				{
					prefab = mapObject.mapObject.prefabToSpawn
				});
			}
		}
	}
}
namespace Simple_Commands.Commands.Compatability
{
	public class WeatherRegistryCommand : SimpleCommand
	{
		public WeatherRegistryCommand()
			: base("weatherregistry", "WeatherRegistry (mrov)")
		{
			overrideShowOutput = true;
			permissionRequired = false;
			instructions.Add("[/cmd] - lists weathers registered through WeatherRegistry");
			instructions.Add("[/cmd] [page]");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			List<string> list = new List<string>();
			foreach (Weather weather in WeatherManager.Weathers)
			{
				list.Add(((Object)weather).name.Replace(" ", "_"));
			}
			int page = 0;
			if (!parameters.IsEmpty())
			{
				page = parameters.GetNumber();
			}
			success = true;
			SimpleCommand.ClearChat();
			return PagedList("WeatherRegistry:", list, page, 7);
		}
	}
}
namespace SimpleCommands
{
	[BepInPlugin("JacobG5.SimpleCommands", "SimpleCommands", "1.4.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SimpleCommandsBase : BaseUnityPlugin
	{
		private const string modGUID = "JacobG5.SimpleCommands";

		private const string modName = "SimpleCommands";

		private const string modVersion = "1.4.0";

		private readonly Harmony harmony = new Harmony("JacobG5.SimpleCommands");

		public static SimpleCommandsBase Instance;

		private ManualLogSource mls;

		public GameObject networkObject;

		public static ConfigEntry<string> commandPrefix;

		public static ConfigEntry<bool> hostOnly;

		public static ConfigEntry<bool> hideDefault;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			hostOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "hostOnly", true, "Restricts commands to only being executed by the host.");
			hideDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "hideDefault", false, "Hides command feedback by default. ('hide' flag now shows command feedback.)");
			commandPrefix = ((BaseUnityPlugin)this).Config.Bind<string>("Main", "commandPrefix", "/", "Prefix for SimpleCommands");
			mls = Logger.CreateLogSource("JacobG5.SimpleCommands");
			JLL.NetcodePatch(mls, Assembly.GetExecutingAssembly().GetTypes());
			networkObject = NetworkPrefabs.CreateNetworkPrefab("SimpleCommandsNetworkManager");
			networkObject.AddComponent<SimpleCommandsNetworkManager>();
			JLL.HarmonyPatch(harmony, mls, new Type[4]
			{
				typeof(HUDManagerPatch),
				typeof(PlayerControllerBPatch),
				typeof(StartOfRoundPatch),
				typeof(TerminalPatch)
			});
			RegisterBaseCommands();
		}

		private void RegisterBaseCommands()
		{
			SimpleCommand.Register(new HelpCommand());
			SimpleCommand.Register(new ClearCommand());
			SimpleCommand.Register(new ListCommand());
			SimpleCommand.Register(new PayCommand());
			SimpleCommand.Register(new WeatherCommand());
			SimpleCommand.Register(new HealCommand());
			SimpleCommand.Register(new DamageCommand());
			SimpleCommand.Register(new InvulnerabilityCommand());
			SimpleCommand.Register(new InfiniteSprintCommand());
			SimpleCommand.Register(new TeleportCommand());
			SimpleCommand.Register(new ItemCommand());
			SimpleCommand.Register(new ItemsCommand());
			SimpleCommand.Register(new TerminalCommand());
			SimpleCommand.Register(new SimplePrefabs.PrefabCommand());
			SimpleCommand.Register(new SimplePrefabs.PrefabsCommand());
			SimpleCommand.Register(new SpawnCommand());
			SimpleCommand.Register(new EnemiesCommand());
			SimpleCommand.Register(new ChargeCommand());
			SimpleCommand.Register(new ExtendCommand());
			SimpleCommand.Register(new ExplodeCommand());
			SimpleCommand.Register(new PosCommand());
			if (JCompatabilityHelper.IsModLoaded.WeatherRegistry)
			{
				SimpleCommand.Register(new WeatherRegistryCommand());
			}
		}

		internal static void LogInfo(string message, JLogLevel level)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if (JLogHelper.AcceptableLogLevel(level))
			{
				Instance.mls.LogInfo((object)message);
			}
		}
	}
}
namespace SimpleCommands.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		[HarmonyPatch("AddTextToChatOnServer")]
		[HarmonyPrefix]
		public static bool patchAddTextToChatOnServer(string chatMessage, int playerId, HUDManager __instance)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			if (playerId != -1)
			{
				PlayerControllerB val = __instance.playersManager.allPlayerScripts[playerId];
				string prefix = SimpleCommand.GetPrefix();
				if (chatMessage.StartsWith(prefix))
				{
					string text = chatMessage.Substring(prefix.Length);
					text = text.Replace("&//=", "").Replace(prefix, "&//=");
					Vector3 targetPos = ((Component)val).transform.position;
					RaycastHit val2 = default(RaycastHit);
					if (Physics.Raycast(new Ray(((Component)val.gameplayCamera).transform.position, ((Component)val.gameplayCamera).transform.forward), ref val2, 200f, 1073742656))
					{
						targetPos = ((RaycastHit)(ref val2)).point;
					}
					if (((NetworkBehaviour)val).IsHost || ((NetworkBehaviour)val).IsServer)
					{
						SimpleCommandsNetworkManager.Instance.CommandExecutionClientRpc(playerId, text, SimpleCommandsBase.hideDefault.Value, targetPos);
					}
					else
					{
						SimpleCommandsBase.LogInfo("Sending Command Request.", (JLogLevel)1);
						SimpleCommandsNetworkManager.Instance.RequestCommandExecutionServerRpc(playerId, text, targetPos);
					}
					return false;
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void patchStart(PlayerControllerB __instance)
		{
			((Component)__instance).gameObject.AddComponent<PlayerModification>();
		}

		[HarmonyPatch("KillPlayer")]
		[HarmonyPrefix]
		public static bool patchKillPlayer(PlayerControllerB __instance)
		{
			return CheckInvulnerability(__instance);
		}

		[HarmonyPatch("DamagePlayer")]
		[HarmonyPrefix]
		public static bool patchDamagePlayer(PlayerControllerB __instance)
		{
			return CheckInvulnerability(__instance);
		}

		public static bool CheckInvulnerability(PlayerControllerB player)
		{
			if (((Component)player).GetComponent<PlayerModification>().invulnerable)
			{
				player.health = 100;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void spawnNetworkManager(StartOfRound __instance)
		{
			if (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(SimpleCommandsBase.Instance.networkObject);
				val.GetComponent<NetworkObject>().Spawn(false);
				SimpleCommandsBase.LogInfo("Simple Command Manager Initialized.", (JLogLevel)2);
			}
		}
	}
}
namespace SimpleCommands.Managers
{
	public class SimpleCommandsNetworkManager : NetworkBehaviour
	{
		public static SimpleCommandsNetworkManager Instance;

		public void Awake()
		{
			Instance = this;
			SimplePrefabs.RegisterBasePrefabs();
		}

		[ServerRpc(RequireOwnership = false)]
		public void RequestCommandExecutionServerRpc(int playerId, string commandMessage, Vector3 targetPos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3835659538u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				bool flag = commandMessage != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(commandMessage, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetPos);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3835659538u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			SimpleCommandsBase.LogInfo("[Server] Processing Command Request from " + StartOfRound.Instance.allPlayerScripts[playerId].playerUsername + ".", (JLogLevel)1);
			if (SimpleCommand.tryParseCommand(commandMessage, out SimpleCommand command, out SimpleCommand.CommandParameters parameters, targetPos))
			{
				if (command == null || parameters == null)
				{
					return;
				}
				if (command.permissionRequired && SimpleCommandsBase.hostOnly.Value)
				{
					SendErrorTipClientRpc(playerId, "Permission Denied", "Only the host is allowed to execute commands due to the server's config.", isError: true);
					return;
				}
			}
			CommandExecutionClientRpc(playerId, commandMessage, SimpleCommandsBase.hideDefault.Value, targetPos);
		}

		[ClientRpc]
		public void CommandExecutionClientRpc(int playerId, string commandMessage, bool hideDefault, Vector3 targetPos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3869478541u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				bool flag = commandMessage != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(commandMessage, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hideDefault, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetPos);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3869478541u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				CommandExecution(StartOfRound.Instance.allPlayerScripts[playerId], commandMessage, hideDefault, targetPos);
			}
		}

		private void CommandExecution(PlayerControllerB sender, string commandMessage, bool hideDefault, Vector3 targetPos)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			HUDManager instance = HUDManager.Instance;
			SimpleCommandsBase.LogInfo("Parsing: " + commandMessage, (JLogLevel)2);
			bool flag = SimpleCommand.IsClient(sender);
			string[] array = commandMessage.Split("&//=");
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (text == "")
				{
					continue;
				}
				if (SimpleCommand.tryParseCommand(text, out SimpleCommand command, out SimpleCommand.CommandParameters parameters, targetPos))
				{
					if (command == null || parameters == null)
					{
						break;
					}
					string text2 = (parameters.IsEmpty() ? "" : ("\n" + parameters.asString()));
					SimpleCommandsBase.LogInfo("Player: " + sender.playerUsername + " | Executing: " + SimpleCommand.GetPrefix() + command.name + text2, (JLogLevel)2);
					bool success;
					string text3 = command.Execute(sender, parameters, out success);
					if (text3 == null || !(text3 != ""))
					{
						continue;
					}
					SimpleCommandsBase.LogInfo($"\nSuccess: {success}\nResult: {text3}", (JLogLevel)2);
					if (success)
					{
						if ((((NetworkBehaviour)instance).IsHost || ((NetworkBehaviour)instance).IsServer) && (parameters.isFlagged("hide") == hideDefault || command.overrideShowOutput))
						{
							instance.AddTextToChatOnServer(text3, -1);
						}
					}
					else if (flag)
					{
						JHudHelper.QueueDisplayTip("Command Failure:", text3, false, false, "LC_Tip1");
					}
				}
				else if (flag)
				{
					JHudHelper.QueueDisplayTip("Unknown Command:", SimpleCommand.GetPrefix() + text.Split(' ')[0], true, false, "LC_Tip1");
				}
			}
		}

		[ClientRpc]
		public void SendErrorTipClientRpc(int playerId, string title, string description, bool isError)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(746899919u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				bool flag = title != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(title, false);
				}
				bool flag2 = description != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(description, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isError, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 746899919u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				HUDManager instance = HUDManager.Instance;
				if (instance.localPlayer.actualClientId == instance.playersManager.allPlayerScripts[playerId].actualClientId)
				{
					instance.DisplayTip(title, description, isError, false, "LC_Tip1");
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SimpleCommandsNetworkManager()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3835659538u, new RpcReceiveHandler(__rpc_handler_3835659538));
			NetworkManager.__rpc_func_table.Add(3869478541u, new RpcReceiveHandler(__rpc_handler_3869478541));
			NetworkManager.__rpc_func_table.Add(746899919u, new RpcReceiveHandler(__rpc_handler_746899919));
		}

		private static void __rpc_handler_3835659538(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string commandMessage = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref commandMessage, false);
				}
				Vector3 targetPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref targetPos);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SimpleCommandsNetworkManager)(object)target).RequestCommandExecutionServerRpc(playerId, commandMessage, targetPos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3869478541(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string commandMessage = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref commandMessage, false);
				}
				bool hideDefault = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hideDefault, default(ForPrimitives));
				Vector3 targetPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref targetPos);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SimpleCommandsNetworkManager)(object)target).CommandExecutionClientRpc(playerId, commandMessage, hideDefault, targetPos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_746899919(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string title = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref title, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				string description = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref description, false);
				}
				bool isError = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isError, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SimpleCommandsNetworkManager)(object)target).SendErrorTipClientRpc(playerId, title, description, isError);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "SimpleCommandsNetworkManager";
		}
	}
}
namespace SimpleCommands.Components
{
	internal class PlayerModification : MonoBehaviour
	{
		private PlayerControllerB player;

		public bool infinateSprint = false;

		public bool invulnerable = false;

		public void Start()
		{
			player = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
		}

		public void Update()
		{
			ApplyUpdate();
		}

		private void ApplyUpdate()
		{
			if (infinateSprint)
			{
				player.sprintMeter = 1f;
			}
		}
	}
}
namespace SimpleCommands.Commands
{
	public class ChargeCommand : SimpleCommand
	{
		public ChargeCommand()
			: base("charge", "charges held item")
		{
			instructions.Add("[/cmd]");
			instructions.Add("[/cmd] [target]");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			PlayerControllerB val = sender;
			if (!parameters.IsEmpty())
			{
				string stringAt = parameters.GetStringAt(0);
				PlayerControllerB player = SimpleCommand.GetPlayer(stringAt);
				if (!((Object)(object)player != (Object)null))
				{
					success = false;
					return SimpleCommand.UnknownPlayerException(stringAt);
				}
				val = player;
			}
			GrabbableObject currentlyHeldObjectServer = val.currentlyHeldObjectServer;
			if ((Object)(object)currentlyHeldObjectServer != (Object)null && currentlyHeldObjectServer.itemProperties.requiresBattery)
			{
				currentlyHeldObjectServer.insertedBattery = new Battery(false, 1f);
			}
			success = true;
			return "Charged " + val.playerUsername + "'s Item.";
		}
	}
	public class ClearCommand : SimpleCommand
	{
		public ClearCommand()
			: base("clear", "clears chat")
		{
			instructions.Add("[/cmd] - clears chat");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			success = true;
			SimpleCommand.ClearChat();
			JHudHelper.ClearDisplayTipQueue();
			return "";
		}
	}
	public abstract class BaseDamageCommand : SimpleCommand
	{
		public BaseDamageCommand(string name, string description)
			: base(name, description)
		{
			instructions.Add("[/cmd]");
			instructions.Add("[/cmd] [value]");
			instructions.Add("[/cmd] [value] [damageType]");
			instructions.Add("[/cmd] [target]");
			instructions.Add("[/cmd] [target] [value]");
			instructions.Add("[/cmd] [target] [value] [damageType]");
		}

		public static CauseOfDeath GetDamageType(string name)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			foreach (CauseOfDeath value in Enum.GetValues(typeof(CauseOfDeath)))
			{
				CauseOfDeath result = value;
				if (((object)(CauseOfDeath)(ref result)).ToString().ToLower() == name.ToLower())
				{
					return result;
				}
			}
			return (CauseOfDeath)0;
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB effected = sender;
			int amount = DefaultValue();
			CauseOfDeath causeOfDeath = (CauseOfDeath)0;
			if (!parameters.IsEmpty())
			{
				string stringAt = parameters.GetStringAt(0);
				PlayerControllerB player = SimpleCommand.GetPlayer(stringAt);
				bool flag = false;
				if ((Object)(object)player != (Object)null)
				{
					effected = player;
					flag = true;
				}
				else
				{
					bool isNumber;
					int numberAt = parameters.GetNumberAt(0, out isNumber);
					if (!isNumber)
					{
						success = false;
						return SimpleCommand.UnknownNumberException();
					}
					amount = numberAt;
				}
				if (parameters.Count() > 1)
				{
					if (flag)
					{
						bool isNumber2;
						int numberAt2 = parameters.GetNumberAt(1, out isNumber2);
						if (!isNumber2)
						{
							success = false;
							return SimpleCommand.UnknownNumberException();
						}
						amount = numberAt2;
					}
					else
					{
						causeOfDeath = GetDamageType(parameters.GetStringAt(1));
					}
				}
				if (flag && parameters.Count() > 2)
				{
					causeOfDeath = GetDamageType(parameters.GetStringAt(2));
				}
			}
			success = true;
			return ApplyDamage(amount, effected, causeOfDeath);
		}

		public abstract int DefaultValue();

		public abstract string ApplyDamage(int amount, PlayerControllerB effected, CauseOfDeath causeOfDeath);
	}
	public class HealCommand : BaseDamageCommand
	{
		public HealCommand()
			: base("heal", "heals players")
		{
		}

		public override string ApplyDamage(int amount, PlayerControllerB effected, CauseOfDeath causeOfDeath)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			effected.DamagePlayer(-amount, true, true, causeOfDeath, 0, false, default(Vector3));
			effected.health = Mathf.Clamp(amount, 0, 100);
			return "Healed " + effected.playerUsername + " to " + ((effected.health == 100) ? "max" : "effected.health") + " HP.";
		}

		public override int DefaultValue()
		{
			return 100;
		}
	}
	public class DamageCommand : BaseDamageCommand
	{
		public DamageCommand()
			: base("damage", "hurts players")
		{
		}

		public override string ApplyDamage(int amount, PlayerControllerB effected, CauseOfDeath causeOfDeath)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			effected.DamagePlayer(amount, true, true, causeOfDeath, 0, false, default(Vector3));
			return $"Delt {amount} damage to {effected.playerUsername}.";
		}

		public override int DefaultValue()
		{
			return 10;
		}
	}
	public class ExplodeCommand : BaseDamageCommand
	{
		public ExplodeCommand()
			: base("explode", "explodes players")
		{
		}

		public override string ApplyDamage(int amount, PlayerControllerB effected, CauseOfDeath causeOfDeath)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(((Component)effected).transform.position, true, 0f, 8f, amount, (float)amount * 0.75f, (GameObject)null, false);
			return $"Exploded {effected.playerUsername}. {amount} dmg.";
		}

		public override int DefaultValue()
		{
			return 69;
		}
	}
	public class ExtendCommand : SimpleCommand
	{
		public ExtendCommand()
			: base("extend", "extends quota")
		{
			instructions.Add("[/cmd] - Extends Quota 1 Day");
			instructions.Add("[/cmd] [days]");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			int num = (parameters.IsEmpty() ? 1 : parameters.GetNumber());
			if (num != 0)
			{
				TimeOfDay instance = TimeOfDay.Instance;
				instance.timeUntilDeadline += instance.totalTime * (float)num;
				instance.UpdateProfitQuotaCurrentTime();
				success = true;
				return "Extended Deadline " + num + " day(s).";
			}
			success = false;
			return "";
		}
	}
	public class InfiniteSprintCommand : SimpleCommand
	{
		public InfiniteSprintCommand()
			: base("stamina", "toggle infinate sprint")
		{
			instructions.Add("[/cmd]");
			instructions.Add("[/cmd] [target]");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			PlayerControllerB val = sender;
			success = false;
			if (!parameters.IsEmpty())
			{
				string stringAt = parameters.GetStringAt(0);
				PlayerControllerB player = SimpleCommand.GetPlayer(stringAt);
				if (!((Object)(object)player != (Object)null))
				{
					return SimpleCommand.UnknownPlayerException(stringAt);
				}
				val = player;
			}
			if (toggleInfiniteStamina(val, out var newValue))
			{
				success = true;
				return "Infinite Stamina for " + val.playerUsername + " set to " + newValue;
			}
			return "";
		}

		private bool toggleInfiniteStamina(PlayerControllerB player, out bool newValue)
		{
			PlayerModification playerModification = default(PlayerModification);
			if (((Component)player).TryGetComponent<PlayerModification>(ref playerModification))
			{
				newValue = !playerModification.infinateSprint;
				playerModification.infinateSprint = newValue;
				return true;
			}
			newValue = false;
			return false;
		}
	}
	public class InvulnerabilityCommand : SimpleCommand
	{
		public InvulnerabilityCommand()
			: base("god", "toggle invulnerability")
		{
			instructions.Add("[/cmd]");
			instructions.Add("[/cmd] [target]");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			PlayerControllerB val = sender;
			success = false;
			if (!parameters.IsEmpty())
			{
				string stringAt = parameters.GetStringAt(0);
				PlayerControllerB player = SimpleCommand.GetPlayer(stringAt);
				if (!((Object)(object)player != (Object)null))
				{
					return SimpleCommand.UnknownPlayerException(stringAt);
				}
				val = player;
			}
			if (toggleInvulnerability(val, out var newValue))
			{
				success = true;
				return "Invulnerability for " + val.playerUsername + " set to " + newValue;
			}
			return "";
		}

		private bool toggleInvulnerability(PlayerControllerB player, out bool newValue)
		{
			PlayerModification playerModification = default(PlayerModification);
			if (((Component)player).TryGetComponent<PlayerModification>(ref playerModification))
			{
				newValue = !playerModification.invulnerable;
				playerModification.invulnerable = newValue;
				return true;
			}
			newValue = false;
			return false;
		}
	}
	public class ItemCommand : SimpleCommand
	{
		public ItemCommand()
			: base("item", "spawns item")
		{
			instructions.Add("[/cmd] [item]");
			instructions.Add("[/cmd] [target] [item]");
			instructions.Add("[/cmd] [item] [x] [y] [z]");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			success = false;
			if (((NetworkBehaviour)sender).IsHost || ((NetworkBehaviour)sender).IsServer)
			{
				string text = "";
				Vector3 val = ((Component)sender).transform.position;
				if (!parameters.IsEmpty())
				{
					string @string = parameters.GetString();
					if (parameters.Count() >= 4)
					{
						if (!parameters.GetRelativeVector(((Component)sender).transform.position, out var vector))
						{
							return SimpleCommand.UnknownVectorException();
						}
						text = @string;
						val = vector;
					}
					else if (parameters.Count(2))
					{
						PlayerControllerB player = SimpleCommand.GetPlayer(@string);
						text = parameters.GetString();
						if (!((Object)(object)player != (Object)null))
						{
							return SimpleCommand.UnknownPlayerException(name);
						}
						val = ((Component)player).transform.position;
					}
					else
					{
						text = @string;
					}
				}
				Terminal terminal = SimpleCommand.GetTerminal();
				if ((Object)(object)terminal == (Object)null)
				{
					return SimpleCommand.MissingTerminal();
				}
				List<Item> list = new List<Item>();
				foreach (Item items in RoundManager.Instance.playersManager.allItemsList.itemsList)
				{
					if (items.itemName.ToLower().Replace(' ', '_').StartsWith(text.ToLower()))
					{
						list.Add(items);
					}
				}
				if (list.Count > 0)
				{
					int index = 0;
					for (int i = 0; i < list.Count; i++)
					{
						if (list[i].itemName.Length < list[index].itemName.Length)
						{
							index = i;
						}
					}
					GameObject val2 = Object.Instantiate<GameObject>(list[index].spawnPrefab, val, Quaternion.identity);
					GrabbableObject component = val2.GetComponent<GrabbableObject>();
					component.fallTime = 0f;
					if (list[index].isScrap)
					{
						component.SetScrapValue(Random.Range(list[index].minValue, list[index].maxValue));
					}
					((Component)component).GetComponent<NetworkObject>().Spawn(false);
					success = true;
					return $"Spawned {list[index].itemName} at {val}.";
				}
				return "Unknown Item: " + text;
			}
			return "";
		}
	}
	public class ItemsCommand : SimpleCommand
	{
		public ItemsCommand()
			: base("items", "lists items")
		{
			overrideShowOutput = true;
			permissionRequired = false;
			instructions.Add("[/cmd] - lists item ids");
			instructions.Add("[/cmd] [page]");
			tagInfo.Add("'Store':\nFilters to show store items");
			tagInfo.Add("'Scrap':\nFilters to show scrap items");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			List<Item> list = new List<Item>();
			string header = "";
			bool flag = parameters.isFlagged("store");
			bool flag2 = parameters.isFlagged("scrap");
			if (flag || flag2)
			{
				if (flag)
				{
					header = "Buyable Items:";
					Terminal terminal = SimpleCommand.GetTerminal();
					if ((Object)(object)terminal == (Object)null)
					{
						success = false;
						return SimpleCommand.MissingTerminal();
					}
					list.AddRange(terminal.buyableItemsList);
				}
				if (flag2)
				{
					header = "Scrap for Moon:";
					foreach (SpawnableItemWithRarity item in StartOfRound.Instance.currentLevel.spawnableScrap)
					{
						list.Add(item.spawnableItem);
					}
				}
				if (flag && flag2)
				{
					header = "Buyables & Scrap:";
				}
			}
			else
			{
				header = "All Items:";
				list.AddRange(RoundManager.Instance.playersManager.allItemsList.itemsList);
			}
			List<string> list2 = new List<string>();
			foreach (Item item2 in list)
			{
				list2.Add(item2.itemName.Replace(' ', '_'));
			}
			int page = 0;
			if (!parameters.IsEmpty())
			{
				page = parameters.GetNumber();
			}
			success = true;
			SimpleCommand.ClearChat();
			return PagedList(header, list2, page, 8);
		}
	}
	public class ListCommand : SimpleCommand
	{
		public ListCommand()
			: base("list", "lists players")
		{
			overrideShowOutput = true;
			permissionRequired = false;
			instructions.Add("[/cmd]");
			instructions.Add("[/cmd] [page]");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			List<string> list = new List<string>();
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			PlayerControllerB[] array = allPlayerScripts;
			foreach (PlayerControllerB val in array)
			{
				if (val.isPlayerControlled && !val.isPlayerDead)
				{
					list.Add(val.playerUsername.Replace(' ', '_'));
				}
			}
			int page = 0;
			if (!parameters.IsEmpty())
			{
				page = parameters.GetNumber();
			}
			success = true;
			return PagedList("Players in Lobby:", list, page, 4);
		}
	}
	public class HelpCommand : SimpleCommand
	{
		public HelpCommand()
			: base("help", "lists commands")
		{
			overrideShowOutput = true;
			permissionRequired = false;
			instructions.Add("[/cmd] - Lists Commands");
			instructions.Add("[/cmd] [page]");
			instructions.Add("[/cmd] [cmd]");
			instructions.Add("[/cmd] [cmd] [page]");
			instructions.Add("[/cmd] [cmd] (flags)");
			instructions.Add("[/cmd] [cmd] (flags) [page]");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			success = true;
			int page = 0;
			if (!parameters.IsEmpty())
			{
				page = parameters.GetNumberAt(0, out var isNumber);
				if (!isNumber)
				{
					string @string = parameters.GetString();
					SimpleCommand simpleCommand = SimpleCommand.tryGetCommand(@string);
					if (simpleCommand != null)
					{
						if (parameters.Count(2))
						{
							string string2 = parameters.GetString();
							if (string2 == "flags")
							{
								if (parameters.Count(3))
								{
									page = parameters.GetNumberAt(2);
								}
								SimpleCommand.ClearChat();
								return PagedList(simpleCommand.name.ToUpper() + " Accepted Flags:", simpleCommand.tagInfo, page, 4);
							}
							page = parameters.GetNumberAt(1);
						}
						SimpleCommand.ClearChat();
						return PagedList(simpleCommand.name.ToUpper() + " Use Cases:\n" + SimpleCommand.GetPrefix() + "help " + simpleCommand.name + " flags\nfor flag info]", simpleCommand.instructions, page).Replace("[/cmd]", SimpleCommand.GetPrefix() + @string);
					}
					if (@string.ToLower() == "flags")
					{
						return "Flags Example:\n" + SimpleCommand.GetPrefix() + "pay | hide\n" + SimpleCommand.GetPrefix() + "help [cmd] flags\nto see flag modifiers.";
					}
				}
			}
			List<string> list = new List<string>();
			foreach (SimpleCommand command in SimpleCommand.GetCommands())
			{
				list.Add(SimpleCommand.GetPrefix() + command.name + " - " + command.description);
			}
			SimpleCommand.ClearChat();
			return PagedList("List of Commands:", list, page);
		}
	}
	public class PayCommand : SimpleCommand
	{
		public PayCommand()
			: base("pay", "free credits")
		{
			instructions.Add("[/cmd] - Grants 100 credits");
			instructions.Add("[/cmd] [value]");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			success = false;
			Terminal terminal = SimpleCommand.GetTerminal();
			if ((Object)(object)terminal == (Object)null)
			{
				return SimpleCommand.MissingTerminal();
			}
			int num = ((!parameters.IsEmpty()) ? parameters.GetNumber() : 100);
			if (num != 0)
			{
				terminal.groupCredits += num;
				success = true;
				return "Received " + num + " Credits.";
			}
			return "";
		}
	}
	public abstract class SimpleCommand
	{
		public class CommandParameters
		{
			private string[] parameters;

			private string[] flags;

			private Vector3 targetPos;

			private int place = 0;

			public CommandParameters(string[] parameters, string[] flags, Vector3 targetPos)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				this.parameters = parameters;
				this.flags = flags;
				this.targetPos = targetPos + Vector3.up;
			}

			public Vector3 GetTargetPos()
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				return targetPos;
			}

			public bool isFlagged(string flag)
			{
				for (int i = 0; i < flags.Length; i++)
				{
					if (flags[i] == flag.ToLower())
					{
						return true;
					}
				}
				return false;
			}

			public bool Count(int value)
			{
				return parameters.Length >= value;
			}

			public int Count()
			{
				return parameters.Length;
			}

			public bool IsEmpty()
			{
				return parameters.Length == 0;
			}

			public string asString()
			{
				return "parameters: [" + string.Join(", ", parameters) + "], flags: [" + string.Join(", ", flags) + "]";
			}

			public string GetLowerCase()
			{
				return GetString().ToLower();
			}

			public string GetString()
			{
				string stringAt = GetStringAt(Math.Min(parameters.Length - 1, place));
				place++;
				return stringAt;
			}

			public string GetStringAt(int index)
			{
				return parameters[index];
			}

			public string GetLast()
			{
				return GetStringAt(parameters.Length - 1);
			}

			public int GetNumber()
			{
				bool isNumber;
				int numberAt = GetNumberAt(Math.Min(parameters.Length - 1, place), out isNumber);
				place++;
				return numberAt;
			}

			public int GetNumberAt(int index)
			{
				bool isNumber;
				return GetNumberAt(index, out isNumber);
			}

			public int GetNumberAt(int index, out bool isNumber)
			{
				isNumber = int.TryParse(parameters[index], out var result);
				if (isNumber)
				{
					return result;
				}
				return 0;
			}

			public PlayerControllerB? GetPlayer()
			{
				PlayerControllerB playerAt = GetPlayerAt(Math.Min(parameters.Length - 1, place));
				place++;
				return playerAt;
			}

			public PlayerControllerB? GetPlayerAt(int index)
			{
				return SimpleCommand.GetPlayer(parameters[index]);
			}

			public bool GetVector(out Vector3 vector)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				return GetRelativeVector(Vector3.zero, out vector);
			}

			public bool GetVectorAt(int startIndex, out Vector3 vector)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				return GetRelativeVectorAt(startIndex, Vector3.zero, out vector);
			}

			public bool GetRelativeVector(Vector3 origin, out Vector3 vector)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				bool relativeVectorAt = GetRelativeVectorAt(Math.Min(parameters.Length - 1, place), origin, out vector);
				place += 3;
				return relativeVectorAt;
			}

			public bool GetRelativeVectorAt(int startIndex, Vector3 origin, out Vector3 vector)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				vector = Vector3.zero;
				if (startIndex + 2 < parameters.Length)
				{
					float[] array = new float[3];
					for (int i = 0; i < 3; i++)
					{
						string stringAt = GetStringAt(startIndex + i);
						if (float.TryParse(stringAt, out var result))
						{
							array[i] = result;
							continue;
						}
						if (GetRelative(stringAt, i, origin, out var output))
						{
							array[i] = output;
							continue;
						}
						return false;
					}
					vector = new Vector3(array[0], array[1], array[2]);
					return true;
				}
				return false;
			}

			private bool GetRelative(string num, int i, Vector3 origin, out float output)
			{
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				output = 0f;
				switch (num[0])
				{
				case '~':
				{
					if (1 == 0)
					{
					}
					float num2 = i switch
					{
						0 => origin.x, 
						1 => origin.y, 
						2 => origin.z, 
						_ => ((Vector3)(ref origin)).magnitude, 
					};
					if (1 == 0)
					{
					}
					output = num2;
					break;
				}
				case '^':
				{
					if (1 == 0)
					{
					}
					float num2 = i switch
					{
						0 => targetPos.x, 
						1 => targetPos.y, 
						2 => targetPos.z, 
						_ => ((Vector3)(ref targetPos)).magnitude, 
					};
					if (1 == 0)
					{
					}
					output = num2;
					break;
				}
				default:
					return false;
				}
				if (float.TryParse(num.Substring(1, num.Length - 1), out var result))
				{
					output += result;
				}
				return true;
			}
		}

		public string name;

		public string description;

		public bool permissionRequired = true;

		public bool overrideShowOutput = false;

		public List<string> instructions = new List<string>();

		public List<string> tagInfo = new List<string>();

		private static readonly List<SimpleCommand> SimpleCommands = new List<SimpleCommand>();

		public SimpleCommand(string name, string description)
		{
			this.name = name;
			this.description = description;
		}

		public abstract string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success);

		public string PagedList(string header, List<string> entries, int page, int pageMax = 5)
		{
			List<string> list = new List<string>();
			int num = (int)Math.Ceiling((float)entries.Count / ((float)pageMax + 0f));
			page = Math.Clamp(page - 1, 0, num - 1);
			if (entries.Count > pageMax)
			{
				for (int i = Math.Clamp(page * pageMax, 0, entries.Count - 1); i < Math.Min(entries.Count, (page + 1) * pageMax); i++)
				{
					list.Add(entries[i]);
				}
				list.Add($"[Page {Math.Min(page + 1, num)} of {num}]");
			}
			else
			{
				list = entries;
			}
			return header + "\n" + string.Join("\n", list);
		}

		public static bool IsClient(PlayerControllerB sender)
		{
			return ((NetworkBehaviour)sender).IsOwner;
		}

		public static string UnknownPlayerException(string username)
		{
			return ((username == "") ? "Unknown" : ("\"" + username + "\"")) + " is not in this lobby.";
		}

		public static string UnknownNumberException()
		{
			return "A Number was not able to be parsed.";
		}

		public static string UnknownVectorException()
		{
			return "A Position (X Y Z) was not able to be parsed.";
		}

		public static string MissingTerminal()
		{
			return "Missing Terminal.";
		}

		public static List<SimpleCommand> GetCommands()
		{
			return SimpleCommands;
		}

		public static string GetPrefix()
		{
			return SimpleCommandsBase.commandPrefix.Value;
		}

		public static void Register(SimpleCommand command)
		{
			if (!command.overrideShowOutput)
			{
				command.tagInfo.Add("'Hide':\nHides command chat output.");
			}
			SimpleCommands.Add(command);
			SimpleCommandsBase.LogInfo("Registered Simple Command: " + GetPrefix() + " " + command.name, (JLogLevel)2);
		}

		public static bool tryParseCommand(string cmd, out SimpleCommand? command, out CommandParameters? parameters, Vector3 targetPos)
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			parameters = null;
			string[] array = cmd.Split(' ');
			command = tryGetCommand(array[0]);
			if (command == null)
			{
				return false;
			}
			List<string> list = new List<string>();
			List<string> list2 = new List<string>();
			bool flag = true;
			for (int i = 1; i < array.Length; i++)
			{
				if (flag)
				{
					if (!(array[i] == ""))
					{
						if (array[i] == "|")
						{
							flag = false;
						}
						else
						{
							list.Add(array[i]);
						}
					}
				}
				else
				{
					list2.Add(array[i].ToLower());
				}
			}
			parameters = new CommandParameters(list.ToArray(), list2.ToArray(), targetPos);
			return true;
		}

		public static SimpleCommand? tryGetCommand(string name)
		{
			foreach (SimpleCommand simpleCommand in SimpleCommands)
			{
				if (simpleCommand.name.ToLower() == name.ToLower())
				{
					return simpleCommand;
				}
			}
			return null;
		}

		public static PlayerControllerB? GetPlayer(string name)
		{
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.playerUsername.ToLower().Replace(' ', '_').StartsWith(name.ToLower().Replace(' ', '_')))
				{
					list.Add(val);
				}
			}
			if (list.Count > 0)
			{
				int index = 0;
				for (int j = 0; j < list.Count; j++)
				{
					if (((Object)list[j]).name.Length < ((Object)list[index]).name.Length)
					{
						index = j;
					}
				}
				return list[index];
			}
			return null;
		}

		public static Terminal GetTerminal()
		{
			return JLevelPropertyRegistry.GetTerminal();
		}

		public static void ClearChat()
		{
			HUDManager instance = HUDManager.Instance;
			instance.ChatMessageHistory.Clear();
			((TMP_Text)instance.chatText).SetText("", true);
			instance.lastChatMessage = "";
		}
	}
	public class SpawnCommand : SimpleCommand
	{
		public SpawnCommand()
			: base("spawn", "spawns item")
		{
			instructions.Add("[/cmd] [enemy]");
			instructions.Add("[/cmd] [target] [enemy]");
			instructions.Add("[/cmd] [enemy] [x] [y] [z]");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			success = false;
			if (((NetworkBehaviour)sender).IsHost || ((NetworkBehaviour)sender).IsServer)
			{
				string text = "";
				Vector3 val = ((Component)sender).transform.position;
				if (!parameters.IsEmpty())
				{
					string @string = parameters.GetString();
					if (parameters.Count() >= 4)
					{
						if (!parameters.GetRelativeVector(((Component)sender).transform.position, out var vector))
						{
							return SimpleCommand.UnknownVectorException();
						}
						text = @string;
						val = vector;
					}
					else if (parameters.Count(2))
					{
						PlayerControllerB player = SimpleCommand.GetPlayer(@string);
						text = parameters.GetString();
						if (!((Object)(object)player != (Object)null))
						{
							return SimpleCommand.UnknownPlayerException(name);
						}
						val = ((Component)player).transform.position;
					}
					else
					{
						text = @string;
					}
				}
				List<EnemyType> list = new List<EnemyType>();
				foreach (EnemyType allSortedEnemy in JLevelPropertyRegistry.AllSortedEnemies)
				{
					if (allSortedEnemy.enemyName.ToLower().Replace(' ', '_').StartsWith(text.ToLower()))
					{
						list.Add(allSortedEnemy);
					}
				}
				if (list.Count > 0)
				{
					int index = 0;
					for (int i = 0; i < list.Count; i++)
					{
						if (list[i].enemyName.Length < list[index].enemyName.Length)
						{
							index = i;
						}
					}
					if ((Object)(object)list[index].enemyPrefab != (Object)null)
					{
						NavMeshHit val2 = default(NavMeshHit);
						if (!NavMesh.SamplePosition(val, ref val2, 5f, -1))
						{
							return "Failed to spawn. (Couldn't Find NavMesh.)";
						}
						GameObject val3 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(((NavMeshHit)(ref val2)).position, 0f, 0, list[index]));
					}
					success = true;
					return $"Spawned {list[index].enemyName} at {val}.";
				}
				return "Unknown Enemy: " + text;
			}
			return "";
		}
	}
	public class EnemiesCommand : SimpleCommand
	{
		public EnemiesCommand()
			: base("enemies", "lists enemies")
		{
			overrideShowOutput = true;
			permissionRequired = false;
			instructions.Add("[/cmd] - lists item ids");
			instructions.Add("[/cmd] [page]");
			tagInfo.Add("'Indoor':\nFilters to show interior enemies");
			tagInfo.Add("'Outdoor':\nFilters to show exterior enemies");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			string header = "";
			bool flag = parameters.isFlagged("indoor");
			bool flag2 = parameters.isFlagged("outdoor");
			if (flag || flag2)
			{
				if (flag)
				{
					header = "Indoor Enemies:";
				}
				if (flag2)
				{
					header = "Outdoor Enemies:";
				}
				if (flag && flag2)
				{
					header = "Spawnable Enemies:";
				}
			}
			else
			{
				header = "Spawnable Enemies:";
				flag = true;
				flag2 = true;
			}
			List<string> list = new List<string>();
			foreach (EnemyType allSortedEnemy in JLevelPropertyRegistry.AllSortedEnemies)
			{
				if ((allSortedEnemy.isOutsideEnemy || allSortedEnemy.isDaytimeEnemy) ? flag2 : flag)
				{
					list.Add(allSortedEnemy.enemyName.Replace(' ', '_'));
				}
			}
			int page = 0;
			if (!parameters.IsEmpty())
			{
				page = parameters.GetNumber();
			}
			success = true;
			SimpleCommand.ClearChat();
			return PagedList(header, list, page, 8);
		}
	}
	public class TeleportCommand : SimpleCommand
	{
		public TeleportCommand()
			: base("tp", "teleports players")
		{
			instructions.Add("[/cmd] [destination] - Teleports Self");
			instructions.Add("[/cmd] (ship | main | exit{#}) - Teleports Self");
			instructions.Add("[/cmd] [target] [destination]");
			instructions.Add("[/cmd] [target] (ship | main | exit{#})");
			instructions.Add("[/cmd] [x] [y] [z] - Teleports self");
			instructions.Add("[/cmd] [target] [x] [y] [z]");
			tagInfo.Add("'Animate':\nTeleport instantly skipping teleport animation.");
			tagInfo.Add("'Inside':\nSets the teleported player inside the facility.");
			tagInfo.Add("'Outside':\nSets the teleported player outside the facility.");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			string formalName = "";
			bool instant = !parameters.isFlagged("animate");
			success = false;
			bool isInside = sender.isInsideFactory;
			if (parameters.isFlagged("inside"))
			{
				isInside = true;
			}
			else if (parameters.isFlagged("outside"))
			{
				isInside = false;
			}
			switch (parameters.Count())
			{
			case 1:
			{
				string @string = parameters.GetString();
				PlayerControllerB player = SimpleCommand.GetPlayer(@string);
				if ((Object)(object)player != (Object)null)
				{
					text = sender.playerUsername;
					formalName = player.playerUsername;
					TeleportPlayer(sender, ((Component)player).transform.position, instant, isInside);
					break;
				}
				if (GetSpecialLocation(@string, out Vector3 pos2, out formalName, ref isInside))
				{
					text = sender.playerUsername;
					TeleportPlayer(sender, pos2, instant, isInside);
					break;
				}
				return SimpleCommand.UnknownPlayerException(@string);
			}
			case 2:
			{
				string @string = parameters.GetString();
				PlayerControllerB player = SimpleCommand.GetPlayer(@string);
				if ((Object)(object)player == (Object)null)
				{
					return SimpleCommand.UnknownPlayerException(@string);
				}
				string string2 = parameters.GetString();
				PlayerControllerB player2 = SimpleCommand.GetPlayer(string2);
				if ((Object)(object)player2 == (Object)null)
				{
					if (!GetSpecialLocation(string2, out Vector3 pos, out formalName, ref isInside))
					{
						return SimpleCommand.UnknownPlayerException(string2);
					}
					text = player.playerUsername;
					TeleportPlayer(player, pos, instant, isInside);
				}
				else
				{
					text = sender.playerUsername;
					formalName = player.playerUsername;
					TeleportPlayer(player, ((Component)player2).transform.position, instant, isInside);
				}
				break;
			}
			case 3:
			{
				if (parameters.GetRelativeVector(((Component)sender).transform.position, out var vector2))
				{
					text = sender.playerUsername;
					formalName = vector2.x + ", " + vector2.y + ", " + vector2.z;
					TeleportPlayer(sender, vector2, instant, isInside);
					break;
				}
				return SimpleCommand.UnknownVectorException();
			}
			case 4:
			{
				string @string = parameters.GetString();
				PlayerControllerB player = SimpleCommand.GetPlayer(@string);
				if ((Object)(object)player != (Object)null)
				{
					if (parameters.GetRelativeVector(((Component)player).transform.position, out var vector))
					{
						text = player.playerUsername;
						formalName = vector.x + ", " + vector.y + ", " + vector.z;
						TeleportPlayer(player, vector, instant, isInside);
						break;
					}
					return SimpleCommand.UnknownVectorException();
				}
				return SimpleCommand.UnknownPlayerException(@string);
			}
			}
			if (text != "")
			{
				success = true;
				return "Teleporting " + text + " to " + formalName;
			}
			return "";
		}

		private bool GetSpecialLocation(string name, out Vector3 pos, out string formalName, ref bool isInside)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (name == "ship")
			{
				isInside = false;
				pos = new Vector3(0f, 0f, -14f);
				formalName = "your Autopilot Ship";
				return true;
			}
			int num = -1;
			int result;
			if (name == "main")
			{
				num = 0;
			}
			else if (name.StartsWith("exit") && int.TryParse(name.Substring(4), out result))
			{
				num = result;
			}
			if (num >= 0)
			{
				Vector3? entranceTeleportLocation = JLevelPropertyRegistry.GetEntranceTeleportLocation(num, !isInside, true);
				if (entranceTeleportLocation.HasValue)
				{
					pos = entranceTeleportLocation.Value;
					formalName = ((num == 0) ? "the Main Entrance" : $"Fire Exit #{num}");
					return true;
				}
			}
			formalName = "";
			pos = Vector3.zero;
			return false;
		}

		private void TeleportPlayer(PlayerControllerB player, Vector3 pos, bool instant, bool isInside)
		{
			//IL_0026: 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)
			if (instant)
			{
				player.isInsideFactory = isInside;
				player.TeleportPlayer(pos, false, 0f, false, true);
			}
			else
			{
				((MonoBehaviour)player).StartCoroutine(beamUpPlayer(player, pos, isInside));
			}
		}

		private IEnumerator beamUpPlayer(PlayerControllerB player, Vector3 pos, bool isInside)
		{
			//IL_0015: 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 ((Object)(object)player == (Object)null)
			{
				Debug.Log((object)"Targeted player is null");
				yield break;
			}
			player.shipTeleporterId = 1;
			player.beamUpParticle.Play();
			yield return (object)new WaitForSeconds(3f);
			player.isInsideFactory = isInside;
			player.averageVelocity = 0f;
			player.velocityLastFrame = Vector3.zero;
			player.TeleportPlayer(pos, false, 0f, false, true);
			player.shipTeleporterId = -1;
		}
	}
	public class PosCommand : SimpleCommand
	{
		public PosCommand()
			: base("pos", "shows player position")
		{
			instructions.Add("[/cmd] - Shows Player Position");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			success = true;
			if (SimpleCommand.IsClient(sender))
			{
				JHudHelper.QueueDisplayTip($"Pos: {((Component)sender).transform.position}", $"Rot: {((Component)sender).transform.rotation}", false, false, "LC_Tip1");
				SimpleCommandsBase.LogInfo($"Pos: {((Component)sender).transform.position} | Rot: {((Component)sender).transform.rotation}", (JLogLevel)2);
			}
			return "";
		}
	}
	public class TerminalCommand : SimpleCommand
	{
		public TerminalCommand()
			: base("terminal", "Send Terminal Codes")
		{
			instructions.Add("[/cmd] [code] - Used for opening doors / disabling hazards.");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			success = false;
			Terminal terminal = SimpleCommand.GetTerminal();
			if ((Object)(object)terminal == (Object)null)
			{
				return SimpleCommand.MissingTerminal();
			}
			if (!parameters.IsEmpty())
			{
				string @string = parameters.GetString();
				TerminalPatch.terminalObjectRequest(terminal, @string);
				success = true;
				return "";
			}
			return "";
		}
	}
	public class WeatherCommand : SimpleCommand
	{
		public static Dictionary<string, string> weatherAlias = new Dictionary<string, string>();

		public WeatherCommand()
			: base("weather", "changes weather")
		{
			instructions.Add("[/cmd] (clear | dusty | foggy | rainy | stormy | eclipsed)");
			if (JCompatabilityHelper.IsModLoaded.WeatherRegistry)
			{
				instructions.Add("{Check /weatherregistry for weather registry weather ids}");
			}
			weatherAlias.Add("clear", "none");
			weatherAlias.Add("dust", "dustclouds");
			weatherAlias.Add("dusty", "dustclouds");
			weatherAlias.Add("fog", "foggy");
			weatherAlias.Add("rain", "rainy");
			weatherAlias.Add("storm", "stormy");
			weatherAlias.Add("eclipse", "eclipsed");
		}

		public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
		{
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			success = false;
			if (!StartOfRound.Instance.inShipPhase)
			{
				return "Can not change weather mid round!";
			}
			if (parameters.Count() >= 1)
			{
				string text = parameters.GetLowerCase();
				string text2 = string.Empty;
				if (weatherAlias.ContainsKey(text))
				{
					text = weatherAlias[text];
				}
				if (JCompatabilityHelper.IsModLoaded.WeatherRegistry)
				{
					foreach (string customWeatherName in JWeatherRegistryHelper.GetCustomWeatherNames())
					{
						if (customWeatherName.ToLower().Replace(" ", "_").Equals(text))
						{
							text2 = customWeatherName;
							break;
						}
					}
				}
				SelectableLevel currentLevel = StartOfRound.Instance.currentLevel;
				if (text2.Equals(string.Empty))
				{
					LevelWeatherType currentWeather;
					switch (text)
					{
					case "none":
						currentWeather = (LevelWeatherType)(-1);
						break;
					case "dustclouds":
						currentWeather = (LevelWeatherType)0;
						break;
					case "foggy":
						currentWeather = (LevelWeatherType)3;
						break;
					case "rainy":
						currentWeather = (LevelWeatherType)1;
						break;
					case "stormy":
						currentWeather = (LevelWeatherType)2;
						break;
					case "eclipsed":
						currentWeather = (LevelWeatherType)5;
						break;
					default:
						return "Unknown Weather: " + text;
					}
					currentLevel.currentWeather = currentWeather;
				}
				else
				{
					JWeatherRegistryHelper.ChangeWeather(text2, currentLevel);
				}
				success = true;
				return "Set Weather for " + currentLevel.PlanetName + " to " + text + ".";
			}
			return "";
		}
	}
}
namespace Simple-Commands.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}