Decompiled source of ToxicOmega Tools v1.2.3

BepInEx/plugins/ToxicOmega_Tools.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using StaticNetcodeLib;
using TMPro;
using ToxicOmega_Tools.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ToxicOmega_Tools")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ToxicOmega_Tools")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f25f0ba7-4a38-4ce6-8d98-4ee185b333d6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace ToxicOmega_Tools
{
	internal class CustomGUI : MonoBehaviour
	{
		internal static bool nearbyVisible;

		internal static bool fullListVisible;

		internal static string posLabelText;

		internal static string itemListText;

		internal static string terminalObjListText;

		internal static string enemyListText;

		private void OnGUI()
		{
			//IL_0040: 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_00ac: 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 (nearbyVisible || fullListVisible)
			{
				GUI.Label(new Rect((float)(Screen.width / 4), (float)(Screen.height / 8), (float)(Screen.width / 2), (float)Screen.height * 0.75f), itemListText);
				GUI.Label(new Rect((float)(Screen.width / 2), (float)(Screen.height / 8), (float)(Screen.width / 2), (float)Screen.height * 0.75f), terminalObjListText);
				GUI.Label(new Rect((float)Screen.width * 0.75f, (float)(Screen.height / 8), (float)(Screen.width / 2), (float)Screen.height * 0.75f), enemyListText);
				GUI.Label(new Rect((float)(Screen.width / 2 - 75), (float)Screen.height * 0.75f, 150f, 150f), posLabelText);
			}
		}

		public static IEnumerator UpdateGUI()
		{
			PlayerControllerB localPlayer = StartOfRound.Instance.localPlayerController;
			while (true)
			{
				if (!nearbyVisible && !fullListVisible)
				{
					yield return null;
				}
				itemListText = "";
				terminalObjListText = "";
				enemyListText = "";
				Vector3 position = ((localPlayer.isPlayerDead && (Object)(object)localPlayer.spectatedPlayerScript != (Object)null) ? ((Component)localPlayer.spectatedPlayerScript).transform.position : ((Component)localPlayer).transform.position);
				GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
				foreach (GrabbableObject obj in array)
				{
					if (Vector3.Distance(((Component)obj).transform.position, position) < 25f || fullListVisible)
					{
						itemListText += string.Format("{0} ({1}){2}\n", obj.itemProperties.itemName, ((NetworkBehaviour)obj).NetworkObjectId, (obj.scrapValue > 0) ? $" - ${obj.scrapValue}" : "");
					}
				}
				TerminalAccessibleObject[] array2 = Object.FindObjectsOfType<TerminalAccessibleObject>();
				foreach (TerminalAccessibleObject terminalObj in array2)
				{
					string objType = "";
					bool isActive = true;
					if (!(Vector3.Distance(((Component)terminalObj).transform.position, position) < 10f) && !fullListVisible)
					{
						continue;
					}
					if (terminalObj.isBigDoor)
					{
						objType = "Door";
					}
					else if (Object.op_Implicit((Object)(object)((Component)terminalObj).GetComponentInChildren<Landmine>()))
					{
						if (((Component)terminalObj).GetComponentInChildren<Landmine>().hasExploded)
						{
							continue;
						}
						objType = "Landmine";
						isActive = ((Component)terminalObj).GetComponent<Landmine>().mineActivated;
					}
					else if (Object.op_Implicit((Object)(object)((Component)terminalObj).GetComponentInChildren<Turret>()))
					{
						objType = "Turret";
						isActive = ((Component)terminalObj).GetComponent<Turret>().turretActive;
					}
					else if (Object.op_Implicit((Object)(object)((Component)((Component)terminalObj).transform.parent).gameObject.GetComponentInChildren<SpikeRoofTrap>()))
					{
						objType = "Spikes";
						isActive = ((Component)((Component)terminalObj).transform.parent).gameObject.GetComponentInChildren<SpikeRoofTrap>().trapActive;
					}
					else
					{
						objType += "Unknown";
					}
					terminalObjListText = terminalObjListText + ((!isActive || (terminalObj.isBigDoor && terminalObj.isDoorOpen)) ? ("<color=" + ((terminalObj.isBigDoor && terminalObj.isDoorOpen) ? "lime" : "red") + ">") : "") + terminalObj.objectCode.ToUpper() + ((!isActive || (terminalObj.isBigDoor && terminalObj.isDoorOpen)) ? "</color>" : "") + " - " + objType + "\n";
				}
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB player in allPlayerScripts)
				{
					if ((Vector3.Distance((player.isPlayerDead && (Object)(object)player.deadBody != (Object)null) ? ((Component)player.deadBody).transform.position : ((Component)player).transform.position, position) < 25f || fullListVisible) && (player.isPlayerControlled || player.isPlayerDead))
					{
						enemyListText += string.Format("{0}{1}{2} (#{3}{4})\n", player.isPlayerDead ? "<color=red>" : "", player.playerUsername, player.isPlayerDead ? "</color>" : "", player.playerClientId, Plugin.CheckPlayerIsHost(player) ? " - HOST" : "");
					}
				}
				EnemyAI[] array3 = Object.FindObjectsOfType<EnemyAI>();
				foreach (EnemyAI enemy in array3)
				{
					if (Vector3.Distance(((Component)enemy).transform.position, position) < 25f || fullListVisible)
					{
						enemyListText += string.Format("{0}{1}{2} ({3})\n", enemy.isEnemyDead ? "<color=red>" : "", enemy.enemyType.enemyName, enemy.isEnemyDead ? "</color>" : "", ((NetworkBehaviour)enemy).NetworkObjectId);
					}
				}
				yield return (object)new WaitForSeconds(0.1f);
			}
		}
	}
	[BepInPlugin("com.toxicomega.toxicomega_tools", "ToxicOmega Tools", "1.2.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "com.toxicomega.toxicomega_tools";

		private const string modName = "ToxicOmega Tools";

		private const string modVersion = "1.2.3";

		private readonly Harmony harmony = new Harmony("com.toxicomega.toxicomega_tools");

		internal static Plugin Instance;

		internal static ManualLogSource mls;

		internal static CustomGUI menu;

		internal static List<SpawnableEnemyWithRarity> customInsideList;

		internal static List<SpawnableEnemyWithRarity> customOutsideList;

		internal static List<SpawnableEnemyWithRarity> allEnemiesList;

		internal static List<SearchableGameObject> allSpawnablesList;

		internal static List<Vector3> waypoints = new List<Vector3>();

		internal static Random shipTeleporterSeed;

		internal static bool defog;

		internal static bool godmode;

		internal static bool nightVision;

		internal static bool noclip;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("com.toxicomega.toxicomega_tools");
			mls.LogInfo((object)"ToxicOmega Tools mod has awoken.");
			harmony.PatchAll();
			GUIPatch();
		}

		public static bool CheckPlayerIsHost(PlayerControllerB player)
		{
			return (Object)(object)((Component)player).gameObject == (Object)(object)player.playersManager.allPlayerObjects[0];
		}

		public static PlayerControllerB GetPlayerFromClientId(ulong clientId)
		{
			StartOfRound instance = StartOfRound.Instance;
			if (clientId >= (ulong)instance.allPlayerScripts.Length)
			{
				return null;
			}
			return instance.allPlayerScripts[clientId];
		}

		public static PlayerControllerB GetPlayerFromString(string searchString)
		{
			if (searchString.StartsWith("#") && searchString.Length > 1)
			{
				string text = searchString.Substring(1);
				if (ulong.TryParse(text, out var result))
				{
					PlayerControllerB playerFromClientId = GetPlayerFromClientId(result);
					if ((Object)(object)playerFromClientId != (Object)null && (playerFromClientId.isPlayerControlled || playerFromClientId.isPlayerDead))
					{
						return playerFromClientId;
					}
					LogMessage($"No Player with ID #{result}!", isError: true);
					return null;
				}
				LogMessage("Player ID #" + text + " is invalid!", isError: true);
				return null;
			}
			PlayerControllerB val = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB player) => player.playerUsername.ToLower().StartsWith(searchString.ToLower())));
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			LogMessage("Player " + searchString + " not found!", isError: true);
			return null;
		}

		public static Vector3 GetPositionFromCommand(string input, int positionType, string targetName = null)
		{
			//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_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0890: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: 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_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: 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_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_088b: Unknown result type (might be due to invalid IL or missing references)
			//IL_088c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: 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_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_077d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0782: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0841: Unknown result type (might be due to invalid IL or missing references)
			//IL_0846: Unknown result type (might be due to invalid IL or missing references)
			//IL_07da: Unknown result type (might be due to invalid IL or missing references)
			//IL_07df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_072d: Unknown result type (might be due to invalid IL or missing references)
			//IL_082f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0834: Unknown result type (might be due to invalid IL or missing references)
			//IL_0825: Unknown result type (might be due to invalid IL or missing references)
			//IL_082a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06df: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0753: 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_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0618: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
			Vector3 result = Vector3.zero;
			bool flag = false;
			Terminal val = Object.FindObjectOfType<Terminal>();
			RoundManager instance = RoundManager.Instance;
			RandomScrapSpawn[] array = Object.FindObjectsOfType<RandomScrapSpawn>();
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			if (input == "" || input == "$")
			{
				switch (positionType)
				{
				case 0:
					if (input == "")
					{
						result = ((!localPlayerController.isPlayerDead) ? ((Component)localPlayerController).transform.position : ((!((Object)(object)localPlayerController.spectatedPlayerScript != (Object)null)) ? ((!((Object)(object)StartOfRound.Instance.allPlayerScripts[localPlayerController.playerClientId].deadBody != (Object)null)) ? Vector3.zero : ((Component)StartOfRound.Instance.allPlayerScripts[localPlayerController.playerClientId].deadBody).transform.position) : ((Component)localPlayerController.spectatedPlayerScript).transform.position));
						break;
					}
					if (array.Length != 0)
					{
						result = ((Component)array[Random.Range(0, array.Length)]).transform.position;
						break;
					}
					LogMessage("No RandomScrapSpawn in this area!", isError: true);
					return Vector3.zero;
				case 1:
					if (instance.outsideAINodes.Length != 0 && (Object)(object)instance.outsideAINodes[0] != (Object)null)
					{
						result = instance.outsideAINodes[Random.Range(0, instance.outsideAINodes.Length)].transform.position;
						break;
					}
					LogMessage("No outsideAINodes in this area!", isError: true);
					return Vector3.zero;
				case 2:
					if (instance.allEnemyVents.Length != 0 && (Object)(object)instance.allEnemyVents[0] != (Object)null)
					{
						result = instance.allEnemyVents[Random.Range(0, instance.allEnemyVents.Length)].floorNode.position;
						break;
					}
					LogMessage("No allEnemyVents in this area!", isError: true);
					return Vector3.zero;
				case 3:
					if (instance.insideAINodes.Length != 0 && (Object)(object)instance.insideAINodes[0] != (Object)null)
					{
						if (shipTeleporterSeed == null)
						{
							mls.LogInfo((object)"Teleport Seed: Random");
							Vector3 position2 = instance.insideAINodes[Random.Range(0, instance.insideAINodes.Length)].transform.position;
							result = instance.GetRandomNavMeshPositionInRadius(position2, 10f, default(NavMeshHit));
						}
						else
						{
							mls.LogInfo((object)"Teleport Seed: Inverse-Teleporter");
							Vector3 position3 = instance.insideAINodes[shipTeleporterSeed.Next(0, instance.insideAINodes.Length)].transform.position;
							Random random = shipTeleporterSeed;
							result = instance.GetRandomNavMeshPositionInBoxPredictable(position3, 10f, default(NavMeshHit), random, -1);
						}
						LogMessage("Teleported " + targetName + " to random location within factory.");
						break;
					}
					LogMessage("No insideAINodes in this area!", isError: true);
					return Vector3.zero;
				case 4:
					if (instance.insideAINodes.Length != 0 && (Object)(object)instance.insideAINodes[0] != (Object)null)
					{
						Vector3 position = instance.insideAINodes[Random.Range(0, instance.insideAINodes.Length)].transform.position;
						result = instance.GetRandomNavMeshPositionInRadius(position, 10f, default(NavMeshHit));
						break;
					}
					LogMessage("No insideAINodes in this area!", isError: true);
					return Vector3.zero;
				}
			}
			else if (input == "!")
			{
				if (!((Object)(object)val != (Object)null))
				{
					LogMessage("Terminal not found!", isError: true);
					return Vector3.zero;
				}
				result = ((Component)val).transform.position;
				if (positionType == 3)
				{
					LogMessage("Teleported " + targetName + " to Terminal.");
				}
			}
			else if (input.StartsWith("@") && input.Length > 1)
			{
				if (!int.TryParse(input.Substring(1), out var result2))
				{
					LogMessage("Waypoint @" + input.Substring(1) + " is invalid!", isError: true);
					return Vector3.zero;
				}
				if (result2 >= waypoints.Count)
				{
					LogMessage("Waypoint @" + input.Substring(1) + " does not exist!", isError: true);
					return Vector3.zero;
				}
				result = waypoints[result2];
				if (positionType == 3)
				{
					LogMessage($"Teleported {targetName} to Waypoint @{result2}.");
				}
			}
			else if (input.StartsWith("+") || (input.StartsWith("-") && input.Length > 1))
			{
				PlayerControllerB val2 = ((localPlayerController.isPlayerDead && (Object)(object)localPlayerController.spectatedPlayerScript != (Object)null) ? localPlayerController.spectatedPlayerScript : localPlayerController);
				if (!((Object)(object)val2 != (Object)null) || !val2.isPlayerControlled)
				{
					LogMessage("Unable to get player origin position!", isError: true);
					return Vector3.zero;
				}
				if (input.Length > 1 && int.TryParse(input.Substring(1), out var result3))
				{
					result = ((Component)val2).transform.position + val2.playerGlobalHead.forward * (float)(result3 * ((!input.StartsWith("-")) ? 1 : (-1)));
				}
				else
				{
					RaycastHit val3 = default(RaycastHit);
					Physics.Raycast(((Component)val2.playerGlobalHead).transform.position + val2.playerGlobalHead.forward * 2f, val2.playerGlobalHead.forward, ref val3, (float)StartOfRound.Instance.collidersAndRoomMaskAndDefault);
					if (!((Object)(object)((RaycastHit)(ref val3)).collider != (Object)null))
					{
						LogMessage("Raycast failed!", isError: true);
						return Vector3.zero;
					}
					result = ((RaycastHit)(ref val3)).point;
				}
				if (positionType == 3)
				{
					LogMessage("Teleported " + targetName + " " + (input.StartsWith("-") ? "behind" : "in front of") + " " + val2.playerUsername + ".");
				}
			}
			else
			{
				ulong result4;
				bool flag2 = ulong.TryParse(input, out result4);
				EnemyAI enemyByNetId = Networking.GetEnemyByNetId(result4);
				GrabbableObject itemByNetId = Networking.GetItemByNetId(result4);
				if (flag2 && (Object)(object)enemyByNetId != (Object)null)
				{
					result = ((Component)enemyByNetId).transform.position;
				}
				else if (flag2 && (Object)(object)itemByNetId != (Object)null)
				{
					result = ((Component)itemByNetId).transform.position;
				}
				else
				{
					flag = true;
				}
			}
			if (flag)
			{
				PlayerControllerB playerFromString = GetPlayerFromString(input);
				if ((Object)(object)playerFromString == (Object)null)
				{
					return Vector3.zero;
				}
				result = ((!playerFromString.isPlayerDead) ? ((Component)playerFromString).transform.position : ((localPlayerController.playerClientId == playerFromString.playerClientId && (Object)(object)playerFromString.spectatedPlayerScript != (Object)null && input == "") ? ((Component)playerFromString.spectatedPlayerScript).transform.position : ((!((Object)(object)StartOfRound.Instance.allPlayerScripts[playerFromString.playerClientId].deadBody != (Object)null)) ? Vector3.zero : ((Component)StartOfRound.Instance.allPlayerScripts[playerFromString.playerClientId].deadBody).transform.position)));
				if (positionType == 3)
				{
					LogMessage("Teleported " + targetName + " to " + playerFromString.playerUsername + ".");
				}
			}
			return result;
		}

		private static void GUIPatch()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GameObject val = new GameObject("CustomGUI");
			Object.DontDestroyOnLoad((Object)(object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<CustomGUI>();
			menu = (CustomGUI)(object)val.GetComponent("CustomGUI");
		}

		public static void LogMessage(string message, bool isError = false)
		{
			if (isError)
			{
				HUDManager.Instance.DisplayTip("Error!", message, isError, false, "LC_Tip1");
				mls.LogError((object)message);
			}
			else
			{
				HUDManager.Instance.DisplayTip("Success!", message, isError, false, "LC_Tip1");
				mls.LogInfo((object)message);
			}
		}

		public static void PlayerTeleportEffects(ulong playerClientId, bool isInside, bool showParticles = true)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB playerFromClientId = GetPlayerFromClientId(playerClientId);
			SavePlayer(playerFromClientId);
			if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
			{
				Object.FindObjectOfType<AudioReverbPresets>().audioPresets[isInside ? 2 : 3].ChangeAudioReverbForPlayer(playerFromClientId);
			}
			playerFromClientId.isInElevator = !isInside;
			playerFromClientId.isInHangarShipRoom = !isInside;
			playerFromClientId.isInsideFactory = isInside;
			playerFromClientId.averageVelocity = 0f;
			playerFromClientId.velocityLastFrame = Vector3.zero;
			if (showParticles)
			{
				playerFromClientId.beamUpParticle.Play();
				playerFromClientId.beamOutBuildupParticle.Play();
			}
		}

		public static void RevivePlayer(ulong playerClientId)
		{
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			PlayerControllerB playerFromClientId = GetPlayerFromClientId(playerClientId);
			StartOfRound instance = StartOfRound.Instance;
			Debug.Log((object)"Reviving players A");
			playerFromClientId.ResetPlayerBloodObjects(playerFromClientId.isPlayerDead);
			if (playerFromClientId.isPlayerDead || playerFromClientId.isPlayerControlled)
			{
				if ((Object)(object)((Component)playerFromClientId.deadBody).gameObject != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)playerFromClientId.deadBody).gameObject);
				}
				if ((Object)(object)playerFromClientId.deadBody != (Object)null)
				{
					Object.Destroy((Object)(object)playerFromClientId.deadBody);
				}
				playerFromClientId.isClimbingLadder = false;
				playerFromClientId.clampLooking = false;
				playerFromClientId.inVehicleAnimation = false;
				playerFromClientId.disableMoveInput = false;
				playerFromClientId.ResetZAndXRotation();
				((Collider)playerFromClientId.thisController).enabled = true;
				playerFromClientId.health = 100;
				playerFromClientId.disableLookInput = false;
				playerFromClientId.disableInteract = false;
				Debug.Log((object)"Reviving players B");
				if (playerFromClientId.isPlayerDead)
				{
					playerFromClientId.isPlayerDead = false;
					playerFromClientId.isPlayerControlled = true;
					playerFromClientId.isInElevator = true;
					playerFromClientId.isInHangarShipRoom = true;
					playerFromClientId.isInsideFactory = false;
					playerFromClientId.parentedToElevatorLastFrame = false;
					playerFromClientId.overrideGameOverSpectatePivot = null;
					instance.SetPlayerObjectExtrapolate(false);
					playerFromClientId.TeleportPlayer(instance.GetPlayerSpawnPosition((int)playerFromClientId.playerClientId, false), false, 0f, false, true);
					playerFromClientId.setPositionOfDeadPlayer = false;
					playerFromClientId.DisablePlayerModel(instance.allPlayerObjects[(uint)playerFromClientId.playerClientId], true, true);
					((Behaviour)playerFromClientId.helmetLight).enabled = false;
					Debug.Log((object)"Reviving players C");
					playerFromClientId.Crouch(false);
					playerFromClientId.criticallyInjured = false;
					Animator playerBodyAnimator = playerFromClientId.playerBodyAnimator;
					if (playerBodyAnimator != null)
					{
						playerBodyAnimator.SetBool("Limp", false);
					}
					playerFromClientId.bleedingHeavily = false;
					playerFromClientId.activatingItem = false;
					playerFromClientId.twoHanded = false;
					playerFromClientId.inShockingMinigame = false;
					playerFromClientId.inSpecialInteractAnimation = false;
					playerFromClientId.freeRotationInInteractAnimation = false;
					playerFromClientId.disableSyncInAnimation = false;
					playerFromClientId.inAnimationWithEnemy = null;
					playerFromClientId.holdingWalkieTalkie = false;
					playerFromClientId.speakingToWalkieTalkie = false;
					Debug.Log((object)"Reviving players D");
					playerFromClientId.isSinking = false;
					playerFromClientId.isUnderwater = false;
					playerFromClientId.sinkingValue = 0f;
					playerFromClientId.statusEffectAudio.Stop();
					playerFromClientId.DisableJetpackControlsLocally();
					playerFromClientId.health = 100;
					Debug.Log((object)"Reviving players E");
					playerFromClientId.mapRadarDotAnimator.SetBool("dead", false);
					playerFromClientId.externalForceAutoFade = Vector3.zero;
					if (((NetworkBehaviour)playerFromClientId).IsOwner)
					{
						HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false);
						playerFromClientId.hasBegunSpectating = false;
						HUDManager.Instance.RemoveSpectateUI();
						HUDManager.Instance.gameOverAnimator.SetTrigger("revive");
						playerFromClientId.hinderedMultiplier = 1f;
						playerFromClientId.isMovementHindered = 0;
						playerFromClientId.sourcesCausingSinking = 0;
						Debug.Log((object)"Reviving players E2");
						playerFromClientId.reverbPreset = instance.shipReverb;
					}
				}
				Debug.Log((object)"Reviving players F");
				SoundManager.Instance.earsRingingTimer = 0f;
				playerFromClientId.voiceMuffledByEnemy = false;
				SoundManager.Instance.playerVoicePitchTargets[(uint)playerFromClientId.playerClientId] = 1f;
				SoundManager.Instance.SetPlayerPitch(1f, (int)playerFromClientId.playerClientId);
				if ((Object)(object)playerFromClientId.currentVoiceChatIngameSettings == (Object)null)
				{
					instance.RefreshPlayerVoicePlaybackObjects();
				}
				if ((Object)(object)playerFromClientId.currentVoiceChatIngameSettings != (Object)null)
				{
					if ((Object)(object)playerFromClientId.currentVoiceChatIngameSettings.voiceAudio == (Object)null)
					{
						playerFromClientId.currentVoiceChatIngameSettings.InitializeComponents();
					}
					if ((Object)(object)playerFromClientId.currentVoiceChatIngameSettings.voiceAudio == (Object)null)
					{
						return;
					}
					((Component)playerFromClientId.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>().overridingLowPass = false;
				}
				Debug.Log((object)"Reviving players G");
			}
			playerFromClientId.bleedingHeavily = false;
			playerFromClientId.criticallyInjured = false;
			playerFromClientId.playerBodyAnimator.SetBool("Limp", false);
			playerFromClientId.health = 100;
			HUDManager.Instance.UpdateHealthUI(100, false);
			playerFromClientId.spectatedPlayerScript = null;
			((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false;
			Debug.Log((object)"Reviving players H");
			instance.SetSpectateCameraToGameOverMode(false, playerFromClientId);
			instance.livingPlayers++;
			instance.allPlayersDead = false;
			instance.UpdatePlayerVoiceEffects();
			instance.ResetMiscValues();
			if (localPlayerController.playerClientId == playerFromClientId.playerClientId)
			{
				HUDManager.Instance.HideHUD(false);
			}
		}

		public static void SavePlayer(PlayerControllerB player)
		{
			CentipedeAI[] array = Object.FindObjectsByType<CentipedeAI>((FindObjectsSortMode)0);
			for (int i = 0; i < array.Length; i++)
			{
				if ((Object)(object)array[i].clingingToPlayer == (Object)(object)player)
				{
					((EnemyAI)array[i]).HitEnemy(0, player, true, -1);
				}
			}
			ForestGiantAI[] array2 = Object.FindObjectsByType<ForestGiantAI>((FindObjectsSortMode)0);
			for (int j = 0; j < array2.Length; j++)
			{
				if ((Object)(object)((EnemyAI)array2[j]).inSpecialAnimationWithPlayer == (Object)(object)player)
				{
					((Component)array2[j]).GetComponentInChildren<EnemyAI>().SetEnemyStunned(true, 7.5f, player);
				}
			}
			MaskedPlayerEnemy[] array3 = Object.FindObjectsByType<MaskedPlayerEnemy>((FindObjectsSortMode)0);
			for (int k = 0; k < array3.Length; k++)
			{
				if ((Object)(object)((EnemyAI)array3[k]).inSpecialAnimationWithPlayer == (Object)(object)player)
				{
					((EnemyAI)array3[k]).CancelSpecialAnimationWithPlayer();
					((EnemyAI)array3[k]).HitEnemy(0, player, true, -1);
					((Component)array3[k]).GetComponentInChildren<EnemyAI>().SetEnemyStunned(true, 7.5f, player);
				}
			}
			RadMechAI[] array4 = Object.FindObjectsByType<RadMechAI>((FindObjectsSortMode)0);
			for (int l = 0; l < array4.Length; l++)
			{
				if ((Object)(object)((EnemyAI)array4[l]).inSpecialAnimationWithPlayer == (Object)(object)player)
				{
					array4[l].CancelSpecialAnimations();
					array4[l].CancelTorchPlayerAnimation();
					((Component)array4[l]).GetComponentInChildren<EnemyAI>().SetEnemyStunned(true, 7.5f, player);
				}
			}
			if (StartOfRound.Instance.localPlayerController.playerClientId == player.playerClientId)
			{
				HUDManager.Instance.HUDAnimator.SetBool("biohazardDamage", false);
			}
		}

		private static void SpawningMessage(SearchableGameObject obj, string targetString, int amount, int value = 0)
		{
			string text = "Unknown";
			string text2 = "";
			if (obj.IsItem)
			{
				text = "Item";
				text2 = ((value != -1) ? string.Concat(value) : "Random");
			}
			else if (obj.IsEnemy)
			{
				text = "Enemy";
			}
			else if (obj.IsTrap)
			{
				text = "Trap";
			}
			string text3;
			if (targetString == "$" || (targetString == "" && !obj.IsItem))
			{
				text3 = "Random";
			}
			else if (targetString == "!")
			{
				text3 = "Terminal";
			}
			else if (targetString.StartsWith("@") && targetString.Length > 1)
			{
				text3 = "WP @" + targetString.Substring(1);
			}
			else if (targetString.StartsWith("+") || (targetString.StartsWith("-") && targetString.Length > 1))
			{
				PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
				PlayerControllerB val = ((localPlayerController.isPlayerDead && (Object)(object)localPlayerController.spectatedPlayerScript != (Object)null) ? localPlayerController.spectatedPlayerScript : localPlayerController);
				if (!((Object)(object)val != (Object)null) || !val.isPlayerControlled)
				{
					return;
				}
				text3 = (targetString.StartsWith("-") ? "Behind" : "In front of") + " " + val.playerUsername;
			}
			else
			{
				ulong result;
				bool flag = ulong.TryParse(targetString, out result);
				EnemyAI enemyByNetId = Networking.GetEnemyByNetId(result);
				GrabbableObject itemByNetId = Networking.GetItemByNetId(result);
				if (flag && (Object)(object)enemyByNetId != (Object)null)
				{
					text3 = enemyByNetId.enemyType.enemyName;
				}
				else if (flag && (Object)(object)itemByNetId != (Object)null)
				{
					text3 = itemByNetId.itemProperties.itemName;
				}
				else
				{
					if (!((Object)(object)GetPlayerFromString(targetString) != (Object)null))
					{
						return;
					}
					text3 = GetPlayerFromString(targetString).playerUsername;
				}
			}
			LogMessage(string.Format("Spawned {0}\nName: {1}, Location: {2}, Amount: {3}{4}", text, obj.Name, text3, amount, obj.IsItem ? (", Value: " + text2) : "."));
		}

		public static void SpawnEnemy(SearchableGameObject enemy, int amount, string targetString)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			if (GetPositionFromCommand(targetString, enemy.IsOutsideEnemy ? 1 : 2) == Vector3.zero)
			{
				return;
			}
			SpawningMessage(enemy, targetString, amount);
			for (int i = 0; i < amount; i++)
			{
				try
				{
					GameObject val = (enemy.IsOutsideEnemy ? customOutsideList[enemy.Id].enemyType.enemyPrefab : customInsideList[enemy.Id].enemyType.enemyPrefab);
					Vector3 positionFromCommand = GetPositionFromCommand(targetString, enemy.IsOutsideEnemy ? 1 : 2);
					Object.Instantiate<GameObject>(val, positionFromCommand, Quaternion.Euler(Vector3.zero)).gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
				}
				catch (Exception ex)
				{
					LogMessage("Unable to Spawn Enemy: " + enemy.Name, isError: true);
					mls.LogError((object)ex);
				}
			}
		}

		public static void SpawnItem(SearchableGameObject item, int amount, int value, string targetString)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList;
			if (GetPositionFromCommand(targetString, 0) == Vector3.zero)
			{
				return;
			}
			SpawningMessage(item, targetString, amount, value);
			for (int i = 0; i < amount; i++)
			{
				try
				{
					if (itemsList[item.Id].minValue > itemsList[item.Id].maxValue)
					{
						Item val = itemsList[item.Id];
						Item obj = itemsList[item.Id];
						int minValue = itemsList[item.Id].minValue;
						int maxValue = itemsList[item.Id].maxValue;
						val.maxValue = minValue;
						obj.minValue = maxValue;
					}
					int scrapValue = (int)(double)((value == -1) ? ((float)Random.Range(itemsList[item.Id].minValue, itemsList[item.Id].maxValue) * RoundManager.Instance.scrapValueMultiplier) : ((float)value));
					Vector3 positionFromCommand = GetPositionFromCommand(targetString, 0);
					GameObject val2 = Object.Instantiate<GameObject>(itemsList[item.Id].spawnPrefab, positionFromCommand, Quaternion.identity);
					((Component)val2.GetComponent<GrabbableObject>()).transform.rotation = Quaternion.Euler(val2.GetComponent<GrabbableObject>().itemProperties.restingRotation);
					val2.GetComponent<GrabbableObject>().fallTime = 0f;
					val2.GetComponent<NetworkObject>().Spawn(false);
					Networking.SyncScrapValueClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val2.GetComponent<GrabbableObject>()).NetworkObject), scrapValue);
					if (itemsList[item.Id].itemName == "Shotgun")
					{
						Networking.SyncAmmoClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val2.GetComponent<GrabbableObject>()).NetworkObject));
					}
				}
				catch (Exception ex)
				{
					LogMessage("Unable to Spawn Item: " + item.Name, isError: true);
					mls.LogError((object)ex);
				}
			}
		}

		public static void SpawnTrap(SearchableGameObject trap, int amount, string targetString)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00b7: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: 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_01f3: 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_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			RoundManager instance = RoundManager.Instance;
			if (GetPositionFromCommand(targetString, 4) == Vector3.zero)
			{
				return;
			}
			SpawningMessage(trap, targetString, amount);
			switch (trap.Id)
			{
			case 0:
			{
				SpawnableMapObject[] spawnableMapObjects2 = instance.currentLevel.spawnableMapObjects;
				foreach (SpawnableMapObject val4 in spawnableMapObjects2)
				{
					try
					{
						if ((Object)(object)val4.prefabToSpawn.GetComponentInChildren<Landmine>() != (Object)null)
						{
							for (int l = 0; l < amount; l++)
							{
								Vector3 randomNavMeshPositionInRadius = instance.GetRandomNavMeshPositionInRadius(val4.prefabToSpawn.transform.position, 10f, default(NavMeshHit));
								GameObject val5 = Object.Instantiate<GameObject>(val4.prefabToSpawn, GetPositionFromCommand(targetString, 4), Quaternion.identity);
								val5.GetComponent<NetworkObject>().Spawn(true);
								int code2 = Random.Range(0, RoundManager.Instance.possibleCodesForBigDoors.Length - 1);
								Networking.TerminalCodeClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val5.GetComponentInChildren<TerminalAccessibleObject>()).NetworkObject), code2);
							}
							break;
						}
					}
					catch (Exception ex2)
					{
						LogMessage("Unable to Spawn Trap: " + trap.Name + "!", isError: true);
						mls.LogError((object)ex2);
					}
				}
				break;
			}
			case 1:
			{
				SpawnableMapObject[] spawnableMapObjects3 = instance.currentLevel.spawnableMapObjects;
				foreach (SpawnableMapObject val6 in spawnableMapObjects3)
				{
					try
					{
						if ((Object)(object)val6.prefabToSpawn.GetComponentInChildren<Turret>() != (Object)null)
						{
							for (int n = 0; n < amount; n++)
							{
								Vector3 positionFromCommand2 = GetPositionFromCommand(targetString, 4);
								GameObject val7 = Object.Instantiate<GameObject>(val6.prefabToSpawn, positionFromCommand2, Quaternion.identity);
								val7.transform.eulerAngles = new Vector3(0f, instance.YRotationThatFacesTheFarthestFromPosition(positionFromCommand2 + Vector3.up * 0.2f, 25f, 6), 0f);
								val7.GetComponent<NetworkObject>().Spawn(true);
								int code3 = Random.Range(0, RoundManager.Instance.possibleCodesForBigDoors.Length - 1);
								Networking.TerminalCodeClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val7.GetComponentInChildren<TerminalAccessibleObject>()).NetworkObject), code3);
							}
							break;
						}
					}
					catch (Exception ex3)
					{
						LogMessage("Unable to Spawn Trap: " + trap.Name + "!", isError: true);
						mls.LogError((object)ex3);
					}
				}
				break;
			}
			case 2:
			{
				SpawnableMapObject[] spawnableMapObjects = instance.currentLevel.spawnableMapObjects;
				RaycastHit val3 = default(RaycastHit);
				foreach (SpawnableMapObject val in spawnableMapObjects)
				{
					try
					{
						if (!((Object)(object)val.prefabToSpawn.GetComponentInChildren<SpikeRoofTrap>() != (Object)null))
						{
							continue;
						}
						for (int j = 0; j < amount; j++)
						{
							Vector3 positionFromCommand = GetPositionFromCommand(targetString, 4);
							GameObject val2 = Object.Instantiate<GameObject>(val.prefabToSpawn, positionFromCommand, Quaternion.identity);
							if ((targetString == "" || targetString == "$") && Physics.Raycast(val2.transform.position, -val2.transform.forward, ref val3, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
							{
								val2.transform.position = ((RaycastHit)(ref val3)).point;
								val2.transform.forward = ((RaycastHit)(ref val3)).normal;
								val2.transform.eulerAngles = new Vector3(0f, val2.transform.eulerAngles.y, 0f);
							}
							val2.GetComponentInChildren<SpikeRoofTrap>().Start();
							val2.GetComponent<NetworkObject>().Spawn(true);
							int code = Random.Range(0, RoundManager.Instance.possibleCodesForBigDoors.Length - 1);
							Networking.TerminalCodeClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val2.GetComponentInChildren<TerminalAccessibleObject>()).NetworkObject), code);
						}
						break;
					}
					catch (Exception ex)
					{
						LogMessage("Unable to Spawn Trap: " + trap.Name + "!", isError: true);
						mls.LogError((object)ex);
					}
				}
				break;
			}
			}
		}
	}
	public struct SearchableGameObject
	{
		public string Name { get; set; }

		public int Id { get; set; }

		public bool IsItem { get; set; }

		public bool IsEnemy { get; set; }

		public bool IsOutsideEnemy { get; set; }

		public bool IsTrap { get; set; }
	}
}
namespace ToxicOmega_Tools.Patches
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManager_Patch : MonoBehaviour
	{
		[HarmonyPatch("Disconnect")]
		[HarmonyPostfix]
		private static void Disconnect()
		{
			Plugin.defog = false;
			Plugin.godmode = false;
			Plugin.nightVision = false;
			Plugin.noclip = false;
			Plugin.waypoints.Clear();
			CustomGUI.nearbyVisible = false;
			CustomGUI.fullListVisible = false;
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal class Terminal_Patch : MonoBehaviour
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void GetAllEnemies(ref SelectableLevel[] ___moonsCatalogueList)
		{
			Plugin.customOutsideList = new List<SpawnableEnemyWithRarity>();
			Plugin.customInsideList = new List<SpawnableEnemyWithRarity>();
			Plugin.allEnemiesList = new List<SpawnableEnemyWithRarity>();
			SelectableLevel[] array = ___moonsCatalogueList;
			foreach (SelectableLevel val in array)
			{
				foreach (SpawnableEnemyWithRarity daytimeEnemy in val.DaytimeEnemies)
				{
					if (!ListHasEnemy(Plugin.customOutsideList, daytimeEnemy.enemyType.enemyName))
					{
						Plugin.customOutsideList.Add(daytimeEnemy);
					}
				}
				foreach (SpawnableEnemyWithRarity outsideEnemy in val.OutsideEnemies)
				{
					if (!ListHasEnemy(Plugin.customOutsideList, outsideEnemy.enemyType.enemyName))
					{
						Plugin.customOutsideList.Add(outsideEnemy);
					}
				}
				foreach (SpawnableEnemyWithRarity weedEnemy in RoundManager.Instance.WeedEnemies)
				{
					if (!ListHasEnemy(Plugin.customOutsideList, weedEnemy.enemyType.enemyName))
					{
						Plugin.customOutsideList.Add(weedEnemy);
					}
				}
				foreach (SpawnableEnemyWithRarity enemy in val.Enemies)
				{
					if (!ListHasEnemy(Plugin.customInsideList, enemy.enemyType.enemyName))
					{
						Plugin.customInsideList.Add(enemy);
					}
				}
			}
			Plugin.allEnemiesList.AddRange(Plugin.customOutsideList);
			Plugin.allEnemiesList.AddRange(Plugin.customInsideList);
			SetupSpawnablesList();
		}

		private static bool ListHasEnemy(List<SpawnableEnemyWithRarity> list, string enemyName)
		{
			return list.Any((SpawnableEnemyWithRarity e) => e.enemyType.enemyName == enemyName);
		}

		private static void SetupSpawnablesList()
		{
			List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList;
			Plugin.allSpawnablesList = new List<SearchableGameObject>();
			foreach (Item item in itemsList)
			{
				Plugin.allSpawnablesList.Add(new SearchableGameObject
				{
					Name = item.itemName,
					Id = itemsList.IndexOf(item),
					IsItem = true
				});
			}
			foreach (SpawnableEnemyWithRarity customInside in Plugin.customInsideList)
			{
				Plugin.allSpawnablesList.Add(new SearchableGameObject
				{
					Name = customInside.enemyType.enemyName,
					Id = Plugin.customInsideList.IndexOf(customInside),
					IsEnemy = true
				});
			}
			foreach (SpawnableEnemyWithRarity customOutside in Plugin.customOutsideList)
			{
				Plugin.allSpawnablesList.Add(new SearchableGameObject
				{
					Name = customOutside.enemyType.enemyName,
					Id = Plugin.customOutsideList.IndexOf(customOutside),
					IsEnemy = true,
					IsOutsideEnemy = true
				});
			}
			Plugin.allSpawnablesList.Add(new SearchableGameObject
			{
				Name = "Mine",
				Id = 0,
				IsTrap = true
			});
			Plugin.allSpawnablesList.Add(new SearchableGameObject
			{
				Name = "LandMine",
				Id = 0,
				IsTrap = true
			});
			Plugin.allSpawnablesList.Add(new SearchableGameObject
			{
				Name = "Turret",
				Id = 1,
				IsTrap = true
			});
			Plugin.allSpawnablesList.Add(new SearchableGameObject
			{
				Name = "Spikes",
				Id = 2,
				IsTrap = true
			});
			Plugin.allSpawnablesList.Add(new SearchableGameObject
			{
				Name = "RoofSpikes",
				Id = 2,
				IsTrap = true
			});
			Plugin.allSpawnablesList.Add(new SearchableGameObject
			{
				Name = "CeilingSpikes",
				Id = 2,
				IsTrap = true
			});
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManager_Patch : MonoBehaviour
	{
		private static int itemListPage;

		private static int enemyListPage;

		private static bool foundId;

		private static ulong networkId;

		private static GrabbableObject itemTarget;

		private static EnemyAI enemyTarget;

		private static PlayerControllerB playerTarget;

		[HarmonyPatch("EnableChat_performed")]
		[HarmonyPrefix]
		private static bool EnableChatAction(HUDManager __instance)
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (localPlayerController.isPlayerDead && Plugin.CheckPlayerIsHost(localPlayerController))
			{
				ShipBuildModeManager.Instance.CancelBuildMode(true);
				__instance.localPlayer.isTypingChat = true;
				((Selectable)__instance.chatTextField).Select();
				__instance.PingHUDElement(__instance.Chat, 0.1f, 1f, 1f);
				((Behaviour)__instance.typingIndicator).enabled = true;
				return false;
			}
			return true;
		}

		[HarmonyPatch("SubmitChat_performed")]
		[HarmonyPrefix]
		private static bool RegisterChatCommand(HUDManager __instance)
		{
			//IL_1c80: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c97: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_098d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0992: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ceb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ced: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d65: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d67: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d05: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c56: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b68: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b86: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af7: Unknown result type (might be due to invalid IL or missing references)
			//IL_175f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1766: Expected O, but got Unknown
			//IL_19cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_19c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_1afd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b09: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b13: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b18: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b24: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b65: Unknown result type (might be due to invalid IL or missing references)
			RoundManager instance = RoundManager.Instance;
			Terminal val = Object.FindObjectOfType<Terminal>();
			List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList;
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			bool flag = true;
			string text = __instance.chatTextField.text;
			__instance.tipsPanelCoroutine = null;
			if (text == null || text == "")
			{
				return true;
			}
			if (!Plugin.CheckPlayerIsHost(localPlayerController) && !NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsServer)
			{
				return true;
			}
			string[] command = (from s in text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
				select s.TrimEnd(Array.Empty<char>()).ToLowerInvariant()).ToArray();
			string text2 = command[0].Replace("/", "").ToLower();
			string text3 = text2;
			if (!(text3 == "help"))
			{
				if (text3 == null)
				{
					goto IL_1bd8;
				}
				if ("items".StartsWith(text3))
				{
					if (command.Length > 1)
					{
						int.TryParse(command[1], out itemListPage);
					}
					itemListPage = Math.Max(itemListPage, 1);
					FindPage(itemsList, itemListPage, 10, "Item");
				}
				else
				{
					string value = text3;
					if ("enemies".StartsWith(value))
					{
						if (command.Length > 1)
						{
							int.TryParse(command[1], out enemyListPage);
						}
						enemyListPage = Math.Max(enemyListPage, 1);
						FindPage(Plugin.allEnemiesList, enemyListPage, 10, "Enemy");
					}
					else
					{
						string value2 = text3;
						if ("spawn".StartsWith(value2))
						{
							string targetString = "";
							int result = 1;
							int result2 = -1;
							if (command.Length >= 2)
							{
								if (command.Length > 2)
								{
									targetString = command[2];
								}
								if (command.Length > 3)
								{
									int.TryParse(command[3], out result);
								}
								if (command.Length > 4)
								{
									if (command[4] == "$")
									{
										result2 = -1;
									}
									else
									{
										int.TryParse(command[4], out result2);
									}
								}
								SearchableGameObject searchableGameObject = Plugin.allSpawnablesList.FirstOrDefault((SearchableGameObject obj) => obj.Name.ToLower().StartsWith(command[1].Replace("_", " ")));
								if (searchableGameObject.Name != null)
								{
									if (searchableGameObject.IsItem)
									{
										Plugin.SpawnItem(searchableGameObject, Math.Max(result, 1), Math.Max(result2, 0), targetString);
									}
									else if (searchableGameObject.IsEnemy)
									{
										Plugin.SpawnEnemy(searchableGameObject, Math.Max(result, 1), targetString);
									}
									else if (searchableGameObject.IsTrap)
									{
										Plugin.SpawnTrap(searchableGameObject, Math.Max(result, 1), targetString);
									}
								}
								else
								{
									Plugin.LogMessage("Unable to find GameObject with name \"" + command[1] + "\"", isError: true);
								}
							}
						}
						else
						{
							string value3 = text3;
							if ("give".StartsWith(value3))
							{
								if (command.Length > 1)
								{
									Item val2 = ((IEnumerable<Item>)StartOfRound.Instance.allItemsList.itemsList).FirstOrDefault((Func<Item, bool>)((Item x) => x.itemName.ToLower().StartsWith(command[1].Replace("_", " "))));
									if ((Object)(object)val2 != (Object)null)
									{
										playerTarget = ((command.Length > 2) ? Plugin.GetPlayerFromString(string.Join(" ", command.Skip(2))) : localPlayerController);
										if (!((Object)(object)playerTarget == (Object)null) && !playerTarget.isPlayerDead)
										{
											GameObject val3 = Object.Instantiate<GameObject>(val2.spawnPrefab, ((Component)playerTarget).transform.position, Quaternion.identity);
											if (!((Object)(object)val3 == (Object)null))
											{
												val3.GetComponent<GrabbableObject>().fallTime = 0f;
												val3.GetComponent<NetworkObject>().Spawn(false);
												if (val2.minValue > val2.maxValue)
												{
													Item val4 = val2;
													int minValue = val2.minValue;
													int maxValue = val2.maxValue;
													val2.maxValue = minValue;
													val4.minValue = maxValue;
												}
												if (val2.itemName == "Shotgun")
												{
													Networking.SyncAmmoClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val3.GetComponent<GrabbableObject>()).NetworkObject));
												}
												Networking.SyncScrapValueClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val3.GetComponent<GrabbableObject>()).NetworkObject), (int)(double)((float)Random.Range(val2.minValue, val2.maxValue) * RoundManager.Instance.scrapValueMultiplier));
												Networking.GiveItemClientRpc(playerTarget.playerClientId, NetworkObjectReference.op_Implicit(((NetworkBehaviour)val3.GetComponent<GrabbableObject>()).NetworkObject));
												Plugin.LogMessage("Giving " + val2.itemName + " to " + playerTarget.playerUsername + ".");
											}
										}
									}
									else
									{
										Plugin.LogMessage("Unable to find GameObject with name \"" + command[1] + "\"", isError: true);
									}
								}
							}
							else
							{
								string value4 = text3;
								if ("traps".StartsWith(value4))
								{
									HUDManager.Instance.DisplayTip("Trap List", "Mine, Turret, Spikes", false, false, "LC_Tip1");
								}
								else
								{
									string value5 = text3;
									if ("list".StartsWith(value5))
									{
										if (command.Length < 2)
										{
											CustomGUI.fullListVisible = !CustomGUI.fullListVisible;
											CustomGUI.nearbyVisible = false;
											if (CustomGUI.fullListVisible)
											{
												((MonoBehaviour)localPlayerController).StartCoroutine(CustomGUI.UpdateGUI());
											}
											else
											{
												((MonoBehaviour)localPlayerController).StopCoroutine(CustomGUI.UpdateGUI());
											}
											Plugin.LogMessage((CustomGUI.fullListVisible ? "Enabling" : "Disabling") + " full list GUI.");
										}
										else
										{
											int result3 = 1;
											if (command.Length > 2)
											{
												int.TryParse(command[2], out result3);
											}
											result3 = Math.Max(result3, 1);
											if ("players".StartsWith(command[1]))
											{
												FindPage(StartOfRound.Instance.allPlayerScripts.ToList(), result3, 4, "Player");
											}
											else if ("items".StartsWith(command[1]))
											{
												FindPage(Object.FindObjectsOfType<GrabbableObject>().ToList(), result3, 6, "Active Items");
											}
											else if ("enemy".StartsWith(command[1]) || "enemies".StartsWith(command[1]))
											{
												FindPage(Object.FindObjectsOfType<EnemyAI>().ToList(), result3, 6, "Active Enemies");
											}
											else if ("codes".StartsWith(command[1]))
											{
												FindPage(Object.FindObjectsOfType<TerminalAccessibleObject>().ToList(), result3, 10, "Terminal Codes");
											}
											else if ("wp".StartsWith(command[1]) || "waypoints".StartsWith(command[1]))
											{
												FindPage(Plugin.waypoints, result3, 8, "Waypoint");
											}
											else
											{
												Plugin.LogMessage("Unable to find list by name " + command[1] + "!", isError: true);
											}
										}
									}
									else
									{
										string value6 = text3;
										if ("tp".StartsWith(value6) || "teleport".StartsWith(value6))
										{
											switch (command.Length)
											{
											case 1:
												if (Plugin.GetPositionFromCommand("!", 3, localPlayerController.playerUsername) != Vector3.zero)
												{
													if (!localPlayerController.isPlayerDead)
													{
														Vector3 positionFromCommand2 = Plugin.GetPositionFromCommand("!", 3, localPlayerController.playerUsername);
														Networking.TPPlayerClientRpc(localPlayerController.playerClientId, positionFromCommand2);
													}
													else
													{
														Plugin.LogMessage("Could not teleport " + localPlayerController.playerUsername + "!\nPlayer is dead!", isError: true);
													}
												}
												break;
											case 2:
											case 3:
												if (command.Length > 2)
												{
													string text4 = null;
													NetworkObjectReference networkRef = default(NetworkObjectReference);
													foundId = ulong.TryParse(command[1], out networkId);
													enemyTarget = Networking.GetEnemyByNetId(networkId);
													itemTarget = Networking.GetItemByNetId(networkId);
													if (foundId && (Object)(object)enemyTarget != (Object)null)
													{
														networkRef = NetworkObjectReference.op_Implicit(((NetworkBehaviour)enemyTarget).NetworkObject);
														text4 = enemyTarget.enemyType.enemyName;
													}
													else if (foundId && (Object)(object)itemTarget != (Object)null)
													{
														networkRef = NetworkObjectReference.op_Implicit(((NetworkBehaviour)itemTarget).NetworkObject);
														text4 = itemTarget.itemProperties.itemName;
													}
													if (foundId && text4 != null)
													{
														Networking.TPGameObjectClientRpc(networkRef, Plugin.GetPositionFromCommand(command[2], 3, text4));
														break;
													}
												}
												playerTarget = ((command.Length > 2) ? Plugin.GetPlayerFromString(command[1]) : localPlayerController);
												if ((Object)(object)playerTarget != (Object)null)
												{
													Vector3 positionFromCommand = Plugin.GetPositionFromCommand((command.Length > 2) ? command[2] : command[1], 3, playerTarget.playerUsername);
													if (positionFromCommand != Vector3.zero)
													{
														Networking.TPPlayerClientRpc(playerTarget.playerClientId, positionFromCommand);
													}
												}
												break;
											}
										}
										else
										{
											string value7 = text3;
											if ("wp".StartsWith(value7) || "waypoints".StartsWith(value7))
											{
												if (command.Length == 1)
												{
													if (Plugin.waypoints.Count > 0)
													{
														FindPage(Plugin.waypoints, 1, 8, "Waypoint");
													}
													else
													{
														Plugin.LogMessage("Waypoint List is empty!", isError: true);
													}
												}
												else if ("add".StartsWith(command[1]))
												{
													if ((Object)(object)localPlayerController != (Object)null && !localPlayerController.isPlayerDead)
													{
														bool isInsideFactory = localPlayerController.isInsideFactory;
														Vector3 position = ((Component)localPlayerController).transform.position;
														Plugin.waypoints.Add(position);
														Plugin.LogMessage($"Waypoint @{Plugin.waypoints.Count - 1} created at {position}.");
													}
												}
												else if ("clear".StartsWith(command[1]))
												{
													Plugin.waypoints.Clear();
													Plugin.LogMessage("Waypoints cleared.");
												}
												else if ("door".StartsWith(command[1]))
												{
													Vector3 val5 = RoundManager.FindMainEntrancePosition(true, true);
													if (val5 != Vector3.zero)
													{
														Plugin.waypoints.Add(val5);
														Plugin.LogMessage($"Waypoint @{Plugin.waypoints.Count - 1} created at Front Door.");
													}
													else
													{
														Plugin.LogMessage("Unable to find Main Entrance!", isError: true);
													}
												}
												else if ("entrance".StartsWith(command[1]))
												{
													Vector3 val6 = RoundManager.FindMainEntrancePosition(true, false);
													if (val6 != Vector3.zero)
													{
														Plugin.waypoints.Add(val6);
														Plugin.LogMessage($"Waypoint @{Plugin.waypoints.Count - 1} created inside Main Entrance.");
													}
													else
													{
														Plugin.LogMessage("Unable to find Main Entrance!", isError: true);
													}
												}
											}
											else
											{
												string value8 = text3;
												if ("heal".StartsWith(value8) || "save".StartsWith(value8))
												{
													if (command.Length < 2)
													{
														playerTarget = localPlayerController;
													}
													else
													{
														playerTarget = Plugin.GetPlayerFromString(string.Join(" ", command.Skip(1)));
													}
													if ((Object)(object)playerTarget != (Object)null)
													{
														if (playerTarget.isPlayerDead)
														{
															Plugin.LogMessage("Attempting to revive " + playerTarget.playerUsername + ".");
														}
														else
														{
															Plugin.LogMessage("Healing " + playerTarget.playerUsername + ".");
														}
														Networking.HealPlayerClientRpc(playerTarget.playerClientId);
													}
												}
												else
												{
													string value9 = text3;
													if ("gm".StartsWith(value9) || "godmode".StartsWith(value9))
													{
														Plugin.godmode = !Plugin.godmode;
														Plugin.LogMessage("GodMode toggled " + (Plugin.godmode ? "on!" : "off."));
													}
													else
													{
														string value10 = text3;
														if ("codes".StartsWith(value10))
														{
															List<TerminalAccessibleObject> list = Object.FindObjectsOfType<TerminalAccessibleObject>().ToList();
															if (list.Count > 0)
															{
																if (command.Length < 2)
																{
																	FindPage(list, 1, 10, "Terminal Codes");
																}
																else
																{
																	foreach (TerminalAccessibleObject item in list)
																	{
																		if ((Object)(object)item != (Object)null && item.objectCode == command[1])
																		{
																			item.CallFunctionFromTerminal();
																		}
																	}
																	Plugin.LogMessage("Attempted to toggle all TerminalAccessibleObject of code " + command[1] + ".");
																}
															}
															else
															{
																Plugin.LogMessage("No TerminalAccessibleObject in this area!", isError: true);
															}
														}
														else
														{
															string value11 = text3;
															if ("breaker".StartsWith(value11))
															{
																BreakerBox val7 = Object.FindObjectOfType<BreakerBox>();
																if ((Object)(object)val7 != (Object)null)
																{
																	val7.SwitchBreaker(!val7.isPowerOn);
																	Plugin.LogMessage("Turned breaker " + (val7.isPowerOn ? "on" : "off") + ".");
																}
																else
																{
																	Plugin.LogMessage("BreakerBox not found!", isError: true);
																}
															}
															else
															{
																string value12 = text3;
																if ("credits".StartsWith(value12) || "money".StartsWith(value12))
																{
																	if ((Object)(object)val != (Object)null)
																	{
																		if (command.Length < 2)
																		{
																			Plugin.LogMessage($"Group Credits: {val.groupCredits}");
																		}
																		else
																		{
																			int.TryParse(command[1], out var result4);
																			Networking.TerminalCreditsClientRpc(result4);
																			Plugin.LogMessage($"Adjusted Credits by {result4}.\nNew Total: {val.groupCredits}.");
																		}
																	}
																	else
																	{
																		Plugin.LogMessage("Terminal not found!", isError: true);
																	}
																}
																else
																{
																	string value13 = text3;
																	if ("charge".StartsWith(value13))
																	{
																		if (command.Length < 2)
																		{
																			playerTarget = localPlayerController;
																		}
																		else
																		{
																			playerTarget = Plugin.GetPlayerFromString(string.Join(" ", command.Skip(1)));
																		}
																		if ((Object)(object)playerTarget != (Object)null && !playerTarget.isPlayerDead)
																		{
																			itemTarget = playerTarget.ItemSlots[playerTarget.currentItemSlot];
																			if ((Object)(object)itemTarget != (Object)null)
																			{
																				if (itemTarget.itemProperties.requiresBattery)
																				{
																					Networking.ChargePlayerClientRpc(playerTarget.playerClientId);
																					Plugin.LogMessage("Charging " + playerTarget.playerUsername + "'s item \"" + itemTarget.itemProperties.itemName + "\".");
																				}
																				else
																				{
																					Plugin.LogMessage(playerTarget.playerUsername + "'s item \"" + itemTarget.itemProperties.itemName + "\" does not use a battery!", isError: true);
																				}
																			}
																			else
																			{
																				Plugin.LogMessage(playerTarget.playerUsername + " is not holding an item!", isError: true);
																			}
																		}
																		else if ((Object)(object)playerTarget != (Object)null && playerTarget.isPlayerDead)
																		{
																			Plugin.LogMessage("Could not charge " + playerTarget.playerUsername + "'s item!\nPlayer is dead!", isError: true);
																		}
																	}
																	else
																	{
																		string value14 = text3;
																		if ("kill".StartsWith(value14))
																		{
																			bool flag2 = false;
																			int num = 0;
																			if (command.Length < 2)
																			{
																				Plugin.LogMessage("Kill command requires a target!", isError: true);
																			}
																			else
																			{
																				string text5 = string.Join("", command.Skip(1));
																				if (text5[text5.Length - 1] == '*')
																				{
																					flag2 = true;
																					text5 = text5.Remove(text5.Length - 1, 1);
																				}
																				string[] array = text5.Split(new char[1] { '-' }, StringSplitOptions.RemoveEmptyEntries);
																				foundId = ulong.TryParse(array[0], out networkId);
																				if (foundId)
																				{
																					if (array.Length < 2 || !int.TryParse(array[1], out var result5))
																					{
																						result5 = (int)networkId;
																					}
																					result5 = Math.Max((int)networkId, result5);
																					for (int i = (int)networkId; i <= result5; i++)
																					{
																						enemyTarget = Networking.GetEnemyByNetId((ulong)i);
																						itemTarget = Networking.GetItemByNetId((ulong)i);
																						if ((Object)(object)enemyTarget != (Object)null)
																						{
																							num++;
																							enemyTarget.HitEnemy(999999, (PlayerControllerB)null, false, -1);
																							if ((Object)(object)((Component)enemyTarget).GetComponentInChildren<BlobAI>() != (Object)null || (Object)(object)((Component)enemyTarget).GetComponentInChildren<ButlerBeesEnemyAI>() != (Object)null || (Object)(object)((Component)enemyTarget).GetComponentInChildren<DressGirlAI>() != (Object)null || (Object)(object)((Component)enemyTarget).GetComponentInChildren<JesterAI>() != (Object)null || (Object)(object)((Component)enemyTarget).GetComponentInChildren<LassoManAI>() != (Object)null || (Object)(object)((Component)enemyTarget).GetComponentInChildren<SpringManAI>() != (Object)null || (Object)(object)((Component)enemyTarget).GetComponentInChildren<DocileLocustBeesAI>() != (Object)null || (Object)(object)((Component)enemyTarget).GetComponentInChildren<RadMechAI>() != (Object)null || (Object)(object)((Component)enemyTarget).GetComponentInChildren<RedLocustBees>() != (Object)null || (Object)(object)((Component)enemyTarget).GetComponentInChildren<SandWormAI>() != (Object)null || flag2)
																							{
																								Object.Destroy((Object)(object)((Component)enemyTarget).gameObject);
																							}
																							if ((int)networkId == result5)
																							{
																								Plugin.LogMessage($"Killed {enemyTarget.enemyType.enemyName} ({((NetworkBehaviour)enemyTarget).NetworkObjectId})!");
																							}
																						}
																						else if ((Object)(object)itemTarget != (Object)null)
																						{
																							num++;
																							Object.Destroy((Object)(object)((Component)itemTarget).gameObject);
																							if ((int)networkId == result5)
																							{
																								Plugin.LogMessage($"Killed {itemTarget.itemProperties.itemName} ({((NetworkBehaviour)itemTarget).NetworkObjectId})!");
																							}
																						}
																					}
																					if ((int)networkId != result5)
																					{
																						Plugin.LogMessage($"Killed {num} GameObjects!");
																					}
																				}
																				else
																				{
																					playerTarget = Plugin.GetPlayerFromString(string.Join(" ", command.Skip(1)));
																					if ((Object)(object)playerTarget != (Object)null && !playerTarget.isPlayerDead && playerTarget.isPlayerControlled)
																					{
																						Networking.HurtPlayerClientRpc(playerTarget.playerClientId, 999999);
																						Plugin.LogMessage("Killing " + playerTarget.playerUsername + "!");
																					}
																					else if ((Object)(object)playerTarget != (Object)null && playerTarget.isPlayerDead)
																					{
																						Plugin.LogMessage("Unable to kill " + playerTarget.playerUsername + ", player already dead!", isError: true);
																					}
																				}
																			}
																		}
																		else
																		{
																			string value15 = text3;
																			if ("nearby".StartsWith(value15))
																			{
																				CustomGUI.nearbyVisible = !CustomGUI.nearbyVisible;
																				CustomGUI.fullListVisible = false;
																				if (CustomGUI.nearbyVisible)
																				{
																					((MonoBehaviour)localPlayerController).StartCoroutine(CustomGUI.UpdateGUI());
																				}
																				else
																				{
																					((MonoBehaviour)localPlayerController).StopCoroutine(CustomGUI.UpdateGUI());
																				}
																				Plugin.LogMessage((CustomGUI.nearbyVisible ? "Enabling" : "Disabling") + " nearby list.");
																			}
																			else
																			{
																				string value16 = text3;
																				if ("suit".StartsWith(value16))
																				{
																					List<UnlockableItem> unlockables = StartOfRound.Instance.unlockablesList.unlockables;
																					UnlockableSuit val8 = new UnlockableSuit();
																					if (command.Length < 2)
																					{
																						string text6 = "";
																						foreach (UnlockableItem item2 in unlockables)
																						{
																							if (item2.unlockableType == 0)
																							{
																								text6 = text6 + item2.unlockableName + ", ";
																							}
																						}
																						text6 = text6.TrimEnd(',', ' ') + ".";
																						HUDManager.Instance.DisplayTip("Suit List", text6, false, false, "LC_Tip1");
																					}
																					else
																					{
																						int num2 = unlockables.IndexOf(((IEnumerable<UnlockableItem>)unlockables).FirstOrDefault((Func<UnlockableItem, bool>)((UnlockableItem suit) => suit.unlockableType == 0 && suit.unlockableName.ToLower().StartsWith(command[1]))));
																						if (num2 != -1 && unlockables[num2].unlockableType == 0)
																						{
																							playerTarget = ((command.Length > 2) ? Plugin.GetPlayerFromString(string.Join(" ", command.Skip(2))) : localPlayerController);
																							if (!((Object)(object)playerTarget == (Object)null))
																							{
																								Networking.SyncSuitClientRpc(playerTarget.playerClientId, num2);
																								Plugin.LogMessage("Setting " + playerTarget.playerUsername + " to " + unlockables[num2].unlockableName + ".");
																							}
																						}
																						else
																						{
																							Plugin.LogMessage("Unable to find suit \"" + command[1] + "\"!", isError: true);
																						}
																					}
																				}
																				else
																				{
																					string value17 = text3;
																					if ("noclip".StartsWith(value17))
																					{
																						Plugin.noclip = !Plugin.noclip;
																						Plugin.LogMessage("NoClip toggled " + (Plugin.noclip ? "on!" : "off."));
																					}
																					else
																					{
																						string value18 = text3;
																						if ("nightvision".StartsWith(value18))
																						{
																							Plugin.nightVision = !Plugin.nightVision;
																							((Behaviour)localPlayerController.nightVision).enabled = Plugin.nightVision;
																							localPlayerController.nightVision.color = (Color)(Plugin.nightVision ? Color.white : new Color(0.396f, 0.415f, 0.394f, 1f));
																							localPlayerController.nightVision.intensity = (Plugin.nightVision ? 1500f : 366.9317f);
																							localPlayerController.nightVision.range = (Plugin.nightVision ? 20000f : 12f);
																							Plugin.LogMessage("Night Vision toggled " + (Plugin.nightVision ? "on!" : "off."));
																						}
																						else
																						{
																							string value19 = text3;
																							if ("defog".StartsWith(value19))
																							{
																								Plugin.defog = !Plugin.defog;
																								Plugin.LogMessage("Defog toggled " + (Plugin.defog ? "on!" : "off."));
																							}
																							else
																							{
																								string value20 = text3;
																								if (!"lock".StartsWith(value20) && !"unlock".StartsWith(value20))
																								{
																									goto IL_1bd8;
																								}
																								PlayerControllerB val9 = ((localPlayerController.isPlayerDead && (Object)(object)localPlayerController.spectatedPlayerScript != (Object)null) ? localPlayerController.spectatedPlayerScript : localPlayerController);
																								if ((Object)(object)val9 != (Object)null && val9.isPlayerControlled)
																								{
																									RaycastHit val10 = default(RaycastHit);
																									Physics.Raycast(((Component)val9.playerGlobalHead).transform.position + val9.playerGlobalHead.forward * 1f, val9.playerGlobalHead.forward, ref val10, (float)StartOfRound.Instance.collidersAndRoomMaskAndDefault);
																									DoorLock component = ((Component)((RaycastHit)(ref val10)).collider).gameObject.GetComponent<DoorLock>();
																									if ((Object)(object)component != (Object)null)
																									{
																										Networking.DoorLockClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)component).NetworkObject), "unlock".StartsWith(value20));
																										Plugin.LogMessage(("unlock".StartsWith(value20) ? "Unlocking" : "Locking") + " door in front of " + val9.playerUsername + ".");
																									}
																									else
																									{
																										Plugin.LogMessage("Unable to find a door in front of " + val9.playerUsername + "!", isError: true);
																									}
																								}
																							}
																						}
																					}
																				}
																			}
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			else
			{
				List<string> list2 = new List<string>
				{
					"Items: Lists spawnable items", "Enemies: Lists spawnable enemies", "Traps: Lists spawnable traps", "Spawn: Spawns items/enemies/traps", "Give: Adds an item to a players inventory", "List: Lists existing players/items/enemies", "Nearby: Toggles a GUI displaying nearby items/enemies", "TP: Teleport players or gameobjects", "WP: Creates waypoints", "Heal: Heals/revives a player",
					"Kill: Kills a player/item/enemy", "GodMode: Toggles invincibility", "Defog: Toggles fog removal", "NightVision: Toggles Night Vision", "NoClip: Toggles NoClip", "Code: Toggles blast doors and traps", "Breaker: Toggles breaker box", "Lock: Locks the door in front of you", "Unlock: Unlocks the door in front of you", "Credit: Adjusts spendable credits",
					"Suit: Changes the suit of a player", "Charge: Charges a player's held item"
				};
				int result6 = 1;
				if (command.Length > 1)
				{
					int.TryParse(command[1], out result6);
				}
				result6 = Math.Max(result6, 1);
				FindPage(list2, result6, 4, "Command");
			}
			goto IL_1bdd;
			IL_1bd8:
			flag = false;
			goto IL_1bdd;
			IL_1bdd:
			if (flag)
			{
				__instance.chatTextField.text = string.Empty;
			}
			if (localPlayerController.isPlayerDead)
			{
				if (!string.IsNullOrEmpty(__instance.chatTextField.text) && __instance.chatTextField.text.Length < 50)
				{
					__instance.AddTextToChatOnServer(__instance.chatTextField.text, (int)__instance.localPlayer.playerClientId);
				}
				for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++)
				{
					if (StartOfRound.Instance.allPlayerScripts[j].isPlayerControlled && (double)Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position) > 24.399999618530273 && (!GameNetworkManager.Instance.localPlayerController.holdingWalkieTalkie || !StartOfRound.Instance.allPlayerScripts[j].holdingWalkieTalkie))
					{
						__instance.playerCouldRecieveTextChatAnimator.SetTrigger("ping");
						break;
					}
				}
				localPlayerController.isTypingChat = false;
				__instance.chatTextField.text = "";
				EventSystem.current.SetSelectedGameObject((GameObject)null);
				__instance.PingHUDElement(__instance.Chat, 2f, 1f, 0.2f);
				((Behaviour)__instance.typingIndicator).enabled = false;
				return false;
			}
			return true;
		}

		private static void FindPage<T>(List<T> list, int page, int itemsPerPage, string listName)
		{
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList;
			List<PlayerControllerB> list2 = StartOfRound.Instance.allPlayerScripts.ToList();
			List<GrabbableObject> list3 = Object.FindObjectsOfType<GrabbableObject>().ToList();
			List<EnemyAI> list4 = Object.FindObjectsOfType<EnemyAI>().ToList();
			List<TerminalAccessibleObject> list5 = Object.FindObjectsOfType<TerminalAccessibleObject>().ToList();
			bool flag = true;
			int count = list.Count;
			int num = (int)Math.Ceiling((double)count / (double)itemsPerPage);
			page = Math.Min(page, num);
			int num2 = (page - 1) * itemsPerPage;
			int val = num2 + itemsPerPage - 1;
			val = Math.Min(val, count - 1);
			if (num2 < 0 || num2 >= count || num2 > val)
			{
				if (num2 >= count || list.Count == 0)
				{
					Plugin.LogMessage(listName + " list is empty!", isError: true);
				}
				else
				{
					Plugin.LogMessage("Invalid page number! Please enter a valid page number.", isError: true);
				}
				return;
			}
			string text = "";
			for (int i = num2; i <= val; i++)
			{
				switch (listName)
				{
				case "Item":
					text = text + itemsList[i].itemName + ", ";
					continue;
				case "Enemy":
					text = text + Plugin.allEnemiesList[i].enemyType.enemyName + ", ";
					continue;
				case "Command":
					text += $"{list[i]}\n";
					continue;
				case "Player":
					if (list2[i].isPlayerControlled || list2[i].isPlayerDead)
					{
						text += string.Format("{0}{1} (#{2}{3})\n", list2[i].isPlayerDead ? "Dead: " : "", list2[i].playerUsername, list2[i].playerClientId, Plugin.CheckPlayerIsHost(list2[i]) ? " - HOST" : "");
						continue;
					}
					break;
				}
				switch (listName)
				{
				case "Active Items":
					text += $"{list3[i].itemProperties.itemName} ({((NetworkBehaviour)list3[i]).NetworkObjectId}), ";
					flag = false;
					break;
				case "Active Enemies":
					text += $"{list4[i].enemyType.enemyName} ({((NetworkBehaviour)list4[i]).NetworkObjectId}), ";
					flag = false;
					break;
				case "Terminal Codes":
					if (list5[i].objectCode != null)
					{
						if (list5[i].isBigDoor)
						{
							text = text + list5[i].objectCode + "(Door), ";
						}
						else if (!Object.op_Implicit((Object)(object)((Component)list5[i]).GetComponentInChildren<Landmine>()))
						{
							text = (Object.op_Implicit((Object)(object)((Component)list5[i]).GetComponentInChildren<Turret>()) ? (text + list5[i].objectCode + "(Turret), ") : ((!Object.op_Implicit((Object)(object)((Component)((Component)list5[i]).transform.parent).gameObject.GetComponentInChildren<SpikeRoofTrap>())) ? (text + list5[i].objectCode + "(Unknown), ") : (text + list5[i].objectCode + "(Spikes), ")));
						}
						else
						{
							if (((Component)list5[i]).GetComponentInChildren<Landmine>().hasExploded)
							{
								break;
							}
							text = text + list5[i].objectCode + "(Mine), ";
						}
					}
					flag = false;
					break;
				case "Waypoint":
					text = ((!(Plugin.waypoints[i] == RoundManager.FindMainEntrancePosition(true, true))) ? ((!(Plugin.waypoints[i] == RoundManager.FindMainEntrancePosition(true, false))) ? (text + $"@{i}({Math.Floor(Plugin.waypoints[i].x)}, {Math.Floor(Plugin.waypoints[i].z)}), ") : (text + $"@{i}(Entrance), ")) : (text + $"@{i}(Door), "));
					break;
				}
			}
			text = text.TrimEnd(',', ' ', '\n') + ((listName == "Player") ? "" : ".");
			string text2 = string.Format("{0}{1} ({2} of {3})", listName, flag ? " List" : "", page, num);
			HUDManager.Instance.DisplayTip(text2, text, false, false, "LC_Tip1");
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerB_Patch : MonoBehaviour
	{
		[HarmonyPatch("KillPlayer")]
		[HarmonyPostfix]
		private static void DeadPlayerEnableHUD(PlayerControllerB __instance)
		{
			if (Plugin.CheckPlayerIsHost(__instance))
			{
				HUDManager instance = HUDManager.Instance;
				instance.HideHUD(false);
				instance.ToggleHUD(true);
			}
		}

		[HarmonyPatch("AllowPlayerDeath")]
		[HarmonyPrefix]
		private static bool OverrideDeath(PlayerControllerB __instance)
		{
			if (!Plugin.CheckPlayerIsHost(__instance))
			{
				return true;
			}
			return !Plugin.godmode;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Update(PlayerControllerB __instance)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_01b2: 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)
			if (CustomGUI.nearbyVisible || CustomGUI.fullListVisible)
			{
				Vector3 val = ((__instance.isPlayerDead && (Object)(object)__instance.spectatedPlayerScript != (Object)null) ? ((Component)__instance.spectatedPlayerScript).transform.position : ((Component)__instance).transform.position);
				CustomGUI.posLabelText = CustomGUI.posLabelText + "List Type: " + (CustomGUI.fullListVisible ? "Full" : "Nearby") + "\n";
				CustomGUI.posLabelText = string.Format("Time: {0}{1}\n", (RoundManager.Instance.timeScript.hour + 6 > 12) ? (RoundManager.Instance.timeScript.hour - 6) : (RoundManager.Instance.timeScript.hour + 6), (RoundManager.Instance.timeScript.hour + 6 < 12) ? "am" : "pm");
				CustomGUI.posLabelText = CustomGUI.posLabelText + "GodMode: " + (Plugin.godmode ? "Enabled" : "Disabled") + "\n";
				CustomGUI.posLabelText = CustomGUI.posLabelText + "NoClip: " + (Plugin.noclip ? "Enabled" : "Disabled") + "\n";
				CustomGUI.posLabelText = CustomGUI.posLabelText + "NightVision: " + (Plugin.nightVision ? "Enabled" : "Disabled") + "\n";
				CustomGUI.posLabelText = CustomGUI.posLabelText + "Defog: " + (Plugin.defog ? "Enabled" : "Disabled") + "\n";
				CustomGUI.posLabelText += $"X: {Math.Round(val.x, 1)}\nY: {Math.Round(val.y, 1)}\nZ: {Math.Round(val.z, 1)}";
			}
			NoClipHandler();
			DefogHandler();
		}

		private static void NoClipHandler()
		{
			//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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "SampleSceneRelay")
			{
				return;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null)
			{
				return;
			}
			Transform transform = ((Component)localPlayerController.gameplayCamera).transform;
			if ((Object)(object)transform == (Object)null)
			{
				return;
			}
			Collider component = (Collider)(object)((Component)localPlayerController).GetComponent<CharacterController>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			if (Plugin.noclip)
			{
				component.enabled = false;
				Vector3 val = default(Vector3);
				if (UnityInput.Current.GetKey((KeyCode)119))
				{
					val += transform.forward;
				}
				if (UnityInput.Current.GetKey((KeyCode)115))
				{
					val += transform.forward * -1f;
				}
				if (UnityInput.Current.GetKey((KeyCode)100))
				{
					val += transform.right;
				}
				if (UnityInput.Current.GetKey((KeyCode)97))
				{
					val += transform.right * -1f;
				}
				if (UnityInput.Current.GetKey((KeyCode)32))
				{
					val.y += transform.up.y;
				}
				if (UnityInput.Current.GetKey((KeyCode)99))
				{
					val.y += transform.up.y * -1f;
				}
				Vector3 localPosition = ((Component)localPlayerController).transform.localPosition;
				if (!((Vector3)(ref localPosition)).Equals(Vector3.zero) && !localPlayerController.isTypingChat)
				{
					Vector3 val2 = localPosition + val * ((UnityInput.Current.GetKey((KeyCode)304) ? 15f : 5f) * Time.deltaTime);
					if (val2.y < -100f && !localPlayerController.isInsideFactory)
					{
						Plugin.PlayerTeleportEffects(localPlayerController.playerClientId, isInside: true, showParticles: false);
					}
					else if (val2.y >= -100f && localPlayerController.isInsideFactory)
					{
						Plugin.PlayerTeleportEffects(localPlayerController.playerClientId, isInside: false, showParticles: false);
					}
					((Component)localPlayerController).transform.localPosition = val2;
				}
			}
			else
			{
				component.enabled = true;
			}
		}

		private static void DefogHandler()
		{
			GameObject obj = GameObject.Find("Systems");
			if (obj != null)
			{
				Transform obj2 = obj.transform.Find("Rendering");
				if (obj2 != null)
				{
					Transform obj3 = obj2.Find("VolumeMain");
					if (obj3 != null)
					{
						((Component)obj3).gameObject.SetActive(!Plugin.defog);
					}
				}
			}
			GameObject obj4 = GameObject.Find("Environment");
			if (obj4 != null)
			{
				Transform obj5 = obj4.transform.Find("Lighting");
				if (obj5 != null)
				{
					Transform obj6 = obj5.Find("GroundFog");
					if (obj6 != null)
					{
						((Component)obj6).gameObject.SetActive(!Plugin.defog);
					}
				}
			}
			GameObject obj7 = GameObject.Find("Environment");
			if (obj7 == null)
			{
				return;
			}
			Transform obj8 = obj7.transform.Find("Lighting");
			if (obj8 == null)
			{
				return;
			}
			Transform obj9 = obj8.Find("BrightDay");
			if (obj9 == null)
			{
				return;
			}
			Transform obj10 = obj9.Find("Sun");
			if (obj10 == null)
			{
				return;
			}
			Transform obj11 = obj10.Find("SunAnimContainer");
			if (obj11 != null)
			{
				Transform obj12 = obj11.Find("StormVolume");
				if (obj12 != null)
				{
					((Component)obj12).gameObject.SetActive(!Plugin.defog);
				}
			}
		}
	}
	[HarmonyPatch(typeof(ShipTeleporter))]
	internal class ShipTeleporter_Patch : MonoBehaviour
	{
		[HarmonyPatch("SetRandomSeed")]
		[HarmonyPostfix]
		private static void GrabTeleporterSeed(ref Random ___shipTeleporterSeed)
		{
			Plugin.shipTeleporterSeed = ___shipTeleporterSeed;
		}

		[HarmonyPatch("OnDisable")]
		[HarmonyPostfix]
		private static void ResetTeleporterSeed()
		{
			Plugin.shipTeleporterSeed = nul