Decompiled source of Overseer v1.1.1

BepInEx/plugins/lammas123.Overseer.dll

Decompiled 6 days ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.IL2CPP;
using BepInEx.IL2CPP.Utils;
using BepInEx.Logging;
using ChatCommands;
using CrabDevKit.Utilities;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PersistentData;
using SteamworksNative;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Overseer
{
	public class WarnCommand : BaseCommand
	{
		public WarnCommand()
		{
			//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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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)
			base.id = "warn";
			base.description = "Warns the given player.";
			base.args = new CommandArguments((CommandArgument[])(object)new CommandArgument[2]
			{
				new CommandArgument(new Type[1] { typeof(OnlineClientId) }, "player", true),
				new CommandArgument(new Type[1] { typeof(string) }, "reason", false)
			});
		}

		public override BaseCommandResponse Execute(BaseExecutionMethod executionMethod, object executorDetails, string args, bool ignorePermissions = false)
		{
			//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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0031: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			if (args.Length != 0)
			{
				ParsedResult<OnlineClientId> val = Api.CommandArgumentParser.Parse<OnlineClientId>(args);
				ulong num;
				if (val.successful)
				{
					num = OnlineClientId.op_Implicit(val.result);
					args = val.newArgs;
				}
				else
				{
					ParsedResult<OfflineClientId> val2 = Api.CommandArgumentParser.Parse<OfflineClientId>(args);
					if (!val2.successful)
					{
						return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You did not select a player." }, (CommandResponseType)1);
					}
					num = OfflineClientId.op_Implicit(val2.result);
					args = val2.newArgs;
				}
				if (num != MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.field_Private_CSteamID_0.m_SteamID)
				{
					if (executionMethod is ChatExecutionMethod && num == (ulong)executorDetails)
					{
						return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "Why would you want to warn yourself?" }, (CommandResponseType)1);
					}
					string text = ((args.Length == 0) ? "No reason provided." : args);
					ChatUtil.SendMessage(num, "Warning: " + text, (MessageType)2, "Overseer");
					return (BaseCommandResponse)new BasicCommandResponse(new string[2]
					{
						"Warned '" + SteamFriends.GetFriendPersonaName(new CSteamID(num)) + "'",
						"Reason: '" + text + "'"
					}, (CommandResponseType)1);
				}
				return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You cannot warn the host." }, (CommandResponseType)1);
			}
			return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "A player is required for the first argument." }, (CommandResponseType)1);
		}
	}
	public class KickCommand : BaseCommand
	{
		public KickCommand()
		{
			//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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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)
			base.id = "kick";
			base.description = "Kicks the given player.";
			base.args = new CommandArguments((CommandArgument[])(object)new CommandArgument[2]
			{
				new CommandArgument(new Type[1] { typeof(OnlineClientId) }, "player", true),
				new CommandArgument(new Type[1] { typeof(string) }, "reason", false)
			});
		}

		public override BaseCommandResponse Execute(BaseExecutionMethod executionMethod, object executorDetails, string args, bool ignorePermissions = false)
		{
			//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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0031: 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_003d: 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_008a: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			if (args.Length != 0)
			{
				ParsedResult<OnlineClientId> val = Api.CommandArgumentParser.Parse<OnlineClientId>(args);
				ulong num;
				if (val.successful)
				{
					num = OnlineClientId.op_Implicit(val.result);
					args = val.newArgs;
				}
				else
				{
					ParsedResult<OfflineClientId> val2 = Api.CommandArgumentParser.Parse<OfflineClientId>(args);
					if (!val2.successful)
					{
						return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You did not select a player." }, (CommandResponseType)1);
					}
					num = OfflineClientId.op_Implicit(val2.result);
					args = val2.newArgs;
				}
				if (num != MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.field_Private_CSteamID_0.m_SteamID)
				{
					if (executionMethod is ChatExecutionMethod && num == (ulong)executorDetails)
					{
						return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "Why would you want to kick yourself?" }, (CommandResponseType)1);
					}
					string text = ((args.Length == 0) ? "No reason provided." : args);
					string friendPersonaName = SteamFriends.GetFriendPersonaName(new CSteamID(num));
					MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance.KickPlayer(num);
					return (BaseCommandResponse)new BasicCommandResponse(new string[2]
					{
						"Kicked '" + friendPersonaName + "'",
						"Reason: '" + text + "'"
					}, (CommandResponseType)1);
				}
				return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You cannot kick the host." }, (CommandResponseType)1);
			}
			return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "A player is required for the first argument." }, (CommandResponseType)1);
		}
	}
	public class BanCommand : BaseCommand
	{
		public BanCommand()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			base.id = "ban";
			base.description = "Bans the given player.";
			base.args = new CommandArguments((CommandArgument[])(object)new CommandArgument[2]
			{
				new CommandArgument(new Type[2]
				{
					typeof(OnlineClientId),
					typeof(OfflineClientId)
				}, "player", true),
				new CommandArgument(new Type[1] { typeof(string) }, "reason", false)
			});
		}

		public override BaseCommandResponse Execute(BaseExecutionMethod executionMethod, object executorDetails, string args, bool ignorePermissions = false)
		{
			//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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0031: 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_003d: 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_008a: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_0142: 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_0134: Expected O, but got Unknown
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Expected O, but got Unknown
			if (args.Length != 0)
			{
				ParsedResult<OnlineClientId> val = Api.CommandArgumentParser.Parse<OnlineClientId>(args);
				ulong num;
				if (val.successful)
				{
					num = OnlineClientId.op_Implicit(val.result);
					args = val.newArgs;
				}
				else
				{
					ParsedResult<OfflineClientId> val2 = Api.CommandArgumentParser.Parse<OfflineClientId>(args);
					if (!val2.successful)
					{
						return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You did not select a player." }, (CommandResponseType)1);
					}
					num = OfflineClientId.op_Implicit(val2.result);
					args = val2.newArgs;
				}
				if (num != MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.field_Private_CSteamID_0.m_SteamID)
				{
					if (executionMethod is ChatExecutionMethod && num == (ulong)executorDetails)
					{
						return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "Why would you want to ban yourself?" }, (CommandResponseType)1);
					}
					if (!MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.bannedPlayers.Contains(num))
					{
						string text = ((args.Length == 0) ? "No reason provided." : args);
						if (PersistentDataCompatibility.Enabled && !PersistentDataCompatibility.SetClientData(num, "Banned", text))
						{
							return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "Failed to save ban reason." }, (CommandResponseType)1);
						}
						string text2;
						if (MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.steamIdToUID.ContainsKey(num))
						{
							text2 = SteamFriends.GetFriendPersonaName(new CSteamID(num));
							MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance.BanPlayer(num);
						}
						else
						{
							text2 = PersistentDataCompatibility.GetClientData(num, "Username");
							MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.bannedPlayers.Add(num);
						}
						return (BaseCommandResponse)new BasicCommandResponse(new string[2]
						{
							"Banned '" + text2 + "'",
							"Reason: '" + text + "'"
						}, (CommandResponseType)1);
					}
					return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "That player has already been banned." }, (CommandResponseType)1);
				}
				return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You cannot ban the host." }, (CommandResponseType)1);
			}
			return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "A player is required for the first argument." }, (CommandResponseType)1);
		}
	}
	public class UnbanCommand : BaseCommand
	{
		public UnbanCommand()
		{
			//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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			base.id = "unban";
			base.description = "Unbans the given player.";
			base.args = new CommandArguments((CommandArgument[])(object)new CommandArgument[1]
			{
				new CommandArgument(new Type[1] { typeof(OfflineClientId) }, "player", true)
			});
		}

		public override BaseCommandResponse Execute(BaseExecutionMethod executionMethod, object executorDetails, string args, bool ignorePermissions = false)
		{
			//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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			if (args.Length != 0)
			{
				ParsedResult<OfflineClientId> val = Api.CommandArgumentParser.Parse<OfflineClientId>(args);
				if (val.successful)
				{
					ulong num = OfflineClientId.op_Implicit(val.result);
					if (MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.bannedPlayers.Contains(num))
					{
						if (PersistentDataCompatibility.Enabled)
						{
							PersistentDataCompatibility.RemoveClientData(num, "Banned");
						}
						MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.bannedPlayers.Remove(num);
						return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "Unbanned '" + PersistentDataCompatibility.GetClientData(num, "Username") + "'" }, (CommandResponseType)1);
					}
					return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "That player has not been banned." }, (CommandResponseType)1);
				}
				return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You did not select a player." }, (CommandResponseType)1);
			}
			return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "A player is required for the first argument." }, (CommandResponseType)1);
		}
	}
	internal static class PersistentDataCompatibility
	{
		internal static bool? enabled;

		internal static bool Enabled
		{
			get
			{
				if (enabled.HasValue)
				{
					return enabled.Value;
				}
				bool? flag = (enabled = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("lammas123.PersistentData"));
				return flag.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static HashSet<ulong> GetPersistentClientDataIds()
		{
			return Api.PersistentClientDataIds;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static bool HasClientData(ulong clientId, string key)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			ClientDataFile clientDataFile = Api.GetClientDataFile(clientId);
			return ((ClientDataFile)(ref clientDataFile)).ContainsKey(key);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static string GetClientData(ulong clientId, string key)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			ClientDataFile clientDataFile = Api.GetClientDataFile(clientId);
			return ((ClientDataFile)(ref clientDataFile)).Get(key);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static bool SetClientData(ulong clientId, string key, string value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			ClientDataFile clientDataFile = Api.GetClientDataFile(clientId);
			bool result = ((ClientDataFile)(ref clientDataFile)).Set(key, value);
			((ClientDataFile)(ref clientDataFile)).SaveFile();
			return result;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static bool RemoveClientData(ulong clientId, string key)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			ClientDataFile clientDataFile = Api.GetClientDataFile(clientId);
			bool result = ((ClientDataFile)(ref clientDataFile)).Remove(key);
			((ClientDataFile)(ref clientDataFile)).SaveFile();
			return result;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static bool AddClientData(ulong clientId, string key, string value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			ClientDataFile clientDataFile = Api.GetClientDataFile(clientId);
			if (((ClientDataFile)(ref clientDataFile)).ContainsKey(key))
			{
				return true;
			}
			bool result = ((ClientDataFile)(ref clientDataFile)).Set(key, value);
			((ClientDataFile)(ref clientDataFile)).SaveFile();
			return result;
		}
	}
	internal static class Patches
	{
		[CompilerGenerated]
		private sealed class <CoroReadPending>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

			[DebuggerHidden]
			public <CoroReadPending>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					bool done = Patches.done;
					ulong result;
					while (pending.TryDequeue(out result) && !MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.bannedPlayers.Contains(result))
					{
						MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.bannedPlayers.Add(result);
						if (MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.steamIdToUID.ContainsKey(result))
						{
							MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance.KickPlayer(result);
						}
					}
					if (done)
					{
						((BasePlugin)Overseer.Instance).Log.LogInfo((object)"Loaded all banned players");
						return false;
					}
				}
				else
				{
					<>1__state = -1;
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

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

		internal static ConcurrentQueue<ulong> pending = new ConcurrentQueue<ulong>();

		internal static volatile int loadGeneration = 0;

		internal static volatile bool done = false;

		internal static Thread thread;

		internal static Coroutine coroutine;

		[HarmonyPatch(typeof(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique), "StartLobby")]
		[HarmonyPatch(typeof(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique), "StartPracticeLobby")]
		[HarmonyPostfix]
		internal static void PostLobbyManagerStartLobby()
		{
			if (!PersistentDataCompatibility.Enabled)
			{
				return;
			}
			if (coroutine != null)
			{
				((MonoBehaviour)MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance).StopCoroutine(coroutine);
			}
			int generation = Interlocked.Increment(ref loadGeneration);
			pending = new ConcurrentQueue<ulong>();
			ConcurrentQueue<ulong> localPending = pending;
			done = false;
			HashSet<ulong> hashSet = new HashSet<ulong>();
			foreach (ulong persistentClientDataId in PersistentDataCompatibility.GetPersistentClientDataIds())
			{
				hashSet.Add(persistentClientDataId);
			}
			HashSet<ulong> clientDataIds = hashSet;
			MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.bannedPlayers.Clear();
			MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.bannedPlayers.EnsureCapacity(clientDataIds.Count);
			((BasePlugin)Overseer.Instance).Log.LogInfo((object)"Loading all banned players...");
			thread = new Thread((ThreadStart)delegate
			{
				foreach (ulong item in clientDataIds)
				{
					if (PersistentDataCompatibility.HasClientData(item, "Banned"))
					{
						localPending.Enqueue(item);
					}
					if (loadGeneration != generation)
					{
						return;
					}
				}
				done = true;
			});
			thread.IsBackground = true;
			thread.Start();
			coroutine = MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.Instance, CoroReadPending());
		}

		[IteratorStateMachine(typeof(<CoroReadPending>d__6))]
		internal static IEnumerator CoroReadPending()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CoroReadPending>d__6(0);
		}

		[HarmonyPatch(typeof(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique), "CloseLobby")]
		[HarmonyPostfix]
		internal static void PostLobbyManagerCloseLobby()
		{
			if (PersistentDataCompatibility.Enabled)
			{
				MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.bannedPlayers.Clear();
			}
		}

		[HarmonyPatch(typeof(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique), "KickPlayer")]
		[HarmonyPatch(typeof(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique), "BanPlayer")]
		[HarmonyPrefix]
		internal static bool PreLobbyManagerForceDisconnectPlayer(ulong param_1)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (param_1 == MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.originalLobbyOwnerId.m_SteamID)
			{
				return false;
			}
			if (Object.op_Implicit((Object)(object)MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance) && MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers.ContainsKey(param_1) && !MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers[param_1].dead)
			{
				MonoBehaviourPublicObInCoIE85SiAwVoFoCoUnique.PlayerDied(param_1, param_1, Vector3.zero);
			}
			return true;
		}

		[HarmonyPatch(typeof(MonoBehaviourPublicTrwiReGakibaGaTeplmuUnique), "BanPlayer")]
		[HarmonyPostfix]
		internal static void PostManagePlayerListingBanPlayer()
		{
			MonoBehaviourPublicGapaTrconaGaDi2UIObUnique.Instance.UpdateList();
		}

		[HarmonyPatch(typeof(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique), "BanPlayer")]
		[HarmonyPostfix]
		internal static void PostLobbyManagerBanPlayer(ulong param_1)
		{
			if (MonoBehaviourPublicCSDi2UIInstObUIloDiUnique.bannedPlayers.Contains(param_1) && PersistentDataCompatibility.Enabled)
			{
				PersistentDataCompatibility.AddClientData(param_1, "Banned", "No reason found.");
			}
		}
	}
	[BepInPlugin("lammas123.Overseer", "Overseer", "1.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class Overseer : BasePlugin
	{
		internal static Overseer Instance { get; private set; }

		public override void Load()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
			CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
			CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
			CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
			Instance = this;
			Api.RegisterCommand((BaseCommand)(object)new WarnCommand());
			Api.RegisterCommand((BaseCommand)(object)new KickCommand());
			Api.RegisterCommand((BaseCommand)(object)new BanCommand());
			Api.RegisterCommand((BaseCommand)(object)new UnbanCommand());
			new Harmony("Overseer").PatchAll(typeof(Patches));
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(15, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initialized [");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Overseer");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.1.1");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
			}
			log.LogInfo(val);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "lammas123.Overseer";

		public const string PLUGIN_NAME = "Overseer";

		public const string PLUGIN_VERSION = "1.1.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}