Decompiled source of faitp v1.2.2

BepInEx/plugins/FAiTP/FAiTP.dll

Decompiled a day 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 FAiTP.Services;
using FAiTP.Utilities;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using ProjectM.Physics;
using ProjectM.Sequencer;
using ProjectM.UI;
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("FAiTP")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1")]
[assembly: AssemblyProduct("FAiTP")]
[assembly: AssemblyTitle("FAiTP")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.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 FAiTP
{
	internal static class Core
	{
		private static World? _client;

		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 CanvasService? CanvasService { get; set; }

		public static UICanvasBase? CanvasSource { get; private 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)"[FAiTP] 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;
			CanvasService = null;
			CanvasSource = null;
			_initialized = false;
			_localCharacter = Entity.Null;
			_localUser = Entity.Null;
			Log.LogInfo((object)"[FAiTP] Core reset.");
		}

		public static void SetCanvas(UICanvasBase canvas)
		{
			CanvasSource = canvas;
			CanvasService = new CanvasService(canvas);
			Log.LogInfo((object)"[FAiTP] 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("FAiTP");
				_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.faitp.vrising";

		public const string PLUGIN_NAME = "FAiTP";

		public const string PLUGIN_VERSION = "1.2.1";
	}
	[BepInPlugin("com.faitp.vrising", "FAiTP", "1.2.1")]
	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;

		private static ConfigEntry<float> _panelX;

		private static ConfigEntry<float> _panelY;

		private static ConfigEntry<string> _language;

		private static ConfigEntry<string> _colorScheme;

		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 static float PanelX => _panelX.Value;

		public static float PanelY => _panelY.Value;

		public static string LanguageSetting => _language.Value;

		public static string ColorScheme
		{
			get
			{
				return _colorScheme.Value;
			}
			set
			{
				_colorScheme.Value = 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>("FAiTP");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.2.1");
					((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>("FAiTP");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("1.2.1");
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] loaded on client.");
				}
				log2.LogInfo(val2);
			}
		}

		private static void InitConfig()
		{
			_teleportsPanel = InitConfigEntry("UIOptions", "TeleportsPanel", defaultValue: true, "Enable or disable the FAiTP teleport 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.");
			_panelX = InitConfigEntry("UIOptions", "PanelX", 0f, "Saved horizontal position of the teleport panel (relative to screen center).");
			_panelY = InitConfigEntry("UIOptions", "PanelY", 0f, "Saved vertical position of the teleport panel (relative to screen center).");
			_language = InitConfigEntry("UIOptions", "Language", "ru", "Interface language: ru or en.");
			_colorScheme = InitConfigEntry("UIOptions", "ColorScheme", "violet", "Interface colour scheme: violet, ice, acid, ember, graphite, darkred or vanilla.");
			Theme.SelectById(_colorScheme.Value);
		}

		internal static void SavePanelState(float x, float y)
		{
			_panelX.Value = x;
			_panelY.Value = y;
		}

		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)
		{
			return ((BasePlugin)Instance).Config.Bind<T>(section, key, defaultValue, description);
		}

		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 FAiTP.Utilities
{
	internal static class ClickService
	{
		private sealed class Target
		{
			public RectTransform Rect;

			public Graphic Visual;

			public string Name;

			public Action Handler;

			public Color BaseColor;

			public bool BaseValid;

			public bool Hovered;

			public bool Pressed;
		}

		private static readonly List<Target> _targets = new List<Target>();

		private static Target? _pressed;

		private static Target? _hover;

		private static float _nextHoverCheck;

		public static void Register(RectTransform rect, Graphic visual, string name, Action handler)
		{
			if (!((Object)(object)rect == (Object)null))
			{
				Unregister(rect);
				Target item = new Target
				{
					Rect = rect,
					Visual = visual,
					Name = name,
					Handler = handler
				};
				_targets.Add(item);
				Button component = ((Component)rect).GetComponent<Button>();
				if ((Object)(object)component != (Object)null)
				{
					((Selectable)component).transition = (Transition)0;
				}
			}
		}

		public static void Unregister(RectTransform rect)
		{
			for (int num = _targets.Count - 1; num >= 0; num--)
			{
				if ((Object)(object)_targets[num].Rect == (Object)(object)rect)
				{
					_targets.RemoveAt(num);
				}
			}
		}

		public static void Clear()
		{
			_targets.Clear();
			_pressed = null;
			_hover = null;
		}

		public static void Rebase(Graphic visual)
		{
			//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)
			if ((Object)(object)visual == (Object)null)
			{
				return;
			}
			for (int i = 0; i < _targets.Count; i++)
			{
				if ((Object)(object)_targets[i].Visual == (Object)(object)visual)
				{
					_targets[i].BaseColor = visual.color;
					_targets[i].BaseValid = true;
				}
			}
		}

		public static void Tick()
		{
			if (_pressed != null && Input.GetMouseButtonUp(0))
			{
				Target pressed = _pressed;
				_pressed = null;
				if (HitTest() == pressed)
				{
					Invoke(pressed);
				}
			}
			if (_pressed == null && Input.GetMouseButtonDown(0))
			{
				_pressed = HitTest();
			}
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			if (!(realtimeSinceStartup < _nextHoverCheck))
			{
				_nextHoverCheck = realtimeSinceStartup + 0.08f;
				_hover = HitTest();
				Paint();
			}
		}

		private static Target? HitTest()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			EventSystem current = EventSystem.current;
			if ((Object)(object)current == (Object)null)
			{
				return null;
			}
			PointerEventData val = new PointerEventData(current);
			val.position = Vector2.op_Implicit(Input.mousePosition);
			List<RaycastResult> val2 = new List<RaycastResult>();
			current.RaycastAll(val, val2);
			if (val2.Count == 0)
			{
				return null;
			}
			GameObject gameObject = val2[0].gameObject;
			if ((Object)(object)gameObject == (Object)null)
			{
				return null;
			}
			Transform val3 = gameObject.transform;
			while ((Object)(object)val3 != (Object)null)
			{
				RectTransform component = ((Component)val3).GetComponent<RectTransform>();
				if ((Object)(object)component != (Object)null)
				{
					Target target = Find(component);
					if (target != null)
					{
						Button component2 = ((Component)target.Rect).GetComponent<Button>();
						if ((Object)(object)component2 != (Object)null && !((Selectable)component2).interactable)
						{
							return null;
						}
						return target;
					}
				}
				val3 = val3.parent;
			}
			return null;
		}

		private static Target? Find(RectTransform rect)
		{
			for (int i = 0; i < _targets.Count; i++)
			{
				if ((Object)(object)_targets[i].Rect == (Object)(object)rect)
				{
					return _targets[i];
				}
			}
			return null;
		}

		private static void Invoke(Target t)
		{
			try
			{
				t.Handler();
			}
			catch (Exception ex)
			{
				Core.Log.LogError((object)("[FAiTP][UI] Button '" + t.Name + "' handler failed: " + ex));
			}
		}

		public static void ResetBaseColors()
		{
			for (int i = 0; i < _targets.Count; i++)
			{
				_targets[i].BaseValid = false;
			}
		}

		private static void Paint()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			for (int num = _targets.Count - 1; num >= 0; num--)
			{
				Target target = _targets[num];
				if ((Object)(object)target.Rect == (Object)null)
				{
					_targets.RemoveAt(num);
				}
				else if (!((Object)(object)target.Visual == (Object)null))
				{
					bool flag = _pressed == target;
					bool flag2 = _hover == target;
					if (flag != target.Pressed || flag2 != target.Hovered)
					{
						target.Pressed = flag;
						target.Hovered = flag2;
						if (!target.BaseValid)
						{
							target.BaseColor = target.Visual.color;
							target.BaseValid = true;
						}
						Color baseColor = target.BaseColor;
						if (flag)
						{
							target.Visual.color = new Color(baseColor.r * 0.65f, baseColor.g * 0.65f, baseColor.b * 0.65f, baseColor.a);
						}
						else if (flag2)
						{
							float num2 = 0.22f;
							float num3 = baseColor.r + (UiSkin.Neon.r - baseColor.r) * num2;
							float num4 = baseColor.g + (UiSkin.Neon.g - baseColor.g) * num2;
							float num5 = baseColor.b + (UiSkin.Neon.b - baseColor.b) * num2;
							target.Visual.color = new Color(Math.Min(1f, num3 * 1.05f), Math.Min(1f, num4 * 1.05f), Math.Min(1f, num5 * 1.05f), baseColor.a);
						}
						else
						{
							target.Visual.color = baseColor;
						}
					}
				}
			}
		}
	}
	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("[FAiTP] Sent command: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(command);
				}
				log.LogInfo(val3);
			}
		}

		public static void Reset()
		{
			_fromCharacter = null;
		}
	}
	internal static class DragService
	{
		private static RectTransform? _window;

		private static RectTransform? _fallbackSpace;

		private static Func<Vector2, Vector2>? _clamp;

		private static Action? _ended;

		private static Vector2 _grabOffset;

		public static bool Dragging { get; private set; }

		public static void Tick(RectTransform window, Transform handle, Func<Vector2, Vector2> clamp, Action ended, RectTransform fallbackSpace, Action began)
		{
			//IL_00e7: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a9: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)window == (Object)null || (Object)(object)handle == (Object)null || (Dragging && (Object)(object)_window != (Object)(object)window))
			{
				return;
			}
			EventSystem current = EventSystem.current;
			if ((Object)(object)current == (Object)null)
			{
				return;
			}
			if (!Dragging)
			{
				if (!Input.GetMouseButtonDown(0) || !PointerOver(current, handle))
				{
					return;
				}
				RectTransform val = DragSpace(window, fallbackSpace);
				if (!((Object)(object)val == (Object)null))
				{
					_window = window;
					_fallbackSpace = fallbackSpace;
					_clamp = clamp;
					_ended = ended;
					Dragging = true;
					Vector2 val2 = default(Vector2);
					if (RectTransformUtility.ScreenPointToLocalPointInRectangle(val, Vector2.op_Implicit(Input.mousePosition), CanvasCamera(val), ref val2))
					{
						_grabOffset = val2 - window.anchoredPosition;
					}
					began?.Invoke();
				}
				return;
			}
			RectTransform val3 = DragSpace(_window, _fallbackSpace);
			if ((Object)(object)val3 == (Object)null)
			{
				Cancel(_window);
				return;
			}
			Vector2 val4 = default(Vector2);
			if (Input.GetMouseButton(0) && RectTransformUtility.ScreenPointToLocalPointInRectangle(val3, Vector2.op_Implicit(Input.mousePosition), CanvasCamera(val3), ref val4))
			{
				_window.anchoredPosition = _clamp(val4 - _grabOffset);
			}
			if (Input.GetMouseButtonUp(0))
			{
				Action? ended2 = _ended;
				Cancel(_window);
				ended2?.Invoke();
			}
		}

		public static bool PointerOver(Transform root)
		{
			if ((Object)(object)root == (Object)null)
			{
				return false;
			}
			EventSystem current = EventSystem.current;
			if ((Object)(object)current != (Object)null)
			{
				return PointerOver(current, root);
			}
			return false;
		}

		public static void Cancel(RectTransform window)
		{
			if (Dragging && (Object)(object)_window == (Object)(object)window)
			{
				Dragging = false;
				_window = null;
				_fallbackSpace = null;
				_clamp = null;
				_ended = null;
			}
		}

		private static RectTransform DragSpace(RectTransform window, RectTransform? fallbackSpace)
		{
			Transform parent = ((Transform)window).parent;
			RectTransform val = (((Object)(object)parent != (Object)null) ? ((Component)parent).GetComponent<RectTransform>() : null);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			return fallbackSpace;
		}

		private static Camera? CanvasCamera(RectTransform space)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Canvas componentInParent = ((Component)space).GetComponentInParent<Canvas>();
			if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.renderMode != 0)
			{
				return componentInParent.worldCamera;
			}
			return null;
		}

		private static bool PointerOver(EventSystem es, Transform root)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			PointerEventData val = new PointerEventData(es);
			val.position = Vector2.op_Implicit(Input.mousePosition);
			List<RaycastResult> val2 = new List<RaycastResult>();
			es.RaycastAll(val, val2);
			for (int i = 0; i < val2.Count; i++)
			{
				GameObject gameObject = val2[i].gameObject;
				if ((Object)(object)gameObject != (Object)null && gameObject.transform.IsChildOf(root))
				{
					return true;
				}
			}
			return false;
		}
	}
	internal static class L10n
	{
		internal static bool IsRu => string.Equals(Plugin.LanguageSetting, "ru", StringComparison.OrdinalIgnoreCase);

		internal static string TabSetPoint
		{
			get
			{
				if (!IsRu)
				{
					return "+ Point";
				}
				return "+ Точка";
			}
		}

		internal static string TabPrivate
		{
			get
			{
				if (!IsRu)
				{
					return "Private";
				}
				return "Приватные";
			}
		}

		internal static string TabPublic
		{
			get
			{
				if (!IsRu)
				{
					return "Public";
				}
				return "Публичные";
			}
		}

		internal static string TabPlayers
		{
			get
			{
				if (!IsRu)
				{
					return "Players";
				}
				return "Игроки";
			}
		}

		internal static string TabWaypoints
		{
			get
			{
				if (!IsRu)
				{
					return "Waypoints";
				}
				return "Вейпоинты";
			}
		}

		internal static string CategoryWaypoints
		{
			get
			{
				if (!IsRu)
				{
					return "Waypoints";
				}
				return "Вейпоинты";
			}
		}

		internal static string TabCastle
		{
			get
			{
				if (!IsRu)
				{
					return "Castles";
				}
				return "Замки";
			}
		}

		internal static string PlotWord
		{
			get
			{
				if (!IsRu)
				{
					return "Plot";
				}
				return "Участок";
			}
		}

		internal static string CellsShort
		{
			get
			{
				if (!IsRu)
				{
					return "free cells";
				}
				return "св. клеток";
			}
		}

		internal static string ClanSuffix
		{
			get
			{
				if (!IsRu)
				{
					return " · clan";
				}
				return " · клан";
			}
		}

		internal static string CastleEmpty
		{
			get
			{
				if (!IsRu)
				{
					return "No castles";
				}
				return "Замков нет";
			}
		}

		internal static string CastleHint
		{
			get
			{
				if (!IsRu)
				{
					return "Click a castle to send creatures there";
				}
				return "Нажмите на замок — существа полетят туда";
			}
		}

		internal static string Delete
		{
			get
			{
				if (!IsRu)
				{
					return "Delete";
				}
				return "Удалить";
			}
		}

		internal static string NewPointPrefix
		{
			get
			{
				if (!IsRu)
				{
					return "Point-";
				}
				return "Точка-";
			}
		}

		internal static string SetPointPrompt
		{
			get
			{
				if (!IsRu)
				{
					return "Enter a point name:";
				}
				return "Введите название точки:";
			}
		}

		internal static string SetPointPlaceholder
		{
			get
			{
				if (!IsRu)
				{
					return "e.g. My garden";
				}
				return "Например: Мой сад";
			}
		}

		internal static string CreatePointBtn
		{
			get
			{
				if (!IsRu)
				{
					return "Create";
				}
				return "Создать";
			}
		}

		internal static string CancelBtn
		{
			get
			{
				if (!IsRu)
				{
					return "Cancel";
				}
				return "Отмена";
			}
		}

		internal static string SetPointHint
		{
			get
			{
				if (!IsRu)
				{
					return "Spaces become '-'. Empty name -> auto Point-N.";
				}
				return "Пробелы заменяются на «-». Пустое имя → авто Точка-N.";
			}
		}

		internal static string RosterHint
		{
			get
			{
				if (!IsRu)
				{
					return "Click a player to send a request";
				}
				return "Нажмите на игрока, чтобы отправить запрос";
			}
		}

		internal static string EnterPlayerName
		{
			get
			{
				if (!IsRu)
				{
					return "Enter player name";
				}
				return "Введите имя игрока";
			}
		}

		internal static string PlayerNameLabel
		{
			get
			{
				if (!IsRu)
				{
					return "Player name";
				}
				return "Имя игрока";
			}
		}

		internal static string RequestBtn
		{
			get
			{
				if (!IsRu)
				{
					return "Request";
				}
				return "Запросить";
			}
		}

		internal static string AcceptFormBtn
		{
			get
			{
				if (!IsRu)
				{
					return "Accept";
				}
				return "Принять";
			}
		}

		internal static string PlayerHint
		{
			get
			{
				if (!IsRu)
				{
					return "Teleport: .tt tpr [name]. Accept: .tt tpa [name].";
				}
				return "Телепорт: .tt tpr [name]. Принять: .tt tpa [name].";
			}
		}

		internal static string PlayersOnline
		{
			get
			{
				if (!IsRu)
				{
					return "Players online";
				}
				return "Игроки онлайн";
			}
		}

		internal static string BackBtn
		{
			get
			{
				if (!IsRu)
				{
					return "< Back";
				}
				return "< Назад";
			}
		}

		internal static string NextBtn
		{
			get
			{
				if (!IsRu)
				{
					return "Next >";
				}
				return "Вперёд >";
			}
		}

		internal static string EnterNameFirst
		{
			get
			{
				if (!IsRu)
				{
					return "Enter a player name first.";
				}
				return "Сначала введите имя игрока.";
			}
		}

		internal static string TitlePlayers => "FAiTP - " + (IsRu ? "Игроки" : "Players");

		internal static string NoPlayers
		{
			get
			{
				if (!IsRu)
				{
					return "No other players online";
				}
				return "Нет других игроков онлайн";
			}
		}

		internal static string LoadingSuffix
		{
			get
			{
				if (!IsRu)
				{
					return " (loading)";
				}
				return " (загрузка)";
			}
		}

		internal static string PopupTitle
		{
			get
			{
				if (!IsRu)
				{
					return "Teleport request";
				}
				return "Запрос телепорта";
			}
		}

		internal static string AcceptBtn
		{
			get
			{
				if (!IsRu)
				{
					return "Accept";
				}
				return "Принять";
			}
		}

		internal static string DenyBtn
		{
			get
			{
				if (!IsRu)
				{
					return "Deny";
				}
				return "Отклонить";
			}
		}

		internal static string CastleSelectedHint(int plot)
		{
			if (!IsRu)
			{
				return "Plot " + plot + " selected. Click it again to clear.";
			}
			return "Выбран участок " + plot + ". Нажмите его ещё раз, чтобы снять выбор.";
		}

		internal static string PageRange(string category, int first, int last, int total)
		{
			if (IsRu)
			{
				return $"{category} {first}-{last} из {total}";
			}
			return $"{category} {first}-{last} of {total}";
		}

		internal static string LoadingLabel(string category)
		{
			if (!IsRu)
			{
				return "Loading: " + category;
			}
			return "Загрузка: " + category;
		}

		internal static string NoTeleports(string category)
		{
			if (!IsRu)
			{
				return "No teleports (" + category + ")";
			}
			return "Нет телепортов (" + category + ")";
		}

		internal static string PlayersRange(int first, int last, int total)
		{
			if (IsRu)
			{
				return $"Игроки {first}-{last} из {total}";
			}
			return $"Players {first}-{last} of {total}";
		}

		internal static string PageN(int current, int max)
		{
			if (IsRu)
			{
				return $"Стр. {current}/{max}";
			}
			return $"Page {current}/{max}";
		}

		internal static string PinLabel(bool pinned)
		{
			if (pinned)
			{
				if (!IsRu)
				{
					return "Pinned";
				}
				return "Закреплено";
			}
			if (!IsRu)
			{
				return "Pin";
			}
			return "Закрепить";
		}

		internal static string QueueMore(int hidden)
		{
			if (IsRu)
			{
				return $"+{hidden} ещё в очереди";
			}
			return $"+{hidden} more in queue";
		}

		internal static string Timer(int remaining)
		{
			if (IsRu)
			{
				return $"{remaining} с";
			}
			return $"{remaining}s";
		}
	}
	internal sealed class Theme
	{
		private static readonly Color NeonRef = new Color(0.82f, 0.48f, 1f, 1f);

		internal readonly string Id;

		internal readonly string Label;

		private readonly float _hueShift;

		private readonly float _satScale;

		private readonly float _valScale;

		private readonly bool _identity;

		private readonly Color? _accentOverride;

		internal static readonly Theme[] All = new Theme[7]
		{
			new Theme("violet", "Фиолет", 0f, 1f, 1f),
			new Theme("ice", "Лёд", -55f, 1f, 1.06f),
			new Theme("acid", "Кислота", -135f, 1.15f, 1f),
			new Theme("ember", "Огонь", 105f, 1.1f, 1.05f),
			new Theme("graphite", "Графит", 0f, 0.1f, 1f),
			new Theme("darkred", "Красный", 76f, 1.55f, 0.72f),
			new Theme("vanilla", "Ваниль", 0f, 0.15f, 0.35f, (Color?)new Color(0.85f, 0.09f, 0.11f, 1f))
		};

		internal static int CurrentIndex { get; private set; }

		internal static Theme Current => All[CurrentIndex];

		internal Color Neon => (Color)(((??)_accentOverride) ?? Map(NeonRef));

		private Theme(string id, string label, float hueShiftDegrees, float satScale, float valScale, Color? accent = null)
		{
			Id = id;
			Label = label;
			_hueShift = hueShiftDegrees / 360f;
			_satScale = satScale;
			_valScale = valScale;
			_identity = hueShiftDegrees == 0f && satScale == 1f && valScale == 1f;
			_accentOverride = accent;
		}

		internal static void SelectById(string id)
		{
			for (int i = 0; i < All.Length; i++)
			{
				if (string.Equals(All[i].Id, id, StringComparison.OrdinalIgnoreCase))
				{
					CurrentIndex = i;
					return;
				}
			}
			CurrentIndex = 0;
		}

		internal static Theme Cycle()
		{
			CurrentIndex = (CurrentIndex + 1) % All.Length;
			return Current;
		}

		internal Color Map(Color reference)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0008: Unknown result type (might be due to invalid IL or missing references)
			if (_identity)
			{
				return reference;
			}
			float num2 = default(float);
			float num3 = default(float);
			float num = default(float);
			Color.RGBToHSV(reference, ref num, ref num2, ref num3);
			num += _hueShift;
			num -= (float)Math.Floor(num);
			Color result = Color.HSVToRGB(num, Mathf.Clamp01(num2 * _satScale), Mathf.Clamp01(num3 * _valScale));
			result.a = reference.a;
			return result;
		}

		internal Color Tint(Color reference)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (_accentOverride.HasValue)
			{
				Color result = Color.Lerp(reference, _accentOverride.Value, 0.9f);
				result.a = reference.a;
				return result;
			}
			return Map(reference);
		}

		internal Color AccentOver(Color reference)
		{
			//IL_0006: 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)
			return _accentOverride ?? reference;
		}
	}
	internal static class ThemeBinder
	{
		private static readonly List<(Graphic graphic, Func<Color> colorOf)> _items = new List<(Graphic, Func<Color>)>();

		internal static void Bind(Graphic graphic, Func<Color> colorOf)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)graphic == (Object)null))
			{
				graphic.color = colorOf();
				_items.Add((graphic, colorOf));
			}
		}

		internal static void Apply()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			for (int num = _items.Count - 1; num >= 0; num--)
			{
				var (val, func) = _items[num];
				if ((Object)(object)val == (Object)null)
				{
					_items.RemoveAt(num);
				}
				else
				{
					val.color = func();
				}
			}
		}
	}
	internal static class UiSkin
	{
		private static readonly Color NeonRef = new Color(0.82f, 0.48f, 1f, 1f);

		internal const float CORNER = 16f;

		private const float STROKE_THICKNESS = 4f;

		private static Sprite _maskLarge;

		private static Sprite _maskSmall;

		private static Sprite _maskTopLarge;

		private static Sprite _maskBottomLarge;

		private static Sprite _headerGradient;

		private static readonly Dictionary<long, Sprite> _strokes = new Dictionary<long, Sprite>();

		internal static readonly Color HeaderRef = new Color(0.37f, 0.15f, 0.7f, 1f);

		internal static Color Neon => Theme.Current.Map(NeonRef);

		public static Sprite MaskLarge => _maskLarge ?? (_maskLarge = BuildMask(96, 16f, 16f));

		public static Sprite MaskSmall => _maskSmall ?? (_maskSmall = BuildMask(32, 7f, 7f));

		public static Sprite MaskTopLarge => _maskTopLarge ?? (_maskTopLarge = BuildMask(96, 16f, 0f));

		public static Sprite MaskBottomLarge => _maskBottomLarge ?? (_maskBottomLarge = BuildMask(96, 0f, 16f));

		public static Sprite HeaderGradient => _headerGradient ?? (_headerGradient = BuildGradient(96, 16f));

		public static void ApplyLarge(Image img)
		{
			img.sprite = MaskLarge;
			img.type = (Type)1;
		}

		public static void ApplySmall(Image img)
		{
			img.sprite = MaskSmall;
			img.type = (Type)1;
		}

		public static void ApplyHeader(Image img)
		{
			img.sprite = HeaderGradient;
			img.type = (Type)1;
			ThemeBinder.Bind((Graphic)(object)img, () => Theme.Current.Map(HeaderRef));
		}

		public static void ApplyBottomStrip(Image img)
		{
			img.sprite = MaskBottomLarge;
			img.type = (Type)1;
		}

		public static void ApplyWindowStroke(Image img, int width, int height)
		{
			long key = ((long)width << 32) | (uint)height;
			if (!_strokes.TryGetValue(key, out var value))
			{
				value = BuildStroke(width, height);
				_strokes[key] = value;
			}
			img.sprite = value;
			img.type = (Type)0;
			((Graphic)img).raycastTarget = false;
			ThemeBinder.Bind((Graphic)(object)img, delegate
			{
				//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_000c: 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)
				Color neon = Neon;
				return new Color(neon.r, neon.g, neon.b, 0.65f);
			});
		}

		public static void AddAccentLine(Transform parent, Transform after, float x0, float y0, float x1, float y1, float alpha = 0.9f)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("NeonAccent");
			val.transform.SetParent(parent, false);
			Image obj = val.AddComponent<Image>();
			((Graphic)obj).raycastTarget = false;
			ThemeBinder.Bind((Graphic)(object)obj, delegate
			{
				//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_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				Color neon = Neon;
				return new Color(neon.r, neon.g, neon.b, alpha);
			});
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(x0, y0);
			component.anchorMax = new Vector2(x1, y1);
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.zero;
			if ((Object)(object)after != (Object)null)
			{
				val.transform.SetSiblingIndex(after.GetSiblingIndex() + 1);
			}
		}

		public static Sprite Icon(string name)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FAiTP.assets." + name + ".png");
				if (manifestResourceStream == null)
				{
					return null;
				}
				byte[] array;
				using (manifestResourceStream)
				{
					array = new byte[manifestResourceStream.Length];
					manifestResourceStream.Read(array, 0, array.Length);
				}
				Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
				if (!ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array)))
				{
					return null;
				}
				((Texture)val).filterMode = (FilterMode)1;
				((Texture)val).wrapMode = (TextureWrapMode)1;
				return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			}
			catch
			{
				return null;
			}
		}

		private static Sprite BuildMask(int size, float rTop, float rBot)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)size * 0.5f;
			Color[] array = (Color[])(object)new Color[size * size];
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float px = (float)j + 0.5f - num;
					float py = (float)i + 0.5f - num;
					float num2 = RoundedSdf(px, py, num, num, rTop, rBot);
					float num3 = Mathf.Clamp01(0.5f - num2);
					array[i * size + j] = new Color(1f, 1f, 1f, num3);
				}
			}
			return CreateTextureSprite(size, size, array, Mathf.Max(rTop, rBot));
		}

		private static Sprite BuildGradient(int size, float radius)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)size * 0.5f;
			Color[] array = (Color[])(object)new Color[size * size];
			for (int i = 0; i < size; i++)
			{
				float num2 = ((float)i + 0.5f) / (float)size;
				float num3 = Mathf.Lerp(1f, 0.49f, num2);
				float num4 = Mathf.Lerp(0.97f, 0.96f, num2);
				for (int j = 0; j < size; j++)
				{
					float px = (float)j + 0.5f - num;
					float py = (float)i + 0.5f - num;
					float num5 = RoundedSdf(px, py, num, num, radius, 0f);
					float num6 = Mathf.Clamp01(0.5f - num5);
					array[i * size + j] = new Color(num3, num3, num3, num4 * num6);
				}
			}
			return CreateTextureSprite(size, size, array, radius);
		}

		private static Sprite BuildStroke(int width, int height)
		{
			//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)
			float num = (float)width * 0.5f;
			float num2 = (float)height * 0.5f;
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < height; i++)
			{
				for (int j = 0; j < width; j++)
				{
					float px = (float)j + 0.5f - num;
					float py = (float)i + 0.5f - num2;
					float num3 = RoundedSdf(px, py, num, num2, 16f, 16f);
					float num4 = Mathf.Clamp01(0.5f - num3);
					float num5 = Mathf.Clamp01((0f - num3) / 4f);
					num5 = num5 * num5 * (3f - 2f * num5);
					float num6 = num4 * (1f - num5);
					array[i * width + j] = new Color(1f, 1f, 1f, num6);
				}
			}
			return CreateTextureSprite(width, height, array, 0f);
		}

		private static Sprite CreateTextureSprite(int width, int height, Color[] pixels, float border)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(pixels));
			((Texture)val).filterMode = (FilterMode)1;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			val.Apply(false);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(0f, 0f, (float)width, (float)height);
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0.5f, 0.5f);
			if (border > 0f)
			{
				return Sprite.Create(val, val2, val3, 100f, 0u, (SpriteMeshType)0, new Vector4(border, border, border, border));
			}
			return Sprite.Create(val, val2, val3);
		}

		private static float RoundedSdf(float px, float py, float halfX, float halfY, float rTop, float rBot)
		{
			float num = ((py >= 0f) ? rTop : rBot);
			float num2 = Mathf.Abs(px) - (halfX - num);
			float num3 = Mathf.Abs(py) - (halfY - num);
			float num4 = Mathf.Max(num2, 0f);
			float num5 = Mathf.Max(num3, 0f);
			float num6 = Mathf.Sqrt(num4 * num4 + num5 * num5);
			float num7 = Mathf.Min(Mathf.Max(num2, num3), 0f);
			return num6 + num7 - num;
		}
	}
}
namespace FAiTP.Services
{
	internal class CanvasService
	{
		private enum TeleportCategory
		{
			Private,
			Public,
			Player,
			Waypoints,
			Castle
		}

		[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_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: 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)
					{
						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 int CASTLE_ROWS = 4;

		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 PanelBgRef = new Color(0.06f, 0.04f, 0.1f, 0.97f);

		private static readonly Color HeaderBgRef = new Color(0.16f, 0.07f, 0.3f, 0.96f);

		private static readonly Color TabsBgRef = new Color(0.09f, 0.05f, 0.16f, 0.94f);

		internal static readonly Color CardBgRef = new Color(0.1f, 0.06f, 0.18f, 0.9f);

		internal static readonly Color SelectedCardBgRef = new Color(0.26f, 0.12f, 0.46f, 0.95f);

		internal static readonly Color CardAccentRef = new Color(0.82f, 0.48f, 1f, 0.95f);

		private static readonly Color PlayerBgRef = new Color(0.1f, 0.06f, 0.18f, 0.88f);

		private static readonly Color InputBgRef = new Color(0.13f, 0.09f, 0.22f, 0.95f);

		private static readonly Color ButtonBgRef = new Color(0.36f, 0.16f, 0.62f, 0.92f);

		internal static readonly Color CloseButtonBg = new Color(0.38f, 0.1f, 0.24f, 0.92f);

		private static readonly Color ButtonBgAltRef = new Color(0.24f, 0.12f, 0.42f, 0.92f);

		private static readonly Color HudBgRef = new Color(0.12f, 0.07f, 0.24f, 0.92f);

		private static readonly Color SeparatorBg = new Color(0.7f, 0.42f, 1f, 0.55f);

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

		internal static readonly Color TextSecondaryRef = new Color(0.87f, 0.82f, 0.97f, 0.95f);

		internal static readonly Color TextMutedRef = new Color(0.75f, 0.68f, 0.88f, 0.55f);

		internal static readonly Color CardNameRef = new Color(0.907f, 0.753f, 0.722f, 1f);

		internal static readonly Color IconTintRef = new Color(0.93f, 0.91f, 1f, 0.95f);

		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 _lastRaycastLogTime;

		private static float _nextOnlinePlayerCacheRefresh;

		private static float _nextOnlinePlayersRefresh;

		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? _castleRoot;

		private static TextMeshProUGUI? _castleHint;

		private static readonly List<DuskCard> _castleCards = new List<DuskCard>();

		private static float _nextCastleRefresh;

		private static GameObject? _playerForm;

		private static GameObject? _playerListPanel;

		private static GameObject? _navBar;

		private static RectTransform? _playerInputRoot;

		private static GameObject? _setPointForm;

		private static RectTransform? _pointInputRoot;

		private static TMP_InputField? _pointNameField;

		private static bool _setPointFormOpen;

		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 const int ROSTER_PAGE_SIZE = 5;

		private static GameObject? _rosterRoot;

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

		private static readonly List<Button> _rosterRowButtons = new List<Button>();

		private static TextMeshProUGUI? _rosterHint;

		private static float _rosterHintUntil;

		private static List<string>? _rosterSnapshot;

		private static bool _pointerOverPanel;

		private static bool _dragging;

		private static RectTransform? _dragAreaRect;

		private static TextMeshProUGUI _themeLabel;

		private static float _lastHoverCheckTime;

		private static bool _hoverStateValid;

		private static Color PanelBg => Theme.Current.Map(PanelBgRef);

		private static Color HeaderBg => Theme.Current.Map(HeaderBgRef);

		private static Color TabsBg => Theme.Current.Map(TabsBgRef);

		internal static Color CardBg => Theme.Current.Map(CardBgRef);

		internal static Color SelectedCardBg => Theme.Current.Map(SelectedCardBgRef);

		internal static Color CardAccent => Theme.Current.Map(CardAccentRef);

		private static Color PlayerBg => Theme.Current.Map(PlayerBgRef);

		private static Color InputBg => Theme.Current.Map(InputBgRef);

		private static Color ButtonBg => Theme.Current.Map(ButtonBgRef);

		private static Color ButtonBgAlt => Theme.Current.Map(ButtonBgAltRef);

		private static Color TextPrimary => Theme.Current.Tint(TextPrimaryRef);

		internal static Color TextSecondary => Theme.Current.Tint(TextSecondaryRef);

		internal static Color TextMuted => Theme.Current.Tint(TextMutedRef);

		internal static Color CardName => Theme.Current.AccentOver(CardNameRef);

		internal static Color IconTint => Theme.Current.Tint(IconTintRef);

		private static string NoPlayersPlaceholder => L10n.NoPlayers;

		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_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Expected O, but got Unknown
				if (TeleportRequestPopup.SuppressesInput)
				{
					return true;
				}
				if (_dragging)
				{
					return true;
				}
				if (_pointerOverPanel && Input.GetMouseButton(0))
				{
					return true;
				}
				if (Time.realtimeSinceStartup < _forceSuppressUntil)
				{
					return true;
				}
				if (_holdPlayerSuppression)
				{
					return true;
				}
				if (Time.realtimeSinceStartup < _suppressionGraceUntil)
				{
					return true;
				}
				if (_setPointFormOpen && (Object)_pointNameField != (Object)null && _pointNameField.isFocused)
				{
					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 => GetOnlinePlayerNames(), 
			TeleportCategory.Waypoints => TeleportDataService.VisibleWaypoints, 
			_ => TeleportDataService.VisiblePrivateTeleports, 
		};

		private static string CurrentCategoryLabel => _activeCategory switch
		{
			TeleportCategory.Private => L10n.TabPrivate, 
			TeleportCategory.Public => L10n.TabPublic, 
			TeleportCategory.Player => L10n.TabPlayers, 
			TeleportCategory.Waypoints => L10n.CategoryWaypoints, 
			_ => L10n.TabPrivate, 
		};

		internal CanvasService(UICanvasBase canvas)
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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 ((Object)(object)_bottomBarCanvas != (Object)null)
			{
				TeleportRequestPopup.Initialize(_bottomBarCanvas, _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());
				}
			}
		}

		private static IEnumerator UpdateLoop()
		{
			while (true)
			{
				if (_killSwitch)
				{
					yield break;
				}
				if (!IsAlive())
				{
					break;
				}
				if (_ready)
				{
					try
					{
						UpdateHoverState();
						UpdateDragState();
						ClickService.Tick();
						TeleportDataService.FinalizeIfExpired();
						if (TeleportDataService.ConsumeLegacyFallback())
						{
							RequestLegacyTeleportList();
						}
						OnlinePlayerListService.FinalizeIfExpired();
						if (_panelOpen && _activeCategory == TeleportCategory.Player && Time.realtimeSinceStartup >= _nextOnlinePlayersRefresh)
						{
							RequestOnlinePlayersList();
						}
						if (_panelOpen && OnlinePlayerListService.IsDirty)
						{
							OnlinePlayerListService.IsDirty = false;
							if (_activeCategory == TeleportCategory.Player)
							{
								RenderRoster();
							}
						}
						if (Time.realtimeSinceStartup >= _nextOnlinePlayerCacheRefresh)
						{
							RefreshOnlinePlayerCache();
							_nextOnlinePlayerCacheRefresh = Time.realtimeSinceStartup + 5f;
							if (_panelOpen && _activeCategory == TeleportCategory.Player && _discoveredOnlinePlayers.Count == 0)
							{
								TryPrimeSocialMenuRoster();
							}
						}
						if (ShouldReleasePlayerInput())
						{
							DeactivatePlayerInput(applyGrace: true, resetInput: false);
						}
						if (_panelOpen && TeleportDataService.IsDirty)
						{
							RefreshPage();
							TeleportDataService.IsDirty = false;
						}
						DuskCastleService.FinalizeIfExpired();
						if (_panelOpen && DuskCastleService.IsDirty)
						{
							DuskCastleService.IsDirty = false;
							if (_activeCategory == TeleportCategory.Castle)
							{
								RenderCastles();
							}
						}
						if (_panelOpen && _activeCategory == TeleportCategory.Castle && Time.realtimeSinceStartup >= _nextCastleRefresh)
						{
							RequestCastleList();
						}
					}
					catch (Exception ex)
					{
						Core.Log.LogError((object)("[FAiTP][UI] Update tick failed: " + ex));
					}
				}
				yield return (_panelOpen || TeleportRequestPopup.IsVisible) ? null : WaitForSeconds;
			}
			Core.Log.LogWarning((object)"[FAiTP] HUD canvas was replaced - the panel will be rebuilt.");
			_ready = false;
		}

		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_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			_iconButton = new GameObject("FAiTP_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(132f, 34f);
			Image val = _iconButton.AddComponent<Image>();
			UiSkin.ApplySmall(val);
			ThemeBinder.Bind((Graphic)(object)val, () => Theme.Current.Map(HudBgRef));
			UiSkin.AddAccentLine(_iconButton.transform, null, 0f, 0.94f, 1f, 1f, 0.85f);
			UiSkin.AddAccentLine(_iconButton.transform, null, 0f, 0f, 1f, 0.06f, 0.85f);
			UiSkin.AddAccentLine(_iconButton.transform, null, 0f, 0.06f, 0.025f, 0.94f, 0.85f);
			UiSkin.AddAccentLine(_iconButton.transform, null, 0.975f, 0.06f, 1f, 0.94f, 0.85f);
			GameObject obj2 = MakeChild("IconLabel", _iconButton.transform);
			TextMeshProUGUI obj3 = obj2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj3).text = "FAiTP";
			((TMP_Text)obj3).fontSize = 13f;
			((TMP_Text)obj3).fontStyle = (FontStyles)1;
			((TMP_Text)obj3).alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj3).enableWordWrapping = false;
			ThemeBinder.Bind((Graphic)(object)obj3, () => UiSkin.Neon);
			FillParent(obj2);
			Button obj4 = _iconButton.AddComponent<Button>();
			StyleButton(obj4, (Graphic)val);
			((UnityEvent)obj4.onClick).AddListener(Safe("FAiTP-Icon", 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			_panel = new GameObject("FAiTP_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);
			Image obj2 = _panel.AddComponent<Image>();
			UiSkin.ApplyLarge(obj2);
			ThemeBinder.Bind((Graphic)(object)obj2, () => PanelBg);
			obj.anchoredPosition = ClampPanelPosition(obj, LoadPanelPosition());
			BuildHeader();
			BuildTabs();
			BuildCards();
			BuildCastleCards();
			BuildRoster();
			BuildPlayerForm();
			BuildSetPointForm();
			BuildPlayerListPanel();
			BuildNav();
			GameObject obj3 = MakeChild("WindowStroke", _panel.transform);
			Stretch(obj3, 0f, 0f, 0f, 0f);
			UiSkin.ApplyWindowStroke(obj3.AddComponent<Image>(), 340, 290);
			_panel.SetActive(false);
		}

		private static void BuildHeader()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = MakeChild("Header", _panel.transform);
			UiSkin.ApplyHeader(val.AddComponent<Image>());
			Stretch(val, 0f, 0f, 256f, 0f);
			GameObject obj = MakeChild("DragArea", val.transform);
			((Graphic)obj.AddComponent<Image>()).color = Color.clear;
			Frac(obj, 0f, 0f, 0.58f, 1f);
			_dragAreaRect = obj.GetComponent<RectTransform>();
			GameObject obj2 = MakeChild("Title", val.transform);
			_titleLabel = obj2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_titleLabel).text = "FAiTP";
			((TMP_Text)_titleLabel).fontSize = 12f;
			((TMP_Text)_titleLabel).alignment = (TextAlignmentOptions)513;
			((TMP_Text)_titleLabel).enableWordWrapping = false;
			((Graphic)_titleLabel).raycastTarget = false;
			ThemeBinder.Bind((Graphic)_titleLabel, () => TextPrimary);
			Frac(obj2, 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, delegate
			{
				ClosePanel("close-button");
			}).GetComponent<Image>()).color = CloseButtonBg;
			GameObject obj3 = BuildTextButton(val.transform, "ThemeBtn", Theme.Current.Label, 0.6f, 0.84f, delegate
			{
				OnThemeClicked();
			});
			ThemeBinder.Bind((Graphic)(object)obj3.GetComponent<Image>(), () => ButtonBgAlt);
			_themeLabel = ((Component)obj3.transform.Find("ThemeBtn_Label")).GetComponent<TextMeshProUGUI>();
			UiSkin.AddAccentLine(val.transform, null, 0f, 0f, 1f, 0.1f, 0.95f);
		}

		private static void BuildTabs()
		{
			GameObject obj = MakeChild("Tabs", _panel.transform);
			ThemeBinder.Bind((Graphic)(object)obj.AddComponent<Image>(), () => TabsBg);
			Stretch(obj, 0f, 0f, 222f, 34f);
			ThemeBinder.Bind((Graphic)(object)BuildTextButton(obj.transform, "SetPointBtn", L10n.TabSetPoint, 0.02f, 0.1717f, delegate
			{
				OnSetTeleportClicked();
			}).GetComponent<Image>(), () => ButtonBg);
			ThemeBinder.Bind((Graphic)(object)BuildTextButton(obj.transform, "PrivateBtn", L10n.TabPrivate, 0.1817f, 0.3334f, delegate
			{
				OnPrivateTabClicked();
			}).GetComponent<Image>(), () => ButtonBg);
			ThemeBinder.Bind((Graphic)(object)BuildTextButton(obj.transform, "PublicBtn", L10n.TabPublic, 0.3434f, 0.4951f, delegate
			{
				OnPublicTabClicked();
			}).GetComponent<Image>(), () => ButtonBg);
			ThemeBinder.Bind((Graphic)(object)BuildTextButton(obj.transform, "PlayersBtn", L10n.TabPlayers, 0.5051f, 0.6568f, delegate
			{
				OnPlayerTabClicked();
			}).GetComponent<Image>(), () => ButtonBg);
			ThemeBinder.Bind((Graphic)(object)BuildTextButton(obj.transform, "WaypointsBtn", L10n.TabWaypoints, 0.6668f, 0.8185f, delegate
			{
				OnWaypointsTabClicked();
			}).GetComponent<Image>(), () => ButtonBg);
			ThemeBinder.Bind((Graphic)(object)BuildTextButton(obj.transform, "CastleBtn", L10n.TabCastle, 0.8285f, 0.98f, delegate
			{
				OnCastleTabClicked();
			}).GetComponent<Image>(), () => ButtonBg);
			AddTabIcon(obj.transform, "SetPointBtn", "icon_setpoint");
			AddTabIcon(obj.transform, "PrivateBtn", "icon_private");
			AddTabIcon(obj.transform, "PublicBtn", "icon_public");
			AddTabIcon(obj.transform, "PlayersBtn", "icon_players");
			AddTabIcon(obj.transform, "WaypointsBtn", "icon_waypoints");
			AddTabIcon(obj.transform, "CastleBtn", "icon_castle");
		}

		private static void AddTabIcon(Transform tabsRoot, string buttonName, string iconName)
		{
			Transform val = tabsRoot.Find(buttonName);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Sprite val2 = UiSkin.Icon(iconName);
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			GameObject obj = MakeChild("Icon", val);
			Image obj2 = obj.AddComponent<Image>();
			obj2.sprite = val2;
			obj2.preserveAspect = true;
			ThemeBinder.Bind((Graphic)(object)obj2, () => IconTint);
			((Graphic)obj2).raycastTarget = false;
			Frac(obj, 0.05f, 0.18f, 0.24f, 0.82f);
			Transform val3 = val.Find(buttonName + "_Label");
			if ((Object)(object)val3 != (Object)null)
			{
				Frac(((Component)val3).gameObject, 0.26f, 0.12f, 0.98f, 0.88f);
				TextMeshProUGUI component = ((Component)val3).GetComponent<TextMeshProUGUI>();
				if ((Object)(object)component != (Object)null)
				{
					((TMP_Text)component).enableAutoSizing = true;
					((TMP_Text)component).fontSizeMin = 7f;
					((TMP_Text)component).fontSizeMax = 11f;
				}
			}
		}

		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 BuildCastleCards()
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			_castleRoot = MakeChild("Castles", _panel.transform);
			Stretch(_castleRoot, 8f, 8f, 62f, 74f);
			GameObject obj = MakeChild("CastleHint", _castleRoot.transform);
			_castleHint = obj.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_castleHint).fontSize = 9f;
			((TMP_Text)_castleHint).alignment = (TextAlignmentOptions)513;
			((TMP_Text)_castleHint).enableWordWrapping = false;
			((TMP_Text)_castleHint).text = L10n.CastleHint;
			ThemeBinder.Bind((Graphic)(object)_castleHint, () => TextSecondary);
			((Graphic)_castleHint).raycastTarget = false;
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 0f);
			component.offsetMin = new Vector2(0f, 0f);
			component.offsetMax = new Vector2(0f, 14f);
			GameObject val = MakeChild("CastleRows", _castleRoot.transform);
			Stretch(val, 0f, 0f, 16f, 0f);
			_castleCards.Clear();
			for (int num = 0; num < 4; num++)
			{
				_castleCards.Add(new DuskCard(val.transform, _layer, num, 28f, 3f));
			}
			_castleRoot.SetActive(false);
		}

		private static void OnCastleTabClicked()
		{
			Core.Log.LogInfo((object)"[FAiTP][UI] Tab: Dusk.");
			CloseSetPointForm();
			ClearAndUnlockPlayerInput();
			_playerListOpen = false;
			GameObject playerListPanel = _playerListPanel;
			if ((Object)(object)playerListPanel != (Object)null)
			{
				playerListPanel.SetActive(false);
			}
			TeleportDataService.CancelAwaiting();
			OnlinePlayerListService.Cancel();
			_activeCategory = TeleportCategory.Castle;
			_page = 0;
			RequestCastleList();
		}

		private static void RequestCastleList()
		{
			OnlinePlayerListService.Cancel();
			TeleportDataService.CancelAwaiting();
			DuskCastleService.Begin();
			CommandSender.Send(".dusk ui");
			_nextCastleRefresh = Time.realtimeSinceStartup + 15f;
			RefreshPage();
		}

		private static void RenderCastles()
		{
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Expected O, but got Unknown
			GameObject cardsRoot = _cardsRoot;
			if ((Object)(object)cardsRoot != (Object)null)
			{
				cardsRoot.SetActive(false);
			}
			GameObject rosterRoot = _rosterRoot;
			if ((Object)(object)rosterRoot != (Object)null)
			{
				rosterRoot.SetActive(false);
			}
			GameObject playerForm = _playerForm;
			if ((Object)(object)playerForm != (Object)null)
			{
				playerForm.SetActive(false);
			}
			GameObject playerListPanel = _playerListPanel;
			if ((Object)(object)playerListPanel != (Object)null)
			{
				playerListPanel.SetActive(false);
			}
			DeactivatePlayerInput();
			GameObject navBar = _navBar;
			if ((Object)(object)navBar != (Object)null)
			{
				navBar.SetActive(true);
			}
			GameObject castleRoot = _castleRoot;
			if ((Object)(object)castleRoot != (Object)null)
			{
				castleRoot.SetActive(true);
			}
			IReadOnlyList<DuskCastleService.CastleEntry> visible = DuskCastleService.Visible;
			int count = visible.Count;
			int val = Math.Max(0, (count - 1) / 4);
			_page = Math.Min(_page, val);
			int num = _page * 4;
			int num2 = Math.Min(4, Math.Max(0, count - num));
			if ((Object)_titleLabel != (Object)null)
			{
				string text = (DuskCastleService.Awaiting ? L10n.LoadingSuffix : string.Empty);
				((TMP_Text)_titleLabel).SetText("FAiTP - " + L10n.TabCastle + text, true);
			}
			if ((Object)_pageLabel != (Object)null)
			{
				if (count > 0)
				{
					((TMP_Text)_pageLabel).SetText("<color=#D8C9C0>" + L10n.PageRange(L10n.TabCastle, num + 1, num + num2, count) + "</color>", true);
				}
				else if (DuskCastleService.Awaiting)
				{
					((TMP_Text)_pageLabel).SetText("<color=#D8C9C0>" + L10n.LoadingLabel(L10n.TabCastle) + "...</color>", true);
				}
				else
				{
					((TMP_Text)_pageLabel).SetText("<color=#D8C9C0>" + L10n.CastleEmpty + "</color>", true);
				}
			}
			if ((Object)_castleHint != (Object)null)
			{
				string text2 = ((DuskCastleService.Target >= 0) ? L10n.CastleSelectedHint(DuskCastleService.Target) : L10n.CastleHint);
				((TMP_Text)_castleHint).SetText(text2, true);
			}
			for (int i = 0; i < _castleCards.Count; i++)
			{
				int num3 = num + i;
				if (num3 < count)
				{
					_castleCards[i].Update(visible[num3], OnCastleClicked);
					_castleCards[i].SetVisible(visible: true);
				}
				else
				{
					_castleCards[i].SetVisible(visible: false);
				}
			}
		}

		private static void OnCastleClicked(int plot)
		{
			if (plot >= 0)
			{
				bool flag = plot == DuskCastleService.Target;
				CommandSender.Send(flag ? ".dusk pick -1" : (".dusk pick " + plot));
				Core.Log.LogInfo((object)("[FAiTP][UI] Dusk castle " + (flag ? "selection cleared." : ("selected: " + plot + "."))));
				_nextCastleRefresh = Time.realtimeSinceStartup + 0.6f;
			}
		}

		private static void BuildRoster()
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Expected O, but got Unknown
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Expected O, but got Unknown
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Expected O, but got Unknown
			_rosterRoot = MakeChild("Roster", _panel.transform);
			Stretch(_rosterRoot, 8f, 8f, 62f, 74f);
			GameObject obj = MakeChild("RosterHint", _rosterRoot.transform);
			_rosterHint = obj.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_rosterHint).fontSize = 9f;
			((TMP_Text)_rosterHint).alignment = (TextAlignmentOptions)513;
			((TMP_Text)_rosterHint).enableWordWrapping = false;
			((TMP_Text)_rosterHint).text = L10n.RosterHint;
			ThemeBinder.Bind((Graphic)(object)_rosterHint, () => TextSecondary);
			((Graphic)_rosterHint).raycastTarget = false;
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 0f);
			component.offsetMin = new Vector2(0f, 0f);
			component.offsetMax = new Vector2(0f, 16f);
			GameObject val = MakeChild("RosterRows", _rosterRoot.transform);
			Stretch(val, 0f, 0f, 18f, 0f);
			_rosterRowTexts.Clear();
			_rosterRowButtons.Clear();
			for (int num = 0; num < 5; num++)
			{
				GameObject val2 = MakeChild($"RosterRow_{num}", val.transform);
				RectTransform component2 = val2.GetComponent<RectTransform>();
				component2.anchorMin = new Vector2(0f, 1f);
				component2.anchorMax = new Vector2(1f, 1f);
				component2.pivot = new Vector2(0.5f, 1f);
				component2.anchoredPosition = new Vector2(0f, 0f - (float)num * 27f);
				component2.sizeDelta = new Vector2(0f, 24f);
				Image val3 = val2.AddComponent<Image>();
				ThemeBinder.Bind((Graphic)(object)val3, () => CardBg);
				TextMeshProUGUI val4 = MakeChild($"RosterRowTxt_{num}", val2.transform).AddComponent<TextMeshProUGUI>();
				((TMP_Text)val4).fontSize = 11f;
				((TMP_Text)val4).alignment = (TextAlignmentOptions)513;
				((TMP_Text)val4).enableWordWrapping = false;
				ThemeBinder.Bind((Graphic)(object)val4, () => TextPrimary);
				((Graphic)val4).raycastTarget = false;
				RectTransform component3 = ((Component)val4).gameObject.GetComponent<RectTransform>();
				component3.anchorMin = Vector2.zero;
				component3.anchorMax = Vector2.one;
				component3.offsetMin = new Vector2(8f, 0f);
				component3.offsetMax = new Vector2(-6f, 0f);
				Button val5 = val2.AddComponent<Button>();
				((Selectable)val5).targetGraphic = (Graphic)val3;
				StyleButton(val5, (Graphic)val3);
				int captured = num;
				ClickService.Register(component2, (Graphic)val3, $"RosterRow_{num}", delegate
				{
					OnRosterRowClicked(captured);
				});
				_rosterRowTexts.Add(val4);
				_rosterRowButtons.Add(val5);
			}
			_rosterRoot.SetActive(false);
		}

		private static void BuildPlayerForm()
		{
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Expected O, but got Unknown
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Expected O, but got Unknown
			_playerForm = MakeChild("PlayerForm", _panel.transform);
			Stretch(_playerForm, 12f, 12f, 66f, 78f);
			Image obj = _playerForm.AddComponent<Image>();
			UiSkin.ApplyLarge(obj);
			ThemeBinder.Bind((Graphic)(object)obj, () => PlayerBg);
			GameObject obj2 = MakeChild("PlayerPrompt", _playerForm.transform);
			TextMeshProUGUI obj3 = obj2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj3).text = L10n.EnterPlayerName;
			((TMP_Text)obj3).fontSize = 12f;
			((TMP_Text)obj3).alignment = (TextAlignmentOptions)513;
			((TMP_Text)obj3).enableWordWrapping = false;
			Frac(obj2, 0.05f, 0.78f, 0.95f, 0.95f);
			GameObject val = MakeChild("PlayerInput", _playerForm.transform);
			Image obj4 = val.AddComponent<Image>();
			UiSkin.ApplySmall(obj4);
			ThemeBinder.Bind((Graphic)(object)obj4, () => 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 obj5 = MakeChild("Placeholder", val2.transform);
			TextMeshProUGUI val3 = obj5.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = L10n.PlayerNameLabel;
			((TMP_Text)val3).fontSize = 12f;
			((TMP_Text)val3).alignment = (TextAlignmentOptions)513;
			((TMP_Text)val3).enableWordWrapping = false;
			ThemeBinder.Bind((Graphic)(object)val3, () => TextMuted);
			FillParent(obj5);
			GameObject obj6 = MakeChild("Text", val2.transform);
			TextMeshProUGUI val4 = obj6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val4).text = string.Empty;
			((TMP_Text)val4).fontSize = 12f;
			((TMP_Text)val4).alignment = (TextAlignmentOptions)513;
			((TMP_Text)val4).enableWordWrapping = false;
			ThemeBinder.Bind((Graphic)(object)val4, () => TextPrimary);
			FillParent(obj6);
			_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 obj7 = BuildTextButton(_playerForm.transform, "PlayerTeleportBtn", L10n.RequestBtn, 0.05f, 0.46f, delegate
			{
				OnPlayerTeleportClicked();
			});
			Frac(obj7, 0.05f, 0.28f, 0.46f, 0.48f);
			ThemeBinder.Bind((Graphic)(object)obj7.GetComponent<Image>(), () => ButtonBg);
			GameObject obj8 = BuildTextButton(_playerForm.transform, "PlayerAskBtn", L10n.AcceptFormBtn, 0.54f, 0.95f, delegate
			{
				OnAskToTpClicked();
			});
			Frac(obj8, 0.54f, 0.28f, 0.95f, 0.48f);
			ThemeBinder.Bind((Graphic)(object)obj8.GetComponent<Image>(), () => ButtonBg);
			GameObject obj9 = MakeChild("PlayerHint", _playerForm.transform);
			_playerHintLabel = obj9.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_playerHintLabel).text = L10n.PlayerHint;
			((TMP_Text)_playerHintLabel).fontSize = 10f;
			((TMP_Text)_playerHintLabel).alignment = (TextAlignmentOptions)257;
			((TMP_Text)_playerHintLabel).enableWordWrapping = true;
			ThemeBinder.Bind((Graphic)(object)_playerHintLabel, () => TextSecondary);
			Frac(obj9, 0.05f, 0.05f, 0.5f, 0.24f);
			_playerForm.SetActive(false);
		}

		private static void BuildSetPointForm()
		{
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Expected O, but got Unknown
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Expected O, but got Unknown
			_setPointForm = MakeChild("SetPointForm", _panel.transform);
			Stretch(_setPointForm, 12f, 12f, 66f, 78f);
			Image obj = _setPointForm.AddComponent<Image>();
			UiSkin.ApplyLarge(obj);
			ThemeBinder.Bind((Graphic)(object)obj, () => PlayerBg);
			GameObject obj2 = MakeChild("SetPointPrompt", _setPointForm.transform);
			TextMeshProUGUI obj3 = obj2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj3).text = L10n.SetPointPrompt;
			((TMP_Text)obj3).fontSize = 12f;
			((TMP_Text)obj3).alignment = (TextAlignmentOptions)513;
			((TMP_Text)obj3).enableWordWrapping = false;
			Frac(obj2, 0.05f, 0.78f, 0.95f, 0.95f);
			GameObject val = MakeChild("PointInput", _setPointForm.transform);
			Image obj4 = val.AddComponent<Image>();
			UiSkin.ApplySmall(obj4);
			ThemeBinder.Bind((Graphic)(object)obj4, () => InputBg);
			Frac(val, 0.05f, 0.56f, 0.95f, 0.76f);
			_pointInputRoot = val.GetComponent<RectTransform>();
			GameObject val2 = MakeChild("TextArea", val.transform);
			Stretch(val2, 10f, 10f, 4f, 4f);
			GameObject obj5 = MakeChild("Placeholder", val2.transform);
			TextMeshProUGUI val3 = obj5.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = L10n.SetPointPlaceholder;
			((TMP_Text)val3).fontSize = 12f;
			((TMP_Text)val3).alignment = (TextAlignmentOptions)513;
			((TMP_Text)val3).enableWordWrapping = false;
			ThemeBinder.Bind((Graphic)(object)val3, () => TextMuted);
			FillParent(obj5);
			GameObject obj6 = MakeChild("Text", val2.transform);
			TextMeshProUGUI val4 = obj6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val4).text = string.Empty;
			((TMP_Text)val4).fontSize = 12f;
			((TMP_Text)val4).alignment = (TextAlignmentOptions)513;
			((TMP_Text)val4).enableWordWrapping = false;
			ThemeBinder.Bind((Graphic)(object)val4, () => TextPrimary);
			FillParent(obj6);
			_pointNameField = val.AddComponent<TMP_InputField>();
			_pointNameField.textViewport = val2.GetComponent<RectTransform>();
			_pointNameField.textComponent = (TMP_Text)val4;
			_pointNameField.placeholder = (Graphic)val3;
			_pointNameField.lineType = (LineType)0;
			_pointNameField.contentType = (ContentType)0;
			_pointNameField.characterLimit = 24;
			((Selectable)_pointNameField).targetGraphic = (Graphic)val.GetComponent<Image>();
			GameObject obj7 = BuildTextButton(_setPointForm.transform, "CreatePointBtn", L10n.CreatePointBtn, 0.05f, 0.46f, delegate
			{
				OnCreatePointClicked();
			});
			Frac(obj7, 0.05f, 0.28f, 0.46f, 0.48f);
			ThemeBinder.Bind((Graphic)(object)obj7.GetComponent<Image>(), () => ButtonBg);
			GameObject obj8 = BuildTextButton(_setPointForm.transform, "CancelPointBtn", L10n.CancelBtn, 0.54f, 0.95f, delegate
			{
				OnCancelPointClicked();
			});
			Frac(obj8, 0.54f, 0.28f, 0.95f, 0.48f);
			ThemeBinder.Bind((Graphic)(object)obj8.GetComponent<Image>(), () => ButtonBg);
			GameObject obj9 = MakeChild("SetPointHint", _setPointForm.transform);
			TextMeshProUGUI obj10 = obj9.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj10).text = L10n.SetPointHint;
			((TMP_Text)obj10).fontSize = 10f;
			((TMP_Text)obj10).alignment = (TextAlignmentOptions)257;
			((TMP_Text)obj10).enableWordWrapping = true;
			ThemeBinder.Bind((Graphic)(object)obj10, () => TextSecondary);
			Frac(obj9, 0.05f, 0.05f, 0.95f, 0.24f);
			_setPointForm.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_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: 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)
			_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);
			Image obj2 = _playerListPanel.AddComponent<Image>();
			UiSkin.ApplyLarge(obj2);
			ThemeBinder.Bind((Graphic)(object)obj2, () => PanelBg);
			GameObject val = MakeChild("ListHeader", _playerListPanel.transform);
			UiSkin.ApplyHeader(val.AddComponent<Image>());
			Stretch(val, 0f, 0f, 256f, 0f);
			TextMeshProUGUI obj3 = MakeChild("ListTitle", val.transform).AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj3).text = L10n.PlayersOnline;
			((TMP_Text)obj3).fontSize = 12f;
			((TMP_Text)obj3).alignment = (TextAlignmentOptions)513;
			((TMP_Text)obj3).enableWordWrapping = false;
			Frac(((Component)obj3).gameObject, 0.05f, 0.1f, 0.8f, 0.9f, 4f, 0f, 2f, 2f);
			((Graphic)BuildTextButton(val.transform, "ListCloseBtn", "<", 0.84f, 0.98f, delegate
			{
				OnListPlayersClicked();
			}).GetComponent<Image>()).color = CloseButtonBg;
			UiSkin.AddAccentLine(val.transform, null, 0f, 0f, 1f, 0.1f, 0.95f);
			GameObject val2 = MakeChild("ListRows", _playerListPanel.transform);
			Stretch(val2, 8f, 8f, 58f, 42f);
			_playerListRows.Clear();
			for (int num = 0; num < 10; num++)
			{
				GameObject val3 = MakeChild($"PlayerRow_{num}", 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)num * 17f);
				component.sizeDelta = new Vector2(0f, 15f);
				Image obj4 = val3.AddComponent<Image>();
				UiSkin.ApplySmall(obj4);
				ThemeBinder.Bind((Graphic)(object)obj4, () => CardBg);
				TextMeshProUGUI val4 = MakeChild($"PlayerRowTxt_{num}", val3.transform).AddComponent<TextMeshProUGUI>();
				((TMP_Text)val4).fontSize = 10f;
				((TMP_Text)val4).alignment = (TextAlignmentOptions)513;
				((TMP_Text)val4).enableWordWrapping = false;
				ThemeBinder.Bind((Graphic)(object)val4, () => TextPrimary);
				FillParent(((Component)val4).gameObject);
				_playerListRows.Add(val4);
			}
			GameObject val5 = MakeChild("ListFooter", _playerListPanel.transform);
			Image obj5 = val5.AddComponent<Image>();
			UiSkin.ApplyBottomStrip(obj5);
			ThemeBinder.Bind((Graphic)(object)obj5, () => HeaderBg);
			Stretch(val5, 0f, 0f, 0f, 40f);
			ThemeBinder.Bind((Graphic)(object)BuildTextButton(val5.transform, "ListPrevBtn", L10n.BackBtn, 0.03f, 0.18f, delegate
			{
				OnPlayerListPrevPage();
			}).GetComponent<Image>(), () => ButtonBg);
			GameObject obj6 = MakeChild("ListPageLabel", val5.transform);
			_playerListPageLabel = obj6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_playerListPageLabel).fontSize = 10f;
			((TMP_Text)_playerListPageLabel).alignment = (TextAlignmentOptions)514;
			((TMP_Text)_playerListPageLabel).enableWordWrapping = false;
			ThemeBinder.Bind((Graphic)(object)_playerListPageLabel, () => TextPrimary);
			Frac(obj6, 0.22f, 0.18f, 0.78f, 0.82f);
			ThemeBinder.Bind((Graphic)(object)BuildTextButton(val5.transform, "ListNextBtn", L10n.NextBtn, 0.82f, 0.97f, delegate
			{
				OnPlayerListNextPage();
			}).GetComponent<Image>(), () => ButtonBg);
			UiSkin.AddAccentLine(val5.transform, null, 0f, 0.94f, 1f, 1f, 0.85f);
			val5.transform.SetAsLastSibling();
			GameObject obj7 = MakeChild("WindowStroke", _playerListPanel.transform);
			Stretch(obj7, 0f, 0f, 0f, 0f);
			UiSkin.ApplyWindowStroke(obj7.AddComponent<Image>(), 250, 290);
			_playerListPanel.SetActive(false);
			_playerListOpen = false;
			_playerListPage = 0;
		}

		private static void BuildN