Decompiled source of SpeedrunRoutingHelperMod v1.2.1

BepInEx/plugins/SRHM.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
using SRHM.Common;
using SRHM.Modules;
using UnityEngine;
using UnityEngine.AI;
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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 SRHM
{
	public enum AllItems : byte
	{
		None = byte.MaxValue,
		Flashlight = 0,
		Saw = 1,
		DoorKey = 2,
		GasCan = 3,
		CabinetKey = 4,
		VanTire = 5,
		RubiksCube = 6,
		Aminaking = 7,
		BowlingBall = 8,
		IDCard = 9,
		ThrowableBottle = 10,
		Airhorn = 11,
		Bounty = 12,
		Zorran = 13,
		Recorder = 14,
		Guitar = 15,
		Violin = 16,
		Accordion = 17,
		PlushieZorti = 18,
		JimmysKey = 19,
		MudurHeart = 20,
		BoxingGloves = 21,
		GrapplingHook = 22,
		Snowball = 23,
		Boomerang = 24,
		ZubbidiRaki = 25,
		WaterGun = 26,
		AminakuCrown = 27,
		ThrowableCheese = 28,
		ThrowableCupcake = 29,
		FlareGun = 30,
		FlareShell = 31,
		Plank = 32,
		Sword = 33,
		CellKeys = 34,
		Ak47 = 35
	}
	public struct DebugColliderInfo
	{
		public GameObject debugPrimitive;

		public Collider originalCollider;

		public Transform originalTransform;
	}
	public struct LocationOfInterest
	{
		public string Name;

		public Vector3 Coordinates;

		public LocationOfInterest(string name, Vector3 coords)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Name = name;
			Coordinates = coords;
		}
	}
	public static class WindowId
	{
		public const int Main = 0;

		public const int SlotDropdownBase = 1;

		public const int CollisionColor = 6;

		public const int KeypadCodes = 7;

		public const int MapLoader = 8;

		public const int Cheats = 9;

		public const int PlayerInfo = 10;

		public const int Snowball = 11;

		public const int Teleportation = 12;

		public const int CrosshairSettings = 13;

		public const int SrhmSettings = 14;

		public const int PlayerInfoSettings = 15;

		public const int EntityDropdown = 16;

		public const int EntityActionMenu = 17;

		public const int Notification = 18;

		public const int CollisionSubmenu = 19;

		public const int Movement = 20;
	}
	[BepInPlugin("mods.krwclassic.srhm", "Speedrun Routing Helper Mod (SRHM)", "1.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private Rect windowRect = new Rect(10f, 40f, 300f, 600f);

		private bool showUI;

		private string statusText;

		private CheatsModule _cheats;

		private TeleportModule _teleport;

		private InventoryModule _inventory;

		private CollisionVisualizer _collisionVisualizer;

		private CrosshairModule _crosshair;

		private KeypadModule _keypad;

		private SnowballModule _snowball;

		private MapLoaderModule _mapLoader;

		private PlayerInfoModule _playerInfo;

		private DebugOverlay _debugOverlay;

		private ZoomModule _zoom;

		private NotificationModule _notification;

		private MovementModule _movement;

		private void Awake()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Plugin Speedrun Routing Helper Mod (SRHM) is loaded!");
			statusText = "SRHM 1.2.1 by KRW CLASSIC";
			_cheats = new CheatsModule();
			_teleport = new TeleportModule();
			_inventory = new InventoryModule(windowRect);
			_collisionVisualizer = new CollisionVisualizer();
			_crosshair = new CrosshairModule();
			_keypad = new KeypadModule();
			_snowball = new SnowballModule();
			_mapLoader = new MapLoaderModule();
			_playerInfo = new PlayerInfoModule();
			_debugOverlay = new DebugOverlay();
			_zoom = new ZoomModule();
			_notification = new NotificationModule();
			_movement = new MovementModule();
			SceneManager.activeSceneChanged += OnActiveSceneChanged;
			UIResolutionManager.OnResolutionChanged += HandleResolutionChanged;
			UIResolutionManager.CheckResolution();
			if ((Object)(object)PlayerController.PlayerClient.Value != (Object)null)
			{
				_inventory.UpdateAvailableItems();
			}
			_collisionVisualizer.Initialize();
		}

		private void OnDestroy()
		{
			UIResolutionManager.OnResolutionChanged -= HandleResolutionChanged;
			SceneManager.activeSceneChanged -= OnActiveSceneChanged;
		}

		private void HandleResolutionChanged()
		{
			float screenWidth = UIResolutionManager.ScreenWidth;
			float screenHeight = UIResolutionManager.ScreenHeight;
			((Rect)(ref _cheats.SrhmSettingsWindowRect)).width = 260f;
			((Rect)(ref _cheats.SrhmSettingsWindowRect)).height = 95f;
			((Rect)(ref _cheats.SrhmSettingsWindowRect)).x = screenWidth - ((Rect)(ref _cheats.SrhmSettingsWindowRect)).width - 10f;
			((Rect)(ref _cheats.SrhmSettingsWindowRect)).y = screenHeight - ((Rect)(ref _cheats.SrhmSettingsWindowRect)).height - 10f;
			((Rect)(ref _teleport.TeleportationWindowRect)).x = screenWidth - ((Rect)(ref _teleport.TeleportationWindowRect)).width - 10f;
			((Rect)(ref _teleport.TeleportationWindowRect)).y = 10f;
			((Rect)(ref _keypad.KeypadWindowRect)).x = ((Rect)(ref _teleport.TeleportationWindowRect)).x - ((Rect)(ref _keypad.KeypadWindowRect)).width - 9f;
			((Rect)(ref _keypad.KeypadWindowRect)).y = 10f;
			((Rect)(ref _playerInfo.PlayerInfoWindowRect)).x = (screenWidth - ((Rect)(ref _playerInfo.PlayerInfoWindowRect)).width) / 2f;
			((Rect)(ref _playerInfo.PlayerInfoSettingsWindowRect)).width = 250f;
			((Rect)(ref _playerInfo.PlayerInfoSettingsWindowRect)).height = 245f;
			((Rect)(ref _playerInfo.PlayerInfoSettingsWindowRect)).x = ((Rect)(ref _playerInfo.PlayerInfoWindowRect)).x + ((Rect)(ref _playerInfo.PlayerInfoWindowRect)).width + 9f;
			((Rect)(ref _notification.WindowRect)).x = (screenWidth - ((Rect)(ref _notification.WindowRect)).width) / 2f;
			((Rect)(ref _notification.WindowRect)).y = screenHeight - ((Rect)(ref _notification.WindowRect)).height - 20f;
			UIResolutionManager.ClampWindow(ref windowRect);
			UIResolutionManager.ClampWindow(ref _teleport.TeleportationWindowRect);
			UIResolutionManager.ClampWindow(ref _keypad.KeypadWindowRect);
			UIResolutionManager.ClampWindow(ref _playerInfo.PlayerInfoWindowRect);
			UIResolutionManager.ClampWindow(ref _playerInfo.PlayerInfoSettingsWindowRect);
			UIResolutionManager.ClampWindow(ref _cheats.CheatsWindowRect);
			UIResolutionManager.ClampWindow(ref _cheats.SrhmSettingsWindowRect);
			UIResolutionManager.ClampWindow(ref _cheats.EntityDropdownRect);
			UIResolutionManager.ClampWindow(ref _cheats.EntityActionWindowRect);
			UIResolutionManager.ClampWindow(ref _snowball.SnowballWindowRect);
			UIResolutionManager.ClampWindow(ref _mapLoader.MapLoaderWindowRect);
			UIResolutionManager.ClampWindow(ref _crosshair.CrosshairSettingsWindowRect);
			UIResolutionManager.ClampWindow(ref _collisionVisualizer.ColorWindowRect);
			UIResolutionManager.ClampWindow(ref _collisionVisualizer.ColorSubmenuRect);
		}

		private void Update()
		{
			HandleToggleUIInput();
			_cheats.Update(showUI);
			_snowball.Update();
			_inventory.Update(showUI);
			_collisionVisualizer.Update();
			_debugOverlay.Update();
			_zoom.Update(showUI);
			_notification.Update();
			_movement.Update();
		}

		private void OnRenderObject()
		{
			_collisionVisualizer?.OnRenderObject();
		}

		private void HandleToggleUIInput()
		{
			//IL_001e: 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)
			if (!Input.GetKeyDown((KeyCode)303))
			{
				return;
			}
			Log.LogInfo((object)"RightShift key pressed.");
			if ((Object)(object)PlayerController.PlayerClient.Value != (Object)null)
			{
				Log.LogInfo((object)"PlayerController found. Toggling UI.");
				bool flag = (showUI = !showUI);
				Log.LogInfo((object)$"Main UI toggled: {flag}");
				if (flag)
				{
					_inventory.RequestRefresh();
					_collisionVisualizer.OnMainUIOpening();
					_mapLoader.OnMainUIOpening();
					_teleport.OnMainUIOpening();
					_cheats.OnMainUIOpening();
					_crosshair.OnMainUIOpening();
					_playerInfo.OnMainUIOpening();
				}
				else
				{
					_collisionVisualizer.OnMainUIClosing();
					_mapLoader.OnMainUIClosing();
					_snowball.OnMainUIClosing(_snowball.HasSnowball);
					_teleport.OnMainUIClosing();
					_cheats.OnMainUIClosing();
					_crosshair.OnMainUIClosing();
					_playerInfo.OnMainUIClosing();
					_inventory.CloseAllDropdowns();
				}
			}
			else
			{
				Log.LogWarning((object)"PlayerController not found when RightShift pressed. Cannot toggle Main UI.");
				Log.LogWarning((object)"Player not found, cannot toggle Main UI.");
			}
		}

		private void OnActiveSceneChanged(Scene current, Scene next)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			Log.LogInfo((object)("Scene changed from " + ((Scene)(ref current)).name + " to " + ((Scene)(ref next)).name));
			_snowball.OnSceneChanged();
			_keypad.FindKeypadCombo(((Scene)(ref next)).name);
			_teleport.OnSceneChanged(((Scene)(ref next)).name);
			if ((Object)(object)PlayerController.PlayerClient.Value != (Object)null)
			{
				_inventory.UpdateAvailableItems();
			}
		}

		private void OnGUI()
		{
			//IL_001d: 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_006b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Expected O, but got Unknown
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Expected O, but got Unknown
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Expected O, but got Unknown
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//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_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			//IL_0175: 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_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Expected O, but got Unknown
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Expected O, but got Unknown
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Expected O, but got Unknown
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Expected O, but got Unknown
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Expected O, but got Unknown
			//IL_054b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Expected O, but got Unknown
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Expected O, but got Unknown
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0609: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			//IL_0682: Unknown result type (might be due to invalid IL or missing references)
			//IL_0698: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			if (_crosshair.ShowCrosshair)
			{
				_crosshair.DrawCrosshair();
			}
			UIResolutionManager.CheckResolution();
			Matrix4x4 matrix = GUI.matrix;
			if (UIResolutionManager.Scale != 1f)
			{
				GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(UIResolutionManager.Scale, UIResolutionManager.Scale, 1f));
			}
			GUILayout.BeginArea(new Rect(10f, 10f, 300f, 30f));
			GUILayout.Label(statusText, Array.Empty<GUILayoutOption>());
			GUILayout.EndArea();
			if (showUI)
			{
				windowRect = GUILayout.Window(0, windowRect, new WindowFunction(ModWindow), "Speedrun Routing Helper Mod", Array.Empty<GUILayoutOption>());
				for (int i = 0; i < _inventory.SelectedItems.Length; i++)
				{
					int slotIndexCopy = i;
					if (_inventory.DropdownOpen[i])
					{
						_inventory.DropdownRects[i] = GUILayout.Window(1 + i, _inventory.DropdownRects[i], (WindowFunction)delegate(int id)
						{
							_inventory.DrawDropdownWindow(id, slotIndexCopy);
						}, "Select Item", Array.Empty<GUILayoutOption>());
					}
				}
				if (_collisionVisualizer.ColorWindowOpen)
				{
					_collisionVisualizer.ColorWindowRect = GUILayout.Window(6, _collisionVisualizer.ColorWindowRect, new WindowFunction(_collisionVisualizer.DrawColorWindow), "Collision Settings", Array.Empty<GUILayoutOption>());
					if (_collisionVisualizer.ShowColorSubmenu)
					{
						_collisionVisualizer.ColorSubmenuRect = GUILayout.Window(19, _collisionVisualizer.ColorSubmenuRect, new WindowFunction(_collisionVisualizer.DrawColorSubmenuWindow), _collisionVisualizer.GetSelectedCategoryName() + " Color", Array.Empty<GUILayoutOption>());
					}
				}
				_cheats.SrhmSettingsWindowRect = GUILayout.Window(14, _cheats.SrhmSettingsWindowRect, new WindowFunction(_cheats.DrawSrhmSettingsWindow), "SRHM Settings", Array.Empty<GUILayoutOption>());
			}
			if (_keypad.ShowKeypadWindow)
			{
				_keypad.KeypadWindowRect = GUILayout.Window(7, _keypad.KeypadWindowRect, new WindowFunction(_keypad.DrawKeypadWindow), "Keypad Codes", Array.Empty<GUILayoutOption>());
			}
			if (_mapLoader.ShowMapLoaderWindow)
			{
				_mapLoader.MapLoaderWindowRect = GUILayout.Window(8, _mapLoader.MapLoaderWindowRect, new WindowFunction(_mapLoader.DrawMapLoaderWindow), "Map Loader", Array.Empty<GUILayoutOption>());
			}
			if (_cheats.ShowCheatsWindow)
			{
				_cheats.CheatsWindowRect = GUILayout.Window(9, _cheats.CheatsWindowRect, new WindowFunction(_cheats.DrawCheatsWindow), "Cheats", Array.Empty<GUILayoutOption>());
				if (_cheats.EntityDropdownOpen)
				{
					_cheats.EntityDropdownRect = GUILayout.Window(16, _cheats.EntityDropdownRect, new WindowFunction(_cheats.DrawEntityDropdownWindow), "Select Entity", Array.Empty<GUILayoutOption>());
				}
				if (_cheats.ShowEntityActionWindow && _cheats.ActionMenuEntity != null)
				{
					_cheats.EntityActionWindowRect = GUILayout.Window(17, _cheats.EntityActionWindowRect, new WindowFunction(_cheats.DrawEntityActionWindow), "Entity Actions", Array.Empty<GUILayoutOption>());
				}
			}
			if (_playerInfo.ShowPlayerInfoWindow)
			{
				_playerInfo.PlayerInfoWindowRect = GUILayout.Window(10, _playerInfo.PlayerInfoWindowRect, new WindowFunction(_playerInfo.DrawMainWindow), "Player Info", Array.Empty<GUILayoutOption>());
			}
			if (_playerInfo.ShowPlayerInfoSettingsWindow)
			{
				_playerInfo.PlayerInfoSettingsWindowRect = GUILayout.Window(15, _playerInfo.PlayerInfoSettingsWindowRect, new WindowFunction(_playerInfo.DrawSettingsWindow), "Player Info Settings", Array.Empty<GUILayoutOption>());
			}
			if (showUI && _snowball.HasSnowball)
			{
				if (((Rect)(ref _snowball.SnowballWindowRect)).x == 10f && ((Rect)(ref _snowball.SnowballWindowRect)).y < ((Rect)(ref windowRect)).yMax + 5f)
				{
					float num = ((Rect)(ref windowRect)).yMax + 9f;
					if (num + ((Rect)(ref _snowball.SnowballWindowRect)).height > UIResolutionManager.ScreenHeight - 10f)
					{
						((Rect)(ref _snowball.SnowballWindowRect)).x = ((Rect)(ref windowRect)).xMax + 9f;
						((Rect)(ref _snowball.SnowballWindowRect)).y = ((Rect)(ref windowRect)).y;
					}
					else
					{
						((Rect)(ref _snowball.SnowballWindowRect)).y = num;
					}
				}
				_snowball.SnowballWindowRect = GUILayout.Window(11, _snowball.SnowballWindowRect, new WindowFunction(_snowball.DrawSnowballWindow), "Snowball Options", Array.Empty<GUILayoutOption>());
			}
			if (_teleport.ShowTeleportationWindow)
			{
				_teleport.TeleportationWindowRect = GUILayout.Window(12, _teleport.TeleportationWindowRect, new WindowFunction(_teleport.DrawWindow), "Teleportation Menu", Array.Empty<GUILayoutOption>());
			}
			if (_crosshair.ShowCrosshairSettingsWindow)
			{
				_crosshair.CrosshairSettingsWindowRect = GUILayout.Window(13, _crosshair.CrosshairSettingsWindowRect, new WindowFunction(_crosshair.DrawCrosshairSettingsWindow), "Crosshair Settings", Array.Empty<GUILayoutOption>());
			}
			if (_debugOverlay.DebugModeEnabled)
			{
				_debugOverlay.DrawWindowPositions(windowRect, _inventory.DropdownOpen, _inventory.DropdownRects, _collisionVisualizer.ColorWindowOpen, _collisionVisualizer.ColorWindowRect, _keypad.ShowKeypadWindow, _keypad.KeypadWindowRect, _mapLoader.ShowMapLoaderWindow, _mapLoader.MapLoaderWindowRect, _cheats.ShowCheatsWindow, _cheats.CheatsWindowRect, _playerInfo.ShowPlayerInfoWindow, _playerInfo.PlayerInfoWindowRect, _playerInfo.ShowPlayerInfoSettingsWindow, _playerInfo.PlayerInfoSettingsWindowRect, _cheats.EntityDropdownOpen, _cheats.EntityDropdownRect, showUI && _snowball.HasSnowball, _snowball.SnowballWindowRect, _teleport.ShowTeleportationWindow, _teleport.TeleportationWindowRect, _crosshair.ShowCrosshairSettingsWindow, _crosshair.CrosshairSettingsWindowRect, _collisionVisualizer.ShowColorSubmenu, _collisionVisualizer.ColorSubmenuRect);
			}
			_notification.DrawNotificationWindow();
			GUI.matrix = matrix;
		}

		private void ModWindow(int windowID)
		{
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			_inventory.DrawSlotButtons();
			_cheats.DrawTimescaleControls();
			GUILayout.Space(10f);
			_movement.DrawMainWindowControls();
			GUILayout.Space(10f);
			_keypad.ShowKeypadWindow = GUILayout.Toggle(_keypad.ShowKeypadWindow, "Show Keypad Codes", Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			_playerInfo.ShowPlayerInfoWindow = GUILayout.Toggle(_playerInfo.ShowPlayerInfoWindow, "Show Player Info", Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button(_playerInfo.ShowPlayerInfoSettingsWindow ? "Hide Settings" : "Show Settings", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
			{
				_playerInfo.ShowPlayerInfoSettingsWindow = !_playerInfo.ShowPlayerInfoSettingsWindow;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			_crosshair.ShowCrosshair = GUILayout.Toggle(_crosshair.ShowCrosshair, "Show Crosshair", Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button(_crosshair.ShowCrosshairSettingsWindow ? "Hide Settings" : "Show Settings", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
			{
				_crosshair.ShowCrosshairSettingsWindow = !_crosshair.ShowCrosshairSettingsWindow;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			bool flag = GUILayout.Toggle(_collisionVisualizer.ShowCollisions, "Show Colliders", Array.Empty<GUILayoutOption>());
			if (flag != _collisionVisualizer.ShowCollisions)
			{
				_collisionVisualizer.ShowCollisions = flag;
				_collisionVisualizer.SetCollisionVisualizationEnabled(flag);
			}
			GUILayout.FlexibleSpace();
			if (GUILayout.Button(_collisionVisualizer.ColorWindowOpen ? "Hide Settings" : "Show Settings", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
			{
				_collisionVisualizer.ColorWindowOpen = !_collisionVisualizer.ColorWindowOpen;
				if (!_collisionVisualizer.ColorWindowOpen)
				{
					_collisionVisualizer.ShowColorSubmenu = false;
				}
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			if (GUILayout.Button(_cheats.ShowCheatsWindow ? "Hide Cheats" : "Show Cheats", Array.Empty<GUILayoutOption>()))
			{
				_cheats.ShowCheatsWindow = !_cheats.ShowCheatsWindow;
			}
			GUILayout.Space(10f);
			if (GUILayout.Button(_mapLoader.ShowMapLoaderWindow ? "Hide Map Loader" : "Show Map Loader", Array.Empty<GUILayoutOption>()))
			{
				_mapLoader.ShowMapLoaderWindow = !_mapLoader.ShowMapLoaderWindow;
			}
			GUILayout.Space(10f);
			if (GUILayout.Button(_teleport.ShowTeleportationWindow ? "Hide Teleportation Menu" : "Show Teleportation Menu", Array.Empty<GUILayoutOption>()))
			{
				_teleport.ShowTeleportationWindow = !_teleport.ShowTeleportationWindow;
				if (_teleport.ShowTeleportationWindow)
				{
					_teleport.UpdateTeleportationWindowHeight();
				}
			}
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 10000f));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "mods.krwclassic.srhm";

		public const string PLUGIN_NAME = "Speedrun Routing Helper Mod (SRHM)";

		public const string PLUGIN_VERSION = "1.2.1";
	}
}
namespace SRHM.Modules
{
	public class KillableEntityEntry
	{
		public string DisplayName;

		public string ShortName;

		public float Distance;

		public IDamagable Damagable;

		public GameObject GameObject;
	}
	public class CheatsModule
	{
		public Rect CheatsWindowRect = new Rect(319f, 681f, 312f, 157f);

		public Rect SrhmSettingsWindowRect = new Rect(1650f, 975f, 260f, 95f);

		private static readonly FieldInfo InvincibleByBackroomsField = typeof(PlayerController).GetField("invincibleByBackrooms", BindingFlags.Instance | BindingFlags.NonPublic);

		private static readonly FieldInfo HealthField = typeof(PlayerController).GetField("health", BindingFlags.Instance | BindingFlags.NonPublic);

		private float _entityRefreshTimer;

		public List<KillableEntityEntry> FoundEntities = new List<KillableEntityEntry>();

		public int SelectedEntityIndex = -1;

		public bool EntityDropdownOpen;

		public Rect EntityDropdownRect = new Rect(640f, 681f, 380f, 300f);

		private Vector2 _entityScrollPosition = Vector2.zero;

		public Rect EntityActionWindowRect = new Rect(1029f, 681f, 170f, 115f);

		public KillableEntityEntry ActionMenuEntity;

		public bool FlyingEnabled { get; private set; }

		public float CurrentTimescale { get; private set; } = 1f;

		public string TimescaleInput { get; private set; } = "1.0";

		public bool LockCameraWhenOpen { get; set; } = true;

		public bool PausedByModMenu { get; private set; }

		public bool ShowCheatsWindow { get; set; }

		public bool CheatsWindowWasOpen { get; set; }

		public string ForcedFpsInput { get; set; } = "0";

		public bool GodModeEnabled { get; set; }

		public bool UseGloveBoost { get; set; }

		public float GlovePower { get; set; } = 25f;

		public string ForceVelocityInput { get; set; } = "20.0";

		public string TargetHpInput { get; set; } = "100";

		public string TargetSanityInput { get; set; } = "100";

		public bool ShowEntityActionWindow { get; set; }

		public void Update(bool showUI)
		{
			HandleFlyingInput();
			HandleGodModeInput();
			HandleVelocityBoostInput();
			UpdateModMenuPause(showUI);
			UpdateGodMode();
			if (EntityDropdownOpen)
			{
				_entityRefreshTimer += Time.deltaTime;
				if (_entityRefreshTimer >= 1f)
				{
					_entityRefreshTimer = 0f;
					RefreshEntities();
				}
			}
			else
			{
				_entityRefreshTimer = 0f;
			}
		}

		public void HandleFlyingInput()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown((KeyCode)118))
			{
				if ((Object)(object)PlayerController.PlayerClient.Value != (Object)null)
				{
					SetNoclipEnabled(!FlyingEnabled);
				}
				else
				{
					Plugin.Log.LogWarning((object)"Player not found, cannot toggle flying.");
				}
			}
		}

		public void HandleVelocityBoostInput()
		{
			if (Input.GetKeyDown((KeyCode)98))
			{
				if (UseGloveBoost)
				{
					ApplyGloveBoost();
				}
				else
				{
					ApplyVelocityBoost();
				}
			}
		}

		public void HandleGodModeInput()
		{
			if (Input.GetKeyDown((KeyCode)106))
			{
				SetGodModeEnabled(!GodModeEnabled);
			}
		}

		public void SetGodModeEnabled(bool enabled)
		{
			//IL_0007: 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)
			GodModeEnabled = enabled;
			PlayerController value = PlayerController.PlayerClient.Value;
			if ((Object)(object)value != (Object)null)
			{
				if (GodModeEnabled)
				{
					HealthField?.SetValue(value, 100);
					value.OnHealthChanged?.Invoke();
					if ((Object)(object)StaticInstance<InGameUI>.Instance != (Object)null)
					{
						StaticInstance<InGameUI>.Instance.SetHealth(100, false);
					}
					if ((Object)(object)value.Syncer != (Object)null)
					{
						value.Syncer.Sanity = 100f;
					}
					InvincibleByBackroomsField?.SetValue(value, true);
				}
				else
				{
					InvincibleByBackroomsField?.SetValue(value, false);
				}
			}
			NotificationModule.Show(GodModeEnabled ? "God Mode enabled" : "God Mode disabled");
		}

		private void UpdateGodMode()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (!GodModeEnabled)
			{
				return;
			}
			PlayerController value = PlayerController.PlayerClient.Value;
			if (!((Object)(object)value != (Object)null))
			{
				return;
			}
			if (value.Health < 100)
			{
				HealthField?.SetValue(value, 100);
				value.OnHealthChanged?.Invoke();
				if ((Object)(object)StaticInstance<InGameUI>.Instance != (Object)null)
				{
					StaticInstance<InGameUI>.Instance.SetHealth(100, false);
				}
			}
			if ((Object)(object)value.Syncer != (Object)null && value.Syncer.Sanity < 100f)
			{
				value.Syncer.Sanity = 100f;
			}
			InvincibleByBackroomsField?.SetValue(value, true);
		}

		public void SetNoclipEnabled(bool enabled)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			PlayerController value = PlayerController.PlayerClient.Value;
			if ((Object)(object)value != (Object)null)
			{
				FlyingEnabled = enabled;
				value.Data.noclip = FlyingEnabled;
				NotificationModule.Show(FlyingEnabled ? "Noclip enabled" : "Noclip disabled");
				Plugin.Log.LogInfo((object)$"Flying (noclip) toggled: {FlyingEnabled}");
			}
			else
			{
				Plugin.Log.LogWarning((object)"Player not found, cannot toggle flying.");
			}
		}

		public void ApplyVelocityBoost()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0076: 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)
			PlayerController value = PlayerController.PlayerClient.Value;
			if ((Object)(object)value != (Object)null)
			{
				if (ParseUtils.TryParseFloat(ForceVelocityInput, out var value2))
				{
					Vector3 cameraForward = value.CameraForward;
					Vector3 val = cameraForward * value2;
					PlayerMoveData data = value.Data;
					data.velocityXZ += new Vector3(val.x, 0f, val.z);
					PlayerMoveData data2 = value.Data;
					data2.velocityY += val.y;
					NotificationModule.Show($"Boosted velocity (+{value2:F1})");
					Plugin.Log.LogInfo((object)$"Applied velocity boost of {value2:F1} in look direction {cameraForward}.");
				}
				else
				{
					Plugin.Log.LogWarning((object)"Invalid velocity boost amount.");
				}
			}
			else
			{
				Plugin.Log.LogWarning((object)"Player not found, cannot apply velocity boost.");
			}
		}

		public void ApplyGloveBoost()
		{
			//IL_0007: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			PlayerController ply = PlayerController.PlayerClient.Value;
			if ((Object)(object)ply == (Object)null)
			{
				Plugin.Log.LogWarning((object)"Player not found, cannot apply glove boost.");
				return;
			}
			float realPower = Mathf.Clamp(GlovePower, 9f, 35f);
			Ray ray = ply.GetRay();
			Vector3 direction = ((Ray)(ref ray)).direction;
			ply.Data.forcedAcceleration = 0f;
			if ((int)ply.Data.swimState == 0)
			{
				ply.Data.velocityXZ = ply.Forward * realPower / 1.5f;
			}
			TryUtils.InvokeIn((MonoBehaviour)(object)ply, 0.1f, (Action)delegate
			{
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: 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_010a: 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_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: 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)
				if (!((Object)(object)ply == (Object)null))
				{
					if (ply.Data.isGrounded)
					{
						ply.Data.velocityY = Mathf.Sqrt(Physics.gravity.y * -2f * Mathf.Max(direction.y * 5f, ply.MoveConfig.jumpHeight) * ply.MoveConfig.gravityMultiplier);
						ply.Data.isGrounded = false;
						PlayerMoveData data = ply.Data;
						data.velocityXZ *= 0.2f;
					}
					else
					{
						PlayerMoveData data2 = ply.Data;
						Vector3 velocityXZ = data2.velocityXZ;
						Vector3 val = new Vector3(direction.x, 0f, direction.z);
						data2.velocityXZ = velocityXZ * ((Vector3)(ref val)).magnitude;
						ply.Data.velocityY = 0f - Mathf.Sqrt(Physics.gravity.y * 2f * Mathf.Min(direction.y * 24f, 0f) * ply.MoveConfig.gravityMultiplier);
					}
					CameraBasics.ShakeOnce(realPower / 100f);
				}
			});
			TryUtils.InvokeIn((MonoBehaviour)(object)ply, 0.5f, (Action)delegate
			{
				if ((Object)(object)ply != (Object)null)
				{
					ply.Data.forcedAcceleration = null;
				}
			});
			NotificationModule.Show($"Glove Boost fired (Power {realPower:F1})");
			Plugin.Log.LogInfo((object)$"Applied Glove Boost with power {realPower:F1}.");
		}

		public void SetHealth(int targetHealth)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			PlayerController value = PlayerController.PlayerClient.Value;
			if ((Object)(object)value != (Object)null)
			{
				targetHealth = Mathf.Clamp(targetHealth, 0, 100);
				typeof(PlayerController).GetField("health", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(value, targetHealth);
				value.OnHealthChanged?.Invoke();
				if ((Object)(object)StaticInstance<InGameUI>.Instance != (Object)null)
				{
					StaticInstance<InGameUI>.Instance.SetHealth(targetHealth, false);
				}
				if (NetworkServer.active)
				{
					typeof(PlayerController).GetMethod("HealRpc", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(value, new object[2] { targetHealth, false });
				}
				NotificationModule.Show($"Health set to {targetHealth}");
				Plugin.Log.LogInfo((object)$"Player health set to {targetHealth}");
			}
			else
			{
				Plugin.Log.LogWarning((object)"Player not found, cannot set health.");
			}
		}

		public void SetSanity(float targetSanity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			PlayerController value = PlayerController.PlayerClient.Value;
			if ((Object)(object)value != (Object)null && (Object)(object)value.Syncer != (Object)null)
			{
				targetSanity = Mathf.Clamp(targetSanity, 0f, 100f);
				if (NetworkServer.active)
				{
					value.Syncer.Sanity = targetSanity;
				}
				else
				{
					float num = targetSanity - value.Syncer.Sanity;
					if (num > 0f)
					{
						value.Syncer.IncreaseSanityPleaseCmd(num);
					}
					typeof(PlayerSync).GetField("_sanity", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(value.Syncer, targetSanity);
				}
				NotificationModule.Show($"Sanity set to {targetSanity:F1}");
				Plugin.Log.LogInfo((object)$"Player sanity set to {targetSanity:F1}");
			}
			else
			{
				Plugin.Log.LogWarning((object)"Player or Syncer not found, cannot set sanity.");
			}
		}

		public void KillSelf()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			PlayerController value = PlayerController.PlayerClient.Value;
			if ((Object)(object)value != (Object)null)
			{
				DamageContext val = new DamageContext
				{
					position = ((Component)value).transform.position,
					normal = Vector3.up,
					damage = 999999,
					damageType = (DamageType)4,
					deathType = (DeathType)3
				};
				if (NetworkServer.active)
				{
					value.TakeDamageOnServer(ref val);
				}
				else
				{
					value.TakeDamagePleaseCmd(val);
				}
				NotificationModule.Show("Killed yourself!");
				Plugin.Log.LogInfo((object)"Kill Self executed.");
			}
			else
			{
				Plugin.Log.LogWarning((object)"Player not found, cannot kill self.");
			}
		}

		public void RefreshEntities(bool preserveSelection = true)
		{
			//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)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: 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_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			GameObject previouslySelected = ((preserveSelection && SelectedEntityIndex >= 0 && SelectedEntityIndex < FoundEntities.Count) ? FoundEntities[SelectedEntityIndex].GameObject : null);
			FoundEntities.Clear();
			HashSet<GameObject> hashSet = new HashSet<GameObject>();
			Vector3 val = (((Object)(object)PlayerController.PlayerClient.Value != (Object)null) ? ((Component)PlayerController.PlayerClient.Value).transform.position : Vector3.zero);
			if (PlayerController.AllPlayers != null)
			{
				foreach (PlayerController allPlayer in PlayerController.AllPlayers)
				{
					if ((Object)(object)allPlayer != (Object)null && (Object)(object)((Component)allPlayer).gameObject != (Object)null && hashSet.Add(((Component)allPlayer).gameObject))
					{
						string arg = (((NetworkBehaviour)allPlayer).isLocalPlayer ? "Player (You)" : (string.IsNullOrEmpty(((Object)allPlayer).name) ? "Player" : ((Object)allPlayer).name));
						string arg2 = (allPlayer.IsDead ? "Dead" : $"{allPlayer.Health} HP");
						float num = Vector3.Distance(val, ((Component)allPlayer).transform.position);
						FoundEntities.Add(new KillableEntityEntry
						{
							DisplayName = $"{arg} | {arg2} | {num:F1}m",
							ShortName = $"{arg} ({num:F1}m)",
							Distance = num,
							Damagable = (IDamagable)(object)allPlayer,
							GameObject = ((Component)allPlayer).gameObject
						});
					}
				}
			}
			SpiderMimic[] array = Object.FindObjectsByType<SpiderMimic>((FindObjectsSortMode)0);
			foreach (SpiderMimic val2 in array)
			{
				if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null && hashSet.Add(((Component)val2).gameObject))
				{
					float num2 = Vector3.Distance(val, ((Component)val2).transform.position);
					FoundEntities.Add(new KillableEntityEntry
					{
						DisplayName = $"SpiderMimic | Active | {num2:F1}m",
						ShortName = $"SpiderMimic ({num2:F1}m)",
						Distance = num2,
						Damagable = (((Component)val2).GetComponentInParent<IDamagable>() ?? ((Component)val2).GetComponent<IDamagable>()),
						GameObject = ((Component)val2).gameObject
					});
				}
			}
			ChestMimic[] array2 = Object.FindObjectsByType<ChestMimic>((FindObjectsSortMode)0);
			foreach (ChestMimic val3 in array2)
			{
				if ((Object)(object)val3 != (Object)null && (Object)(object)((Component)val3).gameObject != (Object)null && hashSet.Add(((Component)val3).gameObject))
				{
					float num3 = Vector3.Distance(val, ((Component)val3).transform.position);
					FoundEntities.Add(new KillableEntityEntry
					{
						DisplayName = $"ChestMimic | Active | {num3:F1}m",
						ShortName = $"ChestMimic ({num3:F1}m)",
						Distance = num3,
						Damagable = (((Component)val3).GetComponentInParent<IDamagable>() ?? ((Component)val3).GetComponent<IDamagable>()),
						GameObject = ((Component)val3).gameObject
					});
				}
			}
			MonoBehaviour[] array3 = Object.FindObjectsByType<MonoBehaviour>((FindObjectsSortMode)0);
			foreach (MonoBehaviour val4 in array3)
			{
				IDamagable val5 = (IDamagable)(object)((val4 is IDamagable) ? val4 : null);
				if (val5 != null && (Object)(object)((Component)val4).gameObject != (Object)null && hashSet.Add(((Component)val4).gameObject))
				{
					string arg3 = ((object)val4).GetType().Name.Replace("(Clone)", "");
					string arg4 = (val5.IsDead ? "Dead" : $"{val5.Health} HP");
					float num4 = Vector3.Distance(val, ((Component)val4).transform.position);
					FoundEntities.Add(new KillableEntityEntry
					{
						DisplayName = $"{arg3} | {arg4} | {num4:F1}m",
						ShortName = $"{arg3} ({num4:F1}m)",
						Distance = num4,
						Damagable = val5,
						GameObject = ((Component)val4).gameObject
					});
				}
			}
			FoundEntities.Sort((KillableEntityEntry a, KillableEntityEntry b) => a.Distance.CompareTo(b.Distance));
			if (preserveSelection && (Object)(object)previouslySelected != (Object)null)
			{
				SelectedEntityIndex = FoundEntities.FindIndex((KillableEntityEntry e) => (Object)(object)e.GameObject == (Object)(object)previouslySelected);
			}
			else if (SelectedEntityIndex >= FoundEntities.Count)
			{
				SelectedEntityIndex = -1;
			}
			Plugin.Log.LogInfo((object)$"Found and sorted {FoundEntities.Count} entities.");
		}

		public void TeleportMeToEntity(KillableEntityEntry entry)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			PlayerController value = PlayerController.PlayerClient.Value;
			if ((Object)(object)value != (Object)null && entry != null && (Object)(object)entry.GameObject != (Object)null)
			{
				Vector3 val = entry.GameObject.transform.position + Vector3.up * 0.2f;
				((Component)value).transform.position = val;
				value.Data.velocityXZ = Vector3.zero;
				value.Data.velocityY = 0f;
				NotificationModule.Show("Teleported to " + entry.ShortName);
				Plugin.Log.LogInfo((object)$"Teleported to entity: {entry.DisplayName} at {val}");
				RefreshEntities();
			}
		}

		public void TeleportEntityToMe(KillableEntityEntry entry)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			PlayerController value = PlayerController.PlayerClient.Value;
			if ((Object)(object)value == (Object)null || entry == null || (Object)(object)entry.GameObject == (Object)null)
			{
				return;
			}
			Vector3 val = ((Component)value).transform.position + value.Forward * 1.5f;
			IDamagable damagable = entry.Damagable;
			PlayerController val2 = (PlayerController)(object)((damagable is PlayerController) ? damagable : null);
			if (val2 != null)
			{
				((Component)val2).transform.position = val;
				val2.Data.velocityXZ = Vector3.zero;
				val2.Data.velocityY = 0f;
				NotificationModule.Show("Teleported " + entry.ShortName + " to you");
				Plugin.Log.LogInfo((object)("Teleported player " + entry.DisplayName + " to me."));
				RefreshEntities();
				return;
			}
			NavMeshAgent component = entry.GameObject.GetComponent<NavMeshAgent>();
			if ((Object)(object)component != (Object)null)
			{
				component.Warp(val);
			}
			CharacterController component2 = entry.GameObject.GetComponent<CharacterController>();
			if ((Object)(object)component2 != (Object)null)
			{
				((Collider)component2).enabled = false;
				entry.GameObject.transform.position = val;
				((Collider)component2).enabled = true;
			}
			else
			{
				entry.GameObject.transform.position = val;
			}
			Rigidbody component3 = entry.GameObject.GetComponent<Rigidbody>();
			if ((Object)(object)component3 != (Object)null)
			{
				component3.position = val;
				component3.velocity = Vector3.zero;
			}
			NotificationModule.Show("Teleported " + entry.ShortName + " to you");
			Plugin.Log.LogInfo((object)("Teleported entity " + entry.DisplayName + " to me."));
			RefreshEntities();
		}

		public void KillSelectedEntity()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			if (SelectedEntityIndex < 0 || SelectedEntityIndex >= FoundEntities.Count)
			{
				NotificationModule.Show("No entity selected to kill.");
				Plugin.Log.LogWarning((object)"No entity selected to kill.");
				return;
			}
			KillableEntityEntry killableEntityEntry = FoundEntities[SelectedEntityIndex];
			if (killableEntityEntry == null)
			{
				return;
			}
			string shortName = killableEntityEntry.ShortName;
			if (killableEntityEntry.Damagable != null)
			{
				IDamagable damagable = killableEntityEntry.Damagable;
				PlayerController val = (PlayerController)(object)((damagable is PlayerController) ? damagable : null);
				if (val != null && ((NetworkBehaviour)val).isLocalPlayer)
				{
					KillSelf();
					RefreshEntities(preserveSelection: false);
					return;
				}
				DamageContext val2 = new DamageContext
				{
					position = (((Object)(object)killableEntityEntry.GameObject != (Object)null) ? killableEntityEntry.GameObject.transform.position : Vector3.zero),
					normal = Vector3.up,
					damage = 999999,
					damageType = (DamageType)4,
					deathType = (DeathType)3
				};
				if (NetworkServer.active)
				{
					killableEntityEntry.Damagable.TakeDamageOnServer(ref val2);
				}
				else
				{
					IDamagable damagable2 = killableEntityEntry.Damagable;
					PlayerController val3 = (PlayerController)(object)((damagable2 is PlayerController) ? damagable2 : null);
					if (val3 != null)
					{
						val3.TakeDamagePleaseCmd(val2);
					}
					else
					{
						killableEntityEntry.Damagable.TakeDamageOnServer(ref val2);
					}
				}
				NotificationModule.Show("Killed " + shortName + "!");
				Plugin.Log.LogInfo((object)("Killed IDamagable entity: " + killableEntityEntry.DisplayName));
			}
			else if ((Object)(object)killableEntityEntry.GameObject != (Object)null)
			{
				killableEntityEntry.GameObject.SetActive(false);
				NotificationModule.Show("Deactivated " + shortName + "!");
				Plugin.Log.LogInfo((object)("Deactivated non-damagable entity: " + killableEntityEntry.DisplayName));
			}
			RefreshEntities(preserveSelection: false);
		}

		public void UpdateModMenuPause(bool showUI)
		{
			if (showUI && LockCameraWhenOpen)
			{
				if (!InGameUI.IsGamePaused)
				{
					SetFakeGamePauseForModMenu(paused: true);
					PausedByModMenu = true;
				}
			}
			else if (PausedByModMenu)
			{
				if ((Object)(object)StaticInstance<InGameUI>.Instance != (Object)null)
				{
					InGameUI.RecalculateCursorLock();
				}
				PausedByModMenu = false;
			}
		}

		public void SetFakeGamePauseForModMenu(bool paused)
		{
			//IL_0066: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				FieldInfo field = typeof(InGameUI).GetField("<IsGamePaused>k__BackingField", BindingFlags.Static | BindingFlags.NonPublic);
				if (field == null)
				{
					Plugin.Log.LogWarning((object)"Could not find InGameUI.IsGamePaused backing field. Fake pause for mod menu will not work.");
					return;
				}
				field.SetValue(null, paused);
				if (paused)
				{
					Cursor.lockState = (CursorLockMode)0;
					Cursor.visible = true;
					Plugin.Log.LogInfo((object)"SRHM fake pause enabled (input/camera obscured, cursor free).");
					return;
				}
				Scene sceneByName = SceneManager.GetSceneByName("MainMenu");
				if (!((Scene)(ref sceneByName)).IsValid())
				{
					sceneByName = SceneManager.GetSceneByName("SplashScreen");
					if (!((Scene)(ref sceneByName)).IsValid())
					{
						Cursor.lockState = (CursorLockMode)1;
						Cursor.visible = false;
					}
				}
				Plugin.Log.LogInfo((object)"SRHM fake pause disabled (input/camera restored).");
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"Error while setting fake game pause for mod menu: {arg}");
			}
		}

		public void DrawTimescaleControls()
		{
			GUILayout.Space(20f);
			GUILayout.Label("Timescale:", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			float num = Mathf.Log(0.01f);
			float num2 = Mathf.Log(100f);
			float num3 = Mathf.Log(CurrentTimescale);
			float num4 = GUILayout.HorizontalSlider(num3, num, num2, Array.Empty<GUILayoutOption>());
			if (num4 != num3)
			{
				CurrentTimescale = Mathf.Exp(num4);
				TimescaleInput = CurrentTimescale.ToString("F2");
				Time.timeScale = CurrentTimescale;
			}
			string text = GUILayout.TextField(TimescaleInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			if (text != TimescaleInput)
			{
				TimescaleInput = text;
				if (ParseUtils.TryParseFloat(TimescaleInput, out var value))
				{
					CurrentTimescale = Mathf.Clamp(value, 0.01f, 100f);
					Time.timeScale = CurrentTimescale;
				}
			}
			GUILayout.EndHorizontal();
		}

		public void DrawForcedFpsControls()
		{
			GUILayout.Space(10f);
			GUILayout.Label("Force FPS:", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			ForcedFpsInput = GUILayout.TextField(ForcedFpsInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			if (GUILayout.Button("Apply FPS", Array.Empty<GUILayoutOption>()))
			{
				if (ParseUtils.TryParseInt(ForcedFpsInput, out var value))
				{
					QualitySettings.vSyncCount = 0;
					Application.targetFrameRate = value;
					NotificationModule.Show($"Forced FPS: {value}");
					Plugin.Log.LogInfo((object)$"Forced FPS set to: {value}");
				}
				else
				{
					Plugin.Log.LogWarning((object)"Invalid FPS input.");
				}
			}
			if (GUILayout.Button("Reset", Array.Empty<GUILayoutOption>()))
			{
				QualitySettings.vSyncCount = 0;
				Application.targetFrameRate = -1;
				ForcedFpsInput = "0";
				NotificationModule.Show("FPS uncapped");
				Plugin.Log.LogInfo((object)"Forced FPS reset to uncapped (-1).");
			}
			GUILayout.EndHorizontal();
		}

		public void DrawCheatsWindow(int windowID)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			PlayerController value = PlayerController.PlayerClient.Value;
			GUI.enabled = (Object)(object)value != (Object)null;
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			bool flag = GUILayout.Toggle(FlyingEnabled, " (V) Noclip", Array.Empty<GUILayoutOption>());
			if (flag != FlyingEnabled)
			{
				SetNoclipEnabled(flag);
			}
			bool flag2 = GUILayout.Toggle(GodModeEnabled, " (J) God Mode", Array.Empty<GUILayoutOption>());
			if (flag2 != GodModeEnabled)
			{
				SetGodModeEnabled(flag2);
			}
			if (GUILayout.Button("Kill Self", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) }))
			{
				KillSelf();
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("HP:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) });
			TargetHpInput = GUILayout.TextField(TargetHpInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) }) && ParseUtils.TryParseInt(TargetHpInput, out var value2))
			{
				SetHealth(value2);
			}
			if (GUILayout.Button("Max", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) }))
			{
				SetHealth(100);
				TargetHpInput = "100";
			}
			GUILayout.Space(6f);
			GUILayout.Label("San:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) });
			TargetSanityInput = GUILayout.TextField(TargetSanityInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) }) && ParseUtils.TryParseFloat(TargetSanityInput, out var value3))
			{
				SetSanity(value3);
			}
			if (GUILayout.Button("Max", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) }))
			{
				SetSanity(100f);
				TargetSanityInput = "100";
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(UseGloveBoost ? "Glove Boost (B):" : "Velocity Boost (B):", Array.Empty<GUILayoutOption>());
			UseGloveBoost = GUILayout.Toggle(UseGloveBoost, "Glove Boost", Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			if (UseGloveBoost)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GlovePower = GUILayout.HorizontalSlider(GlovePower, 9f, 35f, Array.Empty<GUILayoutOption>());
				GUILayout.Label($"{GlovePower:F1}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) });
				if (GUILayout.Button("Boost", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
				{
					ApplyGloveBoost();
				}
				GUILayout.EndHorizontal();
			}
			else
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				ForceVelocityInput = GUILayout.TextField(ForceVelocityInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
				if (GUILayout.Button("Boost", Array.Empty<GUILayoutOption>()))
				{
					ApplyVelocityBoost();
				}
				GUILayout.EndHorizontal();
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button((SelectedEntityIndex >= 0 && SelectedEntityIndex < FoundEntities.Count) ? FoundEntities[SelectedEntityIndex].ShortName : ((FoundEntities.Count == 0) ? "No entities" : "Select entity..."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
			{
				if (FoundEntities.Count == 0)
				{
					RefreshEntities();
				}
				EntityDropdownOpen = !EntityDropdownOpen;
				if (EntityDropdownOpen)
				{
					float num = ((Rect)(ref CheatsWindowRect)).xMax + 9f;
					if (num + 380f > UIResolutionManager.ScreenWidth)
					{
						num = Mathf.Max(10f, UIResolutionManager.ScreenWidth - 390f);
					}
					((Rect)(ref EntityDropdownRect)).x = num;
					((Rect)(ref EntityDropdownRect)).y = ((Rect)(ref CheatsWindowRect)).y;
				}
				else
				{
					ShowEntityActionWindow = false;
				}
			}
			if (GUILayout.Button("Ref", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(34f) }))
			{
				RefreshEntities();
				NotificationModule.Show("Entities refreshed", 1.5f);
			}
			if (GUILayout.Button("Kill", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				KillSelectedEntity();
			}
			GUILayout.EndHorizontal();
			if ((Object)(object)value == (Object)null)
			{
				GUILayout.Space(5f);
				GUILayout.Label("Player not found, cheats unavailable.", Array.Empty<GUILayoutOption>());
			}
			GUI.enabled = true;
			GUILayout.EndVertical();
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 10000f));
		}

		public void DrawEntityDropdownWindow(int windowID)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"<b>Entities ({FoundEntities.Count}):</b>", Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Refresh", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) }))
			{
				RefreshEntities();
				NotificationModule.Show("Entities refreshed", 1.5f);
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(5f);
			_entityScrollPosition = GUILayout.BeginScrollView(_entityScrollPosition, Array.Empty<GUILayoutOption>());
			for (int i = 0; i < FoundEntities.Count; i++)
			{
				KillableEntityEntry killableEntityEntry = FoundEntities[i];
				if (killableEntityEntry == null || (Object)(object)killableEntityEntry.GameObject == (Object)null)
				{
					continue;
				}
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				if (GUILayout.Button(((SelectedEntityIndex == i) ? "> " : "") + killableEntityEntry.DisplayName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
				{
					SelectedEntityIndex = i;
					NotificationModule.Show("Selected " + killableEntityEntry.ShortName, 1.5f);
				}
				if (GUILayout.Button("...", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
				{
					ActionMenuEntity = killableEntityEntry;
					ShowEntityActionWindow = true;
					float num = ((Rect)(ref EntityDropdownRect)).xMax + 9f;
					float num2 = ((Rect)(ref EntityDropdownRect)).y + 35f;
					if (num + 175f > UIResolutionManager.ScreenWidth)
					{
						num = ((Rect)(ref EntityDropdownRect)).x;
						num2 = ((!(((Rect)(ref EntityDropdownRect)).yMax + 125f <= UIResolutionManager.ScreenHeight)) ? Mathf.Max(10f, ((Rect)(ref EntityDropdownRect)).y - 125f) : (((Rect)(ref EntityDropdownRect)).yMax + 9f));
					}
					EntityActionWindowRect = new Rect(num, num2, 170f, 115f);
				}
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 10000f));
		}

		public void DrawEntityActionWindow(int windowID)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			if (ActionMenuEntity != null && (Object)(object)ActionMenuEntity.GameObject != (Object)null)
			{
				if (GUILayout.Button("TP Me to Entity", Array.Empty<GUILayoutOption>()))
				{
					TeleportMeToEntity(ActionMenuEntity);
					ShowEntityActionWindow = false;
				}
				if (GUILayout.Button("TP to Me", Array.Empty<GUILayoutOption>()))
				{
					TeleportEntityToMe(ActionMenuEntity);
					ShowEntityActionWindow = false;
				}
			}
			else
			{
				GUILayout.Label("Entity lost", Array.Empty<GUILayoutOption>());
			}
			if (GUILayout.Button("Close", Array.Empty<GUILayoutOption>()))
			{
				ShowEntityActionWindow = false;
			}
			GUILayout.EndVertical();
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 10000f));
		}

		public void DrawSrhmSettingsWindow(int windowID)
		{
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			bool flag = GUILayout.Toggle(LockCameraWhenOpen, " Lock Camera when SRHM is opened", Array.Empty<GUILayoutOption>());
			if (flag != LockCameraWhenOpen)
			{
				LockCameraWhenOpen = flag;
				if (!LockCameraWhenOpen && PausedByModMenu)
				{
					if ((Object)(object)StaticInstance<InGameUI>.Instance != (Object)null)
					{
						InGameUI.RecalculateCursorLock();
					}
					PausedByModMenu = false;
				}
			}
			bool flag2 = GUILayout.Toggle(UIResolutionManager.AutoScaleUI, " Auto-scale UI to Resolution", Array.Empty<GUILayoutOption>());
			if (flag2 != UIResolutionManager.AutoScaleUI)
			{
				UIResolutionManager.AutoScaleUI = flag2;
				UIResolutionManager.TriggerResolutionChanged();
				NotificationModule.Show(UIResolutionManager.AutoScaleUI ? "UI Auto-scale enabled (1080p base)" : "UI Auto-scale disabled");
			}
			if (UIResolutionManager.AutoScaleUI)
			{
				GUILayout.Label($"<color=#aaaaaa>Scale: {UIResolutionManager.Scale * 100f:F0}% (1080p base)</color>", Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndVertical();
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 10000f));
		}

		public void OnMainUIClosing()
		{
			CheatsWindowWasOpen = ShowCheatsWindow;
			ShowCheatsWindow = false;
			EntityDropdownOpen = false;
			ShowEntityActionWindow = false;
			ActionMenuEntity = null;
		}

		public void OnMainUIOpening()
		{
			ShowCheatsWindow = CheatsWindowWasOpen;
		}
	}
	public class CollisionVisualizer
	{
		public Rect ColorWindowRect = new Rect(319f, 270f, 250f, 267f);

		public Rect ColorSubmenuRect = new Rect(578f, 270f, 200f, 180f);

		private readonly Dictionary<ColliderCategory, CategoryConfig> _categories = new Dictionary<ColliderCategory, CategoryConfig>();

		private readonly List<ColliderCacheEntry> _cachedColliders = new List<ColliderCacheEntry>();

		private float _lastScanTime;

		private Mesh _shaded6FaceBoxMesh;

		private Mesh _unitBeamMesh;

		private Mesh _sphereFaceMesh;

		private Mesh _sphereWireMesh;

		private Mesh _capsuleFaceMesh;

		private Mesh _capsuleWireMesh;

		private Shader _unlitShader;

		private static readonly float[] FaceBrightness = new float[6] { 1f, 0.88f, 0.76f, 0.65f, 0.54f, 0.42f };

		private static readonly MethodInfo SetSurfaceTypeMethod = Type.GetType("UnityEngine.Rendering.HighDefinition.HDMaterial, Unity.RenderPipelines.HighDefinition.Runtime")?.GetMethod("SetSurfaceType", BindingFlags.Static | BindingFlags.Public);

		public bool ShowCollisions { get; set; }

		public bool ColorWindowOpen { get; set; }

		public bool ColorWindowWasOpen { get; set; }

		public bool ShowColorSubmenu { get; set; }

		public ColliderCategory SelectedCategory { get; set; }

		public bool ShowFaces { get; set; } = true;

		public bool ShowWireframe { get; set; } = true;

		public bool XRayMode { get; set; }

		public bool EnableInspector { get; set; }

		public bool EnableLighting { get; set; } = true;

		public float MaxRenderDistance { get; set; } = 60f;

		public string DistanceInput { get; set; } = "60";

		public void Initialize()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_0124: Unknown result type (might be due to invalid IL or missing references)
			_unlitShader = Shader.Find("HDRP/Unlit") ?? Shader.Find("Unlit/Color") ?? Shader.Find("Hidden/Internal-Colored");
			_categories[ColliderCategory.Solid] = new CategoryConfig(ColliderCategory.Solid, "Solids (Walls & Floors)", new Color(0.2f, 0.65f, 1f), 0.22f)
			{
				Enabled = true
			};
			_categories[ColliderCategory.Trigger] = new CategoryConfig(ColliderCategory.Trigger, "Gameplay Triggers", new Color(1f, 0.85f, 0.1f), 0.35f)
			{
				Enabled = false
			};
			_categories[ColliderCategory.Volume] = new CategoryConfig(ColliderCategory.Volume, "Room & Zone Volumes", new Color(0.85f, 0.2f, 1f), 0.2f)
			{
				Enabled = false
			};
			_categories[ColliderCategory.Interactable] = new CategoryConfig(ColliderCategory.Interactable, "Interactables & Pickups", new Color(0.1f, 1f, 0.35f), 0.35f)
			{
				Enabled = false
			};
			_categories[ColliderCategory.Hazard] = new CategoryConfig(ColliderCategory.Hazard, "Hazards & Damage", new Color(1f, 0.15f, 0.15f), 0.4f)
			{
				Enabled = false
			};
			BuildSharedMeshes();
			CreateAllMaterials();
			Plugin.Log.LogInfo((object)"Zero-GameObject CollisionVisualizer initialized with HDRP/Unlit and 6-face directional contrast.");
		}

		private void BuildSharedMeshes()
		{
			_shaded6FaceBoxMesh = CollisionMeshFactory.CreateShaded6FaceBoxMesh();
			_unitBeamMesh = CollisionMeshFactory.CreateUnitBeamMesh();
			_sphereFaceMesh = CollisionMeshFactory.CreateSphereFaceMesh();
			_sphereWireMesh = CollisionMeshFactory.CreateSphereWireMesh();
			_capsuleFaceMesh = CollisionMeshFactory.CreateCapsuleFaceMesh();
			_capsuleWireMesh = CollisionMeshFactory.CreateCapsuleWireMesh();
		}

		private void CreateAllMaterials()
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			Color color = default(Color);
			Color color2 = default(Color);
			Color color3 = default(Color);
			foreach (KeyValuePair<ColliderCategory, CategoryConfig> category in _categories)
			{
				CategoryConfig value = category.Value;
				for (int i = 0; i < 6; i++)
				{
					float num = (EnableLighting ? FaceBrightness[i] : 1f);
					((Color)(ref color))..ctor(value.BaseColor.r * num, value.BaseColor.g * num, value.BaseColor.b * num, value.Alpha);
					value.FaceMaterials[i] = CreateMaterial(color, isWire: false);
				}
				((Color)(ref color2))..ctor(value.BaseColor.r, value.BaseColor.g, value.BaseColor.b, value.Alpha);
				value.SingleFaceMaterial = CreateMaterial(color2, isWire: false);
				((Color)(ref color3))..ctor(Mathf.Min(1f, value.BaseColor.r * 1.25f + 0.1f), Mathf.Min(1f, value.BaseColor.g * 1.25f + 0.1f), Mathf.Min(1f, value.BaseColor.b * 1.25f + 0.1f), 0.98f);
				value.WireMaterial = CreateMaterial(color3, isWire: true);
			}
		}

		private Material CreateMaterial(Color color, bool isWire)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_unlitShader == (Object)null)
			{
				return null;
			}
			Material val = new Material(_unlitShader);
			if (SetSurfaceTypeMethod != null)
			{
				SetSurfaceTypeMethod.Invoke(null, new object[2] { val, true });
			}
			else
			{
				val.SetFloat("_SurfaceType", 1f);
				val.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
				val.DisableKeyword("_SURFACE_TYPE_OPAQUE");
			}
			val.SetOverrideTag("RenderType", "Transparent");
			val.SetInt("_BlendMode", 0);
			val.SetInt("_SrcBlend", 5);
			val.SetInt("_DstBlend", 10);
			val.SetInt("_ZWrite", 0);
			val.renderQueue = 3000 + (isWire ? 300 : 100);
			int num = (XRayMode ? 8 : 4);
			val.SetInt("_ZTestTransparent", num);
			val.SetInt("_ZTestDepthEqualForOpaque", num);
			val.SetInt("_ZTestGBuffer", num);
			val.SetInt("_ZTest", num);
			val.SetInt("_Cull", 2);
			val.SetInt("_CullMode", 2);
			val.SetInt("_TransparentCullMode", 2);
			val.SetInt("_CullModeForward", 2);
			val.SetInt("_DoubleSidedEnable", 0);
			val.DisableKeyword("_DOUBLESIDED_ON");
			val.SetColor("_BaseColor", color);
			val.SetColor("_UnlitColor", color);
			val.SetColor("_Color", color);
			val.color = color;
			return val;
		}

		public void UpdateMaterialColors()
		{
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			Color col = default(Color);
			Color col2 = default(Color);
			Color col3 = default(Color);
			foreach (KeyValuePair<ColliderCategory, CategoryConfig> category in _categories)
			{
				CategoryConfig value = category.Value;
				for (int i = 0; i < 6; i++)
				{
					if ((Object)(object)value.FaceMaterials[i] != (Object)null)
					{
						float num = (EnableLighting ? FaceBrightness[i] : 1f);
						((Color)(ref col))..ctor(value.BaseColor.r * num, value.BaseColor.g * num, value.BaseColor.b * num, value.Alpha);
						SetMatColor(value.FaceMaterials[i], col);
					}
				}
				if ((Object)(object)value.SingleFaceMaterial != (Object)null)
				{
					((Color)(ref col2))..ctor(value.BaseColor.r, value.BaseColor.g, value.BaseColor.b, value.Alpha);
					SetMatColor(value.SingleFaceMaterial, col2);
				}
				if ((Object)(object)value.WireMaterial != (Object)null)
				{
					((Color)(ref col3))..ctor(Mathf.Min(1f, value.BaseColor.r * 1.25f + 0.1f), Mathf.Min(1f, value.BaseColor.g * 1.25f + 0.1f), Mathf.Min(1f, value.BaseColor.b * 1.25f + 0.1f), 0.98f);
					SetMatColor(value.WireMaterial, col3);
				}
			}
		}

		private void SetMatColor(Material mat, Color col)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			mat.SetColor("_BaseColor", col);
			mat.SetColor("_UnlitColor", col);
			mat.SetColor("_Color", col);
			mat.color = col;
			int num = (XRayMode ? 8 : 4);
			mat.SetInt("_ZTestTransparent", num);
			mat.SetInt("_ZTestDepthEqualForOpaque", num);
			mat.SetInt("_ZTestGBuffer", num);
		}

		public void Update()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_01ae: 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_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			if (!ShowCollisions)
			{
				if (EnableInspector)
				{
					NotificationModule.SetInspector(null);
				}
				return;
			}
			Camera playerCamera = CollisionInspector.GetPlayerCamera();
			Vector3 val = (((Object)(object)playerCamera != (Object)null) ? ((Component)playerCamera).transform.position : Vector3.zero);
			if (EnableInspector && (Object)(object)playerCamera != (Object)null)
			{
				CollisionInspector.PerformAimInspection(playerCamera, _categories);
			}
			if (Time.time - _lastScanTime > 2.5f || _cachedColliders.Count == 0)
			{
				ScanSceneColliders();
			}
			for (int i = 0; i < _cachedColliders.Count; i++)
			{
				ColliderCacheEntry entry = _cachedColliders[i];
				if ((Object)(object)entry.Col == (Object)null || !entry.Col.enabled || !((Component)entry.Col).gameObject.activeInHierarchy)
				{
					continue;
				}
				CategoryConfig categoryConfig = _categories[entry.Category];
				if (!categoryConfig.Enabled)
				{
					continue;
				}
				Bounds bounds = entry.Col.bounds;
				Vector3 center = ((Bounds)(ref bounds)).center;
				if ((Object)(object)playerCamera != (Object)null && MaxRenderDistance > 0f && Vector3.Distance(val, center) > MaxRenderDistance)
				{
					continue;
				}
				Matrix4x4 val2 = ComputeMatrix(entry);
				if (ShowFaces)
				{
					if (entry.ShapeType == 0)
					{
						for (int j = 0; j < 6; j++)
						{
							if ((Object)(object)categoryConfig.FaceMaterials[j] != (Object)null)
							{
								Graphics.DrawMesh(_shaded6FaceBoxMesh, val2, categoryConfig.FaceMaterials[j], 0, (Camera)null, j);
							}
						}
					}
					else if (entry.ShapeType == 1 && (Object)(object)_sphereFaceMesh != (Object)null && (Object)(object)categoryConfig.SingleFaceMaterial != (Object)null)
					{
						Graphics.DrawMesh(_sphereFaceMesh, val2, categoryConfig.SingleFaceMaterial, 0, (Camera)null);
					}
					else if (entry.ShapeType == 2 && (Object)(object)_capsuleFaceMesh != (Object)null && (Object)(object)categoryConfig.SingleFaceMaterial != (Object)null)
					{
						Graphics.DrawMesh(_capsuleFaceMesh, val2, categoryConfig.SingleFaceMaterial, 0, (Camera)null);
					}
					else if (entry.ShapeType == 3 && (Object)(object)entry.SharedMesh != (Object)null && (Object)(object)categoryConfig.SingleFaceMaterial != (Object)null)
					{
						Graphics.DrawMesh(entry.SharedMesh, val2, categoryConfig.SingleFaceMaterial, 0, (Camera)null);
					}
				}
				if (ShowWireframe && (Object)(object)categoryConfig.WireMaterial != (Object)null)
				{
					if (entry.ShapeType == 0)
					{
						DrawBoxWireframe(entry, categoryConfig.WireMaterial);
					}
					else if (entry.ShapeType == 1 && (Object)(object)_sphereWireMesh != (Object)null)
					{
						Graphics.DrawMesh(_sphereWireMesh, val2, categoryConfig.WireMaterial, 0, (Camera)null);
					}
					else if (entry.ShapeType == 2 && (Object)(object)_capsuleWireMesh != (Object)null)
					{
						Graphics.DrawMesh(_capsuleWireMesh, val2, categoryConfig.WireMaterial, 0, (Camera)null);
					}
					else if (entry.ShapeType == 3 && (Object)(object)entry.SharedMesh != (Object)null)
					{
						DrawMeshBoundingWireframe(entry, categoryConfig.WireMaterial);
					}
				}
			}
		}

		private Matrix4x4 ComputeMatrix(ColliderCacheEntry entry)
		{
			//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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_009d: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)entry.Col).transform;
			if (entry.ShapeType == 0)
			{
				Vector3 val = transform.TransformPoint(entry.LocalCenter);
				Quaternion val2 = transform.rotation * entry.LocalRotation;
				Vector3 val3 = Vector3.Scale(transform.lossyScale, entry.LocalSize);
				return Matrix4x4.TRS(val, val2, val3);
			}
			if (entry.ShapeType == 1)
			{
				Vector3 val4 = transform.TransformPoint(entry.LocalCenter);
				float num = Mathf.Max(Mathf.Abs(transform.lossyScale.x), Mathf.Max(Mathf.Abs(transform.lossyScale.y), Mathf.Abs(transform.lossyScale.z)));
				Vector3 val5 = entry.LocalSize * num;
				return Matrix4x4.TRS(val4, Quaternion.identity, val5);
			}
			if (entry.ShapeType == 2)
			{
				Vector3 val6 = transform.TransformPoint(entry.LocalCenter);
				Quaternion val7 = transform.rotation * entry.LocalRotation;
				Vector3 val8 = Vector3.Scale(transform.lossyScale, entry.LocalSize);
				return Matrix4x4.TRS(val6, val7, val8);
			}
			return transform.localToWorldMatrix;
		}

		private void DrawBoxWireframe(ColliderCacheEntry entry, Material wireMat)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//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_005b: 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_0062: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_unitBeamMesh == (Object)null) && !((Object)(object)wireMat == (Object)null) && !((Object)(object)entry.Col == (Object)null))
			{
				Transform transform = ((Component)entry.Col).transform;
				Vector3 worldCenter = transform.TransformPoint(entry.LocalCenter);
				Quaternion worldRot = transform.rotation * entry.LocalRotation;
				Vector3 worldScale = Vector3.Scale(transform.lossyScale, entry.LocalSize);
				DrawBoxBeams(worldCenter, worldRot, worldScale, wireMat);
			}
		}

		private void DrawMeshBoundingWireframe(ColliderCacheEntry entry, Material wireMat)
		{
			//IL_003a: 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)
			//IL_004e: 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_0058: 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)
			//IL_005f: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_unitBeamMesh == (Object)null) && !((Object)(object)wireMat == (Object)null) && !((Object)(object)entry.Col == (Object)null) && !((Object)(object)entry.SharedMesh == (Object)null))
			{
				Bounds bounds = entry.SharedMesh.bounds;
				Transform transform = ((Component)entry.Col).transform;
				Vector3 worldCenter = transform.TransformPoint(((Bounds)(ref bounds)).center);
				Quaternion rotation = transform.rotation;
				Vector3 worldScale = Vector3.Scale(transform.lossyScale, ((Bounds)(ref bounds)).size);
				DrawDashedBoxBeams(worldCenter, rotation, worldScale, wireMat);
			}
		}

		private void DrawDashedBoxBeams(Vector3 worldCenter, Quaternion worldRot, Vector3 worldScale, Material wireMat)
		{
			//IL_0000: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_00f9: 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_010b: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Abs(worldScale.x);
			float num2 = Mathf.Abs(worldScale.y);
			float num3 = Mathf.Abs(worldScale.z);
			float num4 = num * 0.5f + 0.003f;
			float num5 = num2 * 0.5f + 0.003f;
			float num6 = num3 * 0.5f + 0.003f;
			float num7 = Mathf.Min(num, Mathf.Min(num2, num3));
			float t = Mathf.Min(0.035f, Mathf.Max(0.004f, num7 * 0.25f));
			DrawDashedEdgeX(worldCenter, worldRot, num5, num6, num, t, wireMat);
			DrawDashedEdgeX(worldCenter, worldRot, num5, 0f - num6, num, t, wireMat);
			DrawDashedEdgeX(worldCenter, worldRot, 0f - num5, num6, num, t, wireMat);
			DrawDashedEdgeX(worldCenter, worldRot, 0f - num5, 0f - num6, num, t, wireMat);
			DrawDashedEdgeY(worldCenter, worldRot, num4, num6, num2, t, wireMat);
			DrawDashedEdgeY(worldCenter, worldRot, num4, 0f - num6, num2, t, wireMat);
			DrawDashedEdgeY(worldCenter, worldRot, 0f - num4, num6, num2, t, wireMat);
			DrawDashedEdgeY(worldCenter, worldRot, 0f - num4, 0f - num6, num2, t, wireMat);
			DrawDashedEdgeZ(worldCenter, worldRot, num4, num5, num3, t, wireMat);
			DrawDashedEdgeZ(worldCenter, worldRot, num4, 0f - num5, num3, t, wireMat);
			DrawDashedEdgeZ(worldCenter, worldRot, 0f - num4, num5, num3, t, wireMat);
			DrawDashedEdgeZ(worldCenter, worldRot, 0f - num4, 0f - num5, num3, t, wireMat);
		}

		private void DrawDashedEdgeX(Vector3 worldCenter, Quaternion worldRot, float y, float z, float sx, float t, Material mat)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp(t * 8f, 0.12f, 0.35f);
			int num2 = Mathf.Max(2, Mathf.RoundToInt(sx / num));
			int num3 = 2 * num2 - 1;
			float num4 = sx / (float)num3;
			float num5 = num4 * 0.75f;
			Vector3 scale = default(Vector3);
			((Vector3)(ref scale))..ctor(num5, t, t);
			float num6 = (0f - sx) * 0.5f + num4 * 0.5f;
			for (int i = 0; i < num2; i++)
			{
				float num7 = num6 + (float)(i * 2) * num4;
				DrawBeam(worldCenter, worldRot, new Vector3(num7, y, z), scale, mat);
			}
		}

		private void DrawDashedEdgeY(Vector3 worldCenter, Quaternion worldRot, float x, float z, float sy, float t, Material mat)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp(t * 8f, 0.12f, 0.35f);
			int num2 = Mathf.Max(2, Mathf.RoundToInt(sy / num));
			int num3 = 2 * num2 - 1;
			float num4 = sy / (float)num3;
			float num5 = num4 * 0.75f;
			Vector3 scale = default(Vector3);
			((Vector3)(ref scale))..ctor(t, num5, t);
			float num6 = (0f - sy) * 0.5f + num4 * 0.5f;
			for (int i = 0; i < num2; i++)
			{
				float num7 = num6 + (float)(i * 2) * num4;
				DrawBeam(worldCenter, worldRot, new Vector3(x, num7, z), scale, mat);
			}
		}

		private void DrawDashedEdgeZ(Vector3 worldCenter, Quaternion worldRot, float x, float y, float sz, float t, Material mat)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp(t * 8f, 0.12f, 0.35f);
			int num2 = Mathf.Max(2, Mathf.RoundToInt(sz / num));
			int num3 = 2 * num2 - 1;
			float num4 = sz / (float)num3;
			float num5 = num4 * 0.75f;
			Vector3 scale = default(Vector3);
			((Vector3)(ref scale))..ctor(t, t, num5);
			float num6 = (0f - sz) * 0.5f + num4 * 0.5f;
			for (int i = 0; i < num2; i++)
			{
				float num7 = num6 + (float)(i * 2) * num4;
				DrawBeam(worldCenter, worldRot, new Vector3(x, y, num7), scale, mat);
			}
		}

		private void DrawBoxBeams(Vector3 worldCenter, Quaternion worldRot, Vector3 worldScale, Material wireMat)
		{
			//IL_0000: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: 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_01cc: 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)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL