Decompiled source of ScarletTeleportGUI v1.4.0

BepInEx/plugins/ScarletTeleportGUI/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 Il2CppSystem.Collections.Generic;
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.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("ScarletTeleportGUI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0")]
[assembly: AssemblyProduct("ScarletTeleportGUI")]
[assembly: AssemblyTitle("ScarletTeleportGUI")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.0.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_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0017: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0031: Expected O, but got Unknown
			if ((Object)_monoBehaviour == (Object)null)
			{
				GameObject val = new GameObject("ScarletTeleportGUI");
				_monoBehaviour = (MonoBehaviour)val.AddComponent<IgnorePhysicsDebugSystem>();
				Object.DontDestroyOnLoad((Object)val);
			}
			return _monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine));
		}

		public static void StopCoroutine(Coroutine routine)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			if (!((Object)_monoBehaviour == (Object)null))
			{
				_monoBehaviour.StopCoroutine(routine);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.scarletteleportgui.vrising";

		public const string PLUGIN_NAME = "ScarletTeleportGUI";

		public const string PLUGIN_VERSION = "1.4.0";
	}
	[BepInPlugin("com.scarletteleportgui.vrising", "ScarletTeleportGUI", "1.4.0")]
	internal class Plugin : BasePlugin
	{
		private Harmony _harmony;

		private static ConfigEntry<bool> _teleportsPanel;

		private static ConfigEntry<bool> _eclipsed;

		private static ConfigEntry<bool> _requestPopupEnabled;

		private static ConfigEntry<bool> _requestPopupPinned;

		private static ConfigEntry<float> _requestPopupX;

		private static ConfigEntry<float> _requestPopupY;

		private static ConfigEntry<int> _requestPopupMaxRows;

		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 static bool RequestPopupEnabled => _requestPopupEnabled.Value;

		public static bool RequestPopupPinned => _requestPopupPinned.Value;

		public static float RequestPopupX => _requestPopupX.Value;

		public static float RequestPopupY => _requestPopupY.Value;

		public static int RequestPopupMaxRows => _requestPopupMaxRows.Value;

		public override void Load()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			Instance = this;
			bool flag = false;
			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.4.0");
					((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 val2 = new BepInExInfoLogInterpolatedStringHandler(20, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("ScarletTeleportGUI");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("1.4.0");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] loaded on client.");
				}
				log2.LogInfo(val2);
			}
		}

		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.");
			_requestPopupEnabled = InitConfigEntry("TeleportRequestPopup", "Enabled", defaultValue: true, "Show a small accept/deny popup window when another player requests to teleport to you.");
			_requestPopupPinned = InitConfigEntry("TeleportRequestPopup", "Pinned", defaultValue: false, "Pin the teleport request popup so it cannot be dragged accidentally.");
			_requestPopupX = InitConfigEntry("TeleportRequestPopup", "WindowX", 0f, "Saved horizontal position of the teleport request popup (relative to screen center).");
			_requestPopupY = InitConfigEntry("TeleportRequestPopup", "WindowY", 120f, "Saved vertical position of the teleport request popup (relative to screen center).");
			_requestPopupMaxRows = InitConfigEntry("TeleportRequestPopup", "MaxRows", 6, "Maximum number of simultaneous teleport requests shown as rows. Extra requests wait in queue.");
		}

		internal static void SaveRequestPopupState(float x, float y, bool pinned)
		{
			_requestPopupX.Value = x;
			_requestPopupY.Value = y;
			_requestPopupPinned.Value = pinned;
		}

		private static ConfigEntry<T> InitConfigEntry<T>(string section, string key, T defaultValue, string description)
		{
			//IL_0026: 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 = null;
			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_0010: 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_0010: 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_001a: 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;
		}
	}
}
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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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 = false;
				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
		}

		[CompilerGenerated]
		private sealed class _003CPrimeSocialMenuRoster_003Ed__122 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int _003C_003E1__state;

			private object _003C_003E2__current;

			public GameObject socialMenuGO;

			private bool _003CwasActive_003E5__2;

			private float _003CendTime_003E5__3;

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

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return _003C_003E2__current;
				}
			}

			[DebuggerHidden]
			public _003CPrimeSocialMenuRoster_003Ed__122(int _003C_003E1__state)
			{
				this._003C_003E1__state = _003C_003E1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = _003C_003E1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						_003C_003Em__Finally1();
					}
				}
				_003C_003E1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Expected O, but got Unknown
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Expected O, but got Unknown
				try
				{
					switch (_003C_003E1__state)
					{
					default:
						return false;
					case 0:
					{
						_003C_003E1__state = -1;
						if (_socialMenuPrimeInProgress)
						{
							return false;
						}
						_socialMenuPrimeInProgress = true;
						_nextSocialMenuPrimeAttempt = Time.realtimeSinceStartup + 10f;
						_003CwasActive_003E5__2 = socialMenuGO.activeSelf;
						_003C_003E1__state = -3;
						ClanMenu component = socialMenuGO.GetComponent<ClanMenu>();
						if ((Object)component != (Object)null)
						{
							TryInvokeClanMenuPrimeMethods(component);
						}
						if (!_003CwasActive_003E5__2)
						{
							socialMenuGO.SetActive(true);
						}
						_003CendTime_003E5__3 = Time.realtimeSinceStartup + 2f;
						break;
					}
					case 1:
						_003C_003E1__state = -3;
						break;
					}
					if (Time.realtimeSinceStartup < _003CendTime_003E5__3)
					{
						TryInvokeSocialMenuSystems();
						RefreshOnlinePlayerCache();
						if (_discoveredOnlinePlayers.Count <= 0)
						{
							_003C_003E2__current = (object)new WaitForSecondsRealtime(0.1f);
							_003C_003E1__state = 1;
							return true;
						}
					}
					if (_playerListOpen)
					{
						RefreshPlayerList();
					}
					_003C_003Em__Finally1();
					return false;
				}
				catch
				{
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				return MoveNext();
			}

			private void _003C_003Em__Finally1()
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Expected O, but got Unknown
				_003C_003E1__state = -1;
				if (!_003CwasActive_003E5__2 && (Object)socialMenuGO != (Object)null)
				{
					socialMenuGO.SetActive(false);
				}
				_socialMenuPrimeInProgress = false;
			}

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

		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
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Expected O, but got Unknown
				if (TeleportRequestPopup.SuppressesInput)
				{
					return true;
				}
				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)_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)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			_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 ((Object)(object)panel != (Object)null)
				{
					panel.SetActive(false);
				}
				if ((Object)_iconButton != (Object)null)
				{
					_ready = true;
					Core.StartCoroutine(UpdateLoop());
				}
			}
			TeleportRequestPopup.Initialize(_bottomBarCanvas, _layer);
		}

		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_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Expected O, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Expected O, but got Unknown
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Expected O, but got Unknown
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: 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)val4;
			_playerNameField.placeholder = (Graphic)val3;
			_playerNameField.lineType = (LineType)0;
			_playerNameField.contentType = (ContentType)0;
			((Selectable)_playerNameField).targetGraphic = (Graphic)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_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_046f: 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 ((Object)(object)panel != (Object)null)
			{
				panel.SetActive(true);
			}
			RequestTeleportList();
		}

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

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

		private static void OnPrivateTabClicked()
		{
			ClearAndUnlockPlayerInput();
			_playerListOpen = false;
			GameObject playerListPanel = _playerListPanel;
			if ((Object)(object)playerListPanel != (Object)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 ((Object)(object)playerListPanel != (Object)null)
			{
				playerListPanel.SetActive(false);
			}
			ClosePanel();
			Core.StartCoroutine(SendWaypointsCommandAfterDelay());
		}

		private static void OnListPlayersClicked()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			if (!_panelOpen || _activeCategory != TeleportCategory.Player || (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()
		{
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			if (_activeCategory == TeleportCategory.Player)
			{
				GameObject cardsRoot = _cardsRoot;
				if ((Object)(object)cardsRoot != (Object)null)
				{
					cardsRoot.SetActive(false);
				}
				GameObject navBar = _navBar;
				if ((Object)(object)navBar != (Object)null)
				{
					navBar.SetActive(false);
				}
				GameObject playerForm = _playerForm;
				if ((Object)(object)playerForm != (Object)null)
				{
					playerForm.SetActive(true);
				}
				GameObject playerListPanel = _playerListPanel;
				if ((Object)(object)playerListPanel != (Object)null)
				{
					playerListPanel.SetActive(_playerListOpen);
				}
				if ((Object)_titleLabel != (Object)null)
				{
					((TMP_Text)_titleLabel).SetText("Scarlet Teleports - Player", true);
				}
				if ((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 ((Object)(object)playerForm2 != (Object)null)
			{
				playerForm2.SetActive(false);
			}
			GameObject playerListPanel2 = _playerListPanel;
			if ((Object)(object)playerListPanel2 != (Object)null)
			{
				playerListPanel2.SetActive(false);
			}
			GameObject cardsRoot2 = _cardsRoot;
			if ((Object)(object)cardsRoot2 != (Object)null)
			{
				cardsRoot2.SetActive(true);
			}
			GameObject navBar2 = _navBar;
			if ((Object)(object)navBar2 != (Object)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)_titleLabel != (Object)null)
			{
				string text = (TeleportDataService.AwaitingTeleportList ? " (loading)" : string.Empty);
				((TMP_Text)_titleLabel).SetText("Scarlet Teleports - " + currentCategoryLabel + text, true);
			}
			if ((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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (!string.IsNullOrWhiteSpace(teleportName))
			{
				CommandSender.Send(".stp tp " + teleportName);
				ManualLogSource log = Core.Log;
				bool flag = false;
				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();
			TeleportRequestPopup.Reset();
			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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			go.layer = _layer;
			Object.DontDestroyOnLoad((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_0038: 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_0040: 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)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			if ((Object)go != (Object)null)
			{
				Object.Destroy((Object)go);
			}
		}

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

		private static void SetPlayerHint(string message)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			if ((Object)_playerHintLabel != (Object)null)
			{
				((TMP_Text)_playerHintLabel).SetText(message, true);
			}
		}

		private static void ActivatePlayerInput()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			if (!((Object)_playerNameField == (Object)null) && _panelOpen && _activeCategory == TeleportCategory.Player)
			{
				EventSystem current = EventSystem.current;
				if ((Object)(object)current != (Object)null)
				{
					current.SetSelectedGameObject(((Component)_playerNameField).gameObject);
				}
				((Selectable)_playerNameField).Select();
				_playerNameField.ActivateInputField();
			}
		}

		private static void DeactivatePlayerInput(bool applyGrace = true)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0034: 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_004d: Expected O, but got Unknown
			//IL_004d: Expected O, but got Unknown
			if (!((Object)_playerNameField == (Object)null))
			{
				bool isFocused = _playerNameField.isFocused;
				EventSystem current = EventSystem.current;
				if ((Object)(((Object)(object)current != (Object)null) ? current.currentSelectedGameObject : null) == (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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//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)
			if (!_panelOpen || _activeCategory != TeleportCategory.Player)
			{
				return false;
			}
			if ((Object)_playerNameField == (Object)null || !_playerNameField.isFocused)
			{
				return false;
			}
			if (!Input.GetMouseButtonDown(0))
			{
				return false;
			}
			if ((Object)_playerInputRoot == (Object)null)
			{
				return false;
			}
			if ((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()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			if ((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()
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			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)_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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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 = false;
				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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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 = false;
				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()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			if (!_socialMenuPrimeInProgress && !(Time.realtimeSinceStartup < _nextSocialMenuPrimeAttempt))
			{
				ClanMenu val = Object.FindObjectOfType<ClanMenu>(true);
				if (!((Object)val == (Object)null))
				{
					Core.StartCoroutine(PrimeSocialMenuRoster(((Component)val).gameObject));
				}
			}
		}

		private static IEnumerator PrimeSocialMenuRoster(GameObject socialMenuGO)
		{
			try
			{
				int num = default(int);
				float num2 = default(float);
				switch (num)
				{
				case 0:
					if (!_socialMenuPrimeInProgress)
					{
						_socialMenuPrimeInProgress = true;
						_nextSocialMenuPrimeAttempt = Time.realtimeSinceStartup + 10f;
						bool activeSelf = socialMenuGO.activeSelf;
						ClanMenu component = socialMenuGO.GetComponent<ClanMenu>();
						if ((Object)component != (Object)null)
						{
							TryInvokeClanMenuPrimeMethods(component);
						}
						if (!activeSelf)
						{
							socialMenuGO.SetActive(true);
						}
						num2 = Time.realtimeSinceStartup + 2f;
						goto case 1;
					}
					break;
				case 1:
					if (Time.realtimeSinceStartup < num2)
					{
						TryInvokeSocialMenuSystems();
						RefreshOnlinePlayerCache();
						if (_discoveredOnlinePlayers.Count <= 0)
						{
							new WaitForSecondsRealtime(0.1f);
							/*Error near IL_010a: Unexpected return in MoveNext()*/;
						}
					}
					if (_playerListOpen)
					{
						RefreshPlayerList();
					}
					((_003CPrimeSocialMenuRoster_003Ed__122)/*Error near IL_00f6: stateMachine*/)._003C_003Em__Finally1();
					break;
				}
			}
			catch
			{
				((IDisposable)/*Error near IL_0101: stateMachine*/).Dispose();
				throw;
			}
			yield break;
		}

		private static void TryInvokeSocialMenuSystems()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			string[] obj = new string[2] { "ProjectM.Sequencer.HandleOpenSocialMenuSystem, ProjectM", "ProjectM.HandleOpenSocialMenuSystem, ProjectM" };
			bool flag = false;
			string[] array = obj;
			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_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Expected O, but got Unknown
			//IL_0012: 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_001d: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: 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_00ae: 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_00ca: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Expected O, but got Unknown
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			TryCollectClanTeamPlayers(names, seen, localPlayerName);
			TryCollectClanMemberStatusPlayers(names, seen, localPlayerName);
			bool flag = false;
			EntityManager entityManager;
			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 val5 = new BepInExInfoLogInterpolatedStringHandler(64, 3, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[ScarletTeleportGUI] PlayerCharacter entity ");
								((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(current.Index);
								((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" userExists=");
								((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<bool>(userEntity.Exists());
								((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" name='");
								((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(text);
								((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("'");
							}
							log2.LogInfo(val5);
						}
						if (!string.IsNullOrWhiteSpace(text) && !IsLocalPlayerName(text, localPlayerName) && seen.Add(text))
						{
							names.Add(text);
						}
					}
				}
				finally
				{
					val2.Dispose();
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log3 = Core.Log;
				BepInExWarningLogInterpolatedStringHandler val6 = new BepInExWarningLogInterpolatedStringHandler(59, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[ScarletTeleportGUI] Could not query PlayerCharacter list: ");
					((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(ex.Message);
				}
				log3.LogWarning(val6);
			}
			try
			{
				Entity localUser = Core.LocalUser;
				entityManager = Core.EntityManager;
				EntityQuery val7 = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
				NativeArray<Entity> val8 = ((EntityQuery)(ref val7)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
				if (logDiagnostics)
				{
					ManualLogSource log4 = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val9 = new BepInExInfoLogInterpolatedStringHandler(42, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val9).AppendLiteral("[ScarletTeleportGUI] Query User: entities=");
						((BepInExLogInterpolatedStringHandler)val9).AppendFormatted<int>(val8.Length);
					}
					log4.LogInfo(val9);
				}
				try
				{
					Enumerator<Entity> enumerator2 = val8.GetEnumerator();
					while (enumerator2.MoveNext())
					{
						Entity current2 = enumerator2.Current;
						if (!current2.Exists() || (localUser.Exists() && current2 == localUser))
						{
							continue;
						}
						string text2 = NormalizeListEntry(GetUserDisplayName(current2.Read<User>()));
						if (logDiagnostics)
						{
							ManualLogSource log5 = Core.Log;
							BepInExInfoLogInterpolatedStringHandler val10 = new BepInExInfoLogInterpolatedStringHandler(41, 2, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("[ScarletTeleportGUI] User entity ");
								((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<int>(current2.Index);
								((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" name='");
								((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>(text2);
								((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("'");
							}
							log5.LogInfo(val10);
						}
						if (!string.IsNullOrWhiteSpace(text2) && !IsLocalPlayerName(text2, localPlayerName) && seen.Add(text2))
						{
							names.Add(text2);
						}
					}
				}
				finally
				{
					val8.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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//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_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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_008f: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			bool flag = false;
			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 var name, out var isOnline))
				{
					continue;
				}
				if (!_loggedPlayerSourceDiagnostics)
				{
					ManualLogSource log2 = Core.Log;
					BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(43, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[ScarletTeleportGUI] ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(bufferLabel);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" entry name='");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(name);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' online=");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(isOnline.HasValue ? isOnline.Value.ToString() : "null");
					}
					log2.LogInfo(val2);
				}
				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_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Expected O, but got Unknown
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//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_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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0096: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			bool flag = false;
			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 val5 = new BepInExInfoLogInterpolatedStringHandler(42, 3, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[ScarletTeleportGUI] ");
								((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(typeof(TBuffer).Name);
								((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" entity ");
								((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(current.Index);
								((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" bufferCount=");
								((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(val4.Length);
							}
							log2.LogInfo(val5);
						}
						Enumerator<TBuffer> enumerator2 = val4.GetEnumerator();
						while (enumerator2.MoveNext())
						{
							if (!TryExtractPlayerEntry(enumerator2.Current, out var name, out var isOnline))
							{
								continue;
							}
							if (!_loggedPlayerSourceDiagnostics)
							{
								ManualLogSource log3 = Core.Log;
								BepInExInfoLogInterpolatedStringHandler val6 = new BepInExInfoLogInterpolatedStringHandler(43, 3, ref flag);
								if (flag)
								{
									((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[ScarletTeleportGUI] ");
									((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(typeof(TBuffer).Name);
									((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" entry name='");
									((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(name);
									((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("' online=");
									((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(isOnline.HasValue ? isOnline.Value.ToString() : "null");
								}
								log3.LogInfo(val6);
							}
							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 val7 = new BepInExWarningLogInterpolatedStringHandler(39, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("[ScarletTeleportGUI] Could not query ");
					((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<string>(typeof(TBuffer).Name);
					((BepInExLogInterpolatedStringHandler)val7).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<string>(ex.Message);
				}
				log4.LogWarning(val7);
			}
		}

		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>())
			{
				PlayerCh