Decompiled source of FehuParty v420.101.21

plugins/FehuParty.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using FehuParty.Core;
using FehuParty.Integrations;
using FehuParty.Map;
using FehuParty.Network;
using FehuParty.Persistence;
using FehuParty.Rewards;
using FehuParty.UI;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Splatform;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
[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 FehuParty
{
	public static class FehuPartyApi
	{
		public static event Action<Party>? OnPartyCreated;

		public static event Action<Party>? OnPartyDisbanded;

		public static event Action<Party, long>? OnPlayerJoinedParty;

		public static event Action<Party, long>? OnPlayerLeftParty;

		public static event Action<Party>? OnLeaderChanged;

		public static Party? GetPartyForPlayer(long steamId)
		{
			Party party;
			if (!((Object)(object)PartyManager.Instance == (Object)null))
			{
				return Copy(PartyManager.Instance.TryGetParty(steamId, out party) ? party : null);
			}
			return null;
		}

		public static Party? GetParty(string partyId)
		{
			if (!((Object)(object)PartyManager.Instance == (Object)null))
			{
				return Copy(PartyManager.Instance.Get(partyId));
			}
			return null;
		}

		public static IReadOnlyList<PartyMember> GetMembers(string partyId)
		{
			return GetParty(partyId)?.Members.Values.Select(Copy).ToArray() ?? Array.Empty<PartyMember>();
		}

		public static bool AreInSameParty(long a, long b)
		{
			return GetPartyForPlayer(a)?.PartyId == GetPartyForPlayer(b)?.PartyId;
		}

		public static bool IsPartyLeader(long steamId)
		{
			Party? partyForPlayer = GetPartyForPlayer(steamId);
			if (partyForPlayer == null)
			{
				return false;
			}
			return partyForPlayer.LeaderSteamId == steamId;
		}

		public static long GetLeader(string partyId)
		{
			return GetParty(partyId)?.LeaderSteamId ?? 0;
		}

		public static int ShareReward(long sourcePlayer, PartyRewardType type, float amount, Vector3 sourcePosition)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return PartyRewardService.Share(sourcePlayer, type, amount, sourcePosition);
		}

		internal static void RaiseCreated(Party p)
		{
			FehuPartyApi.OnPartyCreated?.Invoke(Copy(p));
		}

		internal static void RaiseDisbanded(Party p)
		{
			FehuPartyApi.OnPartyDisbanded?.Invoke(Copy(p));
		}

		internal static void RaiseJoined(Party p, long id)
		{
			FehuPartyApi.OnPlayerJoinedParty?.Invoke(Copy(p), id);
		}

		internal static void RaiseLeft(Party p, long id)
		{
			FehuPartyApi.OnPlayerLeftParty?.Invoke(Copy(p), id);
		}

		internal static void RaiseLeaderChanged(Party p)
		{
			FehuPartyApi.OnLeaderChanged?.Invoke(Copy(p));
		}

		private static Party? Copy(Party? p)
		{
			if (p == null)
			{
				return null;
			}
			Party party = new Party
			{
				PartyId = p.PartyId,
				Name = p.Name,
				LeaderSteamId = p.LeaderSteamId,
				CreatedUtc = p.CreatedUtc,
				Visibility = p.Visibility,
				Purpose = p.Purpose,
				Settings = new PartySettings
				{
					ShowPositions = p.Settings.ShowPositions,
					FriendlyFireProtected = p.Settings.FriendlyFireProtected
				},
				Waypoint = p.Waypoint
			};
			foreach (PartyMember value in p.Members.Values)
			{
				party.Members[value.PlayerId] = Copy(value);
			}
			return party;
		}

		private static PartyMember Copy(PartyMember m)
		{
			return new PartyMember
			{
				PlayerId = m.PlayerId,
				Name = m.Name,
				JoinedUtc = m.JoinedUtc,
				Assistant = m.Assistant
			};
		}
	}
	[BepInPlugin("blackviking.fehuparty", "FehuParty", "420.101.11")]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "blackviking.fehuparty";

		public const string PluginName = "FehuParty";

		public const string PluginVersion = "420.101.11";

		internal static Plugin Instance;

		internal static PartyConfig Settings;

		internal static bool PersistenceInitializationFailed;

		private void Awake()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Settings = new PartyConfig(new ConfigFile(FehuPaths.ConfigFilePath, true));
			((Component)this).gameObject.AddComponent<PartyManager>();
			((Component)this).gameObject.AddComponent<PartyNetwork>();
			((Component)this).gameObject.AddComponent<PartyHud>();
			((Component)this).gameObject.AddComponent<PartyMapService>();
			new Harmony("blackviking.fehuparty").PatchAll();
			Debug("420.101.11 starting; complete server-authoritative Party Hall flow enabled.");
		}

		internal static void Info(string message)
		{
			((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[FehuParty] " + message));
		}

		internal static void Debug(string message)
		{
			if (Settings.DebugLogging.Value)
			{
				((BaseUnityPlugin)Instance).Logger.LogDebug((object)("[FehuParty] " + message));
			}
		}

		internal static void Warning(string message)
		{
			((BaseUnityPlugin)Instance).Logger.LogWarning((object)("[FehuParty] " + message));
		}

		internal static void Error(string message)
		{
			((BaseUnityPlugin)Instance).Logger.LogError((object)("[FehuParty] " + message));
		}
	}
	internal static class FehuPaths
	{
		internal static string ConfigFilePath => Path.Combine(Paths.ConfigPath, "blackviking.fehuparty.cfg");

		internal static string MembershipFilePath => Path.Combine(Paths.ConfigPath, "FehuParty", "PartyMembership.json");
	}
	internal sealed class PartyConfig
	{
		internal readonly ConfigEntry<bool> Enabled;

		internal readonly ConfigEntry<bool> Persist;

		internal readonly ConfigEntry<bool> Browser;

		internal readonly ConfigEntry<bool> HudEnabled;

		internal readonly ConfigEntry<bool> ShowMap;

		internal readonly ConfigEntry<bool> ShowMiniMap;

		internal readonly ConfigEntry<bool> DebugLogging;

		internal readonly ConfigEntry<bool> CrossClan;

		internal readonly ConfigEntry<bool> EnemyClan;

		internal readonly ConfigEntry<int> MaxMembers;

		internal readonly ConfigEntry<int> OfflineRetention;

		internal readonly ConfigEntry<int> EmptyDisband;

		internal readonly ConfigEntry<int> UiLayoutVersion;

		internal readonly ConfigEntry<int> InviteTimeoutSeconds;

		internal readonly ConfigEntry<int> JoinRequestTimeoutSeconds;

		internal readonly ConfigEntry<float> PingCooldown;

		internal readonly ConfigEntry<float> HudScale;

		internal readonly ConfigEntry<float> HudPosX;

		internal readonly ConfigEntry<float> HudPosY;

		internal readonly ConfigEntry<float> LauncherPosX;

		internal readonly ConfigEntry<float> LauncherPosY;

		internal readonly ConfigEntry<float> HudNormalizedX;

		internal readonly ConfigEntry<float> HudNormalizedY;

		internal readonly ConfigEntry<float> PartyButtonNormalizedX;

		internal readonly ConfigEntry<float> PartyButtonNormalizedY;

		internal readonly ConfigEntry<bool> ShowDistance;

		internal readonly ConfigEntry<bool> ShowHp;

		internal readonly ConfigEntry<bool> ShowClanTag;

		internal readonly ConfigEntry<bool> ShowPins;

		internal readonly ConfigEntry<bool> ShowPings;

		internal readonly ConfigEntry<bool> PartyButtonAttachedToMinimap;

		internal readonly ConfigEntry<bool> PartyPanelDefaultBelowMinimap;

		internal readonly ConfigEntry<bool> HudPositionSaved;

		internal readonly ConfigEntry<bool> PartyButtonPositionSaved;

		internal readonly ConfigEntry<bool> MembersCanInvite;

		internal readonly ConfigEntry<string> PartyWindowHotkey;

		internal KeyCode ParsedPartyHotkey => ParseKey(PartyWindowHotkey?.Value);

		internal PartyConfig(ConfigFile c)
		{
			Enabled = c.Bind<bool>("General", "Enabled", true, (ConfigDescription)null);
			DebugLogging = c.Bind<bool>("General", "DebugLogging", false, (ConfigDescription)null);
			MaxMembers = c.Bind<int>("Party", "PartyMaxMembers", 0, (ConfigDescription)null);
			Persist = c.Bind<bool>("Party", "PersistPartyMembership", true, (ConfigDescription)null);
			OfflineRetention = c.Bind<int>("Party", "PartyOfflineRetentionMinutes", 60, (ConfigDescription)null);
			EmptyDisband = c.Bind<int>("Party", "DisbandEmptyPartyMinutes", 15, (ConfigDescription)null);
			MembersCanInvite = c.Bind<bool>("Party", "MembersCanInvite", false, "Allow regular party members to invite online players. The server always validates this permission.");
			InviteTimeoutSeconds = c.Bind<int>("Party", "InviteTimeoutSeconds", 30, "Seconds before a pending party invitation expires.");
			JoinRequestTimeoutSeconds = c.Bind<int>("Party", "JoinRequestTimeoutSeconds", 60, "Seconds before a pending request to join expires.");
			Browser = c.Bind<bool>("Browser", "EnablePartyBrowser", true, (ConfigDescription)null);
			ShowMap = c.Bind<bool>("Map", "ShowPartyMembersOnMap", true, (ConfigDescription)null);
			ShowMiniMap = c.Bind<bool>("Map", "ShowPartyMembersOnMinimap", true, (ConfigDescription)null);
			PingCooldown = c.Bind<float>("Map", "PartyPingCooldownSeconds", 3f, (ConfigDescription)null);
			CrossClan = c.Bind<bool>("FCW", "AllowCrossClanParty", true, (ConfigDescription)null);
			EnemyClan = c.Bind<bool>("FCW", "AllowEnemyClanParty", true, (ConfigDescription)null);
			HudEnabled = c.Bind<bool>("UI", "EnablePartyHUD", true, (ConfigDescription)null);
			HudScale = c.Bind<float>("UI", "HUDScale", 1f, (ConfigDescription)null);
			HudPosX = c.Bind<float>("UI", "HUDPosX", 30f, (ConfigDescription)null);
			HudPosY = c.Bind<float>("UI", "HUDPosY", -180f, (ConfigDescription)null);
			HudNormalizedX = c.Bind<float>("UI", "PartyHudNormalizedX", 0f, "Saved HUD center X as a screen fraction.");
			HudNormalizedY = c.Bind<float>("UI", "PartyHudNormalizedY", 0f, "Saved HUD center Y as a screen fraction.");
			HudPositionSaved = c.Bind<bool>("UI", "PartyHudPositionSaved", false, "Whether Party HUD has a player-saved position.");
			PartyButtonNormalizedX = c.Bind<float>("UI", "PartyButtonNormalizedX", 0f, "Saved PARTY button center X as a screen fraction.");
			PartyButtonNormalizedY = c.Bind<float>("UI", "PartyButtonNormalizedY", 0f, "Saved PARTY button center Y as a screen fraction.");
			PartyButtonPositionSaved = c.Bind<bool>("UI", "PartyButtonPositionSaved", false, "Whether the PARTY button has a player-saved position.");
			PartyButtonAttachedToMinimap = c.Bind<bool>("UI", "PartyButtonAttachedToMinimap", true, "Legacy compatibility value. Reset places the PARTY button above the minimap.");
			PartyPanelDefaultBelowMinimap = c.Bind<bool>("UI", "PartyPanelDefaultBelowMinimap", true, "Place the compact Party HUD below the minimap until moved.");
			LauncherPosX = c.Bind<float>("UI", "PartyLauncherPosX", -24f, "Legacy launcher X value.");
			LauncherPosY = c.Bind<float>("UI", "PartyLauncherPosY", -420f, "Legacy launcher Y value.");
			ShowDistance = c.Bind<bool>("UI", "ShowDistance", true, (ConfigDescription)null);
			ShowHp = c.Bind<bool>("UI", "ShowHP", true, (ConfigDescription)null);
			ShowClanTag = c.Bind<bool>("UI", "ShowClanTag", true, (ConfigDescription)null);
			ShowPins = c.Bind<bool>("UI", "ShowPartyMapPins", true, (ConfigDescription)null);
			ShowPings = c.Bind<bool>("UI", "ShowPartyPings", true, (ConfigDescription)null);
			PartyWindowHotkey = c.Bind<string>("UI", "PartyWindowHotkey", "F2", "Keyboard key used to open and close Party Hall. Invalid values safely fall back to F2.");
			UiLayoutVersion = c.Bind<int>("UI", "PartyUiLayoutVersion", 0, "Internal local UI layout migration marker.");
			if (UiLayoutVersion.Value < 26)
			{
				PartyButtonPositionSaved.Value = false;
				HudPositionSaved.Value = false;
				PartyButtonAttachedToMinimap.Value = true;
				UiLayoutVersion.Value = 26;
			}
			string text = PartyWindowHotkey.Value?.Trim() ?? string.Empty;
			if (!TryParseKey(text, out var _) || string.Equals(text, "R", StringComparison.OrdinalIgnoreCase) || string.Equals(text, "F6", StringComparison.OrdinalIgnoreCase))
			{
				PartyWindowHotkey.Value = "F2";
			}
		}

		internal static KeyCode ParseKey(string? value)
		{
			//IL_0011: 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)
			try
			{
				KeyCode parsed;
				return (KeyCode)((!TryParseKey(value, out parsed)) ? 283 : ((int)parsed));
			}
			catch
			{
			}
			return (KeyCode)283;
		}

		private static bool TryParseKey(string? value, out KeyCode parsed)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected I4, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected I4, but got Unknown
			parsed = (KeyCode)283;
			string text = (value ?? string.Empty).Replace(" ", string.Empty).Trim().ToUpperInvariant();
			if (!Enum.TryParse<KeyCode>(text, ignoreCase: true, out KeyCode result))
			{
				return false;
			}
			if (text.Length == 1 && text[0] >= 'A' && text[0] <= 'Z')
			{
				parsed = (KeyCode)(int)result;
				return true;
			}
			if (text.Length >= 2 && text[0] == 'F' && int.TryParse(text.Substring(1), out var result2) && result2 >= 1 && result2 <= 12)
			{
				parsed = (KeyCode)(int)result;
				return true;
			}
			return false;
		}
	}
}
namespace FehuParty.UI
{
	internal sealed class PartyHud : MonoBehaviour
	{
		private enum PartyPage
		{
			Hall,
			Browser,
			InvitePlayers,
			MemberActions
		}

		private static class PartyWindowState
		{
			internal static string BrowserPayload = string.Empty;
		}

		private sealed class CtrlDragGate : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IDragHandler, IPointerUpHandler, IPointerClickHandler
		{
			private float threshold;

			private Action? click;

			private Action<Vector2>? begin;

			private Action<Vector2>? drag;

			private Action? end;

			private bool armed;

			private bool moved;

			private bool suppressClick;

			private Vector2 pressPosition;

			internal void Configure(float movementThreshold, Action? clickAction, Action<Vector2> beginAction, Action<Vector2> dragAction, Action endAction)
			{
				threshold = movementThreshold;
				click = clickAction;
				begin = beginAction;
				drag = dragAction;
				end = endAction;
			}

			public void OnPointerDown(PointerEventData eventData)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: 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)
				if ((int)eventData.button == 0 && ControlHeld())
				{
					armed = true;
					moved = false;
					suppressClick = false;
					pressPosition = eventData.position;
					begin?.Invoke(eventData.position);
				}
			}

			public void OnDrag(PointerEventData eventData)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				if (armed && ControlHeld() && (moved || !(Vector2.Distance(pressPosition, eventData.position) < threshold)))
				{
					moved = true;
					drag?.Invoke(eventData.position);
				}
			}

			public void OnPointerUp(PointerEventData eventData)
			{
				//IL_0009: 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)
				if (armed && (int)eventData.button == 0)
				{
					if (moved)
					{
						drag?.Invoke(eventData.position);
						end?.Invoke();
						suppressClick = true;
					}
					armed = false;
				}
			}

			public void OnPointerClick(PointerEventData eventData)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				if ((int)eventData.button == 0)
				{
					if (suppressClick)
					{
						suppressClick = false;
					}
					else if (!ControlHeld())
					{
						click?.Invoke();
					}
				}
			}

			private static bool ControlHeld()
			{
				if (!Input.GetKey((KeyCode)306))
				{
					return Input.GetKey((KeyCode)305);
				}
				return true;
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<TMP_Text, bool> <>9__87_0;

			public static Func<Image, bool> <>9__88_0;

			public static Func<Image, float> <>9__88_1;

			public static Func<PartySnapshot.MemberState, string> <>9__105_0;

			public static UnityAction <>9__116_0;

			public static UnityAction <>9__116_3;

			public static Action<PartyVisibility> <>9__116_1;

			public static UnityAction <>9__118_3;

			internal bool <CaptureNativeTemplates>b__87_0(TMP_Text candidate)
			{
				return (Object)(object)((Component)candidate).GetComponentInParent<Button>() == (Object)null;
			}

			internal bool <LargestImage>b__88_0(Image image)
			{
				if ((Object)(object)image.sprite != (Object)null)
				{
					return (Object)(object)((Component)image).GetComponentInParent<Button>() == (Object)null;
				}
				return false;
			}

			internal float <LargestImage>b__88_1(Image image)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				Rect rect = ((Graphic)image).rectTransform.rect;
				float width = ((Rect)(ref rect)).width;
				rect = ((Graphic)image).rectTransform.rect;
				return Mathf.Abs(width * ((Rect)(ref rect)).height);
			}

			internal string <RefreshHud>b__105_0(PartySnapshot.MemberState member)
			{
				return member.Id + ":" + member.Name + ":" + member.ClanTag + ":" + member.Hp + ":" + member.MaxHp + ":" + member.Distance + ":" + member.Online;
			}

			internal void <BuildActivePartyWindow>b__116_0()
			{
				PartyRpc.Client("FP_Leave");
			}

			internal void <BuildActivePartyWindow>b__116_3()
			{
				PartyRpc.Client("FP_Disband");
			}

			internal void <BuildActivePartyWindow>b__116_1(PartyVisibility mode)
			{
				PartyRpc.Client("FP_SetJoinMode", (int)mode);
			}

			internal void <BuildBrowserWindow>b__118_3()
			{
				PartyRpc.Client("FP_RequestBrowser");
			}
		}

		private const float DragThreshold = 5f;

		private const float MinimapGap = 1f;

		private const float ScreenMargin = 6f;

		private const float DefaultHudNormalizedX = 1f;

		private const float DefaultHudNormalizedY = 0.16f;

		private static readonly Color PartyPanelTint = new Color(0.42f, 0.35f, 0.3f, 0.98f);

		private static PartySnapshot? snapshot;

		private static PartyHud? live;

		private static string pendingInviteName = string.Empty;

		private static string pendingInviterName = string.Empty;

		private static TMP_FontAsset? vanillaFont;

		private static Material? vanillaFontMaterial;

		private static TMP_Text? vanillaTextTemplate;

		private static string? lastOnlinePlayersPayload;

		private static string? lastJoinRequestsPayload;

		private static Color vanillaBodyTextColor = Color.white;

		private static Color vanillaHeadingTextColor = new Color(0.95f, 0.72f, 0.25f);

		internal static string PendingInviteId = string.Empty;

		private GameObject? uiRoot;

		private RectTransform? uiRootRect;

		private GameObject? hud;

		private GameObject? window;

		private GameObject? invite;

		private GameObject? launcher;

		private GameObject? blocker;

		private TMP_InputField? nameInput;

		private TMP_InputField? browserSearchInput;

		private TMP_FontAsset? font;

		private Material? fontMaterial;

		private TMP_FontAsset? headingFont;

		private Material? headingFontMaterial;

		private Button? nativeButtonTemplate;

		private TMP_InputField? nativeInputTemplate;

		private Image? nativeWindowImage;

		private Image? nativeInnerImage;

		private Color bodyTextColor = Color.white;

		private Color headingTextColor = new Color(0.95f, 0.72f, 0.25f);

		private string lastHudContent = string.Empty;

		private bool initialized;

		private bool windowOpen;

		private bool windowContentDirty = true;

		private bool hudDirty = true;

		private bool? lastHudEnabledSetting;

		private bool? lastShowHpSetting;

		private bool? lastShowDistanceSetting;

		private bool? lastShowClanTagSetting;

		private bool launcherPlaced;

		private bool hudPlaced;

		private bool previousCursorVisible;

		private CursorLockMode previousCursorLock;

		private Vector2 launcherDragPointerStart;

		private Vector2 launcherDragScreenStart;

		private Vector2 hudDragPointerStart;

		private Vector2 hudDragScreenStart;

		private int lastScreenWidth;

		private int lastScreenHeight;

		private float nextBrowserRefresh;

		private PartyPage page;

		private PartyVisibility createJoinMode;

		private string draftPartyName = string.Empty;

		private string browserSearch = string.Empty;

		private int browserPageIndex;

		private int invitePageIndex;

		private long selectedMemberId;

		private List<BrowserPartyEntry> browserEntries = new List<BrowserPartyEntry>();

		private List<OnlinePlayerEntry> onlinePlayers = new List<OnlinePlayerEntry>();

		private List<JoinRequestEntry> joinRequestEntries = new List<JoinRequestEntry>();

		internal static PartySnapshot? CurrentSnapshot => snapshot;

		internal static bool IsModalOpen
		{
			get
			{
				if ((Object)(object)live != (Object)null && ((Behaviour)live).isActiveAndEnabled && live.windowOpen && (Object)(object)live.window != (Object)null)
				{
					return live.window.activeInHierarchy;
				}
				return false;
			}
		}

		internal static void SetSnapshot(PartySnapshot? value)
		{
			PartySnapshot partySnapshot = snapshot;
			snapshot = value;
			bool flag = !string.Equals(partySnapshot?.Id, value?.Id, StringComparison.Ordinal) || CanInviteFromSnapshot(partySnapshot) != CanInviteFromSnapshot(value);
			bool flag2 = SnapshotWindowContentChanged(partySnapshot, value);
			bool flag3 = SnapshotInviteRosterChanged(partySnapshot, value);
			if (value == null)
			{
				joinRequestEntriesStaticClear();
			}
			if (!((Object)(object)live == (Object)null))
			{
				live.hudDirty = true;
				if (flag)
				{
					live.page = PartyPage.Hall;
					live.onlinePlayers.Clear();
					lastOnlinePlayersPayload = null;
					live.windowContentDirty = true;
				}
				else if (live.page == PartyPage.Hall && flag2)
				{
					live.windowContentDirty = true;
				}
				else if (live.page == PartyPage.MemberActions && (flag2 || live.SelectedMemberDistanceChanged(partySnapshot, value)))
				{
					live.windowContentDirty = true;
				}
				else if (live.page == PartyPage.InvitePlayers && flag3)
				{
					lastOnlinePlayersPayload = null;
					PartyRpc.Client("FP_RequestOnlinePlayers");
				}
				if (live.windowOpen && live.windowContentDirty && (live.page == PartyPage.Hall || live.page == PartyPage.MemberActions))
				{
					live.BuildWindow();
				}
			}
		}

		private static bool CanInviteFromSnapshot(PartySnapshot? value)
		{
			Player localPlayer = Player.m_localPlayer;
			long num = ((localPlayer != null) ? localPlayer.GetPlayerID() : 0);
			if (value != null && num != 0L)
			{
				if (value.Leader != num)
				{
					return value.MembersCanInvite;
				}
				return true;
			}
			return false;
		}

		private static bool SnapshotWindowContentChanged(PartySnapshot? previous, PartySnapshot? value)
		{
			if (previous == null || value == null)
			{
				return previous != value;
			}
			if (previous.Name != value.Name || previous.Leader != value.Leader || previous.Visibility != value.Visibility || previous.MembersCanInvite != value.MembersCanInvite || previous.Members.Count != value.Members.Count)
			{
				return true;
			}
			foreach (PartySnapshot.MemberState oldMember in previous.Members)
			{
				PartySnapshot.MemberState memberState = value.Members.FirstOrDefault((PartySnapshot.MemberState candidate) => candidate.Id == oldMember.Id);
				if (memberState == null || oldMember.Name != memberState.Name || oldMember.ClanTag != memberState.ClanTag || oldMember.Online != memberState.Online || oldMember.Assistant != memberState.Assistant)
				{
					return true;
				}
			}
			return false;
		}

		private static bool SnapshotInviteRosterChanged(PartySnapshot? previous, PartySnapshot? value)
		{
			if (previous == null || value == null || previous.Members.Count != value.Members.Count)
			{
				return previous != value;
			}
			return previous.Members.Any((PartySnapshot.MemberState oldMember) => !value.Members.Any((PartySnapshot.MemberState member) => member.Id == oldMember.Id && member.Online == oldMember.Online));
		}

		private bool SelectedMemberDistanceChanged(PartySnapshot? previous, PartySnapshot? value)
		{
			if (previous == null || value == null)
			{
				return false;
			}
			PartySnapshot.MemberState memberState = previous.Members.FirstOrDefault((PartySnapshot.MemberState member) => member.Id == selectedMemberId);
			PartySnapshot.MemberState memberState2 = value.Members.FirstOrDefault((PartySnapshot.MemberState member) => member.Id == selectedMemberId);
			if (memberState != null && memberState2 != null)
			{
				return memberState.Distance != memberState2.Distance;
			}
			return false;
		}

		internal static void SetBrowser(string value)
		{
			if (string.Equals(PartyWindowState.BrowserPayload, value, StringComparison.Ordinal))
			{
				return;
			}
			PartyWindowState.BrowserPayload = value;
			if (!((Object)(object)live == (Object)null))
			{
				try
				{
					live.browserEntries = PartyDirectory.DecodeBrowser(value);
				}
				catch (Exception ex)
				{
					Plugin.Warning("Browser snapshot decode failed: " + ex.Message);
					live.browserEntries.Clear();
				}
				Plugin.Info("[Browser] Snapshot received: " + live.browserEntries.Count + " parties");
				live.windowContentDirty = true;
				if (live.windowOpen && live.page == PartyPage.Browser)
				{
					live.BuildWindow();
				}
			}
		}

		internal static void SetOnlinePlayers(string value)
		{
			if (!((Object)(object)live == (Object)null) && !string.Equals(lastOnlinePlayersPayload, value, StringComparison.Ordinal))
			{
				lastOnlinePlayersPayload = value;
				try
				{
					live.onlinePlayers = PartyDirectory.DecodeOnlinePlayers(value);
				}
				catch (Exception ex)
				{
					Plugin.Warning("Online player snapshot decode failed: " + ex.Message);
					live.onlinePlayers.Clear();
				}
				Plugin.Info("[Invite] Online player list received: " + live.onlinePlayers.Count);
				live.windowContentDirty = true;
				if (live.windowOpen && live.page == PartyPage.InvitePlayers)
				{
					live.BuildWindow();
				}
			}
		}

		internal static void SetJoinRequests(string value)
		{
			if (!((Object)(object)live == (Object)null) && !string.Equals(lastJoinRequestsPayload, value, StringComparison.Ordinal))
			{
				lastJoinRequestsPayload = value;
				try
				{
					live.joinRequestEntries = PartyDirectory.DecodeJoinRequests(value);
				}
				catch (Exception ex)
				{
					Plugin.Warning("Join request snapshot decode failed: " + ex.Message);
					live.joinRequestEntries.Clear();
				}
				live.windowContentDirty = true;
				if (live.windowOpen && live.page == PartyPage.Hall)
				{
					live.BuildWindow();
				}
			}
		}

		internal static void ShowNotice(string message)
		{
			if ((Object)(object)MessageHud.instance != (Object)null)
			{
				MessageHud.instance.ShowMessage((MessageType)2, message, 0, (Sprite)null, false, true);
			}
		}

		internal static void ReceiveInvite(string partyId, string inviterName, string partyName)
		{
			PendingInviteId = partyId;
			pendingInviterName = inviterName;
			pendingInviteName = partyName;
		}

		internal static void ReceiveJoinRequest(string playerName, string partyName)
		{
			ShowNotice("[Join Request] " + playerName + " wants to join " + partyName + ".");
		}

		private static void joinRequestEntriesStaticClear()
		{
			lastJoinRequestsPayload = null;
			if ((Object)(object)live != (Object)null)
			{
				live.joinRequestEntries.Clear();
			}
		}

		private void Awake()
		{
			live = this;
		}

		private void Update()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (initialized && ((Object)(object)uiRoot == (Object)null || (Object)(object)Hud.instance == (Object)null))
			{
				ResetUiReferences();
			}
			if (!initialized)
			{
				TryInitialize();
				return;
			}
			EnsureInitialPlacement();
			RecoverAfterResolutionChange();
			MaintainModalInput();
			if (windowOpen && page == PartyPage.Browser && Time.time >= nextBrowserRefresh)
			{
				nextBrowserRefresh = Time.time + 6f;
				PartyRpc.Client("FP_RequestBrowser");
			}
			if (Input.GetKeyDown(Plugin.Settings.ParsedPartyHotkey) && !InputBlocked())
			{
				SetWindow(!windowOpen);
			}
			TrackHudSettings();
			bool flag = (Object)(object)hud != (Object)null && Plugin.Settings.HudEnabled.Value && snapshot != null && !windowOpen;
			if ((Object)(object)hud != (Object)null && hud.activeSelf != flag)
			{
				hud.SetActive(flag);
			}
			if (flag && hudDirty)
			{
				RefreshHud();
			}
			if (!string.IsNullOrEmpty(PendingInviteId) && (Object)(object)invite != (Object)null && !invite.activeSelf)
			{
				ShowInvite();
			}
		}

		private void TrackHudSettings()
		{
			bool value = Plugin.Settings.HudEnabled.Value;
			bool value2 = Plugin.Settings.ShowHp.Value;
			bool value3 = Plugin.Settings.ShowDistance.Value;
			bool value4 = Plugin.Settings.ShowClanTag.Value;
			if (lastHudEnabledSetting != value || lastShowHpSetting != value2 || lastShowDistanceSetting != value3 || lastShowClanTagSetting != value4)
			{
				hudDirty = true;
				lastHudEnabledSetting = value;
				lastShowHpSetting = value2;
				lastShowDistanceSetting = value3;
				lastShowClanTagSetting = value4;
			}
		}

		private void TryInitialize()
		{
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: 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_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Hud.instance == (Object)null) && !((Object)(object)Minimap.instance == (Object)null) && !((Object)(object)Minimap.instance.m_mapImageSmall == (Object)null) && !((Object)(object)InventoryGui.instance == (Object)null) && !((Object)(object)TextInput.instance == (Object)null) && !((Object)(object)EventSystem.current == (Object)null) && TryGetMinimapBounds(out var _))
			{
				CaptureNativeTemplates();
				if (!((Object)(object)font == (Object)null) && !((Object)(object)vanillaTextTemplate == (Object)null) && !((Object)(object)nativeButtonTemplate == (Object)null) && !((Object)(object)nativeInputTemplate == (Object)null) && !((Object)(object)nativeWindowImage == (Object)null))
				{
					uiRoot = new GameObject("FehuParty Native UI", new Type[4]
					{
						typeof(RectTransform),
						typeof(Canvas),
						typeof(CanvasScaler),
						typeof(GraphicRaycaster)
					});
					uiRoot.transform.SetParent(((Component)Hud.instance).transform, false);
					uiRootRect = uiRoot.GetComponent<RectTransform>();
					Canvas component = uiRoot.GetComponent<Canvas>();
					component.renderMode = (RenderMode)0;
					component.overrideSorting = true;
					component.sortingOrder = 10000;
					CanvasScaler component2 = uiRoot.GetComponent<CanvasScaler>();
					component2.uiScaleMode = (ScaleMode)0;
					component2.scaleFactor = 1f;
					blocker = ((Component)MakeImage(uiRoot.transform, "PartyModalBlocker", Vector2.zero, Vector2.zero, new Color(0f, 0f, 0f, 0.01f), nativeInnerStyle: false)).gameObject;
					RectTransform obj = Rect(blocker);
					obj.anchorMin = Vector2.zero;
					obj.anchorMax = Vector2.one;
					obj.offsetMin = Vector2.zero;
					obj.offsetMax = Vector2.zero;
					((Graphic)blocker.GetComponent<Image>()).raycastTarget = true;
					blocker.SetActive(false);
					launcher = ((Component)NativeButton(uiRoot.transform, "PARTY", Vector2.zero, new Vector2(87f, 27f))).gameObject;
					((Object)launcher).name = "FehuParty PARTY Button";
					launcher.AddComponent<CtrlDragGate>().Configure(5f, ToggleFromLauncher, BeginLauncherDrag, DragLauncher, EndLauncherDrag);
					hud = Panel("FehuParty Compact HUD", uiRoot.transform, new Vector2(286f, 82f), topLeft: false);
					hud.AddComponent<CtrlDragGate>().Configure(5f, null, BeginHudDrag, DragHud, EndHudDrag);
					window = Panel("FehuParty Hall", uiRoot.transform, new Vector2(820f, 540f), topLeft: false);
					window.SetActive(false);
					invite = Panel("FehuParty Invitation", uiRoot.transform, new Vector2(430f, 190f), topLeft: false);
					invite.SetActive(false);
					initialized = true;
					lastScreenWidth = Screen.width;
					lastScreenHeight = Screen.height;
					EnsureInitialPlacement();
					Plugin.Debug("[UI] Native templates resolved: window=" + HierarchyPath(((Component)nativeWindowImage).transform) + "; button=" + HierarchyPath(((Component)nativeButtonTemplate).transform) + "; input=" + HierarchyPath(((Component)nativeInputTemplate).transform) + "; minimap=Minimap.m_mapImageSmall.");
				}
			}
		}

		private void CaptureNativeTemplates()
		{
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			nativeButtonTemplate = InventoryGui.instance.m_takeAllButton ?? InventoryGui.instance.m_craftButton ?? InventoryGui.instance.m_dropButton;
			nativeInputTemplate = (TMP_InputField?)(object)TextInput.instance.m_inputField;
			Transform inventoryRoot = InventoryGui.instance.m_inventoryRoot;
			nativeWindowImage = LargestImage(((Object)(object)inventoryRoot == (Object)null) ? null : ((Component)inventoryRoot).gameObject);
			nativeInnerImage = LargestImage(TextInput.instance.m_panel) ?? nativeWindowImage;
			if ((Object)(object)vanillaTextTemplate == (Object)null)
			{
				TMP_Text val = InventoryGui.instance.m_craftingStationName;
				if (val == null)
				{
					val = (((Object)(object)nativeButtonTemplate == (Object)null) ? null : ((Component)nativeButtonTemplate).GetComponentInChildren<TMP_Text>(true));
				}
				TMP_Text val2 = InventoryGui.instance.m_recipeDecription;
				if (val2 == null)
				{
					val2 = InventoryGui.instance.m_weight;
				}
				if (val2 == null)
				{
					val2 = (((Object)(object)inventoryRoot == (Object)null) ? null : ((IEnumerable<TMP_Text>)((Component)inventoryRoot).GetComponentsInChildren<TMP_Text>(true)).FirstOrDefault((Func<TMP_Text, bool>)((TMP_Text candidate) => (Object)(object)((Component)candidate).GetComponentInParent<Button>() == (Object)null)));
				}
				TMP_Text val3 = (((Object)(object)((val2 != null) ? val2.font : null) != (Object)null) ? val2 : val);
				if ((Object)(object)val3 != (Object)null && (Object)(object)val3.font != (Object)null)
				{
					vanillaTextTemplate = val3;
					vanillaFont = val3.font;
					vanillaFontMaterial = val3.fontSharedMaterial;
					vanillaBodyTextColor = ((val2 != null) ? ((Graphic)val2).color : Color.white);
					vanillaHeadingTextColor = (Color)((val != null) ? ((Graphic)val).color : new Color(0.95f, 0.72f, 0.25f));
				}
			}
			font = vanillaFont;
			fontMaterial = vanillaFontMaterial;
			headingFont = vanillaFont;
			headingFontMaterial = vanillaFontMaterial;
			bodyTextColor = vanillaBodyTextColor;
			headingTextColor = vanillaHeadingTextColor;
		}

		private static Image? LargestImage(GameObject? root)
		{
			if ((Object)(object)root == (Object)null)
			{
				return null;
			}
			return (from image in root.GetComponentsInChildren<Image>(true)
				where (Object)(object)image.sprite != (Object)null && (Object)(object)((Component)image).GetComponentInParent<Button>() == (Object)null
				select image).OrderByDescending(delegate(Image image)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				Rect rect = ((Graphic)image).rectTransform.rect;
				float width = ((Rect)(ref rect)).width;
				rect = ((Graphic)image).rectTransform.rect;
				return Mathf.Abs(width * ((Rect)(ref rect)).height);
			}).FirstOrDefault();
		}

		private void EnsureInitialPlacement()
		{
			//IL_00b1: 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_0078: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)launcher == (Object)null || (Object)(object)hud == (Object)null || !TryGetMinimapBounds(out var bounds))
			{
				return;
			}
			if (!launcherPlaced)
			{
				RectTransform val = Rect(launcher);
				? val2;
				if (!Plugin.Settings.PartyButtonPositionSaved.Value)
				{
					float xMin = ((Rect)(ref bounds)).xMin;
					Rect rect = val.rect;
					float num = xMin + ((Rect)(ref rect)).width * 0.5f;
					float num2 = ((Rect)(ref bounds)).yMax + 1f;
					rect = val.rect;
					val2 = new Vector2(num, num2 + ((Rect)(ref rect)).height * 0.5f);
				}
				else
				{
					val2 = SavedScreenPoint(Plugin.Settings.PartyButtonNormalizedX.Value, Plugin.Settings.PartyButtonNormalizedY.Value);
				}
				Vector2 screenPoint = (Vector2)val2;
				SetScreenCenter(val, screenPoint);
				ClampToScreen(val);
				launcherPlaced = true;
			}
			if (!hudPlaced)
			{
				RectTransform target = Rect(hud);
				Vector2 screenPoint2 = (Plugin.Settings.HudPositionSaved.Value ? SavedScreenPoint(Plugin.Settings.HudNormalizedX.Value, Plugin.Settings.HudNormalizedY.Value) : SavedScreenPoint(1f, 0.16f));
				SetScreenCenter(target, screenPoint2);
				ClampToScreen(target);
				hudPlaced = true;
			}
		}

		private static Vector2 SavedScreenPoint(float normalizedX, float normalizedY)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return new Vector2(Mathf.Clamp01(normalizedX) * (float)Screen.width, Mathf.Clamp01(normalizedY) * (float)Screen.height);
		}

		private static bool TryGetMinimapBounds(out Rect bounds)
		{
			//IL_0001: 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_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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			bounds = default(Rect);
			Minimap instance = Minimap.instance;
			object obj;
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				RawImage mapImageSmall = instance.m_mapImageSmall;
				obj = ((mapImageSmall != null) ? ((Graphic)mapImageSmall).rectTransform : null);
			}
			RectTransform val = (RectTransform)obj;
			if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy)
			{
				return false;
			}
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			val.GetWorldCorners(array);
			Canvas componentInParent = ((Component)val).GetComponentInParent<Canvas>();
			Camera obj2 = (((Object)(object)componentInParent != (Object)null && (int)componentInParent.renderMode != 0) ? componentInParent.worldCamera : null);
			Vector2 val2 = RectTransformUtility.WorldToScreenPoint(obj2, array[0]);
			Vector2 val3 = RectTransformUtility.WorldToScreenPoint(obj2, array[2]);
			if (val3.x <= val2.x || val3.y <= val2.y)
			{
				return false;
			}
			bounds = Rect.MinMaxRect(val2.x, val2.y, val3.x, val3.y);
			return true;
		}

		private void SetScreenCenter(RectTransform target, Vector2 screenPoint)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)uiRootRect == (Object)null))
			{
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(0.5f, 0.5f);
				target.anchorMax = val;
				target.anchorMin = val;
				target.pivot = new Vector2(0.5f, 0.5f);
				Vector2 anchoredPosition = default(Vector2);
				if (RectTransformUtility.ScreenPointToLocalPointInRectangle(uiRootRect, screenPoint, (Camera)null, ref anchoredPosition))
				{
					target.anchoredPosition = anchoredPosition;
				}
			}
		}

		private static Vector2 GetScreenCenter(RectTransform target)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return RectTransformUtility.WorldToScreenPoint((Camera)null, ((Transform)target).position);
		}

		private void ClampToScreen(RectTransform target)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			Vector2 screenCenter = GetScreenCenter(target);
			Rect rect = target.rect;
			float num = ((Rect)(ref rect)).width * 0.5f;
			rect = target.rect;
			float num2 = ((Rect)(ref rect)).height * 0.5f;
			screenCenter.x = Mathf.Clamp(screenCenter.x, num + 6f, Mathf.Max(num + 6f, (float)Screen.width - num - 6f));
			screenCenter.y = Mathf.Clamp(screenCenter.y, num2 + 6f, Mathf.Max(num2 + 6f, (float)Screen.height - num2 - 6f));
			SetScreenCenter(target, screenCenter);
		}

		private void RecoverAfterResolutionChange()
		{
			if (lastScreenWidth != Screen.width || lastScreenHeight != Screen.height)
			{
				lastScreenWidth = Screen.width;
				lastScreenHeight = Screen.height;
				launcherPlaced = false;
				hudPlaced = false;
				EnsureInitialPlacement();
				if ((Object)(object)launcher != (Object)null)
				{
					ClampToScreen(Rect(launcher));
				}
				if ((Object)(object)hud != (Object)null)
				{
					ClampToScreen(Rect(hud));
				}
			}
		}

		private void ToggleFromLauncher()
		{
			if (!InputBlocked())
			{
				SetWindow(!windowOpen);
			}
		}

		private void BeginLauncherDrag(Vector2 pointer)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (!((Object)(object)launcher == (Object)null))
			{
				launcherDragPointerStart = pointer;
				launcherDragScreenStart = GetScreenCenter(Rect(launcher));
			}
		}

		private void DragLauncher(Vector2 pointer)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)launcher == (Object)null))
			{
				SetScreenCenter(Rect(launcher), launcherDragScreenStart + pointer - launcherDragPointerStart);
				ClampToScreen(Rect(launcher));
			}
		}

		private void EndLauncherDrag()
		{
			if (!((Object)(object)launcher == (Object)null))
			{
				ClampToScreen(Rect(launcher));
				SavePosition(Rect(launcher), Plugin.Settings.PartyButtonNormalizedX, Plugin.Settings.PartyButtonNormalizedY);
				Plugin.Settings.PartyButtonPositionSaved.Value = true;
				Plugin.Settings.PartyButtonAttachedToMinimap.Value = false;
			}
		}

		private void BeginHudDrag(Vector2 pointer)
		{
			//IL_0018: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)hud == (Object)null) && !windowOpen)
			{
				hudDragPointerStart = pointer;
				hudDragScreenStart = GetScreenCenter(Rect(hud));
			}
		}

		private void DragHud(Vector2 pointer)
		{
			//IL_0024: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)hud == (Object)null) && !windowOpen)
			{
				SetScreenCenter(Rect(hud), hudDragScreenStart + pointer - hudDragPointerStart);
				ClampToScreen(Rect(hud));
			}
		}

		private void EndHudDrag()
		{
			if (!((Object)(object)hud == (Object)null) && !windowOpen)
			{
				ClampToScreen(Rect(hud));
				SavePosition(Rect(hud), Plugin.Settings.HudNormalizedX, Plugin.Settings.HudNormalizedY);
				Plugin.Settings.HudPositionSaved.Value = true;
			}
		}

		private static void SavePosition(RectTransform target, ConfigEntry<float> x, ConfigEntry<float> y)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			Vector2 screenCenter = GetScreenCenter(target);
			x.Value = ((Screen.width > 0) ? (screenCenter.x / (float)Screen.width) : 0.5f);
			y.Value = ((Screen.height > 0) ? (screenCenter.y / (float)Screen.height) : 0.5f);
		}

		private static bool InputBlocked()
		{
			if ((Object)(object)Chat.instance != (Object)null && (Chat.instance.HasFocus() || Chat.instance.IsChatDialogWindowVisible()))
			{
				return true;
			}
			if ((Object)(object)TextInput.instance != (Object)null && TextInput.IsVisible())
			{
				return true;
			}
			if ((Object)(object)Console.instance != (Object)null && Console.IsVisible())
			{
				return true;
			}
			if ((Object)(object)Minimap.instance != (Object)null && Minimap.InTextInput())
			{
				return true;
			}
			EventSystem current = EventSystem.current;
			GameObject val = ((current != null) ? current.currentSelectedGameObject : null);
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			TMP_InputField componentInParent = val.GetComponentInParent<TMP_InputField>();
			if ((Object)(object)componentInParent != (Object)null && (componentInParent.isFocused || (Object)(object)((Component)componentInParent).gameObject == (Object)(object)val || val.transform.IsChildOf(((Component)componentInParent).transform)))
			{
				return true;
			}
			InputField componentInParent2 = val.GetComponentInParent<InputField>();
			if ((Object)(object)componentInParent2 != (Object)null)
			{
				if (!componentInParent2.isFocused && !((Object)(object)((Component)componentInParent2).gameObject == (Object)(object)val))
				{
					return val.transform.IsChildOf(((Component)componentInParent2).transform);
				}
				return true;
			}
			return false;
		}

		private void RefreshHud()
		{
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)hud == (Object)null || snapshot == null)
			{
				return;
			}
			string text = snapshot.Name + "|" + snapshot.Leader + "|" + Plugin.Settings.ShowHp.Value + "|" + Plugin.Settings.ShowDistance.Value + "|" + Plugin.Settings.ShowClanTag.Value + "|" + string.Join("|", snapshot.Members.Select((PartySnapshot.MemberState member) => member.Id + ":" + member.Name + ":" + member.ClanTag + ":" + member.Hp + ":" + member.MaxHp + ":" + member.Distance + ":" + member.Online));
			if (text == lastHudContent)
			{
				hudDirty = false;
				return;
			}
			lastHudContent = text;
			Clear(hud);
			float num = Mathf.Clamp(44f + (float)snapshot.Members.Count * 42f, 82f, 420f);
			Rect(hud).sizeDelta = new Vector2(286f, num);
			Text(hud.transform, "PARTY  " + snapshot.Name + "  [" + snapshot.Members.Count + "]", new Vector2(12f, -9f), new Vector2(262f, 24f), 15f, gold: true, (TextAlignmentOptions)257);
			float num2 = -39f;
			foreach (PartySnapshot.MemberState member in snapshot.Members)
			{
				string text2 = ((member.Id == snapshot.Leader) ? "◆ " : string.Empty) + member.Name;
				if (Plugin.Settings.ShowClanTag.Value && !string.IsNullOrEmpty(member.ClanTag))
				{
					text2 = text2 + " [" + member.ClanTag + "]";
				}
				Text(hud.transform, text2, new Vector2(12f, num2), new Vector2(174f, 20f), 13f, gold: false, (TextAlignmentOptions)257);
				if (Plugin.Settings.ShowHp.Value)
				{
					MakeImage(hud.transform, "HP Back", new Vector2(168f, 7f), new Vector2(12f, num2 - 22f), new Color(0.05f, 0.035f, 0.02f, 0.95f), nativeInnerStyle: false);
					MakeImage(hud.transform, "HP", new Vector2(168f * Mathf.Clamp01((member.MaxHp > 0f) ? (member.Hp / member.MaxHp) : 0f), 7f), new Vector2(12f, num2 - 22f), new Color(0.55f, 0.12f, 0.1f, 1f), nativeInnerStyle: false);
				}
				if (Plugin.Settings.ShowDistance.Value)
				{
					Text(hud.transform, member.Online ? (Mathf.RoundToInt(member.Distance) + " m") : "OFFLINE", new Vector2(194f, num2), new Vector2(78f, 22f), 11f, gold: false, (TextAlignmentOptions)260);
				}
				num2 -= 42f;
			}
			ClampToScreen(Rect(hud));
			hudDirty = false;
		}

		private void ResetPartyButtonPosition()
		{
			Plugin.Settings.PartyButtonPositionSaved.Value = false;
			Plugin.Settings.PartyButtonAttachedToMinimap.Value = true;
			launcherPlaced = false;
			EnsureInitialPlacement();
		}

		private void ResetCompactHudPosition()
		{
			Plugin.Settings.HudPositionSaved.Value = false;
			hudPlaced = false;
			EnsureInitialPlacement();
		}

		private void ResetPartyUiPositions()
		{
			ResetPartyButtonPosition();
			ResetCompactHudPosition();
			ShowNotice("Party controls reset around the minimap.");
		}

		private void MaintainModalInput()
		{
			if (IsModalOpen)
			{
				ZCursor.LockState = (CursorLockMode)0;
				ZCursor.Show();
			}
		}

		private void SetWindow(bool value)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)window == (Object)null || value == windowOpen)
			{
				return;
			}
			windowOpen = value;
			window.SetActive(value);
			if ((Object)(object)blocker != (Object)null)
			{
				blocker.SetActive(value);
			}
			if (value)
			{
				if (page != PartyPage.Hall)
				{
					windowContentDirty = true;
				}
				page = PartyPage.Hall;
				GameObject? obj = blocker;
				if (obj != null)
				{
					obj.transform.SetAsLastSibling();
				}
				window.transform.SetAsLastSibling();
				previousCursorVisible = ZCursor.IsRequested;
				previousCursorLock = ZCursor.LockState;
				MaintainModalInput();
				if (windowContentDirty)
				{
					BuildWindow();
				}
			}
			else
			{
				RestoreModalInput();
				EventSystem current = EventSystem.current;
				if (current != null)
				{
					current.SetSelectedGameObject((GameObject)null);
				}
			}
		}

		private void OnDisable()
		{
			if (windowOpen)
			{
				SetWindow(value: false);
			}
		}

		private void ResetUiReferences()
		{
			bool num = windowOpen;
			windowOpen = false;
			if (num)
			{
				RestoreModalInput();
			}
			initialized = false;
			windowContentDirty = true;
			hudDirty = true;
			lastHudContent = string.Empty;
			windowOpen = false;
			uiRoot = null;
			uiRootRect = null;
			hud = null;
			window = null;
			invite = null;
			launcher = null;
			blocker = null;
			nameInput = null;
			launcherPlaced = false;
			hudPlaced = false;
		}

		private void RestoreModalInput()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GameCamera.instance != (Object)null)
			{
				GameCamera.instance.UpdateMouseCapture();
				return;
			}
			ZCursor.LockState = previousCursorLock;
			if (previousCursorVisible)
			{
				ZCursor.Show();
			}
			else
			{
				ZCursor.Hide();
			}
		}

		private void BuildWindow()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected O, but got Unknown
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)window == (Object)null)
			{
				return;
			}
			windowContentDirty = false;
			Clear(window);
			nameInput = null;
			browserSearchInput = null;
			((Graphic)MakeImage(window.transform, "Party Hall Header Panel", new Vector2(780f, 54f), new Vector2(20f, -16f), Color.white, nativeInnerStyle: true)).color = PartyPanelTint;
			Text(window.transform, "PARTY HALL", new Vector2(38f, -27f), new Vector2(300f, 32f), 25f, gold: true, (TextAlignmentOptions)257);
			Text(window.transform, "Fear not — the Black Viking spirit stands by your party’s side.", new Vector2(40f, -55f), new Vector2(510f, 20f), 11f, gold: false, (TextAlignmentOptions)257);
			((UnityEvent)NativeButton(window.transform, "RESET BUTTON", new Vector2(570f, -27f), new Vector2(116f, 30f)).onClick).AddListener(new UnityAction(ResetPartyUiPositions));
			((UnityEvent)NativeButton(window.transform, "CLOSE", new Vector2(698f, -27f), new Vector2(94f, 30f)).onClick).AddListener((UnityAction)delegate
			{
				SetWindow(value: false);
			});
			MakeImage(window.transform, "Separator", new Vector2(780f, 2f), new Vector2(20f, -82f), new Color(0.75f, 0.5f, 0.16f, 0.85f), nativeInnerStyle: false);
			if (page == PartyPage.Browser)
			{
				BuildBrowserWindow();
				return;
			}
			if (page == PartyPage.InvitePlayers)
			{
				BuildInvitePlayersWindow();
				return;
			}
			if (page == PartyPage.MemberActions)
			{
				BuildMemberActionsWindow();
				return;
			}
			GameObject val = Panel("Party Hall Main Panel", window.transform, new Vector2(474f, 400f), topLeft: true);
			Rect(val).anchoredPosition = new Vector2(28f, -105f);
			GameObject val2 = Panel("Party Hall Guide Panel", window.transform, new Vector2(254f, 400f), topLeft: true);
			Rect(val2).anchoredPosition = new Vector2(538f, -105f);
			if (snapshot == null)
			{
				BuildNoPartyWindow(val.transform, val2.transform);
			}
			else
			{
				BuildActivePartyWindow(val.transform, val2.transform);
			}
		}

		private void BuildNoPartyWindow(Transform left, Transform right)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			Text(left, "FORM A PARTY", new Vector2(24f, -24f), new Vector2(426f, 30f), 21f, gold: true, (TextAlignmentOptions)257);
			Text(left, "Find an existing company or form your own.", new Vector2(24f, -61f), new Vector2(426f, 28f), 14f, gold: false, (TextAlignmentOptions)257);
			Text(left, "PARTY NAME", new Vector2(24f, -101f), new Vector2(426f, 22f), 13f, gold: true, (TextAlignmentOptions)257);
			nameInput = NativeInput(left, new Vector2(24f, -128f), new Vector2(426f, 38f));
			nameInput.text = draftPartyName;
			((UnityEvent<string>)(object)nameInput.onValueChanged).AddListener((UnityAction<string>)delegate(string value)
			{
				draftPartyName = value;
			});
			Text(left, "JOIN MODE", new Vector2(24f, -180f), new Vector2(426f, 22f), 13f, gold: true, (TextAlignmentOptions)257);
			JoinModeButtons(left, createJoinMode, -207f, delegate(PartyVisibility mode)
			{
				TMP_InputField? obj = nameInput;
				draftPartyName = ((obj != null) ? obj.text : null) ?? draftPartyName;
				createJoinMode = mode;
				BuildWindow();
			});
			((UnityEvent)NativeButton(left, "CREATE PARTY", new Vector2(24f, -255f), new Vector2(426f, 40f)).onClick).AddListener((UnityAction)delegate
			{
				string text = (((Object)(object)nameInput == (Object)null) ? string.Empty : nameInput.text.Trim());
				if (string.IsNullOrEmpty(text))
				{
					ShowNotice("Enter a party name first.");
				}
				else if (!PartyRpc.Client("FP_CreateParty", text, (int)createJoinMode))
				{
					ShowNotice("Party network is not ready yet.");
				}
			});
			((UnityEvent)NativeButton(left, "BROWSE PARTIES", new Vector2(24f, -307f), new Vector2(426f, 38f)).onClick).AddListener(new UnityAction(OpenBrowser));
			Text(left, "Ctrl + drag the PARTY button or compact HUD to move it.", new Vector2(24f, -357f), new Vector2(426f, 28f), 12f, gold: false, (TextAlignmentOptions)257);
			Text(right, "JOIN MODES", new Vector2(22f, -24f), new Vector2(210f, 28f), 18f, gold: true, (TextAlignmentOptions)257);
			Text(right, "PUBLIC\nJoin immediately from Browse.\n\nREQUEST TO JOIN\nLeader accepts or declines.\n\nINVITE ONLY\nOnly a direct invitation can add you.", new Vector2(22f, -66f), new Vector2(210f, 270f), 13f, gold: false, (TextAlignmentOptions)257);
			Text(right, "Hotkey: " + Plugin.Settings.PartyWindowHotkey.Value, new Vector2(22f, -350f), new Vector2(210f, 24f), 12f, gold: true, (TextAlignmentOptions)257);
		}

		private void BuildActivePartyWindow(Transform left, Transform right)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Expected O, but got Unknown
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Expected O, but got Unknown
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Expected O, but got Unknown
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Expected O, but got Unknown
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_0594: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Expected O, but got Unknown
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_062a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Expected O, but got Unknown
			if (snapshot == null)
			{
				return;
			}
			Player localPlayer = Player.m_localPlayer;
			long num = ((localPlayer != null) ? localPlayer.GetPlayerID() : 0);
			bool flag = num != 0L && snapshot.Leader == num;
			Text(left, snapshot.Name.ToUpperInvariant(), new Vector2(24f, -24f), new Vector2(426f, 30f), 22f, gold: true, (TextAlignmentOptions)257);
			Text(left, "Leader ID: " + snapshot.Leader + "   •   Members: " + snapshot.Members.Count, new Vector2(24f, -61f), new Vector2(426f, 25f), 14f, gold: false, (TextAlignmentOptions)257);
			Text(left, "JOIN MODE: " + PartyManager.JoinModeLabel(snapshot.Visibility), new Vector2(24f, -88f), new Vector2(426f, 22f), 13f, gold: true, (TextAlignmentOptions)257);
			MakeImage(left, "Separator", new Vector2(426f, 2f), new Vector2(24f, -116f), new Color(0.75f, 0.5f, 0.16f, 0.75f), nativeInnerStyle: false);
			Text(left, "COMPANIONS — CLICK FOR ACTIONS", new Vector2(24f, -130f), new Vector2(426f, 22f), 13f, gold: true, (TextAlignmentOptions)257);
			float num2 = -159f;
			foreach (PartySnapshot.MemberState item in snapshot.Members.Take(4))
			{
				string text = ((item.Id == snapshot.Leader) ? "LEADER  " : "MEMBER  ") + item.Name;
				if (!string.IsNullOrEmpty(item.ClanTag))
				{
					text = text + " [" + item.ClanTag + "]";
				}
				if (!item.Online)
				{
					text += "  • OFFLINE";
				}
				Button obj = NativeButton(left, text, new Vector2(24f, num2), new Vector2(426f, 36f));
				long memberId = item.Id;
				((UnityEvent)obj.onClick).AddListener((UnityAction)delegate
				{
					selectedMemberId = memberId;
					page = PartyPage.MemberActions;
					BuildWindow();
				});
				num2 -= 42f;
			}
			ButtonClickedEvent onClick = NativeButton(left, "LEAVE PARTY", new Vector2(24f, -346f), new Vector2(flag ? 204f : 426f, 38f)).onClick;
			object obj2 = <>c.<>9__116_0;
			if (obj2 == null)
			{
				UnityAction val = delegate
				{
					PartyRpc.Client("FP_Leave");
				};
				<>c.<>9__116_0 = val;
				obj2 = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj2);
			if (flag)
			{
				ButtonClickedEvent onClick2 = NativeButton(left, "DISBAND", new Vector2(246f, -346f), new Vector2(204f, 38f)).onClick;
				object obj3 = <>c.<>9__116_3;
				if (obj3 == null)
				{
					UnityAction val2 = delegate
					{
						PartyRpc.Client("FP_Disband");
					};
					<>c.<>9__116_3 = val2;
					obj3 = (object)val2;
				}
				((UnityEvent)onClick2).AddListener((UnityAction)obj3);
			}
			Text(right, "PARTY CONTROLS", new Vector2(18f, -20f), new Vector2(218f, 26f), 17f, gold: true, (TextAlignmentOptions)257);
			if (flag || snapshot.MembersCanInvite)
			{
				((UnityEvent)NativeButton(right, "INVITE PLAYER", new Vector2(18f, -53f), new Vector2(218f, 34f)).onClick).AddListener(new UnityAction(OpenInvitePlayers));
			}
			Text(right, "JOIN MODE", new Vector2(18f, -103f), new Vector2(218f, 22f), 13f, gold: true, (TextAlignmentOptions)257);
			if (flag)
			{
				JoinModeButtons(right, snapshot.Visibility, -130f, delegate(PartyVisibility mode)
				{
					PartyRpc.Client("FP_SetJoinMode", (int)mode);
				});
			}
			else
			{
				Text(right, PartyManager.JoinModeLabel(snapshot.Visibility), new Vector2(18f, -132f), new Vector2(218f, 24f), 13f, gold: false, (TextAlignmentOptions)257);
			}
			Text(right, "JOIN REQUESTS", new Vector2(18f, -181f), new Vector2(218f, 22f), 13f, gold: true, (TextAlignmentOptions)257);
			if (!flag)
			{
				Text(right, "Leader approval only.", new Vector2(18f, -210f), new Vector2(218f, 24f), 12f, gold: false, (TextAlignmentOptions)257);
				return;
			}
			if (joinRequestEntries.Count == 0)
			{
				Text(right, "No pending requests.", new Vector2(18f, -210f), new Vector2(218f, 24f), 12f, gold: false, (TextAlignmentOptions)257);
				return;
			}
			float num3 = -209f;
			foreach (JoinRequestEntry item2 in joinRequestEntries.Take(2))
			{
				Text(right, item2.PlayerName, new Vector2(18f, num3), new Vector2(108f, 25f), 12f, gold: false, (TextAlignmentOptions)257);
				long requester = item2.PlayerId;
				((UnityEvent)NativeButton(right, "ACCEPT", new Vector2(126f, num3), new Vector2(54f, 28f)).onClick).AddListener((UnityAction)delegate
				{
					PartyRpc.Client("FP_JoinRequestResponse", requester, true);
				});
				((UnityEvent)NativeButton(right, "X", new Vector2(184f, num3), new Vector2(40f, 28f)).onClick).AddListener((UnityAction)delegate
				{
					PartyRpc.Client("FP_JoinRequestResponse", requester, false);
				});
				num3 -= 36f;
			}
		}

		private void OpenBrowser()
		{
			page = PartyPage.Browser;
			windowContentDirty = true;
			browserEntries.Clear();
			PartyWindowState.BrowserPayload = string.Empty;
			browserPageIndex = 0;
			nextBrowserRefresh = Time.time + 6f;
			BuildWindow();
			if (!PartyRpc.Client("FP_RequestBrowser"))
			{
				ShowNotice("Party network is not ready yet.");
			}
		}

		private void BuildBrowserWindow()
		{
			//IL_002a: 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_0066: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: 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_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Expected O, but got Unknown
			//IL_050c: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0587: Expected O, but got Unknown
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Expected O, but got Unknown
			if ((Object)(object)window == (Object)null)
			{
				return;
			}
			GameObject val = Panel("Party Browser Panel", window.transform, new Vector2(764f, 400f), topLeft: true);
			Rect(val).anchoredPosition = new Vector2(28f, -105f);
			Text(val.transform, "BROWSE PARTIES", new Vector2(20f, -20f), new Vector2(300f, 28f), 20f, gold: true, (TextAlignmentOptions)257);
			((UnityEvent)NativeButton(val.transform, "BACK", new Vector2(620f, -18f), new Vector2(120f, 32f)).onClick).AddListener((UnityAction)delegate
			{
				page = PartyPage.Hall;
				BuildWindow();
			});
			browserSearchInput = NativeInput(val.transform, new Vector2(20f, -58f), new Vector2(480f, 34f));
			browserSearchInput.text = browserSearch;
			Graphic placeholder = browserSearchInput.placeholder;
			TMP_Text val2 = (TMP_Text)(object)((placeholder is TMP_Text) ? placeholder : null);
			if (val2 != null)
			{
				val2.text = "Search party or leader";
			}
			((UnityEvent<string>)(object)browserSearchInput.onValueChanged).AddListener((UnityAction<string>)delegate(string value)
			{
				browserSearch = value;
			});
			((UnityEvent<string>)(object)browserSearchInput.onEndEdit).AddListener((UnityAction<string>)delegate
			{
				browserPageIndex = 0;
				BuildWindow();
			});
			ButtonClickedEvent onClick = NativeButton(val.transform, "REFRESH", new Vector2(516f, -58f), new Vector2(224f, 34f)).onClick;
			object obj = <>c.<>9__118_3;
			if (obj == null)
			{
				UnityAction val3 = delegate
				{
					PartyRpc.Client("FP_RequestBrowser");
				};
				<>c.<>9__118_3 = val3;
				obj = (object)val3;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			BrowserPartyEntry[] array = browserEntries.Where((BrowserPartyEntry entry) => string.IsNullOrWhiteSpace(browserSearch) || entry.Name.IndexOf(browserSearch, StringComparison.OrdinalIgnoreCase) >= 0 || entry.LeaderName.IndexOf(browserSearch, StringComparison.OrdinalIgnoreCase) >= 0).ToArray();
			int num = Mathf.Max(1, Mathf.CeilToInt((float)array.Length / 4f));
			browserPageIndex = Mathf.Clamp(browserPageIndex, 0, num - 1);
			BrowserPartyEntry[] array2 = array.Skip(browserPageIndex * 4).Take(4).ToArray();
			if (array.Length == 0)
			{
				Text(val.transform, (browserEntries.Count == 0) ? "No parties available." : "No parties match your search.", new Vector2(20f, -116f), new Vector2(720f, 30f), 14f, gold: false, (TextAlignmentOptions)257);
			}
			float num2 = -106f;
			BrowserPartyEntry[] array3 = array2;
			foreach (BrowserPartyEntry browserPartyEntry in array3)
			{
				Image val4 = MakeImage(val.transform, "Party Browser Row", new Vector2(720f, 50f), new Vector2(20f, num2), Color.white, nativeInnerStyle: true);
				((Graphic)val4).color = PartyPanelTint;
				Text(((Component)val4).transform, browserPartyEntry.Name, new Vector2(12f, -7f), new Vector2(255f, 21f), 14f, gold: true, (TextAlignmentOptions)257);
				Text(((Component)val4).transform, "Leader: " + browserPartyEntry.LeaderName + "   Members: " + browserPartyEntry.Members + "   " + PartyManager.JoinModeLabel(browserPartyEntry.Visibility), new Vector2(12f, -28f), new Vector2(560f, 18f), 11f, gold: false, (TextAlignmentOptions)257);
				if (browserPartyEntry.Visibility == PartyVisibility.InviteOnly)
				{
					Text(((Component)val4).transform, "INVITE ONLY", new Vector2(586f, -15f), new Vector2(122f, 22f), 12f, gold: true, (TextAlignmentOptions)260);
				}
				else
				{
					string label = ((browserPartyEntry.Visibility == PartyVisibility.Public) ? "JOIN" : "REQUEST TO JOIN");
					Button obj2 = NativeButton(((Component)val4).transform, label, new Vector2(584f, -9f), new Vector2(124f, 32f));
					string partyId = browserPartyEntry.PartyId;
					string rpc = ((browserPartyEntry.Visibility == PartyVisibility.Public) ? "FP_Join" : "FP_RequestJoin");
					((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate
					{
						PartyRpc.Client(rpc, partyId);
					});
				}
				num2 -= 56f;
			}
			if (num > 1)
			{
				Button obj3 = NativeButton(val.transform, "PREV", new Vector2(240f, -354f), new Vector2(100f, 30f));
				((Selectable)obj3).interactable = browserPageIndex > 0;
				((UnityEvent)obj3.onClick).AddListener((UnityAction)delegate
				{
					browserPageIndex--;
					BuildWindow();
				});
				Text(val.transform, browserPageIndex + 1 + " / " + num, new Vector2(350f, -358f), new Vector2(64f, 22f), 12f, gold: true, (TextAlignmentOptions)258);
				Button obj4 = NativeButton(val.transform, "NEXT", new Vector2(424f, -354f), new Vector2(100f, 30f));
				((Selectable)obj4).interactable = browserPageIndex + 1 < num;
				((UnityEvent)obj4.onClick).AddListener((UnityAction)delegate
				{
					browserPageIndex++;
					BuildWindow();
				});
			}
		}

		private void OpenInvitePlayers()
		{
			page = PartyPage.InvitePlayers;
			windowContentDirty = true;
			onlinePlayers.Clear();
			lastOnlinePlayersPayload = null;
			invitePageIndex = 0;
			BuildWindow();
			if (!PartyRpc.Client("FP_RequestOnlinePlayers"))
			{
				ShowNotice("Party network is not ready yet.");
			}
		}

		private void BuildInvitePlayersWindow()
		{
			//IL_002a: 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_0066: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Expected O, but got Unknown
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Expected O, but got Unknown
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Expected O, but got Unknown
			if ((Object)(object)window == (Object)null)
			{
				return;
			}
			GameObject val = Panel("Online Players Panel", window.transform, new Vector2(764f, 400f), topLeft: true);
			Rect(val).anchoredPosition = new Vector2(28f, -105f);
			Text(val.transform, "ONLINE PLAYERS", new Vector2(20f, -20f), new Vector2(320f, 28f), 20f, gold: true, (TextAlignmentOptions)257);
			((UnityEvent)NativeButton(val.transform, "BACK", new Vector2(620f, -18f), new Vector2(120f, 32f)).onClick).AddListener((UnityAction)delegate
			{
				page = PartyPage.Hall;
				BuildWindow();
			});
			if (onlinePlayers.Count == 0)
			{
				Text(val.transform, "No eligible online players found.", new Vector2(20f, -72f), new Vector2(720f, 30f), 14f, gold: false, (TextAlignmentOptions)257);
			}
			int num = Mathf.Max(1, Mathf.CeilToInt((float)onlinePlayers.Count / 6f));
			invitePageIndex = Mathf.Clamp(invitePageIndex, 0, num - 1);
			float num2 = -64f;
			foreach (OnlinePlayerEntry item in onlinePlayers.Skip(invitePageIndex * 6).Take(6))
			{
				Image val2 = MakeImage(val.transform, "Online Player Row", new Vector2(720f, 40f), new Vector2(20f, num2), Color.white, nativeInnerStyle: true);
				((Graphic)val2).color = PartyPanelTint;
				string text = (string.IsNullOrEmpty(item.ClanTag) ? string.Empty : (" [" + item.ClanTag + "]"));
				Text(((Component)val2).transform, item.Name + text, new Vector2(12f, -9f), new Vector2(390f, 22f), 14f, gold: false, (TextAlignmentOptions)257);
				Text(((Component)val2).transform, Mathf.RoundToInt(item.Distance) + " m", new Vector2(402f, -9f), new Vector2(120f, 22f), 12f, gold: false, (TextAlignmentOptions)260);
				Button obj = NativeButton(((Component)val2).transform, "INVITE", new Vector2(568f, -5f), new Vector2(140f, 30f));
				long playerId = item.PlayerId;
				((UnityEvent)obj.onClick).AddListener((UnityAction)delegate
				{
					PartyRpc.Client("FP_Invite", playerId);
				});
				num2 -= 45f;
			}
			if (num > 1)
			{
				Button obj2 = NativeButton(val.transform, "PREV", new Vector2(240f, -354f), new Vector2(100f, 30f));
				((Selectable)obj2).interactable = invitePageIndex > 0;
				((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate
				{
					invitePageIndex--;
					BuildWindow();
				});
				Text(val.transform, invitePageIndex + 1 + " / " + num, new Vector2(350f, -358f), new Vector2(64f, 22f), 12f, gold: true, (TextAlignmentOptions)258);
				Button obj3 = NativeButton(val.transform, "NEXT", new Vector2(424f, -354f), new Vector2(100f, 30f));
				((Selectable)obj3).interactable = invitePageIndex + 1 < num;
				((UnityEvent)obj3.onClick).AddListener((UnityAction)delegate
				{
					invitePageIndex++;
					BuildWindow();
				});
			}
		}

		private void BuildMemberActionsWindow()
		{
			//IL_003e: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected O, but got Unknown
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Expected O, but got Unknown
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Expected O, but got Unknown
			if ((Object)(object)window == (Object)null || snapshot == null)
			{
				page = PartyPage.Hall;
				BuildWindow();
				return;
			}
			GameObject val = Panel("Party Member Actions Panel", window.transform, new Vector2(764f, 400f), topLeft: true);
			Rect(val).anchoredPosition = new Vector2(28f, -105f);
			PartySnapshot.MemberState memberState = snapshot.Members.FirstOrDefault((PartySnapshot.MemberState candidate) => candidate.Id == selectedMemberId);
			if (memberState == null)
			{
				page = PartyPage.Hall;
				BuildWindow();
				return;
			}
			Text(val.transform, "PARTY MEMBER", new Vector2(24f, -24f), new Vector2(300f, 28f), 20f, gold: true, (TextAlignmentOptions)257);
			Text(val.transform, memberState.Name + (string.IsNullOrEmpty(memberState.ClanTag) ? string.Empty : (" [" + memberState.ClanTag + "]")), new Vector2(24f, -69f), new Vector2(500f, 30f), 18f, gold: false, (TextAlignmentOptions)257);
			Text(val.transform, memberState.Online ? ("Online • " + Mathf.RoundToInt(memberState.Distance) + " m") : "Offline", new Vector2(24f, -108f), new Vector2(500f, 28f), 14f, gold: false, (TextAlignmentOptions)257);
			((UnityEvent)NativeButton(val.transform, "BACK", new Vector2(620f, -18f), new Vector2(120f, 32f)).onClick).AddListener((UnityAction)delegate
			{
				page = PartyPage.Hall;
				BuildWindow();
			});
			Player localPlayer = Player.m_localPlayer;
			long num = ((localPlayer != null) ? localPlayer.GetPlayerID() : 0);
			if (snapshot.Leader == num && selectedMemberId != num)
			{
				((UnityEvent)NativeButton(val.transform, "TRANSFER LEADER", new Vector2(24f, -170f), new Vector2(280f, 40f)).onClick).AddListener((UnityAction)delegate
				{
					page = PartyPage.Hall;
					PartyRpc.Client("FP_TransferLeader", selectedMemberId);
				});
				((UnityEvent)NativeButton(val.transform, "KICK MEMBER", new Vector2(24f, -224f), new Vector2(280f, 40f)).onClick).AddListener((UnityAction)delegate
				{
					page = PartyPage.Hall;
					PartyRpc.Client("FP_Kick", selectedMemberId);
				});
			}
			else
			{
				Text(val.transform, "Only the party leader can transfer leadership or remove another member.", new Vector2(24f, -170f), new Vector2(620f, 60f), 14f, gold: false, (TextAlignmentOptions)257);
			}
		}

		private void JoinModeButtons(Transform parent, PartyVisibility selected, float y, Action<PartyVisibility> action)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			Rect rect = Rect(((Component)parent).gameObject).rect;
			bool num = ((Rect)(ref rect)).width > 300f;
			float num2 = (num ? 24f : 18f);
			float num3 = (num ? 130f : 68f);
			float num4 = (num ? 12f : 4f);
			((UnityEvent)NativeButton(parent, (selected == PartyVisibility.Public) ? "▶ PUBLIC" : "PUBLIC", new Vector2(num2, y), new Vector2(num3, 30f)).onClick).AddListener((UnityAction)delegate
			{
				action(PartyVisibility.Public);
			});
			((UnityEvent)NativeButton(parent, (selected == PartyVisibility.RequestToJoin) ? "▶ REQUEST" : "REQUEST", new Vector2(num2 + num3 + num4, y), new Vector2(num3, 30f)).onClick).AddListener((UnityAction)delegate
			{
				action(PartyVisibility.RequestToJoin);
			});
			((UnityEvent)NativeButton(parent, (selected == PartyVisibility.InviteOnly) ? "▶ INVITE" : "INVITE", new Vector2(num2 + (num3 + num4) * 2f, y), new Vector2(num3, 30f)).onClick).AddListener((UnityAction)delegate
			{
				action(PartyVisibility.InviteOnly);
			});
		}

		private void ShowInvite()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected O, but got Unknown
			if (!((Object)(object)invite == (Object)null))
			{
				Clear(invite);
				Text(invite.transform, "PARTY INVITATION", new Vector2(22f, -24f), new Vector2(386f, 28f), 20f, gold: true, (TextAlignmentOptions)257);
				Text(invite.transform, pendingInviterName + " invites you to join:\n" + pendingInviteName, new Vector2(22f, -66f), new Vector2(386f, 50f), 15f, gold: false, (TextAlignmentOptions)257);
				((UnityEvent)NativeButton(invite.transform, "ACCEPT", new Vector2(22f, -120f), new Vector2(160f, 34f)).onClick).AddListener((UnityAction)delegate
				{
					PartyRpc.Client("FP_InviteResponse", PendingInviteId, true);
					PendingInviteId = string.Empty;
					invite.SetActive(false);
				});
				((UnityEvent)NativeButton(invite.transform, "DECLINE", new Vector2(195f, -120f), new Vector2(160f, 34f)).onClick).AddListener((UnityAction)delegate
				{
					PartyRpc.Client("FP_InviteResponse", PendingInviteId, false);
					PendingInviteId = string.Empty;
					invite.SetActive(false);
				});
				invite.transform.SetAsLastSibling();
				invite.SetActive(true);
			}
		}

		private GameObject Panel(string name, Transform parent, Vector2 size, bool topLeft)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0059: 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_009e: 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_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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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)
			GameObject val = new GameObject(name, new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			val.transform.SetParent(parent, false);
			ApplyImageStyle(val.GetComponent<Image>(), topLeft ? nativeInnerImage : nativeWindowImage, Color.white);
			if (topLeft)
			{
				((Graphic)val.GetComponent<Image>()).color = PartyPanelTint;
			}
			RectTransform obj = Rect(val);
			Vector2 anchorMin = (obj.anchorMax = (topLeft ? new Vector2(0f, 1f) : new Vector2(0.5f, 0.5f)));
			obj.anchorMin = anchorMin;
			obj.pivot = (topLeft ? new Vector2(0f, 1f) : new Vector2(0.5f, 0.5f));
			obj.sizeDelta = size;
			return val;
		}

		private Image MakeImage(Transform parent, string name, Vector2 size, Vector2 pos, Color color, bool nativeInnerStyle)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_007b: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name, new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			val.transform.SetParent(parent, false);
			Image component = val.GetComponent<Image>();
			ApplyImageStyle(component, nativeInnerStyle ? nativeInnerImage : null, color);
			((Graphic)component).raycastTarget = false;
			RectTransform obj = Rect(val);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..cto