Decompiled source of AirlockClient v0.2.1

AirlockClient/BepInEx/plugins/Airlock-Client/AirlockAPI.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using AirlockAPI.Attributes;
using AirlockAPI.Data;
using AirlockAPI.Debug;
using AirlockAPI.Handlers;
using AirlockAPI.Main;
using AirlockAPI.Managers;
using AirlockAPI.Patches;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Unity.IL2CPP;
using ExitGames.Client.Photon;
using Fusion;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.IO;
using Microsoft.CodeAnalysis;
using Photon.Realtime;
using SG.Airlock;
using SG.Airlock.Cutscenes;
using SG.Airlock.Localization;
using SG.Airlock.Network;
using SG.Airlock.Roles;
using SG.Airlock.UI.TitleScreen;
using SG.CoreLite;
using SG.LightUI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AirlockAPI")]
[assembly: AssemblyDescription("Modding API for Among Us 3D/VR")]
[assembly: AssemblyProduct("AirlockAPI")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: ComVisible(false)]
[assembly: Guid("5f9af3a0-9611-47fa-95e6-c2d57052dedc")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace AirlockAPI.Patches
{
	[HarmonyPatch(typeof(RoleManager), "AssignRoles")]
	public class AssignRolesPatch
	{
		public static bool Prefix(RoleManager __instance)
		{
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				return CustomGameHandler.Current.OnBeforeAssignRoles();
			}
			return true;
		}

		public static void Postfix(RoleManager __instance)
		{
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				CustomGameHandler.Current.OnAfterAssignRoles();
			}
		}
	}
	[HarmonyPatch(typeof(GameStateManager), "EndGame")]
	public class EndGamePatch
	{
		public static bool Prefix(GameStateManager __instance, GameTeam winningTeam)
		{
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				return CustomGameHandler.Current.OnGameEnd(ref winningTeam);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(VoteManager), "EndVote")]
	public class EndVotePatch
	{
		public static bool Prefix(VoteManager __instance)
		{
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				return CustomGameHandler.Current.OnAllVotesCast();
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PunishmentController), "OnEvent")]
	public class OnEventPatch
	{
		public static void Prefix(EventData photonEvent)
		{
			if (photonEvent.Code != 125)
			{
				return;
			}
			Object customData = photonEvent.CustomData;
			Hashtable val = (Hashtable)(object)((customData is Hashtable) ? customData : null);
			if (val == null)
			{
				return;
			}
			Object obj = val[(byte)0];
			String val2 = (String)(object)((obj is String) ? obj : null);
			if (val2 != null)
			{
				Object obj2 = val[(byte)1];
				Hashtable val3 = (Hashtable)(object)((obj2 is Hashtable) ? obj2 : null);
				if (val3 != null)
				{
					NetworkManager.OnEvent(new AirlockEventInfo(int.Parse(String.op_Implicit(val2)), val3));
				}
			}
		}
	}
	[HarmonyPatch(typeof(GamemodeSelectionMenu), "OnModeSelect")]
	public static class OnModeSelectPatch
	{
		public static void Prefix(GamemodeSelectionMenu __instance, MapModeSelect modeSelect)
		{
			if (modeSelect.ModeInfo.ModeName.StartsWith("<size=0>MODDED</size><color=yellow>"))
			{
				CurrentMode.Modded = true;
				CurrentMode.Name = modeSelect.ModeInfo.ModeName.Replace("<size=0>MODDED</size><color=yellow>", "");
			}
			else
			{
				CurrentMode.Modded = false;
				CurrentMode.Name = modeSelect.ModeInfo.ModeName;
			}
			if (CurrentMode.Modded)
			{
				__instance._startButton._isDisabled = __instance._isQuickMatch;
			}
			else
			{
				__instance._startButton._isDisabled = false;
			}
			Logging.Log("Mode: " + CurrentMode.Name + " | Modded Gamemode: " + CurrentMode.Modded);
		}
	}
	[HarmonyPatch(typeof(NetworkRunner), "Fusion_Simulation_ICallbacks_OnReliableData")]
	public static class RpcRecievedPatch
	{
		private static void AddParameters(BinaryReader reader, ref object[] args, int count, PlayerRef host, PlayerRef player, ref int targetPlayer)
		{
			//IL_0007: 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)
			int num = 0;
			for (int i = 0; i < count; i++)
			{
				object obj = ReadValue(reader, host, player, ref targetPlayer);
				if (obj == null)
				{
					num++;
				}
				else
				{
					args[i - num] = obj;
				}
			}
		}

		private static object ReadValue(BinaryReader reader, PlayerRef host, PlayerRef player, ref int targetPlayer)
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: 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_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			byte b = reader.ReadByte();
			switch (b)
			{
			case 1:
				return reader.ReadInt32();
			case 2:
				return reader.ReadSingle();
			case 3:
				return reader.ReadByte();
			case 4:
				return reader.ReadBoolean();
			case 5:
				return reader.ReadString();
			case 6:
				return GameObject.Find(reader.ReadString());
			case 7:
				return PlayerRef.op_Implicit(reader.ReadInt32());
			case 8:
			{
				float num18 = reader.ReadSingle();
				float num19 = reader.ReadSingle();
				float num20 = reader.ReadSingle();
				return (object)new Vector3(num18, num19, num20);
			}
			case 9:
			{
				float num15 = reader.ReadSingle();
				float num16 = reader.ReadSingle();
				float num17 = reader.ReadSingle();
				return Quaternion.Euler(new Vector3(num15, num16, num17));
			}
			case 10:
				return GameObject.Find(reader.ReadString()).transform;
			case 11:
			{
				float num12 = reader.ReadSingle();
				float num13 = reader.ReadSingle();
				float num14 = reader.ReadSingle();
				return (object)new Color(num12, num13, num14);
			}
			case 12:
			{
				byte b2 = reader.ReadByte();
				byte b3 = reader.ReadByte();
				byte b4 = reader.ReadByte();
				byte b5 = reader.ReadByte();
				return (object)new Color32(b2, b3, b4, b5);
			}
			case 13:
			{
				float num8 = reader.ReadSingle();
				float num9 = reader.ReadSingle();
				float num10 = reader.ReadSingle();
				float num11 = reader.ReadSingle();
				return (object)new Rect(num8, num9, num10, num11);
			}
			case 14:
			{
				float num6 = reader.ReadSingle();
				float num7 = reader.ReadSingle();
				return (object)new Vector2(num6, num7);
			}
			case 15:
			{
				float num2 = reader.ReadSingle();
				float num3 = reader.ReadSingle();
				float num4 = reader.ReadSingle();
				float num5 = reader.ReadSingle();
				return (object)new Vector4(num2, num3, num4, num5);
			}
			case 16:
			{
				int num = reader.ReadInt32();
				List<object> list = new List<object>(num);
				for (int i = 0; i < num; i++)
				{
					list.Add(ReadValue(reader, host, player, ref targetPlayer));
				}
				return list;
			}
			case 200:
				targetPlayer = reader.ReadInt32();
				return null;
			default:
				Logging.Warn($"Unknown tag: {b}! Skipping value..");
				return null;
			}
		}

		public static void Prefix(NetworkRunner __instance, PlayerRef player, Il2CppStructArray<byte> dataArray)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			Logging.Log("RPC_RECIEVED");
			int targetPlayer = -1;
			if ((Object)(object)NetworkManager.Network == (Object)null)
			{
				NetworkManager.Network = Object.FindObjectOfType<AirlockNetworkRunner>();
				if ((Object)(object)NetworkManager.Network == (Object)null)
				{
					return;
				}
			}
			using MemoryStream input = new MemoryStream(Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)dataArray));
			using BinaryReader binaryReader = new BinaryReader(input, Encoding.UTF8);
			PlayerRef host = default(PlayerRef);
			((NetworkRunner)NetworkManager.Network).TryGetHostPlayer(ref host);
			Logging.Log(((PlayerRef)(ref host)).PlayerId.ToString());
			string text = binaryReader.ReadString();
			Logging.Log(text);
			int num = binaryReader.ReadInt32();
			object[] args = new object[num];
			if (num != 0)
			{
				AddParameters(binaryReader, ref args, num, host, player, ref targetPlayer);
			}
			NetworkManager.OnRecievedRpc(text, PlayerRef.op_Implicit(player), targetPlayer, args);
		}
	}
	[HarmonyPatch(typeof(CutsceneManager), "ShowEjected")]
	public class ShowEjectedPatch1
	{
		public static bool Prefix(CutsceneManager __instance, PlayerRef playerEjected, GameRole playerEjectedRole, bool onlyShowImpostors, int aliveImposters, int aliveCrewmates)
		{
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				PlayerState ejectedPlayer = GameObject.Find("PlayerState (" + ((PlayerRef)(ref playerEjected)).PlayerId + ")").GetComponent<PlayerState>();
				return CustomGameHandler.Current.OnPlayerEjected(ref ejectedPlayer, ref playerEjectedRole);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(CutsceneManager), "ShowAnonymousEjected")]
	public class ShowEjectedPatch2
	{
		public static bool Prefix(CutsceneManager __instance, PlayerRef playerEjected, int aliveImposters, int aliveCrewmates)
		{
			//IL_003b: 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)
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				PlayerState ejectedPlayer = GameObject.Find("PlayerState (" + ((PlayerRef)(ref playerEjected)).PlayerId + ")").GetComponent<PlayerState>();
				GameRole role = CustomGameHandler.Current.GetTrueRole(ejectedPlayer);
				return CustomGameHandler.Current.OnPlayerEjected(ref ejectedPlayer, ref role);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(CutsceneManager), "ShowNoEjected")]
	public class ShowEjectedPatch3
	{
		public static bool Prefix(CutsceneManager __instance, int aliveImposters)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				PlayerState ejectedPlayer = null;
				GameRole role = (GameRole)0;
				return CustomGameHandler.Current.OnPlayerEjected(ref ejectedPlayer, ref role);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(CutsceneManager), "ShowDebugEjected")]
	public class ShowEjectedPatch4
	{
		public static bool Prefix(CutsceneManager __instance, PlayerRef playerEjected, bool wasImposter, int aliveImposters, int cutsceneIndex)
		{
			//IL_003b: 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)
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				PlayerState ejectedPlayer = GameObject.Find("PlayerState (" + ((PlayerRef)(ref playerEjected)).PlayerId + ")").GetComponent<PlayerState>();
				GameRole role = CustomGameHandler.Current.GetTrueRole(ejectedPlayer);
				return CustomGameHandler.Current.OnPlayerEjected(ref ejectedPlayer, ref role);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(GameStateManager), "StartGame")]
	public class StartGamePatch
	{
		public static bool Prefix(GameStateManager __instance)
		{
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				return CustomGameHandler.Current.OnGameStart();
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(NetworkedKillBehaviour), "RPC_TargetedAction")]
	public class TargetedActionPatch
	{
		public static bool Prefix(NetworkedKillBehaviour __instance, ref PlayerRef targetedPlayer, ref PlayerRef perpetrator, ref int action)
		{
			PlayerState killer = GameObject.Find("PlayerState (" + ((PlayerRef)(ref perpetrator)).PlayerId + ")").GetComponent<PlayerState>();
			PlayerState victim = GameObject.Find("PlayerState (" + ((PlayerRef)(ref targetedPlayer)).PlayerId + ")").GetComponent<PlayerState>();
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				return CustomGameHandler.Current.OnTargetedAction(ref killer, ref victim, ref action);
			}
			return true;
		}
	}
	[HarmonyPatch]
	public class VotePatch
	{
		[HarmonyPatch(typeof(VoteManager), "RPC_Vote", new Type[]
		{
			typeof(PlayerRef),
			typeof(PlayerRef),
			typeof(RpcInfo)
		})]
		[HarmonyPrefix]
		public static bool Prefix1(PlayerRef voteAgainstPlayer, PlayerRef sourcePlayer, RpcInfo info)
		{
			PlayerState voter = GameObject.Find("PlayerState (" + ((PlayerRef)(ref sourcePlayer)).PlayerId + ")").GetComponent<PlayerState>();
			PlayerState voted = GameObject.Find("PlayerState (" + ((PlayerRef)(ref voteAgainstPlayer)).PlayerId + ")").GetComponent<PlayerState>();
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				return CustomGameHandler.Current.OnPlayerVoted(ref voter, ref voted);
			}
			return true;
		}

		[HarmonyPatch(typeof(VoteManager), "RPC_Vote", new Type[]
		{
			typeof(PlayerRef),
			typeof(RpcInfo)
		})]
		[HarmonyPrefix]
		public static bool Prefix2(PlayerRef sourcePlayer, RpcInfo info)
		{
			PlayerState voter = GameObject.Find("PlayerState (" + ((PlayerRef)(ref sourcePlayer)).PlayerId + ")").GetComponent<PlayerState>();
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				return CustomGameHandler.Current.OnPlayerVotedSkip(ref voter);
			}
			return true;
		}
	}
	[HarmonyPatch]
	public class CallVote
	{
		[HarmonyPatch(typeof(VoteManager), "RPC_CallVote", new Type[]
		{
			typeof(int),
			typeof(PlayerRef),
			typeof(NetworkBool),
			typeof(RpcInfo)
		})]
		[HarmonyPrefix]
		public static bool Prefix1(int foundPlayer, PlayerRef sourcePlayer, NetworkBool forceVote, RpcInfo info)
		{
			PlayerState reportingPlayer = GameObject.Find("PlayerState (" + ((PlayerRef)(ref sourcePlayer)).PlayerId + ")").GetComponent<PlayerState>();
			PlayerState bodyReported = GameObject.Find("PlayerState (" + foundPlayer + ")").GetComponent<PlayerState>();
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				if (CustomGameHandler.Current.OnVotingBegan(ref bodyReported, ref reportingPlayer))
				{
					return CustomGameHandler.Current.OnBodyReported(ref bodyReported, ref reportingPlayer);
				}
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(VoteManager), "RPC_CallVote", new Type[]
		{
			typeof(PlayerRef),
			typeof(NetworkBool),
			typeof(RpcInfo)
		})]
		[HarmonyPrefix]
		public static bool Prefix(PlayerRef sourcePlayer, NetworkBool forceVote, RpcInfo info)
		{
			PlayerState reportingPlayer = GameObject.Find("PlayerState (" + ((PlayerRef)(ref sourcePlayer)).PlayerId + ")").GetComponent<PlayerState>();
			PlayerState bodyReported = null;
			if (Object.op_Implicit((Object)(object)CustomGameHandler.Current))
			{
				if (CustomGameHandler.Current.OnVotingBegan(ref bodyReported, ref reportingPlayer))
				{
					return CustomGameHandler.Current.OnMeetingCalled(ref reportingPlayer);
				}
				return false;
			}
			return true;
		}
	}
}
namespace AirlockAPI.Managers
{
	internal static class ConvertManager
	{
		public static Il2CppArrayBase<PlayerRef> PlayerIEnumeratorToArray<PlayerRef>(this IEnumerable<PlayerRef> source)
		{
			return MonoLinqHelper.ToArray<PlayerRef>(source);
		}
	}
	public static class GamemodeManager
	{
		internal static List<string> RegisteredCustomModes = new List<string>();

		internal static List<string> RegisteredCustomMaps = new List<string>();

		internal static Dictionary<string, Dictionary<string, GameModes>> QueuedCustomModes = new Dictionary<string, Dictionary<string, GameModes>>();

		internal static Dictionary<string, MapInfo> QueuedCustomMaps = new Dictionary<string, MapInfo>();

		public static List<Type> GamemodeHandlerTypes = new List<Type>();

		internal static void CheckForMapOrMode()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (QueuedCustomModes.Count != 0)
			{
				CreateMode(QueuedCustomModes.Keys.ToList()[0], QueuedCustomModes.Values.ToList()[0].Keys.ToList()[0], QueuedCustomModes.Values.ToList()[0].Values.ToList()[0]);
				QueuedCustomModes.Remove(QueuedCustomModes.Keys.ToList()[0]);
			}
			if (QueuedCustomMaps.Count != 0)
			{
				CreateMap(QueuedCustomMaps.Keys.ToList()[0], QueuedCustomMaps.Values.ToList()[0]);
				QueuedCustomMaps.Remove(QueuedCustomMaps.Keys.ToList()[0]);
			}
		}

		public static void AddMap(string name, MapInfo mapTemplate)
		{
			QueuedCustomMaps.Add(name, mapTemplate);
			CheckForMapOrMode();
		}

		public static void AddMode(string name, string description, GameModes useGamemodeScript = (GameModes)0)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			QueuedCustomModes.Add(name, new Dictionary<string, GameModes> { { description, useGamemodeScript } });
			CheckForMapOrMode();
		}

		internal unsafe static void CreateMode(string name, string description, GameModes useGamemodeScript = (GameModes)0, Sprite image = null)
		{
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Expected O, but got Unknown
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			GamemodeSelectionMenu val = Object.FindObjectOfType<GamemodeSelectionMenu>(true);
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			if (val._modeInfoCollection._activeModesAndMaps.RuntimeModes.Count >= 4)
			{
				foreach (GamemodeSelectionMenu item in Object.FindObjectsOfType<GamemodeSelectionMenu>(true))
				{
					MapModeSelect[] array = Il2CppArrayBase<MapModeSelect>.op_Implicit(((Component)item._modeLayout).GetComponentsInChildren<MapModeSelect>(true));
					int num = 0;
					MapModeSelect[] array2 = array;
					foreach (MapModeSelect val2 in array2)
					{
						((Component)val2).transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);
						if (num == 0)
						{
							Object.Instantiate<GameObject>(((Component)val2).gameObject, ((Component)val2).transform.parent).transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);
						}
						num++;
					}
					((LUIElement)item._modeLayout)._totalHeight = 30f;
					((LUIElement)item._modeLayout).SetHeight(125f);
				}
			}
			if (RegisteredCustomModes.Contains(name + "_" + description))
			{
				val._modeInfoCollection._activeModesAndMaps.RuntimeModes.Add("<size=0>MODDED</size><color=yellow>" + name);
				return;
			}
			ModeInfo val3 = new ModeInfo();
			if ((int)useGamemodeScript == 0)
			{
				val3.Mode = val._modeInfoCollection.Modes[0].Mode;
				val3.Maps = val._modeInfoCollection.Modes[0].Maps;
			}
			else
			{
				ModeInfo modeInfo = val._modeInfoCollection.GetModeInfo(useGamemodeScript);
				if (modeInfo != null)
				{
					Logging.Debug_Log("Using " + ((object)(*(GameModes*)(&useGamemodeScript))/*cast due to .constrained prefix*/).ToString() + " as a template...");
					val3.Mode = modeInfo.Mode;
					val3.Maps = modeInfo.Maps;
				}
				else
				{
					Logging.Debug_Warn(((object)(*(GameModes*)(&useGamemodeScript))/*cast due to .constrained prefix*/).ToString() + " returned a null ModeScript! Using default...");
					val3.Mode = val._modeInfoCollection.Modes[0].Mode;
					val3.Maps = val._modeInfoCollection.Modes[0].Maps;
				}
			}
			val3.ModeName = "<size=0>MODDED</size><color=yellow>" + name;
			val3.ModeNameKey = new UserString();
			val3.ModeNameKey.DefaultValue = val3.ModeName;
			val3.ModeNameKey.FormattedPreview = val3.ModeName;
			val3.ModeDescriptionKey = new UserString();
			val3.ModeDescriptionKey.DefaultValue = description;
			val3.ModeDescriptionKey.FormattedPreview = description;
			if (Object.op_Implicit((Object)(object)image))
			{
				val3.ModeSprite = image;
			}
			if (!val._modeInfoCollection.Modes.Contains(val3))
			{
				val._modeInfoCollection.Modes.Add(val3);
			}
			val._modeInfoCollection._activeModesAndMaps.RuntimeModes.Add(val3.ModeName);
			RegisteredCustomModes.Add(name + "_" + description);
		}

		internal static void CreateMap(string name, MapInfo mapTemplate)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_009f: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			GamemodeSelectionMenu val = Object.FindObjectOfType<GamemodeSelectionMenu>(true);
			if (!((Object)(object)val != (Object)null) || val._mapInfoCollection._activeModesAndMaps.RuntimeMaps.Count >= 10)
			{
				return;
			}
			RegisteredCustomMaps.Add(name);
			if (RegisteredCustomMaps.Contains(name))
			{
				val._modeInfoCollection._activeModesAndMaps.RuntimeMaps.Add("<size=0>MODDED</size><color=orange>" + name);
				return;
			}
			MapInfo val2 = new MapInfo();
			val2.MapName = "<size=0>MODDED</size><color=orange>" + name;
			val2.Scene = mapTemplate.Scene;
			val2.MapIndex = RegisteredCustomMaps.Count + 2;
			val2.LUIMapCoordsOff = mapTemplate.LUIMapCoordsOff;
			val2.LUIMapCoordsOn = mapTemplate.LUIMapCoordsOn;
			val2.MapSprite = mapTemplate.MapSprite;
			val2.LUIMapCoordsHover = mapTemplate.LUIMapCoordsHover;
			val2.LUIMapCoordsHoverOn = mapTemplate.LUIMapCoordsHoverOn;
			val2.TransitionSpace = mapTemplate.TransitionSpace;
			if (!val._mapInfoCollection.Maps.Contains(val2))
			{
				val._mapInfoCollection.Maps.Add(val2);
			}
			val._mapInfoCollection._activeModesAndMaps.RuntimeMaps.Add(val2.MapName);
		}
	}
	public static class NetworkManager
	{
		public enum RpcTarget
		{
			All,
			AllInclusive,
			Host
		}

		public enum RpcCaller
		{
			All,
			Host
		}

		internal static AirlockNetworkRunner Network;

		internal static VoiceChatManager vc;

		internal static Dictionary<string, AirlockRpc> StringToAirlockRpc = new Dictionary<string, AirlockRpc>();

		internal static Dictionary<AirlockRpc, MethodBase> RegisteredRpcs = new Dictionary<AirlockRpc, MethodBase>();

		internal static List<Action<AirlockEventInfo>> onEventCallbacks = new List<Action<AirlockEventInfo>>();

		public static void SendRpc(string rpc, params object[] param)
		{
			ProcessSendingRpc(rpc, -1, param);
		}

		public static void SendRpc(string rpc, int targetPlayer = -1, params object[] param)
		{
			ProcessSendingRpc(rpc, targetPlayer, param);
		}

		internal static bool ValidateVC()
		{
			if ((Object)(object)vc != (Object)null)
			{
				return true;
			}
			VoiceChatManager val = Object.FindObjectOfType<VoiceChatManager>();
			if ((Object)(object)val != (Object)null)
			{
				vc = val;
				return true;
			}
			return false;
		}

		public static void AddOnEventCallback(Action<AirlockEventInfo> eventInfo)
		{
			if (!onEventCallbacks.Contains(eventInfo))
			{
				onEventCallbacks.Add(eventInfo);
			}
		}

		internal static void OnEvent(AirlockEventInfo eventInfo)
		{
			foreach (Action<AirlockEventInfo> onEventCallback in onEventCallbacks)
			{
				onEventCallback(eventInfo);
			}
		}

		internal static void RaiseEvent(int eventCode, Hashtable content, RaiseEventOptions raiseEventOptions, SendOptions sendOptions)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			if (!ValidateVC())
			{
				Logging.Warn("RaiseEvent can only be called within a game!");
				return;
			}
			if ((Object)(object)vc.VoiceConnection == (Object)null)
			{
				Logging.Warn("RaiseEvent can only be called within a game!");
				return;
			}
			if (vc.VoiceConnection.Client == null)
			{
				Logging.Warn("RaiseEvent can only be called within a game!");
				return;
			}
			Hashtable val = new Hashtable();
			Il2CppStructArray<char> val2 = new Il2CppStructArray<char>(eventCode.ToString().ToCharArray());
			val.Add((byte)0, (Object)new String(val2));
			val.Add((byte)1, (Object)(object)content);
			((LoadBalancingClient)vc.VoiceConnection.Client).OpRaiseEvent((byte)125, (Object)(object)val, raiseEventOptions, sendOptions);
		}

		public static double GetPing()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Network))
			{
				return ((NetworkRunner)Network).Simulation.GetPlayerRtt(((NetworkRunner)Network).LocalPlayer);
			}
			return 0.0;
		}

		public static double GetPing(PlayerState player)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Network))
			{
				return ((NetworkRunner)Network).Simulation.GetPlayerRtt(PlayerRef.op_Implicit(player.PlayerId));
			}
			return 0.0;
		}

		private static void WriteValue(BinaryWriter writer, object value)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: 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_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			if (!(value is int value2))
			{
				if (!(value is float value3))
				{
					if (!(value is byte value4))
					{
						if (!(value is bool value5))
						{
							if (!(value is string value6))
							{
								GameObject val = (GameObject)((value is GameObject) ? value : null);
								if (val == null)
								{
									if (!(value is PlayerRef val2))
									{
										if (!(value is Vector3 val3))
										{
											if (!(value is Quaternion val4))
											{
												Transform val5 = (Transform)((value is Transform) ? value : null);
												if (val5 == null)
												{
													if (!(value is Color val6))
													{
														if (!(value is Color32 val7))
														{
															if (!(value is Rect val8))
															{
																if (!(value is Vector2 val9))
																{
																	if (!(value is Vector4 val10))
																	{
																		if (value is IList list)
																		{
																			writer.Write((byte)16);
																			writer.Write(list.Count);
																			{
																				foreach (object item in list)
																				{
																					WriteValue(writer, item);
																				}
																				return;
																			}
																		}
																		throw new InvalidOperationException($"Unsupported value type: {value?.GetType()}");
																	}
																	writer.Write((byte)15);
																	writer.Write(val10.x);
																	writer.Write(val10.y);
																	writer.Write(val10.z);
																	writer.Write(val10.w);
																}
																else
																{
																	writer.Write((byte)14);
																	writer.Write(val9.x);
																	writer.Write(val9.y);
																}
															}
															else
															{
																writer.Write((byte)13);
																writer.Write(((Rect)(ref val8)).x);
																writer.Write(((Rect)(ref val8)).y);
																writer.Write(((Rect)(ref val8)).width);
																writer.Write(((Rect)(ref val8)).height);
															}
														}
														else
														{
															writer.Write((byte)12);
															writer.Write(val7.r);
															writer.Write(val7.g);
															writer.Write(val7.b);
															writer.Write(val7.a);
														}
													}
													else
													{
														writer.Write((byte)11);
														writer.Write(val6.r);
														writer.Write(val6.g);
														writer.Write(val6.b);
														writer.Write(val6.a);
													}
												}
												else
												{
													writer.Write((byte)10);
													writer.Write(TransformExtensions.GetTransformPath(val5));
												}
											}
											else
											{
												writer.Write((byte)9);
												writer.Write(val4.x);
												writer.Write(val4.y);
												writer.Write(val4.z);
												writer.Write(val4.w);
											}
										}
										else
										{
											writer.Write((byte)8);
											writer.Write(val3.x);
											writer.Write(val3.y);
											writer.Write(val3.z);
										}
									}
									else
									{
										writer.Write((byte)7);
										writer.Write(((PlayerRef)(ref val2)).PlayerId);
									}
								}
								else
								{
									writer.Write((byte)6);
									writer.Write(TransformExtensions.GetTransformPath(val.transform));
								}
							}
							else
							{
								writer.Write((byte)5);
								writer.Write(value6);
							}
						}
						else
						{
							writer.Write((byte)4);
							writer.Write(value5);
						}
					}
					else
					{
						writer.Write((byte)3);
						writer.Write(value4);
					}
				}
				else
				{
					writer.Write((byte)2);
					writer.Write(value3);
				}
			}
			else
			{
				writer.Write((byte)1);
				writer.Write(value2);
			}
		}

		private static void WriteParameters(BinaryWriter writer, params object[] param)
		{
			foreach (object value in param)
			{
				WriteValue(writer, value);
			}
		}

		internal static void ProcessSendingRpc(string rpc, int targetPlayer = -1, params object[] param)
		{
			//IL_006c: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_0221: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Network == (Object)null)
			{
				Network = Object.FindObjectOfType<AirlockNetworkRunner>();
				if ((Object)(object)Network == (Object)null)
				{
					return;
				}
			}
			using MemoryStream memoryStream = new MemoryStream();
			using BinaryWriter binaryWriter = new BinaryWriter(memoryStream, Encoding.UTF8, leaveOpen: true);
			binaryWriter.Write(rpc);
			binaryWriter.Write(param.Length);
			if (param.Length != 0)
			{
				WriteParameters(binaryWriter, param);
			}
			PlayerRef val = default(PlayerRef);
			((NetworkRunner)Network).TryGetHostPlayer(ref val);
			AirlockRpc airlockRpc = StringToAirlockRpc[rpc];
			if (val != ((NetworkRunner)Network).LocalPlayer && targetPlayer != -1)
			{
				binaryWriter.Write((byte)200);
				binaryWriter.Write(targetPlayer);
			}
			binaryWriter.Flush();
			byte[] array = memoryStream.ToArray();
			if (targetPlayer != -1)
			{
				if (PlayerRef.op_Implicit(targetPlayer) == val)
				{
					RpcRecievedPatch.Prefix((NetworkRunner)(object)Network, val, Il2CppStructArray<byte>.op_Implicit(array));
				}
				else
				{
					((NetworkRunner)Network).SendReliableDataToPlayer(PlayerRef.op_Implicit(targetPlayer), Il2CppStructArray<byte>.op_Implicit(array));
				}
				return;
			}
			PlayerRef localPlayer;
			switch (airlockRpc.RpcTarget)
			{
			case RpcTarget.All:
			{
				foreach (PlayerRef item in ((NetworkRunner)Network).ActivePlayers.PlayerIEnumeratorToArray<PlayerRef>())
				{
					PlayerRef current2 = item;
					int playerId2 = ((PlayerRef)(ref current2)).PlayerId;
					localPlayer = ((NetworkRunner)Network).LocalPlayer;
					if (playerId2 != ((PlayerRef)(ref localPlayer)).PlayerId)
					{
						((NetworkRunner)Network).SendReliableDataToPlayer(current2, Il2CppStructArray<byte>.op_Implicit(array));
					}
				}
				break;
			}
			case RpcTarget.AllInclusive:
			{
				foreach (PlayerRef item2 in ((NetworkRunner)Network).ActivePlayers.PlayerIEnumeratorToArray<PlayerRef>())
				{
					PlayerRef current = item2;
					int playerId = ((PlayerRef)(ref current)).PlayerId;
					localPlayer = ((NetworkRunner)Network).LocalPlayer;
					if (playerId == ((PlayerRef)(ref localPlayer)).PlayerId)
					{
						RpcRecievedPatch.Prefix((NetworkRunner)(object)Network, val, Il2CppStructArray<byte>.op_Implicit(array));
					}
					else
					{
						((NetworkRunner)Network).SendReliableDataToPlayer(current, Il2CppStructArray<byte>.op_Implicit(array));
					}
				}
				break;
			}
			case RpcTarget.Host:
				localPlayer = ((NetworkRunner)Network).LocalPlayer;
				if (((PlayerRef)(ref localPlayer)).PlayerId == 9)
				{
					RpcRecievedPatch.Prefix((NetworkRunner)(object)Network, val, Il2CppStructArray<byte>.op_Implicit(array));
				}
				else
				{
					((NetworkRunner)Network).SendReliableDataToPlayer(((NetworkRunner)Network).LocalPlayer, Il2CppStructArray<byte>.op_Implicit(array));
				}
				break;
			}
		}

		internal static void OnRecievedRpc(string rpc, int sender, params object[] args)
		{
			OnRecievedRpc(rpc, sender, -1, args);
		}

		internal static void OnRecievedRpc(string rpc, int sender, int targetPlayer, params object[] args)
		{
			//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)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			if (!StringToAirlockRpc.TryGetValue(rpc, out AirlockRpc value))
			{
				Logging.Debug_Warn("RPC: " + rpc + " was not found in StringToAirlockRpc! Have you registered it correctly?");
			}
			else
			{
				if (value == null)
				{
					return;
				}
				if (!RegisteredRpcs.TryGetValue(value, out MethodBase value2))
				{
					Logging.Debug_Warn("RPC: " + rpc + " was not found in RegisteredRpcs! Have you registered it correctly?");
				}
				else
				{
					if (!(value2 != null))
					{
						return;
					}
					PlayerRef val = default(PlayerRef);
					((NetworkRunner)Network).TryGetHostPlayer(ref val);
					if (value.RpcCaller == RpcCaller.Host && val != PlayerRef.op_Implicit(sender))
					{
						return;
					}
					ParameterInfo[] parameters = value2.GetParameters();
					if (parameters.Count() != 0 && parameters.Last().ParameterType == typeof(AirlockRpcInfo))
					{
						AirlockRpcInfo airlockRpcInfo = new AirlockRpcInfo
						{
							Rpc = rpc,
							Target = value.RpcTarget,
							Caller = value.RpcCaller,
							Sender = PlayerRef.op_Implicit(sender)
						};
						args = CollectionExtensions.AddItem<object>((IEnumerable<object>)args, (object)airlockRpcInfo).ToArray();
					}
					switch (value.RpcTarget)
					{
					case RpcTarget.All:
					{
						PlayerRef localPlayer = ((NetworkRunner)Network).LocalPlayer;
						if (sender != ((PlayerRef)(ref localPlayer)).PlayerId)
						{
							InvokeRpc(value2, args);
						}
						break;
					}
					case RpcTarget.AllInclusive:
						InvokeRpc(value2, args);
						break;
					case RpcTarget.Host:
						if (val == ((NetworkRunner)Network).LocalPlayer)
						{
							InvokeRpc(value2, args);
						}
						break;
					}
				}
			}
		}

		internal static void InvokeRpc(MethodBase method, params object[] args)
		{
			method.Invoke(null, args);
		}
	}
}
namespace AirlockAPI.Main
{
	[BepInPlugin("com.airlockapi.youtubey", "AirlockAPI", "1.0.1")]
	internal class Loader : BasePlugin
	{
		public static Loader Instance;

		private Harmony harmony;

		public override void Load()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			harmony = new Harmony("com.airlockapi.youtubey");
			harmony.PatchAll();
			Instance = this;
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			foreach (Type type in types)
			{
				if (type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(MonoBehaviour)) && !ClassInjector.IsTypeRegisteredInIl2Cpp(type))
				{
					ClassInjector.RegisterTypeInIl2Cpp(type);
				}
			}
			SceneManager.sceneLoaded += UnityAction<Scene, LoadSceneMode>.op_Implicit((Action<Scene, LoadSceneMode>)OnSceneLoaded);
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
		{
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			string name = ((Scene)(ref scene)).name;
			if (name == "Boot")
			{
				PluginInfo[] array = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Values.ToArray();
				for (int i = 0; i < array.Length; i++)
				{
					Assembly assembly = array[i].Instance?.GetType().Assembly;
					if (!(assembly != null))
					{
						continue;
					}
					Type[] types = assembly.GetTypes();
					foreach (Type type in types)
					{
						MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
						foreach (MethodInfo methodInfo in methods)
						{
							AirlockRpc customAttribute = methodInfo.GetCustomAttribute<AirlockRpc>();
							if (customAttribute != null)
							{
								NetworkManager.StringToAirlockRpc.Add(customAttribute.RpcName, customAttribute);
								NetworkManager.RegisteredRpcs.Add(customAttribute, methodInfo);
								Logging.Debug_Log("Found RPC: " + customAttribute.RpcName);
							}
						}
						if (type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(CustomGameHandler)))
						{
							if (!ClassInjector.IsTypeRegisteredInIl2Cpp(type))
							{
								ClassInjector.RegisterTypeInIl2Cpp(type);
							}
							GamemodeManager.GamemodeHandlerTypes.Add(type);
							Logging.Debug_Log("Found Gamemode Script: " + type.Name);
						}
					}
				}
			}
			if (!(name != "Boot") || !(name != "Title") || !CurrentMode.IsHosting)
			{
				return;
			}
			foreach (Type gamemodeHandlerType in GamemodeManager.GamemodeHandlerTypes)
			{
				if (gamemodeHandlerType.Name.ToLower().Replace(" ", "").Contains(CurrentMode.Name.ToLower().Replace(" ", "")))
				{
					new GameObject("AIRLOCKAPI").AddComponent(Il2CppType.From(gamemodeHandlerType));
				}
			}
		}
	}
}
namespace AirlockAPI.Handlers
{
	public class CustomGameHandler : MonoBehaviour
	{
		public static CustomGameHandler Current;

		public Dictionary<PlayerState, GameRole> AssignedRoles = new Dictionary<PlayerState, GameRole>();

		public GameStateManager State;

		public RoleManager Role;

		public VoteManager Vote;

		private void Awake()
		{
			if ((Object)(object)Current == (Object)null)
			{
				Current = this;
				Current.State = Object.FindObjectOfType<GameStateManager>();
				Current.Role = Object.FindObjectOfType<RoleManager>();
				Current.Vote = Object.FindObjectOfType<VoteManager>();
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
		}

		public virtual bool OnTargetedAction(ref PlayerState killer, ref PlayerState victim, ref int action)
		{
			return true;
		}

		public virtual bool OnPlayerVoted(ref PlayerState voter, ref PlayerState voted)
		{
			return true;
		}

		public virtual bool OnPlayerVotedSkip(ref PlayerState voter)
		{
			return true;
		}

		public virtual bool OnPlayerEjected(ref PlayerState ejectedPlayer, ref GameRole role)
		{
			return true;
		}

		public virtual bool OnMeetingCalled(ref PlayerState reportingPlayer)
		{
			return true;
		}

		public virtual bool OnBodyReported(ref PlayerState bodyReported, ref PlayerState reportingPlayer)
		{
			return true;
		}

		public virtual bool OnVotingBegan(ref PlayerState bodyReported, ref PlayerState reportingPlayer)
		{
			return true;
		}

		public virtual bool OnAllVotesCast()
		{
			return true;
		}

		public virtual bool OnGameStart()
		{
			return true;
		}

		public virtual bool OnBeforeAssignRoles()
		{
			return true;
		}

		public virtual void OnAfterAssignRoles()
		{
		}

		public virtual bool OnGameEnd(ref GameTeam teamThatWon)
		{
			return true;
		}

		public GameRole GetTrueRole(PlayerState player)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<GameRole, List<int>> enumerator = Current.Role.gameRoleToPlayerIds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				KeyValuePair<GameRole, List<int>> current = enumerator.Current;
				Enumerator<int> enumerator2 = current.Value.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					int current2 = enumerator2.Current;
					if (NetworkBool.op_Implicit(player.IsConnected) && current2 == player.PlayerId)
					{
						return current.Key;
					}
				}
			}
			return (GameRole)0;
		}
	}
}
namespace AirlockAPI.Debug
{
	internal static class Logging
	{
		public static void Log(string message)
		{
			((BasePlugin)Loader.Instance).Log.LogInfo((object)message);
		}

		public static void Warn(string message)
		{
			((BasePlugin)Loader.Instance).Log.LogWarning((object)message);
		}

		public static void Error(string message, bool crash = false)
		{
			((BasePlugin)Loader.Instance).Log.LogError((object)message);
			if (crash)
			{
				Application.Quit();
			}
		}

		public static void Debug_Log(string message)
		{
		}

		public static void Debug_Warn(string message)
		{
		}

		public static void Debug_Error(string message)
		{
		}
	}
}
namespace AirlockAPI.Data
{
	public class AirlockEventInfo
	{
		public int code;

		public Hashtable? customData;

		public AirlockEventInfo(int code, Hashtable customData)
		{
			this.code = code;
			this.customData = customData;
		}
	}
	public class AirlockRpcInfo
	{
		public PlayerRef Sender { get; internal set; } = PlayerRef.None;

		public string Rpc { get; internal set; } = "";

		public NetworkManager.RpcTarget Target { get; internal set; }

		public NetworkManager.RpcCaller Caller { get; internal set; }
	}
	public static class CurrentMode
	{
		public static string Name = "";

		public static bool Modded;

		public static bool IsHosting;
	}
	internal static class Info
	{
		public const string Name = "AirlockAPI";

		public const string VersionAPI = "1.0.1";

		public const string Developer = "YouTubey";

		public const string GUID = "com.airlockapi.youtubey";
	}
}
namespace AirlockAPI.Components
{
	public class AirlockNetworkTransform : MonoBehaviour
	{
		private Vector3 oldScale;

		private Quaternion oldRot;

		private Vector3 oldPos;

		[AirlockRpc("INTERNAL_UpdateTransform", NetworkManager.RpcTarget.All, NetworkManager.RpcCaller.Host)]
		internal static void UpdateTransform(GameObject obj, Vector3 pos, Quaternion rot, Vector3 scale)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)obj == (Object)null))
			{
				AirlockNetworkTransform component = obj.GetComponent<AirlockNetworkTransform>();
				if ((Object)(object)component != (Object)null)
				{
					((Component)component).transform.localPosition = pos;
					((Component)component).transform.localRotation = rot;
					((Component)component).transform.localScale = scale;
				}
			}
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_0064: 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_0076: 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_0038: 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_008e: 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)
			//IL_009f: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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)
			Vector3 localPosition = ((Component)this).transform.localPosition;
			Quaternion localRotation = ((Component)this).transform.localRotation;
			Vector3 localScale = ((Component)this).transform.localScale;
			if (oldScale != localScale || oldRot != localRotation || oldPos != localPosition)
			{
				NetworkManager.SendRpc("INTERNAL_UpdateTransform", ((Component)this).gameObject, localPosition, localRotation, localScale);
			}
			oldPos = ((Component)this).transform.localPosition;
			oldScale = ((Component)this).transform.localScale;
			oldRot = ((Component)this).transform.localRotation;
		}
	}
	public class AirlockSimulationBehaviour : MonoBehaviour
	{
		internal static List<AirlockSimulationBehaviour> All = new List<AirlockSimulationBehaviour>();

		public virtual void OnEvent(AirlockEventInfo eventInfo)
		{
		}

		public AirlockSimulationBehaviour()
		{
			All.Add(this);
		}

		~AirlockSimulationBehaviour()
		{
			try
			{
				All.Remove(this);
			}
			finally
			{
				((Il2CppObjectBase)this).Finalize();
			}
		}
	}
}
namespace AirlockAPI.Attributes
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
	public class AirlockRpc : Attribute
	{
		internal string RpcName;

		internal NetworkManager.RpcTarget RpcTarget;

		internal NetworkManager.RpcCaller RpcCaller;

		public AirlockRpc(string rpcName, NetworkManager.RpcTarget rpcTarget, NetworkManager.RpcCaller rpcCaller)
		{
			RpcName = rpcName;
			RpcTarget = rpcTarget;
			RpcCaller = rpcCaller;
		}

		public override string ToString()
		{
			return $"{RpcName}|{RpcTarget.ToString()}|{RpcCaller.ToString()}";
		}
	}
}

AirlockClient/BepInEx/plugins/Airlock-Client/AirlockClient.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using AirlockAPI.Attributes;
using AirlockAPI.Data;
using AirlockAPI.Handlers;
using AirlockAPI.Managers;
using AirlockClient.AC;
using AirlockClient.Attributes;
using AirlockClient.Core;
using AirlockClient.Data;
using AirlockClient.Data.Roles.CrownCatchers.Crewmate;
using AirlockClient.Data.Roles.CrownCatchers.Impostor;
using AirlockClient.Data.Roles.DeathMatch.Crewmates;
using AirlockClient.Data.Roles.DeathMatch.Impostors;
using AirlockClient.Data.Roles.HideNSeek.Crewmate;
using AirlockClient.Data.Roles.HideNSeek.Imposter;
using AirlockClient.Data.Roles.Infection.Crewmate;
using AirlockClient.Data.Roles.Infection.Imposter;
using AirlockClient.Data.Roles.MoreRoles.Crewmate;
using AirlockClient.Data.Roles.MoreRoles.Imposter;
using AirlockClient.Data.Roles.MoreRoles.Modifiers;
using AirlockClient.Data.Roles.MoreRoles.Neutral;
using AirlockClient.Handlers;
using AirlockClient.Managers;
using AirlockClient.Managers.Debug;
using AirlockClient.Managers.Dev;
using AirlockClient.Managers.Gamemode;
using AirlockClient.Patches;
using AirlockClient.Utils;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using Fusion;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.IO;
using Microsoft.CodeAnalysis;
using SG.Airlock;
using SG.Airlock.Customization;
using SG.Airlock.Cutscenes;
using SG.Airlock.Localization;
using SG.Airlock.Minigames;
using SG.Airlock.Network;
using SG.Airlock.Roles;
using SG.Airlock.Sabotage;
using SG.Airlock.Settings;
using SG.Airlock.UI;
using SG.Airlock.UI.TitleScreen;
using SG.Airlock.XR;
using SG.FusionSimulator;
using SG.GlobalEvents.Variables;
using SG.LightUI;
using TMPro;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.UIElements;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AirlockClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AirlockClient")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f298d077-ba0f-4220-8d5b-38fc240e0208")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AirlockClient.Utils
{
	public static class PlayerStateExtensions
	{
		private static AntiCheat Anticheat => AntiCheat.Instance;

		private static GameStateManager GetState()
		{
			if (Object.op_Implicit((Object)(object)Anticheat) && (Object)(object)Anticheat.State != (Object)null)
			{
				return Anticheat.State;
			}
			if (Object.op_Implicit((Object)(object)StaticRefs.Instance) && (Object)(object)StaticRefs.Instance.State != (Object)null)
			{
				return StaticRefs.Instance.State;
			}
			return null;
		}

		private static PlayerState GetPlayerStateById(int playerId)
		{
			GameStateManager state = GetState();
			object obj;
			if (state == null)
			{
				obj = null;
			}
			else
			{
				SpawnManager spawnManager = state.SpawnManager;
				obj = ((spawnManager != null) ? spawnManager.PlayerStates : null);
			}
			List<PlayerState> val = (List<PlayerState>)obj;
			if (val == null)
			{
				return null;
			}
			Enumerator<PlayerState> enumerator = val.GetEnumerator();
			while (enumerator.MoveNext())
			{
				PlayerState current = enumerator.Current;
				if ((Object)(object)current != (Object)null && current.PlayerId == playerId)
				{
					return current;
				}
			}
			return null;
		}

		public static SubRole GetSubRole(this PlayerState playerState)
		{
			return SubRole.All.FirstOrDefault((SubRole role) => (Object)(object)role.PlayerWithRole == (Object)(object)playerState);
		}

		public static void VerifyState(this PlayerState playerState)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: 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_023c: Unknown result type (might be due to invalid IL or missing references)
			if (!playerState.IsSpawned || !NetworkBool.op_Implicit(playerState.IsConnected) || (Object)(object)Anticheat == (Object)null)
			{
				return;
			}
			if (!CurrentMode.Modded && !AntiCheat.Instance.ColorToName.ContainsValue(playerState.NetworkName.Value) && playerState.NetworkName.Value != "Color###")
			{
				string text = playerState.PlayerModerationUsername.Replace("\\d", "");
				if (text != "" && !text.Contains(playerState.NetworkName.Value))
				{
					if (Object.op_Implicit((Object)(object)((Component)playerState).GetComponent<SubRole>()))
					{
						if (!((Component)playerState).GetComponent<SubRole>().IsDisplayingRole && playerState.NetworkName.Value != "DEPUTY")
						{
							playerState.Alert("invalid player username", takeAction: true);
						}
					}
					else
					{
						playerState.Alert("invalid player username", takeAction: true);
					}
				}
			}
			if (!playerState.IsSpectating && !Anticheat.State.InLobbyState() && (Anticheat.PreviousColor[playerState] != playerState.ColorId || Anticheat.PreviousGlove[playerState] != playerState.HandsId || Anticheat.PreviousHat[playerState] != playerState.HatId || Anticheat.PreviousSkin[playerState] != playerState.SkinId))
			{
				playerState.Alert("invalid cosmetics", takeAction: true);
			}
			if (playerState.IsSpectating || Anticheat.State.InLobbyState())
			{
				Anticheat.PreviousColor[playerState] = playerState.ColorId;
				Anticheat.PreviousGlove[playerState] = playerState.HandsId;
				Anticheat.PreviousHat[playerState] = playerState.HatId;
				Anticheat.PreviousSkin[playerState] = playerState.SkinId;
			}
			if ((int)playerState.ActivePowerUps != 0 && !CurrentMode.Modded && CurrentMode.Name != "Infection")
			{
				playerState.Alert("user has powerups at invalid time.", takeAction: true);
			}
			if (!(playerState.LocomotionPlayer.NetworkRigidbody.Rigidbody.velocity.x > 10f))
			{
				_ = playerState.LocomotionPlayer.NetworkRigidbody.Rigidbody.velocity.z;
				_ = 10f;
			}
			if (Anticheat.BannedUsers.Contains(playerState.PlayerModerationID.Value))
			{
				playerState.Alert("user has been banned from the lobby.", takeAction: true);
			}
		}

		public static bool VerifyVent(this PlayerState playerState)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Invalid comparison between Unknown and I4
			GameStateManager state = GetState();
			bool flag = false;
			GameModeState gameModeStateValue = state.GameModeStateValue;
			if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 5)
			{
				if ((int)playerState.GetTrueRole() != 1 || (int)playerState.ActivePowerUps != 2)
				{
					flag = true;
				}
			}
			else if ((int)playerState.GetTrueRole() != 2 && (int)playerState.GetTrueRole() != 3)
			{
				flag = true;
			}
			if (flag)
			{
				playerState.Alert("suspicious vent data", takeAction: true);
			}
			return !flag;
		}

		public static GameRole GetTrueRole(this PlayerState playerState)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<GameRole, List<int>> enumerator = StaticRefs.Instance.Role.gameRoleToPlayerIds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				KeyValuePair<GameRole, List<int>> current = enumerator.Current;
				Enumerator<int> enumerator2 = current.Value.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					int current2 = enumerator2.Current;
					if (NetworkBool.op_Implicit(playerState.IsConnected) && current2 == playerState.PlayerId)
					{
						return current.Key;
					}
				}
			}
			return (GameRole)0;
		}

		public static void Alert(this PlayerState playerState, string reason, bool takeAction)
		{
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			if (!Anticheat.VerifyModerationID(playerState.PlayerModerationID.Value))
			{
				playerState.PlayerModerationID.Value = playerState.GetActualModId();
				reason = "hidden moderation id";
				takeAction = true;
				Logging.Warn("CHEATER DETECTED! " + playerState.NetworkName.Value + " (" + playerState.PlayerModerationUsername + ", " + playerState.PlayerModerationID.Value + ") was caught cheating. Reason: " + reason + ". Reporting and banning user from lobby.");
				playerState.NetworkName.Value = "CHEATER";
				Anticheat.BannedUsers.Add(playerState.PlayerModerationID.Value);
				Anticheat.SendReportToDevelopers(playerState, reason);
				return;
			}
			playerState.PlayerModerationID.Value = playerState.GetActualModId();
			if (takeAction)
			{
				if (!Anticheat.BannedUsers.Contains(playerState.PlayerModerationID.Value))
				{
					Logging.Warn("CHEATER DETECTED! " + playerState.NetworkName.Value + " (" + playerState.PlayerModerationUsername + ", " + playerState.PlayerModerationID.Value + ") was caught cheating. Reason: " + reason + ". Reporting and banning user from lobby.");
					playerState.NetworkName.Value = "CHEATER";
					Anticheat.BannedUsers.Add(playerState.PlayerModerationID.Value);
					Anticheat.SendReportToDevelopers(playerState, reason);
				}
				else
				{
					Logging.Warn("CHEATER DETECTED! " + playerState.NetworkName.Value + " (" + playerState.PlayerModerationUsername + ", " + playerState.PlayerModerationID.Value + ") was caught cheating. Reason: " + reason + ". Banning user from lobby.");
					playerState.NetworkName.Value = "CHEATER";
				}
				if (playerState.PlayerId != 9)
				{
					((SimulationBehaviour)Anticheat.Moderation).Runner.Disconnect(PlayerRef.op_Implicit(playerState.PlayerId));
				}
				else
				{
					SceneManager.LoadScene("Title");
				}
			}
			else
			{
				Logging.Warn("CHEATER DETECTED! " + playerState.NetworkName.Value + " (" + playerState.PlayerModerationUsername + ", " + playerState.PlayerModerationID.Value + ") is being suspected of cheating. Reason: " + reason + ".");
			}
		}

		public static string GetActualModId(this PlayerState playerState)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)playerState == (Object)null)
			{
				return null;
			}
			if ((Object)(object)StaticRefs.Instance.Runner == (Object)null)
			{
				return playerState.PlayerModerationID?.Value;
			}
			string playerUserId = StaticRefs.Instance.Runner.GetPlayerUserId(playerState.LocomotionPlayer.PlayerID);
			if (string.IsNullOrEmpty(playerUserId))
			{
				return playerState.PlayerModerationID?.Value;
			}
			return playerUserId;
		}

		public static void ChangeIsAliveWithAntiCheat(this PlayerState player, bool isAlive)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Anticheat != (Object)null)
			{
				if (isAlive)
				{
					if (Anticheat.IsDead.Contains(player))
					{
						Anticheat.IsDead.Remove(player);
					}
				}
				else if (!Anticheat.IsDead.Contains(player))
				{
					Anticheat.IsDead.Add(player);
				}
			}
			player.IsAlive = NetworkBool.op_Implicit(isAlive);
		}

		public static bool VerifySpawnBody(this PlayerState body, NetworkRigidbodyObsolete rb)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			GameStateManager state = GetState();
			if ((Object)(object)state == (Object)null)
			{
				return true;
			}
			bool flag = false;
			GameModeState gameModeStateValue = state.GameModeStateValue;
			if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 5)
			{
				flag = true;
			}
			if ((Object)(object)body.LocomotionPlayer.NetworkRigidbody != (Object)(object)rb)
			{
				flag = true;
			}
			if (!flag)
			{
				if ((Object)(object)Anticheat != (Object)null)
				{
					if (!Anticheat.AllowedBodySpawns.Contains(body))
					{
						flag = true;
					}
					else
					{
						Anticheat.AllowedBodySpawns.Remove(body);
					}
				}
			}
			else
			{
				body.Alert("suspicious spawn body data", takeAction: true);
			}
			return !flag;
		}

		public static bool VerifyMeeting(this PlayerState caller, RpcInfo info)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Invalid comparison between Unknown and I4
			if ((Object)(object)Anticheat == (Object)null)
			{
				return true;
			}
			int num = PlayerRef.op_Implicit(info.Source);
			bool flag = false;
			int value = ((GenericVariable<int>)(object)Anticheat.Button._emergencyMeetingsVar).Value;
			Vector3 val = caller.LocomotionPlayer.RigidbodyPosition - ((Component)Anticheat.Button).transform.position;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (caller.PlayerId != num && ((PlayerRef)(ref info.Source)).IsValid)
			{
				GetPlayerStateById(num)?.Alert("misuse of meeting rpc", takeAction: true);
				return false;
			}
			if (!NetworkBool.op_Implicit(caller.IsAlive))
			{
				flag = true;
			}
			if (magnitude > 5f)
			{
				flag = true;
			}
			GameModeState gameModeStateValue = Anticheat.State.GameModeStateValue;
			if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 5)
			{
				flag = true;
			}
			if (!Anticheat.MeetingsCalled.ContainsKey(caller))
			{
				Anticheat.MeetingsCalled.Add(caller, 0);
			}
			Anticheat.MeetingsCalled[caller]++;
			if (Anticheat.MeetingsCalled[caller] > value)
			{
				flag = true;
			}
			if (flag)
			{
				caller.Alert("suspicious meeting data", takeAction: false);
			}
			return !flag;
		}

		public static bool VerifyVote(this PlayerState voter, PlayerState voted, RpcInfo info)
		{
			//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_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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			GameStateManager state = GetState();
			if ((Object)(object)state == (Object)null)
			{
				return true;
			}
			int num = PlayerRef.op_Implicit(info.Source);
			bool flag = false;
			if (num != voter.PlayerId && ((PlayerRef)(ref info.Source)).IsValid)
			{
				GetPlayerStateById(num)?.Alert("misuse of vote rpc", takeAction: true);
			}
			GameModeState gameModeStateValue = state.GameModeStateValue;
			if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 5)
			{
				flag = true;
			}
			if (flag)
			{
				GetPlayerStateById(num)?.Alert("suspicious vote data", takeAction: true);
			}
			return !flag;
		}

		public static bool VerifyBodyReport(this PlayerState reporter, PlayerState bodyReported, RpcInfo info)
		{
			//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_0074: 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)
			//IL_0084: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			GameStateManager state = GetState();
			if ((Object)(object)state == (Object)null)
			{
				return true;
			}
			int num = PlayerRef.op_Implicit(info.Source);
			bool flag = false;
			GameObject val = GameObject.Find("NetworkedBody (" + bodyReported.PlayerId + ")");
			if ((Object)(object)val == (Object)null)
			{
				GetPlayerStateById(num)?.Alert("suspicious report body data (missing body)", takeAction: true);
				return false;
			}
			NetworkedBody component = val.GetComponent<NetworkedBody>();
			Vector3 val2 = ((Component)component).transform.position - reporter.LocomotionPlayer.RigidbodyPosition;
			float magnitude = ((Vector3)(ref val2)).magnitude;
			if (reporter.PlayerId != num && ((PlayerRef)(ref info.Source)).IsValid)
			{
				GetPlayerStateById(num)?.Alert("misuse of body report data", takeAction: true);
				return false;
			}
			GameModeState gameModeStateValue = state.GameModeStateValue;
			if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 5)
			{
				flag = true;
			}
			if (NetworkBool.op_Implicit(bodyReported.IsAlive) || !NetworkBool.op_Implicit(reporter.IsAlive))
			{
				flag = true;
			}
			if (magnitude > 5f)
			{
				flag = true;
			}
			if ((Object)(object)Anticheat != (Object)null)
			{
				if (Anticheat.BodiesReported.Contains(bodyReported))
				{
					flag = true;
				}
				else if (!flag)
				{
					Anticheat.BodiesReported.Add(bodyReported);
				}
			}
			if (flag)
			{
				reporter.Alert("suspicious report body data", takeAction: false);
			}
			return !flag;
		}

		public static void KillPlayerWithAntiCheat(this PlayerState killer, PlayerState target)
		{
			//IL_0029: 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_0035: Invalid comparison between Unknown and I4
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Invalid comparison between Unknown and I4
			if (!Object.op_Implicit((Object)(object)Anticheat))
			{
				if (Object.op_Implicit((Object)(object)StaticRefs.Instance))
				{
					Object.FindObjectOfType<NetworkedKillBehaviour>().KillPlayer(Object.FindObjectOfType<AirlockPeer>(), target, PlayerRef.op_Implicit(killer.PlayerId), (int)killer.GetTrueRole() == 5);
				}
				return;
			}
			if (Anticheat.AllowedBodySpawns.Contains(target))
			{
				Anticheat.AllowedBodySpawns.Remove(target);
			}
			if (Anticheat.IsDead.Contains(target))
			{
				Anticheat.IsDead.Remove(target);
			}
			Anticheat.AllowedBodySpawns.Add(target);
			if (!target.Guarded)
			{
				Anticheat.Kill.KillPlayer(Anticheat.Peer, target, PlayerRef.op_Implicit(killer.PlayerId), (int)killer.GetTrueRole() == 5);
			}
			else
			{
				killer.PlayShieldBreakWithAntiCheat(target);
			}
		}

		public static void PlayShieldBreakWithAntiCheat(this PlayerState killer, PlayerState target)
		{
			//IL_0056: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Anticheat))
			{
				NetworkedKillBehaviour val = Object.FindObjectOfType<NetworkedKillBehaviour>();
				val.RPC_GuardVFX(PlayerRef.op_Implicit(target.PlayerId), true, false, false, false, -1);
				val.RPC_GuardVFX(PlayerRef.op_Implicit(target.PlayerId), false, false, true, false, -1);
				target.Guarded = false;
			}
			else
			{
				Anticheat.Kill.RPC_GuardVFX(PlayerRef.op_Implicit(target.PlayerId), true, false, false, false, -1);
				Anticheat.Kill.RPC_GuardVFX(PlayerRef.op_Implicit(target.PlayerId), false, false, true, false, -1);
				target.Guarded = false;
			}
		}

		public static void InfectPlayerWithAntiCheat(this PlayerState killer, PlayerState target)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Anticheat))
			{
				Object.FindObjectOfType<NetworkedKillBehaviour>().InfectPlayer(target, PlayerRef.op_Implicit(killer.PlayerId), (GameRole)4, Object.FindObjectOfType<AirlockPeer>());
			}
			else
			{
				Anticheat.Kill.InfectPlayer(target, PlayerRef.op_Implicit(killer.PlayerId), (GameRole)4, Anticheat.Peer);
			}
		}

		public static void ChangeHatWithAntiCheat(this PlayerState player, int hatId)
		{
			if (Object.op_Implicit((Object)(object)Anticheat))
			{
				Anticheat.PreviousHat[player] = hatId;
			}
			player.HatId = hatId;
		}

		public static void ChangeSkinWithAntiCheat(this PlayerState player, int SkinId)
		{
			if (Object.op_Implicit((Object)(object)Anticheat))
			{
				Anticheat.PreviousSkin[player] = SkinId;
			}
			player.SkinId = SkinId;
		}

		public static void ChangeGlovesWithAntiCheat(this PlayerState player, int handsId)
		{
			if (Object.op_Implicit((Object)(object)Anticheat))
			{
				Anticheat.PreviousGlove[player] = handsId;
			}
			player.HandsId = handsId;
		}

		public static void RemoveSpellWithAntiCheat(this PlayerState caller, PlayerState victim, bool toggleKill)
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Anticheat))
			{
				if (!(caller.GetSubRole() is Witch))
				{
					return;
				}
				if (Anticheat.RoleTargets.ContainsKey(caller) && Anticheat.RoleTargets[caller].Contains(victim))
				{
					Anticheat.RoleTargets[caller].Remove(victim);
				}
			}
			if (!(caller.GetSubRole() is Witch))
			{
				return;
			}
			Witch witch = (Witch)caller.GetSubRole();
			if (witch.spellsCasted.ContainsKey(victim))
			{
				victim.NetworkName.Value = witch.spellsCasted[victim];
				witch.spellsCasted.Remove(victim);
				if (toggleKill)
				{
					victim.IsAlive = NetworkBool.op_Implicit(false);
				}
			}
		}

		public static void CastSpellWithAntiCheat(this PlayerState caller, PlayerState victim)
		{
			if (Object.op_Implicit((Object)(object)Anticheat))
			{
				if (!(caller.GetSubRole() is Witch))
				{
					return;
				}
				if (!Anticheat.RoleTargets.ContainsKey(caller))
				{
					Anticheat.RoleTargets.Add(caller, new List<PlayerState>());
				}
				Anticheat.RoleTargets[caller].Add(victim);
			}
			if (caller.GetSubRole() is Witch)
			{
				Witch witch = (Witch)caller.GetSubRole();
				witch.spellsCasted[victim] = victim.NetworkName.Value;
			}
		}

		public static void DousePlayerWithAntiCheat(this PlayerState player, PlayerState victim)
		{
			if (Object.op_Implicit((Object)(object)Anticheat))
			{
				if (!(player.GetSubRole() is Arsonist))
				{
					return;
				}
				if (!Anticheat.RoleTargets.ContainsKey(player))
				{
					Anticheat.RoleTargets.Add(player, new List<PlayerState>());
				}
				Anticheat.RoleTargets[player].Add(victim);
			}
			if (player.GetSubRole() is Arsonist)
			{
				Arsonist arsonist = (Arsonist)player.GetSubRole();
				arsonist.dousedPlayers[victim] = victim.NetworkName.Value;
			}
		}

		public static bool VerifyKill(this PlayerState killer, PlayerState target, int action)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected I4, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Invalid comparison between Unknown and I4
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Invalid comparison between Unknown and I4
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Invalid comparison between Unknown and I4
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Invalid comparison between Unknown and I4
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Invalid comparison between Unknown and I4
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Invalid comparison between Unknown and I4
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Invalid comparison between Unknown and I4
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Invalid comparison between Unknown and I4
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Invalid comparison between Unknown and I4
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Invalid comparison between Unknown and I4
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Invalid comparison between Unknown and I4
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Invalid comparison between Unknown and I4
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Invalid comparison between Unknown and I4
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Invalid comparison between Unknown and I4
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: 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_031c: Invalid comparison between Unknown and I4
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Invalid comparison between Unknown and I4
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Invalid comparison between Unknown and I4
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Invalid comparison between Unknown and I4
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Invalid comparison between Unknown and I4
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Invalid comparison between Unknown and I4
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Invalid comparison between Unknown and I4
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Invalid comparison between Unknown and I4
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: 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_020e: Invalid comparison between Unknown and I4
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Invalid comparison between Unknown and I4
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Invalid comparison between Unknown and I4
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			GameStateManager state = GetState();
			if ((Object)(object)state == (Object)null)
			{
				return true;
			}
			bool flag = false;
			Vector3 val = killer.LocomotionPlayer.RigidbodyPosition - target.LocomotionPlayer.RigidbodyPosition;
			float magnitude = ((Vector3)(ref val)).magnitude;
			GameRole trueRole = killer.GetTrueRole();
			GameRole trueRole2 = target.GetTrueRole();
			if ((Object)(object)killer == (Object)(object)target)
			{
				flag = true;
			}
			GameModeState gameModeStateValue;
			if (!CurrentMode.Modded && (Object)(object)Anticheat != (Object)null)
			{
				if (Anticheat.TargetActionCheck.TryGetValue(killer, out var value))
				{
					double totalSeconds = (DateTime.Now - value).TotalSeconds;
					if ((int)trueRole != 9)
					{
						if ((int)trueRole == 1)
						{
							gameModeStateValue = Anticheat.State._GameModeStateValue;
							if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 5)
							{
								if (totalSeconds < (double)(Anticheat.GetCooldownForRole((GameRole)1) - 1f) || (int)killer.ActivePowerUps == 0)
								{
									flag = true;
								}
							}
							else if (totalSeconds < (double)(Anticheat.GetCooldownForRole((GameRole)1) - 1f))
							{
								flag = true;
							}
						}
						else if (totalSeconds < (double)(Anticheat.GetCooldownForRole(trueRole) - 1f))
						{
							flag = true;
						}
					}
					else if (totalSeconds < (double)(Anticheat.GetCooldownForRole((GameRole)9, whenAlive: false) - 1f))
					{
						flag = true;
					}
				}
				else
				{
					Anticheat.TargetActionCheck.Add(killer, DateTime.Now);
				}
			}
			if (magnitude > 6f || !NetworkBool.op_Implicit(target.IsAlive))
			{
				flag = true;
			}
			ProximityTargetedAction val2 = (ProximityTargetedAction)action;
			switch (val2 - -1)
			{
			case 0:
				flag = true;
				break;
			case 1:
				if (CurrentMode.Name == "Hide N Seek")
				{
					if ((int)trueRole == 4 && (int)trueRole2 == 1)
					{
						gameModeStateValue = state.GameModeStateValue;
						if ((int)((GameModeState)(ref gameModeStateValue)).GameMode != 5 && state.InTaskState())
						{
							goto IL_021a;
						}
					}
					flag = true;
				}
				else if ((int)trueRole == 2)
				{
					if ((int)trueRole2 != 2)
					{
						gameModeStateValue = state.GameModeStateValue;
						if ((int)((GameModeState)(ref gameModeStateValue)).GameMode != 5 && state.InTaskState())
						{
							goto IL_021a;
						}
					}
					flag = true;
				}
				else
				{
					if ((int)trueRole == 5)
					{
						gameModeStateValue = state.GameModeStateValue;
						if ((int)((GameModeState)(ref gameModeStateValue)).GameMode != 5 && state.InTaskState())
						{
							goto IL_021a;
						}
					}
					flag = true;
				}
				goto IL_021a;
			case 3:
				if ((int)killer.ActivePowerUps == 1 && (int)trueRole2 == 4)
				{
					gameModeStateValue = state.GameModeStateValue;
					if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 5 && state.InTaskState())
					{
						break;
					}
				}
				flag = true;
				break;
			case 2:
				if ((int)trueRole == 4 && (int)trueRole2 != 4)
				{
					gameModeStateValue = state.GameModeStateValue;
					if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 5 && state.InTaskState())
					{
						break;
					}
				}
				flag = true;
				break;
			case 4:
				gameModeStateValue = state.GameModeStateValue;
				if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 5)
				{
					if ((int)killer.ActivePowerUps != 16 || (int)trueRole2 != 1 || !state.InTaskState())
					{
						flag = true;
					}
				}
				else if ((int)trueRole != 8 || !state.InTaskState())
				{
					flag = true;
				}
				break;
			case 5:
				if ((int)trueRole == 6)
				{
					gameModeStateValue = state.GameModeStateValue;
					if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 8 && state.InVotingState())
					{
						break;
					}
				}
				flag = true;
				break;
			case 7:
				if ((int)trueRole == 9)
				{
					gameModeStateValue = state.GameModeStateValue;
					if ((int)((GameModeState)(ref gameModeStateValue)).GameMode == 10 && state.InVotingState())
					{
						goto IL_0328;
					}
				}
				flag = true;
				goto IL_0328;
			default:
				throw new ArgumentOutOfRangeException();
			case 6:
			case 8:
				break;
				IL_021a:
				if (!flag && (Object)(object)Anticheat != (Object)null)
				{
					Anticheat.AllowedBodySpawns.Add(target);
				}
				break;
				IL_0328:
				if (!flag && (Object)(object)Anticheat != (Object)null)
				{
					Anticheat.AllowedBodySpawns.Add(target);
				}
				break;
			}
			if (!flag)
			{
				if ((Object)(object)Anticheat != (Object)null)
				{
					Anticheat.TargetActionCheck[killer] = DateTime.Now;
				}
			}
			else
			{
				killer.Alert("suspicious kill data", takeAction: false);
			}
			return !flag;
		}
	}
	public class StaticRefs : MonoBehaviour
	{
		public ModerationManager Moderation;

		public RoleManager Role;

		public GameStateManager State;

		public EmergencyButton Button;

		public NetworkedKillBehaviour Kill;

		public AirlockPeer Peer;

		public ChatManager Chat;

		public RoleManager RoleManager;

		public NetworkRunner Runner;

		public static StaticRefs Instance;

		private void Start()
		{
			Instance = this;
			Chat = Object.FindObjectOfType<ChatManager>();
			Role = Object.FindObjectOfType<RoleManager>();
			State = Object.FindObjectOfType<GameStateManager>();
			Moderation = Object.FindObjectOfType<ModerationManager>();
			Peer = Object.FindObjectOfType<AirlockPeer>();
			Chat = Object.FindObjectOfType<ChatManager>();
			Button = Object.FindObjectOfType<EmergencyButton>();
			Kill = Object.FindObjectOfType<NetworkedKillBehaviour>();
			Runner = Object.FindObjectOfType<NetworkRunner>();
			RoleManager = Object.FindObjectOfType<RoleManager>();
		}
	}
}
namespace AirlockClient.Patches
{
	[HarmonyPatch(typeof(VoteManager), "ChooseSheriff")]
	public class AssignSheriffPatch
	{
		public static float originalSpeed;

		public static void Postfix(VoteManager __instance)
		{
			try
			{
				if (CurrentMode.IsHosting && CurrentMode.Modded && !(CurrentMode.Name != "More Roles"))
				{
					if (Object.FindObjectOfType<DSpUp>().PlayerWithModifier.PlayerId == __instance.SheriffId)
					{
						originalSpeed = ((SettingsItem<FloatVariable, float>)(object)ModdedGameStateManager.Instance.GetRoleSetting(Enums.RoleFloatSettings.SheriffSpeedMultiplier)).GetValue();
						Logging.Debug_Log($"Sheriff Original speed: {((SettingsItem<FloatVariable, float>)(object)ModdedGameStateManager.Instance.GetRoleSetting(Enums.RoleFloatSettings.SheriffSpeedMultiplier)).GetValue()}");
						ModdedGameStateManager.Instance.SetRoleSetting(Enums.RoleFloatSettings.SheriffSpeedMultiplier, ((SettingsItem<FloatVariable, float>)(object)ModdedGameStateManager.Instance.GetRoleSetting(Enums.RoleFloatSettings.SheriffSpeedMultiplier)).GetValue() + 0.1f);
						Logging.Debug_Log($"Sheriff new speed: {((SettingsItem<FloatVariable, float>)(object)ModdedGameStateManager.Instance.GetRoleSetting(Enums.RoleFloatSettings.SheriffSpeedMultiplier)).GetValue()}");
					}
					Logging.Debug_Log($"PlayerID: {Object.FindObjectOfType<DSpUp>().PlayerWithModifier.PlayerId}, DeputyID: {__instance.SheriffId}");
				}
			}
			catch (Exception ex)
			{
				Logging.Error(ex.ToString());
			}
		}
	}
	[HarmonyPatch(typeof(AirlockBootstrap), "Main")]
	public class BootstrapPatch
	{
		public static void Prefix(AirlockBootstrap __instance)
		{
			Base.OnInit();
		}
	}
	internal static class PlayerSavedState
	{
		private static readonly Dictionary<int, (int color, int hat)> _store = new Dictionary<int, (int, int)>();

		public static void SetColor(int id, int color)
		{
			if (color != 18 && color != 0)
			{
				_store.TryGetValue(id, out (int, int) value);
				_store[id] = (color, value.Item2);
			}
		}

		public static void SetHat(int id, int hat)
		{
			if (hat != 18 && hat != 12)
			{
				_store.TryGetValue(id, out (int, int) value);
				_store[id] = (value.Item1, hat);
			}
		}

		public static void Init(int id, int color, int hat)
		{
			if (!_store.ContainsKey(id))
			{
				_store[id] = (color, hat);
			}
		}

		public static bool TryGet(int id, out int color, out int hat)
		{
			if (_store.TryGetValue(id, out (int, int) value))
			{
				(color, hat) = value;
				return true;
			}
			color = (hat = 0);
			return false;
		}
	}
	public class BreakColorsPatch
	{
		internal static readonly Dictionary<int, int> StateIdToPlayerId = new Dictionary<int, int>();

		public static void Postfix(NetworkedLocomotionPlayer __instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentMode.IsHosting && CurrentMode.Modded && !(CurrentMode.Name != "More Roles"))
			{
				StateIdToPlayerId[__instance._playerState.PlayerId] = PlayerRef.op_Implicit(__instance.PlayerID);
				PlayerSavedState.Init(PlayerRef.op_Implicit(__instance.PlayerID), __instance._playerState.ColorId, __instance._playerState.HatId);
				if (__instance._playerState.ColorId != 18)
				{
					__instance._playerState.ColorId = 18;
				}
			}
		}
	}
	public class BreakColorsPatch2
	{
		public static void Prefix(NetworkedLocomotionPlayer __instance)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentMode.IsHosting && CurrentMode.Modded && CurrentMode.Name == "More Roles")
			{
				__instance.PState.ColorId = 18;
				if (PlayerSavedState.TryGet(PlayerRef.op_Implicit(__instance.PlayerID), out var color, out var hat))
				{
					CoroutineHandler.Start(RestoreAfterDelay(__instance, color, hat));
				}
			}
		}

		private static IEnumerator RestoreAfterDelay(NetworkedLocomotionPlayer player, int color, int hat)
		{
			yield return (object)new WaitForSeconds(5f);
			BreakColorsPatch.StateIdToPlayerId.Remove(player._playerState.PlayerId);
			player._playerState.ColorId = color;
			yield return (object)new WaitForSeconds(2f);
			player._playerState.HatId = hat;
		}
	}
	public class BreakColorsPatch4
	{
		public static void Prefix(PlayerState __instance, ref int i)
		{
			if (CurrentMode.IsHosting && CurrentMode.Modded && CurrentMode.Name == "More Roles" && i != 18 && BreakColorsPatch.StateIdToPlayerId.TryGetValue(__instance.PlayerId, out var value))
			{
				PlayerSavedState.SetColor(value, i);
			}
		}
	}
	public class BreakColorsPatch5
	{
		public static void Prefix(NetworkedLocomotionPlayer __instance, ref int hatId)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentMode.IsHosting && CurrentMode.Modded && CurrentMode.Name == "More Roles" && hatId != 18)
			{
				PlayerSavedState.SetHat(PlayerRef.op_Implicit(__instance.PlayerID), hatId);
			}
		}
	}
	public class savecosmetics
	{
		public static void Postfix(NetworkedLocomotionPlayer __instance, ref int color, ref int hat, ref int hands, ref int skin)
		{
			//IL_0001: 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)
			PlayerSavedState.SetHat(PlayerRef.op_Implicit(__instance.PlayerID), hat);
			PlayerSavedState.SetColor(PlayerRef.op_Implicit(__instance.PlayerID), color);
		}
	}
	[HarmonyPatch(typeof(GameStateManager), "EndGame")]
	public class EndGamePatch
	{
		public static void Prefix(GameStateManager __instance, GameTeam winningTeam)
		{
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentMode.IsHosting && CurrentMode.Modded && CurrentMode.Name == "More Roles")
			{
				Logging.Debug_Log($"SubRolesFound: {SubRole.All.ToArray()}");
				Lawyer instance = Lawyer.Instance;
				if ((Object)(object)instance != (Object)null)
				{
					Logging.Debug_Log("Lawyer isn't null checking if they can win.");
					if (instance.LawyerWinsWithClient)
					{
						Logging.Debug_Log("lawyer's client want voted out they can win checking if their client won.");
						if (MoreRolesManager.GetTrueTeam(instance.Client) == winningTeam)
						{
							Logging.Debug_Log($"Client TrueTeam: {MoreRolesManager.GetTrueTeam(instance.Client)}, WinningTeam: {winningTeam}");
							Object.FindObjectOfType<NetworkedKillBehaviour>().AlterRole(MoreRolesManager.GetTrueRoleMR(instance.Client), PlayerRef.op_Implicit(instance.PlayerWithRole.PlayerId), 0f);
							Logging.Debug_Log("Client Won and wasn't voted out Altering role");
							Logging.Debug_Log($"Altered Lawyer Role, New Role: {instance.PlayerWithRole.KnownGameRole}");
						}
						else
						{
							Logging.Debug_Log($"Client KnownGameTeam: {MoreRolesManager.GetTrueTeam(instance.Client)}, WinningTeam: {winningTeam}");
							Logging.Debug_Warn("Client didnt win");
						}
					}
					else
					{
						Logging.Debug_Warn("Lawyer's client was voted out");
					}
				}
				else
				{
					Logging.Debug_Error("lawyer is null!");
				}
			}
			foreach (SubRole item in SubRole.All)
			{
				item.OnGameEnd(winningTeam);
			}
		}
	}
	[HarmonyPatch(typeof(GameStateManager), "ReportWin")]
	public class EndGameTestingPatch
	{
		public static void Prefix(GameTeam winningTeam)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			if (!CurrentMode.IsHosting || !CurrentMode.Modded || !(CurrentMode.Name == "More Roles"))
			{
				return;
			}
			Logging.Debug_Log($"SubRolesFound: {SubRole.All.ToArray()}");
			Lawyer instance = Lawyer.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				Logging.Debug_Log("Lawyer isn't null checking if they can win.");
				if (instance.LawyerWinsWithClient)
				{
					Logging.Debug_Log("lawyer's client wasn't voted out they can win, checking if their client won.");
					if (MoreRolesManager.GetTrueTeam(instance.Client) == winningTeam)
					{
						Logging.Debug_Log($"Client TrueTeam: {MoreRolesManager.GetTrueTeam(instance.Client)}, WinningTeam: {winningTeam}");
						Object.FindObjectOfType<NetworkedKillBehaviour>().AlterRole(MoreRolesManager.GetTrueRoleMR(instance.Client), PlayerRef.op_Implicit(instance.PlayerWithRole.PlayerId), 0f);
						Logging.Debug_Log("Client Won and wasn't voted out Altering role");
						Logging.Debug_Log($"Altered Lawyer Role, New Role: {instance.PlayerWithRole.KnownGameRole}");
					}
					else
					{
						Logging.Debug_Log($"Client KnownGameTeam: {MoreRolesManager.GetTrueTeam(instance.Client)}, WinningTeam: {winningTeam}");
						Logging.Debug_Warn("Client didnt win");
					}
				}
				else
				{
					Logging.Debug_Warn("Lawyer's client was voted out");
				}
			}
			else
			{
				Logging.Debug_Error("lawyer is null!");
			}
		}
	}
	internal static class CosmeticHelper
	{
		private static void RevertCosmeticsToSaved(PlayerState player)
		{
			if (CurrentMode.IsHosting && CurrentMode.Modded && CurrentMode.Name == "More Roles" && PlayerSavedState.TryGet(player.PlayerId, out var color, out var hat))
			{
				player.ColorId = color;
				player.HatId = hat;
			}
		}

		public static IEnumerator RevertAllAfterDelay()
		{
			yield return (object)new WaitForSeconds(7f);
			Enumerator<PlayerState> enumerator = MoreRolesManager.Spawn.ActivePlayerStates.GetEnumerator();
			while (enumerator.MoveNext())
			{
				PlayerState current = enumerator.Current;
				RevertCosmeticsToSaved(current);
			}
		}
	}
	[HarmonyPatch(typeof(VoteManager), "EndVote")]
	public class EndVotePatch
	{
		public static void Prefix(VoteManager __instance)
		{
			foreach (SubRole item in SubRole.All)
			{
				item.OnAllVotesCast();
			}
		}
	}
	[HarmonyPatch(typeof(SabotageManager), "RPC_EndSabotage")]
	public class FixSabotagePatch
	{
		public static bool Prefix()
		{
			if (CurrentMode.Name == "Hide N Seek")
			{
				return ((HideNSeekManager)(object)CustomGameHandler.Current).AllowSabotagesToBeTurnedOff;
			}
			if (CurrentMode.Name == "Containment")
			{
				((ContainmentManager)(object)CustomGameHandler.Current).OnRepairedSabotage();
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(MinigamePlayer), "RPC_IncrementCompletedTasks")]
	public class IncrementTaskPatch
	{
		public static void Prefix()
		{
			if (CurrentMode.Name == "Hide N Seek")
			{
				GameStateManager state = CustomGameHandler.Current.State;
				state._gamemodeTimerCurrent -= 5f;
			}
		}
	}
	[HarmonyPatch(typeof(ModerationManager), "RPC_KickVote")]
	public class KickPatch
	{
		private static int calls;

		private static float windowStart = -1f;

		private const float WindowSeconds = 0.2f;

		[HarmonyPrefix]
		public static bool Prefix()
		{
			float time = Time.time;
			if (windowStart < 0f || time - windowStart >= 0.2f)
			{
				windowStart = time;
				calls = 0;
			}
			calls++;
			return calls < 3;
		}
	}
	[HarmonyPatch(typeof(GamemodeSelectionMenu), "OnModeSelect")]
	public class OnModeSelectPatch
	{
		public static void Prefix(GamemodeSelectionMenu __instance, MapModeSelect modeSelect)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			if (modeSelect.ModeInfo.ModeName.StartsWith("<size=0>MODDED</size><color=yellow>") && (Object)(object)((Component)modeSelect.ModeIcon).gameObject.transform.Find("ModdedIcon") == (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(((Component)modeSelect.ModeIcon).gameObject, ((Component)modeSelect.ModeIcon).transform.parent);
				((Component)modeSelect.ModeIcon).transform.position = new Vector3(1000f, 1000f, 1000f);
				Object.Destroy((Object)(object)val.GetComponent<Renderer>());
				Object.Destroy((Object)(object)val.GetComponent<LUITile>());
				Object.Destroy((Object)(object)val.GetComponent<MeshFilter>());
				Image val2 = val.AddComponent<Image>();
				if (CurrentMode.Name == "More Roles")
				{
					val2.sprite = StorageManager.Instance.MoreRolesIcon;
					val2.preserveAspect = true;
				}
				else if (CurrentMode.Name == "Hide N Seek")
				{
					val2.sprite = StorageManager.Instance.HideNSeekIcon;
					val2.preserveAspect = true;
				}
				else if (CurrentMode.Name == "Sandbox")
				{
					val2.sprite = StorageManager.Instance.FreeRoamIcon;
					val2.preserveAspect = true;
				}
				else if (CurrentMode.Name == "Lights Out")
				{
					val2.sprite = StorageManager.Instance.LightsOutIcon;
					val2.preserveAspect = true;
				}
				else if (CurrentMode.Name == "Infection")
				{
					val2.sprite = StorageManager.Instance.InfectedIcon;
					val2.preserveAspect = true;
				}
				else if (CurrentMode.Name == "Containment")
				{
					val2.sprite = StorageManager.Instance.ContainmentIcon;
					val2.preserveAspect = true;
				}
				else if (CurrentMode.Name == "Round Up")
				{
					val2.sprite = StorageManager.Instance.SheriffIcon;
					val2.preserveAspect = true;
				}
				else if (CurrentMode.Name == "DeathMatch")
				{
					val2.sprite = StorageManager.Instance.DeathMatchIcon;
					val2.preserveAspect = true;
				}
				else if (CurrentMode.Name == "Crown Runners")
				{
					val2.sprite = StorageManager.Instance.CrownRunnersIcon;
					val2.preserveAspect = true;
				}
				else
				{
					val2.sprite = StorageManager.Instance.ModStamp;
				}
				((Object)val).name = "ModdedIcon";
			}
		}
	}
	[HarmonyPatch(typeof(CutsceneManager), "RPC_ReplayGame")]
	public class ReplayPatch
	{
		public static void Prefix()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentMode.Modded && CurrentMode.IsHosting && Object.op_Implicit((Object)(object)ModdedGameStateManager.Instance) && ModdedGameStateManager.Instance.state.InLobbyState())
			{
				ModdedGameStateManager.Instance.state.RPC_ToggleLobbyDoors(NetworkBool.op_Implicit(false));
			}
		}
	}
	[HarmonyPatch(typeof(PlayerState), "ApplyRandomPowerUp")]
	public class RequestPowerupPatch
	{
		public static bool Prefix()
		{
			return CurrentMode.Name != "Hide N Seek";
		}
	}
	[HarmonyPatch(typeof(NetworkRunner), "OnMessageUser")]
	public class RpcRecievedPatch
	{
		public unsafe static void Prefix(NetworkRunner __instance, SimulationMessage* message)
		{
			RpcData.FromMessage(__instance, message);
		}
	}
	[HarmonyPatch(typeof(LUIElement), "SetHeight")]
	public class SetHeightPatch
	{
		public static void Prefix(LUIElement __instance, ref float height)
		{
			if (((Object)__instance).name.Contains("Gamemode"))
			{
				__instance._totalHeight = (Mathf.Approximately(__instance._totalHeight, 30f) ? 31 : 30);
				height = 125f;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerState), "RPC_ShowDeathAnim")]
	internal class ShowDeathCutscenePatch
	{
		public static void Prefix(PlayerState __instance, PlayerRef victim, PlayerRef killer, bool wasVigilanteKill)
		{
			//IL_0007: 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)
			foreach (SubRole item in SubRole.All.Where((SubRole role) => PlayerRef.op_Implicit(role.PlayerWithRole.PlayerId) == victim))
			{
				item.OnPlayerDied(GameObject.Find("PlayerState (" + ((PlayerRef)(ref killer)).PlayerId + ")").GetComponent<PlayerState>());
			}
		}
	}
	[HarmonyPatch(typeof(CutsceneManager), "ShowEjected")]
	public class ShowEjectedPatch1
	{
		public static void Prefix(CutsceneManager __instance, PlayerRef playerEjected, GameRole playerEjectedRole, bool onlyShowImpostors, int aliveImposters, int aliveCrewmates)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			PlayerState component = GameObject.Find("PlayerState (" + ((PlayerRef)(ref playerEjected)).PlayerId + ")").GetComponent<PlayerState>();
			Logging.Debug_Log("Player Ejected: " + component.NetworkName.Value);
			foreach (SubRole item in SubRole.All)
			{
				item.OnPlayerEjected(component, playerEjectedRole);
			}
		}
	}
	[HarmonyPatch(typeof(CutsceneManager), "ShowAnonymousEjected")]
	public class ShowEjectedPatch2
	{
		public static void Prefix(CutsceneManager __instance, PlayerRef playerEjected, int aliveImposters, int aliveCrewmates)
		{
			PlayerState component = GameObject.Find("PlayerState (" + ((PlayerRef)(ref playerEjected)).PlayerId + ")").GetComponent<PlayerState>();
			Logging.Debug_Log("Player Ejected: " + component.NetworkName.Value);
			foreach (SubRole item in SubRole.All)
			{
				item.OnPlayerEjected(component, (GameRole)0);
			}
		}
	}
	[HarmonyPatch(typeof(CutsceneManager), "ShowNoEjected")]
	public class ShowEjectedPatch3
	{
		public static void Prefix(CutsceneManager __instance, int aliveImposters)
		{
			foreach (SubRole item in SubRole.All)
			{
				item.OnPlayerEjected(null, (GameRole)0);
			}
		}
	}
	[HarmonyPatch(typeof(CutsceneManager), "ShowDebugEjected")]
	public class ShowEjectedPatch4
	{
		public static void Prefix(CutsceneManager __instance, PlayerRef playerEjected, bool wasImposter, int aliveImposters, int cutsceneIndex)
		{
			PlayerState component = GameObject.Find("PlayerState (" + ((PlayerRef)(ref playerEjected)).PlayerId + ")").GetComponent<PlayerState>();
			Logging.Debug_Log("Player Ejected: " + component.NetworkName.Value);
			foreach (SubRole item in SubRole.All)
			{
				item.OnPlayerEjected(component, (GameRole)0);
			}
		}
	}
	[HarmonyPatch(typeof(SpawnManager), "RPC_SpawnBodyByPlayerId")]
	public class SpawnBodyPatch
	{
		public static bool Prefix(PlayerRef id, NetworkRigidbodyObsolete rb)
		{
			if (!CurrentMode.IsHosting || CurrentMode.Modded)
			{
				return true;
			}
			return GameObject.Find("PlayerState (" + ((PlayerRef)(ref id)).PlayerId + ")").GetComponent<PlayerState>().VerifySpawnBody(rb);
		}
	}
	[HarmonyPatch(typeof(NetworkRunner), "StartGame")]
	public class StartGamePatch
	{
	}
	[HarmonyPatch(typeof(NetworkedKillBehaviour), "RPC_TargetedAction")]
	public class TargetedActionPatch
	{
		public static bool Prefix(NetworkedKillBehaviour __instance, PlayerRef targetedPlayer, PlayerRef perpetrator, ref int action)
		{
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			PlayerState component = GameObject.Find("PlayerState (" + ((PlayerRef)(ref perpetrator)).PlayerId + ")").GetComponent<PlayerState>();
			PlayerState component2 = GameObject.Find("PlayerState (" + ((PlayerRef)(ref targetedPlayer)).PlayerId + ")").GetComponent<PlayerState>();
			if (CurrentMode.IsHosting && !CurrentMode.Modded && !component.VerifyKill(component2, action))
			{
				return false;
			}
			foreach (SubRole item in SubRole.All)
			{
				SubRole subRole = item;
				if (!(subRole is Arsonist))
				{
					if (!(subRole is Sniper))
					{
						if (!(subRole is Witch witch))
						{
							if (!(subRole is Duelist { OtherDuelist: var otherDuelist } duelist))
							{
								if (!(subRole is Viper))
								{
									if (subRole is Silencer silencer)
									{
										if ((Object)(object)silencer.PlayerWithRole != (Object)null && silencer.CanMutePlayer && action == 0 && silencer.PlayerWithRole.SoulLinkID == -1)
										{
											silencer.PlayerToMute = component2;
											silencer.PlayerWithRole.SoulLinkID = silencer.PlayerToMute.PlayerId;
											silencer.OriginalRole = MoreRolesManager.GetTrueRoleMR(component2);
											return false;
										}
										Silencer silencer2 = silencer;
										if ((Object)(object)silencer2.PlayerWithRole != (Object)null && !silencer2.CanMutePlayer && action == 0 && silencer2.PlayerWithRole.SoulLinkID == silencer2.PlayerWithRole.PlayerId)
										{
											Logging.Debug_Log("Deafener has already chosen a player");
											return true;
										}
									}
								}
								else if ((Object)(object)item.PlayerWithRole != (Object)null && action == 0 && (Object)(object)item.PlayerWithRole == (Object)(object)component)
								{
									PlayerSavedState.TryGet(component2.PlayerId, out var color, out var hat);
									PlayerSnapshot snapshot = new PlayerSnapshot
									{
										Player = component2,
										ColorId = color,
										HatId = hat,
										HandsId = component2.HandsId,
										SkinId = component2.SkinId,
										Name = component2.NetworkName.Value
									};
									component2.ColorId = 18;
									CoroutineHandler.Start(RestoreFromSnapshot(snapshot));
								}
							}
							else
							{
								if (!((Object)(object)otherDuelist != (Object)null) || action != 0)
								{
									continue;
								}
								try
								{
									PlayerState playerWithRole = duelist.PlayerWithRole;
									PlayerState playerWithRole2 = otherDuelist.PlayerWithRole;
									if ((Object)(object)component == (Object)(object)duelist.PlayerWithRole)
									{
										if (!((Object)(object)component2 == (Object)(object)playerWithRole2))
										{
											return false;
										}
										playerWithRole.SoulLinkID = -1;
										playerWithRole2.SoulLinkID = -1;
									}
									else if ((Object)(object)component == (Object)(object)otherDuelist.PlayerWithRole)
									{
										if (!((Object)(object)component2 == (Object)(object)playerWithRole))
										{
											return false;
										}
										playerWithRole.SoulLinkID = -1;
										playerWithRole2.SoulLinkID = -1;
									}
								}
								catch
								{
								}
							}
						}
						else
						{
							if (!((Object)(object)witch.PlayerWithRole != (Object)null) || action != 0)
							{
								continue;
							}
							try
							{
								if ((Object)(object)witch.PlayerWithRole == (Object)(object)component)
								{
									Logging.Debug_Log(component.NetworkName.Value + " has cursed " + component2.NetworkName.Value + "!");
									witch.OnSpellCast(component2);
									return false;
								}
							}
							catch
							{
							}
						}
					}
					else
					{
						if (!((Object)(object)item.PlayerWithRole != (Object)null) || action != 0)
						{
							continue;
						}
						try
						{
							if ((Object)(object)item.PlayerWithRole == (Object)(object)component)
							{
								return false;
							}
						}
						catch
						{
						}
					}
				}
				else
				{
					if (!((Object)(object)item.PlayerWithRole != (Object)null) || action != 0)
					{
						continue;
					}
					try
					{
						if ((Object)(object)item.PlayerWithRole == (Object)(object)component)
						{
							Logging.Debug_Log(component.NetworkName.Value + " has doused " + component2.NetworkName.Value + "!");
							return false;
						}
					}
					catch
					{
					}
				}
			}
			return true;
		}

		private static IEnumerator RestoreFromSnapshot(PlayerSnapshot snapshot)
		{
			yield return (object)new WaitForSeconds(0.5f);
			snapshot.Player.ColorId = snapshot.ColorId;
			snapshot.Player.HandsId = snapshot.HandsId;
			snapshot.Player.SkinId = snapshot.SkinId;
			CoroutineHandler.Start(DelayHatRestore(snapshot));
		}

		private static IEnumerator DelayHatRestore(PlayerSnapshot snapshot)
		{
			yield return (object)new WaitForSeconds(0.5f);
			snapshot.Player.HatId = 12;
			PlayerSavedState.SetHat(snapshot.Player.PlayerId, snapshot.HatId);
		}
	}
	public class PlayerSnapshot
	{
		public PlayerState Player;

		public int HatId;

		public int HandsId;

		public int SkinId;

		public int ColorId;

		public string Name;
	}
	[HarmonyPatch(typeof(NetworkedLocomotionPlayer), "RPC_SpawnInitialization")]
	public class SpawnInitializationPatch
	{
		public static void Postfix(NetworkedLocomotionPlayer __instance, int color, int hat, int hands, int skin, string name, string moderationID, string moderationUsername, string accountID, bool is3D)
		{
			//IL_008f: 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)AntiCheat.Instance != (Object)null)
			{
				AntiCheat.Instance.VerifyJoin(__instance, color, hat, hands, skin, name, moderationID, moderationUsername, accountID, is3D);
			}
			if (CurrentMode.Modded && CurrentMode.IsHosting)
			{
				if (__instance.PState.PlayerId != 9)
				{
					ModdedGameStateManager.RPC_JoinedModdedGame(__instance.PState.PlayerId);
				}
				if (CurrentMode.Name == "Sandbox")
				{
					((SandboxManager)(object)CustomGameHandler.Current).playerDidSpawn = true;
					__instance.PState.IsSpectating = false;
					__instance.PState.IsAlive = NetworkBool.op_Implicit(true);
				}
				else if (Object.op_Implicit((Object)(object)ModdedGameStateManager.Instance) && ModdedGameStateManager.Instance.state.InLobbyState())
				{
					ModdedGameStateManager.Instance.state.RPC_ToggleLobbyDoors(NetworkBool.op_Implicit(false));
				}
				if (Object.op_Implicit((Object)(object)CommandManager.Instance))
				{
					CommandManager.Instance.CheckAuthorityForNameTag(__instance.PState);
					CommandManager.Instance.requiresUpdate = true;
				}
			}
			AirlockClientGamemode.RPC_AirlockClientVerification();
		}
	}
	[HarmonyPatch(typeof(NetworkedLocomotionPlayer), "RPC_EnterVent")]
	public class EnterVentPatch
	{
		public static bool Prefix(NetworkedLocomotionPlayer __instance)
		{
			if (!CurrentMode.IsHosting || CurrentMode.Modded)
			{
				return true;
			}
			return __instance.PState.VerifyVent();
		}
	}
	[HarmonyPatch(typeof(NetworkedLocomotionPlayer), "RPC_ExitVent")]
	public class ExitVentPatch
	{
		public static bool Prefix(NetworkedLocomotionPlayer __instance)
		{
			if (!CurrentMode.IsHosting || CurrentMode.Modded)
			{
				return true;
			}
			return __instance.PState.VerifyVent();
		}
	}
	[HarmonyPatch]
	public class VotePatch
	{
		[HarmonyPatch(typeof(VoteManager), "RPC_Vote", new Type[]
		{
			typeof(PlayerRef),
			typeof(PlayerRef),
			typeof(RpcInfo)
		})]
		[HarmonyPrefix]
		public static bool Prefix1(PlayerRef voteAgainstPlayer, PlayerRef sourcePlayer, RpcInfo info)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			PlayerState component = GameObject.Find("PlayerState (" + ((PlayerRef)(ref voteAgainstPlayer)).PlayerId + ")").GetComponent<PlayerState>();
			PlayerState component2 = GameObject.Find("PlayerState (" + ((PlayerRef)(ref sourcePlayer)).PlayerId + ")").GetComponent<PlayerState>();
			if (!CurrentMode.IsHosting || CurrentMode.Modded)
			{
				return true;
			}
			return component.VerifyVote(component2, info);
		}

		[HarmonyPatch(typeof(VoteManager), "RPC_Vote", new Type[]
		{
			typeof(PlayerRef),
			typeof(RpcInfo)
		})]
		[HarmonyPrefix]
		public static bool Prefix2(PlayerRef sourcePlayer, RpcInfo info)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			PlayerState component = GameObject.Find("PlayerState (" + ((PlayerRef)(ref sourcePlayer)).PlayerId + ")").GetComponent<PlayerState>();
			if (!CurrentMode.IsHosting || CurrentMode.Modded)
			{
				return true;
			}
			return component.VerifyVote(null, info);
		}
	}
	[HarmonyPatch]
	public class CallVote
	{
		[HarmonyPatch(typeof(VoteManager), "RPC_CallVote", new Type[]
		{
			typeof(int),
			typeof(PlayerRef),
			typeof(NetworkBool),
			typeof(RpcInfo)
		})]
		[HarmonyPrefix]
		public static bool Prefix1(int foundPlayer, PlayerRef sourcePlayer, NetworkBool forceVote, RpcInfo info)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			PlayerState component = GameObject.Find("PlayerState (" + ((PlayerRef)(ref sourcePlayer)).PlayerId + ")").GetComponent<PlayerState>();
			PlayerState component2 = GameObject.Find("PlayerState (" + foundPlayer + ")").GetComponent<PlayerState>();
			if (!CurrentMode.IsHosting || CurrentMode.Modded)
			{
				return true;
			}
			return component.VerifyBodyReport(component2, info);
		}

		[HarmonyPatch(typeof(VoteManager), "RPC_CallVote", new Type[]
		{
			typeof(PlayerRef),
			typeof(NetworkBool),
			typeof(RpcInfo)
		})]
		[HarmonyPrefix]
		public static bool Prefix(PlayerRef sourcePlayer, NetworkBool forceVote, RpcInfo info)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			PlayerState component = GameObject.Find("PlayerState (" + ((PlayerRef)(ref sourcePlayer)).PlayerId + ")").GetComponent<PlayerState>();
			if (!CurrentMode.IsHosting || CurrentMode.Modded)
			{
				return true;
			}
			return component.VerifyMeeting(info);
		}
	}
}
namespace AirlockClient.Managers
{
	public class AirlockClientManager : MonoBehaviour
	{
		public static bool InGame;

		private bool bonusMapsAdded;

		public static GameObject SceneStorage;

		public static string SceneName = "";

		public static AirlockClientManager Instance;

		private static List<HostPrivateMenu> hostingMenu = new List<HostPrivateMenu>();

		private static List<GamemodeSelectionMenu> selectModeMenus = new List<GamemodeSelectionMenu>();

		private static List<TitleMenu> titleMenus = new List<TitleMenu>();

		private static List<MenuManager> menus = new List<MenuManager>();

		public static GameObject Orbiter1;

		public static GameObject Orbiter7;

		public static GameObject Orbiter2;

		public static GameObject Orbiter3;

		public static GameObject Orbiter4;

		public static GameObject Orbiter5;

		public static GameObject Orbiter8;

		public static GameObject Orbiter9;

		public static GameObject Orbiter10;

		public static GameObject Orbiter11;

		private string previousSceneName;

		public static bool titleScreenFormat;

		private void Start()
		{
			Instance = this;
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			foreach (Type type in types)
			{
				try
				{
					ClassInjector.RegisterTypeInIl2Cpp(type);
				}
				catch
				{
				}
			}
			MoreRolesManager.FetchRoles();
			Info.IsVR = Application.productName.Contains("VR");
			SceneManager.sceneLoaded += UnityAction<Scene, LoadSceneMode>.op_Implicit((Action<Scene, LoadSceneMode>)OnSceneLoaded);
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			string text = (SceneName = ((Scene)(ref scene)).name);
			InGame = SceneName != "Boot" && SceneName != "Title";
			SceneStorage = new GameObject("AirlockClient_" + SceneName);
			bonusMapsAdded = false;
			LobbyBrowserHandler.firstTimeInBrowseMenu = false;
			LobbyBrowserHandler.browseAdded = false;
			if (SceneName != "Boot")
			{
				ModStamp.CreateModStamp();
			}
			SceneStorage.transform.position = new Vector3(1000f, 1000f, 1000f);
			if (SceneName == "Title")
			{
				CurrentMode.IsHosting = false;
				hostingMenu = ((IEnumerable<HostPrivateMenu>)Object.FindObjectsOfType<HostPrivateMenu>(true)).ToList();
				selectModeMenus = ((IEnumerable<GamemodeSelectionMenu>)Object.FindObjectsOfType<GamemodeSelectionMenu>(true)).ToList();
				titleMenus = ((IEnumerable<TitleMenu>)Object.FindObjectsOfType<TitleMenu>(true)).ToList();
				menus = ((IEnumerable<MenuManager>)Object.FindObjectsOfType<MenuManager>(true)).ToList();
				TransitionSpace val = null;
				foreach (TransitionSpace item in Resources.FindObjectsOfTypeAll<TransitionSpace>())
				{
					if (((Object)item).name.Contains("Polus"))
					{
						val = Object.Instantiate<GameObject>(((Component)item).gameObject).GetComponent<TransitionSpace>();
					}
				}
				if (Object.op_Implicit((Object)(object)val))
				{
					((Component)val._ejection).gameObject.SetActive(true);
					foreach (Transform componentsInChild in ((Component)val).GetComponentsInChildren<Transform>(true))
					{
						switch (((Object)componentsInChild).name)
						{
						case "TheaterSpace":
							((Component)componentsInChild).gameObject.SetActive(false);
							break;
						case "P_EjectionScene_01":
							((Component)componentsInChild).gameObject.SetActive(false);
							break;
						case "SM_EndGame_01":
							((Component)componentsInChild).gameObject.SetActive(true);
							break;
						}
					}
					HandleTitleOrbitor();
				}
			}
			if (InGame && previousSceneName == "Title")
			{
				if (CurrentMode.Modded)
				{
					if (CurrentMode.IsHosting)
					{
						SceneStorage.AddComponent<PetManager>();
						SceneStorage.AddComponent<ModdedGameStateManager>();
						SceneStorage.AddComponent<CommandManager>();
						SceneStorage.AddComponent<StaticRefs>();
						if (CurrentMode.Name == "Hide N Seek")
						{
							Object.FindObjectOfType<UILobbyScreenHandler>().PrivateLobbyPlayerCount = 2;
							Object.FindObjectOfType<UILobbyScreenHandler>().PublicLobbyPlayerCount = 2;
						}
					}
				}
				else if (CurrentMode.IsHosting)
				{
					SceneStorage.AddComponent<AntiCheat>();
				}
			}
			previousSceneName = text;
		}

		private void OnGUI()
		{
			LobbyBrowserHandler.OnGUI();
		}

		private void Update()
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			if (!(SceneName == "Title"))
			{
				return;
			}
			if (!CurrentMode.IsHosting)
			{
				CurrentMode.IsHosting = Object.op_Implicit((Object)(object)GameObject.Find("Host Private Menu"));
			}
			if (!LobbyBrowserHandler.browseAdded)
			{
				GameObject val = GameObject.Find("PlayOnlineMenu");
				if ((Object)(object)val != (Object)null)
				{
					GameObject gameObject = ((Component)val.transform.Find("MainLayout").Find("TopBar").Find("MatchButtons")).gameObject;
					GameObject gameObject2 = ((Component)gameObject.transform.Find("QuickMatch")).gameObject;
					GameObject gameObject3 = ((Component)gameObject.transform.Find("Host")).gameObject;
					GameObject gameObject4 = ((Component)gameObject.transform.Find("DirectCode")).gameObject;
					GameObject val2 = Object.Instantiate<GameObject>(gameObject2, gameObject2.transform.position, gameObject2.transform.rotation, gameObject.transform);
					((Object)val2).name = "Browse";
					val2.transform.localPosition = new Vector3(-525f, 0f, 0f);
					gameObject2.transform.localPosition = new Vector3(-175f, 0f, 0f);
					gameObject3.transform.localPosition = new Vector3(175f, 0f, 0f);
					gameObject4.transform.localPosition = new Vector3(525f, 0f, 0f);
					((TMP_Text)((Component)val2.transform.Find("LUI_Button_Frame").Find("Label (TMP)")).GetComponent<TextMeshPro>()).text = "<color=yellow>Browse";
					((Behaviour)((Component)val2.transform.Find("LUI_Button_Frame").Find("Label (TMP)")).GetComponent<UserStringComponent_TMP>()).enabled = false;
					((UnityEventBase)((Component)val2.transform.Find("LUI_Button_Frame")).GetComponent<LUIButton>().OnPressed).RemoveAllListeners();
					((Component)val2.transform.Find("LUI_Button_Frame")).GetComponent<LUIButton>().OnPressed.AddListener(DelegateSupport.ConvertDelegate<UnityAction>((Delegate)new Action(LobbyBrowserHandler.OnEnteredBrowseLobbies)));
					LobbyBrowserHandler.browseAdded = true;
				}
			}
			if (LobbyBrowserHandler.waitingForBrowseChange)
			{
				GameObject val3 = GameObject.Find("QuickMatchHostMenu");
				if ((Object)(object)val3 != (Object)null)
				{
					GameObject gameObject5 = ((Component)val3.transform.Find("Title").Find("QuickMatch")).gameObject;
					LobbyBrowserHandler.quickMatchHud = ((Component)val3.transform.Find("MainLayout")).gameObject;
					((TMP_Text)((Component)gameObject5.transform.Find("QuickMatchTitle")).GetComponent<TextMeshPro>()).text = "<color=yellow>Browse";
					((TMP_Text)((Component)gameObject5.transform.Find("TitleText")).GetComponent<TextMeshPro>()).text = "Select A Lobby From The List";
					LobbyBrowserHandler.quickMatchHud.SetActive(false);
					LobbyBrowserHandler.waitingForBrowseChange = false;
					LobbyBrowserHandler.inBrowseMenu = true;
				}
			}
			if (LobbyBrowserHandler.inBrowseMenu)
			{
				GameObject val4 = GameObject.Find("PlayOnlineMenu");
				if ((Object)(object)val4 != (Object)null)
				{
					LobbyBrowserHandler.quickMatchHud.SetActive(true);
					LobbyBrowserHandler.inBrowseMenu = false;
				}
			}
			if (!titleScreenFormat)
			{
				foreach (GamemodeSelectionMenu selectModeMenu in selectModeMenus)
				{
					if ((Object)(object)selectModeMenu != (Object)null && ((Component)selectModeMenu).gameObject.active && (Object)(object)selectModeMenu._modeLayout != (Object)null)
					{
						selectModeMenu._modeLayout.ChildHeight = 30f;
						((LUIElement)selectModeMenu._modeLayout).SetHeight(125f);
						titleScreenFormat = true;
					}
				}
			}
			if (bonusMapsAdded)
			{
				return;
			}
			titleScreenFormat = false;
			foreach (TitleMenu titleMenu in titleMenus)
			{
				if (!((Object)(object)titleMenu != (Object)null) || !((Component)titleMenu).gameObject.active || !Object.op_Implicit((Object)(object)((Component)titleMenu).transform.Find("Title")))
				{
					continue;
				}
				((Component)((Component)titleMenu).transform.Find("Title")).GetComponent<SpriteRenderer>().sprite = StorageManager.Instance.Logo;
				((Component)((Component)titleMenu).transform.Find("Title")).transform.localScale = new Vector3(0.75f, 1f, 1f);
				foreach (MenuManager menu in menus)
				{
					if (((Component)menu).gameObject.activeSelf)
					{
						GamemodeManager.AddMode("More Roles", "Social deduction gameplay, with tons of extra roles", (GameModes)0);
						GamemodeManager.AddMode("Hide N Seek", "Survive the time limit before the imposter takes everyone out", (GameModes)5);
						GamemodeManager.AddMode("Sandbox", "Practice killing, doing tasks or just have fun", (GameModes)0);
						GamemodeManager.AddMode("Crown Runners", "Keep the crown for as long as possible", (GameModes)0);
						GamemodeManager.AddMode("DeathMatch", "2 Teams fight to the death first to 50 wins", (GameModes)0);
						GamemodeManager.AddMode("Lights Out", "Imposters loose, vents accessible, complete darkness", (GameModes)4);
						GamemodeManager.AddMode("Infection", "The zomburritos have breached mess hall", (GameModes)5);
						bonusMapsAdded = true;
					}
				}
				if (!Info.WelcomeMessageShown)
				{
					Object.FindObjectOfType<MenuManager>().ShowRetrySignInPopup("Welcome to <color=yellow><b>AIRLOCK CLIENT [BETA]</b></color>!\n\nAirlock Client is a <b>modified version of Among Us 3D</b>. It adds 2 new game modes along with most LTEs that had existed. These game modes will be tagged with <color=yellow>YELLOW</color>. They <b>cannot be played on public servers and required to join via code only</b>.\n\nWe hope you enjoy the client!\n\nFor more info, please join our discord server at <color=blue><u>discord.gg/Z8Vy6Mjbq6</u></color>!", "CLOSE");
					Info.WelcomeMessageShown = true;
				}
				bonusMapsAdded = true;
			}
		}

		public static void HandleTitleOrbitor()
		{
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			Orbiter1 = GameObject.Find("Orbiter (1)");
			Orbiter7 = GameObject.Find("Orbiter (7)");
			Orbiter2 = GameObject.Find("Orbiter (2)");
			Orbiter3 = GameObject.Find("Orbiter (3)");
			Orbiter4 = GameObject.Find("Orbiter (4)");
			Orbiter5 = GameObject.Find("Orbiter (5)");
			Orbiter8 = GameObject.Find("Orbiter (8)");
			Orbiter9 = GameObject.Find("Orbiter (9)");
			Orbiter10 = GameObject.Find("Orbiter (10)");
			Orbiter11 = GameObject.Find("Orbiter (11)");
			GameObject[] array = (GameObject[])(object)new GameObject[10] { Orbiter1, Orbiter7, Orbiter2, Orbiter3, Orbiter4, Orbiter5, Orbiter8, Orbiter9, Orbiter10, Orbiter11 };
			float[] array2 = new float[10] { -5.32f, -7.3309f, -9.32f, -11.2727f, -12.8037f, -14.4491f, -15.7619f, -17.0328f, -18.1656f, -19.4546f };
			for (int i = 0; i < array.Length; i++)
			{
				Object.Destroy((Object)(object)array[i].GetComponent<Orbiter>());
				array[i].AddComponent<OrbiterManager>();
				array[i].transform.rotation = Quaternion.Euler(270f, 180f, 0f);
				OrbiterManager component = array[i].GetComponent<OrbiterManager>();
				component.yPosition = array2[i];
				component.isActive = i == 0;
			}
		}
	}
	public static class ListsManager
	{
		public static List<(int id, string name)> hats = new List<(int, string)>
		{
			(12, "No Hat"),
			(13, "Balloon"),
			(14, "Beanie"),
			(15, "FedoraTrillby"),
			(16, "FloatyFlamingo"),
			(17, "Greh"),
			(19, "Mohawk"),
			(20, "Sprout"),
			(21, "Batbean"),
			(22, "Headphones"),
			(23, "MiniCrewmate"),
			(24, "PlagueMask"),
			(25, "Present"),
			(26, "Candycane"),
			(27, "Decorations"),
			(28, "Elf"),
			(29, "Reindeer"),
			(30, "Santa"),
			(31, "Snowman"),
			(32, "Trophy"),
			(33, "Pizzatime"),
			(34, "Banana"),
			(35, "MagicCorn"),
			(36, "Morawk"),
			(37, "Note2Self"),
			(38, "ThirdEye"),
			(39, "Clogged"),
			(40, "ColdBrim"),
			(41, "LavaRock"),
			(42, "MinersSetback"),
			(43, "OSHACompliant"),
			(44, "PHat"),
			(45, "SafetySecond"),
			(46, "Snowmate"),
			(47, "ThisIsNotADrill"),
			(48, "UniqueSpecimen"),
			(49, "Crewhorse"),
			(50, "BearHug"),
			(51, "GasMask"),
			(52, "PengYinz"),
			(53, "SnowDay"),
			(54, "SnowflakeCrown"),
			(55, "CozyHat"),
			(56, "CozyMuffs"),
			(57, "IceCrewmate"),
			(58, "KittyHoodie"),
			(59, "WhippedCream"),
			(60, "Floatyasaurus"),
			(61, "Hooked"),
			(62, "CrabGrab"),
			(63, "Sandcastle"),
			(64, "Funguy"),
			(65, "BeanusFlytrap"),
			(66, "CapCap"),
			(67, "DishJockey"),
			(68, "MoRocks"),
			(69, "Sandmate"),
			(70, "ShadyBusiness"),
			(71, "Overscoped"),
			(72, "Zomburrito"),
			(73, "Chef"),
			(74, "VigilanteHat"),
			(75, "ContainmentHat"),
			(76, "Janitor"),
			(77, "MopHead"),
			(78, "ChocolateScoop"),
			(79, "LastWipe"),
			(80, "VictoriaHair"),
			(81, "WerewolfHat"),
			(82, "Pumpkin"),
			(83, "Wizard"),
			(84, "TenGallons_Stache"),
			(85, "TenGallons_White"),
			(86, "CashHat"),
			(87, "ChaosContainmentHat"),
			(88, "HazmatMask"),
			(89, "ScientistGoggles"),
			(90, "TopHatDark"),
			(91, "TopHatWhite"),
			(92, "FrogHat"),
			(93, "RedDragonHat"),
			(94, "RabbitEars"),
			(95, "PinkBow"),
			(96, "MooseHat"),
			(97, "LunarNewYearDragon"),
			(99, "AstronaughtHat"),
			(100, "PilotHat"),
			(101, "LunarNewYearDog"),
			(102, "NyanCatEars"),
			(103, "SidekickHat"),
			(104, "ScanalyzerHat"),
			(105, "ScanalyzerDeluxeHat"),
			(106, "SquidHat"),
			(107, "GreenFishHat"),
			(108, "MinerHatBrown"),
			(109, "TurtleHat"),
			(110, "HatVR_Black"),
			(111, "FrankenBeanHat"),
			(112, "SlimeHat"),
			(113, "ChopChop"),
			(114, "GreatGoalieHat"),
			(115, "ImpRessiveHat"),
			(116, "InnocenceHat"),
			(117, "PropellerHat"),
			(118, "BaubleTopper"),
			(119, "CoolSlopes"),
			(120, "CozyPuff"),
			(121, "FauxFurHoodie"),
			(122, "NewYears2026"),
			(123, "FOnesieHat"),
			(124, "SealHat"),
			(125, "TrainConductorHat"),
			(126, "WinterHat"),
			(207, "Pioneer"),
			(208, "TopHat"),
			(209, "Eggscellent"),
			(210, "GogglesUp"),
			(211, "LuvU"),
			(212, "Planted"),
			(213, "Lucky"),
			(214, "MysteriousVagabond"),
			(215, "DaisyMeRollin"),
			(216, "IceCrown"),
			(217, "3dGlasses"),
			(218, "StormCloudHat"),
			(219, "FoxEars"),
			(220, "GreyFoxEars"),
			(221, "BlueDog"),
			(222, "PoorReception"),
			(223, "Viking"),
			(224, "BullHeaded"),
			(225, "ZodiacChicken"),
			(226, "TheGoat"),
			(227, "ZodiacHorse"),
			(228, "ImAllEars"),
			(229, "Pig"),
			(230, "MouseEars"),
			(231, "TigerEars"),
			(232, "Toaster"),
			(233, "BunnyEars"),
			(234, "CatEars"),
			(235, "BuffaloHorn"),
			(236, "EagleBeak"),
			(237, "RaccoonHat"),
			(238, "LunarNewYear_Snake"),
			(239, "MouseHat"),
			(240, "PandaEar"),
			(241, "HotDogHat"),
			(246, "AP_FloatingCrown"),
			(247, "AP_TeachersPet"),
			(248, "AntelopeHorn"),
			(249, "Headslug"),
			(250, "JohnJuniper")
		};

		public static List<(int id, string name)> hands = new List<(int, string)>
		{
			(127, "No Gloves"),
			(128, "VigilanteGloves"),
			(129, "GamerGlove"),
			(130, "Spy"),
			(131, "NumberOne"),
			(132, "ContainmentHands"),
			(133, "Museum"),
			(134, "ScrubGlub"),
			(135, "CandyCorn"),
			(136, "Ripper"),
			(137, "Vampire"),
			(138, "Werewolf"),
			(139, "Cufflinks"),
			(140, "FingerGloves"),
			(141, "MoonGloves"),
			(142, "RingGloves"),
			(143, "WindowGloves"),
			(144, "CoolBeanGloves"),
			(145, "Jloves"),
			(146, "SidekickGloves"),
			(147, "BeastGloves"),
			(148, "BalloonGloves"),
			(149, "OilGloves"),
			(150, "SpaceGloves"),
			(151, "DeluxeSpaceGloves"),
			(152, "FishEatingFinger"),
			(153, "ShellBracelet"),
			(154, "FrankenBeanHands"),
			(155, "GoldWatch"),
			(156, "SlimeHands"),
			(157, "StickyFingers"),
			(158, "WinterMittens"),
			(159, "FOnesieHands"),
			(160, "TrainConductorHands"),
			(242, "BurgerTime")
		};

		public static List<(int id, string name)> skins = new List<(int, string)>
		{
			(161, "No Skin"),
			(162, "Mechanic"),
			(163, "SuitedUp"),
			(164, "FannyPack"),
			(165, "Sheriff"),
			(166, "BlingSkin"),
			(167, "ChaosContainmentSkin"),
			(168, "HazmatSkin"),
			(169, "ScientistSkin"),
			(170, "SuitedUpWhite"),
			(171, "Jorts"),
			(172, "FrogSuit"),
			(173, "RedDragonSkin"),
			(174, "MooseSkin"),
			(175, "LeftHandMan"),
			(176, "ChefSkin"),
			(177, "MinerSkin"),
			(178, "WinterSkin"),
			(179, "SidekickSkin"),
			(180, "CatTail"),
			(181, "AstronaughtSkin"),
			(182, "PilotSkin"),
			(183, "SpaceBean"),
			(184, "SpaceBeanDeluxe"),
			(185, "SquidSkin"),
			(186, "SwimTrunks"),
			(187, "LifeJacket"),
			(188, "FrankenBeanSkin"),
			(189, "SlimeSkin"),
			(190, "WerewolfSkin"),
			(191, "VictorianSuit"),
			(192, "BatBeanSkin"),
			(193, "LegWarmers"),
			(194, "FOnesieSkin"),
			(195, "TrainConductorSkin"),
			(196, "Tiger"),
			(197, "Fox"),
			(198, "Possum"),
			(199, "LavaRockSkin"),
			(200, "KarateSkin"),
			(201, "Raccoon"),
			(202, "ShroomPants"),
			(203, "RainCoat"),
			(204, "GeodeBody"),
			(205, "Gardener"),
			(206, "GreenFairy"),
			(243, "GreenSweater"),
			(244, "SchoolUniform"),
			(245, "Cat")
		};

		public static List<string> Usernames = new List<string>
		{
			"PolusPanic232", "AirlockClient234", "EchoHacker278", "GlitchDragon461", "NullTrace560", "DeepWire72", "TurboGhost77", "DarkHacker720", "ByteRunner716", "PizzaWizard970",
			"CyanShade806", "DonutJoker811", "LofiShade626", "NeonRunner57", "FrostRunner296", "HyperByte810", "TurboIRL56", "GhostAI741", "RetroJoker58", "ErrorEater759",
			"OverFlip625", "VortexPointer852", "NullIRL411", "RoleShift342", "HexShade625", "PixelMode241", "ZeroSwapper539", "PhasePanic148", "NovaNinja684", "RoleMode871",
			"NeonSuit115", "CrimsonKing79", "VentPhantom491", "VentEater65", "SilentGhost256", "NovaShade589", "GlitchByte505", "StaticMode654", "ErrorEater767"
		};
	}
	public class ModdedGameStateManager : MonoBehaviour
	{
		public static ModdedGameStateManager Instance;

		public GameStateManager state;

		private QueuedWin queuedWin;

		private readonly List<string> BlacklistedUsers = new List<string>();

		private const string BlacklistUrl = "https://raw.githubusercontent.com/YouTwbey/Airlock-Client/main/AC/blacklisted_user_list.txt";

		public static void RPC_JoinedModdedGame(int playerId)
		{
			NetworkManager.SendRpc("JoinedModdedGame", playerId, Array.Empty<object>());
		}

		[AirlockRpc(/*Could not decode attribute arguments.*/)]
		public static void JoinedModdedGame()
		{
			AirlockClientManager.SceneStorage.AddComponent<PetManager>();
			AirlockClientManager.SceneStorage.AddComponent<CommandManager>();
		}

		private void Start()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
				state = Object.FindObjectOfType<GameStateManager>();
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
			CoroutineHandler.Start(FetchBlacklist());
		}

		private IEnumerator FetchBlacklist()
		{
			while ((Object)(object)((Component)this).gameObject != (Object)null)
			{
				UnityWebRequest www = UnityWebRequest.Get("https://raw.githubusercontent.com/YouTwbey/Airlock-Client/main/AC/blacklisted_user_list.txt");
				yield return www.SendWebRequest();
				if ((int)www.result != 1)
				{
					Logging.Error("Failed to fetch blacklist: " + www.error);
					break;
				}
				string[] array = www.downloadHandler.text.Split(new char[2] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
				string[] array2 = array;
				foreach (string item in array2)
				{
					BlacklistedUsers.Add(item);
				}
				yield return (object)new WaitForSecondsRealtime(300f);
			}
		}

		public void QueueWin(List<PlayerState> winningPlayers, int reason = -1, GameplayStates runInState = (GameplayStates)0, int authority = 99999)
		{
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			if (queuedWin != null && queuedWin.Authority < authority)
			{
				Logging.Debug_Log("Win was overruled. " + queuedWin.Authority + " < " + authority);
				return;
			}
			if (reason == -1)
			{
				reason = 999999999;
			}
			((GenericVariable<bool>)(object)state._preventMatchEnding).Value = true;
			Enumerator<PlayerState> enumerator = Instance.state.SpawnManager.ActivePlayerStates.GetEnumerator();
			while (enumerator.MoveNext())
			{
				PlayerState current = enumerator.Current;
				if (winningPlayers.Contains(current))
				{
					current.RPC_KnownGameRole((GameRole)2);
					state.RoleManager.AlterPlayerRole((GameRole)2, PlayerRef.op_Implicit(current.PlayerId));
				}
				else
				{
					current.RPC_KnownGameRole((GameRole)1);
					state.RoleManager.AlterPlayerRole((GameRole)1, PlayerRef.op_Implicit(current.PlayerId));
				}
			}
			queuedWin = new QueuedWin
			{
				WinningPlayers = winningPlayers,
				Reason = reason,
				RunInState = runInState
			};
		}

		public void QueueWin(PlayerState winningPlayer, int reason = -1, GameplayStates runInState = (GameplayStates)0, int authority = 99999)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			QueueWin(new List<PlayerState> { winningPlayer }, reason, runInState, authority);
		}

		public BoolSettingsItem GetMatchSetting(Enums.MatchBoolSettings setting)
		{
			Enumerator<BoolSettingsItem> enumerator = state.MatchSettings.LocalBoolSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				BoolSettingsItem current = enumerator.Current;
				if (((Object)current).name.EndsWith(setting.ToString()))
				{
					return current;
				}
			}
			return null;
		}

		public FloatSettingsItem GetMatchSetting(Enums.MatchFloatSettings setting)
		{
			Enumerator<FloatSettingsItem> enumerator = state.MatchSettings.LocalFloatSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				FloatSettingsItem current = enumerator.Current;
				if (((Object)current).name.EndsWith(setting.ToString()))
				{
					return current;
				}
			}
			return null;
		}

		public IntSettingsItem GetMatchSetting(Enums.MatchIntSettings setting)
		{
			Enumerator<IntSettingsItem> enumerator = state.MatchSettings.LocalIntSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				IntSettingsItem current = enumerator.Current;
				if (((Object)current).name.EndsWith(setting.ToString()))
				{
					return current;
				}
			}
			return null;
		}

		public void SetMatchSetting(Enums.MatchBoolSettings setting, bool value)
		{
			Enumerator<BoolSettingsItem> enumerator = state.MatchSettings.LocalBoolSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				BoolSettingsItem current = enumerator.Current;
				if (((Object)current).name.Contains(setting.ToString()))
				{
					((GenericVariable<bool>)(object)((SettingsItem<BoolVariable, bool>)(object)current).Variable).Value = value;
				}
			}
		}

		public void SetMatchSetting(Enums.MatchFloatSettings setting, float value)
		{
			Enumerator<FloatSettingsItem> enumerator = state.MatchSettings.LocalFloatSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				FloatSettingsItem current = enumerator.Current;
				if (((Object)current).name.Contains(setting.ToString()))
				{
					((GenericVariable<float>)(object)((SettingsItem<FloatVariable, float>)(object)current).Variable).Value = value;
				}
			}
		}

		public void SetMatchSetting(Enums.MatchIntSettings setting, int value)
		{
			Enumerator<IntSettingsItem> enumerator = state.MatchSettings.LocalIntSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				IntSettingsItem current = enumerator.Current;
				if (((Object)current).name.Contains(setting.ToString()))
				{
					((GenericVariable<int>)(object)((SettingsItem<IntVariable, int>)(object)current).Variable).Value = value;
				}
			}
		}

		public BoolSettingsItem GetRoleSetting(Enums.RoleBoolSettings setting)
		{
			Enumerator<BoolSettingsItem> enumerator = GameObject.Find("RoleCustomizationSettings").GetComponent<MatchCustomizationSettings>().LocalBoolSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				BoolSettingsItem current = enumerator.Current;
				if (((Object)current).name.EndsWith(setting.ToString()))
				{
					return current;
				}
			}
			return null;
		}

		public FloatSettingsItem GetRoleSetting(Enums.RoleFloatSettings setting)
		{
			Enumerator<FloatSettingsItem> enumerator = GameObject.Find("RoleCustomizationSettings").GetComponent<MatchCustomizationSettings>().LocalFloatSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				FloatSettingsItem current = enumerator.Current;
				if (((Object)current).name.EndsWith(setting.ToString()))
				{
					return current;
				}
			}
			return null;
		}

		public IntSettingsItem GetRoleSetting(Enums.RoleIntSettings setting)
		{
			Enumerator<IntSettingsItem> enumerator = GameObject.Find("RoleCustomizationSettings").GetComponent<MatchCustomizationSettings>().LocalIntSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				IntSettingsItem current = enumerator.Current;
				if (((Object)current).name.EndsWith(setting.ToString()))
				{
					return current;
				}
			}
			return null;
		}

		public void SetRoleSetting(Enums.RoleBoolSettings setting, bool value)
		{
			Enumerator<BoolSettingsItem> enumerator = GameObject.Find("RoleCustomizationSettings").GetComponent<MatchCustomizationSettings>().LocalBoolSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				BoolSettingsItem current = enumerator.Current;
				if (((Object)current).name.Contains(setting.ToString()))
				{
					((GenericVariable<bool>)(object)((SettingsItem<BoolVariable, bool>)(object)current).Variable).Value = value;
				}
			}
		}

		public void SetRoleSetting(Enums.RoleFloatSettings setting, float value)
		{
			Enumerator<FloatSettingsItem> enumerator = GameObject.Find("RoleCustomizationSettings").GetComponent<MatchCustomizationSettings>().LocalFloatSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				FloatSettingsItem current = enumerator.Current;
				if (((Object)current).name.Contains(setting.ToString()))
				{
					((GenericVariable<float>)(object)((SettingsItem<FloatVariable, float>)(object)current).Variable).Value = value;
				}
			}
		}

		public void SetRoleSetting(Enums.RoleIntSettings setting, int value)
		{
			Enumerator<IntSettingsItem> enumerator = GameObject.Find("RoleCustomizationSettings").GetComponent<MatchCustomizationSettings>().LocalIntSettings.GetEnumerator();
			while (enumerator.MoveNext())
			{
				IntSettingsItem current = enumerator.Current;
				if (((Object)current).name.Contains(setting.ToString()))
				{
					((GenericVariable<int>)(object)((SettingsItem<IntVariable, int>)(object)current).Variable).Value = value;
				}
			}
		}

		private void Update()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			if (!(CurrentMode.Name == "More Roles"))
			{
				return;
			}
			if (!state.InLobbyState())
			{
				if (queuedWin == null)
				{
					return;
				}
				if ((int)queuedWin.RunInState != 0)
				{
					GameplayStates runInState = queuedWin.RunInState;
					GameModeState gameModeStateValue = state.GameModeStateValue;
					if (runInState != ((GameModeState)(ref gameModeStateValue)).GameState)
					{
						return;
					}
				}
				state.GameEndReasonIndex = queuedWin.Reason;
				state.EndGame((GameTeam)2);
				queuedWin = null;
			}
			else
			{
				((GenericVariable<bool>)(object)state._preventMatchEnding).Value = false;
			}
		}
	}
	public static class ModStamp
	{
		private static GameObject uiCameraObject;

		private static TextMeshProUGUI watermark;

		private static Camera uiCamera;

		private static GameObject canvasObject;

		private static void ApplyWatermark()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)watermark != (Object)null) && !Info.IsVR)
			{
				watermark = new GameObject("Watermark").AddComponent<TextMeshProUGUI>();
				((TMP_Text)watermark).transform.SetParent(GameObject.Find("3DHUD_Canvas").transform, false);
				((TMP_Text)watermark).transform.localPosition = new Vector3(504.873f, 511.091f, 0f);
				((TMP_Text)watermark).transform.localScale = new Vector3(0.7f, 0.7f, 0.7f);
				((TMP_Text)watermark).enableWordWrapping = false;
				((TMP_Text)watermark).alignment = (TextAlignmentOptions)258;
				((TMP_Text)watermark).text = string.Format("<color=yellow>AIRLOCK CLIENT (V{0})</color>\nMod by <color=red>YouTubey</color>\nPing: {1} | FPS: {2}", "0.2.0", (int)NetworkManager.GetPing(), (int)(1f / Time.deltaTime));
				CoroutineHandler.Start(UpdateWatermark());
			}
		}

		private static IEnumerator UpdateWatermark()
		{
			while ((Object)(object)watermark != (Object)null)
			{
				((TMP_Text)watermark).text = string.Format("<color=yellow>AIRLOCK CLIENT (V{0})</color>\nMod by <color=red>YouTubey</color>\nPing: {1} | FPS: {2}", "0.2.0", (int)NetworkManager.GetPing(), (int)(1f / Time.deltaTime));
				yield return (object)new WaitForSeconds(1f);
			}
		}

		public static void CreateModStamp()
		{
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			StorageManager.Instance.ModStamp = StorageManager.Instance.LoadModStamp("AirlockClient.Data.Sprite.ModStamp.png");
			int num = LayerMask.NameToLayer("UI");
			if (Info.IsVR)
			{
				GameObject val = new GameObject("ModUICamera");
				val.transform.parent = AirlockClientManager.SceneStorage.transform;
				uiCameraObject = val;
				uiCamera = uiCameraObject.AddComponent<Camera>();
				uiCamera.clearFlags = (CameraClearFlags)4;
				uiCamera.cullingMask = 1 << num;
				uiCamera.depth = 1f;
				uiCamera.orthographic = true;
				uiCamera.orthographicSize = 5f;
				uiCamera.nearClipPlane = 0.1f;
				uiCamera.farClipPlane = 1.1f;
				AudioListener component = uiCameraObject.GetComponent<AudioListener>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
				GameObject val2 = new GameObject("ModUICanvas");
				val2.transform.parent = AirlockClientManager.SceneStorage.transform;
				val2.layer = num;
				canvasObject = val2;
				Canvas val3 = canvasObject.AddComponent<Canvas>();
				val3.renderMode = (RenderMode)1;
				val3.worldCamera = uiCamera;
				val3.planeDistance = 1f;
				canvasObject.AddComponent<CanvasScaler>();
				canvasObject.AddComponent<GraphicRaycaster>();
			}
			GameObject val4 = new GameObject("ModStamp")
			{
				layer = num
			};
			if (Info.IsVR)
			{
				val4.transform.SetParent(canvasObject.transform, false);
				val4.transform.localPosition = new Vector3(32.4f, 32.4f, 0f);
				val4.transform.localScale = new Vector3(5f, 5f, 5f);
				if (AirlockClientManager.InGame)
				{
					ApplyWatermark();
				}
			}
			else if (AirlockClientManager.InGame)
			{
				ApplyWatermark();
				val4.transform.SetParent(GameObject.Find("3DHUD_Canvas").transform, false);
				val4.transform.localPosition = new Vector3(869.7786f, 356.62f, 0f);
				val4.transform.localScale = new Vector3(100f, 100f, 100f);
			}
			else
			{
				val4.transform.SetParent(GameObject.Find("UI").transform, false);
				val4.transform.localPosition = new Vector3(572.7276f, 303.1816f, 0f);
				val4.transform.localScale = new Vector3(60f, 60f, 60f);
			}
			SpriteRenderer val5 = val4.AddComponent<SpriteRenderer>();
			val5.sprite = StorageM