Decompiled source of RepoAntiCheat v1.0.5

patchers/RepoAntiCheatPatcher.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Cecil.Rocks;
using Mono.Collections.Generic;
using MonoMod.Cil;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("CharlesE2")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Patcher to add sender information to RPCs")]
[assembly: AssemblyFileVersion("1.0.5.0")]
[assembly: AssemblyInformationalVersion("1.0.5+cefc3ab5cdd9987a01ccfcd177ffdcf9f7f21d32")]
[assembly: AssemblyProduct("RepoAntiCheat")]
[assembly: AssemblyTitle("com.github.CharlesE2.RepoAntiCheatPatcher")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Charlese2/RepoAntiCheat")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.5.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public static class RpcPatcher
{
	public static IEnumerable<string> TargetDLLs { get; } = new <>z__ReadOnlySingleElementList<string>("Assembly-CSharp.dll");


	public static void Patch(AssemblyDefinition assembly)
	{
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Expected O, but got Unknown
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: Expected O, but got Unknown
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		ManualLogSource val = Logger.CreateLogSource("RepoAntiCheat");
		val.LogMessage((object)"Patching RPCs to include PhotonMessageInfo parameter.");
		int num = 0;
		int num2 = 0;
		TypeReference val2 = default(TypeReference);
		if (!assembly.MainModule.TryGetTypeReference("Photon.Pun.PhotonMessageInfo", ref val2))
		{
			val.LogFatal((object)"Photon.Pun.PhotonMessageInfo type not found.");
		}
		List<MethodDefinition> list = new List<MethodDefinition>();
		List<MethodDefinition> list2 = new List<MethodDefinition>();
		foreach (TypeDefinition type in assembly.MainModule.GetTypes())
		{
			Enumerator<MethodDefinition> enumerator2 = type.Methods.GetEnumerator();
			try
			{
				while (enumerator2.MoveNext())
				{
					MethodDefinition current2 = enumerator2.Current;
					if (current2.HasBody)
					{
						list.Add(current2);
						if (current2.HasCustomAttributes && ((IEnumerable<CustomAttribute>)current2.CustomAttributes).Any((CustomAttribute attribute) => ((object)attribute.AttributeType).ToString() == "Photon.Pun.PunRPC") && !((IEnumerable<ParameterDefinition>)((MethodReference)current2).Parameters).Any((ParameterDefinition parameter) => ((object)((ParameterReference)parameter).ParameterType).ToString() == "Photon.Pun.PhotonMessageInfo"))
						{
							((MethodReference)current2).Parameters.Add(new ParameterDefinition("info", (ParameterAttributes)16, val2));
							list2.Add(current2);
							num++;
						}
					}
				}
			}
			finally
			{
				((IDisposable)enumerator2).Dispose();
			}
		}
		SortedList<int, Instruction> sortedList = new SortedList<int, Instruction>();
		foreach (MethodDefinition item in list)
		{
			ILProcessor iLProcessor = item.Body.GetILProcessor();
			MethodBodyRocks.SimplifyMacros(item.Body);
			foreach (MethodDefinition item2 in list2)
			{
				Enumerator<Instruction> enumerator5 = item.Body.Instructions.GetEnumerator();
				try
				{
					while (enumerator5.MoveNext())
					{
						Instruction current5 = enumerator5.Current;
						if (ILPatternMatchingExt.MatchCallOrCallvirt(current5, (MethodReference)(object)item2))
						{
							sortedList.Add(current5.Offset, current5);
						}
					}
				}
				finally
				{
					((IDisposable)enumerator5).Dispose();
				}
			}
			if (sortedList.Count > 0)
			{
				item.Body.Variables.Add(new VariableDefinition(val2));
			}
			foreach (Instruction value in sortedList.Values)
			{
				iLProcessor.InsertBefore(value, iLProcessor.Create(OpCodes.Ldloca_S, ((IEnumerable<VariableDefinition>)item.Body.Variables).Last()));
				iLProcessor.InsertBefore(value, iLProcessor.Create(OpCodes.Initobj, val2));
				iLProcessor.InsertBefore(value, iLProcessor.Create(OpCodes.Ldloc_S, ((IEnumerable<VariableDefinition>)item.Body.Variables).Last()));
				num2++;
			}
			MethodBodyRocks.OptimizeMacros(item.Body);
			sortedList.Clear();
		}
		val.LogMessage((object)$"Finished Patching {num} RPCs and {num2} local RPC calls");
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
	{
		object IEnumerator.Current => _item;

		T IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool IEnumerator.MoveNext()
		{
			if (!_moveNextCalled)
			{
				return _moveNextCalled = true;
			}
			return false;
		}

		void IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void IDisposable.Dispose()
		{
		}
	}

	int ICollection.Count => 1;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => 1;

	T IReadOnlyList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

	int ICollection<T>.Count => 1;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection.CopyTo(Array array, int index)
	{
		array.SetValue(_item, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int IList.IndexOf(object value)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
		{
			return -1;
		}
		return 0;
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return EqualityComparer<T>.Default.Equals(_item, item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		array[arrayIndex] = _item;
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, item))
		{
			return -1;
		}
		return 0;
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}

plugins/RepoAntiCheat.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("CharlesE2")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Client-side anticheat mod.")]
[assembly: AssemblyFileVersion("1.0.5.0")]
[assembly: AssemblyInformationalVersion("1.0.5+cefc3ab5cdd9987a01ccfcd177ffdcf9f7f21d32")]
[assembly: AssemblyProduct("RepoAntiCheat")]
[assembly: AssemblyTitle("com.github.CharlesE2.RepoAntiCheat")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Charlese2/RepoAntiCheat")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.5.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RepoAntiCheat
{
	[BepInPlugin("com.github.CharlesE2.RepoAntiCheat", "RepoAntiCheat", "1.0.5")]
	public class AntiCheatPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <ItemSetupCooldown>d__20 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					itemSetupOnCooldown = true;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					itemSetupOnCooldown = false;
					return false;
				}
			}

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

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

		[CompilerGenerated]
		private sealed class <NavMeshSetupCooldown>d__21 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					navMeshSetupOnCooldown = true;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					navMeshSetupOnCooldown = false;
					return false;
				}
			}

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

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

		public static Dictionary<int, PlayerAvatar> playerActorNrToPlayerAvatarMap = new Dictionary<int, PlayerAvatar>();

		public static ConfigEntry<bool> configLogNonHostRevive = null;

		internal static bool itemSetupOnCooldown;

		internal static bool navMeshSetupOnCooldown;

		public static AntiCheatPlugin Instance { get; private set; } = null;


		internal static ManualLogSource Log { get; private set; } = null;


		internal static Harmony? Harmony { get; set; }

		public static PlayerAvatar? GetPlayerAvatarFromActorNumber(int actorNumber)
		{
			if (!playerActorNrToPlayerAvatarMap.TryGetValue(actorNumber, out PlayerAvatar value))
			{
				foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
				{
					if (player.photonView.OwnerActorNr == actorNumber)
					{
						playerActorNrToPlayerAvatarMap.Add(actorNumber, player);
						return player;
					}
				}
			}
			return value;
		}

		private void Awake()
		{
			//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_0037: Expected O, but got Unknown
			if ((Object)(object)GameObject.Find("RepoAntiCheat") == (Object)null && ((Object)this).name != "RepoAntiCheat")
			{
				GameObject val = new GameObject("RepoAntiCheat")
				{
					hideFlags = (HideFlags)61
				};
				Object.DontDestroyOnLoad((Object)(object)val);
				Instance = val.AddComponent<AntiCheatPlugin>();
			}
			else
			{
				Log = ((BaseUnityPlugin)this).Logger;
				configLogNonHostRevive = ((BaseUnityPlugin)this).Config.Bind<bool>("Logging", "Log non-host revives", false, "Logs when clients other than the host revive people");
				Patch();
				Log.LogInfo((object)"RepoAntiCheat v1.0.5 has loaded!");
			}
		}

		internal static void Patch()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("com.github.CharlesE2.RepoAntiCheat");
			}
			Log.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Log.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Log.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Log.LogDebug((object)"Finished unpatching!");
		}

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

		[IteratorStateMachine(typeof(<NavMeshSetupCooldown>d__21))]
		internal static IEnumerator NavMeshSetupCooldown()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <NavMeshSetupCooldown>d__21(0);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.CharlesE2.RepoAntiCheat";

		public const string PLUGIN_NAME = "RepoAntiCheat";

		public const string PLUGIN_VERSION = "1.0.5";
	}
}
namespace RepoAntiCheat.Patches
{
	internal class CleanupPatch
	{
		[HarmonyPatch(typeof(SteamManager), "LeaveLobby")]
		internal static class CleanupOnLeave
		{
			public static void Prefix()
			{
				AntiCheatPlugin.playerActorNrToPlayerAvatarMap.Clear();
			}
		}
	}
	internal class LoadingPatches
	{
		[HarmonyWrapSafe]
		[HarmonyPatch(typeof(NetworkManager), "Update")]
		internal static class FixInstantiatedPlayerAvatarsComparison
		{
			[HarmonyTranspiler]
			public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Expected O, but got Unknown
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Expected O, but got Unknown
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[4]
				{
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction instruction) => CodeInstructionExtensions.LoadsField(instruction, AccessTools.Field(typeof(NetworkManager), "instantiatedPlayerAvatars"), false)), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction instruction) => CodeInstructionExtensions.Calls(instruction, AccessTools.Method(typeof(PhotonNetwork), "get_CurrentRoom", (Type[])null, (Type[])null))), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction instruction) => CodeInstructionExtensions.Calls(instruction, AccessTools.Method(typeof(Room), "get_PlayerCount", (Type[])null, (Type[])null))), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction instruction) => instruction.opcode == OpCodes.Bne_Un), (string)null)
				});
				if (!val.ReportFailure(MethodBase.GetCurrentMethod(), (Action<string>)AntiCheatPlugin.Log.LogInfo))
				{
					val.Instruction.opcode = OpCodes.Blt;
				}
				return val.InstructionEnumeration();
			}
		}

		[HarmonyWrapSafe]
		[HarmonyPatch(typeof(ReloadScene), "Update")]
		internal static class FixPlayersReadyComparison
		{
			[HarmonyTranspiler]
			public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Expected O, but got Unknown
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Expected O, but got Unknown
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[4]
				{
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction instruction) => CodeInstructionExtensions.LoadsField(instruction, AccessTools.Field(typeof(ReloadScene), "PlayersReady"), false)), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction instruction) => CodeInstructionExtensions.Calls(instruction, AccessTools.Method(typeof(PhotonNetwork), "get_CurrentRoom", (Type[])null, (Type[])null))), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction instruction) => CodeInstructionExtensions.Calls(instruction, AccessTools.Method(typeof(Room), "get_PlayerCount", (Type[])null, (Type[])null))), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction instruction) => instruction.opcode == OpCodes.Bne_Un), (string)null)
				});
				if (!val.ReportFailure(MethodBase.GetCurrentMethod(), (Action<string>)AntiCheatPlugin.Log.LogInfo))
				{
					val.Instruction.opcode = OpCodes.Blt;
				}
				return val.InstructionEnumeration();
			}
		}
	}
	internal class PlayerNamePatch
	{
		[HarmonyPatch(typeof(WorldSpaceUIParent), "PlayerName")]
		internal static class SanitizePlayerName
		{
			public static void Prefix(ref PlayerAvatar _player)
			{
				string text = Regex.Replace(_player.playerName, "<(\\S+?)>", "");
				if (text.Length > 32)
				{
					text = text.Substring(0, 32);
				}
				_player.playerName = text;
			}
		}
	}
	internal class RPCPatches
	{
		[HarmonyPatch(typeof(Arena), "CrownGrabRPC")]
		internal static class CrownGrab
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call CrownGrabRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Arena), "PlayerKilledRPC")]
		internal static class PlayerKilled
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call PlayerKilledRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Arena), "DestroyCrownCageRPC")]
		internal static class DestroyCrownCage
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call DestroyCrownCageRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyParent), "DespawnRPC")]
		internal static class EnemyParent_Despawn
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyParent.DespawnRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyRigidbody), "GrabbedSetRPC")]
		internal static class EnemyRigidbody_GrabbedSet
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyRigidbody.GrabbedSetRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyStateInvestigate), "SetRPC")]
		internal static class EnemyStateInvestigate_Set
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyStateInvestigate.SetRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyBang), "ExplodeRPC")]
		internal static class EnemyBang_Explode
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyBang.ExplodeRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyCeilingEye), "UpdatePositionRPC")]
		internal static class EnemyCeilingEye_UpdatePosition
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyCeilingEye.UpdatePositionRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyDuck), "UpdatePlayerTargetRPC")]
		internal static class EnemyDuck_UpdatePlayerTarget
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyDuck.UpdatePlayerTargetRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyFloater), "NoticeRPC")]
		internal static class EnemyFloater_Notice
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyFloater.NoticeRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyHidden), "UpdatePlayerTargetRPC")]
		internal static class EnemyHidden_UpdatePlayerTarget
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyHidden.UpdatePlayerTargetRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyHunter), "ShootRPC")]
		internal static class EnemyHunter_Shoot
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyHunter.ShootRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyHunter), "UpdateInvestigationPoint")]
		internal static class EnemyHunter_UpdateInvestigationPoint
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyHunter.UpdateInvestigationPoint " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyJump), "JumpingSetRPC")]
		internal static class EnemyJump_JumpingSet
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyJump.JumpingSetRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyJump), "JumpingDelaySetRPC")]
		internal static class EnemyJump_JumpingDelaySet
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyJump.JumpingDelaySetRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyJump), "LandDelaySetRPC")]
		internal static class EnemyJump_LandDelaySet
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyJump.LandDelaySetRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyRobe), "TargetPlayerRPC")]
		internal static class EnemyRobe_TargetPlayer
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyRobe.TargetPlayerRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyRobe), "UpdateStateRPC")]
		internal static class EnemyRobe_UpdateState
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyRobe.UpdateStateRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyRunner), "TargetPlayerRPC")]
		internal static class EnemyRunner_TargetPlayer
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyRunner.TargetPlayerRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemySlowMouth), "IdleBreakerVORPC")]
		internal static class EnemySlowMouth_IdleBreakerVO
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemySlowMouth.IdleBreakerVORPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyTumbler), "TargetPlayerRPC")]
		internal static class EnemyTumbler_TargetPlayer
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyTumbler.IdleBreakerVORPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(EnemyTumbler), "OnHurtColliderImpactAnyRPC")]
		internal static class EnemyTumbler_OnHurtColliderImpactAny
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemyTumbler.OnHurtColliderImpactAnyRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar), "ChatMessageSendRPC")]
		internal static class ChatMesageSend
		{
			public static bool Prefix(PlayerAvatar __instance, ref string _message, ref PhotonMessageInfo info)
			{
				if (__instance.photonView.Owner != info.Sender)
				{
					AntiCheatPlugin.Log.LogInfo((object)$"ChatMessage ({_message}) owner ({info.photonView.Owner}) does not match sender ({info.Sender}).");
					return false;
				}
				string text = Regex.Replace(_message, "<(\\S+?)>", "");
				if (text.Length > 50)
				{
					text = text.Substring(0, 50);
				}
				if (string.IsNullOrWhiteSpace(text))
				{
					AntiCheatPlugin.Log.LogInfo((object)$"{info.Sender} Chat message was empty. Original Message: ({_message})");
					return false;
				}
				_message = text;
				return true;
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar), "AddToStatsManagerRPC")]
		internal static class AddToStatsManager
		{
			public static bool Prefix(PlayerAvatar __instance, ref string _playerName, ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (__instance.photonView.Owner != info.Sender)
				{
					return false;
				}
				string text = Regex.Replace(_playerName, "<(\\S+?)>", "");
				if (text.Length > 32)
				{
					text = text.Substring(0, 32);
				}
				_playerName = text;
				return true;
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar), "SpawnRPC")]
		internal static class SpawnPlayer
		{
			public static bool Prefix(PlayerAvatar __instance, Vector3 position, ref PhotonMessageInfo info)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call SpawnRPC with a position of {position}" + $"for ({__instance.photonView.Owner}) while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar), "PlayerDeathRPC")]
		internal static class PlayerDeath
		{
			public static bool Prefix(PlayerAvatar __instance, ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient && info.Sender != __instance.photonView.Owner)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call PlayerDeathRPC " + $"while not the master client ({PhotonNetwork.MasterClient}) " + $"or the the owner ({__instance.photonView.Owner})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar), "ReviveRPC")]
		internal static class Revive
		{
			public static void Prefix(PlayerAvatar __instance, ref PhotonMessageInfo info)
			{
				if (AntiCheatPlugin.configLogNonHostRevive.Value && info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)$"Player ({info.Sender}) revived ({__instance.playerName})");
				}
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar), "OutroStartRPC")]
		internal static class OutroStart
		{
			public static bool Prefix(PlayerAvatar __instance, ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call OutroStartRPC " + $"for ({__instance.photonView.Owner}) while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar), "UpdateMyPlayerVoiceChat")]
		internal static class UpdateMyPlayerVoiceChat
		{
			public static bool Prefix(PlayerAvatar __instance, ref PhotonMessageInfo info)
			{
				if (info.Sender != __instance.photonView.Owner)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpdateMyPlayerVoiceChat " + $"for another player ({__instance.photonView.Owner})"));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ExtractionPoint), "HaulGoalSetRPC")]
		internal static class HaulGoalSet
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call HaulGoalSetRPC with a value of ({value}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ExtractionPoint), "ExtractionPointSurplusRPC")]
		internal static class ExtractionPointSurplus
		{
			public static bool Prefix(int surplus, ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call ExtractionPointSurplusRPC " + $"while not the master client ({PhotonNetwork.MasterClient})" + $"with a surplus of ({surplus})"));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ExtractionPoint), "StateSetRPC")]
		internal static class StateSet
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call StateSetRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(LevelMusic), "PlayTrack")]
		internal static class PlayTrack
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call PlayTrack " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ItemAttributes), "GetValueRPC")]
		internal static class GetValue
		{
			public static bool Prefix(ItemAttributes __instance, int _value, ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call GetValueRPC " + $"on ({((Object)((Component)__instance).gameObject).name}) with a value of ({_value})" + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ItemGun), "ShootBulletRPC")]
		internal static class ShootBullet
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call ShootBulletRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(MapToolController), "SetActiveRPC")]
		internal static class SetActive
		{
			public static bool Prefix(MapToolController __instance, ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != __instance.photonView.Owner)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call SetActiveRPC " + $"for another client ({__instance.photonView.Owner})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(RoundDirector), "ExtractionPointActivateRPC")]
		internal static class ExtractionPointActivate
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call ExtractionPointActivateRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(RoundDirector), "ExtractionPointsUnlockRPC")]
		internal static class ExtractionPointsUnlock
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call ExtractionPointsUnlockRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PlayerHealth), "UpdateHealthRPC")]
		internal static class UpdateHealth
		{
			public static bool Prefix(PlayerHealth __instance, ref PhotonMessageInfo info)
			{
				if (info.Sender == null || info.Sender == PhotonNetwork.MasterClient)
				{
					return true;
				}
				if (info.Sender != __instance.photonView.Owner)
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PlayerHealth), "HurtOtherRPC")]
		internal static class HurtOther
		{
			public static bool Prefix(PlayerHealth __instance, int damage, ref PhotonMessageInfo info)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: 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)
				if (info.Sender == PhotonNetwork.MasterClient)
				{
					return true;
				}
				PlayerAvatar playerAvatarFromActorNumber = AntiCheatPlugin.GetPlayerAvatarFromActorNumber(info.Sender.ActorNumber);
				if ((Object)(object)playerAvatarFromActorNumber != (Object)null && Vector3.Distance(((Component)playerAvatarFromActorNumber).transform.position, ((Component)__instance).transform.position) > 2f)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"{info.Sender} sent HurtOtherRPC with damage ({damage}) from too far away " + $"({Vector3.Distance(((Component)playerAvatarFromActorNumber).transform.position, ((Component)__instance).transform.position)})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PlayerTumble), "TumbleSetRPC")]
		internal static class TumbleSet
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call TumbleSetRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PhysGrabObject), "DestroyPhysGrabObjectRPC")]
		internal static class PhysGrabObject_DestroyPhysGrabObject
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call PhysGrabObject.DestroyPhysGrabObjectRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "DestroyObjectRPC")]
		internal static class PhysGrabObjectImpactDetector_DestroyObject
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call PhysGrabObject.DestroyPhysGrabObjectRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "SetItemNameRPC")]
		internal static class SetItemName
		{
			public static bool Prefix(string name, int photonViewID, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					PhotonView val = PhotonView.Find(photonViewID);
					ItemAttributes val2 = default(ItemAttributes);
					if ((Object)(object)val == (Object)null || !((Component)val).TryGetComponent<ItemAttributes>(ref val2))
					{
						AntiCheatPlugin.Log.LogInfo((object)$"Player ({info.Sender}) tried to call SetItemNameRPC with an invalid photonViewID ({photonViewID}).");
						return false;
					}
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call SetItemNameRPC " + "with a name of (" + val2.instanceName + ") to new name (" + name + ") " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "SetRunStatRPC")]
		internal static class SetRunStat
		{
			public static bool Prefix(string statName, int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call SetRunStatRPC " + $"to set stat ({statName}) with a value of ({value})" + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "ReceiveSyncData")]
		internal static class ReceiveSyncData
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call ReceiveSyncData" + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpdateStatRPC")]
		internal static class UpdateStat
		{
			public static bool Prefix(string dictionaryName, string key, int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpdateStatRPC " + $"with input of [({dictionaryName}), ({key}), ({value})]" + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpdateShoppingCostRPC")]
		internal static class UpdateShoppingCost
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpdateShoppingCostRPC with a value of ({value})" + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "SyncHaul")]
		internal static class SyncHaul
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call SyncHaul with a value of ({value})" + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpgradeItemBatteryRPC")]
		internal static class UpgradeItemBattery
		{
			public static bool Prefix(string itemName, int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpgradeItemBatteryRPC " + $"with item name of ({itemName}) and a value of ({value}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpgradePlayerEnergyRPC")]
		internal static class UpgradePlayerEnergy
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpgradePlayerEnergyRPC with a value of ({value}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpgradePlayerExtraJumpRPC")]
		internal static class UpgradePlayerExtraJump
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpgradePlayerExtraJumpRPC with a value of ({value}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpgradePlayerGrabRangeRPC")]
		internal static class UpgradePlayerGrabRange
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpgradePlayerGrabRangeRPC with a value of ({value}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpgradePlayerGrabStrengthRPC")]
		internal static class UpgradePlayerGrabStrength
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpgradePlayerGrabStrengthRPC with a value of ({value}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpgradePlayerHealthRPC")]
		internal static class UpgradePlayerHealth
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpgradePlayerHealthRPC with a value of ({value}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpgradePlayerSprintSpeedRPC")]
		internal static class UpgradePlayerSprintSpeed
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpgradePlayerSprintSpeedRPC with a value of ({value}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpgradePlayerThrowStrengthRPC")]
		internal static class UpgradePlayerThrowStrength
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpgradePlayerThrowStrengthRPC with a value of ({value}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(PunManager), "UpgradePlayerTumbleLaunchRPC")]
		internal static class UpgradePlayerTumbleLaunch
		{
			public static bool Prefix(int value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpgradePlayerTumbleLaunchRPC with a value of ({value}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(RoundDirector), "ExtractionCompletedAllRPC")]
		internal static class ExtractionCompleteAll
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call ExtractionCompletedAllRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(TruckScreenText), "SelfDestructPlayersOutsideTruckRPC")]
		internal static class SelfDestructPlayersOutsideTruck
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call SelfDestructPlayersOutsideTruckRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(TruckScreenText), "GotoPageRPC")]
		internal static class GotoPage
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call GotoPageRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(StaticGrabObject), "DestroyPhysGrabObjectRPC")]
		internal static class StaticGrabObject_DestroyPhysGrabObject
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call StaticGrabObject.DestroyPhysGrabObjectRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(LevelGenerator), "EnemySpawnTargetRPC")]
		internal static class EnemySpawnTarget
		{
			public static bool Prefix(int _amount, ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call EnemySpawnTargetRPC with an amount of ({_amount})" + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(LevelGenerator), "GenerateDone")]
		internal static class GenerateDone
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call GenerateDone " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(LevelGenerator), "ItemSetup")]
		internal static class ItemSetup
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (AntiCheatPlugin.itemSetupOnCooldown)
				{
					return false;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call ItemSetup " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				((MonoBehaviour)AntiCheatPlugin.Instance).StartCoroutine(AntiCheatPlugin.ItemSetupCooldown());
				return true;
			}
		}

		[HarmonyPatch(typeof(LevelGenerator), "ModuleAmountRPC")]
		internal static class ModuleAmount
		{
			public static bool Prefix(int amount, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call ModuleAmountRPC with an amount of ({amount}) " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(LevelGenerator), "NavMeshSetupRPC")]
		internal static class NavMeshSetup
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (AntiCheatPlugin.navMeshSetupOnCooldown)
				{
					return false;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call NavMeshSetupRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				((MonoBehaviour)AntiCheatPlugin.Instance).StartCoroutine(AntiCheatPlugin.NavMeshSetupCooldown());
				return true;
			}
		}

		[HarmonyPatch(typeof(RunManagerPUN), "UpdateLevelRPC")]
		internal static class UpdateLevel
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call UpdateLevelRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ValuableDirector), "ValuablesTargetSetRPC")]
		internal static class ValuablesTargetSet
		{
			public static bool Prefix(int _amount, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call ValuablesTargetSetRPC with an amount of ({_amount})" + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ValuableDirector), "VolumesAndSwitchSetupRPC")]
		internal static class VolumesAndSwitchSetup
		{
			public static bool Prefix(ref PhotonMessageInfo info)
			{
				if (info.Sender == null)
				{
					return true;
				}
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call VolumesAndSwitchSetupRPC " + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ValuableObject), "DollarValueSetRPC")]
		internal static class DollarValueSet
		{
			public static bool Prefix(float value, ref PhotonMessageInfo info)
			{
				if (info.Sender != PhotonNetwork.MasterClient)
				{
					AntiCheatPlugin.Log.LogInfo((object)($"Player ({info.Sender}) tried to call DollarValueSetRPC with a value of ({value})" + $"while not the master client ({PhotonNetwork.MasterClient})."));
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ValuableObject), "DiscoverRPC")]
		internal static class Discover
		{
			public static bool Prefix(ValuableObject __instance)
			{
				if (__instance.discovered)
				{
					return false;
				}
				return true;
			}
		}
	}
}