Decompiled source of GodCommands v1.5.2

BepInEx\plugins\MechGaming-GodCommands\GodCommands.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MechGaming")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: AssemblyInformationalVersion("1.5.2")]
[assembly: AssemblyProduct("GodCommands")]
[assembly: AssemblyTitle("GodCommands")]
[assembly: AssemblyVersion("1.5.2.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MechGaming.REPO.GodCommands
{
	internal static class HotkeyInput
	{
		private const int KeyDownMask = 32768;

		private const float TextInputScanInterval = 0.15f;

		private static readonly Dictionary<KeyCode, bool> PreviousStates = new Dictionary<KeyCode, bool>();

		private static readonly Type? UnityInputFieldType = Type.GetType("UnityEngine.UI.InputField, UnityEngine.UI");

		private static readonly Type? TmpInputFieldType = Type.GetType("TMPro.TMP_InputField, Unity.TextMeshPro");

		private static int _currentProcessId;

		private static float _nextTextInputScanTime;

		private static bool _cachedNoTextInputActive = true;

		private static int CurrentProcessId
		{
			get
			{
				if (_currentProcessId == 0)
				{
					_currentProcessId = Process.GetCurrentProcess().Id;
				}
				return _currentProcessId;
			}
		}

		internal static bool GetKeyDown(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			bool flag = GetUnityKeyDown(key) || GetWindowsKey(key);
			bool value;
			bool flag2 = PreviousStates.TryGetValue(key, out value) && value;
			PreviousStates[key] = flag;
			if (flag)
			{
				return !flag2;
			}
			return false;
		}

		internal static bool GetKey(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (!GetUnityKey(key))
			{
				return GetWindowsKey(key);
			}
			return true;
		}

		internal static bool GetMouseButton(int button)
		{
			if (!GetUnityMouseButton(button))
			{
				return GetWindowsMouseButton(button);
			}
			return true;
		}

		internal static bool NoTextInputActive(Func<bool> gameCheck)
		{
			try
			{
				if (gameCheck())
				{
					_cachedNoTextInputActive = true;
					return true;
				}
			}
			catch
			{
			}
			if (Time.unscaledTime < _nextTextInputScanTime)
			{
				return _cachedNoTextInputActive;
			}
			_nextTextInputScanTime = Time.unscaledTime + 0.15f;
			_cachedNoTextInputActive = !AnyFocusedTextInput();
			return _cachedNoTextInputActive;
		}

		private static bool GetUnityKeyDown(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return Input.GetKeyDown(key);
			}
			catch
			{
				return false;
			}
		}

		private static bool GetUnityKey(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return Input.GetKey(key);
			}
			catch
			{
				return false;
			}
		}

		private static bool GetUnityMouseButton(int button)
		{
			try
			{
				return Input.GetMouseButton(button);
			}
			catch
			{
				return false;
			}
		}

		private static bool GetWindowsKey(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			int num = ToVirtualKey(key);
			if (num != 0 && IsForegroundProcess())
			{
				return IsVirtualKeyDown(num);
			}
			return false;
		}

		private static bool GetWindowsMouseButton(int button)
		{
			int num = button switch
			{
				0 => 1, 
				1 => 2, 
				2 => 4, 
				_ => 0, 
			};
			if (num != 0 && IsForegroundProcess())
			{
				return IsVirtualKeyDown(num);
			}
			return false;
		}

		private static bool IsVirtualKeyDown(int virtualKey)
		{
			try
			{
				return (GetAsyncKeyState(virtualKey) & 0x8000) != 0;
			}
			catch
			{
				return false;
			}
		}

		private static bool IsForegroundProcess()
		{
			try
			{
				IntPtr foregroundWindow = GetForegroundWindow();
				if (foregroundWindow == IntPtr.Zero)
				{
					return false;
				}
				GetWindowThreadProcessId(foregroundWindow, out var processId);
				return processId == CurrentProcessId;
			}
			catch
			{
				return false;
			}
		}

		private static int ToVirtualKey(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_000c: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected I4, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Invalid comparison between Unknown and I4
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Invalid comparison between Unknown and I4
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected I4, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Invalid comparison between Unknown and I4
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected I4, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected I4, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Invalid comparison between Unknown and I4
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Invalid comparison between Unknown and I4
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Invalid comparison between Unknown and I4
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected I4, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Invalid comparison between Unknown and I4
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Invalid comparison between Unknown and I4
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Invalid comparison between Unknown and I4
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected I4, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Invalid comparison between Unknown and I4
			if ((int)key >= 97 && (int)key <= 122)
			{
				return 65 + (key - 97);
			}
			if ((int)key >= 48 && (int)key <= 57)
			{
				return 48 + (key - 48);
			}
			if ((int)key >= 282 && (int)key <= 678)
			{
				return 112 + (key - 282);
			}
			if ((int)key <= 32)
			{
				if ((int)key <= 9)
				{
					if ((int)key == 8)
					{
						return 8;
					}
					if ((int)key == 9)
					{
						return 9;
					}
				}
				else
				{
					if ((int)key == 13)
					{
						return 13;
					}
					if ((int)key == 27)
					{
						return 27;
					}
					if ((int)key == 32)
					{
						return 32;
					}
				}
			}
			else if ((int)key <= 127)
			{
				if ((int)key == 47)
				{
					return 191;
				}
				if ((int)key == 127)
				{
					return 46;
				}
			}
			else
			{
				switch (key - 273)
				{
				case 7:
					return 33;
				case 8:
					return 34;
				case 6:
					return 35;
				case 5:
					return 36;
				case 3:
					return 37;
				case 0:
					return 38;
				case 2:
					return 39;
				case 1:
					return 40;
				case 4:
					return 45;
				}
				switch (key - 303)
				{
				case 1:
					return 160;
				case 0:
					return 161;
				case 3:
					return 162;
				case 2:
					return 163;
				case 5:
					return 164;
				case 4:
					return 165;
				}
				switch (key - 323)
				{
				case 0:
					return 1;
				case 1:
					return 2;
				case 2:
					return 4;
				}
			}
			return 0;
		}

		private static bool AnyFocusedTextInput()
		{
			if (!TypeHasFocusedInput(UnityInputFieldType))
			{
				return TypeHasFocusedInput(TmpInputFieldType);
			}
			return true;
		}

		private static bool TypeHasFocusedInput(Type? inputType)
		{
			if (inputType == null)
			{
				return false;
			}
			try
			{
				Object[] array = Resources.FindObjectsOfTypeAll(inputType);
				for (int i = 0; i < array.Length; i++)
				{
					if (IsFocusedInput(array[i]))
					{
						return true;
					}
				}
			}
			catch
			{
				return false;
			}
			return false;
		}

		private static bool IsFocusedInput(Object input)
		{
			Component val = (Component)(object)((input is Component) ? input : null);
			if (val == null || !val.gameObject.activeInHierarchy)
			{
				return false;
			}
			Behaviour val2 = (Behaviour)(object)((val is Behaviour) ? val : null);
			if (val2 != null && !val2.enabled)
			{
				return false;
			}
			PropertyInfo property = ((object)input).GetType().GetProperty("isFocused", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (property != null && property.PropertyType == typeof(bool))
			{
				try
				{
					return (bool)property.GetValue(input, null);
				}
				catch
				{
					return false;
				}
			}
			return false;
		}

		[DllImport("user32.dll")]
		private static extern short GetAsyncKeyState(int virtualKey);

		[DllImport("user32.dll")]
		private static extern IntPtr GetForegroundWindow();

		[DllImport("user32.dll")]
		private static extern uint GetWindowThreadProcessId(IntPtr windowHandle, out uint processId);
	}
	[BepInPlugin("MechGaming.REPO.GodCommands", "GodCommands", "1.5.2")]
	public sealed class Plugin : BaseUnityPlugin
	{
		private static class GameFields
		{
			internal static readonly FieldInfo ChatMessage = AccessTools.Field(typeof(ChatManager), "chatMessage");

			internal static readonly FieldInfo AssetManagerMainCamera = AccessTools.Field(typeof(AssetManager), "mainCamera");

			internal static readonly FieldInfo CosmeticPhysGrabObject = AccessTools.Field(typeof(CosmeticWorldObject), "physGrabObject");

			internal static readonly FieldInfo EnemyEnemyParent = AccessTools.Field(typeof(Enemy), "EnemyParent");

			internal static readonly FieldInfo EnemyHasHealth = AccessTools.Field(typeof(Enemy), "HasHealth");

			internal static readonly FieldInfo EnemyHealth = AccessTools.Field(typeof(Enemy), "Health");

			internal static readonly FieldInfo EnemyHealthDead = AccessTools.Field(typeof(EnemyHealth), "dead");

			internal static readonly FieldInfo EnemyHealthDeadImpulse = AccessTools.Field(typeof(EnemyHealth), "deadImpulse");

			internal static readonly FieldInfo EnemyParentCurrentRooms = AccessTools.Field(typeof(EnemyParent), "currentRooms");

			internal static readonly FieldInfo EnemyParentDespawnedTimer = AccessTools.Field(typeof(EnemyParent), "DespawnedTimer");

			internal static readonly FieldInfo EnemyParentEnemy = AccessTools.Field(typeof(EnemyParent), "Enemy");

			internal static readonly FieldInfo EnemyParentSpawned = AccessTools.Field(typeof(EnemyParent), "Spawned");

			internal static readonly FieldInfo EnemyPlayerDistanceClosest = AccessTools.Field(typeof(EnemyPlayerDistance), "PlayerDistanceClosest");

			internal static readonly FieldInfo EnemyPlayerDistanceLocal = AccessTools.Field(typeof(EnemyPlayerDistance), "PlayerDistanceLocal");

			internal static readonly FieldInfo EnemyPlayerRoomSameAny = AccessTools.Field(typeof(EnemyPlayerRoom), "SameAny");

			internal static readonly FieldInfo EnemyPlayerRoomSameLocal = AccessTools.Field(typeof(EnemyPlayerRoom), "SameLocal");

			internal static readonly FieldInfo EnemyTargetPlayerAvatar = AccessTools.Field(typeof(Enemy), "TargetPlayerAvatar");

			internal static readonly FieldInfo EnemyTargetPlayerViewID = AccessTools.Field(typeof(Enemy), "TargetPlayerViewID");

			internal static readonly FieldInfo ExtractionCurrentState = AccessTools.Field(typeof(ExtractionPoint), "currentState");

			internal static readonly FieldInfo ExtractionSafetySpawn = AccessTools.Field(typeof(ExtractionPoint), "safetySpawn");

			internal static readonly FieldInfo ImpactDetectorIsIndestructible = AccessTools.Field(typeof(PhysGrabObjectImpactDetector), "isIndestructible");

			internal static readonly FieldInfo ItemAttributesInstanceName = AccessTools.Field(typeof(ItemAttributes), "instanceName");

			internal static readonly FieldInfo ItemAttributesAssetName = AccessTools.Field(typeof(ItemAttributes), "itemAssetName");

			internal static readonly FieldInfo ItemAttributesItemName = AccessTools.Field(typeof(ItemAttributes), "itemName");

			internal static readonly FieldInfo ItemAttributesPromptName = AccessTools.Field(typeof(ItemAttributes), "promptName");

			internal static readonly FieldInfo ItemBatteryBatteryLifeCountBars = AccessTools.Field(typeof(ItemBattery), "batteryLifeCountBars");

			internal static readonly FieldInfo ItemBatteryBatteryLifeCountBarsPrev = AccessTools.Field(typeof(ItemBattery), "batteryLifeCountBarsPrev");

			internal static readonly FieldInfo ItemBatteryBatteryLifeInt = AccessTools.Field(typeof(ItemBattery), "batteryLifeInt");

			internal static readonly FieldInfo ItemBatteryBatteryLifePrev = AccessTools.Field(typeof(ItemBattery), "batteryLifePrev");

			internal static readonly FieldInfo ItemBatteryBatteryVisualLogic = AccessTools.Field(typeof(ItemBattery), "batteryVisualLogic");

			internal static readonly FieldInfo ItemBatteryBatteryColorMedium = AccessTools.Field(typeof(ItemBattery), "batteryColorMedium");

			internal static readonly FieldInfo ItemBatteryCurrentBars = AccessTools.Field(typeof(ItemBattery), "currentBars");

			internal static readonly FieldInfo ItemBatteryDrainRate = AccessTools.Field(typeof(ItemBattery), "drainRate");

			internal static readonly FieldInfo ItemBatteryDrainTimer = AccessTools.Field(typeof(ItemBattery), "drainTimer");

			internal static readonly FieldInfo ItemBatteryItemEquippable = AccessTools.Field(typeof(ItemBattery), "itemEquippable");

			internal static readonly FieldInfo ItemBatteryItemAttributes = AccessTools.Field(typeof(ItemBattery), "itemAttributes");

			internal static readonly FieldInfo ItemBatteryPhysGrabObject = AccessTools.Field(typeof(ItemBattery), "physGrabObject");

			internal static readonly FieldInfo ItemBatteryShowBattery = AccessTools.Field(typeof(ItemBattery), "showBattery");

			internal static readonly FieldInfo ItemBatteryShowTimer = AccessTools.Field(typeof(ItemBattery), "showTimer");

			internal static readonly MethodInfo ItemBatteryBatteryUpdateBars = AccessTools.Method(typeof(ItemBattery), "BatteryUpdateBars", (Type[])null, (Type[])null);

			internal static readonly FieldInfo ItemEquippableIsEquipped = AccessTools.Field(typeof(ItemEquippable), "isEquipped");

			internal static readonly FieldInfo InventorySpots = AccessTools.Field(typeof(Inventory), "inventorySpots");

			internal static readonly FieldInfo InventorySpotBatteryVisualLogic = AccessTools.Field(typeof(InventorySpot), "batteryVisualLogic");

			internal static readonly FieldInfo InventorySpotCurrentItem = AccessTools.Field(typeof(InventorySpot), "<CurrentItem>k__BackingField");

			internal static readonly FieldInfo BatteryVisualBars = AccessTools.Field(typeof(BatteryVisualLogic), "bars");

			internal static readonly FieldInfo BatteryVisualCurrentBars = AccessTools.Field(typeof(BatteryVisualLogic), "currentBars");

			internal static readonly FieldInfo BatteryVisualIsCharging = AccessTools.Field(typeof(BatteryVisualLogic), "batteryIsCharging");

			internal static readonly FieldInfo BatteryVisualIsDraining = AccessTools.Field(typeof(BatteryVisualLogic), "batteryIsDraining");

			internal static readonly FieldInfo BatteryVisualIsOutWarning = AccessTools.Field(typeof(BatteryVisualLogic), "batteryIsOutWarning");

			internal static readonly FieldInfo BatteryVisualChargeNeeded = AccessTools.Field(typeof(BatteryVisualLogic), "batteryChargeNeeded");

			internal static readonly FieldInfo BatteryVisualSmallDeductionFlashing = AccessTools.Field(typeof(BatteryVisualLogic), "smallDeductionFlashing");

			internal static readonly FieldInfo MapCustomEntity = AccessTools.Field(typeof(MapCustom), "mapCustomEntity");

			internal static readonly FieldInfo PlayerAvatarIsLocal = AccessTools.Field(typeof(PlayerAvatar), "isLocal");

			internal static readonly FieldInfo PlayerAvatarRb = AccessTools.Field(typeof(PlayerAvatar), "rb");

			internal static readonly FieldInfo PlayerHealthGodMode = AccessTools.Field(typeof(PlayerHealth), "godMode");

			internal static readonly FieldInfo PlayerHealthHealth = AccessTools.Field(typeof(PlayerHealth), "health");

			internal static readonly FieldInfo PlayerHealthIsMenuAvatar = AccessTools.Field(typeof(PlayerHealth), "isMenuAvatar");

			internal static readonly FieldInfo PlayerHealthMaxHealth = AccessTools.Field(typeof(PlayerHealth), "maxHealth");

			internal static readonly FieldInfo PhysGrabEnemyRigidbody = AccessTools.Field(typeof(PhysGrabObject), "enemyRigidbody");

			internal static readonly FieldInfo PhysGrabImpactDetector = AccessTools.Field(typeof(PhysGrabObject), "impactDetector");

			internal static readonly FieldInfo PhysGrabIsCart = AccessTools.Field(typeof(PhysGrabObject), "isCart");

			internal static readonly FieldInfo PhysGrabIsEnemy = AccessTools.Field(typeof(PhysGrabObject), "isEnemy");

			internal static readonly FieldInfo PhysGrabIsPlayer = AccessTools.Field(typeof(PhysGrabObject), "isPlayer");

			internal static readonly FieldInfo PhysGrabIsValuable = AccessTools.Field(typeof(PhysGrabObject), "isValuable");

			internal static readonly FieldInfo PhysGrabSpawnTorque = AccessTools.Field(typeof(PhysGrabObject), "spawnTorque");

			internal static readonly FieldInfo RoundExtractionPointActive = AccessTools.Field(typeof(RoundDirector), "extractionPointActive");

			internal static readonly FieldInfo RoundExtractionPointCurrent = AccessTools.Field(typeof(RoundDirector), "extractionPointCurrent");

			internal static readonly FieldInfo ValuableDollarValueCurrent = AccessTools.Field(typeof(ValuableObject), "dollarValueCurrent");

			internal static readonly FieldInfo ValuableDollarValueOriginal = AccessTools.Field(typeof(ValuableObject), "dollarValueOriginal");

			internal static readonly FieldInfo ValuableDollarValueOverride = AccessTools.Field(typeof(ValuableObject), "dollarValueOverride");

			internal static readonly FieldInfo ValuableDollarValueSet = AccessTools.Field(typeof(ValuableObject), "dollarValueSet");

			internal static readonly FieldInfo ValuablePhysGrabObject = AccessTools.Field(typeof(ValuableObject), "physGrabObject");

			internal static T Get<T>(FieldInfo field, object instance)
			{
				if (field == null || instance == null)
				{
					return default(T);
				}
				object value = field.GetValue(instance);
				if (value is T)
				{
					return (T)value;
				}
				return default(T);
			}

			internal static void Set<T>(FieldInfo field, object instance, T value)
			{
				if (!(field == null) && instance != null)
				{
					field.SetValue(instance, value);
				}
			}

			internal static object? Invoke(MethodInfo method, object instance, params object[] args)
			{
				if (method == null || instance == null)
				{
					return null;
				}
				return method.Invoke(instance, args);
			}
		}

		[CompilerGenerated]
		private sealed class <GetLocalPlayerHealthObjects>d__268 : IEnumerable<PlayerHealth>, IEnumerable, IEnumerator<PlayerHealth>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private PlayerHealth <>2__current;

			private int <>l__initialThreadId;

			private PlayerHealth[] <>7__wrap1;

			private int <>7__wrap2;

			PlayerHealth IEnumerator<PlayerHealth>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetLocalPlayerHealthObjects>d__268(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					PlayerAvatar localPlayerAvatar = GetLocalPlayerAvatar();
					if ((Object)(object)localPlayerAvatar != (Object)null && (Object)(object)localPlayerAvatar.playerHealth != (Object)null)
					{
						<>2__current = localPlayerAvatar.playerHealth;
						<>1__state = 1;
						return true;
					}
					<>7__wrap1 = Object.FindObjectsOfType<PlayerHealth>();
					<>7__wrap2 = 0;
					goto IL_00ba;
				}
				case 1:
					<>1__state = -1;
					return false;
				case 2:
					{
						<>1__state = -1;
						goto IL_00ac;
					}
					IL_00ac:
					<>7__wrap2++;
					goto IL_00ba;
					IL_00ba:
					if (<>7__wrap2 < <>7__wrap1.Length)
					{
						PlayerHealth val = <>7__wrap1[<>7__wrap2];
						if (!((Object)(object)val == (Object)null) && !GameFields.Get<bool>(GameFields.PlayerHealthIsMenuAvatar, val))
						{
							<>2__current = val;
							<>1__state = 2;
							return true;
						}
						goto IL_00ac;
					}
					<>7__wrap1 = null;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<PlayerHealth> IEnumerable<PlayerHealth>.GetEnumerator()
			{
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					return this;
				}
				return new <GetLocalPlayerHealthObjects>d__268(0);
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<PlayerHealth>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <GetRespawnTimerLines>d__158 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private string <>2__current;

			private int <>l__initialThreadId;

			private IEnumerator<(string Name, int Seconds)> <>7__wrap1;

			string IEnumerator<string>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetRespawnTimerLines>d__158(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
					{
						<>1__state = -1;
						List<(string, int)> list = new List<(string, int)>();
						foreach (EnemyParent knownEnemy in GetKnownEnemies())
						{
							if (!((Object)(object)knownEnemy == (Object)null) && !IsEnemySpawned(knownEnemy))
							{
								float num = GameFields.Get<float>(GameFields.EnemyParentDespawnedTimer, knownEnemy);
								if (!(num <= 0.05f))
								{
									list.Add((DescribeEnemy(knownEnemy), Mathf.CeilToInt(num)));
								}
							}
						}
						<>7__wrap1 = list.OrderBy<(string, int), int>(((string Name, int Seconds) timer) => timer.Seconds).ThenBy<(string, int), string>(((string Name, int Seconds) timer) => timer.Name, StringComparer.OrdinalIgnoreCase).GetEnumerator();
						<>1__state = -3;
						break;
					}
					case 1:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap1.MoveNext())
					{
						(string Name, int Seconds) current2 = <>7__wrap1.Current;
						string item = current2.Name;
						int item2 = current2.Seconds;
						<>2__current = $"{item} - {item2}s";
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>7__wrap1 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<string> IEnumerable<string>.GetEnumerator()
			{
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					return this;
				}
				return new <GetRespawnTimerLines>d__158(0);
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<string>)this).GetEnumerator();
			}
		}

		public const string PluginGuid = "MechGaming.REPO.GodCommands";

		public const string PluginName = "GodCommands";

		public const string PluginVersion = "1.5.2";

		private const float MonsterMapRefreshInterval = 0.5f;

		private const float LootRefreshInterval = 1f;

		private const float LightsRefreshInterval = 1f;

		private const float GearEnergyRefreshInterval = 0.25f;

		private const float MessageDuration = 4f;

		private const int MenuWidth = 1080;

		private const int MenuHeight = 720;

		private const int SummonSuggestionLimit = 8;

		private const int MaxSummonAmount = 50;

		private const int LaserSwirlSegments = 24;

		private const float NoclipSpeed = 9f;

		private const float NoclipFastSpeed = 22f;

		private const float LaserRange = 75f;

		private const float LaserDamageInterval = 0.12f;

		private const string SoloOnlyMessage = "GodCommands only works in SoloPlayer.";

		private const string CommandInputControlName = "GodCommandsCommandInput";

		private Harmony? _harmony;

		private DebugCommandHandler? _registeredHandler;

		private ConfigEntry<KeyCode> _adminMenuKey;

		private ConfigEntry<int> _laserDamage;

		private Dictionary<AdminAction, ConfigEntry<KeyCode>> _actionKeys;

		private readonly Dictionary<int, RendererState> _invisibilityRenderers = new Dictionary<int, RendererState>();

		private readonly Dictionary<int, ColliderState> _noclipColliders = new Dictionary<int, ColliderState>();

		private readonly Dictionary<int, RigidbodyState> _noclipRigidbodies = new Dictionary<int, RigidbodyState>();

		private readonly Dictionary<int, MapCustom> _monsterMapMarkers = new Dictionary<int, MapCustom>();

		private readonly List<string> _respawnTimerHudLines = new List<string>();

		private readonly List<SummonableItem> _summonables = new List<SummonableItem>();

		private bool _lootIndestructible;

		private bool _commandWindowOpen;

		private bool _commandWindowFocusRequested;

		private bool _adminMenuOpen;

		private bool _summonCatalogBuilt;

		private bool _lightsOriginalStored;

		private bool _storedCursorVisible;

		private bool _storedCommandCursorVisible;

		private bool _originalFog;

		private CursorLockMode _storedCursorLockMode;

		private CursorLockMode _storedCommandCursorLockMode;

		private AdminAction? _bindingAction;

		private Rect _adminMenuRect = new Rect(40f, 40f, 1080f, 720f);

		private Vector2 _adminMenuScroll;

		private Vector2 _commandHelpScroll;

		private Vector2 _summonSuggestionsScroll;

		private GameObject? _rightClickLaserVisual;

		private LineRenderer? _rightClickLaserLine;

		private LineRenderer? _rightClickLaserSwirlA;

		private LineRenderer? _rightClickLaserSwirlB;

		private Light? _rightClickLaserLight;

		private Material? _rightClickLaserMaterial;

		private GameObject? _lightsObject;

		private Light? _lightsDirectional;

		private Sprite? _monsterMarkerSprite;

		private Texture2D? _monsterMarkerTexture;

		private AmbientMode _originalAmbientMode;

		private Color _originalAmbientLight;

		private Color _originalFogColor;

		private float _originalAmbientIntensity;

		private float _originalFogDensity;

		private float _nextLootRefreshTime;

		private float _nextInvisibilityRefreshTime;

		private float _nextLightsRefreshTime;

		private float _nextGearEnergyRefreshTime;

		private float _nextLaserDamageTime;

		private float _nextMonsterMapRefreshTime;

		private float _nextRespawnHudRefreshTime;

		private float _statusMessageUntil;

		private string _statusMessage = string.Empty;

		private string _commandInput = "/";

		private string _giveMoneyText = "1000";

		private string _laserDamageText = "100";

		private string _summonCatalogStatus = "Summon catalog not indexed yet.";

		private string _summonCatalogSceneName = string.Empty;

		private string _summonSearch = string.Empty;

		private string _summonAmountText = "1";

		private int _summonCatalogKnownItemCount;

		private static readonly KeyCode[] BindableKeys = (from KeyCode key in Enum.GetValues(typeof(KeyCode))
			where (int)key > 0
			select key).ToArray();

		private static readonly Color VanillaBatteryColor = new Color(1f, 0.86f, 0.06f, 1f);

		private static readonly Color VanillaBatteryBorderColor = new Color(1f, 0.68f, 0.04f, 1f);

		private static readonly string[] CommandHelpLines = new string[20]
		{
			"/kill - kill nearest monster", "/killroom - kill monsters in your room", "/killall - kill all living monsters", "/killclick - toggle click-to-kill", "/infiniteenergy - toggle infinite player energy", "/invis - toggle invisibility", "/invulnerable - toggle invulnerability", "/noclip - toggle noclip", "/showmonsters - toggle monster map dots", "/showrespawntimer - toggle monster respawn HUD",
			"/unlimitedenergy - toggle gear energy", "/laseronrightclick - toggle right-click laser", "/lightson - toggle bright map lighting", "/spawning - toggle monster spawning", "/indestructableloot - make loot indestructable", "/extractall - move all loot value to extractor", "/tptoextractor - teleport to extractor", "/tptotruck - teleport to truck", "/summonitem [item name] [amount] - spawn an item", "/givemoney [amount] - add money"
		};

		internal static Plugin? Instance { get; private set; }

		internal static bool InfiniteEnergyEnabled { get; private set; }

		internal static bool InvisibilityEnabled { get; private set; }

		internal static bool InvulnerableEnabled { get; private set; }

		internal static bool KillClickEnabled { get; private set; }

		internal static bool LaserOnRightClickEnabled { get; private set; }

		internal static bool LightsOnEnabled { get; private set; }

		internal static bool NoclipEnabled { get; private set; }

		internal static bool ShowMonstersEnabled { get; private set; }

		internal static bool ShowRespawnTimersEnabled { get; private set; }

		internal static bool SpawningDisabled { get; private set; }

		internal static bool UnlimitedGearEnergyEnabled { get; private set; }

		private void Awake()
		{
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Expected O, but got Unknown
			Instance = this;
			_adminMenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "AdminMenuKey", (KeyCode)284, "Key used to open the GodCommands admin menu.");
			_laserDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Laser", "RightClickLaserDamage", 100, "Damage applied by each right-click laser hit tick.");
			_laserDamageText = Mathf.Clamp(_laserDamage.Value, 1, 999999).ToString();
			_actionKeys = new Dictionary<AdminAction, ConfigEntry<KeyCode>>
			{
				[AdminAction.InfiniteEnergy] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "InfiniteEnergy", (KeyCode)0, "Optional keybind for toggling infinite energy."),
				[AdminAction.Invisibility] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "Invisibility", (KeyCode)0, "Optional keybind for toggling invisibility."),
				[AdminAction.Invulnerable] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "Invulnerable", (KeyCode)0, "Optional keybind for toggling invulnerability."),
				[AdminAction.KillClick] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "KillClick", (KeyCode)0, "Optional keybind for toggling kill click."),
				[AdminAction.LaserOnRightClick] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "LaserOnRightClick", (KeyCode)0, "Optional keybind for toggling right-click laser."),
				[AdminAction.LightsOn] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "LightsOn", (KeyCode)0, "Optional keybind for toggling map lighting."),
				[AdminAction.Noclip] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "Noclip", (KeyCode)0, "Optional keybind for toggling noclip flight."),
				[AdminAction.ShowMonsters] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "ShowMonsters", (KeyCode)0, "Optional keybind for toggling monster map markers."),
				[AdminAction.ShowRespawnTimers] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "ShowRespawnTimers", (KeyCode)0, "Optional keybind for toggling monster respawn timers."),
				[AdminAction.DisableSpawning] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "DisableSpawning", (KeyCode)0, "Optional keybind for toggling monster spawning."),
				[AdminAction.IndestructibleLoot] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "IndestructibleLoot", (KeyCode)0, "Optional keybind for enabling indestructable loot."),
				[AdminAction.UnlimitedGearEnergy] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "UnlimitedGearEnergy", (KeyCode)0, "Optional keybind for toggling unlimited weapon and gear energy."),
				[AdminAction.GiveMoney] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "GiveMoney", (KeyCode)0, "Optional keybind for giving the amount entered in the admin menu."),
				[AdminAction.KillNearest] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "KillNearest", (KeyCode)0, "Optional keybind for killing the nearest monster."),
				[AdminAction.KillRoom] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "KillRoom", (KeyCode)0, "Optional keybind for killing monsters in your current room."),
				[AdminAction.KillAll] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "KillAll", (KeyCode)0, "Optional keybind for killing every living monster."),
				[AdminAction.ExtractAll] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "ExtractAll", (KeyCode)0, "Optional keybind for extracting all map loot."),
				[AdminAction.TeleportToExtractor] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "TeleportToExtractor", (KeyCode)0, "Optional keybind for teleporting to an extractor."),
				[AdminAction.TeleportToTruck] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "TeleportToTruck", (KeyCode)0, "Optional keybind for teleporting to the truck."),
				[AdminAction.SummonItem] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "SummonItem", (KeyCode)0, "Optional keybind for summoning the selected menu item.")
			};
			_harmony = new Harmony("MechGaming.REPO.GodCommands");
			_harmony.PatchAll(typeof(Plugin).Assembly);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"GodCommands 1.5.2 loaded.");
		}

		private void Update()
		{
			TryRegisterCommands();
			if (!IsSoloPlayer())
			{
				RestoreInvisibilityRenderers();
				RestoreNoclipPhysics();
				HideMonsterMapMarkers();
				DestroyRightClickLaser();
				DisableMapLights();
				SetCommandWindowOpen(open: false);
				HandleInput();
				return;
			}
			HandleInput();
			ApplyInfiniteEnergy();
			ApplyInvulnerability();
			ApplyUnlimitedGearEnergy();
			ApplyInvisibility();
			ApplyNoclip();
			ApplyMonsterMapMarkers();
			ApplyMapLights();
			UpdateRightClickLaser();
			if (_lootIndestructible && Time.unscaledTime >= _nextLootRefreshTime)
			{
				ApplyIndestructibleToLoot();
				_nextLootRefreshTime = Time.unscaledTime + 1f;
			}
		}

		private void OnDestroy()
		{
			SetAdminMenuOpen(open: false);
			RestoreInvisibilityRenderers();
			RestoreNoclipPhysics();
			HideMonsterMapMarkers();
			DestroyRightClickLaser();
			DisableMapLights();
			SetCommandWindowOpen(open: false);
			Harmony? harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Instance = null;
		}

		private void OnGUI()
		{
			//IL_00fb: 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_0116: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: 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)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Expected O, but got Unknown
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			DrawKeyboundStatus();
			DrawRespawnTimersHud();
			if (_commandWindowOpen)
			{
				DrawCommandWindow();
			}
			if (_adminMenuOpen)
			{
				((Rect)(ref _adminMenuRect)).width = Mathf.Min(1080f, Mathf.Max(520f, (float)Screen.width - 80f));
				((Rect)(ref _adminMenuRect)).height = Mathf.Min(720f, Mathf.Max(420f, (float)Screen.height - 80f));
				((Rect)(ref _adminMenuRect)).x = Mathf.Clamp(((Rect)(ref _adminMenuRect)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref _adminMenuRect)).width));
				((Rect)(ref _adminMenuRect)).y = Mathf.Clamp(((Rect)(ref _adminMenuRect)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref _adminMenuRect)).height));
				_adminMenuRect = GUI.Window(((Object)this).GetInstanceID(), _adminMenuRect, new WindowFunction(DrawAdminMenuWindow), "GodCommands Admin");
			}
			if (!(Time.unscaledTime >= _statusMessageUntil) && !string.IsNullOrWhiteSpace(_statusMessage))
			{
				float num = Mathf.Max(12f, ((float)Screen.width - 560f) / 2f);
				Rect val = new Rect(num, 42f, Mathf.Min(560f, (float)Screen.width - 24f), 46f);
				GUI.color = new Color(0f, 0f, 0f, 0.68f);
				GUI.Box(val, GUIContent.none);
				GUI.color = Color.white;
				GUIStyle val2 = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontSize = 18,
					fontStyle = (FontStyle)1,
					wordWrap = true
				};
				val2.normal.textColor = new Color(0.82f, 1f, 0.78f, 1f);
				GUI.Label(val, _statusMessage, val2);
			}
		}

		private void DrawCommandWindow()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Invalid comparison between Unknown and I4
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0125: Invalid comparison between Unknown and I4
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Invalid comparison between Unknown and I4
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Invalid comparison between Unknown and I4
			float num = Mathf.Min(880f, (float)Screen.width - 80f);
			float num2 = Mathf.Min(360f, (float)Screen.height - 120f);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((float)Screen.width - num) / 2f, (float)Screen.height - num2 - 46f, num, num2);
			GUI.color = new Color(0f, 0f, 0f, 0.84f);
			GUI.Box(val, GUIContent.none);
			GUI.color = Color.white;
			GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 12f, ((Rect)(ref val)).width - 28f, ((Rect)(ref val)).height - 24f));
			GUILayout.Label("GodCommands", Array.Empty<GUILayoutOption>());
			GUI.SetNextControlName("GodCommandsCommandInput");
			_commandInput = GUILayout.TextField(_commandInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) });
			Event current = Event.current;
			if ((int)current.type == 4)
			{
				KeyCode keyCode = current.keyCode;
				if (((int)keyCode == 13 || (int)keyCode == 271) ? true : false)
				{
					SubmitCommandWindow();
					current.Use();
				}
				else if ((int)current.keyCode == 27)
				{
					SetCommandWindowOpen(open: false);
					current.Use();
				}
			}
			GUILayout.Space(8f);
			string filter = NormalizeCommandFilter(_commandInput);
			List<string> list = CommandHelpLines.Where((string line) => string.IsNullOrWhiteSpace(filter) || line.Contains(filter, StringComparison.OrdinalIgnoreCase)).ToList();
			_commandHelpScroll = GUILayout.BeginScrollView(_commandHelpScroll, false, true, Array.Empty<GUILayoutOption>());
			IEnumerable<string> enumerable;
			if (list.Count <= 0)
			{
				IEnumerable<string> commandHelpLines = CommandHelpLines;
				enumerable = commandHelpLines;
			}
			else
			{
				IEnumerable<string> commandHelpLines = list;
				enumerable = commandHelpLines;
			}
			foreach (string item in enumerable)
			{
				GUILayout.Label(item, Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndScrollView();
			GUILayout.EndArea();
			if (_commandWindowFocusRequested)
			{
				GUI.FocusControl("GodCommandsCommandInput");
				_commandWindowFocusRequested = false;
			}
		}

		private void SubmitCommandWindow()
		{
			string commandInput = _commandInput;
			SetCommandWindowOpen(open: false);
			PublishCommandResult(ExecuteLocalCommand(commandInput));
		}

		private void HandleInput()
		{
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_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_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			if (_bindingAction.HasValue)
			{
				if (HotkeyInput.GetKeyDown((KeyCode)27))
				{
					PublishStatus("keybind cancelled");
					_bindingAction = null;
					return;
				}
				KeyCode[] bindableKeys = BindableKeys;
				for (int i = 0; i < bindableKeys.Length; i++)
				{
					KeyCode val = bindableKeys[i];
					if (HotkeyInput.GetKeyDown(val) && !((object)(KeyCode)(ref val)).ToString().StartsWith("Mouse", StringComparison.OrdinalIgnoreCase) && !((object)(KeyCode)(ref val)).ToString().StartsWith("Joystick", StringComparison.OrdinalIgnoreCase))
					{
						AdminAction value = _bindingAction.Value;
						_actionKeys[value].Value = val;
						_bindingAction = null;
						PublishStatus($"{GetActionLabel(value)} bound to [{val}]");
						break;
					}
				}
			}
			else if (HotkeyInput.GetKeyDown(_adminMenuKey.Value))
			{
				SetCommandWindowOpen(open: false);
				SetAdminMenuOpen(!_adminMenuOpen);
			}
			else if (_commandWindowOpen)
			{
				if (HotkeyInput.GetKeyDown((KeyCode)13) || HotkeyInput.GetKeyDown((KeyCode)271))
				{
					SubmitCommandWindow();
				}
				else if (HotkeyInput.GetKeyDown((KeyCode)27))
				{
					SetCommandWindowOpen(open: false);
				}
			}
			else if (_adminMenuOpen)
			{
				if (HotkeyInput.GetKeyDown((KeyCode)27))
				{
					SetAdminMenuOpen(open: false);
				}
			}
			else
			{
				if (!NoTextInputActive())
				{
					return;
				}
				if (!IsSoloPlayer() || !HotkeyInput.GetKeyDown((KeyCode)47))
				{
					foreach (KeyValuePair<AdminAction, ConfigEntry<KeyCode>> actionKey in _actionKeys)
					{
						KeyCode value2 = actionKey.Value.Value;
						if ((int)value2 != 0 && HotkeyInput.GetKeyDown(value2))
						{
							PublishStatus(ExecuteAction(actionKey.Key));
						}
					}
					return;
				}
				SetCommandWindowOpen(open: true);
			}
		}

		private void HandleSoloBlockedInput()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (HotkeyInput.GetKeyDown(_adminMenuKey.Value))
			{
				PublishStatus("GodCommands only works in SoloPlayer.");
			}
		}

		private void ApplyInfiniteEnergy()
		{
			if (InfiniteEnergyEnabled && IsSoloPlayer())
			{
				PlayerController instance = PlayerController.instance;
				if (!((Object)(object)instance == (Object)null))
				{
					instance.EnergyCurrent = Mathf.Max(instance.EnergyCurrent, instance.EnergyStart);
				}
			}
		}

		private void ApplyInvulnerability()
		{
			if (!InvulnerableEnabled || !IsSoloPlayer())
			{
				return;
			}
			foreach (PlayerHealth localPlayerHealthObject in GetLocalPlayerHealthObjects())
			{
				SetPlayerHealthInvulnerable(localPlayerHealthObject, invulnerable: true);
			}
		}

		private void ApplyUnlimitedGearEnergy()
		{
			if (UnlimitedGearEnergyEnabled && IsSoloPlayer() && !(Time.unscaledTime < _nextGearEnergyRefreshTime))
			{
				ItemBattery[] array = Object.FindObjectsOfType<ItemBattery>();
				for (int i = 0; i < array.Length; i++)
				{
					FillBattery(array[i]);
				}
				_nextGearEnergyRefreshTime = Time.unscaledTime + 0.25f;
			}
		}

		private void ApplyInvisibility()
		{
			if (!InvisibilityEnabled || !IsSoloPlayer() || Time.unscaledTime < _nextInvisibilityRefreshTime)
			{
				return;
			}
			PlayerAvatar localPlayerAvatar = GetLocalPlayerAvatar();
			if ((Object)(object)localPlayerAvatar != (Object)null)
			{
				HideLocalAvatarRenderers(localPlayerAvatar);
			}
			EnemyVision[] array = Object.FindObjectsOfType<EnemyVision>();
			foreach (EnemyVision val in array)
			{
				try
				{
					val.DisableVision(0.4f);
				}
				catch (Exception ex)
				{
					((BaseUnityPlugin)this).Logger.LogDebug((object)("Could not disable enemy vision: " + ex.Message));
				}
			}
			EnemyPlayerDistance[] array2 = Object.FindObjectsOfType<EnemyPlayerDistance>();
			foreach (EnemyPlayerDistance instance in array2)
			{
				GameFields.Set(GameFields.EnemyPlayerDistanceLocal, instance, 9999f);
				GameFields.Set(GameFields.EnemyPlayerDistanceClosest, instance, 9999f);
			}
			EnemyPlayerRoom[] array3 = Object.FindObjectsOfType<EnemyPlayerRoom>();
			foreach (EnemyPlayerRoom instance2 in array3)
			{
				GameFields.Set(GameFields.EnemyPlayerRoomSameAny, instance2, value: false);
				GameFields.Set(GameFields.EnemyPlayerRoomSameLocal, instance2, value: false);
			}
			Enemy[] array4 = Object.FindObjectsOfType<Enemy>();
			foreach (Enemy val2 in array4)
			{
				if (IsLocalPlayer(GameFields.Get<PlayerAvatar>(GameFields.EnemyTargetPlayerAvatar, val2)))
				{
					GameFields.Set<PlayerAvatar>(GameFields.EnemyTargetPlayerAvatar, val2, null);
					GameFields.Set(GameFields.EnemyTargetPlayerViewID, val2, 0);
					try
					{
						val2.DisableChase(0.4f);
					}
					catch (Exception ex2)
					{
						((BaseUnityPlugin)this).Logger.LogDebug((object)("Could not disable enemy chase: " + ex2.Message));
					}
				}
			}
			_nextInvisibilityRefreshTime = Time.unscaledTime + 0.2f;
		}

		private void ApplyNoclip()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: 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_01b7: 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)
			if (!NoclipEnabled || !IsSoloPlayer())
			{
				RestoreNoclipPhysics();
				return;
			}
			PlayerController instance = PlayerController.instance;
			PlayerAvatar localPlayerAvatar = GetLocalPlayerAvatar();
			if ((Object)(object)instance == (Object)null || (Object)(object)localPlayerAvatar == (Object)null)
			{
				return;
			}
			CacheAndDisableNoclipPhysics(instance, localPlayerAvatar);
			instance.InputDisable(0.1f);
			instance.AntiGravity(0.2f);
			Transform cameraTransform = GetCameraTransform(instance);
			if ((Object)(object)cameraTransform == (Object)null)
			{
				return;
			}
			Quaternion rotation = Quaternion.Euler(0f, cameraTransform.eulerAngles.y, 0f);
			((Component)instance).transform.rotation = rotation;
			((Component)localPlayerAvatar).transform.rotation = rotation;
			ZeroLocalPlayerVelocity(instance, localPlayerAvatar);
			if (!_adminMenuOpen && !_commandWindowOpen && NoTextInputActive())
			{
				Vector3 val = Vector3.zero;
				if (HotkeyInput.GetKey((KeyCode)119))
				{
					val += cameraTransform.forward;
				}
				if (HotkeyInput.GetKey((KeyCode)115))
				{
					val -= cameraTransform.forward;
				}
				if (HotkeyInput.GetKey((KeyCode)100))
				{
					val += cameraTransform.right;
				}
				if (HotkeyInput.GetKey((KeyCode)97))
				{
					val -= cameraTransform.right;
				}
				if (HotkeyInput.GetKey((KeyCode)32) || HotkeyInput.GetKey((KeyCode)101))
				{
					val += Vector3.up;
				}
				if (HotkeyInput.GetKey((KeyCode)306) || HotkeyInput.GetKey((KeyCode)113))
				{
					val -= Vector3.up;
				}
				if (!(((Vector3)(ref val)).sqrMagnitude <= 0.0001f))
				{
					float num = ((HotkeyInput.GetKey((KeyCode)304) || HotkeyInput.GetKey((KeyCode)303)) ? 22f : 9f);
					TeleportLocalPlayer(((Component)localPlayerAvatar).transform.position + ((Vector3)(ref val)).normalized * num * Time.unscaledDeltaTime, rotation);
				}
			}
		}

		private void ApplyMonsterMapMarkers()
		{
			if (!ShowMonstersEnabled || !IsSoloPlayer() || Time.unscaledTime < _nextMonsterMapRefreshTime)
			{
				return;
			}
			Map instance = Map.Instance;
			if ((Object)(object)instance == (Object)null || (Object)(object)instance.CustomObject == (Object)null || (Object)(object)instance.OverLayerParent == (Object)null)
			{
				return;
			}
			HashSet<int> hashSet = new HashSet<int>();
			foreach (EnemyParent liveEnemy in GetLiveEnemies())
			{
				int instanceID = ((Object)liveEnemy).GetInstanceID();
				hashSet.Add(instanceID);
				EnsureMonsterMapMarker(instance, liveEnemy, instanceID);
			}
			foreach (int item in _monsterMapMarkers.Keys.ToList())
			{
				if (!hashSet.Contains(item))
				{
					RemoveMonsterMapMarker(item);
				}
			}
			_nextMonsterMapRefreshTime = Time.unscaledTime + 0.5f;
		}

		private void ApplyMapLights()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (LightsOnEnabled && IsSoloPlayer() && !(Time.unscaledTime < _nextLightsRefreshTime))
			{
				StoreOriginalLighting();
				RenderSettings.ambientMode = (AmbientMode)3;
				RenderSettings.ambientLight = Color.white;
				RenderSettings.ambientIntensity = 2.4f;
				RenderSettings.fog = false;
				EnsureMapLightObject();
				_nextLightsRefreshTime = Time.unscaledTime + 1f;
			}
		}

		private void UpdateRightClickLaser()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (!LaserOnRightClickEnabled || !IsSoloPlayer() || _adminMenuOpen || _commandWindowOpen || !NoTextInputActive() || !HotkeyInput.GetMouseButton(1))
			{
				DeactivateRightClickLaser();
				return;
			}
			Transform cameraTransform = GetCameraTransform(PlayerController.instance);
			if ((Object)(object)cameraTransform == (Object)null)
			{
				DeactivateRightClickLaser();
				return;
			}
			Vector3 val = cameraTransform.position + cameraTransform.forward * 0.35f;
			Vector3 end = val + cameraTransform.forward * 75f;
			RaycastHit hit = default(RaycastHit);
			bool flag = Physics.Raycast(val, cameraTransform.forward, ref hit, 75f, -5, (QueryTriggerInteraction)1);
			if (flag)
			{
				end = ((RaycastHit)(ref hit)).point;
			}
			if (EnsureRightClickLaserVisual())
			{
				DrawRightClickLaser(val, end, flag, hit);
			}
		}

		private void SetAdminMenuOpen(bool open)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if (_adminMenuOpen != open)
			{
				_adminMenuOpen = open;
				_bindingAction = null;
				((BaseUnityPlugin)this).Logger.LogInfo((object)("GodCommands admin menu " + (open ? "opened" : "closed") + "."));
				if (open)
				{
					_storedCursorVisible = Cursor.visible;
					_storedCursorLockMode = Cursor.lockState;
					Cursor.visible = true;
					Cursor.lockState = (CursorLockMode)0;
				}
				else
				{
					Cursor.visible = _storedCursorVisible;
					Cursor.lockState = _storedCursorLockMode;
				}
			}
		}

		private void SetCommandWindowOpen(bool open)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (_commandWindowOpen != open)
			{
				_commandWindowOpen = open;
				if (open)
				{
					_commandInput = "/";
					_commandWindowFocusRequested = true;
					_storedCommandCursorVisible = Cursor.visible;
					_storedCommandCursorLockMode = Cursor.lockState;
					Cursor.visible = true;
					Cursor.lockState = (CursorLockMode)0;
				}
				else
				{
					Cursor.visible = _storedCommandCursorVisible;
					Cursor.lockState = _storedCommandCursorLockMode;
				}
			}
		}

		private void DrawAdminMenuWindow(int windowId)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(500f, ((Rect)(ref _adminMenuRect)).width - 24f);
			float num2 = Mathf.Max(320f, ((Rect)(ref _adminMenuRect)).height - 58f);
			GUILayout.Space(8f);
			_adminMenuScroll = GUILayout.BeginScrollView(_adminMenuScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(num),
				GUILayout.Height(num2)
			});
			try
			{
				GUILayout.Label($"Menu key: {_adminMenuKey.Value}", Array.Empty<GUILayoutOption>());
				GUILayout.Space(6f);
				GUILayout.Label("Toggles", Array.Empty<GUILayoutOption>());
				DrawToggleAction(AdminAction.InfiniteEnergy, "Keep player energy full.");
				DrawToggleAction(AdminAction.Invisibility, "Hide from monsters and block detection.");
				DrawToggleAction(AdminAction.Invulnerable, "Prevent incoming player damage.");
				DrawToggleAction(AdminAction.KillClick, "Kill monsters when you click to grab them.");
				DrawToggleAction(AdminAction.LaserOnRightClick, "Hold right click to fire the wand-style laser.");
				DrawToggleAction(AdminAction.LightsOn, "Brighten the whole map so it is easy to see.");
				DrawToggleAction(AdminAction.Noclip, "Fly through walls. Movement follows your camera and keeps map facing correct.");
				DrawToggleAction(AdminAction.ShowMonsters, "Show living monsters on the map as red dots.");
				DrawToggleAction(AdminAction.ShowRespawnTimers, "Show monster respawn countdowns on the HUD.");
				DrawToggleAction(AdminAction.DisableSpawning, "Prevent monsters from spawning.");
				DrawToggleAction(AdminAction.IndestructibleLoot, "Keep loot from breaking.");
				DrawToggleAction(AdminAction.UnlimitedGearEnergy, "Keep weapon and gear batteries full.");
				DrawLaserSettings();
				GUILayout.Space(10f);
				GUILayout.Label("Buttons", Array.Empty<GUILayoutOption>());
				DrawButtonAction(AdminAction.KillNearest, "Kill the closest monster.");
				DrawButtonAction(AdminAction.KillRoom, "Kill monsters in your room.");
				DrawButtonAction(AdminAction.KillAll, "Kill every living monster.");
				DrawButtonAction(AdminAction.ExtractAll, "Condense map loot at the active extractor.");
				DrawButtonAction(AdminAction.TeleportToExtractor, "Teleport to the active extractor or nearest unactivated extractor.");
				DrawButtonAction(AdminAction.TeleportToTruck, "Teleport to the truck safety point.");
				DrawMoneySection();
				GUILayout.Space(10f);
				DrawSummonSection();
				GUILayout.Space(10f);
				if (_bindingAction.HasValue)
				{
					GUILayout.Label("Press a key for " + GetActionLabel(_bindingAction.Value) + ". Escape cancels.", Array.Empty<GUILayoutOption>());
				}
				else
				{
					GUILayout.Label("Bind buttons assign optional hotkeys. Clear removes a hotkey.", Array.Empty<GUILayoutOption>());
				}
			}
			catch (Exception arg)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)$"GodCommands admin menu draw failed: {arg}");
				GUILayout.Label("GodCommands menu hit an error. Check LogOutput.log.", Array.Empty<GUILayoutOption>());
			}
			finally
			{
				GUILayout.EndScrollView();
			}
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _adminMenuRect)).width, 24f));
		}

		private void DrawToggleAction(AdminAction action, string description)
		{
			bool flag = IsActionActive(action);
			GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(GetActionLabel(action) + ": " + (flag ? "true" : "false"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(430f) });
			if (GUILayout.Button(flag ? "Disable" : "Enable", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(96f) }))
			{
				PublishStatus(ExecuteAction(action));
			}
			DrawBindControls(action);
			GUILayout.EndHorizontal();
			GUILayout.Label(description, Array.Empty<GUILayoutOption>());
			GUILayout.EndVertical();
		}

		private void DrawButtonAction(AdminAction action, string description)
		{
			GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button(GetActionLabel(action), (GUILayoutOption[])(object)new GUILayoutOption[3]
			{
				GUILayout.MinWidth(430f),
				GUILayout.Height(28f),
				GUILayout.ExpandWidth(true)
			}))
			{
				PublishStatus(ExecuteAction(action));
			}
			DrawBindControls(action);
			GUILayout.EndHorizontal();
			GUILayout.Label(description, Array.Empty<GUILayoutOption>());
			GUILayout.EndVertical();
		}

		private void DrawMoneySection()
		{
			GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Money Amount ($)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
			_giveMoneyText = GUILayout.TextField(_giveMoneyText, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.MinWidth(180f),
				GUILayout.ExpandWidth(true)
			});
			if (GUILayout.Button("Give Money", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(120f),
				GUILayout.Height(28f)
			}))
			{
				PublishStatus(GiveMoneyCommand(new string[1] { _giveMoneyText }));
			}
			DrawBindControls(AdminAction.GiveMoney);
			GUILayout.EndHorizontal();
			GUILayout.Label("Enter normal dollars; GodCommands converts it to R.E.P.O.'s K currency units.", Array.Empty<GUILayoutOption>());
			GUILayout.EndVertical();
		}

		private void DrawLaserSettings()
		{
			GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Laser Damage", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
			_laserDamageText = GUILayout.TextField(_laserDamageText, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			if (GUILayout.Button("Apply", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(96f),
				GUILayout.Height(28f)
			}))
			{
				int laserDamageFromText = GetLaserDamageFromText(updateConfig: true);
				_laserDamageText = laserDamageFromText.ToString();
				PublishStatus($"laser damage set to {laserDamageFromText}");
			}
			GUILayout.EndHorizontal();
			GUILayout.Label("Default is 100, matching the clown laser hit damage.", Array.Empty<GUILayoutOption>());
			GUILayout.EndVertical();
		}

		private int GetLaserDamageFromText(bool updateConfig)
		{
			int num = ((_laserDamage != null) ? _laserDamage.Value : 100);
			if (int.TryParse((_laserDamageText ?? string.Empty).Replace(",", string.Empty).Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
			{
				num = result;
			}
			num = Mathf.Clamp(num, 1, 999999);
			if (updateConfig && _laserDamage != null)
			{
				_laserDamage.Value = num;
			}
			return num;
		}

		private void DrawSummonSection()
		{
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			TryRefreshSummonCatalog();
			GUILayout.Label("Summon Item", Array.Empty<GUILayoutOption>());
			GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Search", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(72f) });
			_summonSearch = GUILayout.TextField(_summonSearch, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.MinWidth(360f),
				GUILayout.ExpandWidth(true)
			});
			GUILayout.Label("Amount", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) });
			_summonAmountText = GUILayout.TextField(_summonAmountText, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) });
			if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
			{
				SetSummonAmount(GetSummonAmount() - 1);
			}
			if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }))
			{
				SetSummonAmount(GetSummonAmount() + 1);
			}
			if (GUILayout.Button("Refresh", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(82f) }))
			{
				TryRefreshSummonCatalog(force: true);
			}
			GUILayout.EndHorizontal();
			List<SummonableItem> list = GetSummonMatches(_summonSearch).Take(8).ToList();
			_summonSuggestionsScroll = GUILayout.BeginScrollView(_summonSuggestionsScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(140f) });
			if (list.Count == 0)
			{
				GUILayout.Label((_summonables.Count == 0) ? "No summonable items found yet." : "No matching items.", Array.Empty<GUILayoutOption>());
			}
			else
			{
				foreach (SummonableItem item in list)
				{
					if (GUILayout.Button(item.DisplayName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
					{
						_summonSearch = item.DisplayName;
					}
				}
			}
			GUILayout.EndScrollView();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Summon Selected", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(430f),
				GUILayout.Height(30f)
			}))
			{
				PublishStatus(SummonSelectedItem());
			}
			DrawBindControls(AdminAction.SummonItem);
			GUILayout.EndHorizontal();
			GUILayout.Label($"{_summonables.Count} summonable items indexed. Type to filter, click a result to autofill.", Array.Empty<GUILayoutOption>());
			GUILayout.Label(_summonCatalogStatus, Array.Empty<GUILayoutOption>());
			GUILayout.EndVertical();
		}

		private void DrawBindControls(AdminAction action)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			KeyCode value = _actionKeys[action].Value;
			if (GUILayout.Button((_bindingAction == action) ? "..." : (((int)value == 0) ? "Bind" : $"[{value}]"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(82f) }))
			{
				_bindingAction = action;
				PublishStatus("press a key for " + GetActionLabel(action));
			}
			if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(62f) }))
			{
				_actionKeys[action].Value = (KeyCode)0;
				if (_bindingAction == action)
				{
					_bindingAction = null;
				}
				PublishStatus(GetActionLabel(action) + " keybind cleared");
			}
		}

		private void DrawKeyboundStatus()
		{
			//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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_00f7: Expected O, but got Unknown
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			if (!IsSoloPlayer())
			{
				return;
			}
			List<string> list = new List<string>();
			AdminAction[] array = new AdminAction[20]
			{
				AdminAction.InfiniteEnergy,
				AdminAction.Invisibility,
				AdminAction.Invulnerable,
				AdminAction.KillClick,
				AdminAction.LaserOnRightClick,
				AdminAction.LightsOn,
				AdminAction.Noclip,
				AdminAction.ShowMonsters,
				AdminAction.ShowRespawnTimers,
				AdminAction.DisableSpawning,
				AdminAction.IndestructibleLoot,
				AdminAction.UnlimitedGearEnergy,
				AdminAction.GiveMoney,
				AdminAction.KillNearest,
				AdminAction.KillRoom,
				AdminAction.KillAll,
				AdminAction.ExtractAll,
				AdminAction.TeleportToExtractor,
				AdminAction.TeleportToTruck,
				AdminAction.SummonItem
			};
			foreach (AdminAction adminAction in array)
			{
				ConfigEntry<KeyCode> value;
				KeyCode val = (KeyCode)((_actionKeys != null && _actionKeys.TryGetValue(adminAction, out value)) ? ((int)value.Value) : 0);
				if ((int)val != 0)
				{
					string arg = ((!IsToggleAction(adminAction)) ? "READY" : (IsActionActive(adminAction) ? "ENABLED" : "DISABLED"));
					list.Add($"{GetActionLabel(adminAction)}: {arg}   [{val}]");
				}
			}
			if (list.Count != 0)
			{
				GUIStyle val2 = new GUIStyle(GUI.skin.box)
				{
					alignment = (TextAnchor)4,
					fontSize = 16,
					fontStyle = (FontStyle)1,
					richText = true,
					padding = new RectOffset(12, 12, 6, 6)
				};
				val2.normal.textColor = Color.white;
				float num = 300f;
				float num2 = 34f;
				float num3 = Mathf.Max(12f, (float)Screen.width - num - 16f);
				float num4 = Mathf.Max(12f, (float)Screen.height - num2 * (float)list.Count - 16f);
				Color backgroundColor = GUI.backgroundColor;
				for (int j = 0; j < list.Count; j++)
				{
					Rect val3 = new Rect(num3, num4 + (float)j * num2, num, 30f);
					GUI.backgroundColor = (list[j].Contains("ENABLED", StringComparison.Ordinal) ? new Color(0.2f, 0.7f, 0.2f, 0.85f) : (list[j].Contains("READY", StringComparison.Ordinal) ? new Color(0.2f, 0.32f, 0.7f, 0.85f) : new Color(0.7f, 0.2f, 0.2f, 0.85f)));
					GUI.Box(val3, list[j], val2);
				}
				GUI.backgroundColor = backgroundColor;
			}
		}

		private void DrawRespawnTimersHud()
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_012b: Expected O, but got Unknown
			//IL_0146: 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)
			if (!ShowRespawnTimersEnabled || !IsSoloPlayer())
			{
				return;
			}
			if (Time.unscaledTime >= _nextRespawnHudRefreshTime)
			{
				_respawnTimerHudLines.Clear();
				_respawnTimerHudLines.AddRange(GetRespawnTimerLines().Take(10));
				_nextRespawnHudRefreshTime = Time.unscaledTime + 0.25f;
			}
			if (_respawnTimerHudLines.Count != 0)
			{
				float num = 260f;
				float num2 = 24f;
				float num3 = 10f + num2 * (float)_respawnTimerHudLines.Count;
				float num4 = 18f;
				float num5 = Mathf.Clamp((float)Screen.height * 0.34f, 96f, Mathf.Max(96f, (float)Screen.height - num3 - 20f));
				Rect val = new Rect(num4, num5, num, num3);
				Color color = GUI.color;
				GUI.color = new Color(0f, 0f, 0f, 0.62f);
				GUI.Box(val, GUIContent.none);
				GUI.color = color;
				GUIStyle val2 = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)3,
					fontSize = 15,
					fontStyle = (FontStyle)1,
					padding = new RectOffset(10, 8, 0, 0)
				};
				val2.normal.textColor = new Color(1f, 0.72f, 0.68f, 1f);
				for (int i = 0; i < _respawnTimerHudLines.Count; i++)
				{
					GUI.Label(new Rect(num4, num5 + 5f + num2 * (float)i, num, num2), _respawnTimerHudLines[i], val2);
				}
			}
		}

		[IteratorStateMachine(typeof(<GetRespawnTimerLines>d__158))]
		private static IEnumerable<string> GetRespawnTimerLines()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetRespawnTimerLines>d__158(-2);
		}

		private void TryRegisterCommands()
		{
			DebugCommandHandler instance = DebugCommandHandler.instance;
			if ((Object)(object)instance == (Object)null || instance == _registeredHandler)
			{
				return;
			}
			Register(instance, "kill", "Kills the nearest monster.", delegate
			{
				PublishCommandResult(RunSolo(KillNearestMonster));
			});
			Register(instance, "killroom", "Kills all monsters in your current room.", delegate
			{
				PublishCommandResult(RunSolo(KillMonstersInCurrentRoom));
			});
			Register(instance, "killall", "Kills all living monsters.", delegate
			{
				PublishCommandResult(RunSolo(KillAllMonsters));
			});
			Register(instance, "killclick", "Toggles click-to-kill for monsters.", delegate
			{
				PublishCommandResult(RunSolo(ToggleKillClick));
			});
			Register(instance, "infiniteenergy", "Toggles infinite player energy.", delegate
			{
				PublishCommandResult(RunSolo(ToggleInfiniteEnergy));
			});
			Register(instance, "invis", "Toggles invisibility and monster undetectability.", delegate
			{
				PublishCommandResult(RunSolo(ToggleInvisibility));
			});
			Register(instance, "invulnerable", "Toggles player invulnerability.", delegate
			{
				PublishCommandResult(RunSolo(ToggleInvulnerable));
			});
			Register(instance, "noclip", "Toggles noclip flight.", delegate
			{
				PublishCommandResult(RunSolo(ToggleNoclip));
			});
			Register(instance, "showmonsters", "Toggles monster map markers.", delegate
			{
				PublishCommandResult(RunSolo(ToggleShowMonsters));
			});
			Register(instance, "showrespawntimer", "Toggles monster respawn timers.", delegate
			{
				PublishCommandResult(RunSolo(ToggleShowRespawnTimers));
			});
			Register(instance, "showrespawntimers", "Alias for /showrespawntimer.", delegate
			{
				PublishCommandResult(RunSolo(ToggleShowRespawnTimers));
			});
			Register(instance, "unlimitedenergy", "Toggles unlimited weapon and gear energy.", delegate
			{
				PublishCommandResult(RunSolo(ToggleUnlimitedGearEnergy));
			});
			Register(instance, "laseronrightclick", "Toggles right-click laser.", delegate
			{
				PublishCommandResult(RunSolo(ToggleLaserOnRightClick));
			});
			Register(instance, "lightson", "Toggles bright map lighting.", delegate
			{
				PublishCommandResult(RunSolo(ToggleLightsOn));
			});
			Register(instance, "spawning", "Toggles monster spawning.", delegate
			{
				PublishCommandResult(RunSolo(ToggleSpawning));
			});
			Register(instance, "indestructableloot", "Makes loot indestructable.", delegate
			{
				PublishCommandResult(RunSolo(EnableIndestructibleLoot));
			});
			Register(instance, "indestructibleloot", "Alias for /indestructableloot.", delegate
			{
				PublishCommandResult(RunSolo(EnableIndestructibleLoot));
			});
			Register(instance, "extractall", "Condenses all map loot value into one moneybag at the active extractor.", delegate
			{
				PublishCommandResult(RunSolo(ExtractAllLoot));
			});
			Register(instance, "tptoextractor", "Teleports to the active or nearest unactivated extractor.", delegate
			{
				PublishCommandResult(RunSolo(TeleportToExtractor));
			});
			Register(instance, "tptotruck", "Teleports to the truck.", delegate
			{
				PublishCommandResult(RunSolo(TeleportToTruck));
			});
			Register(instance, "summonitem", "Summons an item by name. Usage: /summonitem [item name] [amount]", delegate(bool _, string[] args)
			{
				string[] args3 = args;
				PublishCommandResult(RunSolo(() => SummonItemCommand(args3)));
			});
			Register(instance, "givemoney", "Adds money. Usage: /givemoney [dollar amount]", delegate(bool _, string[] args)
			{
				string[] args2 = args;
				PublishCommandResult(RunSolo(() => GiveMoneyCommand(args2)));
			});
			_registeredHandler = instance;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"GodCommands chat commands registered.");
		}

		private static void Register(DebugCommandHandler handler, string name, string description, Action<bool, string[]> execute)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			handler.Register(new ChatCommand(name, description, execute, (Func<bool, string, string[], List<string>>)null, (Func<bool>)(() => true), false));
		}

		private void PublishCommandResult(string message)
		{
			PublishStatus(message);
			ChatManager instance = ChatManager.instance;
			if ((Object)(object)instance != (Object)null)
			{
				GameFields.Set(GameFields.ChatMessage, instance, message);
			}
		}

		internal void PublishStatus(string message)
		{
			_statusMessage = message;
			_statusMessageUntil = Time.unscaledTime + 4f;
			((BaseUnityPlugin)this).Logger.LogInfo((object)message);
		}

		private static string RunSolo(Func<string> action)
		{
			if (!IsSoloPlayer())
			{
				return "GodCommands only works in SoloPlayer.";
			}
			return action();
		}

		private string ExecuteLocalCommand(string input)
		{
			string text = input.Trim();
			if (text.StartsWith("/", StringComparison.Ordinal))
			{
				string text2 = text;
				text = text2.Substring(1, text2.Length - 1).TrimStart();
			}
			if (string.IsNullOrWhiteSpace(text))
			{
				return "enter a command";
			}
			string[] array = text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
			string text3 = array[0].ToLowerInvariant();
			string[] args = array.Skip(1).ToArray();
			switch (text3)
			{
			case "kill":
				return RunSolo(KillNearestMonster);
			case "killroom":
				return RunSolo(KillMonstersInCurrentRoom);
			case "killall":
				return RunSolo(KillAllMonsters);
			case "killclick":
				return RunSolo(ToggleKillClick);
			case "infiniteenergy":
				return RunSolo(ToggleInfiniteEnergy);
			case "invis":
				return RunSolo(ToggleInvisibility);
			case "invulnerable":
				return RunSolo(ToggleInvulnerable);
			case "noclip":
				return RunSolo(ToggleNoclip);
			case "showmonsters":
				return RunSolo(ToggleShowMonsters);
			case "showrespawntimers":
			case "showrespawntimer":
				return RunSolo(ToggleShowRespawnTimers);
			case "unlimitedenergy":
				return RunSolo(ToggleUnlimitedGearEnergy);
			case "laseronrightclick":
				return RunSolo(ToggleLaserOnRightClick);
			case "lightson":
				return RunSolo(ToggleLightsOn);
			case "spawning":
				return RunSolo(ToggleSpawning);
			case "indestructableloot":
			case "indestructibleloot":
				return RunSolo(EnableIndestructibleLoot);
			case "extractall":
				return RunSolo(ExtractAllLoot);
			case "tptoextractor":
				return RunSolo(TeleportToExtractor);
			case "tptotruck":
				return RunSolo(TeleportToTruck);
			case "summonitem":
				return RunSolo(() => SummonItemCommand(args));
			case "givemoney":
				return RunSolo(() => GiveMoneyCommand(args));
			case "help":
			case "commands":
				return "commands shown in GodCommands window";
			default:
				return "unknown command /" + text3;
			}
		}

		private static string NormalizeCommandFilter(string input)
		{
			string text = input.Trim();
			if (text.StartsWith("/", StringComparison.Ordinal))
			{
				string text2 = text;
				text = text2.Substring(1, text2.Length - 1);
			}
			int num = text.IndexOf(' ');
			if (num < 0)
			{
				return text;
			}
			return text.Substring(0, num);
		}

		private string ExecuteAction(AdminAction action)
		{
			if (!IsSoloPlayer())
			{
				return "GodCommands only works in SoloPlayer.";
			}
			return action switch
			{
				AdminAction.InfiniteEnergy => ToggleInfiniteEnergy(), 
				AdminAction.Invisibility => ToggleInvisibility(), 
				AdminAction.Invulnerable => ToggleInvulnerable(), 
				AdminAction.KillClick => ToggleKillClick(), 
				AdminAction.LaserOnRightClick => ToggleLaserOnRightClick(), 
				AdminAction.LightsOn => ToggleLightsOn(), 
				AdminAction.Noclip => ToggleNoclip(), 
				AdminAction.ShowMonsters => ToggleShowMonsters(), 
				AdminAction.ShowRespawnTimers => ToggleShowRespawnTimers(), 
				AdminAction.DisableSpawning => ToggleSpawning(), 
				AdminAction.IndestructibleLoot => ToggleIndestructibleLoot(), 
				AdminAction.UnlimitedGearEnergy => ToggleUnlimitedGearEnergy(), 
				AdminAction.GiveMoney => GiveMoneyCommand(new string[1] { _giveMoneyText }), 
				AdminAction.KillNearest => KillNearestMonster(), 
				AdminAction.KillRoom => KillMonstersInCurrentRoom(), 
				AdminAction.KillAll => KillAllMonsters(), 
				AdminAction.ExtractAll => ExtractAllLoot(), 
				AdminAction.TeleportToExtractor => TeleportToExtractor(), 
				AdminAction.TeleportToTruck => TeleportToTruck(), 
				AdminAction.SummonItem => SummonSelectedItem(), 
				_ => "unknown admin action", 
			};
		}

		private bool IsActionActive(AdminAction action)
		{
			return action switch
			{
				AdminAction.InfiniteEnergy => InfiniteEnergyEnabled, 
				AdminAction.Invisibility => InvisibilityEnabled, 
				AdminAction.Invulnerable => InvulnerableEnabled, 
				AdminAction.KillClick => KillClickEnabled, 
				AdminAction.LaserOnRightClick => LaserOnRightClickEnabled, 
				AdminAction.LightsOn => LightsOnEnabled, 
				AdminAction.Noclip => NoclipEnabled, 
				AdminAction.ShowMonsters => ShowMonstersEnabled, 
				AdminAction.ShowRespawnTimers => ShowRespawnTimersEnabled, 
				AdminAction.DisableSpawning => SpawningDisabled, 
				AdminAction.IndestructibleLoot => _lootIndestructible, 
				AdminAction.UnlimitedGearEnergy => UnlimitedGearEnergyEnabled, 
				_ => false, 
			};
		}

		private static bool IsToggleAction(AdminAction action)
		{
			if ((uint)action <= 11u)
			{
				return true;
			}
			return false;
		}

		private static string GetActionLabel(AdminAction action)
		{
			return action switch
			{
				AdminAction.InfiniteEnergy => "Infinite Energy", 
				AdminAction.Invisibility => "Invisibility", 
				AdminAction.Invulnerable => "Invulnerable", 
				AdminAction.KillClick => "Kill Click", 
				AdminAction.LaserOnRightClick => "Right-Click Laser", 
				AdminAction.LightsOn => "Lights On", 
				AdminAction.Noclip => "Noclip", 
				AdminAction.ShowMonsters => "Show Monsters", 
				AdminAction.ShowRespawnTimers => "Respawn Timers", 
				AdminAction.DisableSpawning => "No Spawning", 
				AdminAction.IndestructibleLoot => "Indestructable Loot", 
				AdminAction.UnlimitedGearEnergy => "Unlimited Gear Energy", 
				AdminAction.GiveMoney => "Give Money", 
				AdminAction.KillNearest => "Kill Nearest", 
				AdminAction.KillRoom => "Kill Room", 
				AdminAction.KillAll => "Kill All", 
				AdminAction.ExtractAll => "Extract All", 
				AdminAction.TeleportToExtractor => "TP To Extractor", 
				AdminAction.TeleportToTruck => "TP To Truck", 
				AdminAction.SummonItem => "Summon Item", 
				_ => action.ToString(), 
			};
		}

		private string KillNearestMonster()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Vector3? playerPosition = GetPlayerPosition();
			if (!playerPosition.HasValue)
			{
				return "no local player found";
			}
			EnemyParent val = GetLiveEnemies().OrderBy(delegate(EnemyParent enemy)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val2 = GetEnemyPosition(enemy) - playerPosition.Value;
				return ((Vector3)(ref val2)).sqrMagnitude;
			}).FirstOrDefault();
			if ((Object)(object)val == (Object)null)
			{
				return "no monsters alive";
			}
			string text = DescribeEnemy(val);
			if (!KillEnemy(val, playerPosition.Value))
			{
				return "could not kill monster " + text;
			}
			return "killed monster " + text;
		}

		private string KillMonstersInCurrentRoom()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			List<RoomVolume> playerRooms = GetPlayerRooms();
			if (playerRooms.Count == 0)
			{
				return "no current room found";
			}
			List<string> list = new List<string>();
			Vector3 sourcePosition = (Vector3)(((??)GetPlayerPosition()) ?? Vector3.zero);
			foreach (EnemyParent liveEnemy in GetLiveEnemies())
			{
				TryRefreshEnemyRooms(liveEnemy);
				if (SharesRoom(liveEnemy, playerRooms))
				{
					string item = DescribeEnemy(liveEnemy);
					if (KillEnemy(liveEnemy, sourcePosition))
					{
						list.Add(item);
					}
				}
			}
			return FormatKilledMessage(list, "no monsters in this room");
		}

		private string KillAllMonsters()
		{
			//IL_001e: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = new List<string>();
			Vector3 sourcePosition = (Vector3)(((??)GetPlayerPosition()) ?? Vector3.zero);
			foreach (EnemyParent liveEnemy in GetLiveEnemies())
			{
				string item = DescribeEnemy(liveEnemy);
				if (KillEnemy(liveEnemy, sourcePosition))
				{
					list.Add(item);
				}
			}
			return FormatKilledMessage(list, "no monsters alive");
		}

		private string ToggleKillClick()
		{
			KillClickEnabled = !KillClickEnabled;
			if (!KillClickEnabled)
			{
				return "killclick disabled";
			}
			return "killclick enabled";
		}

		private string ToggleInfiniteEnergy()
		{
			InfiniteEnergyEnabled = !InfiniteEnergyEnabled;
			if (InfiniteEnergyEnabled)
			{
				ApplyInfiniteEnergy();
			}
			if (!InfiniteEnergyEnabled)
			{
				return "infinite energy disabled";
			}
			return "infinite energy enabled";
		}

		private string ToggleInvisibility()
		{
			InvisibilityEnabled = !InvisibilityEnabled;
			if (InvisibilityEnabled)
			{
				_nextInvisibilityRefreshTime = 0f;
				ApplyInvisibility();
			}
			else
			{
				RestoreInvisibilityRenderers();
			}
			if (!InvisibilityEnabled)
			{
				return "invis disabled";
			}
			return "invis enabled";
		}

		private string ToggleInvulnerable()
		{
			InvulnerableEnabled = !InvulnerableEnabled;
			if (InvulnerableEnabled)
			{
				ApplyInvulnerability();
			}
			else
			{
				ClearInvulnerability();
			}
			if (!InvulnerableEnabled)
			{
				return "invulnerable disabled";
			}
			return "invulnerable enabled";
		}

		private string ToggleUnlimitedGearEnergy()
		{
			UnlimitedGearEnergyEnabled = !UnlimitedGearEnergyEnabled;
			if (UnlimitedGearEnergyEnabled)
			{
				_nextGearEnergyRefreshTime = 0f;
				ApplyUnlimitedGearEnergy();
			}
			else
			{
				RestoreGearBatteryVisuals();
			}
			if (!UnlimitedGearEnergyEnabled)
			{
				return "unlimited energy disabled";
			}
			return "unlimited energy enabled";
		}

		private string ToggleNoclip()
		{
			NoclipEnabled = !NoclipEnabled;
			if (!NoclipEnabled)
			{
				RestoreNoclipPhysics();
			}
			if (!NoclipEnabled)
			{
				return "noclip disabled";
			}
			return "noclip enabled";
		}

		private string ToggleShowMonsters()
		{
			ShowMonstersEnabled = !ShowMonstersEnabled;
			if (ShowMonstersEnabled)
			{
				_nextMonsterMapRefreshTime = 0f;
				ApplyMonsterMapMarkers();
			}
			else
			{
				HideMonsterMapMarkers();
			}
			if (!ShowMonstersEnabled)
			{
				return "show monsters disabled";
			}
			return "show monsters enabled";
		}

		private string ToggleShowRespawnTimers()
		{
			ShowRespawnTimersEnabled = !ShowRespawnTimersEnabled;
			if (!ShowRespawnTimersEnabled)
			{
				return "monster respawn timers disabled";
			}
			return "monster respawn timers enabled";
		}

		private string ToggleLaserOnRightClick()
		{
			LaserOnRightClickEnabled = !LaserOnRightClickEnabled;
			if (!LaserOnRightClickEnabled)
			{
				DestroyRightClickLaser();
			}
			if (!LaserOnRightClickEnabled)
			{
				return "right-click laser disabled";
			}
			return "right-click laser enabled";
		}

		private string ToggleLightsOn()
		{
			LightsOnEnabled = !LightsOnEnabled;
			if (LightsOnEnabled)
			{
				_nextLightsRefreshTime = 0f;
				ApplyMapLights();
			}
			else
			{
				DisableMapLights();
			}
			if (!LightsOnEnabled)
			{
				return "lights on disabled";
			}
			return "lights on enabled";
		}

		private string ToggleSpawning()
		{
			SpawningDisabled = !SpawningDisabled;
			if (!SpawningDisabled)
			{
				return "monster spawning enabled";
			}
			return "monster spawning disabled";
		}

		private string EnableIndestructibleLoot()
		{
			_lootIndestructible = true;
			int num = ApplyIndestructibleToLoot();
			_nextLootRefreshTime = Time.unscaledTime + 1f;
			if (num != 1)
			{
				return $"indestructable loot enabled for {num} loot items";
			}
			return "indestructable loot enabled for 1 loot item";
		}

		private string ToggleIndestructibleLoot()
		{
			if (_lootIndestructible)
			{
				_lootIndestructible = false;
				int num = ClearIndestructibleLoot();
				if (num != 1)
				{
					return $"indestructable loot disabled for {num} loot items";
				}
				return "indestructable loot disabled for 1 loot item";
			}
			return EnableIndestructibleLoot();
		}

		private string ExtractAllLoot()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: 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_01cd: Unknown result type (might be due to invalid IL or missing references)
			ExtractionPoint activeExtractionPoint = GetActiveExtractionPoint();
			if ((Object)(object)activeExtractionPoint == (Object)null)
			{
				return "activate an extractor";
			}
			Vector3 extractionDropPosition = GetExtractionDropPosition(activeExtractionPoint);
			HashSet<int> hashSet = new HashSet<int>();
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			ValuableObject[] array = Object.FindObjectsOfType<ValuableObject>();
			foreach (ValuableObject val in array)
			{
				if (IsActiveComponent((Component)(object)val))
				{
					PhysGrabObject val2 = GameFields.Get<PhysGrabObject>(GameFields.ValuablePhysGrabObject, val);
					if ((Object)(object)val2 == (Object)null)
					{
						val2 = ((Component)val).GetComponent<PhysGrabObject>();
					}
					if ((Object)(object)val2 != (Object)null)
					{
						hashSet.Add(((Object)val2).GetInstanceID());
					}
					int valuableValue = GetValuableValue(val);
					if (valuableValue <= 0)
					{
						MoveToExtractor(((Component)val).transform, extractionDropPosition, num3++);
						continue;
					}
					num += valuableValue;
					DestroyLootObject(((Component)val).gameObject, val2);
					num2++;
				}
			}
			ItemValuableBox[] array2 = Object.FindObjectsOfType<ItemValuableBox>();
			foreach (ItemValuableBox val3 in array2)
			{
				if (!IsActiveComponent((Component)(object)val3))
				{
					continue;
				}
				PhysGrabObject component = ((Component)val3).GetComponent<PhysGrabObject>();
				if (!((Object)(object)component != (Object)null) || hashSet.Add(((Object)component).GetInstanceID()))
				{
					int num4 = Mathf.RoundToInt(Mathf.Max(val3.ExtractionValue, val3.CurrentValue));
					if (num4 > 0)
					{
						num += num4;
						DestroyLootObject(((Component)val3).gameObject, component);
						num2++;
					}
					else
					{
						MoveToExtractor(((Component)val3).transform, extractionDropPosition, num3++);
					}
				}
			}
			CosmeticWorldObject[] array3 = Object.FindObjectsOfType<CosmeticWorldObject>();
			foreach (CosmeticWorldObject val4 in array3)
			{
				if (IsActiveComponent((Component)(object)val4))
				{
					PhysGrabObject val5 = GameFields.Get<PhysGrabObject>(GameFields.CosmeticPhysGrabObject, val4);
					if ((Object)(object)val5 == (Object)null)
					{
						val5 = ((Component)val4).GetComponent<PhysGrabObject>();
					}
					if (!((Object)(object)val5 != (Object)null) || hashSet.Add(((Object)val5).GetInstanceID()))
					{
						MoveToExtractor(((Component)val4).transform, extractionDropPosition, num3++);
					}
				}
			}
			bool num5 = num > 0 && SpawnMoneybag(num, activeExtractionPoint, extractionDropPosition);
			if (_lootIndestructible)
			{
				ApplyIndestructibleToLoot();
			}
			string text = ((num > 0) ? ("$" + SemiFunc.DollarGetString(num)) : "$0");
			if (!num5 && num > 0)
			{
				return $"could not spawn moneybag for {text}; moved {num3} special items";
			}
			return $"extracted {num2} loot items into one {text} moneybag; moved {num3} special items";
		}

		private string TeleportToExtractor()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			Vector3? playerPosition = GetPlayerPosition();
			if (!playerPosition.HasValue)
			{
				return "no local player found";
			}
			ExtractionPoint teleportExtractor = GetTeleportExtractor(playerPosition.Value);
			if ((Object)(object)teleportExtractor == (Object)null)
			{
				return "no extractor found";
			}
			TeleportLocalPlayer(GetExtractorTeleportPosition(teleportExtractor), Quaternion.Euler(0f, ((Component)teleportExtractor).transform.eulerAngles.y, 0f));
			return "teleported to extractor " + DescribeObject(((Component)teleportExtractor).gameO