Decompiled source of ScarletTeleportGUI v1.2.8

ScarletTeleportGUI.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using ProjectM.Physics;
using ProjectM.Scripting;
using ProjectM.Sequencer;
using ProjectM.UI;
using ScarletTeleportGUI.Services;
using ScarletTeleportGUI.Utilities;
using TMPro;
using Unity.Collections;
using Unity.Entities;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ScarletTeleportGUI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.8.0")]
[assembly: AssemblyInformationalVersion("1.2.8")]
[assembly: AssemblyProduct("ScarletTeleportGUI")]
[assembly: AssemblyTitle("ScarletTeleportGUI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.8.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 ScarletTeleportGUI
{
	internal static class Core
	{
		private static World? _client;

		private static SystemService? _systemService;

		private static Entity _localCharacter = Entity.Null;

		private static Entity _localUser = Entity.Null;

		private static MonoBehaviour? _monoBehaviour;

		private static bool _initialized;

		public static Entity LocalCharacter
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: 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)
				if (!_localCharacter.Exists())
				{
					if (!ConsoleShared.TryGetLocalCharacterInCurrentWorld(ref _localCharacter, _client))
					{
						return Entity.Null;
					}
					return _localCharacter;
				}
				return _localCharacter;
			}
		}

		public static Entity LocalUser
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: 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)
				if (!_localUser.Exists())
				{
					if (!ConsoleShared.TryGetLocalUserInCurrentWorld(ref _localUser, _client))
					{
						return Entity.Null;
					}
					return _localUser;
				}
				return _localUser;
			}
		}

		public static EntityManager EntityManager => _client.EntityManager;

		public static SystemService SystemService => _systemService ?? (_systemService = new SystemService(_client));

		public static CanvasService? CanvasService { get; set; }

		public static ManualLogSource Log => Plugin.LogInstance;

		public static bool HasInitialized => _initialized;

		public static void Initialize(GameDataManager gameDataManager)
		{
			if (!_initialized)
			{
				_client = ((ComponentSystemBase)gameDataManager).World;
				_initialized = true;
				Log.LogInfo((object)"[ScarletTeleportGUI] Core initialized.");
			}
		}

		public static void Reset()
		{
			//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_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)
			_client = null;
			_systemService = null;
			CanvasService = null;
			_initialized = false;
			_localCharacter = Entity.Null;
			_localUser = Entity.Null;
			Log.LogInfo((object)"[ScarletTeleportGUI] Core reset.");
		}

		public static void SetCanvas(UICanvasBase canvas)
		{
			CanvasService = new CanvasService(canvas);
			Log.LogInfo((object)"[ScarletTeleportGUI] Canvas service initialized.");
		}

		public static Coroutine StartCoroutine(IEnumerator routine)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			if ((Object)(object)_monoBehaviour == (Object)null)
			{
				GameObject val = new GameObject("ScarletTeleportGUI");
				_monoBehaviour = (MonoBehaviour?)(object)val.AddComponent<IgnorePhysicsDebugSystem>();
				Object.DontDestroyOnLoad((Object)val);
			}
			return _monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine));
		}

		public static void StopCoroutine(Coroutine routine)
		{
			if (!((Object)(object)_monoBehaviour == (Object)null))
			{
				_monoBehaviour.StopCoroutine(routine);
			}
		}
	}
	[BepInPlugin("com.scarletteleportgui.vrising", "ScarletTeleportGUI", "1.2.8")]
	internal class Plugin : BasePlugin
	{
		private Harmony _harmony;

		private static ConfigEntry<bool> _teleportsPanel;

		private static ConfigEntry<bool> _eclipsed;

		internal static Plugin Instance { get; private set; }

		public static ManualLogSource LogInstance => ((BasePlugin)Instance).Log;

		public static bool TeleportsPanel => _teleportsPanel.Value;

		public static bool Eclipsed => _eclipsed.Value;

		public override void Load()
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			Instance = this;
			bool flag = default(bool);
			if (!Application.productName.Equals("VRising", StringComparison.OrdinalIgnoreCase))
			{
				ManualLogSource log = Core.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ScarletTeleportGUI");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.2.8");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] is a client mod - skipping on server (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Application.productName);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(").");
				}
				log.LogInfo(val);
			}
			else
			{
				_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
				InitConfig();
				ManualLogSource log2 = Core.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ScarletTeleportGUI");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.2.8");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] loaded on client.");
				}
				log2.LogInfo(val);
			}
		}

		private static void InitConfig()
		{
			_teleportsPanel = InitConfigEntry("UIOptions", "TeleportsPanel", defaultValue: true, "Enable or disable the Scarlet Teleport GUI panel.");
			_eclipsed = InitConfigEntry("UIOptions", "Eclipsed", defaultValue: true, "Set to false for slower update intervals if you want lower polling overhead.");
		}

		private static ConfigEntry<T> InitConfigEntry<T>(string section, string key, T defaultValue, string description)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			ConfigEntry<T> val = ((BasePlugin)Instance).Config.Bind<T>(section, key, defaultValue, description);
			ConfigEntry<T> val2 = default(ConfigEntry<T>);
			if (new ConfigFile(Path.Combine(Paths.ConfigPath, "com.scarletteleportgui.vrising.cfg"), true).TryGetEntry<T>(section, key, ref val2))
			{
				val.Value = val2.Value;
			}
			return val;
		}

		public override bool Unload()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			return true;
		}
	}
	internal static class VExtensions
	{
		private static EntityManager EntityManager => Core.EntityManager;

		public static bool Has<T>(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			return ((EntityManager)(ref entityManager)).HasComponent<T>(entity);
		}

		public static bool Exists(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (entity != Entity.Null)
			{
				EntityManager entityManager = EntityManager;
				return ((EntityManager)(ref entityManager)).Exists(entity);
			}
			return false;
		}

		public static T Read<T>(this Entity entity) where T : struct
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			T result = default(T);
			if (!((EntityManager)(ref entityManager)).TryGetComponentData<T>(entity, ref result))
			{
				return default(T);
			}
			return result;
		}

		public static NetworkId GetNetworkId(this Entity entity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			EntityManager entityManager = EntityManager;
			NetworkId result = default(NetworkId);
			if (((EntityManager)(ref entityManager)).TryGetComponentData<NetworkId>(entity, ref result))
			{
				return result;
			}
			return NetworkId.Empty;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.scarletteleportgui.vrising";

		public const string PLUGIN_NAME = "ScarletTeleportGUI";

		public const string PLUGIN_VERSION = "1.2.8";
	}
}
namespace ScarletTeleportGUI.Utilities
{
	internal static class CommandSender
	{
		private static FromCharacter? _fromCharacter;

		private static readonly ComponentType[] _componentTypes = (ComponentType[])(object)new ComponentType[4]
		{
			ComponentType.ReadOnly(Il2CppType.Of<FromCharacter>()),
			ComponentType.ReadOnly(Il2CppType.Of<NetworkEventType>()),
			ComponentType.ReadOnly(Il2CppType.Of<SendNetworkEventTag>()),
			ComponentType.ReadOnly(Il2CppType.Of<ChatMessageEvent>())
		};

		private static readonly NetworkEventType _networkEventType = new NetworkEventType
		{
			IsAdminEvent = false,
			EventId = NetworkEvents.EventId_ChatMessageEvent,
			IsDebugEvent = false
		};

		private static EntityManager EntityManager => Core.EntityManager;

		private static Entity LocalCharacter => Core.LocalCharacter;

		private static Entity LocalUser => Core.LocalUser;

		private static FromCharacter FromCharacter
		{
			get
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: 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_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: 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_0039: 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)
				FromCharacter valueOrDefault = _fromCharacter.GetValueOrDefault();
				if (!_fromCharacter.HasValue)
				{
					valueOrDefault = new FromCharacter
					{
						Character = LocalCharacter,
						User = LocalUser
					};
					_fromCharacter = valueOrDefault;
					return valueOrDefault;
				}
				return valueOrDefault;
			}
		}

		public static void Send(string command)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_006e: 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_0076: 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_0081: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			if (Core.HasInitialized && !(LocalCharacter == Entity.Null) && !(LocalUser == Entity.Null))
			{
				ChatMessageEvent val = new ChatMessageEvent
				{
					MessageText = new FixedString512Bytes(command),
					MessageType = (ChatMessageType)4,
					ReceiverEntity = LocalUser.GetNetworkId()
				};
				EntityManager entityManager = EntityManager;
				Entity val2 = ((EntityManager)(ref entityManager)).CreateEntity(_componentTypes);
				entityManager = EntityManager;
				((EntityManager)(ref entityManager)).SetComponentData<FromCharacter>(val2, FromCharacter);
				entityManager = EntityManager;
				((EntityManager)(ref entityManager)).SetComponentData<NetworkEventType>(val2, _networkEventType);
				entityManager = EntityManager;
				((EntityManager)(ref entityManager)).SetComponentData<ChatMessageEvent>(val2, val);
				ManualLogSource log = Core.Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(35, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[ScarletTeleportGUI] Sent command: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(command);
				}
				log.LogInfo(val3);
			}
		}

		public static void Reset()
		{
			_fromCharacter = null;
		}
	}
}
namespace ScarletTeleportGUI.Services
{
	internal class CanvasService
	{
		private enum TeleportCategory
		{
			Private,
			Public,
			Player,
			Waypoints
		}

		private const float PANEL_W = 340f;

		private const float PANEL_H = 290f;

		private const float HEADER_H = 34f;

		private const float TAB_H = 34f;

		private const float NAV_H = 56f;

		private const float CARD_H = 28f;

		private const float CARD_GAP = 3f;

		private const int MAX_CARDS = 5;

		private const float PLAYER_LIST_W = 250f;

		private const float PLAYER_LIST_H = 290f;

		private const int PLAYER_LIST_ROWS = 10;

		private static readonly Color PanelBg = new Color(0.05f, 0.04f, 0.07f, 0.92f);

		private static readonly Color HeaderBg = new Color(0.08f, 0.07f, 0.1f, 0.85f);

		private static readonly Color TabsBg = new Color(0.07f, 0.06f, 0.09f, 0.85f);

		internal static readonly Color CardBg = new Color(0.08f, 0.07f, 0.1f, 0.78f);

		private static readonly Color PlayerBg = new Color(0.08f, 0.07f, 0.1f, 0.7f);

		private static readonly Color InputBg = new Color(0.1f, 0.09f, 0.13f, 0.92f);

		private static readonly Color ButtonBg = new Color(0.25f, 0.18f, 0.08f, 0.9f);

		private static readonly Color ButtonBgAlt = new Color(0.25f, 0.18f, 0.08f, 0.9f);

		private static readonly Color SeparatorBg = new Color(0.5f, 0.4f, 0.2f, 0.7f);

		private static readonly Color TextPrimary = new Color(0.95f, 0.92f, 0.86f, 1f);

		internal static readonly Color TextSecondary = new Color(0.88f, 0.84f, 0.76f, 0.95f);

		internal static readonly Color TextMuted = new Color(0.78f, 0.72f, 0.66f, 0.55f);

		private static readonly WaitForSeconds _fastWait = new WaitForSeconds(0.1f);

		private static readonly WaitForSeconds _slowWait = new WaitForSeconds(1f);

		private static readonly WaitForSeconds _actionDelay = new WaitForSeconds(0.35f);

		private static bool _ready;

		private static bool _panelOpen;

		private static bool _killSwitch;

		private static bool _holdPlayerSuppression;

		private static float _suppressionGraceUntil;

		private static float _blockMapInputUntil;

		private static float _forceSuppressUntil;

		private static float _nextOnlinePlayerCacheRefresh;

		private static float _nextSocialMenuPrimeAttempt;

		private static bool _socialMenuPrimeInProgress;

		private static TeleportCategory _activeCategory;

		private static int _page;

		private static Canvas? _bottomBarCanvas;

		private static int _layer;

		private static GameObject? _iconButton;

		private static GameObject? _panel;

		private static GameObject? _cardsRoot;

		private static GameObject? _playerForm;

		private static GameObject? _playerListPanel;

		private static GameObject? _navBar;

		private static RectTransform? _playerInputRoot;

		private static TextMeshProUGUI? _titleLabel;

		private static TextMeshProUGUI? _pageLabel;

		private static TextMeshProUGUI? _playerListPageLabel;

		private static TMP_InputField? _playerNameField;

		private static TextMeshProUGUI? _playerHintLabel;

		private static readonly List<TeleportCard> _cards = new List<TeleportCard>();

		private static readonly List<TextMeshProUGUI> _playerListRows = new List<TextMeshProUGUI>();

		private static readonly List<string> _discoveredOnlinePlayers = new List<string>();

		private static bool _playerListOpen;

		private static int _playerListPage;

		private static bool _loggedPlayerSourceDiagnostics;

		private static WaitForSeconds WaitForSeconds
		{
			get
			{
				if (!Plugin.Eclipsed)
				{
					return _slowWait;
				}
				return _fastWait;
			}
		}

		internal static bool IsOpen => _panelOpen;

		internal static bool BlockMapInput => Time.realtimeSinceStartup < _blockMapInputUntil;

		internal static bool SuppressGameplayInput
		{
			get
			{
				if (Time.realtimeSinceStartup < _forceSuppressUntil)
				{
					return true;
				}
				if (_holdPlayerSuppression)
				{
					return true;
				}
				if (Time.realtimeSinceStartup < _suppressionGraceUntil)
				{
					return true;
				}
				if (!_panelOpen || _activeCategory != TeleportCategory.Player)
				{
					return false;
				}
				if ((Object)(object)_playerNameField != (Object)null)
				{
					return _playerNameField.isFocused;
				}
				return false;
			}
		}

		private static IReadOnlyList<string> CurrentList => _activeCategory switch
		{
			TeleportCategory.Private => TeleportDataService.VisiblePrivateTeleports, 
			TeleportCategory.Public => TeleportDataService.VisiblePublicTeleports, 
			TeleportCategory.Player => TeleportDataService.VisiblePlayerTeleports, 
			TeleportCategory.Waypoints => TeleportDataService.VisibleWaypoints, 
			_ => TeleportDataService.VisiblePrivateTeleports, 
		};

		private static string CurrentCategoryLabel => _activeCategory switch
		{
			TeleportCategory.Private => "Private", 
			TeleportCategory.Player => "Player", 
			TeleportCategory.Waypoints => "Waypoints", 
			_ => "Private", 
		};

		internal CanvasService(UICanvasBase canvas)
		{
			_killSwitch = false;
			_ready = false;
			_panelOpen = false;
			_activeCategory = TeleportCategory.Private;
			_page = 0;
			_holdPlayerSuppression = false;
			_suppressionGraceUntil = 0f;
			_blockMapInputUntil = 0f;
			_forceSuppressUntil = 0f;
			_nextOnlinePlayerCacheRefresh = 0f;
			_nextSocialMenuPrimeAttempt = 0f;
			_socialMenuPrimeInProgress = false;
			_playerListPage = 0;
			_cards.Clear();
			_bottomBarCanvas = ((Component)canvas.BottomBarParent).gameObject.GetComponent<Canvas>();
			_layer = ((Component)_bottomBarCanvas).gameObject.layer;
			if (Plugin.TeleportsPanel)
			{
				BuildIconButton();
				BuildPanel();
				GameObject? panel = _panel;
				if (panel != null)
				{
					panel.SetActive(false);
				}
				if ((Object)(object)_iconButton != (Object)null)
				{
					_ready = true;
					Core.StartCoroutine(UpdateLoop());
				}
			}
		}

		private static IEnumerator UpdateLoop()
		{
			while (!_killSwitch)
			{
				if (_ready)
				{
					TeleportDataService.FinalizeIfExpired();
					if (Time.realtimeSinceStartup >= _nextOnlinePlayerCacheRefresh)
					{
						RefreshOnlinePlayerCache();
						_nextOnlinePlayerCacheRefresh = Time.realtimeSinceStartup + 5f;
						if (_panelOpen && _activeCategory == TeleportCategory.Player && _discoveredOnlinePlayers.Count == 0)
						{
							TryPrimeSocialMenuRoster();
						}
					}
					if (ShouldReleasePlayerInput())
					{
						DeactivatePlayerInput();
					}
					if (_panelOpen && TeleportDataService.IsDirty)
					{
						RefreshPage();
						TeleportDataService.IsDirty = false;
					}
				}
				yield return (_panelOpen && _activeCategory == TeleportCategory.Player) ? null : WaitForSeconds;
			}
		}

		private static void BuildIconButton()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_002e: 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_0058: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			_iconButton = new GameObject("STP_Icon");
			AttachToCanvas(_iconButton);
			RectTransform obj = _iconButton.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0f, 0f);
			obj.anchorMax = new Vector2(0f, 0f);
			obj.pivot = new Vector2(0f, 0f);
			obj.anchoredPosition = new Vector2(104f, 60f);
			obj.sizeDelta = new Vector2(76f, 28f);
			((Graphic)_iconButton.AddComponent<Image>()).color = new Color(0.06f, 0.06f, 0.12f, 0.85f);
			GameObject obj2 = MakeChild("IconLabel", _iconButton.transform);
			TextMeshProUGUI obj3 = obj2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj3).text = "STP";
			((TMP_Text)obj3).fontSize = 12f;
			((TMP_Text)obj3).alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj3).enableWordWrapping = false;
			FillParent(obj2);
			((UnityEvent)_iconButton.AddComponent<Button>().onClick).AddListener(UnityAction.op_Implicit((Action)OnIconClicked));
			_iconButton.SetActive(true);
		}

		private static void BuildPanel()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0039: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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)
			_panel = new GameObject("ScarletTeleportGUI_Panel");
			_panel.SetActive(false);
			AttachToCanvas(_panel);
			RectTransform obj = _panel.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0.5f, 0.5f);
			obj.anchorMax = new Vector2(0.5f, 0.5f);
			obj.pivot = new Vector2(0.5f, 0.5f);
			obj.anchoredPosition = Vector2.zero;
			obj.sizeDelta = new Vector2(340f, 290f);
			((Graphic)_panel.AddComponent<Image>()).color = PanelBg;
			BuildHeader();
			BuildTabs();
			BuildCards();
			BuildPlayerForm();
			BuildPlayerListPanel();
			BuildNav();
			_panel.SetActive(false);
		}

		private static void BuildHeader()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = MakeChild("Header", _panel.transform);
			((Graphic)val.AddComponent<Image>()).color = HeaderBg;
			Stretch(val, 0f, 0f, 256f, 0f);
			GameObject obj = MakeChild("Title", val.transform);
			_titleLabel = obj.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_titleLabel).text = "Scarlet Teleports";
			((TMP_Text)_titleLabel).fontSize = 12f;
			((TMP_Text)_titleLabel).alignment = (TextAlignmentOptions)513;
			((TMP_Text)_titleLabel).enableWordWrapping = false;
			Frac(obj, 0.04f, 0.1f, 0.58f, 0.9f, 4f, 0f, 2f, 2f);
			((Graphic)BuildTextButton(val.transform, "CloseBtn", "<color=#FF6666>x</color>", 0.86f, 0.98f, UnityAction.op_Implicit((Action)ClosePanel)).GetComponent<Image>()).color = Color.clear;
		}

		private static void BuildTabs()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = MakeChild("Tabs", _panel.transform);
			((Graphic)obj.AddComponent<Image>()).color = TabsBg;
			Stretch(obj, 0f, 0f, 222f, 34f);
			((Graphic)BuildTextButton(obj.transform, "PrivateBtn", "Private", 0.02f, 0.245f, UnityAction.op_Implicit((Action)OnPrivateTabClicked)).GetComponent<Image>()).color = ButtonBg;
			((Graphic)BuildTextButton(obj.transform, "PublicBtn", "Public", 0.255f, 0.48f, UnityAction.op_Implicit((Action)OnPublicTabClicked)).GetComponent<Image>()).color = ButtonBg;
			((Graphic)BuildTextButton(obj.transform, "WaypointsBtn", "Waypoints", 0.49f, 0.715f, UnityAction.op_Implicit((Action)OnWaypointsTabClicked)).GetComponent<Image>()).color = ButtonBg;
			((Graphic)BuildTextButton(obj.transform, "PlayerBtn", "Player", 0.725f, 0.98f, UnityAction.op_Implicit((Action)OnPlayerTabClicked)).GetComponent<Image>()).color = ButtonBg;
		}

		private static void BuildCards()
		{
			_cardsRoot = MakeChild("Cards", _panel.transform);
			Stretch(_cardsRoot, 8f, 8f, 62f, 74f);
			for (int i = 0; i < 5; i++)
			{
				_cards.Add(new TeleportCard(_cardsRoot.transform, _layer, i, 28f, 3f));
			}
		}

		private static void BuildPlayerForm()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			_playerForm = MakeChild("PlayerForm", _panel.transform);
			Stretch(_playerForm, 12f, 12f, 66f, 78f);
			((Graphic)_playerForm.AddComponent<Image>()).color = PlayerBg;
			GameObject obj = MakeChild("PlayerPrompt", _playerForm.transform);
			TextMeshProUGUI obj2 = obj.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj2).text = "Enter player name";
			((TMP_Text)obj2).fontSize = 12f;
			((TMP_Text)obj2).alignment = (TextAlignmentOptions)513;
			((TMP_Text)obj2).enableWordWrapping = false;
			Frac(obj, 0.05f, 0.78f, 0.95f, 0.95f);
			GameObject val = MakeChild("PlayerInput", _playerForm.transform);
			((Graphic)val.AddComponent<Image>()).color = InputBg;
			Frac(val, 0.05f, 0.56f, 0.95f, 0.76f);
			_playerInputRoot = val.GetComponent<RectTransform>();
			GameObject val2 = MakeChild("TextArea", val.transform);
			Stretch(val2, 10f, 10f, 4f, 4f);
			GameObject obj3 = MakeChild("Placeholder", val2.transform);
			TextMeshProUGUI val3 = obj3.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = "Player name";
			((TMP_Text)val3).fontSize = 12f;
			((TMP_Text)val3).alignment = (TextAlignmentOptions)513;
			((TMP_Text)val3).enableWordWrapping = false;
			((Graphic)val3).color = TextMuted;
			FillParent(obj3);
			GameObject obj4 = MakeChild("Text", val2.transform);
			TextMeshProUGUI val4 = obj4.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val4).text = string.Empty;
			((TMP_Text)val4).fontSize = 12f;
			((TMP_Text)val4).alignment = (TextAlignmentOptions)513;
			((TMP_Text)val4).enableWordWrapping = false;
			((Graphic)val4).color = TextPrimary;
			FillParent(obj4);
			_playerNameField = val.AddComponent<TMP_InputField>();
			_playerNameField.textViewport = val2.GetComponent<RectTransform>();
			_playerNameField.textComponent = (TMP_Text)(object)val4;
			_playerNameField.placeholder = (Graphic)(object)val3;
			_playerNameField.lineType = (LineType)0;
			_playerNameField.contentType = (ContentType)0;
			((Selectable)_playerNameField).targetGraphic = (Graphic)(object)val.GetComponent<Image>();
			GameObject obj5 = BuildTextButton(_playerForm.transform, "PlayerTeleportBtn", "Teleport", 0.05f, 0.46f, UnityAction.op_Implicit((Action)OnPlayerTeleportClicked));
			Frac(obj5, 0.05f, 0.28f, 0.46f, 0.48f);
			((Graphic)obj5.GetComponent<Image>()).color = ButtonBg;
			GameObject obj6 = BuildTextButton(_playerForm.transform, "PlayerAskBtn", "Accept", 0.54f, 0.95f, UnityAction.op_Implicit((Action)OnAskToTpClicked));
			Frac(obj6, 0.54f, 0.28f, 0.95f, 0.48f);
			((Graphic)obj6.GetComponent<Image>()).color = ButtonBg;
			GameObject obj7 = MakeChild("PlayerHint", _playerForm.transform);
			_playerHintLabel = obj7.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_playerHintLabel).text = "Teleport sends .stp tpr [name]. Accept sends .stp tpa [name].";
			((TMP_Text)_playerHintLabel).fontSize = 10f;
			((TMP_Text)_playerHintLabel).alignment = (TextAlignmentOptions)257;
			((TMP_Text)_playerHintLabel).enableWordWrapping = true;
			((Graphic)_playerHintLabel).color = TextSecondary;
			Frac(obj7, 0.05f, 0.05f, 0.5f, 0.24f);
			_playerForm.SetActive(false);
		}

		private static void BuildPlayerListPanel()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_002e: 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_0058: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: 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_0287: 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_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			_playerListPanel = new GameObject("PlayerListPanel");
			AttachToCanvas(_playerListPanel);
			RectTransform obj = _playerListPanel.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0.5f, 0.5f);
			obj.anchorMax = new Vector2(0.5f, 0.5f);
			obj.pivot = new Vector2(0.5f, 0.5f);
			obj.anchoredPosition = new Vector2(309f, 0f);
			obj.sizeDelta = new Vector2(250f, 290f);
			((Graphic)_playerListPanel.AddComponent<Image>()).color = PanelBg;
			GameObject val = MakeChild("ListHeader", _playerListPanel.transform);
			((Graphic)val.AddComponent<Image>()).color = HeaderBg;
			Stretch(val, 0f, 0f, 256f, 0f);
			TextMeshProUGUI obj2 = MakeChild("ListTitle", val.transform).AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj2).text = "Online Players";
			((TMP_Text)obj2).fontSize = 12f;
			((TMP_Text)obj2).alignment = (TextAlignmentOptions)513;
			((TMP_Text)obj2).enableWordWrapping = false;
			Frac(((Component)obj2).gameObject, 0.05f, 0.1f, 0.8f, 0.9f, 4f, 0f, 2f, 2f);
			((Graphic)BuildTextButton(val.transform, "ListCloseBtn", "<", 0.84f, 0.98f, UnityAction.op_Implicit((Action)OnListPlayersClicked)).GetComponent<Image>()).color = Color.clear;
			GameObject val2 = MakeChild("ListRows", _playerListPanel.transform);
			Stretch(val2, 8f, 8f, 58f, 42f);
			_playerListRows.Clear();
			for (int i = 0; i < 10; i++)
			{
				GameObject val3 = MakeChild($"PlayerRow_{i}", val2.transform);
				RectTransform component = val3.GetComponent<RectTransform>();
				component.anchorMin = new Vector2(0f, 1f);
				component.anchorMax = new Vector2(1f, 1f);
				component.pivot = new Vector2(0.5f, 1f);
				component.anchoredPosition = new Vector2(0f, 0f - (float)i * 17f);
				component.sizeDelta = new Vector2(0f, 15f);
				((Graphic)val3.AddComponent<Image>()).color = CardBg;
				TextMeshProUGUI val4 = MakeChild($"PlayerRowTxt_{i}", val3.transform).AddComponent<TextMeshProUGUI>();
				((TMP_Text)val4).fontSize = 10f;
				((TMP_Text)val4).alignment = (TextAlignmentOptions)513;
				((TMP_Text)val4).enableWordWrapping = false;
				((Graphic)val4).color = TextPrimary;
				FillParent(((Component)val4).gameObject);
				_playerListRows.Add(val4);
			}
			GameObject val5 = MakeChild("ListFooter", _playerListPanel.transform);
			((Graphic)val5.AddComponent<Image>()).color = HeaderBg;
			Stretch(val5, 0f, 0f, 0f, 40f);
			((Graphic)BuildTextButton(val5.transform, "ListPrevBtn", "< Prev", 0.03f, 0.18f, UnityAction.op_Implicit((Action)OnPlayerListPrevPage)).GetComponent<Image>()).color = ButtonBg;
			GameObject obj3 = MakeChild("ListPageLabel", val5.transform);
			_playerListPageLabel = obj3.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_playerListPageLabel).fontSize = 10f;
			((TMP_Text)_playerListPageLabel).alignment = (TextAlignmentOptions)514;
			((TMP_Text)_playerListPageLabel).enableWordWrapping = false;
			((Graphic)_playerListPageLabel).color = TextPrimary;
			Frac(obj3, 0.22f, 0.18f, 0.78f, 0.82f);
			((Graphic)BuildTextButton(val5.transform, "ListNextBtn", "Next >", 0.82f, 0.97f, UnityAction.op_Implicit((Action)OnPlayerListNextPage)).GetComponent<Image>()).color = ButtonBg;
			val5.transform.SetAsLastSibling();
			_playerListPanel.SetActive(false);
			_playerListOpen = false;
			_playerListPage = 0;
		}

		private static void BuildNav()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			_navBar = MakeChild("Nav", _panel.transform);
			((Graphic)_navBar.AddComponent<Image>()).color = TabsBg;
			Stretch(_navBar, 0f, 0f, 0f, 234f);
			((Graphic)BuildTextButton(_navBar.transform, "PrevBtn", "< Prev", 0.03f, 0.28f, UnityAction.op_Implicit((Action)OnPrevPage)).GetComponent<Image>()).color = ButtonBg;
			GameObject obj = MakeChild("PageLabel", _navBar.transform);
			_pageLabel = obj.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_pageLabel).fontSize = 10f;
			((TMP_Text)_pageLabel).alignment = (TextAlignmentOptions)514;
			((TMP_Text)_pageLabel).enableWordWrapping = false;
			Frac(obj, 0.3f, 0.12f, 0.7f, 0.88f);
			((Graphic)BuildTextButton(_navBar.transform, "NextBtn", "Next >", 0.72f, 0.97f, UnityAction.op_Implicit((Action)OnNextPage)).GetComponent<Image>()).color = ButtonBg;
		}

		private static void OnIconClicked()
		{
			if (_panelOpen)
			{
				ClosePanel();
			}
			else
			{
				OpenPanel();
			}
		}

		private static void OpenPanel()
		{
			_panelOpen = true;
			_activeCategory = TeleportCategory.Private;
			_page = 0;
			GameObject? panel = _panel;
			if (panel != null)
			{
				panel.SetActive(true);
			}
			RequestTeleportList();
		}

		private static void ClosePanel()
		{
			_panelOpen = false;
			GameObject? panel = _panel;
			if (panel != null)
			{
				panel.SetActive(false);
			}
			_playerListOpen = false;
			_playerListPage = 0;
			GameObject? playerListPanel = _playerListPanel;
			if (playerListPanel != null)
			{
				playerListPanel.SetActive(false);
			}
			ClearAndUnlockPlayerInput();
			TeleportDataService.CancelAwaiting();
		}

		private static void OnPublicTabClicked()
		{
			ClearAndUnlockPlayerInput();
			_playerListOpen = false;
			GameObject? playerListPanel = _playerListPanel;
			if (playerListPanel != null)
			{
				playerListPanel.SetActive(false);
			}
			_activeCategory = TeleportCategory.Public;
			_page = 0;
			RefreshPage();
		}

		private static void OnPrivateTabClicked()
		{
			ClearAndUnlockPlayerInput();
			_playerListOpen = false;
			GameObject? playerListPanel = _playerListPanel;
			if (playerListPanel != null)
			{
				playerListPanel.SetActive(false);
			}
			_activeCategory = TeleportCategory.Private;
			_page = 0;
			RefreshPage();
		}

		private static void OnPlayerTabClicked()
		{
			_activeCategory = TeleportCategory.Player;
			_page = 0;
			_playerListPage = 0;
			RefreshOnlinePlayerCache();
			RefreshPage();
		}

		private static void OnWaypointsTabClicked()
		{
			ClearAndUnlockPlayerInput();
			_playerListOpen = false;
			GameObject? playerListPanel = _playerListPanel;
			if (playerListPanel != null)
			{
				playerListPanel.SetActive(false);
			}
			ClosePanel();
			Core.StartCoroutine(SendWaypointsCommandAfterDelay());
		}

		private static void OnListPlayersClicked()
		{
			if (!_panelOpen || _activeCategory != TeleportCategory.Player || (Object)(object)_playerListPanel == (Object)null)
			{
				return;
			}
			_playerListOpen = !_playerListOpen;
			_playerListPanel.SetActive(_playerListOpen);
			if (_playerListOpen)
			{
				if (_discoveredOnlinePlayers.Count == 0)
				{
					TryPrimeSocialMenuRoster();
				}
				RefreshPlayerList();
			}
			else
			{
				_discoveredOnlinePlayers.Clear();
			}
		}

		internal static void RegisterSocialMenuMember(string? playerName)
		{
			AddDiscoveredPlayer(playerName);
		}

		private static void AddDiscoveredPlayer(string? playerName)
		{
			string normalized = NormalizeListEntry(playerName ?? string.Empty);
			if (!string.IsNullOrWhiteSpace(normalized) && !_discoveredOnlinePlayers.Any((string existing) => existing.Equals(normalized, StringComparison.OrdinalIgnoreCase)))
			{
				_discoveredOnlinePlayers.Add(normalized);
				if (_playerListOpen)
				{
					RefreshPlayerList();
				}
			}
		}

		private static void OnPlayerTeleportClicked()
		{
			_holdPlayerSuppression = true;
			DeactivatePlayerInput();
			string playerTabInput = GetPlayerTabInput();
			if (string.IsNullOrWhiteSpace(playerTabInput))
			{
				SetPlayerHint("Enter a player name first.");
				_holdPlayerSuppression = false;
			}
			else
			{
				StartMapInputCooldown();
				Core.StartCoroutine(SendCommandAfterDelay(".stp tpr " + playerTabInput, "Sent: .stp tpr " + playerTabInput, "[ScarletTeleportGUI] Player teleport requested: " + playerTabInput));
			}
		}

		private static void OnAskToTpClicked()
		{
			_holdPlayerSuppression = true;
			DeactivatePlayerInput();
			string playerTabInput = GetPlayerTabInput();
			if (string.IsNullOrWhiteSpace(playerTabInput))
			{
				SetPlayerHint("Enter a player name first.");
				_holdPlayerSuppression = false;
			}
			else
			{
				StartMapInputCooldown();
				Core.StartCoroutine(SendCommandAfterDelay(".stp tpa " + playerTabInput, "Sent: .stp tpa " + playerTabInput, "[ScarletTeleportGUI] Accept teleport sent for: " + playerTabInput));
			}
		}

		private static void OnPrevPage()
		{
			if (_page > 0)
			{
				_page--;
				RefreshPage();
			}
		}

		private static void OnNextPage()
		{
			int count = CurrentList.Count;
			int num = Math.Max(0, (count - 1) / 5);
			if (_page < num)
			{
				_page++;
				RefreshPage();
			}
		}

		private static void RequestTeleportList()
		{
			TeleportDataService.BeginAwaitingTeleportList();
			CommandSender.Send(".stp ltp");
			RefreshPage();
		}

		private static void RefreshPage()
		{
			if (_activeCategory == TeleportCategory.Player)
			{
				GameObject? cardsRoot = _cardsRoot;
				if (cardsRoot != null)
				{
					cardsRoot.SetActive(false);
				}
				GameObject? navBar = _navBar;
				if (navBar != null)
				{
					navBar.SetActive(false);
				}
				GameObject? playerForm = _playerForm;
				if (playerForm != null)
				{
					playerForm.SetActive(true);
				}
				GameObject? playerListPanel = _playerListPanel;
				if (playerListPanel != null)
				{
					playerListPanel.SetActive(_playerListOpen);
				}
				if ((Object)(object)_titleLabel != (Object)null)
				{
					((TMP_Text)_titleLabel).SetText("Scarlet Teleports - Player", true);
				}
				if ((Object)(object)_playerHintLabel != (Object)null && string.IsNullOrWhiteSpace(((TMP_Text)_playerHintLabel).text))
				{
					((TMP_Text)_playerHintLabel).SetText("Teleport sends .stp tpr [name]. Accept sends .stp tpa [name].", true);
				}
				ActivatePlayerInput();
				if (_playerListOpen)
				{
					RefreshPlayerList();
				}
				return;
			}
			DeactivatePlayerInput();
			GameObject? playerForm2 = _playerForm;
			if (playerForm2 != null)
			{
				playerForm2.SetActive(false);
			}
			GameObject? playerListPanel2 = _playerListPanel;
			if (playerListPanel2 != null)
			{
				playerListPanel2.SetActive(false);
			}
			GameObject? cardsRoot2 = _cardsRoot;
			if (cardsRoot2 != null)
			{
				cardsRoot2.SetActive(true);
			}
			GameObject? navBar2 = _navBar;
			if (navBar2 != null)
			{
				navBar2.SetActive(true);
			}
			string currentCategoryLabel = CurrentCategoryLabel;
			IReadOnlyList<string> currentList = CurrentList;
			int count = currentList.Count;
			int val = Math.Max(0, (count - 1) / 5);
			_page = Math.Min(_page, val);
			int num = _page * 5;
			int num2 = Math.Min(5, Math.Max(0, count - num));
			if ((Object)(object)_titleLabel != (Object)null)
			{
				string text = (TeleportDataService.AwaitingTeleportList ? " (loading)" : string.Empty);
				((TMP_Text)_titleLabel).SetText("Scarlet Teleports - " + currentCategoryLabel + text, true);
			}
			if ((Object)(object)_pageLabel != (Object)null)
			{
				if (count > 0)
				{
					((TMP_Text)_pageLabel).SetText($"<color=#D8C9C0>{currentCategoryLabel} {num + 1}-{num + num2} of {count}</color>", true);
				}
				else if (TeleportDataService.AwaitingTeleportList)
				{
					((TMP_Text)_pageLabel).SetText("<color=#D8C9C0>Loading " + currentCategoryLabel.ToLowerInvariant() + " teleports...</color>", true);
				}
				else
				{
					((TMP_Text)_pageLabel).SetText("<color=#D8C9C0>No " + currentCategoryLabel.ToLowerInvariant() + " teleports found</color>", true);
				}
			}
			for (int i = 0; i < _cards.Count; i++)
			{
				int num3 = num + i;
				if (num3 < count)
				{
					_cards[i].Update(currentList[num3], num3 + 1, currentCategoryLabel, OnTeleportClicked);
					_cards[i].SetVisible(visible: true);
				}
				else
				{
					_cards[i].SetVisible(visible: false);
				}
			}
		}

		private static void OnTeleportClicked(string teleportName)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if (!string.IsNullOrWhiteSpace(teleportName))
			{
				CommandSender.Send(".stp tp " + teleportName);
				ManualLogSource log = Core.Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(41, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ScarletTeleportGUI] Teleport requested: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(teleportName);
				}
				log.LogInfo(val);
			}
		}

		public static void ResetState()
		{
			_killSwitch = true;
			_ready = false;
			_panelOpen = false;
			_activeCategory = TeleportCategory.Private;
			_page = 0;
			_holdPlayerSuppression = false;
			_suppressionGraceUntil = 0f;
			_blockMapInputUntil = 0f;
			_forceSuppressUntil = 0f;
			Destroy(_iconButton);
			_iconButton = null;
			Destroy(_panel);
			_panel = null;
			_titleLabel = null;
			_pageLabel = null;
			_cardsRoot = null;
			_playerForm = null;
			_playerListPanel = null;
			_navBar = null;
			_playerNameField = null;
			_playerInputRoot = null;
			_playerHintLabel = null;
			_playerListRows.Clear();
			_discoveredOnlinePlayers.Clear();
			_playerListOpen = false;
			_cards.Clear();
			TeleportDataService.Reset();
			CommandSender.Reset();
			Core.Log.LogInfo((object)"[ScarletTeleportGUI] State reset.");
		}

		private static GameObject BuildTextButton(Transform parent, string name, string text, float x0, float x1, UnityAction onClick)
		{
			GameObject val = MakeChild(name, parent);
			val.AddComponent<Image>();
			Frac(val, x0, 0.12f, x1, 0.88f, 0f, 0f, 2f, 2f);
			GameObject obj = MakeChild(name + "_Label", val.transform);
			TextMeshProUGUI obj2 = obj.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj2).text = text;
			((TMP_Text)obj2).fontSize = 11f;
			((TMP_Text)obj2).alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj2).enableWordWrapping = false;
			FillParent(obj);
			((UnityEvent)val.AddComponent<Button>().onClick).AddListener(onClick);
			return val;
		}

		private static void AttachToCanvas(GameObject go)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			go.layer = _layer;
			Object.DontDestroyOnLoad((Object)(object)go);
			SceneManager.MoveGameObjectToScene(go, SceneManager.GetSceneByName("VRisingWorld"));
			go.transform.SetParent(((Component)_bottomBarCanvas).transform, false);
		}

		private static GameObject MakeChild(string name, Transform parent)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			GameObject val = new GameObject(name)
			{
				layer = _layer
			};
			val.AddComponent<RectTransform>();
			val.transform.SetParent(parent, false);
			return val;
		}

		private static void Stretch(GameObject go, float left, float right, float bottom, float top)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = go.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = new Vector2(left, bottom);
			component.offsetMax = new Vector2(0f - right, 0f - top);
		}

		private static void Frac(GameObject go, float x0, float y0, float x1, float y1, float pl = 0f, float pr = 0f, float pb = 0f, float pt = 0f)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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)
			RectTransform component = go.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(x0, y0);
			component.anchorMax = new Vector2(x1, y1);
			component.offsetMin = new Vector2(pl, pb);
			component.offsetMax = new Vector2(0f - pr, 0f - pt);
		}

		private static void FillParent(GameObject go)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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)
			RectTransform component = go.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.zero;
		}

		private static void Destroy(GameObject? go)
		{
			if ((Object)(object)go != (Object)null)
			{
				Object.Destroy((Object)(object)go);
			}
		}

		private static string GetPlayerTabInput()
		{
			TMP_InputField? playerNameField = _playerNameField;
			return ((playerNameField == null) ? null : playerNameField.text?.Trim()) ?? string.Empty;
		}

		private static void SetPlayerHint(string message)
		{
			if ((Object)(object)_playerHintLabel != (Object)null)
			{
				((TMP_Text)_playerHintLabel).SetText(message, true);
			}
		}

		private static void ActivatePlayerInput()
		{
			if (!((Object)(object)_playerNameField == (Object)null) && _panelOpen && _activeCategory == TeleportCategory.Player)
			{
				EventSystem current = EventSystem.current;
				if (current != null)
				{
					current.SetSelectedGameObject(((Component)_playerNameField).gameObject);
				}
				((Selectable)_playerNameField).Select();
				_playerNameField.ActivateInputField();
			}
		}

		private static void DeactivatePlayerInput(bool applyGrace = true)
		{
			if (!((Object)(object)_playerNameField == (Object)null))
			{
				bool isFocused = _playerNameField.isFocused;
				EventSystem current = EventSystem.current;
				if ((Object)(object)((current != null) ? current.currentSelectedGameObject : null) == (Object)(object)((Component)_playerNameField).gameObject)
				{
					EventSystem.current.SetSelectedGameObject((GameObject)null);
				}
				_playerNameField.DeactivateInputField(false);
				if (isFocused && applyGrace)
				{
					Input.ResetInputAxes();
					_suppressionGraceUntil = Time.realtimeSinceStartup + 0.25f;
				}
			}
		}

		private static bool ShouldReleasePlayerInput()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			if (!_panelOpen || _activeCategory != TeleportCategory.Player)
			{
				return false;
			}
			if ((Object)(object)_playerNameField == (Object)null || !_playerNameField.isFocused)
			{
				return false;
			}
			if (!Input.GetMouseButtonDown(0))
			{
				return false;
			}
			if ((Object)(object)_playerInputRoot == (Object)null)
			{
				return false;
			}
			if ((Object)(object)EventSystem.current == (Object)null)
			{
				return false;
			}
			return !RectTransformUtility.RectangleContainsScreenPoint(_playerInputRoot, Vector2.op_Implicit(Input.mousePosition), (Camera)null);
		}

		private static IEnumerator SendWaypointsCommandAfterDelay()
		{
			_holdPlayerSuppression = true;
			yield return _actionDelay;
			CommandSender.Send(".stp wp");
			_holdPlayerSuppression = false;
		}

		private static IEnumerator SendCommandAfterDelay(string command, string hintMessage, string logMessage)
		{
			yield return _actionDelay;
			CommandSender.Send(command);
			SetPlayerHint(hintMessage);
			Core.Log.LogInfo((object)logMessage);
			UnlockPlayerSuppression(clearCooldowns: false);
		}

		private static void UnlockPlayerSuppression(bool clearCooldowns = true)
		{
			_holdPlayerSuppression = false;
			_suppressionGraceUntil = 0f;
			if (clearCooldowns)
			{
				_blockMapInputUntil = 0f;
				_forceSuppressUntil = 0f;
			}
			DeactivatePlayerInput(applyGrace: false);
		}

		private static void ClearAndUnlockPlayerInput()
		{
			if ((Object)(object)_playerNameField != (Object)null)
			{
				_playerNameField.text = string.Empty;
			}
			UnlockPlayerSuppression();
		}

		private static void StartMapInputCooldown()
		{
			_blockMapInputUntil = Time.realtimeSinceStartup + 0.75f;
			_forceSuppressUntil = Time.realtimeSinceStartup + 0.75f;
		}

		private static void RefreshPlayerList()
		{
			if (_playerListRows.Count == 0)
			{
				return;
			}
			List<string> onlinePlayerNames = GetOnlinePlayerNames();
			int count = _playerListRows.Count;
			int num = Math.Max(0, (onlinePlayerNames.Count - 1) / count);
			_playerListPage = Math.Clamp(_playerListPage, 0, num);
			int num2 = _playerListPage * count;
			for (int i = 0; i < _playerListRows.Count; i++)
			{
				int num3 = num2 + i;
				if (num3 < onlinePlayerNames.Count)
				{
					((TMP_Text)_playerListRows[i]).SetText($"{num3 + 1}. {onlinePlayerNames[num3]}", true);
				}
				else
				{
					((TMP_Text)_playerListRows[i]).SetText(string.Empty, true);
				}
			}
			if ((Object)(object)_playerListPageLabel != (Object)null)
			{
				((TMP_Text)_playerListPageLabel).SetText($"Page {_playerListPage + 1}/{num + 1}", true);
			}
		}

		private static void OnPlayerListPrevPage()
		{
			if (_playerListPage > 0)
			{
				_playerListPage--;
				RefreshPlayerList();
			}
		}

		private static void OnPlayerListNextPage()
		{
			_playerListPage++;
			RefreshPlayerList();
		}

		private static List<string> GetOnlinePlayerNames()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			List<string> list = new List<string>();
			HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			string localPlayerName = GetLocalPlayerName();
			bool flag = !_loggedPlayerSourceDiagnostics;
			if (flag)
			{
				ManualLogSource log = Core.Log;
				bool flag2 = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(71, 2, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ScarletTeleportGUI] Player source diagnostics start: local='");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(localPlayerName);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("', cached=");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_discoveredOnlinePlayers.Count);
				}
				log.LogInfo(val);
			}
			CollectOnlinePlayerNames(list, hashSet, localPlayerName, flag);
			foreach (string discoveredOnlinePlayer in _discoveredOnlinePlayers)
			{
				if (!string.IsNullOrWhiteSpace(discoveredOnlinePlayer) && !IsLocalPlayerName(discoveredOnlinePlayer, localPlayerName) && hashSet.Add(discoveredOnlinePlayer))
				{
					list.Add(discoveredOnlinePlayer);
				}
			}
			list.Sort(StringComparer.OrdinalIgnoreCase);
			if (list.Count == 0)
			{
				list.Add("No other players online");
			}
			if (flag)
			{
				_loggedPlayerSourceDiagnostics = true;
			}
			return list;
		}

		private static void RefreshOnlinePlayerCache()
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			try
			{
				string localPlayerName = GetLocalPlayerName();
				List<string> list = new List<string>();
				HashSet<string> seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
				CollectOnlinePlayerNames(list, seen, localPlayerName, logDiagnostics: false);
				bool flag = false;
				foreach (string name in list)
				{
					if (!_discoveredOnlinePlayers.Any((string existing) => existing.Equals(name, StringComparison.OrdinalIgnoreCase)))
					{
						_discoveredOnlinePlayers.Add(name);
						flag = true;
					}
				}
				if (flag && _playerListOpen)
				{
					RefreshPlayerList();
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Core.Log;
				bool flag2 = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(60, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ScarletTeleportGUI] Could not refresh online player cache: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val);
			}
		}

		private static void TryPrimeSocialMenuRoster()
		{
			if (!_socialMenuPrimeInProgress && !(Time.realtimeSinceStartup < _nextSocialMenuPrimeAttempt))
			{
				ClanMenu val = Object.FindObjectOfType<ClanMenu>(true);
				if (!((Object)(object)val == (Object)null))
				{
					Core.StartCoroutine(PrimeSocialMenuRoster(((Component)val).gameObject));
				}
			}
		}

		private static IEnumerator PrimeSocialMenuRoster(GameObject socialMenuGO)
		{
			if (_socialMenuPrimeInProgress)
			{
				yield break;
			}
			_socialMenuPrimeInProgress = true;
			_nextSocialMenuPrimeAttempt = Time.realtimeSinceStartup + 10f;
			bool wasActive = socialMenuGO.activeSelf;
			try
			{
				ClanMenu component = socialMenuGO.GetComponent<ClanMenu>();
				if ((Object)(object)component != (Object)null)
				{
					TryInvokeClanMenuPrimeMethods(component);
				}
				if (!wasActive)
				{
					socialMenuGO.SetActive(true);
				}
				float endTime = Time.realtimeSinceStartup + 2f;
				while (Time.realtimeSinceStartup < endTime)
				{
					TryInvokeSocialMenuSystems();
					RefreshOnlinePlayerCache();
					if (_discoveredOnlinePlayers.Count > 0)
					{
						break;
					}
					yield return (object)new WaitForSecondsRealtime(0.1f);
				}
				if (_playerListOpen)
				{
					RefreshPlayerList();
				}
			}
			finally
			{
				if (!wasActive && (Object)(object)socialMenuGO != (Object)null)
				{
					socialMenuGO.SetActive(false);
				}
				_socialMenuPrimeInProgress = false;
			}
		}

		private static void TryInvokeSocialMenuSystems()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			string[] array = new string[2] { "ProjectM.Sequencer.HandleOpenSocialMenuSystem, ProjectM", "ProjectM.HandleOpenSocialMenuSystem, ProjectM" };
			bool flag = default(bool);
			foreach (string text in array)
			{
				if (Core.SystemService.TryUpdateSystem(text))
				{
					ManualLogSource log = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(49, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ScarletTeleportGUI] Social menu system updated: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
					}
					log.LogInfo(val);
				}
			}
		}

		private static void TryInvokeClanMenuPrimeMethods(ClanMenu clanMenu)
		{
			string[] obj = new string[9] { "InitializeUI", "RefreshUI", "Refresh", "UpdateUI", "Open", "Show", "OpenMenu", "Populate", "PopulateList" };
			Type type = ((object)clanMenu).GetType();
			string[] array = obj;
			foreach (string name in array)
			{
				MethodInfo method = type.GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
				if (!(method == null) && !(method.ReturnType != typeof(void)))
				{
					try
					{
						method.Invoke(clanMenu, null);
					}
					catch
					{
					}
				}
			}
		}

		private static void CollectOnlinePlayerNames(List<string> names, HashSet<string> seen, string localPlayerName, bool logDiagnostics)
		{
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Expected O, but got Unknown
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Expected O, but got Unknown
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			TryCollectClanTeamPlayers(names, seen, localPlayerName);
			TryCollectClanMemberStatusPlayers(names, seen, localPlayerName);
			EntityManager entityManager;
			bool flag = default(bool);
			try
			{
				_ = Core.LocalUser;
				Entity localCharacter = Core.LocalCharacter;
				entityManager = Core.EntityManager;
				EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<PlayerCharacter>() });
				NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				if (logDiagnostics)
				{
					ManualLogSource log = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(53, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[ScarletTeleportGUI] Query PlayerCharacter: entities=");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(val2.Length);
					}
					log.LogInfo(val3);
				}
				try
				{
					Enumerator<Entity> enumerator = val2.GetEnumerator();
					while (enumerator.MoveNext())
					{
						Entity current = enumerator.Current;
						if (!current.Exists() || (localCharacter.Exists() && current == localCharacter))
						{
							continue;
						}
						PlayerCharacter val4 = current.Read<PlayerCharacter>();
						Entity userEntity = val4.UserEntity;
						User user = (User)(userEntity.Exists() ? userEntity.Read<User>() : default(User));
						string text = string.Empty;
						if (userEntity.Exists())
						{
							text = NormalizeListEntry(GetUserDisplayName(user));
						}
						if (string.IsNullOrWhiteSpace(text))
						{
							text = NormalizeListEntry(((FixedString64Bytes)(ref val4.Name)).Value);
						}
						if (logDiagnostics)
						{
							ManualLogSource log2 = Core.Log;
							BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(64, 3, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[ScarletTeleportGUI] PlayerCharacter entity ");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(current.Index);
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" userExists=");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<bool>(userEntity.Exists());
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" name='");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text);
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("'");
							}
							log2.LogInfo(val3);
						}
						if (!string.IsNullOrWhiteSpace(text) && !IsLocalPlayerName(text, localPlayerName) && seen.Add(text))
						{
							names.Add(text);
						}
					}
				}
				finally
				{
					val2.Dispose();
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log3 = Core.Log;
				BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(59, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[ScarletTeleportGUI] Could not query PlayerCharacter list: ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message);
				}
				log3.LogWarning(val5);
			}
			try
			{
				Entity localUser = Core.LocalUser;
				entityManager = Core.EntityManager;
				EntityQuery val6 = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
				NativeArray<Entity> val7 = ((EntityQuery)(ref val6)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				if (logDiagnostics)
				{
					ManualLogSource log4 = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(42, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[ScarletTeleportGUI] Query User: entities=");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(val7.Length);
					}
					log4.LogInfo(val3);
				}
				try
				{
					Enumerator<Entity> enumerator = val7.GetEnumerator();
					while (enumerator.MoveNext())
					{
						Entity current2 = enumerator.Current;
						if (!current2.Exists() || (localUser.Exists() && current2 == localUser))
						{
							continue;
						}
						string text2 = NormalizeListEntry(GetUserDisplayName(current2.Read<User>()));
						if (logDiagnostics)
						{
							ManualLogSource log5 = Core.Log;
							BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(41, 2, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[ScarletTeleportGUI] User entity ");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(current2.Index);
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" name='");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text2);
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("'");
							}
							log5.LogInfo(val3);
						}
						if (!string.IsNullOrWhiteSpace(text2) && !IsLocalPlayerName(text2, localPlayerName) && seen.Add(text2))
						{
							names.Add(text2);
						}
					}
				}
				finally
				{
					val7.Dispose();
				}
			}
			catch
			{
			}
		}

		private static void TryCollectClanMemberStatusPlayers(List<string> names, HashSet<string> seen, string localPlayerName)
		{
			TryCollectBufferPlayers<ClanMemberStatus>(names, seen, localPlayerName);
			TryCollectBufferPlayers<Snapshot_ClanMemberStatus>(names, seen, localPlayerName);
		}

		private static void TryCollectClanTeamPlayers(List<string> names, HashSet<string> seen, string localPlayerName)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_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)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			try
			{
				EntityManager entityManager = Core.EntityManager;
				EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<ClanTeam>() });
				NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				if (!_loggedPlayerSourceDiagnostics)
				{
					ManualLogSource log = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(46, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[ScarletTeleportGUI] Query ClanTeam: entities=");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(val2.Length);
					}
					log.LogInfo(val3);
				}
				try
				{
					Enumerator<Entity> enumerator = val2.GetEnumerator();
					DynamicBuffer<ClanMemberStatus> buffer = default(DynamicBuffer<ClanMemberStatus>);
					DynamicBuffer<Snapshot_ClanMemberStatus> buffer2 = default(DynamicBuffer<Snapshot_ClanMemberStatus>);
					while (enumerator.MoveNext())
					{
						Entity current = enumerator.Current;
						if (current.Exists())
						{
							entityManager = Core.EntityManager;
							if (((EntityManager)(ref entityManager)).TryGetBuffer<ClanMemberStatus>(current, ref buffer))
							{
								CollectClanBufferEntries<ClanMemberStatus>(current, buffer, names, seen, localPlayerName, "ClanMemberStatus");
							}
							entityManager = Core.EntityManager;
							if (((EntityManager)(ref entityManager)).TryGetBuffer<Snapshot_ClanMemberStatus>(current, ref buffer2))
							{
								CollectClanBufferEntries<Snapshot_ClanMemberStatus>(current, buffer2, names, seen, localPlayerName, "Snapshot_ClanMemberStatus");
							}
						}
					}
				}
				finally
				{
					val2.Dispose();
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Core.Log;
				BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(52, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[ScarletTeleportGUI] Could not query ClanTeam list: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message);
				}
				log2.LogWarning(val4);
			}
		}

		private static void CollectClanBufferEntries<TBuffer>(Entity entity, DynamicBuffer<TBuffer> buffer, List<string> names, HashSet<string> seen, string localPlayerName, string bufferLabel) where TBuffer : struct
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			bool flag = default(bool);
			if (!_loggedPlayerSourceDiagnostics)
			{
				ManualLogSource log = Core.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ScarletTeleportGUI] ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(bufferLabel);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" entity ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(entity.Index);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" bufferCount=");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(buffer.Length);
				}
				log.LogInfo(val);
			}
			Enumerator<TBuffer> enumerator = buffer.GetEnumerator();
			while (enumerator.MoveNext())
			{
				if (!TryExtractPlayerEntry(enumerator.Current, out string name, out bool? isOnline))
				{
					continue;
				}
				if (!_loggedPlayerSourceDiagnostics)
				{
					ManualLogSource log2 = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ScarletTeleportGUI] ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(bufferLabel);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" entry name='");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' online=");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(isOnline.HasValue ? isOnline.Value.ToString() : "null");
					}
					log2.LogInfo(val);
				}
				if ((!isOnline.HasValue || isOnline.Value) && !string.IsNullOrWhiteSpace(name) && !IsLocalPlayerName(name, localPlayerName) && seen.Add(name))
				{
					names.Add(name);
				}
			}
		}

		private static void TryCollectBufferPlayers<TBuffer>(List<string> names, HashSet<string> seen, string localPlayerName) where TBuffer : struct
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				EntityManager entityManager = Core.EntityManager;
				EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<TBuffer>() });
				NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				if (!_loggedPlayerSourceDiagnostics)
				{
					ManualLogSource log = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(38, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[ScarletTeleportGUI] Query ");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(typeof(TBuffer).Name);
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(": entities=");
						((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(val2.Length);
					}
					log.LogInfo(val3);
				}
				try
				{
					Enumerator<Entity> enumerator = val2.GetEnumerator();
					DynamicBuffer<TBuffer> val4 = default(DynamicBuffer<TBuffer>);
					while (enumerator.MoveNext())
					{
						Entity current = enumerator.Current;
						if (!current.Exists())
						{
							continue;
						}
						entityManager = Core.EntityManager;
						if (!((EntityManager)(ref entityManager)).TryGetBuffer<TBuffer>(current, ref val4))
						{
							continue;
						}
						if (!_loggedPlayerSourceDiagnostics)
						{
							ManualLogSource log2 = Core.Log;
							BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(42, 3, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[ScarletTeleportGUI] ");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(typeof(TBuffer).Name);
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" entity ");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(current.Index);
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" bufferCount=");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(val4.Length);
							}
							log2.LogInfo(val3);
						}
						Enumerator<TBuffer> enumerator2 = val4.GetEnumerator();
						while (enumerator2.MoveNext())
						{
							if (!TryExtractPlayerEntry(enumerator2.Current, out string name, out bool? isOnline))
							{
								continue;
							}
							if (!_loggedPlayerSourceDiagnostics)
							{
								ManualLogSource log3 = Core.Log;
								BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(43, 3, ref flag);
								if (flag)
								{
									((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[ScarletTeleportGUI] ");
									((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(typeof(TBuffer).Name);
									((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" entry name='");
									((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(name);
									((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("' online=");
									((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(isOnline.HasValue ? isOnline.Value.ToString() : "null");
								}
								log3.LogInfo(val3);
							}
							if ((!isOnline.HasValue || isOnline.Value) && !string.IsNullOrWhiteSpace(name) && !IsLocalPlayerName(name, localPlayerName) && seen.Add(name))
							{
								names.Add(name);
							}
						}
					}
				}
				finally
				{
					val2.Dispose();
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log4 = Core.Log;
				BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(39, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[ScarletTeleportGUI] Could not query ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(typeof(TBuffer).Name);
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message);
				}
				log4.LogWarning(val5);
			}
		}

		private static bool TryExtractPlayerEntry<TBuffer>(TBuffer bufferEntry, out string name, out bool? isOnline) where TBuffer : struct
		{
			object obj = bufferEntry;
			Type type = obj.GetType();
			name = string.Empty;
			isOnline = null;
			string[] array = new string[6] { "CharacterName", "PlayerName", "PlatformName", "Name", "Username", "DisplayName" };
			foreach (string memberName in array)
			{
				name = ReadNamedMember(type, obj, memberName);
				if (!string.IsNullOrWhiteSpace(name))
				{
					break;
				}
			}
			array = new string[5] { "IsOnline", "Online", "Connected", "IsConnected", "IsActive" };
			foreach (string name2 in array)
			{
				PropertyInfo property = type.GetProperty(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (property != null && property.PropertyType == typeof(bool) && property.CanRead)
				{
					isOnline = ((property.GetValue(obj) is bool value) ? new bool?(value) : ((bool?)null));
					if (isOnline.HasValue)
					{
						break;
					}
				}
				FieldInfo field = type.GetField(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null && field.FieldType == typeof(bool))
				{
					isOnline = ((field.GetValue(obj) is bool value2) ? new bool?(value2) : ((bool?)null));
					if (isOnline.HasValue)
					{
						break;
					}
				}
			}
			if (string.IsNullOrWhiteSpace(name))
			{
				return isOnline.HasValue;
			}
			return true;
		}

		private static string GetUserDisplayName(User user)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			string text = NormalizeNameValue(((FixedString64Bytes)(ref user.CharacterName)).Value);
			if (!string.IsNullOrWhiteSpace(text))
			{
				return text;
			}
			return ExtractUserDisplayName<User>(user);
		}

		private static string GetLocalPlayerName()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			Entity localUser = Core.LocalUser;
			if (localUser.Exists())
			{
				string text = NormalizeListEntry(GetUserDisplayName(localUser.Read<User>()));
				if (!string.IsNullOrWhiteSpace(text))
				{
					return text;
				}
			}
			Entity localCharacter = Core.LocalCharacter;
			if (localCharacter.Exists() && localCharacter.Has<PlayerCharacter>())
			{
				PlayerCharacter val = localCharacter.Read<PlayerCharacter>();
				string text2 = NormalizeListEntry(((FixedString64Bytes)(ref val.Name)).Value);
				if (!string.IsNullOrWhiteSpace(text2))
				{
					return text2;
				}
			}
			return string.Empty;
		}

		private static bool IsLocalPlayerName(string candidate, string localPlayerName)
		{
			if (string.IsNullOrWhiteSpace(candidate) || string.IsNullOrWhiteSpace(localPlayerName))
			{
				return false;
			}
			return candidate.Equals(localPlayerName, StringComparison.OrdinalIgnoreCase);
		}

		private static string NormalizeListEntry(string value)
		{
			if (string.IsNullOrWhiteSpace(value))
			{
				return string.Empty;
			}
			string text = NormalizeNameValue(value);
			if (string.IsNullOrWhiteSpace(text))
			{
				return string.Empty;
			}
			text = text.TrimStart('-', '*', '•', ' ');
			int num = text.IndexOf('.');
			if (num > 0)
			{
				bool flag = true;
				for (int i = 0; i < num; i++)
				{
					if (!char.IsDigit(text[i]))
					{
						flag = false;
						break;
					}
				}
				if (flag && num + 1 < text.Length)
				{
					string text2 = text;
					int num2 = num + 1;
					text = text2.Substring(num2, text2.Length - num2).TrimStart();
				}
			}
			return text.Trim();
		}

		private static string ExtractUserDisplayName<TUser>(TUser userData) where TUser : struct
		{
			object obj = userData;
			Type type = obj.GetType();
			string[] array = new string[4] { "CharacterName", "PlayerName", "PlatformName", "Name" };
			foreach (string memberName in array)
			{
				string text = ReadNamedMember(type, obj, memberName);
				if (!string.IsNullOrWhiteSpace(text))
				{
					return text;
				}
			}
			FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (FieldInfo fieldInfo in fields)
			{
				if (fieldInfo.Name.IndexOf("name", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					string text2 = NormalizeNameValue(fieldInfo.GetValue(obj));
					if (!string.IsNullOrWhiteSpace(text2))
					{
						return text2;
					}
				}
			}
			PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo.CanRead && propertyInfo.Name.IndexOf("name", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					string text3 = NormalizeNameValue(propertyInfo.GetValue(obj));
					if (!string.IsNullOrWhiteSpace(text3))
					{
						return text3;
					}
				}
			}
			string text4 = ReadNamedMember(type, obj, "PlatformId");
			if (!string.IsNullOrWhiteSpace(text4))
			{
				return "Player " + text4;
			}
			return string.Empty;
		}

		private static string ReadNamedMember(Type type, object boxed, string memberName)
		{
			PropertyInfo property = type.GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (property != null && property.CanRead)
			{
				string text = NormalizeNameValue(property.GetValue(boxed));
				if (!string.IsNullOrWhiteSpace(text))
				{
					return text;
				}
			}
			FieldInfo field = type.GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (field != null)
			{
				string text2 = NormalizeNameValue(field.GetValue(boxed));
				if (!string.IsNullOrWhiteSpace(text2))
				{
					return text2;
				}
			}
			return string.Empty;
		}

		private static string NormalizeNameValue(object? value)
		{
			if (value == null)
			{
				return string.Empty;
			}
			string text = value.ToString() ?? string.Empty;
			text = text.Replace("\0", string.Empty).Trim();
			if (string.IsNullOrWhiteSpace(text))
			{
				return string.Empty;
			}
			if (text.Equals("None", StringComparison.OrdinalIgnoreCase))
			{
				return string.Empty;
			}
			if (text.Equals("Empty", StringComparison.OrdinalIgnoreCase))
			{
				return string.Empty;
			}
			return text;
		}
	}
	internal sealed class TeleportCard
	{
		private readonly GameObject _root;

		private readonly TextMeshProUGUI _nameText;

		private readonly TextMeshProUGUI _infoText;

		private readonly Button _button;

		public TeleportCard(Transform parent, int layer, int index, float cardHeight, float gap)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			_root = new GameObject($"TeleportCard_{index}");
			_root.layer = layer;
			_root.transform.SetParent(parent, false);
			((Graphic)_root.AddComponent<Image>()).color = CanvasService.CardBg;
			_button = _root.AddComponent<Button>();
			RectTransform component = _root.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(0.5f, 1f);
			component.anchoredPosition = new Vector2(0f, 0f - ((float)index * (cardHeight + gap) + 3f));
			component.sizeDelta = new Vector2(0f, cardHeight);
			GameObject val = new GameObject("NameTxt");
			val.layer = layer;
			val.transform.SetParent(_root.transform, false);
			_nameText = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_nameText).fontSize = 12f;
			((TMP_Text)_nameText).alignment = (TextAlignmentOptions)513;
			((TMP_Text)_nameText).enableWordWrapping = false;
			RectTransform component2 = val.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 0f);
			component2.anchorMax = new Vector2(0.75f, 1f);
			component2.offsetMin = new Vector2(8f, 2f);
			component2.offsetMax = new Vector2(0f, -2f);
			GameObject val2 = new GameObject("InfoTxt");
			val2.layer = layer;
			val2.transform.SetParent(_root.transform, false);
			_infoText = val2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_infoText).fontSize = 10f;
			((TMP_Text)_infoText).alignment = (TextAlignmentOptions)516;
			((TMP_Text)_infoText).enableWordWrapping = false;
			((Graphic)_infoText).color = CanvasService.TextSecondary;
			RectTransform component3 = val2.GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0.75f, 0f);
			component3.anchorMax = new Vector2(1f, 1f);
			component3.offsetMin = new Vector2(0f, 2f);
			component3.offsetMax = new Vector2(-8f, -2f);
			_root.SetActive(false);
		}

		public void Update(string teleportName, int teleportNumber, string category, Action<string> onClick)
		{
			((TMP_Text)_nameText).SetText("<color=#E8C0B8>" + teleportName + "</color>", true);
			((TMP_Text)_infoText).SetText($"{category} #{teleportNumber}", true);
			((UnityEventBase)_button.onClick).RemoveAllListeners();
			((UnityEvent)_button.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
			{
				onClick(teleportName);
			}));
		}

		public void SetVisible(bool visible)
		{
			_root.SetActive(visible);
		}
	}
	internal class SystemService
	{
		private readonly World _world = world ?? throw new ArgumentNullException("world");

		private ClientScriptMapper? _clientScriptMapper;

		public ClientScriptMapper ClientScriptMapper => _clientScriptMapper ?? (_clientScriptMapper = GetSystem<ClientScriptMapper>());

		public SystemService(World world)
		{
		}

		private T GetSystem<T>() where T : ComponentSystemBase
		{
			return _world.GetExistingSystemManaged<T>() ?? throw new InvalidOperationException("Failed to get " + Il2CppType.Of<T>().FullName + " from the world.");
		}

		public bool TryUpdateSystem(string assemblyQualifiedName)
		{
			Type type = Type.GetType(assemblyQualifiedName, throwOnError: false);
			if (type == null)
			{
				return false;
			}
			return TryUpdateSystem(type);
		}

		public bool TryUpdateSystem(Type systemType)
		{
			if (!typeof(ComponentSystemBase).IsAssignableFrom(systemType))
			{
				retur