Decompiled source of BanEnforcer v2.0.0

BanList.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using MenuLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Photon.Pun;
using Photon.Realtime;
using Steamworks;
using Steamworks.Data;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyProduct("BanList")]
[assembly: AssemblyTitle("BanList")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RepoMods.PhotonBanEnforcer
{
	public static class RepoBanPatcher
	{
		public static void Apply(Harmony harmony)
		{
			harmony.PatchAll(typeof(RepoBanPatcher).Assembly);
		}
	}
	public class RepoBanManager : MonoBehaviourPunCallbacks
	{
		[Serializable]
		public sealed class SaveModel
		{
			public List<string> keys = new List<string>();

			public List<BanRecordModel> records = new List<BanRecordModel>();
		}

		[Serializable]
		public sealed class BanRecordModel
		{
			public string steamId = string.Empty;

			public string displayName = string.Empty;

			public string reason = string.Empty;

			public string lastSeenName = string.Empty;

			public string createdUtc = string.Empty;
		}

		private sealed class BanRecord
		{
			public string Key = string.Empty;

			public ulong SteamId;

			public string DisplayName = string.Empty;

			public string Reason = string.Empty;

			public string LastSeenName = string.Empty;

			public DateTime CreatedUtc = DateTime.UtcNow;
		}

		public sealed class BanRecordSnapshot
		{
			public string Key { get; set; } = string.Empty;


			public ulong SteamId { get; set; }

			public string DisplayName { get; set; } = string.Empty;


			public string Reason { get; set; } = string.Empty;


			public string LastSeenName { get; set; } = string.Empty;


			public DateTime CreatedUtc { get; set; }
		}

		private sealed class PlayerInfo
		{
			public string NickName = string.Empty;

			public string SteamId = string.Empty;

			public int ActorNumber;

			public DateTime LastSeenUtc;

			public bool HasSid => !string.IsNullOrEmpty(SteamId);
		}

		public static bool VerboseLogs;

		public static bool LogLocalIds;

		private readonly Dictionary<string, BanRecord> _banRecords = new Dictionary<string, BanRecord>(StringComparer.OrdinalIgnoreCase);

		private readonly HashSet<ulong> _pendingPhotonEnforcement = new HashSet<ulong>();

		private readonly Dictionary<int, PlayerInfo> _playerCache = new Dictionary<int, PlayerInfo>();

		private readonly Dictionary<ulong, string> _steamLobbyMembers = new Dictionary<ulong, string>();

		private readonly Dictionary<string, List<ulong>> _nameToSteamIds = new Dictionary<string, List<ulong>>(StringComparer.Ordinal);

		private static string? _savePath;

		public static RepoBanManager Instance { get; private set; }

		private static string SavePath
		{
			get
			{
				if (!string.IsNullOrEmpty(_savePath))
				{
					return _savePath;
				}
				try
				{
					_savePath = Path.Combine(Paths.ConfigPath, "RepoBanList.json");
				}
				catch
				{
					_savePath = Path.Combine(Application.persistentDataPath, "RepoBanList.json");
				}
				return _savePath;
			}
		}

		public static void EnsureExists()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)Instance))
			{
				GameObject val = new GameObject("RepoBanManager");
				((Object)val).hideFlags = (HideFlags)61;
				Object.DontDestroyOnLoad((Object)(object)val);
				Instance = val.AddComponent<RepoBanManager>();
				((Object)Instance).hideFlags = (HideFlags)61;
				Instance.LoadLocal();
				Debug.Log((object)"[RepoBan] Manager created (Steam-only).");
			}
		}

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(UpdatePlayerInfoRoutine());
			ForceRefreshAll();
		}

		private void OnDestroy()
		{
			try
			{
				SaveLocal();
			}
			catch
			{
			}
			if (Instance == this)
			{
				Instance = null;
			}
		}

		private IEnumerator UpdatePlayerInfoRoutine()
		{
			while (true)
			{
				yield return (object)new WaitForSecondsRealtime(2f);
				ForceRefreshAll();
			}
		}

		public void ForceRefreshAll()
		{
			RefreshSteamLobbyMap();
			if (PhotonNetwork.InRoom)
			{
				UpdatePlayerCache();
				EnforceExistingBans();
				EnforcePendingBans();
			}
		}

		internal void RefreshSteamLobbyMap()
		{
			//IL_001b: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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)
			try
			{
				if ((Object)(object)SteamManager.instance == (Object)null)
				{
					return;
				}
				Lobby currentLobby = SteamManager.instance.currentLobby;
				SteamId id = ((Lobby)(ref currentLobby)).Id;
				if (!((SteamId)(ref id)).IsValid)
				{
					return;
				}
				_steamLobbyMembers.Clear();
				_nameToSteamIds.Clear();
				foreach (Friend member in ((Lobby)(ref currentLobby)).Members)
				{
					Friend current = member;
					ulong value = current.Id.Value;
					string text = ((Friend)(ref current)).Name ?? string.Empty;
					_steamLobbyMembers[value] = text;
					if (IsSteamIdBanned(value))
					{
						QueuePendingEnforcement(value, string.IsNullOrWhiteSpace(text) ? $"Steam lobby member {value}" : text);
					}
					if (!string.IsNullOrEmpty(text))
					{
						if (!_nameToSteamIds.TryGetValue(text, out List<ulong> value2))
						{
							value2 = new List<ulong>();
							_nameToSteamIds[text] = value2;
						}
						if (!value2.Contains(value))
						{
							value2.Add(value);
						}
					}
				}
			}
			catch
			{
			}
		}

		public string ResolveSteam64For(Player p)
		{
			if (p == null)
			{
				return string.Empty;
			}
			PlayerInfo orCreatePlayerInfo = GetOrCreatePlayerInfo(p);
			if (!string.IsNullOrEmpty(orCreatePlayerInfo.SteamId))
			{
				return orCreatePlayerInfo.SteamId;
			}
			string text = ExtractSteam64FromCustomProps(p);
			if (!string.IsNullOrEmpty(text))
			{
				orCreatePlayerInfo.SteamId = text;
				return text;
			}
			if (!string.IsNullOrEmpty(p.NickName) && _nameToSteamIds.TryGetValue(p.NickName, out List<ulong> value) && value.Count > 0)
			{
				orCreatePlayerInfo.SteamId = value[0].ToString();
			}
			return orCreatePlayerInfo.SteamId ?? string.Empty;
		}

		private string ExtractSteam64FromCustomProps(Player? player, Hashtable? changedProps = null)
		{
			Hashtable val = changedProps ?? ((player != null) ? player.CustomProperties : null);
			if (val == null)
			{
				return string.Empty;
			}
			string[] array = new string[5] { "steamId", "steamID", "steamid", "SteamId", "STEAMID" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (!((Dictionary<object, object>)(object)val).TryGetValue((object)text, out object value))
				{
					continue;
				}
				string text2 = value?.ToString();
				if (!string.IsNullOrEmpty(text2) && text2 != "0")
				{
					if (VerboseLogs && player != null && (!player.IsLocal || LogLocalIds))
					{
						Debug.Log((object)("[RepoBan] Found Steam ID for " + player.NickName + ": " + text2 + " (" + text + ")"));
					}
					return text2;
				}
			}
			if (!string.IsNullOrEmpty((player != null) ? player.UserId : null) && player.UserId.All(char.IsDigit) && player.UserId.Length >= 10)
			{
				return player.UserId;
			}
			return string.Empty;
		}

		private void UpdatePlayerCache()
		{
			Player[] playerList = PhotonNetwork.PlayerList;
			foreach (Player val in playerList)
			{
				if (val != null)
				{
					PlayerInfo orCreatePlayerInfo = GetOrCreatePlayerInfo(val);
					bool hasSid = orCreatePlayerInfo.HasSid;
					orCreatePlayerInfo.NickName = val.NickName;
					orCreatePlayerInfo.ActorNumber = val.ActorNumber;
					orCreatePlayerInfo.LastSeenUtc = DateTime.UtcNow;
					orCreatePlayerInfo.SteamId = ResolveSteam64For(val);
					TouchBanRecord(orCreatePlayerInfo.SteamId, orCreatePlayerInfo.NickName);
					if (!hasSid && orCreatePlayerInfo.HasSid && IsSteam64Banned(orCreatePlayerInfo.SteamId))
					{
						Debug.Log((object)("[RepoBan] Newly identified banned player " + orCreatePlayerInfo.NickName + "; enforcing kick."));
						EnforceKick(val, orCreatePlayerInfo.SteamId, "newly identified");
					}
				}
			}
		}

		private PlayerInfo GetOrCreatePlayerInfo(Player player)
		{
			if (!_playerCache.TryGetValue(player.ActorNumber, out PlayerInfo value))
			{
				value = new PlayerInfo();
				_playerCache[player.ActorNumber] = value;
			}
			return value;
		}

		private static string PrefixSteam(string id)
		{
			return "steam:" + id;
		}

		private static string PrefixSteam(ulong steamId)
		{
			return PrefixSteam(steamId.ToString());
		}

		private static string NormalizeReason(string? reason)
		{
			return string.IsNullOrWhiteSpace(reason) ? string.Empty : reason.Trim();
		}

		private static string NormalizeDisplayName(string? displayName)
		{
			return string.IsNullOrWhiteSpace(displayName) ? string.Empty : displayName.Trim();
		}

		private void TouchBanRecord(string sidText, string displayName)
		{
			if (!ulong.TryParse(sidText, out var result))
			{
				return;
			}
			string key = PrefixSteam(result);
			if (!_banRecords.TryGetValue(key, out BanRecord value))
			{
				return;
			}
			bool flag = false;
			if (!string.IsNullOrWhiteSpace(displayName))
			{
				string text = displayName.Trim();
				if (!string.Equals(value.LastSeenName, text, StringComparison.Ordinal))
				{
					value.LastSeenName = text;
					flag = true;
				}
				if (string.IsNullOrWhiteSpace(value.DisplayName))
				{
					value.DisplayName = text;
					flag = true;
				}
			}
			if (flag)
			{
				SaveLocal();
			}
		}

		private void UpsertBanRecord(ulong steamId, string? displayName, string? reason)
		{
			string key = PrefixSteam(steamId);
			if (!_banRecords.TryGetValue(key, out BanRecord value))
			{
				value = new BanRecord
				{
					Key = key,
					SteamId = steamId,
					CreatedUtc = DateTime.UtcNow
				};
				_banRecords[key] = value;
			}
			string text = NormalizeDisplayName(displayName);
			string text2 = NormalizeReason(reason);
			if (!string.IsNullOrWhiteSpace(text))
			{
				value.DisplayName = text;
				value.LastSeenName = text;
			}
			if (!string.IsNullOrWhiteSpace(text2))
			{
				value.Reason = text2;
			}
		}

		private void QueuePendingEnforcement(ulong steamId, string sourceLabel)
		{
			if (steamId != 0)
			{
				_pendingPhotonEnforcement.Add(steamId);
				if (VerboseLogs)
				{
					Debug.Log((object)$"[RepoBan] Queued enforcement for Steam64 {steamId} from {sourceLabel}.");
				}
			}
		}

		private void EnforceExistingBans()
		{
			Player[] playerList = PhotonNetwork.PlayerList;
			foreach (Player val in playerList)
			{
				if (val != null && !val.IsLocal)
				{
					string s = ResolveSteam64For(val);
					if (ulong.TryParse(s, out var result) && IsSteamIdBanned(result))
					{
						PlayerInfo orCreatePlayerInfo = GetOrCreatePlayerInfo(val);
						Debug.Log((object)$"[RepoBan] Enforcing active ban on {orCreatePlayerInfo.NickName} ({result}).");
						EnforceKick(val, result.ToString(), "active ban scan");
					}
				}
			}
		}

		private void EnforcePendingBans()
		{
			if (_pendingPhotonEnforcement.Count == 0)
			{
				return;
			}
			ulong[] array = _pendingPhotonEnforcement.ToArray();
			foreach (ulong num in array)
			{
				if (TryEnforceBySteamId(num, "pending enforcement"))
				{
					_pendingPhotonEnforcement.Remove(num);
				}
			}
		}

		private bool TryEnforceBySteamId(ulong steamId, string reasonContext)
		{
			Player[] playerList = PhotonNetwork.PlayerList;
			foreach (Player val in playerList)
			{
				if (val != null && !val.IsLocal)
				{
					string text = ResolveSteam64For(val);
					if (ulong.TryParse(text, out var result) && result == steamId)
					{
						return EnforceKick(val, text, reasonContext);
					}
				}
			}
			return false;
		}

		public static void BanPlayer(Player p)
		{
			if (p != null && !((Object)(object)Instance == (Object)null))
			{
				string s = Instance.ResolveSteam64For(p);
				if (!ulong.TryParse(s, out var result))
				{
					Debug.LogWarning((object)("[RepoBan] Could not resolve Steam64 for " + p.NickName + ". Use the Steam panel or manual field."));
				}
				else
				{
					BanBySteamId(result, p.NickName, "Banned from in-room player list");
				}
			}
		}

		public static void BanBySteamId(ulong steamId, string? displayName = null, string? reason = null)
		{
			if (steamId != 0L && !((Object)(object)Instance == (Object)null))
			{
				Instance.UpsertBanRecord(steamId, displayName, reason);
				Instance.QueuePendingEnforcement(steamId, "ban list");
				Instance.SaveLocal();
				if (!Instance.TryEnforceBySteamId(steamId, "manual ban"))
				{
					Debug.Log((object)$"[RepoBan] Stored ban for Steam64 {steamId}. Enforcement will apply as soon as that player resolves in-room.");
				}
			}
		}

		public static void RemoveSteamKey(string key)
		{
			if (!((Object)(object)Instance == (Object)null) && !string.IsNullOrWhiteSpace(key) && Instance._banRecords.Remove(key))
			{
				if (ulong.TryParse(key.Replace("steam:", string.Empty), out var result))
				{
					Instance._pendingPhotonEnforcement.Remove(result);
				}
				Instance.SaveLocal();
			}
		}

		public static void ClearAllLocalBans()
		{
			if (!((Object)(object)Instance == (Object)null))
			{
				Instance._banRecords.Clear();
				Instance._pendingPhotonEnforcement.Clear();
				Instance.SaveLocal();
			}
		}

		public static List<string> LocalSteamKeysSnapshot()
		{
			return Instance?._banRecords.Keys.Where((string key) => key.StartsWith("steam:", StringComparison.OrdinalIgnoreCase)).OrderBy<string, string>((string key) => key, StringComparer.OrdinalIgnoreCase).ToList() ?? new List<string>();
		}

		public static List<BanRecordSnapshot> BanRecordsSnapshot()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				return new List<BanRecordSnapshot>();
			}
			return (from record in Instance._banRecords.Values.OrderByDescending((BanRecord record) => record.CreatedUtc).ThenBy<BanRecord, string>((BanRecord record) => record.DisplayName, StringComparer.OrdinalIgnoreCase)
				select new BanRecordSnapshot
				{
					Key = record.Key,
					SteamId = record.SteamId,
					DisplayName = record.DisplayName,
					Reason = record.Reason,
					LastSeenName = record.LastSeenName,
					CreatedUtc = record.CreatedUtc
				}).ToList();
		}

		public static int PendingEnforcementCount()
		{
			return Instance?._pendingPhotonEnforcement.Count ?? 0;
		}

		public static Dictionary<ulong, string> SteamLobbySnapshot()
		{
			Dictionary<ulong, string> dictionary = new Dictionary<ulong, string>();
			if ((Object)(object)Instance == (Object)null)
			{
				return dictionary;
			}
			foreach (KeyValuePair<ulong, string> steamLobbyMember in Instance._steamLobbyMembers)
			{
				dictionary[steamLobbyMember.Key] = steamLobbyMember.Value;
			}
			return dictionary;
		}

		public static bool IsSteamIdBanned(ulong steamId)
		{
			if ((Object)(object)Instance == (Object)null || steamId == 0)
			{
				return false;
			}
			return Instance._banRecords.ContainsKey(PrefixSteam(steamId));
		}

		private bool IsSteam64Banned(string sidText)
		{
			ulong result;
			return ulong.TryParse(sidText, out result) && IsSteamIdBanned(result);
		}

		public override void OnJoinedRoom()
		{
			((MonoBehaviourPunCallbacks)this).OnJoinedRoom();
			_playerCache.Clear();
			((MonoBehaviour)this).StartCoroutine(DelayedScan());
		}

		private IEnumerator DelayedScan()
		{
			yield return (object)new WaitForSecondsRealtime(1f);
			ForceRefreshAll();
		}

		public override void OnPlayerEnteredRoom(Player newPlayer)
		{
			((MonoBehaviourPunCallbacks)this).OnPlayerEnteredRoom(newPlayer);
			if (VerboseLogs)
			{
				Debug.Log((object)$"[RepoBan] Player entered: {newPlayer.NickName} (Actor: {newPlayer.ActorNumber})");
			}
			string text = ResolveSteam64For(newPlayer);
			TouchBanRecord(text, newPlayer.NickName);
			if (IsSteam64Banned(text))
			{
				Debug.Log((object)("[RepoBan] Immediately detected banned player: " + newPlayer.NickName));
				EnforceKick(newPlayer, text, "player joined");
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(DelayedCheck(newPlayer));
			}
		}

		public override void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps)
		{
			((MonoBehaviourPunCallbacks)this).OnPlayerPropertiesUpdate(targetPlayer, changedProps);
			if (targetPlayer != null)
			{
				PlayerInfo orCreatePlayerInfo = GetOrCreatePlayerInfo(targetPlayer);
				orCreatePlayerInfo.NickName = targetPlayer.NickName;
				orCreatePlayerInfo.ActorNumber = targetPlayer.ActorNumber;
				orCreatePlayerInfo.LastSeenUtc = DateTime.UtcNow;
				string text = ExtractSteam64FromCustomProps(targetPlayer, changedProps);
				if (string.IsNullOrWhiteSpace(text))
				{
					text = ResolveSteam64For(targetPlayer);
				}
				if (!string.IsNullOrWhiteSpace(text))
				{
					orCreatePlayerInfo.SteamId = text;
					TouchBanRecord(text, targetPlayer.NickName);
				}
				if (!targetPlayer.IsLocal && IsSteam64Banned(orCreatePlayerInfo.SteamId))
				{
					EnforceKick(targetPlayer, orCreatePlayerInfo.SteamId, "player properties update");
				}
			}
		}

		private IEnumerator DelayedCheck(Player player)
		{
			yield return (object)new WaitForSecondsRealtime(3f);
			if (player != null && PhotonNetwork.PlayerList.Contains(player))
			{
				string sidText = ResolveSteam64For(player);
				TouchBanRecord(sidText, player.NickName);
				if (IsSteam64Banned(sidText))
				{
					Debug.Log((object)("[RepoBan] Delayed detection of banned player: " + player.NickName));
					EnforceKick(player, sidText, "delayed join check");
				}
			}
		}

		public override void OnPlayerLeftRoom(Player otherPlayer)
		{
			((MonoBehaviourPunCallbacks)this).OnPlayerLeftRoom(otherPlayer);
			((MonoBehaviour)this).StartCoroutine(DelayedCacheCleanup(otherPlayer.ActorNumber));
		}

		private IEnumerator DelayedCacheCleanup(int actorNumber)
		{
			yield return (object)new WaitForSecondsRealtime(30f);
			_playerCache.Remove(actorNumber);
		}

		private bool EnforceKick(Player target, string id, string reasonContext)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			if (target == null || target.IsLocal)
			{
				return false;
			}
			if (!PhotonNetwork.IsMasterClient || !PhotonNetwork.InRoom)
			{
				return false;
			}
			Debug.Log((object)$"[RepoBan] Enforcing kick on {target.NickName} (Steam64: {id}, Actor: {target.ActorNumber}, Context: {reasonContext}).");
			PhotonNetwork.RemoveRPCs(target);
			PhotonNetwork.DestroyPlayerObjects(target);
			RaiseEventOptions val = new RaiseEventOptions();
			val.TargetActors = new int[1] { target.ActorNumber };
			PhotonNetwork.RaiseEvent((byte)199, (object)null, val, SendOptions.SendReliable);
			bool flag = PhotonNetwork.CloseConnection(target);
			Debug.Log((object)$"[RepoBan] Master closed connection for {target.ActorNumber}/{id}: {flag}");
			return flag;
		}

		private static DateTime ParseStoredUtc(string raw)
		{
			if (DateTime.TryParse(raw, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out var result))
			{
				return result;
			}
			return DateTime.UtcNow;
		}

		private void SaveLocal()
		{
			try
			{
				SaveModel saveModel = new SaveModel
				{
					keys = _banRecords.Keys.OrderBy<string, string>((string key) => key, StringComparer.OrdinalIgnoreCase).ToList(),
					records = (from record in _banRecords.Values.OrderBy<BanRecord, string>((BanRecord record) => record.Key, StringComparer.OrdinalIgnoreCase)
						select new BanRecordModel
						{
							steamId = record.SteamId.ToString(),
							displayName = record.DisplayName,
							reason = record.Reason,
							lastSeenName = record.LastSeenName,
							createdUtc = record.CreatedUtc.ToString("O", CultureInfo.InvariantCulture)
						}).ToList()
				};
				string contents = JsonConvert.SerializeObject((object)saveModel, (Formatting)1);
				string path = Path.GetDirectoryName(SavePath) ?? Paths.ConfigPath;
				Directory.CreateDirectory(path);
				File.WriteAllText(SavePath, contents);
				Debug.Log((object)$"[RepoBan] Saved {saveModel.records.Count} local steam bans to {SavePath}");
			}
			catch (Exception arg)
			{
				Debug.LogWarning((object)$"[RepoBan] SaveLocal failed: {arg}");
			}
		}

		private void LoadLocal()
		{
			try
			{
				_banRecords.Clear();
				if (!File.Exists(SavePath))
				{
					return;
				}
				string text = File.ReadAllText(SavePath);
				SaveModel saveModel = JsonConvert.DeserializeObject<SaveModel>(text);
				if (saveModel?.records != null)
				{
					foreach (BanRecordModel record in saveModel.records)
					{
						if (ulong.TryParse(record.steamId, out var result) && result != 0)
						{
							string key = PrefixSteam(result);
							_banRecords[key] = new BanRecord
							{
								Key = key,
								SteamId = result,
								DisplayName = NormalizeDisplayName(record.displayName),
								Reason = NormalizeReason(record.reason),
								LastSeenName = NormalizeDisplayName(record.lastSeenName),
								CreatedUtc = ParseStoredUtc(record.createdUtc)
							};
						}
					}
				}
				if (saveModel?.keys != null)
				{
					foreach (string key3 in saveModel.keys)
					{
						if (!string.IsNullOrWhiteSpace(key3) && key3.StartsWith("steam:", StringComparison.OrdinalIgnoreCase) && ulong.TryParse(key3.Replace("steam:", string.Empty), out var result2) && result2 != 0)
						{
							string key2 = PrefixSteam(result2);
							if (!_banRecords.ContainsKey(key2))
							{
								_banRecords[key2] = new BanRecord
								{
									Key = key2,
									SteamId = result2,
									CreatedUtc = DateTime.UtcNow
								};
							}
						}
					}
				}
				Debug.Log((object)$"[RepoBan] Loaded {_banRecords.Count} local steam bans from {SavePath}");
			}
			catch (Exception arg)
			{
				Debug.LogWarning((object)$"[RepoBan] LoadLocal failed: {arg}");
			}
		}

		public static void DumpDebugInfo()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Debug.Log((object)"[RepoBan] Manager not initialized");
				return;
			}
			Debug.Log((object)"[RepoBan] === DEBUG INFO ===");
			Debug.Log((object)$"[RepoBan] Local steam keys: {Instance._banRecords.Count}");
			foreach (BanRecord item in Instance._banRecords.Values.OrderBy<BanRecord, string>((BanRecord record) => record.Key, StringComparer.OrdinalIgnoreCase))
			{
				Debug.Log((object)("[RepoBan]   - " + item.Key + " | Name: '" + item.DisplayName + "' | Note: '" + item.Reason + "' | LastSeen: '" + item.LastSeenName + "'"));
			}
			Debug.Log((object)$"[RepoBan] Steam lobby members: {Instance._steamLobbyMembers.Count}");
			foreach (KeyValuePair<ulong, string> steamLobbyMember in Instance._steamLobbyMembers)
			{
				Debug.Log((object)$"[RepoBan]   - {steamLobbyMember.Value} ({steamLobbyMember.Key})");
			}
			Debug.Log((object)$"[RepoBan] Pending enforcement: {Instance._pendingPhotonEnforcement.Count}");
			foreach (ulong item2 in Instance._pendingPhotonEnforcement.OrderBy((ulong value) => value))
			{
				Debug.Log((object)$"[RepoBan]   - {item2}");
			}
			Debug.Log((object)$"[RepoBan] Cached players: {Instance._playerCache.Count}");
			foreach (KeyValuePair<int, PlayerInfo> item3 in Instance._playerCache)
			{
				PlayerInfo value2 = item3.Value;
				Debug.Log((object)$"[RepoBan]   Actor{item3.Key}: {value2.NickName} | Steam64: '{value2.SteamId}'");
			}
			Debug.Log((object)$"[RepoBan] Current Photon players: {PhotonNetwork.PlayerList.Length}");
			Player[] playerList = PhotonNetwork.PlayerList;
			foreach (Player val in playerList)
			{
				string text = Instance.ResolveSteam64For(val) ?? "Unknown";
				bool flag = Instance.IsSteam64Banned(text);
				Debug.Log((object)$"[RepoBan]   {val.NickName} | Steam64: '{text}' | Banned: {flag}");
			}
		}
	}
	[HarmonyPatch(typeof(NetworkManager), "BanPlayer")]
	public static class Patch_NetworkManager_BanPlayer
	{
		private static void Postfix(PlayerAvatar _playerAvatar)
		{
			try
			{
				if (!((Object)(object)_playerAvatar?.photonView == (Object)null))
				{
					int ownerActorNr = _playerAvatar.photonView.OwnerActorNr;
					Room currentRoom = PhotonNetwork.CurrentRoom;
					Player val = ((currentRoom != null) ? currentRoom.GetPlayer(ownerActorNr, false) : null);
					if (val == null)
					{
						Debug.LogWarning((object)$"[RepoBan] Could not resolve Player for actor {ownerActorNr}");
						return;
					}
					Debug.Log((object)("[RepoBan] NetworkManager.BanPlayer called for " + val.NickName + " (steam-only)"));
					RepoBanManager.BanPlayer(val);
				}
			}
			catch (Exception arg)
			{
				Debug.LogWarning((object)$"[RepoBan] BanPlayer postfix failed: {arg}");
			}
		}
	}
	[HarmonyPatch(typeof(MenuCursor), "Show")]
	public static class Patch_MenuCursor_Show
	{
		private static bool Prefix()
		{
			return !RepoBanEnforcerPlugin.WantsExclusiveCursor;
		}
	}
	[HarmonyPatch(typeof(CursorManager), "Unlock")]
	public static class Patch_CursorManager_Unlock
	{
		private static bool Prefix()
		{
			return !RepoBanEnforcerPlugin.WantsExclusiveCursor;
		}
	}
	internal static class SteamLobbyGate
	{
		private static bool _registered;

		public static void EnsureRegistered()
		{
			if (_registered)
			{
				return;
			}
			_registered = true;
			try
			{
				SteamMatchmaking.OnLobbyMemberJoined += OnLobbyMemberJoined;
				SteamMatchmaking.OnLobbyMemberLeave += OnLobbyMemberLeft;
				Debug.Log((object)"[RepoBan] SteamLobbyGate registered");
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[RepoBan] SteamLobbyGate registration failed: " + ex.Message));
				_registered = false;
			}
		}

		private static void OnLobbyMemberJoined(Lobby lobby, Friend friend)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				RepoBanManager.Instance?.RefreshSteamLobbyMap();
				if ((Object)(object)SteamManager.instance == (Object)null)
				{
					return;
				}
				SteamId id = ((Lobby)(ref SteamManager.instance.currentLobby)).Id;
				if (((SteamId)(ref id)).IsValid && SteamId.op_Implicit(((Lobby)(ref lobby)).Id) == SteamId.op_Implicit(((Lobby)(ref SteamManager.instance.currentLobby)).Id) && ((Lobby)(ref SteamManager.instance.currentLobby)).IsOwnedBy(SteamClient.SteamId))
				{
					ulong value = friend.Id.Value;
					if (RepoBanManager.IsSteamIdBanned(value))
					{
						RepoBanManager.Instance?.ForceRefreshAll();
						Debug.Log((object)$"[RepoBan] Banned Steam lobby member detected ({value}). Waiting for Photon resolution so the host can remove them cleanly.");
					}
				}
			}
			catch (Exception ex)
			{
				if (RepoBanManager.VerboseLogs)
				{
					Debug.LogWarning((object)("[RepoBan] SteamLobbyGate.OnLobbyMemberJoined error: " + ex.Message));
				}
			}
		}

		private static void OnLobbyMemberLeft(Lobby lobby, Friend friend)
		{
			RepoBanManager.Instance?.RefreshSteamLobbyMap();
		}
	}
	[BepInPlugin("repo.ban.enforcer", "Repo Ban Enforcer", "2.0.0")]
	public class RepoBanEnforcerPlugin : BaseUnityPlugin
	{
		private enum Tab
		{
			Bans,
			Arcade
		}

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

			public static BuilderDelegate <>9__99_0;

			public static BuilderDelegate <>9__99_1;

			public static Func<Player, int> <>9__138_0;

			public static Func<KeyValuePair<ulong, string>, string> <>9__138_3;

			internal void <Start>b__99_0(Transform parent)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("<size=22><b>BAN LIST</b></size>", (Action)OpenUI, parent, new Vector2(420f, -40f));
				Debug.Log((object)"[RepoBan] MenuLib: added BAN LIST to Escape menu.");
			}

			internal void <Start>b__99_1(Transform parent)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("<size=22><b>BAN LIST</b></size>", (Action)OpenUI, parent, new Vector2(420f, -40f));
				Debug.Log((object)"[RepoBan] MenuLib: added BAN LIST to Lobby menu.");
			}

			internal int <DrawBanTab>b__138_0(Player p)
			{
				return p.ActorNumber;
			}

			internal string <DrawBanTab>b__138_3(KeyValuePair<ulong, string> k)
			{
				return string.IsNullOrWhiteSpace(k.Value) ? k.Key.ToString() : k.Value;
			}
		}

		internal static ManualLogSource LogSrc;

		private Harmony? _harmony;

		private bool _show;

		private Rect _win = new Rect(40f, 140f, 980f, 520f);

		private Vector2 _scrollPlayers;

		private Vector2 _scrollBanned;

		private Vector2 _scrollSteam;

		private string _manualSteamBan = string.Empty;

		private string _manualBanReason = string.Empty;

		private string _playerSearch = string.Empty;

		private string _bannedSearch = string.Empty;

		private string _steamSearch = string.Empty;

		private string _uiStatus = "Ready to enforce Steam bans.";

		private ConfigEntry<KeyCode> _toggleKey = null;

		private ConfigEntry<KeyCode> _debugDumpKey = null;

		private ConfigEntry<bool> _verboseLogsConfig = null;

		private ConfigEntry<bool> _logLocalIdsConfig = null;

		private GUIStyle _winStyle = null;

		private GUIStyle _boxStyle = null;

		private GUIStyle _labelStyle = null;

		private GUIStyle _labelHeaderStyle = null;

		private GUIStyle _buttonStyle = null;

		private GUIStyle _textFieldStyle = null;

		private GUIStyle _tabStyle = null;

		private GUIStyle _tabActiveStyle = null;

		private GUIStyle _thinLabelStyle = null;

		private GUIStyle _verticalScrollbarStyle = null;

		private GUIStyle _verticalScrollbarThumbStyle = null;

		private GUIStyle _horizontalScrollbarStyle = null;

		private GUIStyle _horizontalScrollbarThumbStyle = null;

		private Texture2D _texGlassWin = null;

		private Texture2D _texGlassPanel = null;

		private Texture2D _texBtn = null;

		private Texture2D _texBtnHover = null;

		private Texture2D _texBtnActive = null;

		private Texture2D _texLineRed = null;

		private Texture2D _texWhite = null;

		private Texture2D _texBorder = null;

		private Texture2D _texHighlight = null;

		private Texture2D _shadowBig = null;

		private Texture2D _shadowSmall = null;

		private Texture2D _texCursorHardware = null;

		private Texture2D? _omniIcon;

		private bool _stylesReady;

		private bool _triedIcon;

		private GUIStyle _hiddenBtnStyle = null;

		private readonly Color _cText = new Color(0.98f, 0.99f, 1f, 0.98f);

		private readonly Color _cTextSoft = new Color(0.98f, 0.99f, 1f, 0.85f);

		private readonly Color _cGlass = new Color(0.08f, 0.09f, 0.12f, 0.58f);

		private readonly Color _cGlassPanel = new Color(0.1f, 0.12f, 0.16f, 0.42f);

		private readonly Color _cBorder = new Color(1f, 1f, 1f, 0.08f);

		private readonly Color _cHighlight = new Color(1f, 1f, 1f, 0.06f);

		private readonly Color _cRed = new Color(0.98f, 0.22f, 0.28f, 0.85f);

		private readonly Color _cRedHover = new Color(1f, 0.35f, 0.4f, 0.95f);

		private readonly Color _cRedActive = new Color(0.85f, 0.1f, 0.16f, 0.95f);

		private Tab _activeTab = Tab.Bans;

		private bool _pongInit;

		private bool _pongPaused = true;

		private int _pongLeftScore;

		private int _pongRightScore;

		private float _paddleLeftY = 0.5f;

		private float _paddleRightY = 0.5f;

		private float _ballX = 0.5f;

		private float _ballY = 0.5f;

		private float _ballVX = 0.45f;

		private float _ballVY = 0.33f;

		private const float PADDLE_H = 0.18f;

		private const float PADDLE_W = 0.015f;

		private const float BALL_R = 0.012f;

		private const float PADDLE_SPEED = 0.7f;

		private AudioSource? _pongAudio;

		private AudioClip? _hitClip;

		private bool _cracktroActive = false;

		private float _cracktroStart;

		private float _scrollX;

		private string _scrollMsg = "   Shout out to the R.E.P.O modding Discord and all of the amazing people in there.   We fight for the Users.   I am the Queen of Cursed.   ";

		private AudioSource? _demoAudio;

		private AudioClip? _demoClip;

		private float[] _spec = new float[64];

		private float _vu;

		private float _vuSmoothed;

		private float _bassLevel;

		private float _bassSmoothed;

		private GUIStyle _demoTitleStyle = null;

		private GUIStyle _demoScrollStyle = null;

		private GUIStyle _demoSmallStyle = null;

		private Texture2D _texScanline = null;

		private bool _demoTriedLoad;

		private const string DemoFileName = "omnidemo.mp3";

		private const float UiInputCaptureTime = 0.2f;

		public static RepoBanEnforcerPlugin Instance { get; private set; }

		internal static bool WantsExclusiveCursor => (Object)(object)Instance != (Object)null && Instance._show;

		public static void OpenUI()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = Object.FindObjectOfType<RepoBanEnforcerPlugin>();
			}
			if ((Object)(object)Instance != (Object)null)
			{
				Instance.OpenWindow();
			}
		}

		private void Awake()
		{
			Instance = this;
			((Object)this).hideFlags = (HideFlags)61;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			LogSrc = ((BaseUnityPlugin)this).Logger;
			_toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Input", "ToggleKey", (KeyCode)287, "Key to open or close the ban enforcer.");
			_debugDumpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Input", "DebugDumpKey", (KeyCode)288, "Key to dump debug information to the BepInEx log.");
			_verboseLogsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Logging", "VerboseLogs", false, "Enable extra ban enforcement logging.");
			_logLocalIdsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Logging", "LogLocalIds", false, "Include local player Steam ID details in verbose logs.");
			RepoBanManager.VerboseLogs = _verboseLogsConfig.Value;
			RepoBanManager.LogLocalIds = _logLocalIdsConfig.Value;
			LoadOmniIcon();
			EnsureAudio();
		}

		private IEnumerator Start()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[RepoBan] Plugin starting…");
			yield return null;
			yield return null;
			try
			{
				_harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				RepoBanPatcher.Apply(_harmony);
				RepoBanManager.EnsureExists();
				SteamLobbyGate.EnsureRegistered();
			}
			catch (Exception e2)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)$"[RepoBan] Init error: {e2}");
			}
			try
			{
				if (SteamClient.IsValid)
				{
					SteamId steamId2 = SteamClient.SteamId;
					string steamId = ((object)(SteamId)(ref steamId2)).ToString();
					if (!string.IsNullOrEmpty(steamId))
					{
						if (PhotonNetwork.AuthValues == null)
						{
							PhotonNetwork.AuthValues = new AuthenticationValues();
						}
						PhotonNetwork.AuthValues.UserId = steamId;
					}
				}
			}
			catch
			{
			}
			try
			{
				object obj2 = <>c.<>9__99_0;
				if (obj2 == null)
				{
					BuilderDelegate val = delegate(Transform parent)
					{
						//IL_002c: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("<size=22><b>BAN LIST</b></size>", (Action)OpenUI, parent, new Vector2(420f, -40f));
						Debug.Log((object)"[RepoBan] MenuLib: added BAN LIST to Escape menu.");
					};
					<>c.<>9__99_0 = val;
					obj2 = (object)val;
				}
				MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj2);
				object obj3 = <>c.<>9__99_1;
				if (obj3 == null)
				{
					BuilderDelegate val2 = delegate(Transform parent)
					{
						//IL_002c: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("<size=22><b>BAN LIST</b></size>", (Action)OpenUI, parent, new Vector2(420f, -40f));
						Debug.Log((object)"[RepoBan] MenuLib: added BAN LIST to Lobby menu.");
					};
					<>c.<>9__99_1 = val2;
					obj3 = (object)val2;
				}
				MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj3);
			}
			catch (Exception e)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("[RepoBan] MenuLib register failed: " + e.Message));
			}
		}

		private void Update()
		{
			//IL_0027: 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)
			RepoBanManager.VerboseLogs = _verboseLogsConfig.Value;
			RepoBanManager.LogLocalIds = _logLocalIdsConfig.Value;
			if (Input.GetKeyDown(_toggleKey.Value))
			{
				if (_show)
				{
					CloseWindow();
				}
				else
				{
					OpenWindow();
				}
				return;
			}
			if (_show)
			{
				RefreshUiInputCapture();
				if (Input.GetKeyDown((KeyCode)27))
				{
					CloseWindow();
					return;
				}
			}
			if (Input.GetKeyDown(_debugDumpKey.Value))
			{
				RepoBanManager.DumpDebugInfo();
			}
			if (_show && _activeTab == Tab.Arcade && !_pongPaused)
			{
				if (!_pongInit)
				{
					InitPong();
				}
				float dt = Mathf.Clamp(Time.unscaledDeltaTime, 0f, 0.05f);
				StepPong(dt);
			}
			if (!_cracktroActive || !((Object)(object)_demoAudio != (Object)null) || !((Object)(object)_demoAudio.clip != (Object)null))
			{
				return;
			}
			try
			{
				_demoAudio.GetSpectrumData(_spec, 0, (FFTWindow)5);
				float num = 0f;
				int num2 = Mathf.Min(16, _spec.Length);
				for (int i = 0; i < num2; i++)
				{
					num += _spec[i];
				}
				_vu = Mathf.Clamp01(num * 18f);
				_vuSmoothed = Mathf.Lerp(_vuSmoothed, _vu, 0.2f);
				float num3 = 0f;
				int num4 = Mathf.Min(4, _spec.Length);
				for (int j = 0; j < num4; j++)
				{
					num3 += _spec[j];
				}
				_bassLevel = Mathf.Clamp01(num3 * 2f);
				_bassSmoothed = Mathf.Lerp(_bassSmoothed, _bassLevel, 0.15f);
			}
			catch
			{
			}
		}

		private void SetUiStatus(string message)
		{
			if (!string.IsNullOrWhiteSpace(message))
			{
				_uiStatus = message.Trim();
			}
		}

		private void OpenWindow()
		{
			_show = true;
			_pongPaused = _activeTab != Tab.Arcade;
			RefreshUiInputCapture();
			SetUiStatus("Ban enforcer opened.");
		}

		private void RefreshUiInputCapture()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)CursorManager.instance != (Object)null)
			{
				CursorManager.instance.unlockTimer = -1234f;
			}
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
			if ((Object)(object)_texCursorHardware != (Object)null)
			{
				Cursor.SetCursor(_texCursorHardware, new Vector2((float)((Texture)_texCursorHardware).width * 0.5f, (float)((Texture)_texCursorHardware).height * 0.5f), (CursorMode)0);
			}
			else
			{
				Cursor.SetCursor((Texture2D)null, Vector2.zero, (CursorMode)0);
			}
			SuppressGameCursor();
			GameDirector instance = GameDirector.instance;
			if (instance != null)
			{
				instance.SetDisableInput(0.2f);
			}
			PlayerController instance2 = PlayerController.instance;
			if ((Object)(object)instance2 != (Object)null)
			{
				instance2.InputDisable(0.2f);
				instance2.InputDirection = Vector3.zero;
				instance2.CanInteract = false;
				if ((Object)(object)instance2.cameraAim != (Object)null)
				{
					instance2.cameraAim.OverrideAimStop();
					instance2.cameraAim.OverridePlayerAimDisable(false);
				}
			}
		}

		private void ReleaseUiInputCapture()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			Cursor.SetCursor((Texture2D)null, Vector2.zero, (CursorMode)0);
			Cursor.visible = false;
			Cursor.lockState = (CursorLockMode)1;
			if ((Object)(object)CursorManager.instance != (Object)null)
			{
				CursorManager.instance.unlockTimer = -1234f;
			}
			RestoreGameCursor();
			PlayerController instance = PlayerController.instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.InputDirection = Vector3.zero;
				if ((Object)(object)instance.cameraAim != (Object)null)
				{
					instance.cameraAim.OverridePlayerAimDisableReset();
				}
			}
		}

		private void SuppressGameCursor()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)CursorManager.instance != (Object)null)
			{
				CursorManager.instance.unlockTimer = -1234f;
			}
			if ((Object)(object)MenuCursor.instance != (Object)null)
			{
				((Behaviour)MenuCursor.instance).enabled = false;
				MenuCursor.instance.showTimer = 0f;
				MenuCursor.instance.overridePosTimer = 0f;
				if ((Object)(object)MenuCursor.instance.mesh != (Object)null)
				{
					MenuCursor.instance.mesh.SetActive(false);
				}
				((Component)MenuCursor.instance).transform.localScale = Vector3.zero;
			}
		}

		private void RestoreGameCursor()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MenuCursor.instance != (Object)null)
			{
				((Behaviour)MenuCursor.instance).enabled = true;
				MenuCursor.instance.showTimer = 0f;
				MenuCursor.instance.overridePosTimer = 0f;
				if ((Object)(object)MenuCursor.instance.mesh != (Object)null)
				{
					MenuCursor.instance.mesh.SetActive(false);
				}
				((Component)MenuCursor.instance).transform.localScale = Vector3.zero;
			}
		}

		private bool IsPauseLike()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			return Time.timeScale == 0f || (int)Cursor.lockState != 1;
		}

		private Texture2D MakeSolid(int w, int h, Color c)
		{
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			Color[] array = (Color[])(object)new Color[w * h];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = c;
			}
			Texture2D val = new Texture2D(w, h, (TextureFormat)4, false);
			val.SetPixels(array);
			val.Apply();
			((Texture)val).wrapMode = (TextureWrapMode)1;
			return val;
		}

		private Texture2D MakeVerticalGradient(int w, int h, Color top, Color bottom)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0026: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(w, h, (TextureFormat)4, false);
			for (int i = 0; i < h; i++)
			{
				float num = (float)i / Mathf.Max(1f, (float)h - 1f);
				Color val2 = Color.Lerp(top, bottom, num);
				for (int j = 0; j < w; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			val.Apply();
			((Texture)val).wrapMode = (TextureWrapMode)1;
			return val;
		}

		private Texture2D MakeRadialShadow(int size, float softness = 1.6f, float alpha = 0.35f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0013: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			Vector2 val2 = new Vector2((float)(size - 1), (float)(size - 1)) * 0.5f;
			float magnitude = ((Vector2)(ref val2)).magnitude;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num = Vector2.Distance(new Vector2((float)j, (float)i), val2) / magnitude;
					float num2 = Mathf.Pow(Mathf.Clamp01(1f - num), softness) * alpha;
					val.SetPixel(j, i, new Color(0f, 0f, 0f, num2));
				}
			}
			val.Apply();
			((Texture)val).wrapMode = (TextureWrapMode)1;
			return val;
		}

		private Texture2D MakeRadialTexture(int size, Color innerColor, Color outerColor, float softness = 1.8f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0013: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			Vector2 val2 = new Vector2((float)(size - 1), (float)(size - 1)) * 0.5f;
			float magnitude = ((Vector2)(ref val2)).magnitude;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num = Vector2.Distance(new Vector2((float)j, (float)i), val2) / magnitude;
					float num2 = Mathf.Pow(Mathf.Clamp01(num), softness);
					val.SetPixel(j, i, Color.Lerp(innerColor, outerColor, num2));
				}
			}
			val.Apply();
			((Texture)val).wrapMode = (TextureWrapMode)1;
			return val;
		}

		private Texture2D MakeCursorTexture(int size)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_005a: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			((Object)val).hideFlags = (HideFlags)61;
			Vector2 val2 = new Vector2((float)(size - 1), (float)(size - 1)) * 0.5f;
			float num = (float)size * 0.48f;
			float num2 = (float)size * 0.16f;
			Color val3 = default(Color);
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num3 = Vector2.Distance(new Vector2((float)j, (float)i), val2);
					((Color)(ref val3))..ctor(0f, 0f, 0f, 0f);
					if (num3 <= num)
					{
						float num4 = 1f - Mathf.Clamp01(num3 / num);
						val3 = Color.Lerp(val3, new Color(1f, 0.18f, 0.24f, num4 * 0.75f), num4);
					}
					if (num3 <= num2)
					{
						float num5 = 1f - Mathf.Clamp01(num3 / num2);
						val3 = Color.Lerp(val3, new Color(1f, 1f, 1f, 0.95f), num5);
					}
					val.SetPixel(j, i, val3);
				}
			}
			val.Apply();
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			return val;
		}

		private void EnsureStyles()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: 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_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: 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_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Expected O, but got Unknown
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Expected O, but got Unknown
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Expected O, but got Unknown
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Expected O, but got Unknown
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Expected O, but got Unknown
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Expected O, but got Unknown
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Expected O, but got Unknown
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Expected O, but got Unknown
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Expected O, but got Unknown
			//IL_051b: 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_052d: Expected O, but got Unknown
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0572: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b8: Expected O, but got Unknown
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Expected O, but got Unknown
			//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: 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_0623: Expected O, but got Unknown
			//IL_062e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0633: Unknown result type (might be due to invalid IL or missing references)
			//IL_0645: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_067d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0682: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Expected O, but got Unknown
			//IL_068d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_069c: Expected O, but got Unknown
			//IL_069d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ac: Expected O, but got Unknown
			//IL_06b2: Expected O, but got Unknown
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0704: Unknown result type (might be due to invalid IL or missing references)
			//IL_070c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0711: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Expected O, but got Unknown
			//IL_071c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0721: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Expected O, but got Unknown
			//IL_0731: Expected O, but got Unknown
			//IL_073c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0741: Unknown result type (might be due to invalid IL or missing references)
			//IL_0753: Unknown result type (might be due to invalid IL or missing references)
			//IL_0765: Unknown result type (might be due to invalid IL or missing references)
			//IL_0777: Unknown result type (might be due to invalid IL or missing references)
			//IL_0783: Unknown result type (might be due to invalid IL or missing references)
			//IL_078b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0790: Unknown result type (might be due to invalid IL or missing references)
			//IL_079a: Expected O, but got Unknown
			//IL_079b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07aa: Expected O, but got Unknown
			//IL_07ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ba: Expected O, but got Unknown
			//IL_07c0: Expected O, but got Unknown
			//IL_07cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0806: Unknown result type (might be due to invalid IL or missing references)
			//IL_0812: Unknown result type (might be due to invalid IL or missing references)
			//IL_081a: Unknown result type (might be due to invalid IL or missing references)
			//IL_081f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0829: Expected O, but got Unknown
			//IL_082a: Unknown result type (might be due to invalid IL or missing references)
			//IL_082f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Expected O, but got Unknown
			//IL_083f: Expected O, but got Unknown
			//IL_0846: Unknown result type (might be due to invalid IL or missing references)
			//IL_0850: Expected O, but got Unknown
			//IL_0857: Unknown result type (might be due to invalid IL or missing references)
			//IL_0861: Expected O, but got Unknown
			//IL_086c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0871: Unknown result type (might be due to invalid IL or missing references)
			//IL_0882: Unknown result type (might be due to invalid IL or missing references)
			//IL_089c: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0908: Unknown result type (might be due to invalid IL or missing references)
			//IL_0913: Unknown result type (might be due to invalid IL or missing references)
			//IL_0918: Unknown result type (might be due to invalid IL or missing references)
			//IL_0922: Expected O, but got Unknown
			//IL_0923: Unknown result type (might be due to invalid IL or missing references)
			//IL_0928: Unknown result type (might be due to invalid IL or missing references)
			//IL_0932: Expected O, but got Unknown
			//IL_0933: Unknown result type (might be due to invalid IL or missing references)
			//IL_0938: Unknown result type (might be due to invalid IL or missing references)
			//IL_0942: Expected O, but got Unknown
			//IL_0948: Expected O, but got Unknown
			if (!_stylesReady)
			{
				_texGlassWin = MakeVerticalGradient(4, 64, new Color(_cGlass.r + 0.02f, _cGlass.g + 0.02f, _cGlass.b + 0.03f, _cGlass.a + 0.04f), new Color(_cGlass.r, _cGlass.g, _cGlass.b, _cGlass.a));
				_texGlassPanel = MakeVerticalGradient(4, 64, new Color(_cGlassPanel.r + 0.02f, _cGlassPanel.g + 0.02f, _cGlassPanel.b + 0.03f, _cGlassPanel.a + 0.03f), _cGlassPanel);
				_texBorder = MakeSolid(2, 2, _cBorder);
				_texHighlight = MakeSolid(2, 2, _cHighlight);
				_texBtn = MakeVerticalGradient(4, 32, new Color(_cRed.r, _cRed.g, _cRed.b, _cRed.a), new Color(_cRed.r * 0.9f, _cRed.g * 0.9f, _cRed.b * 0.9f, _cRed.a));
				_texBtnHover = MakeVerticalGradient(4, 32, _cRedHover, new Color(_cRedHover.r * 0.88f, _cRedHover.g * 0.88f, _cRedHover.b * 0.88f, _cRedHover.a));
				_texBtnActive = MakeVerticalGradient(4, 32, _cRedActive, new Color(_cRedActive.r * 0.85f, _cRedActive.g * 0.85f, _cRedActive.b * 0.85f, _cRedActive.a));
				_texLineRed = MakeSolid(2, 2, new Color(1f, 0.13f, 0.18f, 0.7f));
				_texWhite = MakeSolid(2, 2, new Color(1f, 1f, 1f, 0.92f));
				_texCursorHardware = MakeCursorTexture(32);
				_shadowBig = MakeRadialShadow(256, 2f, 0.32f);
				_shadowSmall = MakeRadialShadow(128, 2.2f, 0.25f);
				_texScanline = MakeVerticalGradient(2, 4, new Color(1f, 1f, 1f, 0.06f), new Color(1f, 1f, 1f, 0f));
				GUIStyle val = new GUIStyle(GUI.skin.window);
				val.normal.background = _texGlassWin;
				val.normal.textColor = _cText;
				val.active.background = _texGlassWin;
				val.active.textColor = _cText;
				val.onNormal.background = _texGlassWin;
				val.onNormal.textColor = _cText;
				val.onActive.background = _texGlassWin;
				val.onActive.textColor = _cText;
				val.border = new RectOffset(12, 12, 24, 14);
				val.padding = new RectOffset(12, 12, 32, 12);
				val.margin = new RectOffset(0, 0, 0, 0);
				val.fontStyle = (FontStyle)1;
				val.richText = true;
				val.alignment = (TextAnchor)0;
				_winStyle = val;
				GUIStyle val2 = new GUIStyle(GUI.skin.box);
				val2.normal.background = _texGlassPanel;
				val2.normal.textColor = _cText;
				val2.active.background = _texGlassPanel;
				val2.active.textColor = _cText;
				val2.margin = new RectOffset(2, 2, 2, 2);
				val2.padding = new RectOffset(10, 10, 8, 8);
				val2.richText = true;
				_boxStyle = val2;
				GUIStyle val3 = new GUIStyle(GUI.skin.label);
				val3.normal.textColor = _cText;
				val3.richText = true;
				_labelStyle = val3;
				GUIStyle val4 = new GUIStyle(_labelStyle);
				val4.normal.textColor = _cTextSoft;
				val4.fontSize = Mathf.RoundToInt((float)GUI.skin.label.fontSize * 0.95f);
				_thinLabelStyle = val4;
				_labelHeaderStyle = new GUIStyle(_labelStyle)
				{
					fontStyle = (FontStyle)1
				};
				GUIStyle val5 = new GUIStyle(GUI.skin.button);
				val5.normal.background = _texBtn;
				val5.normal.textColor = Color.white;
				val5.hover.background = _texBtnHover;
				val5.hover.textColor = Color.white;
				val5.active.background = _texBtnActive;
				val5.active.textColor = Color.white;
				val5.padding = new RectOffset(12, 12, 8, 10);
				val5.richText = true;
				_buttonStyle = val5;
				GUIStyle val6 = new GUIStyle(GUI.skin.textField);
				val6.normal.background = _texGlassPanel;
				val6.normal.textColor = _cText;
				val6.focused.background = _texGlassPanel;
				val6.focused.textColor = _cText;
				_textFieldStyle = val6;
				GUIStyle val7 = new GUIStyle(GUI.skin.verticalScrollbar);
				val7.normal.background = _texGlassPanel;
				val7.hover.background = _texGlassPanel;
				val7.active.background = _texGlassPanel;
				val7.fixedWidth = 18f;
				val7.stretchHeight = true;
				val7.margin = new RectOffset(6, 2, 2, 2);
				val7.border = new RectOffset(6, 6, 6, 6);
				val7.padding = new RectOffset(2, 2, 2, 2);
				_verticalScrollbarStyle = val7;
				GUIStyle val8 = new GUIStyle(GUI.skin.verticalScrollbarThumb);
				val8.normal.background = _texBtn;
				val8.hover.background = _texBtnHover;
				val8.active.background = _texBtnActive;
				val8.fixedWidth = 14f;
				val8.stretchHeight = true;
				val8.border = new RectOffset(6, 6, 6, 6);
				val8.margin = new RectOffset(0, 0, 2, 2);
				_verticalScrollbarThumbStyle = val8;
				GUIStyle val9 = new GUIStyle(GUI.skin.horizontalScrollbar);
				val9.normal.background = _texGlassPanel;
				val9.hover.background = _texGlassPanel;
				val9.active.background = _texGlassPanel;
				val9.fixedHeight = 12f;
				val9.stretchWidth = true;
				val9.margin = new RectOffset(2, 2, 6, 2);
				val9.border = new RectOffset(6, 6, 6, 6);
				val9.padding = new RectOffset(2, 2, 2, 2);
				_horizontalScrollbarStyle = val9;
				GUIStyle val10 = new GUIStyle(GUI.skin.horizontalScrollbarThumb);
				val10.normal.background = _texBtn;
				val10.hover.background = _texBtnHover;
				val10.active.background = _texBtnActive;
				val10.fixedHeight = 10f;
				val10.stretchWidth = true;
				val10.border = new RectOffset(6, 6, 6, 6);
				val10.margin = new RectOffset(2, 2, 0, 0);
				_horizontalScrollbarThumbStyle = val10;
				_tabStyle = new GUIStyle(_buttonStyle);
				_tabActiveStyle = new GUIStyle(_buttonStyle);
				GUIStyle val11 = new GUIStyle(GUI.skin.button);
				val11.normal.background = Texture2D.blackTexture;
				val11.normal.textColor = new Color(0f, 0f, 0f, 0f);
				val11.hover.background = Texture2D.blackTexture;
				val11.hover.textColor = new Color(0f, 0f, 0f, 0f);
				val11.active.background = Texture2D.blackTexture;
				val11.active.textColor = new Color(0f, 0f, 0f, 0f);
				val11.border = new RectOffset(0, 0, 0, 0);
				val11.margin = new RectOffset(0, 0, 0, 0);
				val11.padding = new RectOffset(0, 0, 0, 0);
				_hiddenBtnStyle = val11;
				_hiddenBtnStyle.normal.background = null;
				_hiddenBtnStyle.hover.background = null;
				_hiddenBtnStyle.active.background = null;
				_stylesReady = true;
			}
		}

		private void LoadOmniIcon()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			if (_triedIcon)
			{
				return;
			}
			_triedIcon = true;
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
				string text = Path.Combine(directoryName ?? "", "omni.png");
				if (!File.Exists(text))
				{
					text = Path.Combine(Paths.ConfigPath, "omni.png");
				}
				if (File.Exists(text))
				{
					byte[] array = File.ReadAllBytes(text);
					_omniIcon = new Texture2D(2, 2, (TextureFormat)4, false);
					ImageConversion.LoadImage(_omniIcon, array, false);
					_omniIcon.Apply();
					((BaseUnityPlugin)this).Logger.LogInfo((object)("[RepoBan] Loaded icon: " + text));
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)"[RepoBan] omni.png not found (optional).");
				}
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("[RepoBan] Icon load failed: " + ex.Message));
			}
		}

		private void EnsureAudio()
		{
			if (!((Object)(object)_pongAudio != (Object)null))
			{
				_pongAudio = ((Component)this).gameObject.AddComponent<AudioSource>();
				_pongAudio.playOnAwake = false;
				_pongAudio.spatialBlend = 0f;
				_pongAudio.volume = 0.25f;
				_hitClip = CreateClickClip(0.035f, 920f);
			}
		}

		private AudioClip CreateClickClip(float duration, float frequency)
		{
			int num = 44100;
			int num2 = Mathf.CeilToInt(duration * (float)num);
			AudioClip val = AudioClip.Create("pong_click", num2, 1, num, false);
			float[] array = new float[num2];
			for (int i = 0; i < num2; i++)
			{
				float num3 = (float)i / (float)num;
				float num4 = Mathf.Exp(-24f * num3);
				array[i] = Mathf.Sin(MathF.PI * 2f * frequency * num3) * num4 * 0.35f;
			}
			val.SetData(array, 0);
			return val;
		}

		private void PlayHitSfx()
		{
			if ((Object)(object)_pongAudio != (Object)null && (Object)(object)_hitClip != (Object)null)
			{
				_pongAudio.PlayOneShot(_hitClip, 0.9f);
			}
		}

		private void StartCracktro()
		{
			_cracktroActive = true;
			_cracktroStart = Time.unscaledTime;
			_scrollX = 0f;
			_vu = (_vuSmoothed = 0f);
			_bassLevel = (_bassSmoothed = 0f);
			if ((Object)(object)_demoAudio == (Object)null)
			{
				_demoAudio = ((Component)this).gameObject.AddComponent<AudioSource>();
				_demoAudio.playOnAwake = false;
				_demoAudio.loop = true;
				_demoAudio.spatialBlend = 0f;
				_demoAudio.volume = 0.92f;
			}
			if (!_demoTriedLoad)
			{
				((MonoBehaviour)this).StartCoroutine(LoadDemoAudioAndPlay());
				return;
			}
			if ((Object)(object)_demoClip == (Object)null)
			{
				_demoClip = CreateDemoFallbackClip();
			}
			_demoAudio.clip = _demoClip;
			_demoAudio.Play();
		}

		private void DrawRotatingCubes(Vector2 center, Vector2 textSize, float time, float bassLevel)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			float num = (textSize.x + textSize.y) * 0.3f + bassLevel * 20f;
			float size = 12f + bassLevel * 8f;
			int num2 = 6;
			Vector2 pos = default(Vector2);
			for (int i = 0; i < num2; i++)
			{
				float num3 = (float)i / (float)num2 * 2f * MathF.PI;
				float num4 = 0.8f + bassLevel * 1.2f;
				float num5 = time * num4 + num3;
				((Vector2)(ref pos))..ctor(center.x + Mathf.Cos(num5) * num, center.y + Mathf.Sin(num5) * num * 0.6f);
				float rotation = time * 2f + num3;
				DrawPseudo3DCube(pos, size, rotation, bassLevel);
			}
		}

		private void DrawPseudo3DCube(Vector2 pos, float size, float rotation, float bassLevel)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_00a2: 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_00b1: 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_00c7: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_0112: 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_0129: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: 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_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: 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_0254: 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_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			Color val = Color.Lerp(new Color(0.3f, 0.3f, 0.8f, 0.7f), new Color(1f, 0.2f, 0.8f, 0.9f), bassLevel);
			Color val2 = Color.Lerp(new Color(0.6f, 0.6f, 1f, 0.8f), new Color(1f, 0.8f, 0.2f, 1f), bassLevel);
			float num = size * 0.5f;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(Mathf.Cos(rotation) * num * 0.3f, Mathf.Sin(rotation) * num * 0.3f);
			Rect val4 = default(Rect);
			((Rect)(ref val4))..ctor(pos.x - num + val3.x, pos.y - num + val3.y, size, size);
			GUI.color = new Color(val.r * 0.6f, val.g * 0.6f, val.b * 0.6f, val.a * 0.8f);
			GUI.DrawTexture(val4, (Texture)(object)_texGlassPanel);
			Rect val5 = default(Rect);
			((Rect)(ref val5))..ctor(pos.x - num, pos.y - num, size, size);
			GUI.color = val;
			GUI.DrawTexture(val5, (Texture)(object)_texGlassPanel);
			GUI.color = val2;
			DrawRectBorder(val5, 1f, (Texture)(object)_texBorder);
			GUI.color = new Color(val2.r, val2.g, val2.b, 0.6f);
			Vector2[] array = (Vector2[])(object)new Vector2[4]
			{
				new Vector2(((Rect)(ref val5)).xMin, ((Rect)(ref val5)).yMin),
				new Vector2(((Rect)(ref val5)).xMax, ((Rect)(ref val5)).yMin),
				new Vector2(((Rect)(ref val5)).xMax, ((Rect)(ref val5)).yMax),
				new Vector2(((Rect)(ref val5)).xMin, ((Rect)(ref val5)).yMax)
			};
			Vector2[] array2 = (Vector2[])(object)new Vector2[4]
			{
				new Vector2(((Rect)(ref val4)).xMin, ((Rect)(ref val4)).yMin),
				new Vector2(((Rect)(ref val4)).xMax, ((Rect)(ref val4)).yMin),
				new Vector2(((Rect)(ref val4)).xMax, ((Rect)(ref val4)).yMax),
				new Vector2(((Rect)(ref val4)).xMin, ((Rect)(ref val4)).yMax)
			};
			for (int i = 0; i < 4; i++)
			{
				DrawLine(array[i], array2[i], _texBorder, 1f);
			}
			GUI.color = Color.white;
		}

		private void DrawLine(Vector2 start, Vector2 end, Texture2D tex, float thickness)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_0032: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = end - start;
			Vector2 normalized = ((Vector2)(ref val)).normalized;
			float num = Vector2.Distance(start, end);
			float num2 = Mathf.Atan2(normalized.y, normalized.x) * 57.29578f;
			Vector2 val2 = (start + end) * 0.5f;
			Rect val3 = default(Rect);
			((Rect)(ref val3))..ctor(val2.x - num * 0.5f, val2.y - thickness * 0.5f, num, thickness);
			Matrix4x4 matrix = GUI.matrix;
			GUIUtility.RotateAroundPivot(num2, val2);
			GUI.DrawTexture(val3, (Texture)(object)tex);
			GUI.matrix = matrix;
		}

		private void StopCracktro()
		{
			_cracktroActive = false;
			if ((Object)(object)_demoAudio != (Object)null)
			{
				_demoAudio.Stop();
			}
		}

		private IEnumerator LoadDemoAudioAndPlay()
		{
			_demoTriedLoad = true;
			string path = FindNearbyFile("omnidemo.mp3");
			if (!string.IsNullOrEmpty(path))
			{
				UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip("file://" + path, (AudioType)13);
				try
				{
					yield return req.SendWebRequest();
					if ((int)req.result == 1)
					{
						try
						{
							_demoClip = DownloadHandlerAudioClip.GetContent(req);
						}
						catch
						{
							_demoClip = null;
						}
					}
				}
				finally
				{
					((IDisposable)req)?.Dispose();
				}
			}
			if ((Object)(object)_demoClip == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"[RepoBan] omnidemo.mp3 not found or failed to load; using synth fallback.");
				_demoClip = CreateDemoFallbackClip();
			}
			if ((Object)(object)_demoAudio != (Object)null)
			{
				_demoAudio.clip = _demoClip;
				_demoAudio.Play();
			}
		}

		private void OnDestroy()
		{
			ReleaseUiInputCapture();
			StopCracktro();
			Harmony? harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private string? FindNearbyFile(string filename)
		{
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
				string text = Path.Combine(directoryName ?? "", filename);
				if (File.Exists(text))
				{
					return text;
				}
				string text2 = Path.Combine(Paths.ConfigPath, filename);
				if (File.Exists(text2))
				{
					return text2;
				}
				string text3 = Path.Combine(Application.streamingAssetsPath ?? "", filename);
				if (File.Exists(text3))
				{
					return text3;
				}
			}
			catch
			{
			}
			return null;
		}

		private AudioClip CreateDemoFallbackClip()
		{
			int num = 44100;
			float num2 = 60f;
			int num3 = Mathf.CeilToInt(num2 * (float)num);
			AudioClip val = AudioClip.Create("omnidemo_fallback", num3, 1, num, false);
			float[] array = new float[num3];
			float[] array2 = new float[8] { 110f, 146.83f, 164.81f, 220f, 246.94f, 329.63f, 196f, 174.61f };
			for (int i = 0; i < num3; i++)
			{
				float num4 = (float)i / (float)num;
				float num5 = array2[i / (num / 2) % array2.Length];
				float num6 = Mathf.Sign(Mathf.Sin(MathF.PI * 2f * num5 * num4));
				float num7 = 2f * (num4 * num5 - Mathf.Floor(0.5f + num4 * num5));
				float num8 = Mathf.Clamp01(1f - Mathf.Repeat(num4, 0.5f) * 1.6f);
				float num9 = (num6 * 0.45f + num7 * 0.25f) * num8;
				float num10 = Mathf.Repeat(num4, 0.5f);
				num9 += Mathf.Exp((0f - num10) * 24f) * 0.25f * Mathf.Sin(MathF.PI * 100f * num4);
				array[i] = num9 * 0.5f;
			}
			val.SetData(array, 0);
			return val;
		}

		private void OnGUI()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected O, but got Unknown
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			EnsureStyles();
			if (!_show)
			{
				return;
			}
			ConfigEntry<KeyCode> toggleKey = _toggleKey;
			object obj;
			KeyCode value;
			if (toggleKey == null)
			{
				obj = null;
			}
			else
			{
				value = toggleKey.Value;
				obj = ((object)(KeyCode)(ref value)).ToString();
			}
			if (obj == null)
			{
				obj = "F6";
			}
			string text = (string)obj;
			ConfigEntry<KeyCode> debugDumpKey = _debugDumpKey;
			object obj2;
			if (debugDumpKey == null)
			{
				obj2 = null;
			}
			else
			{
				value = debugDumpKey.Value;
				obj2 = ((object)(KeyCode)(ref value)).ToString();
			}
			if (obj2 == null)
			{
				obj2 = "F7";
			}
			string text2 = (string)obj2;
			GUIStyle verticalScrollbar = GUI.skin.verticalScrollbar;
			GUIStyle verticalScrollbarThumb = GUI.skin.verticalScrollbarThumb;
			GUIStyle horizontalScrollbar = GUI.skin.horizontalScrollbar;
			GUIStyle horizontalScrollbarThumb = GUI.skin.horizontalScrollbarThumb;
			GUI.skin.verticalScrollbar = _verticalScrollbarStyle;
			GUI.skin.verticalScrollbarThumb = _verticalScrollbarThumbStyle;
			GUI.skin.horizontalScrollbar = _horizontalScrollbarStyle;
			GUI.skin.horizontalScrollbarThumb = _horizontalScrollbarThumbStyle;
			try
			{
				DrawWindowShadow(_win, (Texture)(object)_shadowBig, 18f);
				if (!PhotonNetwork.InRoom)
				{
					_win = GUILayout.Window(987123, _win, new WindowFunction(DrawNoRoom), "Repo Ban | Not In Room | " + text + " Toggle", _winStyle, Array.Empty<GUILayoutOption>());
					DrawHeaderBevel(_win);
					DrawTopIcon(_win);
					if (_cracktroActive)
					{
						DrawCracktroOverlay(_win);
					}
					return;
				}
				_win = GUILayout.Window(987122, _win, new WindowFunction(DrawWindow), PhotonNetwork.IsMasterClient ? ("Ban List | Host | " + text + " Toggle | " + text2 + " Debug") : ("Ban List | Viewer | " + text + " Toggle | " + text2 + " Debug"), _winStyle, Array.Empty<GUILayoutOption>());
				DrawHeaderBevel(_win);
				DrawTopIcon(_win);
				if (_cracktroActive)
				{
					DrawCracktroOverlay(_win);
				}
			}
			finally
			{
				GUI.skin.verticalScrollbar = verticalScrollbar;
				GUI.skin.verticalScrollbarThumb = verticalScrollbarThumb;
				GUI.skin.horizontalScrollbar = horizontalScrollbar;
				GUI.skin.horizontalScrollbarThumb = horizontalScrollbarThumb;
			}
		}

		private void DrawTopIcon(Rect win)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_omniIcon == (Object)null))
			{
				float num = 52f;
				float num2 = 8f;
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref win)).x + ((Rect)(ref win)).width - num - num2, ((Rect)(ref win)).y + num2, num, num);
				GUI.DrawTexture(val, (Texture)(object)_omniIcon, (ScaleMode)2, true);
			}
		}

		private void DrawHeaderBevel(Rect win)
		{
			//IL_0034: 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)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref win)).x + 6f, ((Rect)(ref win)).y + 6f, ((Rect)(ref win)).width - 12f, 2f);
			GUI.DrawTexture(val, (Texture)(object)_texHighlight);
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((Rect)(ref win)).x + 3f, ((Rect)(ref win)).y + 3f, ((Rect)(ref win)).width - 6f, ((Rect)(ref win)).height - 6f);
			DrawRectBorder(r, 1f, (Texture)(object)_texBorder);
		}

		private void DrawWindowShadow(Rect r, Texture tex, float padding)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref r)).x - padding, ((Rect)(ref r)).y - padding, ((Rect)(ref r)).width + padding * 2f, ((Rect)(ref r)).height + padding * 2f);
			GUI.DrawTexture(val, tex, (ScaleMode)0, true);
		}

		private void DrawRectBorder(Rect r, float thickness, Texture tex)
		{
			//IL_0079: 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_0089: 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)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, thickness);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - thickness, ((Rect)(ref r)).width, thickness);
			Rect val3 = default(Rect);
			((Rect)(ref val3))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).y, thickness, ((Rect)(ref r)).height);
			Rect val4 = default(Rect);
			((Rect)(ref val4))..ctor(((Rect)(ref r)).xMax - thickness, ((Rect)(ref r)).y, thickness, ((Rect)(ref r)).height);
			GUI.DrawTexture(val, tex);
			GUI.DrawTexture(val2, tex);
			GUI.DrawTexture(val3, tex);
			GUI.DrawTexture(val4, tex);
		}

		private void CloseWindow()
		{
			ReleaseUiInputCapture();
			_show = false;
			_pongPaused = true;
			StopCracktro();
			SetUiStatus("Ban enforcer closed.");
		}

		private void RefreshBanData()
		{
			RepoBanManager.Instance?.ForceRefreshAll();
			SetUiStatus("Refreshed room and Steam lobby data.");
		}

		private static bool MatchesFilter(string haystack, string filter)
		{
			return string.IsNullOrWhiteSpace(filter) || haystack.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0;
		}

		private void DrawNoRoom(int id)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			DrawOmniHiddenButton();
			GUILayout.Label("Join/Create a room to manage bans.", _labelStyle, Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Close", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				CloseWindow();
			}
			GUI.DragWindow();
			Rect rect = GUILayoutUtility.GetRect(1f, 8f);
			((Rect)(ref rect)).height = 2f;
			((Rect)(ref rect)).x = 6f;
			((Rect)(ref rect)).width = ((Rect)(ref _win)).width - 12f;
			GUI.DrawTexture(rect, (Texture)(object)_texLineRed);
		}

		private void DrawWindow(int id)
		{
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			DrawOmniHiddenButton();
			bool isMasterClient = PhotonNetwork.IsMasterClient;
			if (!isMasterClient)
			{
				GUILayout.Label("<color=#FFEE99>You are not the host — only the host enforces bans.</color>", _thinLabelStyle, Array.Empty<GUILayoutOption>());
			}
			GUILayout.Space(4f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Bans", (_activeTab == Tab.Bans) ? _tabActiveStyle : _tabStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }))
			{
				_activeTab = Tab.Bans;
				_pongPaused = true;
				StopCracktro();
			}
			if (GUILayout.Button("Arcade (Pong)", (_activeTab == Tab.Arcade) ? _tabActiveStyle : _tabStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(170f) }))
			{
				_activeTab = Tab.Arcade;
				if (!_pongInit)
				{
					InitPong();
				}
				_pongPaused = false;
				StopCracktro();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Close", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				CloseWindow();
			}
			if (GUILayout.Button($"Debug Dump ({_debugDumpKey.Value})", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				RepoBanManager.DumpDebugInfo();
				SetUiStatus("Debug info sent to the BepInEx log.");
			}
			if (GUILayout.Button("Refresh Now", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				RefreshBanData();
			}
			GUILayout.FlexibleSpace();
			GUI.enabled = isMasterClient;
			if (GUILayout.Button("Clear All Bans", _buttonStyle, Array.Empty<GUILayoutOption>()))
			{
				RepoBanManager.ClearAllLocalBans();
				SetUiStatus("Cleared all stored Steam bans.");
			}
			GUI.enabled = true;
			GUILayout.EndHorizontal();
			Rect rect = GUILayoutUtility.GetRect(1f, 10f);
			((Rect)(ref rect)).height = 2f;
			((Rect)(ref rect)).x = 6f;
			((Rect)(ref rect)).width = ((Rect)(ref _win)).width - 12f;
			GUI.DrawTexture(rect, (Texture)(object)_texLineRed);
			GUILayout.Space(4f);
			if (_activeTab == Tab.Arcade)
			{
				DrawPongTab();
			}
			else
			{
				DrawBanTab(isMasterClient);
			}
			GUI.DragWindow();
		}

		private void DrawOmniHiddenButton()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref _win)).width - 52f - 8f, 8f, 52f, 52f);
			if (GUI.Button(val, GUIContent.none, _hiddenBtnStyle))
			{
				if (_cracktroActive)
				{
					StopCracktro();
				}
				else
				{
					StartCracktro();
				}
			}
		}

		private void DrawBanTab(bool isMaster)
		{
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_07be: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_080e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0813: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("<b>Players in Room (Steam)</b>", _labelHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(420f) });
			GUILayout.Label("<b>Banned Records</b>", _labelHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) });
			GUILayout.Label("<b>Steam Lobby Members</b>", _labelHeaderStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(420f) });
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Find:", _thinLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) });
			_playerSearch = GUILayout.TextField(_playerSearch ?? string.Empty, _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(364f) });
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			Rect rect = GUILayoutUtility.GetRect(0f, 0f);
			float x = ((Rect)(ref rect)).x;
			rect = GUILayoutUtility.GetRect(0f, 0f);
			DrawPanelShadow(x, ((Rect)(ref rect)).y, 420f, 360f, (Texture)(object)_shadowSmall);
			_scrollPlayers = GUILayout.BeginScrollView(_scrollPlayers, false, true, _horizontalScrollbarStyle, _verticalScrollbarStyle, GUIStyle.none, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(350f) });
			Player[] array = (from p in PhotonNetwork.PlayerList
				orderby p.ActorNumber
				where MatchesFilter($"{p.ActorNumber} {p.NickName} {RepoBanManager.Instance.ResolveSteam64For(p)}", _playerSearch)
				select p).ToArray();
			if (array.Length == 0)
			{
				GUILayout.Label("<i>No matching players in room.</i>", _thinLabelStyle, Array.Empty<GUILayoutOption>());
			}
			Player[] array2 = array;
			foreach (Player val in array2)
			{
				GUILayout.BeginVertical(_boxStyle, Array.Empty<GUILayoutOption>());
				string text = RepoBanManager.Instance.ResolveSteam64For(val);
				if (string.IsNullOrWhiteSpace(text))
				{
					text = "Unknown";
				}
				ulong result;
				bool flag = ulong.TryParse(text, out result);
				bool flag2 = flag && RepoBanManager.IsSteamIdBanned(result);
				string arg = (flag2 ? "#FF3B3B" : (val.IsLocal ? "#77E3FF" : "#FFFFFF"));
				GUILayout.Label($"<color={arg}><b>#{val.ActorNumber} | {val.NickName}</b></color>", _labelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("  Steam64: '<b>" + text + "</b>'", _thinLabelStyle, Array.Empty<GUILayoutOption>());
				if (flag2)
				{
					GUILayout.Label("<color=#FF4D4D>  BANNED AND READY TO KICK</color>", _thinLabelStyle, Array.Empty<GUILayoutOption>());
				}
				else if (!flag)
				{
					GUILayout.Label("<color=#FFCC66>  Waiting for Steam64 resolution...</color>", _thinLabelStyle, Array.Empty<GUILayoutOption>());
				}
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.FlexibleSpace();
				GUI.enabled = isMaster && !val.IsLocal && flag && !flag2;
				if (GUILayout.Button("BAN PLAYER", _buttonStyle, (GUILayoutOption[])(o