Decompiled source of Empress Spawn Browser v3.0.0

EmpressSpawnBrowser.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("3.0.0+31d33a1e262fb9cd936a8fd3f583fdd7bc996e5a")]
[assembly: AssemblyProduct("EmpressSpawnBrowser")]
[assembly: AssemblyTitle("EmpressSpawnBrowser")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.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 Empress.SpawnBrowser
{
	[BepInPlugin("Empress.SpawnBrowser", "Spawn Browser", "3.0.0")]
	public class SpawnBrowser : BaseUnityPlugin
	{
		[HarmonyPatch]
		private static class Patch_CameraAim_Update
		{
			private static MethodBase TargetMethod()
			{
				return typeof(CameraAim).GetMethod("Update", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? null;
			}

			private static bool Prefix()
			{
				return !UIActive;
			}
		}

		[HarmonyPatch]
		private static class Patch_EnemyOnScreen_GetOnScreen
		{
			private static MethodBase TargetMethod()
			{
				return typeof(EnemyOnScreen).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo method) => method.Name == "GetOnScreen" && method.GetParameters().Length == 1) ?? null;
			}

			private static void Finalizer(Exception __exception, ref bool __result)
			{
				if (__exception is KeyNotFoundException)
				{
					__result = false;
				}
				else if (__exception != null)
				{
					throw __exception;
				}
			}
		}

		private const int EnemyTab = 0;

		private const int ValuableTab = 1;

		private const int ItemTab = 2;

		private const int TeleportTab = 3;

		private static readonly string[] TabNames = new string[4] { "ENEMIES", "VALUABLES", "ITEMS", "TELEPORT" };

		private static readonly string[] SearchHints = new string[4] { "Filter enemy setups...", "Filter valuables...", "Filter items and upgrades...", "Filter level points, rooms, or tags..." };

		private static readonly Regex RxEnemyTrim = new Regex("^Enemy( -)?\\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled);

		private static readonly Regex RxValuableTrim = new Regex("^Valuable\\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled);

		private static readonly Regex RxItemTrim = new Regex("^Item\\s*", RegexOptions.IgnoreCase | RegexOptions.Compiled);

		private static bool _uiVisible;

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

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

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

		private readonly Dictionary<string, EnemySetup> _enemyByKey = new Dictionary<string, EnemySetup>(StringComparer.OrdinalIgnoreCase);

		private readonly Dictionary<string, PrefabRef> _valuableByKey = new Dictionary<string, PrefabRef>(StringComparer.OrdinalIgnoreCase);

		private readonly Dictionary<string, Item> _itemByKey = new Dictionary<string, Item>(StringComparer.OrdinalIgnoreCase);

		private readonly Color _bg = new Color(0.03f, 0.05f, 0.09f, 0.97f);

		private readonly Color _bg2 = new Color(0.07f, 0.1f, 0.16f, 0.96f);

		private readonly Color _surface = new Color(0.09f, 0.13f, 0.2f, 0.98f);

		private readonly Color _surfaceLift = new Color(0.13f, 0.19f, 0.29f, 0.99f);

		private readonly Color _surfaceSoft = new Color(0.18f, 0.26f, 0.39f, 0.55f);

		private readonly Color _fg = new Color(0.9f, 0.96f, 1f, 1f);

		private readonly Color _mutedCol = new Color(0.55f, 0.68f, 0.82f, 0.9f);

		private readonly Color _accentBase = new Color(0.14f, 0.73f, 1f, 1f);

		private readonly Color _accentHover = new Color(0.36f, 0.84f, 1f, 1f);

		private readonly Color _accentDisabled = new Color(0.17f, 0.31f, 0.44f, 0.7f);

		private readonly Color _success = new Color(0.34f, 0.92f, 0.66f, 1f);

		private readonly Color _warning = new Color(1f, 0.76f, 0.36f, 1f);

		private int _tabIndex;

		private string _searchEnemies = string.Empty;

		private string _searchValuables = string.Empty;

		private string _searchItems = string.Empty;

		private string _searchTeleport = string.Empty;

		private string _baseStatus = "Load into a run, then browse or spawn from live game data.";

		private string _lastAction = "Ready.";

		private bool _discovered;

		private bool _discovering;

		private CursorLockMode _prevLock;

		private bool _prevVisible;

		private GameObject _canvasRoot = null;

		private GameObject _panelRoot = null;

		private ScrollRect _scrollRect = null;

		private ScrollRect _sidebarScrollRect = null;

		private RectTransform _scrollViewportRect = null;

		private RectTransform _sidebarViewportRect = null;

		private Transform _contentContainer = null;

		private Transform _sidebarContentContainer = null;

		private Transform _tabBar = null;

		private TextMeshProUGUI _titleText = null;

		private TextMeshProUGUI _statusText = null;

		private TextMeshProUGUI _countText = null;

		private TextMeshProUGUI _summaryText = null;

		private TextMeshProUGUI _sceneBadgeText = null;

		private TextMeshProUGUI _searchPlaceholderText = null;

		private TextMeshProUGUI _spawnQuantityValueText = null;

		private TextMeshProUGUI _spawnOriginValueText = null;

		private TextMeshProUGUI _sortValueText = null;

		private Button _refreshButton = null;

		private TMP_InputField _searchInput = null;

		private ConfigEntry<KeyCode> _toggleKey = null;

		private ConfigEntry<float> _scrollSpeed = null;

		private ConfigEntry<float> _uiScale = null;

		private ConfigEntry<Vector2> _uiPosition = null;

		private ConfigEntry<bool> _showTooltips = null;

		private ConfigEntry<int> _spawnQuantity = null;

		private ConfigEntry<int> _spawnOriginMode = null;

		private ConfigEntry<bool> _sortAscending = null;

		private ConfigEntry<bool> _autoRefreshOnSceneLoad = null;

		private LevelPoint? _pinnedTeleportPoint;

		private string _pinnedTeleportPointName = string.Empty;

		internal static SpawnBrowser Instance { get; private set; } = null;


		internal static bool UIActive => _uiVisible;

		internal static ManualLogSource Logger => Instance._logger;

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

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			_toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Input", "ToggleKey", (KeyCode)277, "Key to toggle the Spawn Browser UI.");
			_scrollSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "ScrollSpeed", 35f, "Mouse wheel scroll sensitivity for the Spawn Browser list.");
			_uiScale = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "UIScale", 1f, "Scale of the UI panel (0.65 to 1.35).");
			_uiPosition = ((BaseUnityPlugin)this).Config.Bind<Vector2>("UI", "UIPosition", Vector2.zero, "Custom offset position for the UI panel.");
			_showTooltips = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowTooltips", true, "Show extra row context in the status strip when hovering entries.");
			_spawnQuantity = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "Quantity", 1, "How many copies each spawn action creates (1 to 10).");
			_spawnOriginMode = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "OriginMode", 0, "0 = Closest level point, 1 = Player position, 2 = Pinned teleport point.");
			_sortAscending = ((BaseUnityPlugin)this).Config.Bind<bool>("Browser", "SortAscending", true, "Sort browser rows from A to Z.");
			_autoRefreshOnSceneLoad = ((BaseUnityPlugin)this).Config.Bind<bool>("Browser", "AutoRefreshOnSceneLoad", true, "Refresh discovery when a new scene loads while the browser is open.");
			NormalizeConfigValues();
			Harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
			Harmony.PatchAll();
			SceneManager.sceneLoaded += OnSceneLoaded;
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded. Press {_toggleKey.Value} to open/close the spawn browser.");
			((MonoBehaviour)this).StartCoroutine(InitializeCanvasDelayed());
		}

		private IEnumerator InitializeCanvasDelayed()
		{
			yield return (object)new WaitForSeconds(0.5f);
			BuildCanvas();
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			_discovered = false;
			_discovering = false;
			_pinnedTeleportPoint = null;
			_pinnedTeleportPointName = string.Empty;
			_lastAction = "Scene loaded: " + ((Scene)(ref scene)).name;
			_baseStatus = "Scene changed. Press rescan or reopen the browser to pull current run data.";
			if (_uiVisible)
			{
				if (_autoRefreshOnSceneLoad.Value)
				{
					((MonoBehaviour)this).StartCoroutine(DiscoverRoutine());
				}
				else
				{
					RefreshCurrentTab();
				}
			}
		}

		private void OnDestroy()
		{
			SceneManager.sceneLoaded -= OnSceneLoaded;
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			if (_uiVisible)
			{
				RestoreCursor();
			}
			if (Object.op_Implicit((Object)(object)_canvasRoot))
			{
				Object.Destroy((Object)(object)_canvasRoot);
			}
		}

		private void Update()
		{
			//IL_000e: 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_014f: Unknown result type (might be due to invalid IL or missing references)
			NormalizeConfigValues();
			if (Input.GetKeyDown(_toggleKey.Value))
			{
				_uiVisible = !_uiVisible;
				if (_uiVisible)
				{
					OpenBrowser();
				}
				else
				{
					CloseBrowser();
				}
			}
			if (_uiVisible)
			{
				KeepCursorFree();
				HandleMouseWheelScroll();
				UpdateTabVisuals();
				UpdateChrome();
			}
			if ((Object)(object)_scrollRect != (Object)null && _scrollRect.scrollSensitivity != _scrollSpeed.Value)
			{
				_scrollRect.scrollSensitivity = _scrollSpeed.Value;
			}
			if ((Object)(object)_sidebarScrollRect != (Object)null && _sidebarScrollRect.scrollSensitivity != _scrollSpeed.Value)
			{
				_sidebarScrollRect.scrollSensitivity = _scrollSpeed.Value;
			}
			if ((Object)(object)_panelRoot != (Object)null)
			{
				RectTransform component = _panelRoot.GetComponent<RectTransform>();
				((Transform)component).localScale = new Vector3(_uiScale.Value, _uiScale.Value, 1f);
				component.anchoredPosition = _uiPosition.Value;
			}
		}

		private void NormalizeConfigValues()
		{
			if (_spawnQuantity != null)
			{
				_spawnQuantity.Value = Mathf.Clamp(_spawnQuantity.Value, 1, 10);
			}
			if (_spawnOriginMode != null)
			{
				_spawnOriginMode.Value = Mathf.Clamp(_spawnOriginMode.Value, 0, 2);
			}
			if (_uiScale != null)
			{
				_uiScale.Value = Mathf.Clamp(_uiScale.Value, 0.65f, 1.35f);
			}
		}

		private void BuildCanvas()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: 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_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Expected O, but got Unknown
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Unknown result type (might be due to invalid IL or missing references)
			//IL_0731: Unknown result type (might be due to invalid IL or missing references)
			//IL_0748: Unknown result type (might be due to invalid IL or missing references)
			//IL_075f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0776: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			_canvasRoot = new GameObject("SpawnBrowserCanvas_EMPRESS");
			Object.DontDestroyOnLoad((Object)(object)_canvasRoot);
			_canvasRoot.layer = LayerMask.NameToLayer("UI");
			Canvas val = _canvasRoot.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			val.sortingOrder = 32767;
			val.overrideSorting = true;
			CanvasScaler val2 = _canvasRoot.AddComponent<CanvasScaler>();
			val2.uiScaleMode = (ScaleMode)1;
			val2.referenceResolution = new Vector2(1920f, 1080f);
			val2.matchWidthOrHeight = 1f;
			_canvasRoot.AddComponent<GraphicRaycaster>();
			if ((Object)(object)EventSystem.current == (Object)null)
			{
				GameObject val3 = new GameObject("EventSystem_EMPRESS");
				Object.DontDestroyOnLoad((Object)(object)val3);
				val3.AddComponent<EventSystem>();
				val3.AddComponent<StandaloneInputModule>();
			}
			GameObject val4 = CreateUIElement("Backdrop", _canvasRoot.transform);
			Stretch(val4.GetComponent<RectTransform>(), 0f, 0f, 0f, 0f);
			((Graphic)val4.AddComponent<Image>()).color = new Color(0.01f, 0.02f, 0.04f, 0.62f);
			_panelRoot = CreateCard("Panel", _canvasRoot.transform, _bg);
			RectTransform component = _panelRoot.GetComponent<RectTransform>();
			Vector2 val5 = default(Vector2);
			((Vector2)(ref val5))..ctor(0.5f, 0.5f);
			component.anchorMax = val5;
			component.anchorMin = val5;
			component.pivot = new Vector2(0.5f, 0.5f);
			component.sizeDelta = new Vector2(1180f, 760f);
			component.anchoredPosition = _uiPosition.Value;
			((Shadow)_panelRoot.GetComponent<Outline>()).effectColor = new Color(_accentBase.r, _accentBase.g, _accentBase.b, 0.5f);
			((Shadow)_panelRoot.GetComponent<Outline>()).effectDistance = new Vector2(2f, -2f);
			GameObject val6 = CreateUIElement("AccentBar", _panelRoot.transform);
			RectTransform component2 = val6.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 1f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.pivot = new Vector2(0.5f, 1f);
			component2.sizeDelta = new Vector2(0f, 6f);
			component2.anchoredPosition = Vector2.zero;
			((Graphic)val6.AddComponent<Image>()).color = _accentBase;
			GameObject val7 = CreateCard("Sidebar", _panelRoot.transform, _bg2);
			RectTransform component3 = val7.GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0f, 0f);
			component3.anchorMax = new Vector2(0f, 1f);
			component3.pivot = new Vector2(0f, 0.5f);
			component3.sizeDelta = new Vector2(290f, -32f);
			component3.anchoredPosition = new Vector2(16f, 0f);
			GameObject val8 = CreateUIElement("SidebarScrollView", val7.transform);
			Stretch(val8.GetComponent<RectTransform>(), 10f, 12f, 10f, 10f);
			_sidebarScrollRect = val8.AddComponent<ScrollRect>();
			_sidebarScrollRect.horizontal = false;
			_sidebarScrollRect.vertical = true;
			_sidebarScrollRect.scrollSensitivity = _scrollSpeed.Value;
			_sidebarScrollRect.verticalScrollbarVisibility = (ScrollbarVisibility)0;
			GameObject val9 = CreateUIElement("SidebarViewport", val8.transform);
			RectTransform component4 = val9.GetComponent<RectTransform>();
			component4.anchorMin = Vector2.zero;
			component4.anchorMax = Vector2.one;
			component4.offsetMin = Vector2.zero;
			component4.offsetMax = new Vector2(-12f, 0f);
			val9.AddComponent<RectMask2D>();
			_sidebarViewportRect = component4;
			_sidebarScrollRect.viewport = component4;
			GameObject val10 = CreateUIElement("SidebarContent", val9.transform);
			RectTransform component5 = val10.GetComponent<RectTransform>();
			component5.anchorMin = new Vector2(0f, 1f);
			component5.anchorMax = new Vector2(1f, 1f);
			component5.pivot = new Vector2(0.5f, 1f);
			component5.sizeDelta = Vector2.zero;
			VerticalLayoutGroup val11 = val10.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val11).spacing = 10f;
			((LayoutGroup)val11).padding = new RectOffset(0, 0, 0, 0);
			((HorizontalOrVerticalLayoutGroup)val11).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val11).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val11).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val11).childForceExpandHeight = false;
			val10.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			_sidebarScrollRect.content = component5;
			_sidebarContentContainer = val10.transform;
			BuildSidebar(val10.transform);
			GameObject val12 = CreateUIElement("SidebarScrollbar", val8.transform);
			RectTransform component6 = val12.GetComponent<RectTransform>();
			component6.anchorMin = new Vector2(1f, 0f);
			component6.anchorMax = new Vector2(1f, 1f);
			component6.pivot = new Vector2(1f, 1f);
			component6.sizeDelta = new Vector2(10f, 0f);
			component6.anchoredPosition = Vector2.zero;
			((Graphic)val12.AddComponent<Image>()).color = new Color(_surfaceLift.r, _surfaceLift.g, _surfaceLift.b, 0.55f);
			Scrollbar val13 = val12.AddComponent<Scrollbar>();
			val13.direction = (Direction)2;
			GameObject val14 = CreateUIElement("SlidingArea", val12.transform);
			Stretch(val14.GetComponent<RectTransform>(), 2f, 2f, 2f, 2f);
			GameObject val15 = CreateUIElement("Handle", val14.transform);
			Stretch(val15.GetComponent<RectTransform>(), 0f, 0f, 0f, 0f);
			Image val16 = val15.AddComponent<Image>();
			((Graphic)val16).color = new Color(_accentBase.r, _accentBase.g, _accentBase.b, 0.82f);
			val13.handleRect = val15.GetComponent<RectTransform>();
			((Selectable)val13).targetGraphic = (Graphic)(object)val16;
			_sidebarScrollRect.verticalScrollbar = val13;
			GameObject val17 = CreateCard("Body", _panelRoot.transform, new Color(_surface.r, _surface.g, _surface.b, 0.75f));
			RectTransform component7 = val17.GetComponent<RectTransform>();
			component7.anchorMin = new Vector2(0f, 0f);
			component7.anchorMax = new Vector2(1f, 1f);
			component7.offsetMin = new Vector2(322f, 16f);
			component7.offsetMax = new Vector2(-16f, -16f);
			BuildBody(val17.transform);
			_canvasRoot.SetActive(false);
			UpdateSearchPlaceholder();
			UpdateChrome();
			UpdateTabVisuals();
			RebuildLayout();
		}

		private void BuildSidebar(Transform sidebar)
		{
			MakeBrandCard(sidebar);
			MakeSummaryCard(sidebar);
			MakeTabsCard(sidebar);
			MakeControlsCard(sidebar);
		}

		private void MakeBrandCard(Transform parent)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateCard("Brand", parent, _surface);
			val.AddComponent<LayoutElement>().preferredHeight = 104f;
			VerticalLayoutGroup val2 = val.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 4f;
			((LayoutGroup)val2).padding = new RectOffset(16, 16, 14, 14);
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
			TextMeshProUGUI val3 = CreateTextMeshPro("Eyebrow", val.transform, "EMPRESS TOOLSUITE", 12f, _accentBase, (TextAlignmentOptions)513);
			((TMP_Text)val3).fontStyle = (FontStyles)1;
			TextMeshProUGUI val4 = CreateTextMeshPro("BrandTitle", val.transform, "Spawn Browser", 23f, _fg, (TextAlignmentOptions)513);
			((TMP_Text)val4).fontStyle = (FontStyles)1;
			((TMP_Text)val4).enableWordWrapping = false;
			((TMP_Text)val4).overflowMode = (TextOverflowModes)1;
			TextMeshProUGUI val5 = CreateTextMeshPro("BrandCopy", val.transform, "Version 3.0  •  Live spawn control", 11f, _mutedCol, (TextAlignmentOptions)257);
			((TMP_Text)val5).enableWordWrapping = false;
			((TMP_Text)val5).overflowMode = (TextOverflowModes)1;
		}

		private void MakeSummaryCard(Transform parent)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateCard("Summary", parent, _surface);
			val.AddComponent<LayoutElement>().preferredHeight = 118f;
			VerticalLayoutGroup val2 = val.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 6f;
			((LayoutGroup)val2).padding = new RectOffset(16, 16, 14, 14);
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
			TextMeshProUGUI val3 = CreateTextMeshPro("SummaryTitle", val.transform, "RUN SNAPSHOT", 12f, _accentBase, (TextAlignmentOptions)513);
			((TMP_Text)val3).fontStyle = (FontStyles)1;
			_summaryText = CreateTextMeshPro("SummaryBody", val.transform, string.Empty, 11f, _fg, (TextAlignmentOptions)257);
			((TMP_Text)_summaryText).enableWordWrapping = true;
		}

		private void MakeTabsCard(Transform parent)
		{
			//IL_0009: 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_0058: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			GameObject val = CreateCard("TabsCard", parent, _surface);
			val.AddComponent<LayoutElement>().minHeight = 238f;
			val.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			VerticalLayoutGroup val2 = val.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 8f;
			((LayoutGroup)val2).padding = new RectOffset(16, 16, 14, 14);
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
			TextMeshProUGUI val3 = CreateTextMeshPro("TabsTitle", val.transform, "SECTIONS", 12f, _accentBase, (TextAlignmentOptions)513);
			((TMP_Text)val3).fontStyle = (FontStyles)1;
			GameObject val4 = CreateUIElement("TabBar", val.transform);
			_tabBar = val4.transform;
			VerticalLayoutGroup val5 = val4.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val5).spacing = 6f;
			((HorizontalOrVerticalLayoutGroup)val5).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val5).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val5).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val5).childForceExpandHeight = false;
			val4.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			for (int i = 0; i < TabNames.Length; i++)
			{
				int index = i;
				GameObject val6 = CreateButton($"Tab{i}", _tabBar, TabNames[i], primary: false);
				val6.AddComponent<LayoutElement>().preferredHeight = 42f;
				((UnityEvent)val6.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					SwitchTab(index);
				});
			}
		}

		private void MakeControlsCard(Transform parent)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateCard("Controls", parent, _surface);
			val.AddComponent<LayoutElement>().preferredHeight = 208f;
			VerticalLayoutGroup val2 = val.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 6f;
			((LayoutGroup)val2).padding = new RectOffset(14, 14, 12, 12);
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
			TextMeshProUGUI val3 = CreateTextMeshPro("ControlsTitle", val.transform, "QUICK OPTIONS", 12f, _accentBase, (TextAlignmentOptions)513);
			((TMP_Text)val3).fontStyle = (FontStyles)1;
			MakeQuantityRow(val.transform);
			MakeOriginRow(val.transform);
			MakeSortRow(val.transform);
		}

		private void MakeHintCard(Transform parent)
		{
			//IL_002e: 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_0064: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateCard("Hint", parent, new Color(_surface.r, _surface.g, _surface.b, 0.7f));
			val.AddComponent<LayoutElement>().preferredHeight = 68f;
			VerticalLayoutGroup val2 = val.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val2).padding = new RectOffset(16, 16, 14, 14);
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 4f;
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false;
			TextMeshProUGUI val3 = CreateTextMeshPro("HintTitle", val.transform, "BROWSER NOTES", 12f, _warning, (TextAlignmentOptions)513);
			((TMP_Text)val3).fontStyle = (FontStyles)1;
			TextMeshProUGUI val4 = CreateTextMeshPro("HintBody", val.transform, "Teleport is local-only. Spawning is host or offline only. Pin any level point to reuse it as a spawn anchor.", 11f, _mutedCol, (TextAlignmentOptions)257);
			((TMP_Text)val4).enableWordWrapping = true;
		}

		private void MakeQuantityRow(Transform parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			GameObject val = CreateControlCard("QuantityRow", parent);
			TextMeshProUGUI val2 = CreateTextMeshPro("Label", val.transform, "Quantity", 13f, _fg, (TextAlignmentOptions)513);
			((Component)val2).gameObject.AddComponent<LayoutElement>().preferredWidth = 74f;
			GameObject val3 = CreateButton("Minus", val.transform, "-", primary: false);
			val3.AddComponent<LayoutElement>().preferredWidth = 30f;
			((UnityEvent)val3.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				_spawnQuantity.Value = Mathf.Clamp(_spawnQuantity.Value - 1, 1, 10);
				UpdateChrome();
				RefreshCurrentTab();
			});
			GameObject val4 = CreateCard("Value", val.transform, new Color(_surfaceLift.r, _surfaceLift.g, _surfaceLift.b, 0.85f));
			val4.AddComponent<LayoutElement>().preferredWidth = 64f;
			VerticalLayoutGroup val5 = val4.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val5).padding = new RectOffset(0, 0, 6, 6);
			((LayoutGroup)val5).childAlignment = (TextAnchor)4;
			_spawnQuantityValueText = CreateTextMeshPro("ValueText", val4.transform, string.Empty, 15f, _fg, (TextAlignmentOptions)514);
			((TMP_Text)_spawnQuantityValueText).fontStyle = (FontStyles)1;
			GameObject val6 = CreateButton("Plus", val.transform, "+", primary: true);
			val6.AddComponent<LayoutElement>().preferredWidth = 30f;
			((UnityEvent)val6.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				_spawnQuantity.Value = Mathf.Clamp(_spawnQuantity.Value + 1, 1, 10);
				UpdateChrome();
				RefreshCurrentTab();
			});
		}

		private void MakeOriginRow(Transform parent)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			GameObject val = CreateTallControlCard("OriginRow", parent, "Spawn Origin");
			GameObject val2 = CreateButton("OriginButton", val.transform, string.Empty, primary: false);
			val2.AddComponent<LayoutElement>().preferredHeight = 28f;
			_spawnOriginValueText = val2.GetComponentInChildren<TextMeshProUGUI>();
			((UnityEvent)val2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				_spawnOriginMode.Value = (_spawnOriginMode.Value + 1) % 3;
				UpdateChrome();
				RefreshCurrentTab();
			});
		}

		private void MakeSortRow(Transform parent)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			GameObject val = CreateTallControlCard("SortRow", parent, "Row Order");
			GameObject val2 = CreateButton("SortButton", val.transform, string.Empty, primary: false);
			val2.AddComponent<LayoutElement>().preferredHeight = 28f;
			_sortValueText = val2.GetComponentInChildren<TextMeshProUGUI>();
			((UnityEvent)val2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				_sortAscending.Value = !_sortAscending.Value;
				UpdateChrome();
				RefreshCurrentTab();
			});
		}

		private GameObject CreateControlCard(string name, Transform parent)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			GameObject val = CreateCard(name, parent, _surfaceSoft);
			val.AddComponent<LayoutElement>().preferredHeight = 44f;
			HorizontalLayoutGroup val2 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 6f;
			((LayoutGroup)val2).padding = new RectOffset(10, 10, 8, 8);
			((LayoutGroup)val2).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
			return val;
		}

		private GameObject CreateTallControlCard(string name, Transform parent, string title)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateCard(name, parent, _surfaceSoft);
			val.AddComponent<LayoutElement>().preferredHeight = 56f;
			VerticalLayoutGroup val2 = val.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 4f;
			((LayoutGroup)val2).padding = new RectOffset(10, 10, 8, 8);
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false;
			TextMeshProUGUI val3 = CreateTextMeshPro("Label", val.transform, title, 12f, _fg, (TextAlignmentOptions)513);
			((TMP_Text)val3).fontStyle = (FontStyles)1;
			return val;
		}

		private void BuildBody(Transform body)
		{
			MakeHeader(body);
			MakeSearchBar(body);
			MakeStatusCard(body);
			MakeScrollArea(body);
		}

		private void MakeHeader(Transform parent)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Expected O, but got Unknown
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			GameObject val = CreateCard("Header", parent, _surfaceLift);
			PositionTop(val.GetComponent<RectTransform>(), 12f, 78f);
			HorizontalLayoutGroup val2 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 10f;
			((LayoutGroup)val2).padding = new RectOffset(18, 18, 16, 16);
			((LayoutGroup)val2).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true;
			GameObject val3 = CreateUIElement("Copy", val.transform);
			val3.AddComponent<LayoutElement>().flexibleWidth = 1f;
			VerticalLayoutGroup val4 = val3.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val4).spacing = 2f;
			((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = false;
			_titleText = CreateTextMeshPro("Title", val3.transform, "<b>EMPRESS SPAWN BROWSER</b> <size=75%><color=#90DFFF>3.0</color></size>", 24f, _fg, (TextAlignmentOptions)513);
			((TMP_Text)_titleText).enableWordWrapping = false;
			TextMeshProUGUI val5 = CreateTextMeshPro("Subtitle", val3.transform, "Live browser for REPO enemies, valuables, items, and level-point warps.", 12f, _mutedCol, (TextAlignmentOptions)513);
			((TMP_Text)val5).enableWordWrapping = true;
			GameObject val6 = CreateButton("RefreshBtn", val.transform, "RESCAN", primary: true);
			val6.AddComponent<LayoutElement>().preferredWidth = 110f;
			_refreshButton = val6.GetComponent<Button>();
			((UnityEvent)_refreshButton.onClick).AddListener((UnityAction)delegate
			{
				((MonoBehaviour)this).StartCoroutine(DiscoverRoutine());
			});
			GameObject val7 = CreateButton("CloseBtn", val.transform, "CLOSE", primary: false);
			val7.AddComponent<LayoutElement>().preferredWidth = 96f;
			((UnityEvent)val7.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				_uiVisible = false;
				CloseBrowser();
			});
		}

		private void MakeSearchBar(Transform parent)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Expected O, but got Unknown
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateCard("SearchCard", parent, _surface);
			PositionTop(val.GetComponent<RectTransform>(), 102f, 58f);
			HorizontalLayoutGroup val2 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 12f;
			((LayoutGroup)val2).padding = new RectOffset(16, 16, 10, 10);
			((LayoutGroup)val2).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true;
			TextMeshProUGUI val3 = CreateTextMeshPro("SearchIcon", val.transform, "SEARCH", 11f, _accentBase, (TextAlignmentOptions)513);
			((TMP_Text)val3).fontStyle = (FontStyles)1;
			((Component)val3).gameObject.AddComponent<LayoutElement>().preferredWidth = 74f;
			GameObject val4 = CreateCard("SearchField", val.transform, new Color(_bg2.r, _bg2.g, _bg2.b, 0.94f));
			val4.AddComponent<LayoutElement>().flexibleWidth = 1f;
			val4.GetComponent<RectTransform>().sizeDelta = new Vector2(0f, 36f);
			_searchInput = val4.AddComponent<TMP_InputField>();
			GameObject val5 = CreateUIElement("SearchViewport", val4.transform);
			RectTransform component = val5.GetComponent<RectTransform>();
			Stretch(component, 10f, 10f, 0f, 0f);
			val5.AddComponent<RectMask2D>();
			_searchInput.textViewport = component;
			TextMeshProUGUI val6 = CreateTextMeshPro("SearchText", val5.transform, string.Empty, 15f, _fg, (TextAlignmentOptions)513);
			Stretch(((TMP_Text)val6).rectTransform, 0f, 0f, 0f, 0f);
			_searchInput.textComponent = (TMP_Text)(object)val6;
			_searchPlaceholderText = CreateTextMeshPro("SearchPlaceholder", val5.transform, string.Empty, 15f, _mutedCol, (TextAlignmentOptions)513);
			Stretch(((TMP_Text)_searchPlaceholderText).rectTransform, 0f, 0f, 0f, 0f);
			_searchInput.placeholder = (Graphic)(object)_searchPlaceholderText;
			((UnityEvent<string>)(object)_searchInput.onValueChanged).AddListener((UnityAction<string>)OnSearchChanged);
			GameObject val7 = CreateCard("SceneBadge", val.transform, new Color(_surfaceLift.r, _surfaceLift.g, _surfaceLift.b, 0.9f));
			val7.AddComponent<LayoutElement>().preferredWidth = 240f;
			VerticalLayoutGroup val8 = val7.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val8).padding = new RectOffset(12, 12, 8, 8);
			((LayoutGroup)val8).childAlignment = (TextAnchor)4;
			_sceneBadgeText = CreateTextMeshPro("SceneBadgeText", val7.transform, string.Empty, 11f, _fg, (TextAlignmentOptions)514);
			((TMP_Text)_sceneBadgeText).enableWordWrapping = true;
		}

		private void MakeStatusCard(Transform parent)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateCard("StatusCard", parent, _surface);
			PositionTop(val.GetComponent<RectTransform>(), 174f, 78f);
			VerticalLayoutGroup val2 = val.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 6f;
			((LayoutGroup)val2).padding = new RectOffset(16, 16, 14, 14);
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false;
			_statusText = CreateTextMeshPro("StatusText", val.transform, string.Empty, 13f, _fg, (TextAlignmentOptions)513);
			((TMP_Text)_statusText).enableWordWrapping = true;
			_countText = CreateTextMeshPro("CountText", val.transform, string.Empty, 11f, _mutedCol, (TextAlignmentOptions)513);
		}

		private void MakeScrollArea(Transform parent)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: 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_039f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateCard("ScrollShell", parent, new Color(_surface.r, _surface.g, _surface.b, 0.55f));
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 1f);
			component.offsetMin = new Vector2(0f, 12f);
			component.offsetMax = new Vector2(0f, -266f);
			GameObject val2 = CreateUIElement("ScrollView", val.transform);
			Stretch(val2.GetComponent<RectTransform>(), 12f, 18f, 12f, 12f);
			_scrollRect = val2.AddComponent<ScrollRect>();
			_scrollRect.horizontal = false;
			_scrollRect.vertical = true;
			_scrollRect.scrollSensitivity = _scrollSpeed.Value;
			_scrollRect.verticalScrollbarVisibility = (ScrollbarVisibility)0;
			GameObject val3 = CreateUIElement("Viewport", val2.transform);
			RectTransform component2 = val3.GetComponent<RectTransform>();
			component2.anchorMin = Vector2.zero;
			component2.anchorMax = Vector2.one;
			component2.offsetMin = Vector2.zero;
			component2.offsetMax = new Vector2(-10f, 0f);
			val3.AddComponent<RectMask2D>();
			_scrollViewportRect = component2;
			_scrollRect.viewport = component2;
			GameObject val4 = CreateUIElement("Content", val3.transform);
			RectTransform component3 = val4.GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0f, 1f);
			component3.anchorMax = new Vector2(1f, 1f);
			component3.pivot = new Vector2(0.5f, 1f);
			component3.sizeDelta = Vector2.zero;
			VerticalLayoutGroup val5 = val4.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val5).spacing = 10f;
			((HorizontalOrVerticalLayoutGroup)val5).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val5).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)val5).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val5).childForceExpandHeight = false;
			val4.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			_scrollRect.content = component3;
			_contentContainer = val4.transform;
			GameObject val6 = CreateUIElement("Scrollbar", val2.transform);
			RectTransform component4 = val6.GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(1f, 0f);
			component4.anchorMax = new Vector2(1f, 1f);
			component4.pivot = new Vector2(1f, 1f);
			component4.sizeDelta = new Vector2(10f, 0f);
			component4.anchoredPosition = Vector2.zero;
			((Graphic)val6.AddComponent<Image>()).color = new Color(_surfaceLift.r, _surfaceLift.g, _surfaceLift.b, 0.7f);
			Scrollbar val7 = val6.AddComponent<Scrollbar>();
			val7.direction = (Direction)2;
			GameObject val8 = CreateUIElement("SlidingArea", val6.transform);
			Stretch(val8.GetComponent<RectTransform>(), 2f, 2f, 2f, 2f);
			GameObject val9 = CreateUIElement("Handle", val8.transform);
			Stretch(val9.GetComponent<RectTransform>(), 0f, 0f, 0f, 0f);
			Image val10 = val9.AddComponent<Image>();
			((Graphic)val10).color = _accentBase;
			val7.handleRect = val9.GetComponent<RectTransform>();
			((Selectable)val7).targetGraphic = (Graphic)(object)val10;
			_scrollRect.verticalScrollbar = val7;
		}

		private void ShowCanvas()
		{
			if (Object.op_Implicit((Object)(object)_canvasRoot))
			{
				_canvasRoot.SetActive(true);
			}
			UpdateSearchPlaceholder();
			_searchInput.SetTextWithoutNotify(GetCurrentSearch());
			if ((Object)(object)_scrollRect != (Object)null)
			{
				_scrollRect.verticalNormalizedPosition = 1f;
			}
			if ((Object)(object)_sidebarScrollRect != (Object)null)
			{
				_sidebarScrollRect.verticalNormalizedPosition = 1f;
			}
			RefreshCurrentTab();
			RebuildLayout();
		}

		private void HideCanvas()
		{
			if (Object.op_Implicit((Object)(object)_canvasRoot))
			{
				_canvasRoot.SetActive(false);
			}
		}

		private void OpenBrowser()
		{
			if (!_discovered && !_discovering)
			{
				((MonoBehaviour)this).StartCoroutine(DiscoverRoutine());
			}
			TakeCursor();
			ShowCanvas();
		}

		private void CloseBrowser()
		{
			HideCanvas();
			RestoreCursor();
		}

		private void SwitchTab(int index)
		{
			_tabIndex = index;
			UpdateSearchPlaceholder();
			_searchInput.SetTextWithoutNotify(GetCurrentSearch());
			RefreshCurrentTab();
		}

		private void OnSearchChanged(string value)
		{
			switch (_tabIndex)
			{
			case 0:
				_searchEnemies = value;
				break;
			case 1:
				_searchValuables = value;
				break;
			case 2:
				_searchItems = value;
				break;
			case 3:
				_searchTeleport = value;
				break;
			}
			RefreshCurrentTab();
		}

		private string GetCurrentSearch()
		{
			int tabIndex = _tabIndex;
			if (1 == 0)
			{
			}
			string result = tabIndex switch
			{
				0 => _searchEnemies, 
				1 => _searchValuables, 
				2 => _searchItems, 
				3 => _searchTeleport, 
				_ => string.Empty, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private void UpdateSearchPlaceholder()
		{
			if ((Object)(object)_searchPlaceholderText != (Object)null)
			{
				((TMP_Text)_searchPlaceholderText).text = SearchHints[Mathf.Clamp(_tabIndex, 0, SearchHints.Length - 1)];
			}
		}

		private void UpdateTabVisuals()
		{
			//IL_007f: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_tabBar == (Object)null)
			{
				return;
			}
			for (int i = 0; i < _tabBar.childCount; i++)
			{
				Button component = ((Component)_tabBar.GetChild(i)).GetComponent<Button>();
				if (!((Object)(object)component == (Object)null))
				{
					Image component2 = ((Component)component).GetComponent<Image>();
					Outline component3 = ((Component)component).GetComponent<Outline>();
					TextMeshProUGUI componentInChildren = ((Component)component).GetComponentInChildren<TextMeshProUGUI>();
					bool flag = i == _tabIndex;
					if ((Object)(object)component2 != (Object)null)
					{
						((Graphic)component2).color = (flag ? _surfaceLift : _bg2);
					}
					if ((Object)(object)component3 != (Object)null)
					{
						((Shadow)component3).effectColor = (flag ? new Color(_accentBase.r, _accentBase.g, _accentBase.b, 0.75f) : new Color(_surfaceLift.r, _surfaceLift.g, _surfaceLift.b, 0.45f));
					}
					if ((Object)(object)componentInChildren != (Object)null)
					{
						((Graphic)componentInChildren).color = (flag ? Color.white : _fg);
					}
				}
			}
		}

		private void RefreshCurrentTab()
		{
			if (!((Object)(object)_contentContainer == (Object)null))
			{
				ClearContent();
				SetStatus(BuildTabStatus(), keepAsBase: true);
				if (_tabIndex == 0)
				{
					RenderEnemiesTab();
				}
				else if (_tabIndex == 1)
				{
					RenderValuablesTab();
				}
				else if (_tabIndex == 2)
				{
					RenderItemsTab();
				}
				else if (_tabIndex == 3)
				{
					RenderTeleportTab();
				}
				RebuildLayout();
			}
		}

		private void ClearContent()
		{
			for (int num = _contentContainer.childCount - 1; num >= 0; num--)
			{
				Object.Destroy((Object)(object)((Component)_contentContainer.GetChild(num)).gameObject);
			}
		}

		private void HandleMouseWheelScroll()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			float y = Input.mouseScrollDelta.y;
			if (!(Mathf.Abs(y) < 0.01f))
			{
				if (IsPointerInside(_scrollViewportRect) && (Object)(object)_scrollRect != (Object)null)
				{
					ApplyScrollDelta(_scrollRect, y, 0.13f);
				}
				else if (IsPointerInside(_sidebarViewportRect) && (Object)(object)_sidebarScrollRect != (Object)null)
				{
					ApplyScrollDelta(_sidebarScrollRect, y, 0.11f);
				}
			}
		}

		private static bool IsPointerInside(RectTransform rect)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			return (Object)(object)rect != (Object)null && RectTransformUtility.RectangleContainsScreenPoint(rect, Vector2.op_Implicit(Input.mousePosition), (Camera)null);
		}

		private static void ApplyScrollDelta(ScrollRect scrollRect, float wheel, float strength)
		{
			//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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)scrollRect == (Object)null) && !((Object)(object)scrollRect.content == (Object)null) && !((Object)(object)scrollRect.viewport == (Object)null))
			{
				Rect rect = scrollRect.content.rect;
				float height = ((Rect)(ref rect)).height;
				rect = scrollRect.viewport.rect;
				if (!(height <= ((Rect)(ref rect)).height + 1f))
				{
					scrollRect.verticalNormalizedPosition = Mathf.Clamp01(scrollRect.verticalNormalizedPosition + wheel * strength);
				}
			}
		}

		private void RenderEnemiesTab()
		{
			if (_discovering)
			{
				RenderEmptyState("Scanning Enemy Setups", "Pulling live enemy setup assets from the current game build.");
				((TMP_Text)_countText).text = "Working...";
				return;
			}
			List<string> list = ApplySearchAndSort(_enemyNames, _searchEnemies);
			((TMP_Text)_countText).text = $"{list.Count} enemy setups · spawn x{_spawnQuantity.Value} · {GetSpawnOriginLabel()}";
			if (!_discovered && list.Count == 0)
			{
				RenderEmptyState("No Enemy Data Yet", "Load into a run and press RESCAN to discover enemy setups from the current session.");
				return;
			}
			if (list.Count == 0)
			{
				RenderEmptyState("No Enemy Matches", "Try a wider search or switch to another tab.");
				return;
			}
			foreach (string name in list)
			{
				if (_enemyByKey.TryGetValue(name.ToLowerInvariant(), out EnemySetup value) && !((Object)(object)value == (Object)null))
				{
					string meta = $"{Mathf.Max(value.spawnObjects?.Count ?? 0, 1)} prefab refs · {GetSpawnOriginLabel()}";
					CreateEntryCard(name.ToUpperInvariant(), meta, "SPAWN", delegate
					{
						SpawnEnemy(name);
					}, null, null, highlight: false, $"Enemy setup '{name}' uses {Mathf.Max(value.spawnObjects?.Count ?? 0, 1)} prefab refs and spawns x{_spawnQuantity.Value} at {GetResolvedSpawnOriginLabel()}.");
				}
			}
		}

		private void RenderValuablesTab()
		{
			if (_discovering)
			{
				RenderEmptyState("Scanning Valuable Prefabs", "Collecting every valuable prefab reference found in the current level pool.");
				((TMP_Text)_countText).text = "Working...";
				return;
			}
			List<string> list = ApplySearchAndSort(_valuableNames, _searchValuables);
			((TMP_Text)_countText).text = $"{list.Count} valuables · spawn x{_spawnQuantity.Value} · {GetSpawnOriginLabel()}";
			if (!_discovered && list.Count == 0)
			{
				RenderEmptyState("No Valuable Data Yet", "Load into a run and press RESCAN to discover valuable prefabs from the live level presets.");
				return;
			}
			if (list.Count == 0)
			{
				RenderEmptyState("No Valuable Matches", "Try a broader search or switch tabs.");
				return;
			}
			foreach (string name in list)
			{
				if (_valuableByKey.TryGetValue(name.ToLowerInvariant(), out PrefabRef value) && value != null)
				{
					CreateEntryCard(name.ToUpperInvariant(), value.ResourcePath + " · " + GetSpawnOriginLabel(), "SPAWN", delegate
					{
						SpawnValuable(name);
					}, null, null, highlight: false, $"Valuable '{name}' will spawn x{_spawnQuantity.Value} at {GetResolvedSpawnOriginLabel()} using prefab path '{value.ResourcePath}'.");
				}
			}
		}

		private void RenderItemsTab()
		{
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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)
			if (_discovering)
			{
				RenderEmptyState("Scanning Items And Upgrades", "Reading shop pools and item dictionaries from the active run.");
				((TMP_Text)_countText).text = "Working...";
				return;
			}
			List<string> list = ApplySearchAndSort(_itemNames, _searchItems);
			((TMP_Text)_countText).text = $"{list.Count} items · spawn x{_spawnQuantity.Value} · {GetSpawnOriginLabel()}";
			if (!_discovered && list.Count == 0)
			{
				RenderEmptyState("No Item Data Yet", "Open a run or shop state, then RESCAN to pull the current item catalog.");
				return;
			}
			if (list.Count == 0)
			{
				RenderEmptyState("No Item Matches", "Try a broader search or switch tabs.");
				return;
			}
			foreach (string name in list)
			{
				if (_itemByKey.TryGetValue(name.ToLowerInvariant(), out Item value) && !((Object)(object)value == (Object)null))
				{
					CreateEntryCard(name.ToUpperInvariant(), $"{value.itemType} · {value.itemVolume} · {GetSpawnOriginLabel()}", "SPAWN", delegate
					{
						SpawnItem(name);
					}, null, null, highlight: false, $"Item '{name}' is a {value.itemType} with {value.itemVolume} volume and spawns x{_spawnQuantity.Value} at {GetResolvedSpawnOriginLabel()}.");
				}
			}
		}

		private void RenderTeleportTab()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			List<LevelPoint> source = (from point in Object.FindObjectsOfType<LevelPoint>()
				where (Object)(object)point != (Object)null
				select point).ToList();
			Vector3 playerPos = GetPlayerPosition();
			IEnumerable<LevelPoint> source2 = source.Where(delegate(LevelPoint point)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				if (string.IsNullOrWhiteSpace(_searchTeleport))
				{
					return true;
				}
				string text = ((Object)point).name + " " + BuildTeleportMeta(point, playerPos, (Object)(object)ResolvePinnedTeleportPoint() == (Object)(object)point);
				return text.IndexOf(_searchTeleport, StringComparison.OrdinalIgnoreCase) >= 0;
			});
			source2 = (_sortAscending.Value ? source2.OrderBy<LevelPoint, string>((LevelPoint point) => ((Object)point).name, StringComparer.OrdinalIgnoreCase) : source2.OrderByDescending<LevelPoint, string>((LevelPoint point) => ((Object)point).name, StringComparer.OrdinalIgnoreCase));
			List<LevelPoint> list = source2.ToList();
			((TMP_Text)_countText).text = $"{list.Count} level points · pinned {GetPinnedPointLabel()}";
			if (list.Count == 0)
			{
				RenderEmptyState("No Level Points Found", "Load into a generated level to teleport or pin a level point for later spawns.");
				return;
			}
			foreach (LevelPoint point2 in list)
			{
				bool pinned = (Object)(object)ResolvePinnedTeleportPoint() == (Object)(object)point2;
				CreateEntryCard(((Object)point2).name.ToUpperInvariant(), BuildTeleportMeta(point2, playerPos, pinned), "WARP", delegate
				{
					TeleportToPoint(point2);
				}, pinned ? "UNPIN" : "PIN", delegate
				{
					if (pinned)
					{
						_pinnedTeleportPoint = null;
						_pinnedTeleportPointName = string.Empty;
						RefreshCurrentTab();
						SetActionFeedback("Cleared pinned anchor for teleport points.");
					}
					else
					{
						PinTeleportPoint(point2);
						RefreshCurrentTab();
						SetActionFeedback("Pinned '" + ((Object)point2).name + "' as the spawn anchor.");
					}
				}, pinned, "Warp locally to '" + ((Object)point2).name + "', or pin it as the shared spawn anchor for enemies, valuables, and items.");
			}
		}

		private List<string> ApplySearchAndSort(IEnumerable<string> source, string search)
		{
			string search2 = search;
			IEnumerable<string> source2 = source;
			if (!string.IsNullOrWhiteSpace(search2))
			{
				source2 = source2.Where((string name) => name.IndexOf(search2, StringComparison.OrdinalIgnoreCase) >= 0);
			}
			source2 = (_sortAscending.Value ? source2.OrderBy<string, string>((string name) => name, StringComparer.OrdinalIgnoreCase) : source2.OrderByDescending<string, string>((string name) => name, StringComparer.OrdinalIgnoreCase));
			return source2.ToList();
		}

		private void RenderEmptyState(string title, string body)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateCard("EmptyState", _contentContainer, _surface);
			val.AddComponent<LayoutElement>().preferredHeight = 120f;
			VerticalLayoutGroup val2 = val.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 8f;
			((LayoutGroup)val2).padding = new RectOffset(20, 20, 20, 20);
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false;
			TextMeshProUGUI val3 = CreateTextMeshPro("Title", val.transform, title.ToUpperInvariant(), 18f, _fg, (TextAlignmentOptions)513);
			((TMP_Text)val3).fontStyle = (FontStyles)1;
			TextMeshProUGUI val4 = CreateTextMeshPro("Body", val.transform, body, 13f, _mutedCol, (TextAlignmentOptions)257);
			((TMP_Text)val4).enableWordWrapping = true;
		}

		private GameObject CreateEntryCard(string title, string meta, string primaryLabel, Action primaryAction, string? secondaryLabel = null, Action? secondaryAction = null, bool highlight = false, string? hoverStatus = null)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Expected O, but got Unknown
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected O, but got Unknown
			Action primaryAction2 = primaryAction;
			Action secondaryAction2 = secondaryAction;
			GameObject val = CreateCard("EntryCard", _contentContainer, highlight ? _surfaceLift : _surface);
			val.AddComponent<LayoutElement>().preferredHeight = ((secondaryLabel == null) ? 84f : 92f);
			HorizontalLayoutGroup val2 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val2).spacing = 12f;
			((LayoutGroup)val2).padding = new RectOffset(16, 16, 14, 14);
			((LayoutGroup)val2).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true;
			GameObject val3 = CreateUIElement("Copy", val.transform);
			val3.AddComponent<LayoutElement>().flexibleWidth = 1f;
			VerticalLayoutGroup val4 = val3.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val4).spacing = 4f;
			((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = false;
			TextMeshProUGUI val5 = CreateTextMeshPro("EntryTitle", val3.transform, title, 16f, _fg, (TextAlignmentOptions)513);
			((TMP_Text)val5).fontStyle = (FontStyles)1;
			TextMeshProUGUI val6 = CreateTextMeshPro("EntryMeta", val3.transform, meta, 12f, highlight ? _success : _mutedCol, (TextAlignmentOptions)257);
			((TMP_Text)val6).enableWordWrapping = true;
			GameObject val7 = CreateUIElement("Actions", val.transform);
			HorizontalLayoutGroup val8 = val7.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val8).spacing = 8f;
			((HorizontalOrVerticalLayoutGroup)val8).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val8).childControlHeight = true;
			GameObject val9 = CreateButton("PrimaryAction", val7.transform, primaryLabel, primary: true);
			val9.AddComponent<LayoutElement>().preferredWidth = 92f;
			((UnityEvent)val9.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				primaryAction2();
			});
			if (!string.IsNullOrWhiteSpace(secondaryLabel) && secondaryAction2 != null)
			{
				GameObject val10 = CreateButton("SecondaryAction", val7.transform, secondaryLabel, primary: false);
				val10.AddComponent<LayoutElement>().preferredWidth = 78f;
				((UnityEvent)val10.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					secondaryAction2();
				});
			}
			if (!string.IsNullOrWhiteSpace(hoverStatus))
			{
				AttachHoverStatus(val, hoverStatus);
			}
			return val;
		}

		private void AttachHoverStatus(GameObject target, string hoverStatus)
		{
			//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)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			string hoverStatus2 = hoverStatus;
			if (_showTooltips.Value && !string.IsNullOrWhiteSpace(hoverStatus2))
			{
				EventTrigger val = target.AddComponent<EventTrigger>();
				Entry val2 = new Entry
				{
					eventID = (EventTriggerType)0
				};
				((UnityEvent<BaseEventData>)(object)val2.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					ShowTooltip(hoverStatus2);
				});
				val.triggers.Add(val2);
				Entry val3 = new Entry
				{
					eventID = (EventTriggerType)1
				};
				((UnityEvent<BaseEventData>)(object)val3.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					HideTooltip();
				});
				val.triggers.Add(val3);
			}
		}

		private void ShowTooltip(string text)
		{
			if ((Object)(object)_statusText != (Object)null && !string.IsNullOrWhiteSpace(text))
			{
				((TMP_Text)_statusText).text = text;
			}
		}

		private void HideTooltip()
		{
			if ((Object)(object)_statusText != (Object)null)
			{
				((TMP_Text)_statusText).text = _baseStatus;
			}
		}

		private string BuildTabStatus()
		{
			string sessionModeLabel = GetSessionModeLabel();
			int tabIndex = _tabIndex;
			if (1 == 0)
			{
			}
			string result = tabIndex switch
			{
				0 => $"{sessionModeLabel} · Enemy setups spawn x{_spawnQuantity.Value} at {GetSpawnOriginLabel()}.", 
				1 => $"{sessionModeLabel} · Valuables spawn x{_spawnQuantity.Value} at {GetSpawnOriginLabel()}.", 
				2 => $"{sessionModeLabel} · Items spawn x{_spawnQuantity.Value} at {GetSpawnOriginLabel()}.", 
				3 => "Local-only teleport browser. Pin any level point to reuse it as the shared spawn anchor.", 
				_ => _baseStatus, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private string GetSessionModeLabel()
		{
			if (!InRoom())
			{
				return "Offline session";
			}
			if (IsSoloRoom())
			{
				return "Solo room";
			}
			if (IsHost())
			{
				return "Host session";
			}
			return "Client session";
		}

		private void SetStatus(string text, bool keepAsBase)
		{
			if (keepAsBase)
			{
				_baseStatus = text;
			}
			if ((Object)(object)_statusText != (Object)null)
			{
				((TMP_Text)_statusText).text = text;
			}
			UpdateChrome();
		}

		private void SetActionFeedback(string text)
		{
			_lastAction = text;
			SetStatus(text, keepAsBase: true);
		}

		private void UpdateChrome()
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_spawnQuantityValueText != (Object)null)
			{
				((TMP_Text)_spawnQuantityValueText).text = $"x{_spawnQuantity.Value}";
			}
			if ((Object)(object)_spawnOriginValueText != (Object)null)
			{
				((TMP_Text)_spawnOriginValueText).text = GetSpawnOriginButtonLabel().ToUpperInvariant();
			}
			if ((Object)(object)_sortValueText != (Object)null)
			{
				((TMP_Text)_sortValueText).text = (_sortAscending.Value ? "A-Z" : "Z-A");
			}
			if ((Object)(object)_sceneBadgeText != (Object)null)
			{
				TextMeshProUGUI sceneBadgeText = _sceneBadgeText;
				Scene activeScene = SceneManager.GetActiveScene();
				((TMP_Text)sceneBadgeText).text = ((Scene)(ref activeScene)).name.ToUpperInvariant() + "\n" + GetSessionModeLabel().ToUpperInvariant();
			}
			if ((Object)(object)_summaryText != (Object)null)
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.AppendLine($"Enemies: {_enemyNames.Count}");
				stringBuilder.AppendLine($"Valuables: {_valuableNames.Count}");
				stringBuilder.AppendLine($"Items: {_itemNames.Count}");
				stringBuilder.AppendLine("Anchor: " + GetPinnedPointLabel());
				stringBuilder.Append("Last: " + SummarizeActionText(_lastAction, 28));
				((TMP_Text)_summaryText).text = stringBuilder.ToString();
			}
		}

		private IEnumerator DiscoverRoutine()
		{
			if (_discovering)
			{
				yield break;
			}
			_discovering = true;
			if ((Object)(object)_refreshButton != (Object)null)
			{
				((Selectable)_refreshButton).interactable = false;
			}
			_enemyNames.Clear();
			_valuableNames.Clear();
			_itemNames.Clear();
			_enemyByKey.Clear();
			_valuableByKey.Clear();
			_itemByKey.Clear();
			SetStatus("Scanning enemy setups from the current Assembly-CSharp build...", keepAsBase: true);
			yield return null;
			int enemyCount = 0;
			try
			{
				HashSet<string> set = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
				EnemySetup[] array = Resources.FindObjectsOfTypeAll<EnemySetup>();
				foreach (EnemySetup setup in array)
				{
					if (!((Object)(object)setup == (Object)null) && setup.spawnObjects != null && setup.spawnObjects.Count != 0)
					{
						string display = NormalizeName(((Object)setup).name, RxEnemyTrim);
						if (!string.IsNullOrWhiteSpace(display))
						{
							_enemyByKey[display.ToLowerInvariant()] = setup;
							set.Add(display);
						}
					}
				}
				_enemyNames.AddRange(set.OrderBy<string, string>((string name) => name, StringComparer.OrdinalIgnoreCase));
				enemyCount = _enemyNames.Count;
			}
			catch (Exception ex2)
			{
				Logger.LogWarning((object)("Enemy discovery failed: " + ex2.Message));
			}
			SetStatus("Scanning valuable prefab references from live level presets...", keepAsBase: true);
			yield return null;
			int valuableCount = 0;
			try
			{
				HashSet<string> set2 = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
				if ((Object)(object)RunManager.instance != (Object)null && RunManager.instance.levels != null)
				{
					foreach (Level level in RunManager.instance.levels)
					{
						if ((Object)(object)level == (Object)null || level.ValuablePresets == null)
						{
							continue;
						}
						foreach (LevelValuables preset in level.ValuablePresets)
						{
							AddValuableEntries(preset, set2);
						}
					}
				}
				_valuableNames.AddRange(set2.OrderBy<string, string>((string name) => name, StringComparer.OrdinalIgnoreCase));
				valuableCount = _valuableNames.Count;
			}
			catch (Exception ex3)
			{
				Logger.LogWarning((object)("Valuable discovery failed: " + ex3.Message));
			}
			SetStatus("Scanning items, upgrades, and shop pools from the active run...", keepAsBase: true);
			yield return null;
			int itemCount = 0;
			try
			{
				HashSet<string> set3 = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
				if ((Object)(object)ShopManager.instance != (Object)null)
				{
					foreach (Item item2 in ShopManager.instance.potentialItems)
					{
						AddItemEntry(item2, set3);
					}
					foreach (Item item5 in ShopManager.instance.potentialItemConsumables)
					{
						AddItemEntry(item5, set3);
					}
					foreach (Item item4 in ShopManager.instance.potentialItemUpgrades)
					{
						AddItemEntry(item4, set3);
					}
				}
				if ((Object)(object)StatsManager.instance != (Object)null)
				{
					foreach (Item item3 in StatsManager.instance.itemDictionary.Values)
					{
						AddItemEntry(item3, set3);
					}
				}
				if ((Object)(object)ItemManager.instance != (Object)null)
				{
					foreach (Item item in ItemManager.instance.purchasedItems)
					{
						AddItemEntry(item, set3);
					}
				}
				_itemNames.AddRange(set3.OrderBy<string, string>((string name) => name, StringComparer.OrdinalIgnoreCase));
				itemCount = _itemNames.Count;
			}
			catch (Exception ex)
			{
				Logger.LogWarning((object)("Item discovery failed: " + ex.Message));
			}
			_discovered = enemyCount + valuableCount + itemCount > 0;
			_discovering = false;
			if ((Object)(object)_refreshButton != (Object)null)
			{
				((Selectable)_refreshButton).interactable = true;
			}
			SetStatus(_discovered ? $"Discovery complete. Found {enemyCount} enemy setups, {valuableCount} valuables, and {itemCount} items." : "Discovery complete, but no live spawn data was found. Load into a run and rescan.", keepAsBase: true);
			Logger.LogInfo((object)$"Discovered {enemyCount} enemies, {valuableCount} valuables, {itemCount} items.");
			if (_uiVisible)
			{
				RefreshCurrentTab();
			}
		}

		private void AddValuableEntries(LevelValuables? preset, HashSet<string> set)
		{
			if ((Object)(object)preset == (Object)null)
			{
				return;
			}
			foreach (PrefabRef item in EnumeratePrefabRefs(preset.tiny))
			{
				AddValuableEntry(item, set);
			}
			foreach (PrefabRef item2 in EnumeratePrefabRefs(preset.small))
			{
				AddValuableEntry(item2, set);
			}
			foreach (PrefabRef item3 in EnumeratePrefabRefs(preset.medium))
			{
				AddValuableEntry(item3, set);
			}
			foreach (PrefabRef item4 in EnumeratePrefabRefs(preset.big))
			{
				AddValuableEntry(item4, set);
			}
			foreach (PrefabRef item5 in EnumeratePrefabRefs(preset.wide))
			{
				AddValuableEntry(item5, set);
			}
			foreach (PrefabRef item6 in EnumeratePrefabRefs(preset.tall))
			{
				AddValuableEntry(item6, set);
			}
			foreach (PrefabRef item7 in EnumeratePrefabRefs(preset.veryTall))
			{
				AddValuableEntry(item7, set);
			}
		}

		private void AddValuableEntry(PrefabRef? prefab, HashSet<string> set)
		{
			if (prefab != null && prefab.IsValid())
			{
				string text = NormalizeName(prefab.PrefabName, RxValuableTrim);
				if (!string.IsNullOrWhiteSpace(text))
				{
					_valuableByKey[text.ToLowerInvariant()] = prefab;
					set.Add(text);
				}
			}
		}

		private void AddItemEntry(Item? item, HashSet<string> set)
		{
			if (!((Object)(object)item == (Object)null) && item.prefab != null && item.prefab.IsValid())
			{
				string text = NormalizeName(item.itemName, RxItemTrim);
				if (string.IsNullOrWhiteSpace(text))
				{
					text = NormalizeName(((Object)item).name, RxItemTrim);
				}
				if (!string.IsNullOrWhiteSpace(text))
				{
					_itemByKey[text.ToLowerInvariant()] = item;
					set.Add(text);
				}
			}
		}

		private void SpawnEnemy(string displayName)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHostOrOffline())
			{
				SetActionFeedback("Enemy spawning is blocked for clients. Host or offline only.");
				return;
			}
			if (!_enemyByKey.TryGetValue(displayName.Trim().ToLowerInvariant(), out EnemySetup value) || (Object)(object)value == (Object)null)
			{
				SetActionFeedback("Enemy setup '" + displayName + "' is no longer available in the current scan.");
				return;
			}
			string anchorLabel;
			Vector3 val = ResolveSpawnBasePosition(out anchorLabel);
			int num = 0;
			EnemyDirector instance = EnemyDirector.instance;
			bool debugSpawnClose = (Object)(object)instance != (Object)null && instance.debugSpawnClose;
			try
			{
				if ((Object)(object)instance != (Object)null)
				{
					instance.debugSpawnClose = true;
				}
				for (int i = 0; i < _spawnQuantity.Value; i++)
				{
					if (SpawnEnemySetupAt(value, val + GetSpawnOffset(i, _spawnQuantity.Value, 2.4f)))
					{
						num++;
					}
				}
				SetActionFeedback($"Spawned {num}/{_spawnQuantity.Value} '{displayName}' at {anchorLabel}.");
			}
			catch (Exception ex)
			{
				Logger.LogWarning((object)("Enemy spawn failed: " + ex.Message));
				SetActionFeedback("Enemy spawn failed for '" + displayName + "'.");
			}
			finally
			{
				if ((Object)(object)instance != (Object)null)
				{
					instance.debugSpawnClose = debugSpawnClose;
				}
			}
		}

		private bool SpawnEnemySetupAt(EnemySetup setup, Vector3 spawnPos)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			bool result = false;
			foreach (PrefabRef spawnObject in setup.spawnObjects)
			{
				if (spawnObject == null)
				{
					continue;
				}
				GameObject val = InstantiatePrefabRef(spawnObject, spawnPos, Quaternion.identity);
				if (!Object.op_Implicit((Object)(object)val))
				{
					continue;
				}
				if (InRoom() && !HasValidPhotonView(val))
				{
					try
					{
						Object.Destroy((Object)(object)val);
					}
					catch
					{
					}
					continue;
				}
				result = true;
				EnemyParent component = val.GetComponent<EnemyParent>();
				if ((Object)(object)component != (Object)null)
				{
					try
					{
						component.SetupDone = true;
					}
					catch
					{
					}
					try
					{
						component.firstSpawnPointUsed = true;
					}
					catch
					{
					}
				}
				Enemy componentInChildren = val.GetComponentInChildren<Enemy>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					try
					{
						componentInChildren.EnemyTeleported(spawnPos);
					}
					catch
					{
					}
				}
			}
			return result;
		}

		private void SpawnValuable(string displayName)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0086: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHostOrOffline())
			{
				SetActionFeedback("Valuable spawning is blocked for clients. Host or offline only.");
				return;
			}
			if (!_valuableByKey.TryGetValue(displayName.Trim().ToLowerInvariant(), out PrefabRef value) || value == null)
			{
				SetActionFeedback("Valuable '" + displayName + "' is no longer available in the current scan.");
				return;
			}
			string anchorLabel;
			Vector3 val = ResolveSpawnBasePosition(out anchorLabel) + Vector3.up;
			int num = 0;
			for (int i = 0; i < _spawnQuantity.Value; i++)
			{
				try
				{
					GameObject val2 = InstantiatePrefabRef(value, val + GetSpawnOffset(i, _spawnQuantity.Value, 1.35f), Quaternion.identity);
					if (!Object.op_Implicit((Object)(object)val2))
					{
						continue;
					}
					if (InRoom() && !HasValidPhotonView(val2))
					{
						Object.Destroy((Object)(object)val2);
						continue;
					}
					ValuableObject component = val2.GetComponent<ValuableObject>();
					if (component != null)
					{
						component.DollarValueSetLogic();
					}
					num++;
				}
				catch (Exception ex)
				{
					Logger.LogWarning((object)("Valuable spawn failed: " + ex.Message));
				}
			}
			SetActionFeedback($"Spawned {num}/{_spawnQuantity.Value} '{displayName}' at {anchorLabel}.");
		}

		private void SpawnItem(string displayName)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHostOrOffline())
			{
				SetActionFeedback("Item spawning is blocked for clients. Host or offline only.");
				return;
			}
			if (!_itemByKey.TryGetValue(displayName.Trim().ToLowerInvariant(), out Item value) || (Object)(object)value == (Object)null || value.prefab == null)
			{
				SetActionFeedback("Item '" + displayName + "' is no longer available in the current scan.");
				return;
			}
			Quaternion rot = value.spawnRotationOffset;
			if ((Object)(object)ShopManager.instance != (Object)null && (Object)(object)ShopManager.instance.itemRotateHelper != (Object)null)
			{
				rot = ShopManager.instance.itemRotateHelper.rotation;
			}
			string anchorLabel;
			Vector3 val = ResolveSpawnBasePosition(out anchorLabel) + Vector3.up;
			int num = 0;
			for (int i = 0; i < _spawnQuantity.Value; i++)
			{
				try
				{
					GameObject val2 = InstantiatePrefabRef(value.prefab, val + GetSpawnOffset(i, _spawnQuantity.Value, 1.2f), rot);
					if (Object.op_Implicit((Object)(object)val2))
					{
						if (InRoom() && !HasValidPhotonView(val2))
						{
							Object.Destroy((Object)(object)val2);
						}
						else
						{
							num++;
						}
					}
				}
				catch (Exception ex)
				{
					Logger.LogWarning((object)("Item spawn failed: " + ex.Message));
				}
			}
			SetActionFeedback($"Spawned {num}/{_spawnQuantity.Value} '{displayName}' at {anchorLabel}.");
		}

		private Vector3 ResolveSpawnBasePosition(out string anchorLabel)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			switch (_spawnOriginMode.Value)
			{
			case 1:
				anchorLabel = "player position";
				return GetPlayerPosition();
			case 2:
			{
				LevelPoint val = ResolvePinnedTeleportPoint();
				if ((Object)(object)val != (Object)null)
				{
					anchorLabel = "pinned point '" + ((Object)val).name + "'";
					return ((Component)val).transform.position;
				}
				break;
			}
			}
			LevelPoint closestLevelPoint = GetClosestLevelPoint();
			if ((Object)(object)closestLevelPoint != (Object)null)
			{
				anchorLabel = "closest point '" + ((Object)closestLevelPoint).name + "'";
				return ((Component)closestLevelPoint).transform.position;
			}
			anchorLabel = "player position";
			return GetPlayerPosition();
		}

		private string GetSpawnOriginLabel()
		{
			int value = _spawnOriginMode.Value;
			if (1 == 0)
			{
			}
			string result = value switch
			{
				0 => "closest level point", 
				1 => "player position", 
				2 => ((Object)(object)ResolvePinnedTeleportPoint() != (Object)null) ? ("pinned point '" + ((Object)ResolvePinnedTeleportPoint()).name + "'") : "pinned point (not set)", 
				_ => "closest level point", 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private string GetSpawnOriginButtonLabel()
		{
			int value = _spawnOriginMode.Value;
			if (1 == 0)
			{
			}
			string result = value switch
			{
				0 => "nearest point", 
				1 => "player", 
				2 => ((Object)(object)ResolvePinnedTeleportPoint() != (Object)null) ? "pinned point" : "pin a point", 
				_ => "nearest point", 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private string GetResolvedSpawnOriginLabel()
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			ResolveSpawnBasePosition(out string anchorLabel);
			return anchorLabel;
		}

		private LevelPoint? ResolvePinnedTeleportPoint()
		{
			if ((Object)(object)_pinnedTeleportPoint != (Object)null)
			{
				return _pinnedTeleportPoint;
			}
			if (string.IsNullOrWhiteSpace(_pinnedTeleportPointName))
			{
				return null;
			}
			_pinnedTeleportPoint = ((IEnumerable<LevelPoint>)Object.FindObjectsOfType<LevelPoint>()).FirstOrDefault((Func<LevelPoint, bool>)((LevelPoint point) => (Object)(object)point != (Object)null && string.Equals(((Object)point).name, _pinnedTeleportPointName, StringComparison.OrdinalIgnoreCase)));
			return _pinnedTeleportPoint;
		}

		private void PinTeleportPoint(LevelPoint point)
		{
			_pinnedTeleportPoint = point;
			_pinnedTeleportPointName = ((Object)point).name;
		}

		private string GetPinnedPointLabel()
		{
			LevelPoint val = ResolvePinnedTeleportPoint();
			return ((Object)(object)val != (Object)null) ? ("'" + ((Object)val).name + "'") : "none";
		}

		private string BuildTeleportMeta(LevelPoint point, Vector3 playerPos, bool pinned)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = new List<string>();
			if (pinned)
			{
				list.Add("Pinned anchor");
			}
			if (point.inStartRoom)
			{
				list.Add("Start room");
			}
			if (point.Truck)
			{
				list.Add("Truck");
			}
			if (point.ModuleConnect)
			{
				list.Add("Connector");
			}
			if ((Object)(object)point.Room != (Object)null)
			{
				list.Add(((Object)point.Room).name);
			}
			list.Add($"{Vector3.Distance(playerPos, ((Component)point).transform.position):0.0}m away");
			return string.Join(" · ", list.Where((string token) => !string.IsNullOrWhiteSpace(token)));
		}

		private void TeleportToPoint(LevelPoint point)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0096: 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_003d: 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)
			PlayerController playerController = GetPlayerController();
			if ((Object)(object)playerController == (Object)null)
			{
				SetActionFeedback("Teleport failed because the local player controller was not found.");
				return;
			}
			try
			{
				if ((Object)(object)playerController.rb != (Object)null)
				{
					playerController.rb.velocity = Vector3.zero;
					playerController.rb.angularVelocity = Vector3.zero;
				}
				((Component)playerController).transform.position = ((Component)point).transform.position + Vector3.up * 1.35f;
				((Component)playerController).transform.rotation = Quaternion.Euler(0f, ((Component)point).transform.eulerAngles.y, 0f);
				SetActionFeedback("Warped to '" + ((Object)point).name + "'.");
			}
			catch (Exception ex)
			{
				Logger.LogWarning((object)("Teleport failed: " + ex.Message));
				SetActionFeedback("Teleport failed for '" + ((Object)point).name + "'.");
			}
		}

		private Vector3 GetSpawnOffset(int index, int total, float radius)
		{
			//IL_0031: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (total <= 1)
			{
				return Vector3.zero;
			}
			float num = 360f / (float)Mathf.Max(total, 1) * (float)index;
			return Quaternion.Euler(0f, num, 0f) * Vector3.forward * radius;
		}

		private GameObject InstantiatePrefabRef(PrefabRef prefabRef, Vector3 pos, Quaternion rot)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			if (prefabRef == null || !prefabRef.IsValid())
			{
				return null;
			}
			if (InRoom() && !IsHost())
			{
				return null;
			}
			try
			{
				if (InRoom() && PhotonNetwork.IsConnectedAndReady)
				{
					if (string.IsNullOrWhiteSpace(prefabRef.ResourcePath))
					{
						return null;
					}
					return PhotonNetwork.Instantiate(prefabRef.ResourcePath, pos, rot, (byte)0, (object[])null);
				}
				if ((Object)(object)prefabRef.Prefab != (Object)null)
				{
					return Object.Instantiate<GameObject>(prefabRef.Prefab, pos, rot);
				}
				if (!string.IsNullOrWhiteSpace(prefabRef.ResourcePath))
				{
					GameObject val = Resources.Load<GameObject>(prefabRef.ResourcePath);
					if ((Object)(object)val != (Object)null)
					{
						return Object.Instantiate<GameObject>(val, pos, rot);
					}
				}
			}
			catch (Exception ex)
			{
				Logger.LogWarning((object)("InstantiatePrefabRef failed for '" + prefabRef.PrefabName + "': " + ex.Message));
			}
			return null;
		}

		private static bool HasValidPhotonView(GameObject go)
		{
			try
			{
				return go.GetComponentsInChildren<PhotonView>(true)?.Any((PhotonView view) => (Object)(object)view != (Object)null && view.ViewID != 0) ?? false;
			}
			catch
			{
				return false;
			}
		}

		private static LevelPoint? GetClosestLevelPoint()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)LevelGenerator.Instance != (Object)null && LevelGenerator.Instance.LevelPathPoints != null && LevelGenerator.Instance.LevelPathPoints.Count > 0)
				{
					Vector3 playerPosition = GetPlayerPosition();
					LevelPoint val = null;
					float num = float.MaxValue;
					foreach (LevelPoint levelPathPoint in LevelGenerator.Instance.LevelPathPoints)
					{
						if (!((Object)(object)levelPathPoint == (Object)null))
						{
							float num2 = Vector3.SqrMagnitude(((Component)levelPathPoint).transform.position - playerPosition);
							if (num2 < num)
							{
								num = num2;
								val = levelPathPoint;
							}
						}
					}
					if ((Object)(object)val != (Object)null)
					{
						return val;
					}
				}
			}
			catch
			{
			}
			try
			{
				return (from point in Object.FindObjectsOfType<LevelPoint>()
					where (Object)(object)point != (Object)null
					orderby Vector3.SqrMagnitude(((Component)point).transform.position - GetPlayerPosition())
					select point).FirstOrDefault();
			}
			catch
			{
				return null;
			}
		}

		private static PlayerController? GetPlayerController()
		{
			try
			{
				if ((Object)(object)PlayerController.instance != (Object)null)
				{
					return PlayerController.instance;
				}
			}
			catch
			{
			}
			try
			{
				return Object.FindObjectOfType<PlayerController>();
			}
			catch
			{
				return null;
			}
		}

		private static Vector3 GetPlayerPosition()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			PlayerController playerController = GetPlayerController();
			if ((Object)(object)playerController != (Object)null)
			{
				return ((Component)playerController).transform.position;
			}
			if ((Object)(object)Camera.main != (Object)null)
			{
				return ((Component)Camera.main).transform.position;
			}
			return Vector3.zero;
		}

		private static string NormalizeName(string? raw, Regex trimRegex)
		{
			if (string.IsNullOrWhiteSpace(raw))
			{
				return string.Empty;
			}
			return trimRegex.Replace(raw, string.Empty).Trim().Replace("_", " ")
				.Trim();
		}

		private static string SummarizeActionText(string? text, int maxLength)
		{
			if (string.IsNullOrWhiteSpace(text))
			{
				return "Ready.";
			}
			if (text.Length <= maxLength)
			{
				return text;
			}
			return text.Substring(0, Math.Max(0, maxLength - 3)).TrimEnd() + "...";
		}

		private static IEnumerable<PrefabRef> EnumeratePrefabRefs(List<PrefabRef>? refs)
		{
			if (refs == null)
			{
				yield break;
			}
			foreach (PrefabRef prefabRef in refs)
			{
				if (prefabRef != null)
				{
					yield return prefabRef;
				}
			}
		}

		private static bool InRoom()
		{
			try
			{
				return PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null;
			}
			catch
			{
				return false;
			}
		}

		private static bool IsSoloRoom()
		{
			try
			{
				return InRoom() && PhotonNetwork.CurrentRoom.PlayerCount <= 1;
			}
			catch
			{
				return false;
			}
		}

		private static bool IsHost()
		{
			try
			{
				return InRoom() && PhotonNetwork.IsMasterClient;
			}
			catch
			{
				return false;
			}
		}

		private static bool IsHostOrOffline()
		{
			try
			{
				if (!InRoom())
				{
					return true;
				}
				if (IsSoloRoom())
				{
					return true;
				}
				return PhotonNetwork.IsMasterClient;
			}
			catch
			{
				return true;
			}
		}

		private void TakeCursor()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			_prevLock = Cursor.lockState;
			_prevVisible = Cursor.visible;
			try
			{
				CursorManager instance = CursorManager.instance;
				if (instance != null)
				{
					instance.Unlock(9999f);
				}
			}
			catch
			{
			}
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}

		private void KeepCursorFree()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)Cursor.lockState > 0)
			{
				Cursor.lockState = (CursorLockMode)0;
			}
			if (!Cursor.visible)
			{
				Cursor.visible = true;
			}
		}

		private void RestoreCursor()
		{
			//IL_0029: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)CursorManager.instance != (Object)null)
				{
					CursorManager.instance.unlockTimer = -1234f;
				}
			}
			catch
			{
			}
			Cursor.lockState = _prevLock;
			Cursor.visible = _prevVisible;
			try
			{
				if (((int)_prevLock != 0 || !_prevVisible) && (Object)(object)MenuCursor.instance != (Object)null)
				{
					MenuCursor.instance.showTimer = 0f;
					((Component)MenuCursor.instance).transform.localScale = Vector3.zero;
					if ((Object)(object)MenuCursor.instance.mesh != (Object)null)
					{
						MenuCursor.instance.mesh.SetActive(false);
					}
				}
			}
			catch
			{
			}
		}

		private GameObject CreateUIElement(string name, Transform parent)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			return val;
		}

		private GameObject CreateCard(string name, Transform parent, Color color)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIElement(name, parent);
			((Graphic)val.AddComponent<Image>()).color = color;
			Outline val2 = val.AddComponent<Outline>();
			((Shadow)val2).effectColor = new Color(_accentBase.r, _accentBase.g, _accentBase.b, 0.14f);
			((Shadow)val2).effectDistance = new Vector2(1f, -1f);
			return val;
		}

		private GameObject CreateButton(string name, Transform parent, stri