Decompiled source of Omnium v0.9.0

Omnium.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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.Configuration;
using BepInEx.Logging;
using Empress.OmniumLib;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+24369bca1bd6a33721f9c687193b6778581edd6f")]
[assembly: AssemblyProduct("Omnium")]
[assembly: AssemblyTitle("Omnium")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Omnium
{
	[BepInPlugin("Omniscye.Omnium", "Omnium", "1.0")]
	public class Omnium : BaseUnityPlugin
	{
		internal static Omnium Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("dev.empress.omnium", "Omnium", "2.2.0")]
	public class OmniumPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <Bootstrap>d__17 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public OmniumPlugin <>4__this;

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

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

			[DebuggerHidden]
			public <Bootstrap>d__17(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (<>4__this._waitForRepoLibBundles.Value)
					{
						<>2__current = BundleGate.WaitForRepoLibBundles(<>4__this._repoLibWaitTimeout.Value, <>4__this._repoLibPollInterval.Value, <>4__this._logVerbose.Value);
						<>1__state = 1;
						return true;
					}
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				<>4__this.DoDeferredInit();
				return false;
			}

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

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

		public const string PluginGuid = "dev.empress.omnium";

		public const string PluginName = "Omnium";

		public const string PluginVersion = "2.2.0";

		private Harmony _harmony;

		private OmniumUI _ui;

		private ConfigEntry<KeyCode> _toggleKey;

		private ConfigEntry<KeyCode> _freeCamKey;

		private ConfigEntry<KeyCode> _noclipKey;

		private ConfigEntry<bool> _openOnSceneLoad;

		private ConfigEntry<bool> _logVerbose;

		private ConfigEntry<bool> _respectRepoLib;

		private ConfigEntry<bool> _disableInputHijack;

		private ConfigEntry<bool> _waitForRepoLibBundles;

		private ConfigEntry<float> _repoLibWaitTimeout;

		private ConfigEntry<float> _repoLibPollInterval;

		private bool _initialized;

		private void Awake()
		{
			_toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("UI", "ToggleKey", (KeyCode)288, "Key to toggle Omnium UI.");
			_freeCamKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("UI", "FreeCamKey", (KeyCode)289, "Toggle FreeCam.");
			_noclipKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("UI", "NoclipKey", (KeyCode)290, "Toggle noclip. (hidden in UI, not handled by key)");
			_openOnSceneLoad = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "OpenOnSceneLoad", false, "Open Omnium when a new scene/level loads.");
			_logVerbose = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Verbose", false, "Enable verbose log output.");
			_respectRepoLib = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "RespectRepoLib", true, "Avoid disabling RepoLib/Bundle/Mod loader components while Omnium UI is open.");
			_disableInputHijack = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "DisableInputHijack", false, "If true, Omnium will never disable behaviours while UI is open.");
			_waitForRepoLibBundles = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "WaitForRepoLibBundles", true, "Delay Omnium init until REPOLib reports bundles are done (event or ops drain), or timeout.");
			_repoLibWaitTimeout = ((BaseUnityPlugin)this).Config.Bind<float>("Compatibility", "RepoLibWaitTimeoutSec", 25f, "Max seconds to wait for REPOLib bundles before giving up.");
			_repoLibPollInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Compatibility", "RepoLibPollIntervalSec", 0.25f, "How often to poll REPOLib readiness (seconds).");
			((MonoBehaviour)this).StartCoroutine(Bootstrap());
		}

		[IteratorStateMachine(typeof(<Bootstrap>d__17))]
		private IEnumerator Bootstrap()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Bootstrap>d__17(0)
			{
				<>4__this = this
			};
		}

		private void DoDeferredInit()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_harmony = new Harmony("dev.empress.omnium");
			SceneManager.sceneLoaded += OnSceneLoaded;
			TryRegisterWithRepoLib();
			if (DetectAnotherOmniumAssembly())
			{
				_disableInputHijack.Value = true;
				((BaseUnityPlugin)this).Logger.LogWarning((object)"[Omnium] Detected another Omnium-like plugin. Input hijack kill-switch ENABLED automatically to prevent conflicts.");
			}
			_ui = new OmniumUI(this, _toggleKey, _freeCamKey, _noclipKey, _respectRepoLib, _disableInputHijack);
			_initialized = true;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Omnium 2.2.0 initialized (GUID: dev.empress.omnium).");
		}

		private bool IsRepoLibStillLoading(out string reason)
		{
			reason = "REPOLib not detected";
			Type type = FindTypeByFullName("REPOLib.BundleLoader");
			if (type == null)
			{
				return false;
			}
			try
			{
				if (type.GetField("_operations", BindingFlags.Static | BindingFlags.NonPublic)?.GetValue(null) is ICollection collection)
				{
					reason = $"operations={collection.Count}";
					return collection.Count > 0;
				}
			}
			catch
			{
			}
			reason = "REPOLib present, state unknown";
			return false;
		}

		private static Type FindTypeByFullName(string fullName)
		{
			Type type = TypeCache.FindType(fullName);
			if (type != null)
			{
				return type;
			}
			try
			{
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				foreach (Assembly assembly in assemblies)
				{
					try
					{
						Type type2 = assembly.GetType(fullName, throwOnError: false);
						if (type2 != null)
						{
							return type2;
						}
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
			return null;
		}

		private void OnDestroy()
		{
			try
			{
				Harmony harmony = _harmony;
				if (harmony != null)
				{
					harmony.UnpatchSelf();
				}
			}
			catch
			{
			}
			try
			{
				SceneManager.sceneLoaded -= OnSceneLoaded;
			}
			catch
			{
			}
		}

		private void Update()
		{
			//IL_0019: 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)
			if (_ui != null)
			{
				if (Input.GetKeyDown(_toggleKey.Value))
				{
					_ui.ToggleUiOrCloseAll();
				}
				if (Input.GetKeyDown(_freeCamKey.Value))
				{
					_ui.ToggleFreeCam();
				}
				if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)286))
				{
					_ui.QuickSavePos();
				}
				if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)290))
				{
					_ui.QuickLoadPos();
				}
				_ui.OnUpdate();
			}
		}

		private void OnGUI()
		{
			_ui?.OnGUI();
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0013: 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)
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Scene loaded: {((Scene)(ref scene)).name} ({mode}).");
			_ui?.OnSceneLoaded(scene);
			if (_openOnSceneLoad.Value)
			{
				_ui.ShowMainWindow();
			}
		}

		private void TryRegisterWithRepoLib()
		{
			try
			{
				Type type = Type.GetType("RepoLib.Core, RepoLib", throwOnError: false);
				if (!(type == null))
				{
					type.GetMethod("RegisterService", BindingFlags.Static | BindingFlags.Public)?.Invoke(null, new object[3] { "Omnium", "2.2.0", "dev.empress.omnium" });
					((BaseUnityPlugin)this).Logger.LogInfo((object)"Registered Omnium with RepoLib.Core (optional).");
				}
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("[dbg] RepoLib register failed: " + ex.Message));
			}
		}

		private bool DetectAnotherOmniumAssembly()
		{
			try
			{
				Assembly assembly = typeof(OmniumPlugin).Assembly;
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				foreach (Assembly assembly2 in assemblies)
				{
					if (!(assembly2 == null) && !(assembly2 == assembly))
					{
						string text = "";
						try
						{
							text = assembly2.GetName().Name ?? "";
						}
						catch
						{
						}
						if (!string.IsNullOrEmpty(text) && text.IndexOf("OmniumLib", StringComparison.OrdinalIgnoreCase) < 0 && !text.Equals("OmniumLibrary", StringComparison.OrdinalIgnoreCase) && (text.IndexOf("Omnium", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Omniscye", StringComparison.OrdinalIgnoreCase) >= 0))
						{
							return true;
						}
					}
				}
			}
			catch
			{
			}
			return false;
		}

		public void LogInfo(string msg)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)msg);
		}

		public void LogWarn(string msg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)msg);
		}

		public void LogErr(string msg)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)msg);
		}
	}
	internal sealed class OmniumUI
	{
		[Serializable]
		private class ProfileDto
		{
			public float freeCamSpeed;

			public float freeCamSensitivity;

			public float freeCamFov;

			public bool lockCursor;

			public Dictionary<string, float[]> windowRects;
		}

		private readonly OmniumPlugin _plugin;

		private readonly ConfigEntry<KeyCode> _toggleKey;

		private readonly ConfigEntry<KeyCode> _freeCamKey;

		private readonly ConfigEntry<KeyCode> _noclipKey;

		private readonly ConfigEntry<bool> _respectRepoLib;

		private readonly ConfigEntry<bool> _disableInputHijack;

		private bool _mainWindowVisible;

		private readonly Dictionary<string, bool> _tabWindows = new Dictionary<string, bool>();

		private readonly Dictionary<string, Rect> _windowRects = new Dictionary<string, Rect>();

		private int _nextWindowId = 100;

		private GUIStyle _windowStyle;

		private GUIStyle _buttonStyle;

		private GUIStyle _toggleStyle;

		private GUIStyle _labelStyle;

		private GUIStyle _h1Style;

		private GUIStyle _textFieldStyle;

		private GUIStyle _sliderStyle;

		private GUIStyle _boxStyle;

		private GUIStyle _sliderThumbStyle;

		private GUIStyle _hScrollbarStyle;

		private GUIStyle _hScrollbarThumbStyle;

		private GUIStyle _vScrollbarStyle;

		private GUIStyle _vScrollbarThumbStyle;

		private bool _stylesInitialized;

		private Texture2D _blackTex;

		private Texture2D _black90Tex;

		private Texture2D _redTex;

		private Texture2D _redHoverTex;

		private Texture2D _dragStripTex;

		private Texture2D _trackOutlinedTex;

		private Texture2D _thumbTex;

		private Rect _mainWindowRect = new Rect(100f, 100f, 400f, 500f);

		private Vector2 _mainScroll;

		private readonly string[] _tabs = new string[10] { "Control", "Player", "Camera", "Teleport", "Spawn", "Objects", "Inspect", "Console", "Log", "Settings" };

		private float _timeScale = 1f;

		private bool _godMode;

		private bool _levelVis;

		private Vector3? _savedPos;

		private Quaternion? _savedRot;

		private string _objectSearch = string.Empty;

		private List<GameObject> _cachedObjects = new List<GameObject>();

		private DateTime _lastCache = DateTime.MinValue;

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

		private Vector2 _logScroll;

		private float _curWinW;

		private float _curWinH;

		private Vector2 _objectsScroll;

		private GameObject _selected;

		private bool _freeCam;

		private GameObject _freeCamGO;

		private Camera _freeCamCam;

		private Camera _mainCamCached;

		private float _freeCamSpeed = 8f;

		private float _freeCamBoost = 4f;

		private float _freeCamSensitivity = 2f;

		private float _freeCamFov = 60f;

		private bool _freeCamLockCursor = true;

		private Vector2 _freeCamRot;

		private bool _noclip;

		private CharacterController _cc;

		private Rigidbody _rb;

		private Collider[] _col;

		private bool _ccPrevCollide;

		private bool _rbPrevDetect;

		private bool _rbPrevKinematic;

		private readonly Dictionary<Collider, bool> _colPrevEnabled = new Dictionary<Collider, bool>();

		private string _consoleInput = string.Empty;

		private readonly Dictionary<string, Action<string[]>> _commands = new Dictionary<string, Action<string[]>>(StringComparer.OrdinalIgnoreCase);

		private Vector2 _consoleScroll;

		private bool _hijackActive;

		private CursorLockMode _prevCursorLock;

		private bool _prevCursorVisible;

		private CharacterController _hijackCC;

		private bool _hijackCCPrev;

		private Rigidbody _hijackRB;

		private bool _hijackRBPrevKinematic;

		private bool _hijackRBPrevDetect;

		private readonly List<Behaviour> _disabledBehaviours = new List<Behaviour>();

		private string ProfilePath => Path.Combine(Paths.ConfigPath, "Omnium.profile.json");

		public OmniumUI(OmniumPlugin plugin, ConfigEntry<KeyCode> toggleKey, ConfigEntry<KeyCode> freeCamKey, ConfigEntry<KeyCode> noclipKey, ConfigEntry<bool> respectRepoLib, ConfigEntry<bool> disableInputHijack)
		{
			//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_01c1: Unknown result type (might be due to invalid IL or missing references)
			_plugin = plugin;
			_toggleKey = toggleKey;
			_freeCamKey = freeCamKey;
			_noclipKey = noclipKey;
			_respectRepoLib = respectRepoLib;
			_disableInputHijack = disableInputHijack;
			float num = 120f;
			float num2 = 120f;
			for (int i = 0; i < _tabs.Length; i++)
			{
				_tabWindows[_tabs[i]] = false;
				_windowRects[_tabs[i]] = new Rect(num + (float)(i % 3 * 450), num2 + (float)(i / 3 * 350), 420f, 320f);
			}
			RegisterCommands();
			LoadProfile(log: false);
		}

		public void ToggleUiOrCloseAll()
		{
			if (IsAnyWindowOpen())
			{
				CloseAllWindows();
			}
			else
			{
				ShowMainWindow();
			}
		}

		public void ShowMainWindow()
		{
			_mainWindowVisible = true;
		}

		private void HideMainWindow()
		{
			_mainWindowVisible = false;
		}

		private void CloseAllWindows()
		{
			_mainWindowVisible = false;
			List<string> list = _tabWindows.Keys.ToList();
			foreach (string item in list)
			{
				_tabWindows[item] = false;
			}
		}

		public bool IsAnyWindowOpen()
		{
			if (_mainWindowVisible)
			{
				return true;
			}
			foreach (bool value in _tabWindows.Values)
			{
				if (value)
				{
					return true;
				}
			}
			return false;
		}

		public void OnSceneLoaded(Scene scene)
		{
			LogEvent("Scene loaded: " + ((Scene)(ref scene)).name);
			_savedPos = null;
			_savedRot = null;
			_cachedObjects.Clear();
			_lastCache = DateTime.MinValue;
			CloseAllWindows();
			if (_levelVis)
			{
				try
				{
					LevelDebugVis.Enable(true);
					LevelDebugVis.Rebuild();
				}
				catch
				{
				}
			}
		}

		public void OnUpdate()
		{
			bool flag = !_disableInputHijack.Value && IsAnyWindowOpen();
			if (flag && !_hijackActive)
			{
				BeginInputHijack();
			}
			else if ((!flag && _hijackActive) || (_disableInputHijack.Value && _hijackActive))
			{
				EndInputHijack();
			}
			Time.timeScale = Mathf.Clamp(_timeScale, 0f, 8f);
			if (_freeCam)
			{
				UpdateFreeCam();
			}
		}

		public void OnGUI()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0052: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_0117: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			if (!_stylesInitialized)
			{
				InitializeStyles();
			}
			ApplyGlobalSkin();
			bool flag = IsAnyWindowOpen();
			if (_mainWindowVisible)
			{
				_mainWindowRect = GUI.Window(_nextWindowId, _mainWindowRect, new WindowFunction(DrawMainWindow), "OMNIUM v2.2.0 - Debug Toolkit", _windowStyle);
				_mainWindowRect = ClampToScreen(_mainWindowRect);
			}
			string[] tabs = _tabs;
			foreach (string tab in tabs)
			{
				if (_tabWindows[tab])
				{
					int num = _nextWindowId + Array.IndexOf(_tabs, tab) + 1;
					_windowRects[tab] = GUI.Window(num, _windowRects[tab], (WindowFunction)delegate(int id)
					{
						DrawTabWindow(tab, id);
					}, "OMNIUM - " + tab, _windowStyle);
					_windowRects[tab] = ClampToScreen(_windowRects[tab]);
				}
			}
			if (_freeCam && !flag)
			{
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(20f, 20f, 560f, 90f);
				GUI.Box(val, "", _boxStyle);
				GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 10f, ((Rect)(ref val)).width - 20f, ((Rect)(ref val)).height - 20f));
				GUILayout.Label("<color=#ff0000>FreeCam Active</color>", _h1Style, Array.Empty<GUILayoutOption>());
				GUILayout.Label($"Controls: WASD+QE | Mouse look | Shift Boost | Toggle: {_freeCamKey.Value}", _labelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label($"Speed: {_freeCamSpeed:F1} | FOV: {_freeCamFov:F0}", _labelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndArea();
			}
		}

		private void InitializeStyles()
		{
			//IL_0070: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: 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_01a0: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Expected O, but got Unknown
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_0204: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Expected O, but got Unknown
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Expected O, but got Unknown
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Expected O, but got Unknown
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Expected O, but got Unknown
			//IL_0331: Expected O, but got Unknown
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Expected O, but got Unknown
			//IL_03a4: Expected O, but got Unknown
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Expected O, but got Unknown
			//IL_03db: Expected O, but got Unknown
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Expected O, but got Unknown
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0428: Expected O, but got Unknown
			//IL_042e: Expected O, but got Unknown
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Expected O, but got Unknown
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: Expected O, but got Unknown
			//IL_04a5: Expected O, but got Unknown
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Expected O, but got Unknown
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Expected O, but got Unknown
			//IL_04f8: Expected O, but got Unknown
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: Expected O, but got Unknown
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Expected O, but got Unknown
			//IL_056f: Expected O, but got Unknown
			Color val = default(Color);
			((Color)(ref val))..ctor(0f, 0f, 0f, 0.85f);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0.9f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(1f, 0f, 0f, 1f);
			Color c = default(Color);
			((Color)(ref c))..ctor(1f, 0.1f, 0.1f, 1f);
			_blackTex = MakeTex(8, 8, val);
			_black90Tex = MakeTex(8, 8, val2);
			_redTex = MakeTex(8, 8, val3);
			_redHoverTex = MakeTex(8, 8, c);
			_dragStripTex = MakeTex(8, 2, val3);
			_trackOutlinedTex = MakeOutlinedTex(8, 8, val, val3);
			_thumbTex = MakeOutlinedTex(8, 8, val3, val2);
			GUIStyle val4 = new GUIStyle(GUI.skin.window);
			val4.normal.background = _black90Tex;
			val4.normal.textColor = val3;
			val4.onNormal.background = _black90Tex;
			val4.onNormal.textColor = val3;
			val4.padding = new RectOffset(15, 15, 25, 15);
			val4.border = new RectOffset(8, 8, 8, 8);
			val4.fontSize = 14;
			val4.fontStyle = (FontStyle)1;
			_windowStyle = val4;
			GUIStyle val5 = new GUIStyle(GUI.skin.button);
			val5.normal.background = _blackTex;
			val5.normal.textColor = val3;
			val5.hover.background = _redHoverTex;
			val5.hover.textColor = Color.white;
			val5.active.background = _redTex;
			val5.active.textColor = Color.white;
			val5.alignment = (TextAnchor)4;
			val5.fontSize = 14;
			val5.border = new RectOffset(2, 2, 2, 2);
			val5.padding = new RectOffset(8, 8, 6, 6);
			_buttonStyle = val5;
			GUIStyle val6 = new GUIStyle(GUI.skin.toggle);
			val6.normal.textColor = val3;
			val6.onNormal.textColor = val3;
			val6.fontSize = 14;
			_toggleStyle = val6;
			GUIStyle val7 = new GUIStyle(GUI.skin.label)
			{
				richText = true,
				fontSize = 14
			};
			val7.normal.textColor = Color.white;
			_labelStyle = val7;
			_h1Style = new GUIStyle(_labelStyle)
			{
				fontSize = 18,
				fontStyle = (FontStyle)1
			};
			GUIStyle val8 = new GUIStyle(GUI.skin.textField);
			val8.normal.background = _blackTex;
			val8.normal.textColor = Color.white;
			val8.alignment = (TextAnchor)3;
			val8.fontSize = 14;
			_textFieldStyle = val8;
			GUIStyle val9 = new GUIStyle(GUI.skin.horizontalSlider);
			val9.normal.background = _trackOutlinedTex;
			val9.fixedHeight = 14f;
			val9.border = new RectOffset(2, 2, 2, 2);
			val9.padding = new RectOffset(2, 2, 2, 2);
			_sliderStyle = val9;
			GUIStyle val10 = new GUIStyle(GUI.skin.horizontalSliderThumb);
			val10.normal.background = _thumbTex;
			val10.hover.background = _redHoverTex;
			val10.active.background = _redTex;
			val10.fixedWidth = 22f;
			val10.fixedHeight = 22f;
			val10.border = new RectOffset(2, 2, 2, 2);
			_sliderThumbStyle = val10;
			GUIStyle val11 = new GUIStyle(GUI.skin.box);
			val11.normal.background = _black90Tex;
			val11.border = new RectOffset(4, 4, 4, 4);
			_boxStyle = val11;
			GUIStyle val12 = new GUIStyle(GUI.skin.horizontalScrollbar);
			val12.normal.background = _trackOutlinedTex;
			val12.fixedHeight = 14f;
			val12.border = new RectOffset(2, 2, 2, 2);
			val12.padding = new RectOffset(2, 2, 2, 2);
			_hScrollbarStyle = val12;
			GUIStyle val13 = new GUIStyle(GUI.skin.horizontalScrollbarThumb);
			val13.normal.background = _thumbTex;
			val13.hover.background = _redHoverTex;
			val13.active.background = _redTex;
			val13.fixedHeight = 14f;
			val13.border = new RectOffset(2, 2, 2, 2);
			val13.padding = new RectOffset(2, 2, 2, 2);
			_hScrollbarThumbStyle = val13;
			GUIStyle val14 = new GUIStyle(GUI.skin.verticalScrollbar);
			val14.normal.background = _trackOutlinedTex;
			val14.fixedWidth = 14f;
			val14.border = new RectOffset(2, 2, 2, 2);
			val14.padding = new RectOffset(2, 2, 2, 2);
			_vScrollbarStyle = val14;
			GUIStyle val15 = new GUIStyle(GUI.skin.verticalScrollbarThumb);
			val15.normal.background = _thumbTex;
			val15.hover.background = _redHoverTex;
			val15.active.background = _redTex;
			val15.fixedWidth = 14f;
			val15.border = new RectOffset(2, 2, 2, 2);
			val15.padding = new RectOffset(2, 2, 2, 2);
			_vScrollbarThumbStyle = val15;
			_stylesInitialized = true;
		}

		private void ApplyGlobalSkin()
		{
			GUI.skin.horizontalScrollbar = _hScrollbarStyle;
			GUI.skin.horizontalScrollbarThumb = _hScrollbarThumbStyle;
			GUI.skin.verticalScrollbar = _vScrollbarStyle;
			GUI.skin.verticalScrollbarThumb = _vScrollbarThumbStyle;
		}

		private void DrawTopDragStrip(float width)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_dragStripTex != (Object)null)
			{
				GUI.DrawTexture(new Rect(0f, 0f, Mathf.Max(0f, width), 3f), (Texture)(object)_dragStripTex);
			}
		}

		private static Rect ClampToScreen(Rect r)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				float num = Mathf.Max(50f, (float)Screen.width);
				float num2 = Mathf.Max(50f, (float)Screen.height);
				if (((Rect)(ref r)).width > num)
				{
					((Rect)(ref r)).width = num;
				}
				if (((Rect)(ref r)).height > num2)
				{
					((Rect)(ref r)).height = num2;
				}
				((Rect)(ref r)).x = Mathf.Clamp(((Rect)(ref r)).x, 0f, num - ((Rect)(ref r)).width);
				((Rect)(ref r)).y = Mathf.Clamp(((Rect)(ref r)).y, 0f, num2 - ((Rect)(ref r)).height);
			}
			catch
			{
			}
			return r;
		}

		private void DrawMainWindow(int id)
		{
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			DrawTopDragStrip(((Rect)(ref _mainWindowRect)).width);
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("<color=#ff0000>OMNIUM</color> v2.2.0", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("×", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(30f),
				GUILayout.Height(25f)
			}))
			{
				HideMainWindow();
			}
			GUILayout.EndHorizontal();
			GUILayout.Label("Is this tool <i>advanced</i>? Let’s just say it has more toggles than a space raccoon’s backpack.", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUILayout.Label("<color=#ff0000>Quick Controls</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("FreeCam " + (_freeCam ? "ON" : "OFF"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				ToggleFreeCam();
			}
			if (GUILayout.Button("God Mode " + (_godMode ? "ON" : "OFF"), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				_godMode = !_godMode;
				TrySetGodMode(_godMode);
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(15f);
			GUILayout.Label("<color=#ff0000>Tool Windows</color>", _h1Style, Array.Empty<GUILayoutOption>());
			_mainScroll = GUILayout.BeginScrollView(_mainScroll, Array.Empty<GUILayoutOption>());
			for (int i = 0; i < _tabs.Length; i += 2)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				string text = _tabs[i];
				bool flag = _tabWindows[text];
				string text2 = text + " " + (flag ? "●" : "○");
				if (GUILayout.Button(text2, _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(35f) }))
				{
					_tabWindows[text] = !_tabWindows[text];
				}
				if (i + 1 < _tabs.Length)
				{
					string text3 = _tabs[i + 1];
					bool flag2 = _tabWindows[text3];
					string text4 = text3 + " " + (flag2 ? "●" : "○");
					if (GUILayout.Button(text4, _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(35f) }))
					{
						_tabWindows[text3] = !_tabWindows[text3];
					}
				}
				GUILayout.EndHorizontal();
				GUILayout.Space(5f);
			}
			GUILayout.EndScrollView();
			GUILayout.Space(10f);
			GUILayout.Label($"<color=#888888>Toggle UI: {_toggleKey.Value} | FreeCam: {_freeCamKey.Value}</color>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndVertical();
			GUI.DragWindow(new Rect(0f, 0f, 9999f, 25f));
		}

		private void DrawTabWindow(string tabName, int id)
		{
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			if (_windowRects.TryGetValue(tabName, out var value))
			{
				DrawTopDragStrip(((Rect)(ref value)).width);
				float width = ((Rect)(ref value)).width;
				GUIStyle windowStyle = _windowStyle;
				int? obj;
				if (windowStyle == null)
				{
					obj = null;
				}
				else
				{
					RectOffset padding = windowStyle.padding;
					obj = ((padding != null) ? new int?(padding.left) : null);
				}
				int? num = obj;
				float num2 = width - (float)num.GetValueOrDefault(15);
				GUIStyle windowStyle2 = _windowStyle;
				int? obj2;
				if (windowStyle2 == null)
				{
					obj2 = null;
				}
				else
				{
					RectOffset padding2 = windowStyle2.padding;
					obj2 = ((padding2 != null) ? new int?(padding2.right) : null);
				}
				num = obj2;
				_curWinW = num2 - (float)num.GetValueOrDefault(15);
				float height = ((Rect)(ref value)).height;
				GUIStyle windowStyle3 = _windowStyle;
				int? obj3;
				if (windowStyle3 == null)
				{
					obj3 = null;
				}
				else
				{
					RectOffset padding3 = windowStyle3.padding;
					obj3 = ((padding3 != null) ? new int?(padding3.top) : null);
				}
				num = obj3;
				float num3 = height - (float)num.GetValueOrDefault(25);
				GUIStyle windowStyle4 = _windowStyle;
				int? obj4;
				if (windowStyle4 == null)
				{
					obj4 = null;
				}
				else
				{
					RectOffset padding4 = windowStyle4.padding;
					obj4 = ((padding4 != null) ? new int?(padding4.bottom) : null);
				}
				num = obj4;
				_curWinH = num3 - (float)num.GetValueOrDefault(15);
			}
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("<color=#ff0000>" + tabName + "</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("×", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(25f),
				GUILayout.Height(25f)
			}))
			{
				_tabWindows[tabName] = false;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			switch (tabName)
			{
			case "Control":
				DrawControlContent();
				break;
			case "Player":
				DrawPlayerContent();
				break;
			case "Camera":
				DrawCameraContent();
				break;
			case "Teleport":
				DrawTeleportContent();
				break;
			case "Spawn":
				DrawSpawnContent();
				break;
			case "Objects":
				DrawObjectsContent();
				break;
			case "Inspect":
				DrawInspectContent();
				break;
			case "Console":
				DrawConsoleContent();
				break;
			case "Log":
				DrawLogContent();
				break;
			case "Settings":
				DrawSettingsContent();
				break;
			}
			GUILayout.EndVertical();
			GUI.DragWindow(new Rect(0f, 0f, 9999f, 25f));
		}

		private void DrawControlContent()
		{
			GUILayout.Label("<color=#ff0000>Runtime Controls</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Time Scale", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			_timeScale = GUILayout.HorizontalSlider(_timeScale, 0f, 8f, _sliderStyle, _sliderThumbStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			GUILayout.Label(_timeScale.ToString("0.00"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Reset", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }))
			{
				_timeScale = 1f;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			bool flag = GUILayout.Toggle(_godMode, "God Mode (Damage Immunity)", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag != _godMode)
			{
				_godMode = flag;
				TrySetGodMode(_godMode);
			}
			if (GUILayout.Button("Refresh Damage Systems", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				TrySetGodMode(_godMode, forceRefresh: true);
			}
			GUILayout.Space(15f);
			GUILayout.Label("<color=#ff0000>Visualizers</color>", _h1Style, Array.Empty<GUILayoutOption>());
			bool flag2 = GUILayout.Toggle(_levelVis, "Level Markers + Paths (path points glow red)", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag2 != _levelVis)
			{
				_levelVis = flag2;
				try
				{
					if (_levelVis)
					{
						LevelDebugVis.Enable(true);
						LevelDebugVis.Rebuild();
					}
					else
					{
						LevelDebugVis.Enable(false);
					}
				}
				catch (Exception ex)
				{
					_plugin.LogErr("Visualizer toggle failed: " + ex);
				}
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Refresh Markers", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
			{
				try
				{
					if (_levelVis)
					{
						LevelDebugVis.Rebuild();
					}
				}
				catch (Exception ex2)
				{
					_plugin.LogErr("Vis rebuild failed: " + ex2);
				}
			}
			if (GUILayout.Button("Hide Markers", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
			{
				try
				{
					LevelDebugVis.Enable(false);
					_levelVis = false;
				}
				catch (Exception ex3)
				{
					_plugin.LogErr("Vis hide failed: " + ex3);
				}
			}
			GUILayout.EndHorizontal();
		}

		private void DrawPlayerContent()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<color=#ff0000>Player Controls</color>", _h1Style, Array.Empty<GUILayoutOption>());
			Transform val = TryGetPlayerTransform(log: true);
			if (Object.op_Implicit((Object)(object)val))
			{
				GUILayout.Label("<color=#88ff88>Player Found:</color> " + ((Object)val).name, _labelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label($"<color=#88ff88>Position:</color> {val.position}", _labelStyle, Array.Empty<GUILayoutOption>());
			}
			else
			{
				GUILayout.Label("<color=#ffff88>Player transform not found</color>", _labelStyle, Array.Empty<GUILayoutOption>());
			}
			GUILayout.Space(10f);
			bool flag = GUILayout.Toggle(_godMode, "God Mode", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag != _godMode)
			{
				_godMode = flag;
				TrySetGodMode(_godMode);
			}
			GUILayout.Space(15f);
			GUILayout.Label("<color=#ff0000>Movement Speed Modifiers</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Attempts to modify common speed fields", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Half Speed", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				TrySetMoveSpeed(0.5f);
			}
			if (GUILayout.Button("Normal", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				TrySetMoveSpeed(1f);
			}
			if (GUILayout.Button("Double", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				TrySetMoveSpeed(2f);
			}
			if (GUILayout.Button("Quad", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				TrySetMoveSpeed(4f);
			}
			GUILayout.EndHorizontal();
		}

		private void DrawCameraContent()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<color=#ff0000>Camera Controls</color>", _h1Style, Array.Empty<GUILayoutOption>());
			bool flag = GUILayout.Toggle(_freeCam, $"FreeCam (Key: {_freeCamKey.Value})", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag != _freeCam)
			{
				ToggleFreeCam();
			}
			GUILayout.Space(10f);
			GUILayout.Label("<color=#ff0000>FreeCam Settings</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Speed", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			_freeCamSpeed = GUILayout.HorizontalSlider(_freeCamSpeed, 1f, 40f, _sliderStyle, _sliderThumbStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			GUILayout.Label(_freeCamSpeed.ToString("0.0"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("FOV", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			_freeCamFov = GUILayout.HorizontalSlider(_freeCamFov, 20f, 110f, _sliderStyle, _sliderThumbStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			GUILayout.Label(_freeCamFov.ToString("0"), _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
			if (GUILayout.Button("Apply FOV to Active Camera", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(220f),
				GUILayout.Height(26f)
			}))
			{
				ApplyFov();
			}
			GUILayout.EndHorizontal();
			_freeCamLockCursor = GUILayout.Toggle(_freeCamLockCursor, "Lock cursor during FreeCam", _toggleStyle, Array.Empty<GUILayoutOption>());
		}

		private void DrawTeleportContent()
		{
			//IL_004c: 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_0077: 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_00cc: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<color=#ff0000>Teleportation</color>", _h1Style, Array.Empty<GUILayoutOption>());
			Transform val = TryGetPlayerTransform(log: true);
			if ((Object)(object)val == (Object)null)
			{
				GUILayout.Label("<color=#ffff88>Player not found. Enter gameplay first.</color>", _labelStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			GUILayout.Label($"<color=#88ff88>Position:</color> {val.position:F2}", _labelStyle, Array.Empty<GUILayoutOption>());
			Quaternion rotation = val.rotation;
			GUILayout.Label($"<color=#88ff88>Rotation:</color> {((Quaternion)(ref rotation)).eulerAngles:F1}", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Save Position", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				_savedPos = val.position;
				_savedRot = val.rotation;
				LogEvent("Position saved");
			}
			if (GUILayout.Button("Load Position", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				if (_savedPos.HasValue && _savedRot.HasValue)
				{
					val.position = _savedPos.Value;
					val.rotation = _savedRot.Value;
					LogEvent("Position loaded");
				}
				else
				{
					LogEvent("No saved position");
				}
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.Label("<color=#ff0000>Quick Teleports</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Respawn (Truck Safe Zone)", _buttonStyle, Array.Empty<GUILayoutOption>()) && !TryTeleportTruckSafe(val))
			{
				LogEvent("TruckSafetySpawnPoint not found — trying tag 'Respawn'");
				TeleportToTag(val, "Respawn");
			}
			if (GUILayout.Button("Checkpoint", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				TeleportToTag(val, "Checkpoint");
			}
			if (GUILayout.Button("Finish Line", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				TeleportToTag(val, "Finish");
			}
			GUILayout.EndHorizontal();
		}

		private void DrawSpawnContent()
		{
			GUILayout.Label("<color=#ff0000>Object Spawning</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Spawn Unity primitives at camera position", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Cube", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				SpawnPrimitive((PrimitiveType)3);
			}
			if (GUILayout.Button("Sphere", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				SpawnPrimitive((PrimitiveType)0);
			}
			if (GUILayout.Button("Capsule", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				SpawnPrimitive((PrimitiveType)1);
			}
			if (GUILayout.Button("Cylinder", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				SpawnPrimitive((PrimitiveType)2);
			}
			if (GUILayout.Button("Plane", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				SpawnPrimitive((PrimitiveType)4);
			}
			GUILayout.EndHorizontal();
			if ((Object)(object)_selected != (Object)null)
			{
				GUILayout.Space(15f);
				GUILayout.Label("<color=#88ff88>Selected:</color> " + ((Object)_selected).name, _labelStyle, Array.Empty<GUILayoutOption>());
				if (GUILayout.Button("Destroy Selected Object", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
				{
					Object.Destroy((Object)(object)_selected);
					_selected = null;
					LogEvent("Selected object destroyed");
				}
			}
		}

		private void DrawObjectsContent()
		{
			//IL_00f3: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<color=#ff0000>Scene Objects</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Search:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			_objectSearch = GUILayout.TextField(_objectSearch ?? string.Empty, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(200f) });
			if (GUILayout.Button("Refresh Object Cache", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
			{
				RebuildObjectCache(force: true);
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			RebuildObjectCache();
			float num = Mathf.Max(120f, _curWinW - 10f);
			float num2 = Mathf.Max(140f, _curWinH - 180f);
			Rect rect = GUILayoutUtility.GetRect(num, num2);
			_objectsScroll = GUI.BeginScrollView(rect, _objectsScroll, new Rect(0f, 0f, num - 20f, (float)(_cachedObjects.Count * 25)));
			IEnumerable<GameObject> source = _cachedObjects;
			if (!string.IsNullOrEmpty(_objectSearch))
			{
				string searchLower = _objectSearch.ToLowerInvariant();
				source = source.Where((GameObject go) => Object.op_Implicit((Object)(object)go) && ((Object)go).name != null && ((Object)go).name.ToLowerInvariant().Contains(searchLower));
			}
			int num3 = 0;
			Rect val = default(Rect);
			Rect val2 = default(Rect);
			Rect val3 = default(Rect);
			Rect val4 = default(Rect);
			Rect val5 = default(Rect);
			foreach (GameObject item in source.Take(200))
			{
				if (Object.op_Implicit((Object)(object)item))
				{
					float num4 = num - 20f;
					((Rect)(ref val))..ctor(0f, (float)num3, num4, 23f);
					GUI.Box(val, "", _boxStyle);
					((Rect)(ref val2))..ctor(5f, (float)(num3 + 2), Mathf.Max(100f, num4 - 170f), 20f);
					GUI.Label(val2, ((Object)item).name, _labelStyle);
					((Rect)(ref val3))..ctor(num4 - 155f, (float)(num3 + 2), 80f, 20f);
					GUI.Label(val3, item.activeInHierarchy ? "<color=#88ff88>Active</color>" : "<color=#ff8888>Inactive</color>", _labelStyle);
					((Rect)(ref val4))..ctor(num4 - 95f, (float)(num3 + 1), 50f, 22f);
					if (GUI.Button(val4, "Select", _buttonStyle))
					{
						_selected = item;
						LogEvent("Selected: " + ((Object)item).name);
					}
					((Rect)(ref val5))..ctor(num4 - 45f, (float)(num3 + 1), 45f, 22f);
					if (GUI.Button(val5, item.activeSelf ? "Hide" : "Show", _buttonStyle))
					{
						item.SetActive(!item.activeSelf);
					}
					num3 += 25;
				}
			}
			GUI.EndScrollView();
			GUILayout.Space(10f);
			int val6 = source.Count();
			GUILayout.Label($"<color=#888888>Showing {Math.Min(val6, 200)} of {_cachedObjects.Count} objects</color>", _labelStyle, Array.Empty<GUILayoutOption>());
		}

		private void DrawInspectContent()
		{
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: 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_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<color=#ff0000>Object Inspector</color>", _h1Style, Array.Empty<GUILayoutOption>());
			if (!Object.op_Implicit((Object)(object)_selected))
			{
				GUILayout.Label("<color=#ffff88>No object selected</color>", _labelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("Use the Objects window to select an object", _labelStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			GUILayout.Label("<color=#88ff88>Object:</color> " + ((Object)_selected).name, _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("<color=#88ff88>Path:</color> " + GetPath(_selected.transform), _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button(_selected.activeSelf ? "Disable Object" : "Enable Object", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				_selected.SetActive(!_selected.activeSelf);
			}
			if (GUILayout.Button("Destroy Object", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				Object.Destroy((Object)(object)_selected);
				_selected = null;
				LogEvent("Object destroyed");
				return;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(15f);
			GUILayout.Label("<color=#ff0000>Components</color>", _h1Style, Array.Empty<GUILayoutOption>());
			float num = Mathf.Max(120f, _curWinW - 10f);
			float num2 = Mathf.Max(140f, _curWinH - 260f);
			Rect rect = GUILayoutUtility.GetRect(num, num2);
			Vector2 zero = Vector2.zero;
			zero = GUI.BeginScrollView(rect, zero, new Rect(0f, 0f, num - 20f, 500f));
			Component[] components = _selected.GetComponents<Component>();
			int num3 = 0;
			Component[] array = components;
			Rect val2 = default(Rect);
			foreach (Component val in array)
			{
				if (!Object.op_Implicit((Object)(object)val))
				{
					continue;
				}
				float num4 = num - 20f;
				((Rect)(ref val2))..ctor(0f, (float)num3, num4, 30f);
				GUI.Box(val2, "", _boxStyle);
				GUI.Label(new Rect(5f, (float)(num3 + 5), num4 - 90f, 20f), "<color=#ff0000>" + ((object)val).GetType().Name + "</color>", _labelStyle);
				Behaviour val3 = (Behaviour)(object)((val is Behaviour) ? val : null);
				if ((Object)(object)val3 != (Object)null)
				{
					bool flag = GUI.Toggle(new Rect(num4 - 85f, (float)(num3 + 5), 80f, 20f), val3.enabled, "Enabled", _toggleStyle);
					if (flag != val3.enabled)
					{
						val3.enabled = flag;
					}
				}
				num3 += 35;
			}
			GUI.EndScrollView();
		}

		private void DrawConsoleContent()
		{
			//IL_0047: 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_004e: 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_0075: 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)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<color=#ff0000>Command Console</color>", _h1Style, Array.Empty<GUILayoutOption>());
			float num = Mathf.Max(100f, _curWinW - 10f);
			float num2 = Mathf.Max(120f, _curWinH - 160f);
			Rect rect = GUILayoutUtility.GetRect(num, num2);
			_consoleScroll = GUI.BeginScrollView(rect, _consoleScroll, new Rect(0f, 0f, num - 20f, (float)(_eventLog.Count * 16)));
			int num3 = 0;
			int num4 = Mathf.Max(0, _eventLog.Count - 200);
			for (int i = num4; i < _eventLog.Count; i++)
			{
				GUI.Label(new Rect(5f, (float)num3, num - 30f, 16f), _eventLog[i], _labelStyle);
				num3 += 16;
			}
			GUI.EndScrollView();
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			_consoleInput = GUILayout.TextField(_consoleInput ?? string.Empty, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(280f) });
			if (GUILayout.Button("Execute", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(80f),
				GUILayout.Height(25f)
			}))
			{
				RunConsole(_consoleInput);
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(5f);
			GUILayout.Label("<color=#888888>Commands: help | tp x y z | ts value | god on/off | freecam on/off | noclip on/off</color>", _labelStyle, Array.Empty<GUILayoutOption>());
		}

		private void DrawLogContent()
		{
			//IL_0047: 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_004e: 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_0075: 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)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<color=#ff0000>Event Log</color>", _h1Style, Array.Empty<GUILayoutOption>());
			float num = Mathf.Max(100f, _curWinW - 10f);
			float num2 = Mathf.Max(120f, _curWinH - 140f);
			Rect rect = GUILayoutUtility.GetRect(num, num2);
			_logScroll = GUI.BeginScrollView(rect, _logScroll, new Rect(0f, 0f, num - 20f, (float)(_eventLog.Count * 16)));
			int num3 = 0;
			int num4 = Mathf.Max(0, _eventLog.Count - 300);
			for (int i = num4; i < _eventLog.Count; i++)
			{
				GUI.Label(new Rect(5f, (float)num3, num - 30f, 16f), _eventLog[i], _labelStyle);
				num3 += 16;
			}
			GUI.EndScrollView();
			GUILayout.Space(10f);
			if (GUILayout.Button("Clear Event Log", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				_eventLog.Clear();
			}
		}

		private void DrawSettingsContent()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<color=#ff0000>Configuration</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Settings persist via BepInEx configuration", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUILayout.Label("<color=#ff0000>Hotkeys</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Toggle UI: <color=#88ff88>{_toggleKey.Value}</color>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label($"FreeCam: <color=#88ff88>{_freeCamKey.Value}</color>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Quick Save: <color=#88ff88>Ctrl + F5</color>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Quick Load: <color=#88ff88>Ctrl + F9</color>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			bool flag = GUILayout.Toggle(_respectRepoLib.Value, "Respect RepoLib/Bundle/Mod loaders while UI is open", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag != _respectRepoLib.Value)
			{
				_respectRepoLib.Value = flag;
				LogEvent($"RespectRepoLib set to {flag}");
			}
			bool flag2 = GUILayout.Toggle(_disableInputHijack.Value, "Disable Input Hijack entirely (recommended if using loaders like REPOLib)", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (flag2 != _disableInputHijack.Value)
			{
				_disableInputHijack.Value = flag2;
				if (flag2 && _hijackActive)
				{
					EndInputHijack();
				}
				LogEvent($"DisableInputHijack set to {flag2}");
			}
			GUILayout.Space(15f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Save Profile", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				SaveProfile();
			}
			if (GUILayout.Button("Load Profile", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				LoadProfile();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(15f);
			GUILayout.Label("<color=#ff0000>Technical Notes</color>", _h1Style, Array.Empty<GUILayoutOption>());
			GUILayout.Label("• God Mode modifies HurtCollider components", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("• Player detection uses multiple fallback methods (now asks OmniumLib first)", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("• FreeCam uses unscaled time for consistency", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("• Recommended for single-player use", _labelStyle, Array.Empty<GUILayoutOption>());
		}

		private void TrySetGodMode(bool enabled, bool forceRefresh = false)
		{
			try
			{
				Type type = FindTypeByName("HurtCollider");
				if (type == null)
				{
					LogEvent("HurtCollider type not found – God Mode unavailable");
					return;
				}
				Object[] array = Object.FindObjectsOfType(type);
				int num = 0;
				Object[] array2 = array;
				foreach (Object val in array2)
				{
					Behaviour val2 = (Behaviour)(object)((val is Behaviour) ? val : null);
					if (!Object.op_Implicit((Object)(object)val2))
					{
						continue;
					}
					FieldInfo field = type.GetField("invincible", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if (field != null)
					{
						field.SetValue(val, enabled);
						num++;
						continue;
					}
					PropertyInfo property = type.GetProperty("Invincible", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if (property != null && property.CanWrite)
					{
						property.SetValue(val, enabled);
						num++;
					}
					else if (forceRefresh || enabled)
					{
						val2.enabled = !enabled;
					}
				}
				LogEvent(string.Format("God Mode {0} for {1} damage components", enabled ? "enabled" : "disabled", num));
			}
			catch (Exception ex)
			{
				_plugin.LogErr("TrySetGodMode failed: " + ex);
			}
		}

		private Transform TryGetPlayerTransform(bool log = false)
		{
			Transform player = PlayerLocator.GetPlayer(false, log);
			if (Object.op_Implicit((Object)(object)player))
			{
				return player;
			}
			try
			{
				Type type = FindTypeByName("PlayerController");
				if (type != null)
				{
					object? obj = type.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
					Component val = (Component)((obj is Component) ? obj : null);
					if (Object.op_Implicit((Object)(object)val))
					{
						return val.transform;
					}
				}
				Type type2 = FindTypeByName("PlayerAvatar");
				if (type2 != null)
				{
					Object[] array = Object.FindObjectsOfType(type2);
					Object[] array2 = array;
					foreach (Object obj2 in array2)
					{
						bool flag = false;
						try
						{
							FieldInfo field = type2.GetField("isLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
							if (field != null)
							{
								flag = (bool)(field.GetValue(obj2) ?? ((object)false));
							}
						}
						catch
						{
						}
						if (flag)
						{
							object? obj4 = type2.GetField("playerTransform", BindingFlags.Instance | BindingFlags.Public)?.GetValue(obj2);
							Transform val2 = (Transform)((obj4 is Transform) ? obj4 : null);
							if (Object.op_Implicit((Object)(object)val2))
							{
								return val2;
							}
						}
					}
					if (array.Length != 0)
					{
						Object obj5 = array[0];
						Object obj6 = ((obj5 is Component) ? obj5 : null);
						return (obj6 != null) ? ((Component)obj6).transform : null;
					}
				}
				GameObject val3 = GameObject.FindGameObjectWithTag("Player");
				if (Object.op_Implicit((Object)(object)val3))
				{
					return val3.transform;
				}
				if (Object.op_Implicit((Object)(object)Camera.main))
				{
					return ((Component)Camera.main).transform.root;
				}
			}
			catch
			{
			}
			return null;
		}

		public void ToggleFreeCam()
		{
			_freeCam = !_freeCam;
			if (_freeCam)
			{
				EnableFreeCam();
			}
			else
			{
				DisableFreeCam();
			}
		}

		private void EnableFreeCam()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				_mainCamCached = Camera.main;
				if (!Object.op_Implicit((Object)(object)_freeCamGO))
				{
					_freeCamGO = new GameObject("OmniumFreeCam");
					Object.DontDestroyOnLoad((Object)(object)_freeCamGO);
					_freeCamCam = _freeCamGO.AddComponent<Camera>();
					_freeCamGO.AddComponent<AudioListener>();
				}
				if (Object.op_Implicit((Object)(object)_mainCamCached))
				{
					_freeCamCam.CopyFrom(_mainCamCached);
					_freeCamGO.transform.SetPositionAndRotation(((Component)_mainCamCached).transform.position, ((Component)_mainCamCached).transform.rotation);
					_freeCamFov = _mainCamCached.fieldOfView;
					_freeCamRot = new Vector2(_freeCamGO.transform.eulerAngles.x, _freeCamGO.transform.eulerAngles.y);
					((Behaviour)_mainCamCached).enabled = false;
					AudioListener component = ((Component)_mainCamCached).GetComponent<AudioListener>();
					if (Object.op_Implicit((Object)(object)component))
					{
						((Behaviour)component).enabled = false;
					}
				}
				AudioListener component2 = _freeCamGO.GetComponent<AudioListener>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					((Behaviour)component2).enabled = true;
				}
				((Behaviour)_freeCamCam).enabled = true;
				LogEvent("FreeCam ENABLED");
			}
			catch (Exception ex)
			{
				_plugin.LogErr("EnableFreeCam failed: " + ex);
				LogEvent("FreeCam enable failed - see console");
			}
		}

		private void DisableFreeCam()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Invalid comparison between Unknown and I4
			try
			{
				if (Object.op_Implicit((Object)(object)_freeCamCam))
				{
					((Behaviour)_freeCamCam).enabled = false;
				}
				AudioListener val = (Object.op_Implicit((Object)(object)_freeCamGO) ? _freeCamGO.GetComponent<AudioListener>() : null);
				if (Object.op_Implicit((Object)(object)val))
				{
					((Behaviour)val).enabled = false;
				}
				if (Object.op_Implicit((Object)(object)_mainCamCached))
				{
					((Behaviour)_mainCamCached).enabled = true;
					AudioListener component = ((Component)_mainCamCached).GetComponent<AudioListener>();
					if (Object.op_Implicit((Object)(object)component))
					{
						((Behaviour)component).enabled = true;
					}
				}
				if (_freeCamLockCursor && (int)Cursor.lockState == 1)
				{
					Cursor.lockState = (CursorLockMode)0;
				}
				if (_freeCamLockCursor)
				{
					Cursor.visible = true;
				}
				LogEvent("FreeCam DISABLED");
			}
			catch (Exception ex)
			{
				_plugin.LogErr("DisableFreeCam failed: " + ex);
				LogEvent("FreeCam disable failed - see console");
			}
		}

		private void UpdateFreeCam()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Invalid comparison between Unknown and I4
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)_freeCamGO) || !Object.op_Implicit((Object)(object)_freeCamCam))
			{
				return;
			}
			if (IsAnyWindowOpen())
			{
				if (_freeCamLockCursor && (int)Cursor.lockState == 1)
				{
					Cursor.lockState = (CursorLockMode)0;
					Cursor.visible = true;
				}
				return;
			}
			if (_freeCamLockCursor && (int)Cursor.lockState != 1)
			{
				Cursor.lockState = (CursorLockMode)1;
				Cursor.visible = false;
			}
			_freeCamRot.y += Input.GetAxis("Mouse X") * _freeCamSensitivity;
			_freeCamRot.x -= Input.GetAxis("Mouse Y") * _freeCamSensitivity;
			_freeCamRot.x = Mathf.Clamp(_freeCamRot.x, -89f, 89f);
			_freeCamGO.transform.rotation = Quaternion.Euler(_freeCamRot.x, _freeCamRot.y, 0f);
			float num = _freeCamSpeed * (Input.GetKey((KeyCode)304) ? _freeCamBoost : 1f);
			Vector3 val = Vector3.zero;
			if (Input.GetKey((KeyCode)119))
			{
				val += _freeCamGO.transform.forward;
			}
			if (Input.GetKey((KeyCode)115))
			{
				val -= _freeCamGO.transform.forward;
			}
			if (Input.GetKey((KeyCode)97))
			{
				val -= _freeCamGO.transform.right;
			}
			if (Input.GetKey((KeyCode)100))
			{
				val += _freeCamGO.transform.right;
			}
			if (Input.GetKey((KeyCode)101))
			{
				val += _freeCamGO.transform.up;
			}
			if (Input.GetKey((KeyCode)113))
			{
				val -= _freeCamGO.transform.up;
			}
			Transform transform = _freeCamGO.transform;
			transform.position += ((Vector3)(ref val)).normalized * num * Time.unscaledDeltaTime;
			_freeCamCam.fieldOfView = _freeCamFov;
		}

		private void ApplyFov()
		{
			try
			{
				if (_freeCam && Object.op_Implicit((Object)(object)_freeCamCam))
				{
					_freeCamCam.fieldOfView = _freeCamFov;
					LogEvent($"Applied FOV {_freeCamFov:F0} to FreeCam");
				}
				else if (Object.op_Implicit((Object)(object)Camera.main))
				{
					Camera.main.fieldOfView = _freeCamFov;
					LogEvent($"Applied FOV {_freeCamFov:F0} to main camera");
				}
			}
			catch (Exception ex)
			{
				_plugin.LogErr("ApplyFov failed: " + ex);
				LogEvent("FOV application failed - see console");
			}
		}

		public void QuickSavePos()
		{
			//IL_0027: 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)
			Transform val = TryGetPlayerTransform(log: true);
			if (!Object.op_Implicit((Object)(object)val))
			{
				LogEvent("QuickSavePos: player not found");
				return;
			}
			_savedPos = val.position;
			_savedRot = val.rotation;
			LogEvent("Saved player position");
		}

		public void QuickLoadPos()
		{
			//IL_004c: 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)
			Transform val = TryGetPlayerTransform(log: true);
			if (!Object.op_Implicit((Object)(object)val))
			{
				LogEvent("QuickLoadPos: player not found");
			}
			else if (_savedPos.HasValue && _savedRot.HasValue)
			{
				Teleport(val, _savedPos.Value, _savedRot.Value);
				LogEvent("Loaded player position");
			}
			else
			{
				LogEvent("No saved position");
			}
		}

		private static void Teleport(Transform tr, Vector3 pos, Quaternion rot)
		{
			//IL_002e: 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_009a: 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_006c: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)tr))
			{
				return;
			}
			CharacterController component = ((Component)tr).GetComponent<CharacterController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				((Collider)component).enabled = false;
				tr.position = pos;
				tr.rotation = rot;
				((Collider)component).enabled = true;
				return;
			}
			Rigidbody component2 = ((Component)tr).GetComponent<Rigidbody>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.isKinematic = true;
				component2.detectCollisions = false;
				tr.position = pos;
				tr.rotation = rot;
				component2.velocity = Vector3.zero;
				component2.isKinematic = false;
				component2.detectCollisions = true;
			}
			else
			{
				tr.position = pos;
				tr.rotation = rot;
			}
		}

		private void TrySetMoveSpeed(float scale)
		{
			try
			{
				Transform val = TryGetPlayerTransform();
				if (!Object.op_Implicit((Object)(object)val))
				{
					LogEvent("Player not found for speed tweak");
					return;
				}
				Behaviour[] componentsInChildren = ((Component)val).GetComponentsInChildren<Behaviour>(true);
				int num = 0;
				Behaviour[] array = componentsInChildren;
				foreach (Behaviour val2 in array)
				{
					if (!Object.op_Implicit((Object)(object)val2))
					{
						continue;
					}
					Type type = ((object)val2).GetType();
					string text = type.Name.ToLowerInvariant();
					if (!text.Contains("move") && !text.Contains("motor") && !text.Contains("locomotion") && !text.Contains("controller"))
					{
						continue;
					}
					FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					foreach (FieldInfo fieldInfo in fields)
					{
						if (fieldInfo.FieldType == typeof(float))
						{
							string text2 = fieldInfo.Name.ToLowerInvariant();
							if (text2.Contains("speed") || text2.Contains("walk") || text2.Contains("run") || text2.Contains("sprint"))
							{
								float num2 = (float)(fieldInfo.GetValue(val2) ?? ((object)0f));
								float num3 = Mathf.Max(0f, num2 * scale);
								fieldInfo.SetValue(val2, num3);
								num++;
							}
						}
					}
					PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					foreach (PropertyInfo propertyInfo in properties)
					{
						if (!propertyInfo.CanRead || !propertyInfo.CanWrite || !(propertyInfo.PropertyType == typeof(float)))
						{
							continue;
						}
						string text3 = propertyInfo.Name.ToLowerInvariant();
						if (text3.Contains("speed") || text3.Contains("walk") || text3.Contains("run") || text3.Contains("sprint"))
						{
							try
							{
								float num4 = (float)(propertyInfo.GetValue(val2, null) ?? ((object)0f));
								float num5 = Mathf.Max(0f, num4 * scale);
								propertyInfo.SetValue(val2, num5, null);
								num++;
							}
							catch
							{
							}
						}
					}
				}
				LogEvent($"Applied speed scale {scale} to {num} fields/properties");
			}
			catch (Exception ex)
			{
				_plugin.LogErr("TrySetMoveSpeed failed: " + ex);
				LogEvent("Speed modification failed - see console");
			}
		}

		private bool TryTeleportTruckSafe(Transform player)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Type type = FindTypeByName("TruckSafetySpawnPoint");
				if (type != null)
				{
					object? obj = type.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
					Component val = (Component)((obj is Component) ? obj : null);
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.transform))
					{
						Teleport(player, val.transform.position, val.transform.rotation);
						LogEvent("Teleported to TruckSafetySpawnPoint");
						return true;
					}
				}
			}
			catch
			{
			}
			return false;
		}

		private void TeleportToTag(Transform player, string tag)
		{
			//IL_0035: 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)
			try
			{
				GameObject val = GameObject.FindGameObjectWithTag(tag);
				if ((Object)(object)val == (Object)null)
				{
					LogEvent("No object with tag '" + tag + "' found in scene");
					return;
				}
				Teleport(player, val.transform.position, val.transform.rotation);
				LogEvent("Teleported to tag '" + tag + "'");
			}
			catch (Exception ex)
			{
				_plugin.LogErr("Teleport failed: " + ex);
				LogEvent("Teleportation failed - see console");
			}
		}

		private void RebuildObjectCache(bool force = false)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (!force && (DateTime.Now - _lastCache).TotalSeconds < 2.0)
			{
				return;
			}
			_lastCache = DateTime.Now;
			try
			{
				Scene activeScene = SceneManager.GetActiveScene();
				List<GameObject> list = new List<GameObject>();
				GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
				foreach (GameObject root in rootGameObjects)
				{
					Collect(root, list);
				}
				_cachedObjects = list.Where((GameObject go) => (Object)(object)go != (Object)null).ToList();
			}
			catch (Exception ex)
			{
				_plugin.LogErr("RebuildObjectCache failed: " + ex);
			}
		}

		private static void Collect(GameObject root, List<GameObject> list)
		{
			if (Object.op_Implicit((Object)(object)root))
			{
				list.Add(root);
				Transform transform = root.transform;
				for (int i = 0; i < transform.childCount; i++)
				{
					Collect(((Component)transform.GetChild(i)).gameObject, list);
				}
			}
		}

		private static string GetPath(Transform tr)
		{
			StringBuilder stringBuilder = new StringBuilder(((Object)tr).name);
			while ((Object)(object)tr.parent != (Object)null)
			{
				tr = tr.parent;
				stringBuilder.Insert(0, ((Object)tr).name + "/");
			}
			return stringBuilder.ToString();
		}

		private void SpawnPrimitive(PrimitiveType type)
		{
			//IL_0032: 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_0047: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_006c: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Camera val = (Camera)(Object.op_Implicit((Object)(object)_freeCamCam) ? ((object)_freeCamCam) : ((object)Camera.main));
				Vector3 position = (Object.op_Implicit((Object)(object)val) ? (((Component)val).transform.position + ((Component)val).transform.forward * 3f) : Vector3.zero);
				Quaternion rotation = (Object.op_Implicit((Object)(object)val) ? ((Component)val).transform.rotation : Quaternion.identity);
				GameObject val2 = GameObject.CreatePrimitive(type);
				val2.transform.position = position;
				val2.transform.rotation = rotation;
				((Object)val2).name = "OmniumSpawned_" + ((object)(PrimitiveType)(ref type)).ToString();
				_selected = val2;
				LogEvent($"Spawned {type}");
			}
			catch (Exception ex)
			{
				_plugin.LogErr("SpawnPrimitive failed: " + ex);
			}
		}

		private void RegisterCommands()
		{
			_commands.Clear();
			_commands["help"] = delegate
			{
				LogEvent("Commands: help | tp x y z | ts value | god on/off | freecam on/off | noclip on/off");
			};
			_commands["tp"] = delegate(string[] args)
			{
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				float result2;
				float result3;
				float result4;
				if (args.Length < 3)
				{
					LogEvent("Usage: tp x y z");
				}
				else if (!float.TryParse(args[0], out result2) || !float.TryParse(args[1], out result3) || !float.TryParse(args[2], out result4))
				{
					LogEvent("tp: invalid numbers");
				}
				else
				{
					Transform val = TryGetPlayerTransform(log: true);
					if (!Object.op_Implicit((Object)(object)val))
					{
						LogEvent("tp: player not found");
					}
					else
					{
						Teleport(val, new Vector3(result2, result3, result4), val.rotation);
					}
				}
			};
			_commands["ts"] = delegate(string[] args)
			{
				if (args.Length < 1 || !float.TryParse(args[0], out var result))
				{
					LogEvent("Usage: ts value");
				}
				else
				{
					_timeScale = result;
					LogEvent($"Time scale set to {result}");
				}
			};
			_commands["god"] = delegate(string[] args)
			{
				if (args.Length < 1)
				{
					LogEvent("Usage: god on/off");
				}
				else
				{
					TrySetGodMode(_godMode = args[0].Equals("on", StringComparison.OrdinalIgnoreCase));
				}
			};
			_commands["freecam"] = delegate(string[] args)
			{
				bool flag = args.Length == 0 || args[0].Equals("on", StringComparison.OrdinalIgnoreCase);
				if (_freeCam != flag)
				{
					ToggleFreeCam();
				}
			};
			_commands["noclip"] = delegate
			{
				ToggleNoclip();
			};
		}

		private void RunConsole(string input)
		{
			if (string.IsNullOrWhiteSpace(input))
			{
				return;
			}
			LogEvent("> " + input);
			try
			{
				string[] array = input.Trim().Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
				string text = array[0];
				string[] obj = array.Skip(1).ToArray();
				if (_commands.TryGetValue(text, out Action<string[]> value))
				{
					value(obj);
				}
				else
				{
					LogEvent("Unknown command '" + text + "'");
				}
			}
			catch (Exception ex)
			{
				_plugin.LogErr("RunConsole failed: " + ex);
			}
			finally
			{
				_consoleInput = string.Empty;
			}
		}

		private void SaveProfile()
		{
			try
			{
				var anon = new
				{
					freeCamSpeed = _freeCamSpeed,
					freeCamSensitivity = _freeCamSensitivity,
					freeCamFov = _freeCamFov,
					lockCursor = _freeCamLockCursor,
					windowRects = _windowRects.ToDictionary<KeyValuePair<string, Rect>, string, float[]>((KeyValuePair<string, Rect> kv) => kv.Key, delegate(KeyValuePair<string, Rect> kv)
					{
						//IL_000a: Unknown result type (might be due to invalid IL or missing references)
						//IL_000f: Unknown result type (might be due to invalid IL or missing references)
						//IL_001c: 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_002e: 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_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)
						float[] array = new float[4];
						Rect value = kv.Value;
						array[0] = ((Rect)(ref value)).x;
						value = kv.Value;
						array[1] = ((Rect)(ref value)).y;
						value = kv.Value;
						array[2] = ((Rect)(ref value)).width;
						value = kv.Value;
						array[3] = ((Rect)(ref value)).height;
						return array;
					})
				};
				File.WriteAllText(ProfilePath, JsonUtility.ToJson((object)anon));
				LogEvent("Profile saved");
			}
			catch (Exception ex)
			{
				_plugin.LogErr("SaveProfile failed: " + ex);
			}
		}

		private void LoadProfile(bool log = true)
		{
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!File.Exists(ProfilePath))
				{
					if (log)
					{
						LogEvent("No profile found");
					}
					return;
				}
				string text = File.ReadAllText(ProfilePath);
				ProfileDto profileDto = JsonUtility.FromJson<ProfileDto>(text);
				if (profileDto != null)
				{
					_freeCamSpeed = profileDto.freeCamSpeed;
					_freeCamSensitivity = profileDto.freeCamSensitivity;
					_freeCamFov = profileDto.freeCamFov;
					_freeCamLockCursor = profileDto.lockCursor;
					if (profileDto.windowRects != null)
					{
						foreach (KeyValuePair<string, float[]> windowRect in profileDto.windowRects)
						{
							float[] value = windowRect.Value;
							if (value != null && value.Length >= 4)
							{
								_windowRects[windowRect.Key] = new Rect(value[0], value[1], value[2], value[3]);
							}
						}
					}
				}
				if (log)
				{
					LogEvent("Profile loaded");
				}
			}
			catch (Exception ex)
			{
				_plugin.LogErr("LoadProfile failed: " + ex);
			}
		}

		private void ToggleNoclip()
		{
			try
			{
				_noclip = !_noclip;
				Transform val = TryGetPlayerTransform();
				if (!Object.op_Implicit((Object)(object)val))
				{
					LogEvent("Noclip: player not found");
					return;
				}
				_cc = ((Component)val).GetComponent<CharacterController>();
				_rb = ((Component)val).GetComponent<Rigidbody>();
				_col = ((Component)val).GetComponentsInChildren<Collider>(true);
				if (_noclip)
				{
					if (Object.op_Implicit((Object)(object)_cc))
					{
						_ccPrevCollide = _cc.detectCollisions;
						_cc.detectCollisions = false;
						((Collider)_cc).enabled = false;
					}
					if (Object.op_Implicit((Object)(object)_rb))
					{
						_rbPrevKinematic = _rb.isKinematic;
						_rbPrevDetect = _rb.detectCollisions;
						_rb.isKinematic = true;
						_rb.detectCollisions = false;
					}
					_colPrevEnabled.Clear();
					Collider[] col = _col;
					foreach (Collider val2 in col)
					{
						if (Object.op_Implicit((Object)(object)val2))
						{
							_colPrevEnabled[val2] = val2.enabled;
							val2.enabled = false;
						}
					}
					LogEvent("Noclip enabled");
					return;
				}
				if (Object.op_Implicit((Object)(object)_cc))
				{
					_cc.detectCollisions = _ccPrevCollide;
					((Collider)_cc).enabled = true;
				}
				if (Object.op_Implicit((Object)(object)_rb))
				{
					_rb.isKinematic = _rbPrevKinematic;
					_rb.detectCollisions = _rbPrevDetect;
				}
				foreach (KeyValuePair<Collider, bool> item in _colPrevEnabled)
				{
					if (Object.op_Implicit((Object)(object)item.Key))
					{
						item.Key.enabled = item.Value;
					}
				}
				_colPrevEnabled.Clear();
				LogEvent("Noclip disabled");
			}
			catch (Exception ex)
			{
				_plugin.LogErr("ToggleNoclip failed: " + ex);
				LogEvent("Noclip toggle failed - see console");
			}
		}

		private void BeginInputHijack()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				_prevCursorLock = Cursor.lockState;
				_prevCursorVisible = Cursor.visible;
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
				_disabledBehaviours.Clear();
				_hijackCC = null;
				_hijackRB = null;
				Transform player = PlayerLocator.GetPlayer(false, false);
				if (Object.op_Implicit((Object)(object)player))
				{
					List<Behaviour> list = new List<Behaviour>();
					list.AddRange(((Component)player).GetComponentsInChildren<Behaviour>(true));
					if (Object.op_Implicit((Object)(object)Camera.main))
					{
						list.AddRange(((Component)Camera.main).GetComponentsInChildren<Behaviour>(true));
					}
					foreach (Behaviour item in list)
					{
						if (!Object.op_Implicit((Object)(object)item) || !item.enabled)
						{
							continue;
						}
						Type type = ((object)item).GetType();
						if (type == typeof(Camera) || type == typeof(AudioListener))
						{
							continue;
						}
						string text = "";
						try
						{
							text = type.Assembly.GetName().Name ?? "";
						}
						catch
						{
						}
						bool flag = text.Equals("Assembly-CSharp", StringComparison.OrdinalIgnoreCase) || text.Equals("Assembly-CSharp-firstpass", StringComparison.OrdinalIgnoreCase) || text.StartsWith("UnityEngine", StringComparison.OrdinalIgnoreCase) || text.StartsWith("Unity.", StringComparison.OrdinalIgnoreCase);
						bool flag2 = text.IndexOf("RepoLib", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("REPOLib", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("OmniumLib", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("OmniumLibrary", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("BepInEx", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Harmony", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Thunderstore", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Plugin", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Mod", StringComparison.OrdinalIgnoreCase) >= 0;
						if (_respectRepoLib.Value && (!flag || flag2))
						{
							continue;
						}
						string name = type.Name;
						bool flag3 = name.Contains("Mouse") || name.Contains("Look") || name.Contains("Locomotion") || name.Contains("Motor") || name.Contains("Movement") || (name.Contains("Input") && (name.Contains("Player") || name.Contains("Character") || name.Contains("Camera"))) || (name.Contains("Controller") && (name.Contains("Player") || name.Contains("Character") || name.Contains("FirstPerson") || name.Contains("ThirdPerson") || name.Contains("Camera")));
						string text2 = ((Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)((Component)item).gameObject)) ? ((Object)((Component)item).gameObject).name : string.Empty);
						if (_respectRepoLib.Value)
						{
							if (text2.IndexOf("HUD", StringComparison.OrdinalIgnoreCase) >= 0)
							{
								flag3 = false;
							}
							if (text2.IndexOf("REPOLib", StringComparison.OrdinalIgnoreCase) >= 0)
							{
								flag3 = false;
							}
						}
						string text3 = name.ToLowerInvariant();
						if (text3.Contains("ui") || text3.Contains("canvas") || text3.Contains("graphic"))
						{
							flag3 = false;
						}
						if (_respectRepoLib.Value && (text3.Contains("bundle") || text3.Contains("loader") || text3.Contains("manager") || text3.Contains("addressable")))
						{
							flag3 = false;
						}
						if (flag3)
						{
							item.enabled = false;
							_disabledBehaviours.Add(item);
						}
					}
					_hijackCC = ((Component)player).GetComponent<CharacterController>();
					if (Object.op_Implicit((Object)(object)_hijackCC))
					{
						_hijackCCPrev = ((Collider)_hijackCC).enabled;
						((Collider)_hijackCC).enabled = false;
					}
					_hijackRB = ((Component)player).GetComponent<Rigidbody>();
					if (Object.op_Implicit((Object)(object)_hijackRB))
					{
						_hijackRBPrevKinematic = _hijackRB.isKinematic;
						_hijackRBPrevDetect = _hijackRB.detectCollisions;
						_hijackRB.isKinematic = true;
						_hijackRB.detectCollisions = false;
						_hijackRB.velocity = Vector3.zero;
					}
				}
				_hijackActive = true;
				LogEvent("Input hijack ENABLED (UI open)");
			}
			catch (Exception ex)
			{
				_plugin.LogErr("BeginInputHijack failed: " + ex);
			}
		}

		private void EndInputHijack()
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				foreach (Behaviour disabledBehaviour in _disabledBehaviours)
				{
					if (Object.op_Implicit((Object)(object)disabledBehaviour))
					{
						disabledBehaviour.enabled = true;
					}