Decompiled source of ScandalLib v1.0.21

BepInEx/plugins/scandallib/scandal.scandallib.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CruiserImproved.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using InjectionLibrary.Attributes;
using JLL.Components;
using Microsoft.CodeAnalysis;
using ScandalLib.Compatibility;
using ScandalLib.Interfaces;
using ScandalLib.Networking;
using ScandalLib.Patches;
using ScandalLib.Scripts;
using ScandalLib.Utils;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using VoxxWeatherPlugin.Patches;
using VoxxWeatherPlugin.Utils;
using VoxxWeatherPlugin.Weathers;
using Woecust.ImmersiveVisor;
using scandal.scandallib.NetcodePatcher;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RequiresInjections]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DiggC.CruiserImproved")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("ImmersiveVisor")]
[assembly: IgnoresAccessChecksTo("JLL")]
[assembly: IgnoresAccessChecksTo("MonkeyInjectionLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: IgnoresAccessChecksTo("voxx.LethalElementsPlugin")]
[assembly: AssemblyCompany("scandal.scandallib")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.20.0")]
[assembly: AssemblyInformationalVersion("1.0.20")]
[assembly: AssemblyProduct("ScandalLib")]
[assembly: AssemblyTitle("scandal.scandallib")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.20.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ScandalLib
{
	[BepInPlugin("scandal.scandallib", "ScandalLib", "1.0.20")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static bool initialized;

		public static Plugin Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		public void Awake()
		{
			if (!initialized)
			{
				initialized = true;
				Logger = ((BaseUnityPlugin)this).Logger;
				Instance = this;
				UserConfig.InitConfig();
				LoadAssetBundle();
				Patch();
				LogInfo("scandal.scandallib v1.0.20 has loaded!");
			}
		}

		internal void LoadAssetBundle()
		{
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scandalsharedassets"));
			if ((Object)(object)val == (Object)null)
			{
				LogError("[AssetBundle] Failed to load asset bundle: sharedAssetsBundle");
			}
			else
			{
				LogInfo("[AssetBundle] Successfully loaded asset bundle: sharedAssetsBundle");
			}
		}

		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("scandal.scandallib");
			}
			LogDebug("Patching...");
			CompatibilityUtils.Init(Harmony);
			Harmony.PatchAll();
			LogDebug("Finished patching!");
		}

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

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogMessage(string messageLog)
		{
			Logger.LogMessage((object)messageLog);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogDebug(string debugLog)
		{
			if (UserConfig.EnableDebugLogging.Value)
			{
				Logger.LogDebug((object)debugLog);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogInfo(string infoLog)
		{
			Logger.LogInfo((object)infoLog);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogWarning(string warningLog)
		{
			Logger.LogWarning((object)warningLog);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogError(string errorLog)
		{
			Logger.LogError((object)errorLog);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "scandal.scandallib";

		public const string PLUGIN_NAME = "ScandalLib";

		public const string PLUGIN_VERSION = "1.0.20";
	}
}
namespace ScandalLib.Utils
{
	internal static class CompatibilityUtils
	{
		internal const string GUID_JLL = "JacobG5.JLL";

		internal const string GUID_LETHALELEMENTS = "voxx.LethalElementsPlugin";

		internal const string GUID_CRUISER_IMPROVED = "DiggC.CruiserImproved";

		internal const string GUID_IMMERSIVE_VISOR = "ImmersiveVisor";

		internal static bool INSTALLED_JLL;

		internal static bool INSTALLED_LETHALELEMENTS;

		internal static bool INSTALLED_CRUISER_IMPROVED;

		internal static bool INSTALLED_IMMERSIVE_VISOR;

		internal static void Init(Harmony harmony)
		{
			if (Chainloader.PluginInfos.ContainsKey("JacobG5.JLL"))
			{
				INSTALLED_JLL = true;
				harmony.PatchAll(typeof(JLLCompatibility));
				Plugin.LogDebug("CROSS-COMPATIBILITY - JLL detected");
			}
			if (Chainloader.PluginInfos.ContainsKey("voxx.LethalElementsPlugin"))
			{
				INSTALLED_LETHALELEMENTS = true;
				harmony.PatchAll(typeof(LethalElementsCompatibility));
				Plugin.LogDebug("CROSS-COMPATIBILITY - LethalElements detected.");
			}
			if (Chainloader.PluginInfos.ContainsKey("ImmersiveVisor"))
			{
				INSTALLED_IMMERSIVE_VISOR = true;
				harmony.PatchAll(typeof(ImmersiveVisorCompatibility));
				Plugin.LogDebug("CROSS-COMPATIBILITY - ImmersiveVisor detected.");
			}
			if (Chainloader.PluginInfos.ContainsKey("DiggC.CruiserImproved"))
			{
				INSTALLED_CRUISER_IMPROVED = true;
				harmony.PatchAll(typeof(CruiserImprovedCompatibility));
				Plugin.LogDebug("CROSS-COMPATIBILITY - CruiserImproved detected");
			}
		}
	}
	public class NullMemberException : Exception
	{
		private NullMemberException(string message)
			: base(message)
		{
		}

		public static NullMemberException Method(Type type, string methodName, Type[] parameters = null, Type[] generics = null)
		{
			string text = "";
			string text2 = "";
			if (parameters != null && parameters.Length != 0)
			{
				text = string.Join(", ", parameters.Select((Type param) => param.ToString()));
			}
			if (generics != null && generics.Length != 0)
			{
				text2 = "<" + string.Join(", ", generics.Select((Type param) => param.ToString())) + ">";
			}
			return new NullMemberException("Could not find method " + type.Name + ":" + text2 + methodName + "(" + text + ")");
		}

		public static NullMemberException Field(Type type, string fieldName)
		{
			return new NullMemberException("Could not find field " + type.Name + "." + fieldName);
		}
	}
	internal static class PatchUtils
	{
		public struct OpcodeMatch
		{
			public OpCode opcode;

			public object operandOrNull;

			public OpcodeMatch(OpCode opcode)
			{
				operandOrNull = null;
				this.opcode = opcode;
			}

			public OpcodeMatch(OpCode opcode, object operand)
			{
				operandOrNull = null;
				this.opcode = opcode;
				operandOrNull = operand;
			}
		}

		public static bool OperandCompare(object inputOperand, object codeInstructionOperand)
		{
			if (inputOperand.Equals(codeInstructionOperand))
			{
				return true;
			}
			Type type = codeInstructionOperand.GetType();
			if (type == typeof(LocalBuilder))
			{
				return inputOperand.Equals(((LocalBuilder)codeInstructionOperand).LocalIndex);
			}
			if (!(inputOperand is IConvertible) || !(codeInstructionOperand is IConvertible))
			{
				return false;
			}
			return Convert.ChangeType(inputOperand, codeInstructionOperand.GetType())?.Equals(codeInstructionOperand) ?? false;
		}

		public static int LocateCodeSegment(int startIndex, List<CodeInstruction> searchSpace, List<OpcodeMatch> searchFor)
		{
			if (startIndex < 0 || startIndex >= searchSpace.Count)
			{
				return -1;
			}
			int num = 0;
			for (int i = startIndex; i < searchSpace.Count; i++)
			{
				CodeInstruction val = searchSpace[i];
				OpcodeMatch opcodeMatch = searchFor[num];
				bool flag = val.opcode == opcodeMatch.opcode;
				if (flag && opcodeMatch.operandOrNull != null)
				{
					flag = OperandCompare(opcodeMatch.operandOrNull, val.operand);
				}
				if (flag)
				{
					num++;
					if (num == searchFor.Count)
					{
						return i - num + 1;
					}
				}
				else
				{
					num = 0;
				}
			}
			return -1;
		}

		public static string GetAllMaskLayers(LayerMask _mask)
		{
			int value = ((LayerMask)(ref _mask)).value;
			string text = "";
			for (int i = 0; i < 32; i++)
			{
				if (((1 << i) & value) != 0)
				{
					text = text + " " + LayerMask.LayerToName(i);
				}
			}
			return text;
		}

		public static bool TryMethod(Type type, string name, out MethodInfo methodInfo)
		{
			return TryMethod(type, name, null, null, out methodInfo);
		}

		public static bool TryMethod(Type type, string name, Type[] parameters, out MethodInfo methodInfo)
		{
			return TryMethod(type, name, parameters, null, out methodInfo);
		}

		public static bool TryMethod(Type type, string name, Type[] parameters, Type[] generics, out MethodInfo methodInfo)
		{
			if (parameters == null && generics == null)
			{
				methodInfo = type.GetMethod(name, AccessTools.all);
			}
			else
			{
				if (generics == null)
				{
					generics = Type.EmptyTypes;
				}
				if (parameters == null)
				{
					parameters = Type.EmptyTypes;
				}
				methodInfo = type.GetMethod(name, generics.Length, AccessTools.all, null, parameters, null);
				if (generics.Length != 0)
				{
					methodInfo = methodInfo.MakeGenericMethod(generics);
				}
			}
			return methodInfo != null;
		}

		public static MethodInfo Method(Type type, string name, Type[] parameters = null, Type[] generics = null)
		{
			if (!TryMethod(type, name, parameters, generics, out MethodInfo methodInfo))
			{
				throw NullMemberException.Method(type, name, parameters, generics);
			}
			return methodInfo;
		}

		public static bool TryField(Type type, string name, out FieldInfo fieldInfo)
		{
			fieldInfo = AccessTools.Field(type, name);
			return fieldInfo != null;
		}

		public static FieldInfo Field(Type type, string name)
		{
			if (!TryField(type, name, out FieldInfo fieldInfo))
			{
				throw NullMemberException.Field(type, name);
			}
			return fieldInfo;
		}
	}
	internal static class References
	{
		internal static AudioMixerGroup? diageticSFXGroup;
	}
	public class UserConfig
	{
		public static ConfigEntry<bool> EnableDebugLogging;

		internal static void InitConfig()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			config.SaveOnConfigSet = false;
			EnableDebugLogging = config.Bind<bool>("Debug", "Debug-Logging", false, "If true, activates debug logging");
			ClearOrphanedEntries(config);
			config.Save();
			config.SaveOnConfigSet = true;
		}

		private static void ClearOrphanedEntries(ConfigFile config)
		{
			PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(config);
			dictionary.Clear();
		}
	}
	public static class Utilities
	{
		private struct AnimationInfo
		{
			public string stateName;

			public float normalizedTime;
		}

		public static readonly int stopAnimationID = Animator.StringToHash("SA_stopAnimation");

		public static bool disableAnimationSync = false;

		private static float[] storedParameters = new float[0];

		private static bool[] storedBools = new bool[0];

		private static int[] storedInts = new int[0];

		private static AnimationInfo[] storedAnimations = new AnimationInfo[0];

		public static void StoreParameters(Animator playerAnimator)
		{
			//IL_0047: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected I4, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			AnimatorControllerParameter[] parameters = playerAnimator.parameters;
			storedParameters = new float[parameters.Length];
			storedBools = new bool[parameters.Length];
			storedInts = new int[parameters.Length];
			storedAnimations = new AnimationInfo[playerAnimator.layerCount];
			for (int i = 0; i < parameters.Length; i++)
			{
				AnimatorControllerParameter val = parameters[i];
				AnimatorControllerParameterType type = val.type;
				switch (type - 1)
				{
				case 0:
					storedParameters[i] = playerAnimator.GetFloat(val.name);
					break;
				case 3:
					storedBools[i] = playerAnimator.GetBool(val.name);
					break;
				case 2:
					storedInts[i] = playerAnimator.GetInteger(val.name);
					break;
				}
			}
			for (int j = 0; j < playerAnimator.layerCount; j++)
			{
				AnimatorStateInfo currentAnimatorStateInfo = playerAnimator.GetCurrentAnimatorStateInfo(j);
				AnimationInfo animationInfo = new AnimationInfo
				{
					stateName = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).fullPathHash.ToString(),
					normalizedTime = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime
				};
				storedAnimations[j] = animationInfo;
			}
		}

		public static void RestoreParameters(Animator playerAnimator)
		{
			//IL_0013: 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)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected I4, but got Unknown
			AnimatorControllerParameter[] parameters = playerAnimator.parameters;
			for (int i = 0; i < parameters.Length; i++)
			{
				AnimatorControllerParameter val = parameters[i];
				AnimatorControllerParameterType type = val.type;
				switch (type - 1)
				{
				case 0:
					if (i < storedParameters.Length)
					{
						playerAnimator.SetFloat(val.name, storedParameters[i]);
					}
					break;
				case 3:
					if (i < storedBools.Length)
					{
						playerAnimator.SetBool(val.name, storedBools[i]);
					}
					break;
				case 2:
					if (i < storedInts.Length)
					{
						playerAnimator.SetInteger(val.name, storedInts[i]);
					}
					break;
				}
			}
			for (int j = 0; j < playerAnimator.layerCount; j++)
			{
				if (j < storedAnimations.Length)
				{
					AnimationInfo animationInfo = storedAnimations[j];
					playerAnimator.Play(int.Parse(animationInfo.stateName), j, animationInfo.normalizedTime);
				}
			}
		}

		public static bool IsTargetPlayerProtectedByVehicle(PlayerControllerB player, VehicleController vehicle, EnemyAI enemyAi)
		{
			if (player is IPlayerManager playerManager && (Object)(object)playerManager.CurrentPlayerPhysicsRegion != (Object)null)
			{
				return playerManager.CurrentPlayerPhysicsRegion.IsPlayerProtectedFromEnemy(player, enemyAi);
			}
			return false;
		}

		internal static bool IsPlayerProtectedByVehicle(EnemyAI enemyAi, PlayerControllerB player)
		{
			if (player is IPlayerManager playerManager && (Object)(object)playerManager.CurrentPlayerPhysicsRegion != (Object)null)
			{
				return playerManager.CurrentPlayerPhysicsRegion.IsPlayerProtectedFromEnemy(player, enemyAi);
			}
			return false;
		}
	}
}
namespace ScandalLib.Scripts
{
	public class AudioMixerFixer : MonoBehaviour
	{
		public AudioSource[] allAudios;

		public void Start()
		{
			if ((Object)(object)References.diageticSFXGroup == (Object)null)
			{
				Plugin.LogError("Audio mixer is null");
				return;
			}
			if (allAudios == null || allAudios.Length == 0)
			{
				Plugin.LogError("Audio array was either null or empty");
				return;
			}
			for (int i = 0; i < allAudios.Length; i++)
			{
				if ((Object)(object)allAudios[i] == (Object)null)
				{
					Plugin.LogError($"Audio source at index; {i} is null");
				}
				else
				{
					allAudios[i].outputAudioMixerGroup = References.diageticSFXGroup;
				}
			}
			Plugin.LogDebug($"Corrected output mixer on {allAudios.Length} audios");
		}
	}
	public class ExtendedPhysicsRegion : PlayerPhysicsRegion
	{
		private bool addedRegionToList;

		private float playerInsideInterval;

		private bool playerInsideThisFrame;

		public bool saveLocalPlayerInOrbit = true;

		public bool overrideSetParent;

		public bool useGlobalRot;

		public bool playerInZone;

		public bool isRegionActive;

		public bool parentPlayerBodies;

		internal void OnDestroy()
		{
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			base.disablePhysicsRegion = true;
			if (StartOfRound.Instance.CurrentPlayerPhysicsRegions.Contains((PlayerPhysicsRegion)(object)this))
			{
				StartOfRound.Instance.CurrentPlayerPhysicsRegions.Remove((PlayerPhysicsRegion)(object)this);
			}
			for (int i = 0; i < StartOfRound.Instance?.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
				if ((Object)(object)((Component)val).transform.parent == (Object)(object)base.physicsTransform)
				{
					Transform parent = (val.isInElevator ? val.playersManager.elevatorTransform : val.playersManager.playersContainer);
					((Component)val).transform.SetParent(parent);
					Plugin.LogDebug($"Player {i} setting parent since physics region was destroyed.");
				}
			}
			if (!base.allowDroppingItems || (Object)(object)base.itemDropCollider == (Object)null)
			{
				return;
			}
			GrabbableObject[] componentsInChildren = ((Component)base.physicsTransform).GetComponentsInChildren<GrabbableObject>();
			for (int j = 0; j < componentsInChildren.Length; j++)
			{
				if ((Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null)
				{
					((Component)componentsInChildren[j]).transform.SetParent(RoundManager.Instance.mapPropsContainer.transform, true);
				}
				else
				{
					((Component)componentsInChildren[j]).transform.SetParent((Transform)null, true);
				}
				if (!componentsInChildren[j].isHeld)
				{
					componentsInChildren[j].FallToGround(false, false, default(Vector3));
				}
			}
		}

		internal void OnTriggerStay(Collider other)
		{
			if (base.disablePhysicsRegion)
			{
				overrideSetParent = false;
				return;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null)
			{
				base.hasLocalPlayer = false;
				playerInZone = false;
				return;
			}
			string tag = ((Component)other).gameObject.tag;
			if (parentPlayerBodies && tag.StartsWith("PlayerRagdoll", StringComparison.Ordinal))
			{
				PlayerControllerB val = null;
				DeadBodyInfo val2 = default(DeadBodyInfo);
				if (((Component)other).gameObject.TryGetComponent<DeadBodyInfo>(ref val2))
				{
					val = val2.playerScript;
				}
				if ((Object)(object)val != (Object)null && (Object)(object)val.deadBody != (Object)null && !val.deadBody.isParentedToPhysicsRegion)
				{
					val.deadBody.SetPhysicsParent(base.physicsTransform, base.physicsCollider);
				}
			}
			else if (!overrideSetParent && !((Object)(object)((Component)other).gameObject != (Object)(object)((Component)localPlayerController).gameObject))
			{
				playerInsideThisFrame = true;
				playerInsideInterval = 0f;
			}
		}

		internal void SetPhysicsRegionActive()
		{
			if (overrideSetParent)
			{
				base.checkInterval = 0f;
				base.removePlayerNextFrame = false;
				base.hasLocalPlayer = true;
				if (!addedRegionToList)
				{
					TryAddPhysicsRegionToList();
				}
			}
			else if (!isRegionActive)
			{
				if (addedRegionToList)
				{
					TryRemovePhysicsRegionFromList();
				}
			}
			else
			{
				base.checkInterval = 0f;
				base.removePlayerNextFrame = false;
				TryAddPhysicsRegionToList();
			}
		}

		internal void SetPlayerZoneActive()
		{
			playerInZone = true;
		}

		internal bool IsPhysicsRegionActive()
		{
			//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)
			if ((!(useGlobalRot = Vector3.Angle(((Component)this).transform.up, Vector3.up) > base.maxTippingAngle) || overrideSetParent) && !StartOfRound.Instance.inShipPhase)
			{
				return !base.disablePhysicsRegion;
			}
			return false;
		}

		internal void TryRemovePhysicsRegionFromList()
		{
			StartOfRound.Instance?.CurrentPlayerPhysicsRegions?.Remove((PlayerPhysicsRegion)(object)this);
			addedRegionToList = false;
			base.hasLocalPlayer = false;
			base.removePlayerNextFrame = false;
			base.checkInterval = 0f;
		}

		internal void TryAddPhysicsRegionToList()
		{
			if (!addedRegionToList && isRegionActive && StartOfRound.Instance.CurrentPlayerPhysicsRegions != null && !StartOfRound.Instance.CurrentPlayerPhysicsRegions.Contains((PlayerPhysicsRegion)(object)this))
			{
				StartOfRound.Instance.CurrentPlayerPhysicsRegions.Add((PlayerPhysicsRegion)(object)this);
				addedRegionToList = true;
				base.hasLocalPlayer = true;
			}
		}

		internal void Update()
		{
			if (base.disablePhysicsRegion)
			{
				base.physicsCollider.enabled = false;
				return;
			}
			isRegionActive = IsPhysicsRegionActive();
			UpdatePhysicsRegion();
			SetPhysicsRegionAndZone();
		}

		internal void UpdatePhysicsRegion()
		{
			if (overrideSetParent)
			{
				SetPhysicsRegionActive();
				playerInsideThisFrame = true;
				playerInsideInterval = 0f;
				return;
			}
			if (!playerInsideThisFrame)
			{
				if (playerInZone)
				{
					playerInZone = false;
				}
				return;
			}
			if (playerInsideThisFrame)
			{
				SetPhysicsRegionActive();
				SetPlayerZoneActive();
			}
			if (playerInsideInterval <= 0.15f)
			{
				playerInsideInterval += Time.deltaTime;
				return;
			}
			playerInsideThisFrame = false;
			playerInsideInterval = 0f;
		}

		internal void SetPhysicsRegionAndZone()
		{
			if (!overrideSetParent && base.hasLocalPlayer)
			{
				if (base.checkInterval <= 0.15f)
				{
					base.checkInterval += Time.deltaTime;
					return;
				}
				if (!base.removePlayerNextFrame)
				{
					base.removePlayerNextFrame = true;
					return;
				}
				base.removePlayerNextFrame = false;
				base.checkInterval = 0f;
				base.hasLocalPlayer = false;
				TryRemovePhysicsRegionFromList();
			}
		}

		public virtual bool IsTargetPlayerInVehicle(PlayerControllerB playerScript, EnemyAI enemyAi)
		{
			return false;
		}

		public virtual bool IsPlayerProtectedFromEnemy(PlayerControllerB playerScript, EnemyAI enemyAi)
		{
			return false;
		}

		public virtual bool IsPlayerProtectedFromKnockback(PlayerControllerB playerScript)
		{
			return false;
		}

		public virtual bool IsLocalPlayerCooled()
		{
			return false;
		}

		public virtual bool IsLocalPlayerHeated()
		{
			return false;
		}

		public virtual bool IsLocalPlayerSheltered()
		{
			return false;
		}

		public virtual float GetHeatTransferRateLocalPlayer(bool acceleratedHeatTransfer)
		{
			return 1f;
		}
	}
	public class ExtendedPlayerZone : MonoBehaviour
	{
		public VehicleManager vehicleManager;

		public ExtendedPhysicsRegion physicsRegion;

		public ExtendedPlayerZone otherPlayerZone;

		public Transform vehicleTransform;

		public Collider physicsCollider;

		private float playerInsideInterval;

		private bool playerInsideThisFrame;

		private bool removePlayerFromZoneNextFrame;

		private float checkZoneInterval;

		[HideInInspector]
		public int zoneId = -1;

		public bool isEnclosedZone = true;

		public bool hideRainEffects = true;

		public bool unsetInZoneWhileSeated;

		public bool setInZoneWhileSeated;

		public bool playerInZone;

		public bool disableZone;

		internal virtual void OnEnable()
		{
			if (setInZoneWhileSeated && unsetInZoneWhileSeated)
			{
				Plugin.Logger.LogWarning((object)"'Set in zone' and 'Unset in zone' are set simulteanously! this will cause issues!");
				Plugin.Logger.LogWarning((object)"Fallback to set behaviour 'Set zone --> not seated'");
				setInZoneWhileSeated = false;
				unsetInZoneWhileSeated = true;
			}
			else if (!setInZoneWhileSeated && !unsetInZoneWhileSeated)
			{
				Plugin.Logger.LogWarning((object)"'Set in zone' and 'Unset in zone' are unset simulteanously! this will cause issues!");
				Plugin.Logger.LogWarning((object)"Fallback to set behaviour 'Set zone --> not seated'");
				setInZoneWhileSeated = false;
				unsetInZoneWhileSeated = true;
			}
		}

		internal virtual void OnDestroy()
		{
			disableZone = true;
		}

		internal void OnTriggerStay(Collider other)
		{
			if (!disableZone)
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if (!((Object)(object)localPlayerController == (Object)null) && !((Object)(object)((Component)other).gameObject != (Object)(object)((Component)localPlayerController).gameObject))
				{
					playerInsideThisFrame = true;
					playerInsideInterval = 0f;
				}
			}
		}

		internal bool IsPlayerSeatedInVehicle(PlayerControllerB? playerController)
		{
			if ((Object)(object)playerController != (Object)null && (Object)(object)playerController.overridePhysicsParent != (Object)null)
			{
				return (Object)(object)playerController.overridePhysicsParent == (Object)(object)vehicleTransform;
			}
			return false;
		}

		internal void Update()
		{
			if ((Object)(object)physicsRegion == (Object)null || (Object)(object)vehicleTransform == (Object)null || disableZone)
			{
				physicsCollider.enabled = false;
				return;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (IsPlayerSeatedInVehicle(localPlayerController))
			{
				if (setInZoneWhileSeated)
				{
					SetPlayerInZone(value: true);
				}
				else if (unsetInZoneWhileSeated)
				{
					SetPlayerInZone(value: false);
				}
				removePlayerFromZoneNextFrame = false;
				checkZoneInterval = 0f;
			}
			else
			{
				UpdatePlayerZone();
				SetPlayerZone();
			}
			if ((Object)(object)otherPlayerZone != (Object)null)
			{
				bool flag = !playerInZone;
				if (otherPlayerZone.physicsCollider.enabled != flag)
				{
					otherPlayerZone.physicsCollider.enabled = flag;
				}
			}
			if (physicsCollider.enabled)
			{
				physicsRegion.overrideSetParent = playerInZone;
			}
		}

		internal void UpdatePlayerZone()
		{
			if (playerInsideThisFrame)
			{
				if (playerInsideThisFrame)
				{
					SetPlayerZoneActive();
				}
				if (playerInsideInterval <= 0.15f)
				{
					playerInsideInterval += Time.deltaTime;
					return;
				}
				playerInsideThisFrame = false;
				playerInsideInterval = 0f;
			}
		}

		internal void SetPlayerZoneActive()
		{
			checkZoneInterval = 0f;
			removePlayerFromZoneNextFrame = false;
			SetPlayerInZone(value: true);
		}

		private void SetPlayerInZone(bool value)
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!(localPlayerController is IPlayerManager playerManager) || playerInZone == value)
			{
				return;
			}
			playerInZone = value;
			if (!playerInZone)
			{
				if ((Object)(object)playerManager.CurrentPlayerZone == (Object)(object)this)
				{
					playerManager.CurrentPlayerZone = null;
				}
			}
			else
			{
				playerManager.CurrentPlayerZone = this;
			}
		}

		internal void SetPlayerZone()
		{
			if (playerInZone)
			{
				if (checkZoneInterval <= 0.15f)
				{
					checkZoneInterval += Time.deltaTime;
					return;
				}
				if (!removePlayerFromZoneNextFrame)
				{
					removePlayerFromZoneNextFrame = true;
					return;
				}
				removePlayerFromZoneNextFrame = false;
				checkZoneInterval = 0f;
				SetPlayerInZone(value: false);
			}
		}
	}
	public abstract class ExtendedVehicleController : VehicleController
	{
		public virtual void SetBackDoorOpen(bool setOpen)
		{
		}

		public virtual void SetFrontCabinLightOn(bool setOn)
		{
		}

		public virtual void Start()
		{
		}

		public virtual void SetWheelFriction()
		{
		}

		public virtual void RemoveKeyFromIgnition()
		{
		}

		public virtual IEnumerator RemoveKey()
		{
			base.keyIgnitionCoroutine = null;
			yield break;
		}

		public virtual void StartTryCarIgnition()
		{
		}

		public virtual void CancelTryCarIgnition()
		{
		}

		public virtual void CancelIgnitionAnimation()
		{
			CancelIgnitionCoroutine();
		}

		public virtual void CancelIgnitionCoroutine()
		{
			if (base.keyIgnitionCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(base.keyIgnitionCoroutine);
				base.keyIgnitionCoroutine = null;
			}
		}

		public virtual void SetIgnition(bool setStarted)
		{
		}

		public virtual void SetDriverInVehicle()
		{
		}

		public virtual void OnDriverExitVehicle()
		{
		}

		public virtual void SetPassengerInVehicle()
		{
		}

		public virtual void OnPassengerExitVehicle()
		{
		}

		public virtual int CanExitVehicle(Transform[] exitPoints)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (exitPoints == null)
			{
				Plugin.LogWarning("No exit points found for; " + ((Object)((Component)this).gameObject).name);
				return -1;
			}
			for (int i = 0; i < exitPoints.Length; i++)
			{
				if (!Physics.Linecast(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position, exitPoints[i].position, base.exitCarLayerMask, (QueryTriggerInteraction)1))
				{
					return i;
				}
			}
			return -1;
		}

		public virtual void EnableVehicleCollisionForAllPlayers()
		{
		}

		public virtual void DisableVehicleCollisionForAllPlayers()
		{
		}

		public virtual void SetVehicleCollisionForPlayer(bool setEnabled, PlayerControllerB playerController)
		{
		}

		public virtual void ActivateControl()
		{
		}

		public virtual void DisableControl()
		{
		}

		public virtual void ShiftGearForward()
		{
		}

		public virtual void ShiftGearBack()
		{
		}

		public virtual void ShiftToGearAndSync(int setGear)
		{
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		protected void ShiftToGearAndSyncRpc(int setGear)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_0092: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2132911485u, val3, val, (SendTo)5, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, setGear);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 2132911485u, val3, val, (SendTo)5, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				}
			}
		}

		public virtual void SetGearOnLocalClient(int setGear)
		{
		}

		protected override void __initializeVariables()
		{
			((VehicleController)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2132911485u, new RpcReceiveHandler(__rpc_handler_2132911485), "ShiftToGearAndSyncRpc");
			((VehicleController)this).__initializeRpcs();
		}

		private static void __rpc_handler_2132911485(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int setGear = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref setGear);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ExtendedVehicleController)(object)target).ShiftToGearAndSyncRpc(setGear);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ExtendedVehicleController";
		}
	}
	public class VehicleManager : NetworkBehaviour
	{
		public ExtendedPhysicsRegion physicsRegion;

		public ExtendedPlayerZone[] playerZones;

		public void OnEnable()
		{
			for (int i = 0; i < playerZones.Length; i++)
			{
				if ((Object)(object)playerZones[i] == (Object)null)
				{
					Plugin.LogError($"The zone at index; {i} was null when trying to assign zone ids!");
				}
				else
				{
					playerZones[i].zoneId = i;
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void UpdateCurrentPlayerZoneRpc(NetworkBehaviourReference playerNetObjRef, int zoneId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1261832963u, val3, val, (SendTo)5, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerNetObjRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, zoneId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1261832963u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val4 = default(PlayerControllerB);
			if (!((NetworkBehaviourReference)(ref playerNetObjRef)).TryGet<PlayerControllerB>(ref val4, (NetworkManager)null))
			{
				Plugin.LogError("UpdateCurrentPlayerZoneRpc failed to find player reference from network behaviour!");
			}
			else
			{
				if (!(val4 is IPlayerManager playerManager))
				{
					return;
				}
				if (zoneId == -1)
				{
					playerManager.CurrentPlayerZone = null;
					playerManager.SyncedPlayerZone = null;
					return;
				}
				ExtendedPlayerZone extendedPlayerZone = playerZones[zoneId];
				if ((Object)(object)extendedPlayerZone == (Object)null)
				{
					Plugin.LogError("The zone to set was null in the array!");
					return;
				}
				playerManager.CurrentPlayerZone = extendedPlayerZone;
				playerManager.SyncedPlayerZone = extendedPlayerZone;
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1261832963u, new RpcReceiveHandler(__rpc_handler_1261832963), "UpdateCurrentPlayerZoneRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1261832963(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference playerNetObjRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerNetObjRef, default(ForNetworkSerializable));
				int zoneId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref zoneId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((VehicleManager)(object)target).UpdateCurrentPlayerZoneRpc(playerNetObjRef, zoneId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "VehicleManager";
		}
	}
	public class VehicleSeatAnimator : NetworkBehaviour
	{
		public RuntimeAnimatorController playerVehicleAnimator;

		public bool setOccupiedTip;

		public InteractTrigger seatTrigger;

		private Coroutine specialInteractCoroutine;

		private RuntimeAnimatorController cachedPlayerAnimatorController;

		public void OnEnable()
		{
			if (setOccupiedTip)
			{
				seatTrigger.disabledHoverTip = "[ Seat occupied ]";
			}
			else
			{
				seatTrigger.disabledHoverTip = null;
			}
		}

		public void SetLocalPlayerIntoSeat()
		{
			if (specialInteractCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(specialInteractCoroutine);
				specialInteractCoroutine = null;
			}
			specialInteractCoroutine = ((MonoBehaviour)this).StartCoroutine(SpecialInteractAnimation(seatTrigger, GameNetworkManager.Instance.localPlayerController));
		}

		public void StopSpecialInteractAnimationCoroutine()
		{
			if (specialInteractCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(specialInteractCoroutine);
				specialInteractCoroutine = null;
			}
		}

		public IEnumerator SpecialInteractAnimation(InteractTrigger seatTrigger, PlayerControllerB playerController)
		{
			if ((Object)(object)seatTrigger == (Object)null)
			{
				Plugin.LogError("No seat found for trigger " + ((Object)((Component)this).gameObject).name);
				InteractTriggerPatches.interactedLastFrame = false;
				specialInteractCoroutine = null;
				yield break;
			}
			if ((Object)(object)playerController == (Object)null)
			{
				Plugin.LogError("No player argument was passed for trigger " + ((Object)((Component)this).gameObject).name);
				InteractTriggerPatches.interactedLastFrame = false;
				specialInteractCoroutine = null;
				yield break;
			}
			playerController.updatePlayerAnimationsInterval = 0f;
			Utilities.disableAnimationSync = true;
			int num = (int)playerController.playerClientId;
			if (Object.op_Implicit((Object)(object)seatTrigger.overridePlayerParent))
			{
				playerController.parentedToElevatorLastFrame = false;
				playerController.physicsParent = seatTrigger.overridePlayerParent;
				playerController.lastSyncedPhysicsParent = seatTrigger.overridePlayerParent;
				playerController.overridePhysicsParent = seatTrigger.overridePlayerParent;
				if ((Object)(object)((Component)playerController).transform.parent != (Object)(object)seatTrigger.overridePlayerParent)
				{
					((Component)playerController).transform.SetParent(seatTrigger.overridePlayerParent);
				}
				PlayerControllerBPatches.TrySetPlayerPhysicsRegionFromOverride(playerController);
			}
			((UnityEvent<PlayerControllerB>)(object)seatTrigger.onInteractEarlyOtherClients).Invoke(playerController);
			UpdateUsedByPlayerRpc(num);
			seatTrigger.isPlayingSpecialAnimation = true;
			seatTrigger.lockedPlayer = playerController.thisPlayerBody;
			seatTrigger.playerScriptInSpecialAnimation = playerController;
			seatTrigger.playerUsingId = num;
			if (seatTrigger.clampLooking)
			{
				playerController.minVerticalClamp = seatTrigger.minVerticalClamp;
				playerController.maxVerticalClamp = seatTrigger.maxVerticalClamp;
				playerController.horizontalClamp = seatTrigger.horizontalClamp;
				playerController.clampLooking = true;
			}
			if (seatTrigger.setVehicleAnimation)
			{
				playerController.inVehicleAnimation = true;
			}
			if (seatTrigger.hidePlayerItem && (Object)(object)playerController.currentlyHeldObjectServer != (Object)null)
			{
				playerController.currentlyHeldObjectServer.EnableItemMeshes(false);
			}
			playerController.UpdateSpecialAnimationValue(true, (short)seatTrigger.playerPositionNode.eulerAngles.y, 0f, false);
			playerController.inSpecialInteractAnimation = true;
			playerController.currentTriggerInAnimationWith = seatTrigger;
			SetPlayerAnimations(playerController, isLocalPlayer: true);
			HUDManager.Instance.ClearControlTips();
			if (!seatTrigger.stopAnimationManually)
			{
				yield return (object)new WaitForSeconds(seatTrigger.animationWaitTime);
				seatTrigger.StopSpecialAnimation();
			}
			InteractTriggerPatches.interactedLastFrame = false;
			specialInteractCoroutine = null;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void UpdateUsedByPlayerRpc(int playerNum)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_0092: 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_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2516751942u, val3, val, (SendTo)5, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerNum);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2516751942u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val4 = StartOfRound.Instance.allPlayerScripts[playerNum];
			((UnityEvent<PlayerControllerB>)(object)seatTrigger.onInteractEarlyOtherClients).Invoke(val4);
			Plugin.LogDebug("Update used by player rpc has been called for InteractTrigger: " + ((Object)((Component)this).gameObject).name);
			if ((Object)(object)val4 != (Object)(object)GameNetworkManager.Instance.localPlayerController && (Object)(object)seatTrigger.lockedPlayer == (Object)(object)((Component)GameNetworkManager.Instance.localPlayerController).transform)
			{
				Plugin.LogDebug("Client is getting kicked off of InteractTrigger animation");
				seatTrigger.StopSpecialAnimation();
			}
			if (Object.op_Implicit((Object)(object)seatTrigger.overridePlayerParent))
			{
				val4.parentedToElevatorLastFrame = false;
				val4.physicsParent = seatTrigger.overridePlayerParent;
				val4.lastSyncedPhysicsParent = seatTrigger.overridePlayerParent;
				val4.overridePhysicsParent = seatTrigger.overridePlayerParent;
				if ((Object)(object)((Component)val4).transform.parent != (Object)(object)seatTrigger.overridePlayerParent)
				{
					((Component)val4).transform.SetParent(seatTrigger.overridePlayerParent);
				}
				PlayerControllerBPatches.TrySetPlayerPhysicsRegionFromOverride(val4);
			}
			seatTrigger.isPlayingSpecialAnimation = true;
			seatTrigger.lockedPlayer = val4.thisPlayerBody;
			seatTrigger.playerScriptInSpecialAnimation = val4;
			seatTrigger.playerUsingId = playerNum;
			if (seatTrigger.setVehicleAnimation)
			{
				val4.inVehicleAnimation = true;
				val4.syncFullCameraRotation = ((Component)val4.gameplayCamera).transform.localEulerAngles;
			}
			if (seatTrigger.hidePlayerItem && (Object)(object)val4.currentlyHeldObjectServer != (Object)null)
			{
				val4.currentlyHeldObjectServer.EnableItemMeshes(false);
			}
			val4.inSpecialInteractAnimation = true;
			val4.currentTriggerInAnimationWith = seatTrigger;
			if (!seatTrigger.stopAnimationManually)
			{
				((MonoBehaviour)seatTrigger).StartCoroutine(seatTrigger.isSpecialAnimationPlayingTimer(playerNum));
			}
		}

		public void SetPlayerAnimations(PlayerControllerB playerController, bool isLocalPlayer)
		{
			if (!((Object)(object)playerController == (Object)null) && !playerController.isPlayerDead && playerController.isPlayerControlled)
			{
				if (isLocalPlayer)
				{
					SetPlayerSeated(setSeated: true, playerController);
					UncrouchPlayer(playerController);
				}
				ResetPlayerData(playerController);
				cachedPlayerAnimatorController = null;
				cachedPlayerAnimatorController = Object.Instantiate<RuntimeAnimatorController>(playerController.playerBodyAnimator.runtimeAnimatorController);
				if (isLocalPlayer)
				{
					Utilities.StoreParameters(playerController.playerBodyAnimator);
				}
				playerController.playerBodyAnimator.runtimeAnimatorController = playerVehicleAnimator;
				playerController.playerBodyAnimator.ResetTrigger(Utilities.stopAnimationID);
				playerController.playerBodyAnimator.ResetTrigger(seatTrigger.animationString);
				playerController.playerBodyAnimator.SetTrigger(seatTrigger.animationString);
			}
		}

		public void ReturnPlayerAnimations(PlayerControllerB playerController, bool isLocalPlayer)
		{
			if ((Object)(object)playerController == (Object)null)
			{
				return;
			}
			if ((Object)(object)cachedPlayerAnimatorController != (Object)null)
			{
				playerController.playerBodyAnimator.runtimeAnimatorController = cachedPlayerAnimatorController;
				if (isLocalPlayer)
				{
					Utilities.RestoreParameters(playerController.playerBodyAnimator);
				}
			}
			else if (isLocalPlayer)
			{
				playerController.playerBodyAnimator.runtimeAnimatorController = StartOfRound.Instance.localClientAnimatorController;
			}
			else
			{
				playerController.playerBodyAnimator.runtimeAnimatorController = StartOfRound.Instance.otherClientsAnimatorController;
			}
			if (isLocalPlayer)
			{
				playerController.playerBodyAnimator.ResetTrigger(Utilities.stopAnimationID);
				SetPlayerSeated(setSeated: false, playerController);
				UncrouchPlayer(playerController);
				ReUpdatePlayerAnimations(playerController);
			}
			ResetPlayerData(playerController);
			cachedPlayerAnimatorController = null;
		}

		internal void ReUpdatePlayerAnimations(PlayerControllerB localPlayer)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)localPlayer == (Object)null))
			{
				localPlayer.updatePlayerAnimationsInterval = 0f;
				localPlayer.currentAnimationSpeed = localPlayer.playerBodyAnimator.GetFloat("animationSpeed");
				for (int i = 0; i < localPlayer.playerBodyAnimator.layerCount; i++)
				{
					List<int> currentAnimationStateHash = localPlayer.currentAnimationStateHash;
					int index = i;
					AnimatorStateInfo currentAnimatorStateInfo = localPlayer.playerBodyAnimator.GetCurrentAnimatorStateInfo(i);
					currentAnimationStateHash[index] = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).fullPathHash;
					localPlayer.previousAnimationStateHash[i] = localPlayer.currentAnimationStateHash[i];
					localPlayer.previousAnimationSpeed = localPlayer.currentAnimationSpeed;
					localPlayer.UpdatePlayerAnimationServerRpc(localPlayer.currentAnimationStateHash[i], localPlayer.currentAnimationSpeed);
				}
			}
		}

		public void OnStopInteract(PlayerControllerB playerController)
		{
			ReturnPlayerAnimations(playerController, isLocalPlayer: true);
			playerController.updatePlayerAnimationsInterval = 0f;
			Utilities.disableAnimationSync = false;
		}

		public virtual void OnPlayerLeaveGame()
		{
		}

		public void Update()
		{
			if (!((Object)(object)((NetworkBehaviour)seatTrigger).NetworkManager == (Object)null) && ((NetworkBehaviour)seatTrigger).NetworkManager.IsListening)
			{
				PlayerControllerB playerScriptInSpecialAnimation = seatTrigger.playerScriptInSpecialAnimation;
				if (!((Object)(object)playerScriptInSpecialAnimation == (Object)null) && !playerScriptInSpecialAnimation.isPlayerControlled && playerScriptInSpecialAnimation.disconnectedMidGame)
				{
					seatTrigger.StopUsingClientRpc((int)playerScriptInSpecialAnimation.playerClientId);
					OnPlayerLeaveGame();
				}
			}
		}

		public void UncrouchPlayer(PlayerControllerB player)
		{
			player.isCrouching = false;
			player.playerBodyAnimator.SetBool("crouching", false);
		}

		public virtual void ResetPlayerData(PlayerControllerB player)
		{
		}

		public virtual void SetPlayerSeated(bool setSeated, PlayerControllerB localPlayer)
		{
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2516751942u, new RpcReceiveHandler(__rpc_handler_2516751942), "UpdateUsedByPlayerRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2516751942(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerNum = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerNum);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((VehicleSeatAnimator)(object)target).UpdateUsedByPlayerRpc(playerNum);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "VehicleSeatAnimator";
		}
	}
}
namespace ScandalLib.Patches
{
	[HarmonyPatch]
	public static class ElevatorAnimationEventsPatches
	{
		[HarmonyPatch(typeof(ElevatorAnimationEvents), "ElevatorFullyRunning")]
		[HarmonyPrefix]
		private static void ElevatorAnimationEvents_Pre_ElevatorFullyRunning()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!((Object)(object)localPlayerController == (Object)null) && localPlayerController is IPlayerManager playerManager && !((Object)(object)playerManager.CurrentPlayerPhysicsRegion == (Object)null))
			{
				localPlayerController.isInElevator = playerManager.CurrentPlayerPhysicsRegion.saveLocalPlayerInOrbit;
			}
		}
	}
	[HarmonyPatch]
	public static class GameNetworkManagerPatches
	{
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		[HarmonyPostfix]
		private static void GameNetworkManager_Post_Start(GameNetworkManager __instance)
		{
			ScandalLibNetworker.Init();
		}
	}
	[HarmonyPatch]
	public static class HUDManagerPatches
	{
		[HarmonyPatch(typeof(HUDManager), "HelmetCondensationDrops")]
		[HarmonyPostfix]
		private static void HUDManager_Post_HelmetCondensationDrops(HUDManager __instance)
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (localPlayerController is IPlayerManager playerManager && !((Object)(object)playerManager.CurrentPlayerZone == (Object)null) && playerManager.CurrentPlayerZone.hideRainEffects)
			{
				__instance.increaseHelmetCondensation = false;
			}
		}
	}
	[HarmonyPatch]
	public static class InteractTriggerPatches
	{
		public static bool interactedLastFrame;

		[HarmonyPatch(typeof(InteractTrigger), "Interact")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> InteractTrigger_Trans_Interact(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Expected O, but got Unknown
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Expected O, but got Unknown
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Expected O, but got Unknown
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Expected O, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Expected O, but got Unknown
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			Plugin.LogDebug("Attempting to transpile 'Interact' for 'InteractTrigger'");
			MethodInfo operand = PatchUtils.Method(typeof(PlayerControllerB), "ResetFallGravity");
			Type type = Type.MakeGenericMethodParameter(0).MakeByRefType();
			MethodInfo methodInfo = typeof(Component).GetMethod("TryGetComponent", 1, new Type[1] { type }).MakeGenericMethod(typeof(VehicleSeatAnimator));
			FieldInfo fieldInfo = PatchUtils.Field(typeof(InteractTriggerPatches), "interactedLastFrame");
			FieldInfo fieldInfo2 = PatchUtils.Field(typeof(InteractTrigger), "onInteractEarly");
			MethodInfo methodInfo2 = PatchUtils.Method(fieldInfo2.FieldType, "Invoke", new Type[1] { typeof(PlayerControllerB) });
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Callvirt, operand)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Failed to transpile 'InteractTrigger.Interact'!");
				return list;
			}
			num++;
			LocalBuilder localBuilder = generator.DeclareLocal(typeof(VehicleSeatAnimator));
			Label label = generator.DefineLabel();
			Label label2 = generator.DefineLabel();
			list[num].labels.Add(label2);
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[14]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldloca_S, (object)localBuilder),
				new CodeInstruction(OpCodes.Callvirt, (object)methodInfo),
				new CodeInstruction(OpCodes.Brfalse_S, (object)label2),
				new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo),
				new CodeInstruction(OpCodes.Brtrue_S, (object)label),
				new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
				new CodeInstruction(OpCodes.Stsfld, (object)fieldInfo),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2),
				new CodeInstruction(OpCodes.Ldnull, (object)null),
				new CodeInstruction(OpCodes.Callvirt, (object)methodInfo2),
				new CodeInstruction(OpCodes.Ret, (object)null),
				new CodeInstruction(OpCodes.Ret, (object)null)
				{
					labels = new List<Label>(1) { label }
				}
			}));
			return list;
		}

		[HarmonyPatch(typeof(InteractTrigger), "StopSpecialAnimation")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> InteractTrigger_Trans_StopSpecialAnimation(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'StopSpecialAnimation' for 'InteractTrigger'");
			MethodInfo methodInfo = PatchUtils.Method(typeof(HUDManager), "get_Instance");
			FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "isHoldingObject");
			MethodInfo methodInfo2 = PatchUtils.Method(typeof(HUDManager), "ClearControlTips");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldloc_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand),
				new PatchUtils.OpcodeMatch(OpCodes.Brfalse)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogWarning("Could not transpile 'StopSpecialAnimation' on 'InteractTrigger.StopSpecialAnimation'!");
				return list;
			}
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Call, (object)methodInfo),
				new CodeInstruction(OpCodes.Callvirt, (object)methodInfo2)
			}));
			return list;
		}

		[HarmonyPatch(typeof(InteractTrigger), "StopSpecialAnimation")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> InteractTrigger_Trans_StopSpecialAnimation_ClearPlayerSpecialAnim(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'StopSpecialAnimation' for 'InteractTrigger'");
			FieldInfo operand = PatchUtils.Field(typeof(InteractTrigger), "isPlayingSpecialAnimation");
			FieldInfo fieldInfo = PatchUtils.Field(typeof(InteractTrigger), "playerScriptInSpecialAnimation");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldc_I4_0),
				new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Could not transpile 'StopSpecialAnimation' for 'InteractTrigger'!");
				return list;
			}
			List<Label> list2 = CodeInstructionExtensions.ExtractLabels(list[num]);
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3]
			{
				CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_0, (object)null), (IEnumerable<Label>)list2),
				new CodeInstruction(OpCodes.Ldnull, (object)null),
				new CodeInstruction(OpCodes.Stfld, (object)fieldInfo)
			}));
			return list;
		}

		[HarmonyPatch(typeof(InteractTrigger), "StopSpecialAnimation")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> InteractTrigger_Trans_StopSpecialAnimation_PrePost(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Expected O, but got Unknown
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'StopSpecialAnimation' for 'InteractTrigger'");
			MethodInfo operand = PatchUtils.Method(typeof(Component), "GetComponent", null, new Type[1] { typeof(PlayerControllerB) });
			MethodInfo methodInfo = PatchUtils.Method(typeof(InteractTriggerPatches), "StopSpecialAnimationCoroutine");
			MethodInfo methodInfo2 = PatchUtils.Method(typeof(InteractTriggerPatches), "OnStopInteractTriggerSpecialAnimation");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Callvirt, operand),
				new PatchUtils.OpcodeMatch(OpCodes.Stloc_0)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Could not transpile 'StopSpecialAnimation' for 'InteractTrigger'!");
				return list;
			}
			num += 2;
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldloc_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo)
			}));
			MethodInfo operand2 = PatchUtils.Method(typeof(GrabbableObject), "SetControlTipsForItem");
			List<PatchUtils.OpcodeMatch> searchFor2 = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Callvirt, operand2)
			};
			num = PatchUtils.LocateCodeSegment(num, list, searchFor2);
			if (num == -1)
			{
				Plugin.LogError("Could not transpile 'StopSpecialAnimation' for 'InteractTrigger'!");
				return list;
			}
			num++;
			List<Label> list2 = CodeInstructionExtensions.ExtractLabels(list[num]);
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3]
			{
				CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_0, (object)null), (IEnumerable<Label>)list2),
				new CodeInstruction(OpCodes.Ldloc_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo2)
			}));
			return list;
		}

		internal static void OnStopInteractTriggerSpecialAnimation(InteractTrigger trigger, PlayerControllerB player)
		{
			VehicleSeatAnimator vehicleSeatAnimator = default(VehicleSeatAnimator);
			if (((Component)trigger).gameObject.TryGetComponent<VehicleSeatAnimator>(ref vehicleSeatAnimator))
			{
				vehicleSeatAnimator.OnStopInteract(player);
				interactedLastFrame = false;
			}
		}

		internal static void StopSpecialAnimationCoroutine(InteractTrigger trigger, PlayerControllerB player)
		{
			VehicleSeatAnimator vehicleSeatAnimator = default(VehicleSeatAnimator);
			if (((Component)trigger).gameObject.TryGetComponent<VehicleSeatAnimator>(ref vehicleSeatAnimator))
			{
				vehicleSeatAnimator.StopSpecialInteractAnimationCoroutine();
			}
		}

		[HarmonyPatch(typeof(InteractTrigger), "StopUsingClientRpc")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> InteractTrigger_Trans_StopUsingClientRpc(IEnumerable<CodeInstruction> instructions)
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'StopUsingClientRpc' for 'InteractTrigger'");
			FieldInfo fieldInfo = PatchUtils.Field(typeof(StartOfRound), "allPlayerScripts");
			FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "inVehicleAnimation");
			MethodInfo methodInfo = PatchUtils.Method(typeof(InteractTriggerPatches), "ClearPlayerOverrideOnInteractTrigger");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Could not transpile 'StopUsingClientRpc' for 'InteractTrigger'!");
				return list;
			}
			num++;
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_1, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo)
			}));
			return list;
		}

		[HarmonyPatch(typeof(InteractTrigger), "UpdateUsedByPlayerClientRpc")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> InteractTrigger_Trans_UpdateUsedByPlayerClientRpc(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'UpdateUsedByPlayerClientRpc' for 'InteractTrigger'");
			FieldInfo operand = PatchUtils.Field(typeof(InteractTrigger), "onInteractEarlyOtherClients");
			MethodInfo methodInfo = PatchUtils.Method(typeof(InteractTriggerPatches), "SetPlayerInSpecialAnimationTrigger");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Could not transpile 'UpdateUsedByPlayerClientRpc' for 'InteractTrigger'!");
				return list;
			}
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[4]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_1, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo),
				new CodeInstruction(OpCodes.Ret, (object)null)
			}));
			return list;
		}

		internal static void SetPlayerInSpecialAnimationTrigger(InteractTrigger trigger, int playerNum)
		{
			//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)
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerNum];
			((UnityEvent<PlayerControllerB>)(object)trigger.onInteractEarlyOtherClients).Invoke(val);
			if ((Object)(object)val != (Object)(object)GameNetworkManager.Instance.localPlayerController && (Object)(object)trigger.lockedPlayer == (Object)(object)((Component)GameNetworkManager.Instance.localPlayerController).transform)
			{
				Plugin.LogDebug("Client is getting kicked off of InteractTrigger animation");
				((MonoBehaviour)trigger).StopAllCoroutines();
				trigger.StopSpecialAnimation();
			}
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val))
			{
				if (Object.op_Implicit((Object)(object)trigger.overridePlayerParent))
				{
					val.overridePhysicsParent = trigger.overridePlayerParent;
				}
				trigger.isPlayingSpecialAnimation = true;
				trigger.lockedPlayer = val.thisPlayerBody;
				trigger.playerScriptInSpecialAnimation = val;
				trigger.playerUsingId = playerNum;
				if (trigger.setVehicleAnimation)
				{
					val.inVehicleAnimation = true;
					val.syncFullCameraRotation = ((Component)val.gameplayCamera).transform.localEulerAngles;
				}
				if (trigger.hidePlayerItem && (Object)(object)val.currentlyHeldObjectServer != (Object)null)
				{
					val.currentlyHeldObjectServer.EnableItemMeshes(false);
				}
				val.inSpecialInteractAnimation = true;
				val.currentTriggerInAnimationWith = trigger;
				if (!trigger.stopAnimationManually)
				{
					((MonoBehaviour)trigger).StartCoroutine(trigger.isSpecialAnimationPlayingTimer(playerNum));
				}
			}
		}

		internal static void SetPlayerOverrideParent(InteractTrigger trigger, int playerNum)
		{
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerNum];
			if (Object.op_Implicit((Object)(object)trigger.overridePlayerParent))
			{
				val.overridePhysicsParent = trigger.overridePlayerParent;
			}
			Plugin.LogError("Set override!");
		}

		internal static void SetPlayerNumIfNotSet(InteractTrigger trigger, int playerNum)
		{
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerNum];
			if (trigger.playerUsingId != playerNum)
			{
				trigger.playerUsingId = playerNum;
			}
			Plugin.LogError("Set num!");
		}

		internal static void SetInSpecialAnimationIfNull(InteractTrigger trigger, int playerNum)
		{
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerNum];
			if ((Object)(object)trigger.playerScriptInSpecialAnimation == (Object)null || (Object)(object)val.currentTriggerInAnimationWith != (Object)(object)trigger)
			{
				trigger.lockedPlayer = ((Component)val).transform;
				trigger.playerScriptInSpecialAnimation = val;
				trigger.isPlayingSpecialAnimation = true;
				val.currentTriggerInAnimationWith = trigger;
			}
			Plugin.LogError("Set special!");
		}

		internal static bool IsLocalPlayer(int playerNum)
		{
			Plugin.LogError("local player checkaroo!");
			return (Object)(object)StartOfRound.Instance.allPlayerScripts[playerNum] == (Object)(object)GameNetworkManager.Instance.localPlayerController;
		}

		internal static void ClearPlayerOverrideOnInteractTrigger(InteractTrigger trigger, int playerUsing)
		{
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerUsing];
			if (Object.op_Implicit((Object)(object)trigger.overridePlayerParent) && (Object)(object)val.overridePhysicsParent == (Object)(object)trigger.overridePlayerParent)
			{
				val.overridePhysicsParent = null;
			}
		}

		public static void CancelVehicleSeatInteraction()
		{
			interactedLastFrame = false;
		}

		[HarmonyPatch(typeof(InteractTrigger), "CancelLadderAnimation")]
		[HarmonyPrefix]
		public static bool InteractTrigger_Pre_CancelLadderAnimation(InteractTrigger __instance)
		{
			return (Object)(object)__instance.playerScriptInSpecialAnimation != (Object)null;
		}
	}
	[HarmonyPatch]
	public static class LandminePatches
	{
		internal static bool ShouldCheckCustomKnockback(PlayerControllerB player)
		{
			if (player is IPlayerManager playerManager)
			{
				return (Object)(object)playerManager.CurrentPlayerPhysicsRegion != (Object)null;
			}
			return false;
		}

		internal static bool CanPlayerBeKnockedBack(PlayerControllerB player)
		{
			if (player is IPlayerManager playerManager)
			{
				if (!((Object)(object)playerManager.CurrentPlayerPhysicsRegion == (Object)null))
				{
					return !playerManager.CurrentPlayerPhysicsRegion.IsPlayerProtectedFromKnockback(player);
				}
				return true;
			}
			return false;
		}

		internal static bool ShouldDealKnockback(PlayerControllerB instance)
		{
			return CanPlayerBeKnockedBack(instance);
		}

		[HarmonyPatch(typeof(Landmine), "SpawnExplosion")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Landmine_Trans_SpawnExplosion(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			if (CompatibilityUtils.INSTALLED_CRUISER_IMPROVED)
			{
				Plugin.LogDebug("Skipping Landmine transpiler as CruiserImproved is present");
				return list;
			}
			MethodInfo operand = PatchUtils.Method(typeof(Vector3), "get_magnitude");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldloca_S, 16),
				new PatchUtils.OpcodeMatch(OpCodes.Call, operand),
				new PatchUtils.OpcodeMatch(OpCodes.Ldc_R4, 2),
				new PatchUtils.OpcodeMatch(OpCodes.Ble_Un),
				new PatchUtils.OpcodeMatch(OpCodes.Ldloca_S, 16),
				new PatchUtils.OpcodeMatch(OpCodes.Call, operand),
				new PatchUtils.OpcodeMatch(OpCodes.Ldc_R4, 10)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogWarning("Could not find Landmine vehicle knockback check!");
				return list;
			}
			object operand2 = list[num + 3].operand;
			list.InsertRange(num + 4, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Ldloc_S, (object)4),
				new CodeInstruction(OpCodes.Call, (object)PatchUtils.Method(typeof(LandminePatches), "ShouldDealKnockback")),
				new CodeInstruction(OpCodes.Brfalse_S, operand2)
			}));
			return list;
		}
	}
	[HarmonyPatch]
	public static class PlayerControllerBPatches
	{
		private static Quaternion armsMetarigParentRot = Quaternion.Euler(90f, 0f, 0f);

		private static Quaternion armsMetarigRot = Quaternion.Euler(-90f, 0f, 0f);

		private static Vector3 localArmsPos = new Vector3(0f, -0.008f, -0.43f);

		private static Quaternion localArmsRot = Quaternion.Euler(84.78056f, 0f, 0f);

		private static Vector3 playerBodyPos = Vector3.zero;

		private static Quaternion playerBodyRot = Quaternion.Euler(-90f, 0f, 0f);

		private static bool hasLogged;

		[HarmonyPatch(typeof(PlayerControllerB), "UpdatePlayerAnimationsToOtherClients")]
		[HarmonyPrefix]
		public static bool PlayerControllerB_Pre_UpdatePlayerAnimationsToOtherClients(PlayerControllerB __instance, Vector2 moveInputVector)
		{
			if (!((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController))
			{
				return !Utilities.disableAnimationSync;
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PlayerControllerB_Trans_LateUpdate(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected O, but got Unknown
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'LateUpdate' for 'PlayerControllerB'");
			FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "parentedToElevatorLastFrame");
			FieldInfo operand2 = PatchUtils.Field(typeof(PlayerControllerB), "lastSyncedPhysicsParent");
			MethodInfo methodInfo = PatchUtils.Method(typeof(PlayerControllerBPatches), "TrySetPlayerPhysicsRegionFromOverride");
			MethodInfo methodInfo2 = PatchUtils.Method(typeof(PlayerControllerBPatches), "TrySetPlayerPhysicsRegion");
			MethodInfo methodInfo3 = PatchUtils.Method(typeof(PlayerControllerBPatches), "TryRemovePlayerPhysicsRegion");
			List<PatchUtils.OpcodeMatch> list2 = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldc_I4_0),
				new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, list2);
			if (num == -1)
			{
				Plugin.LogError("Could not locate first 'parentedToElevatorLastFrame' assignment in 'PlayerControllerB.LateUpdate'!");
				return list;
			}
			int num2 = PatchUtils.LocateCodeSegment(num + list2.Count, list, list2);
			if (num2 == -1)
			{
				Plugin.LogError("Could not locate second 'parentedToElevatorLastFrame' assignment in 'PlayerControllerB.LateUpdate'!");
				return list;
			}
			list.InsertRange(num + list2.Count, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo)
			}));
			num2 += 2;
			list.InsertRange(num2 + list2.Count, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo2)
			}));
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldnull),
				new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand2)
			};
			int num3 = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num3 == -1)
			{
				Plugin.LogError("Could not locate 'lastSyncedPhysicsParent' reset in 'PlayerControllerB.LateUpdate'!");
				return list;
			}
			list.InsertRange(num3, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo3)
			}));
			return list;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "KillPlayerClientRpc")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PlayerControllerB_Trans_KillPlayerClientRpc(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'KillPlayerClientRpc' for 'PlayerControllerB'");
			FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "physicsParent");
			MethodInfo methodInfo = PatchUtils.Method(typeof(PlayerControllerBPatches), "TryRemovePlayerPhysicsRegionLocal");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldloc_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldnull),
				new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Could not transpile 'KillPlayerClientRpc' on 'PlayerControllerB.KillPlayerClientRpc'!");
				return list;
			}
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo)
			}));
			return list;
		}

		internal static void TryRemovePlayerPhysicsRegion(PlayerControllerB player)
		{
			if (player is IPlayerManager playerManager)
			{
				Transform lastSyncedPhysicsParent = player.lastSyncedPhysicsParent;
				VehicleManager vehicleManager = default(VehicleManager);
				if (!((Object)(object)lastSyncedPhysicsParent == (Object)null) && ((Component)lastSyncedPhysicsParent).TryGetComponent<VehicleManager>(ref vehicleManager))
				{
					playerManager.CurrentPlayerPhysicsRegion = null;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PlayerControllerB_Trans_KillPlayer(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'KillPlayer' for 'PlayerControllerB'");
			FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "physicsParent");
			MethodInfo methodInfo = PatchUtils.Method(typeof(PlayerControllerBPatches), "TryRemovePlayerPhysicsRegionLocal");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldnull),
				new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Could not transpile 'KillPlayer' on 'PlayerControllerB.KillPlayer'!");
				return list;
			}
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo)
			}));
			return list;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "RemovePlayerPhysicsParentClientRpc")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PlayerControllerB_Trans_RemovePlayerPhysicsParentClientRpc(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'RemovePlayerPhysicsParentClientRpc' for 'PlayerControllerB'");
			FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "isPlayerDead");
			MethodInfo methodInfo = PatchUtils.Method(typeof(PlayerControllerBPatches), "TryRemovePlayerPhysicsRegionLocal");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand),
				new PatchUtils.OpcodeMatch(OpCodes.Brfalse)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Could not locate 'isPlayerDead' check in 'PlayerControllerB.RemovePlayerPhysicsParentClientRpc'!");
				return list;
			}
			List<Label> list2 = CodeInstructionExtensions.ExtractLabels(list[num]);
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2]
			{
				CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_0, (object)null), (IEnumerable<Label>)list2),
				new CodeInstruction(OpCodes.Call, (object)methodInfo)
			}));
			return list;
		}

		internal static void TryRemovePlayerPhysicsRegionLocal(PlayerControllerB player)
		{
			if (player is IPlayerManager playerManager && !((Object)(object)playerManager.CurrentPlayerPhysicsRegion == (Object)null))
			{
				playerManager.CurrentPlayerPhysicsRegion = null;
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "UpdatePlayerPhysicsParentLocal")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PlayerControllerB_Trans_UpdatePlayerPhysicsParentLocal(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'UpdatePlayerPhysicsParentLocal' for 'PlayerControllerB'");
			FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "isPlayerDead");
			MethodInfo methodInfo = PatchUtils.Method(typeof(PlayerControllerBPatches), "TryUpdatePhysicsRegionLocal");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand),
				new PatchUtils.OpcodeMatch(OpCodes.Brfalse)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Could not locate 'isPlayerDead' check in 'PlayerControllerB.UpdatePlayerPhysicsParentLocal'!");
				return list;
			}
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldarg_2, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo)
			}));
			return list;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PlayerControllerB_Trans_LateUpdate_SetOverride(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'LateUpdate' for 'PlayerControllerB'");
			FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "physicsParent");
			FieldInfo fieldInfo = PatchUtils.Field(typeof(PlayerControllerB), "overridePhysicsParent");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldloc_1),
				new PatchUtils.OpcodeMatch(OpCodes.Stfld, operand)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Could not locate 'physicsParent' assignment in 'PlayerControllerB.LateUpdate'!");
				return list;
			}
			Label label = default(Label);
			list[num].labels.Add(label);
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[6]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo),
				new CodeInstruction(OpCodes.Brfalse_S, (object)label),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo),
				new CodeInstruction(OpCodes.Stloc_1, (object)null)
			}));
			return list;
		}

		[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> PlayerControllerB_Trans_LateUpdate_Transform(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			Plugin.LogDebug("Attempting to transpile 'LateUpdate' for 'PlayerControllerB'");
			FieldInfo operand = PatchUtils.Field(typeof(PlayerControllerB), "playersManager");
			FieldInfo operand2 = PatchUtils.Field(typeof(StartOfRound), "overrideSpectateCamera");
			MethodInfo methodInfo = PatchUtils.Method(typeof(PlayerControllerBPatches), "TrySetPlayerBodyTransform");
			List<PatchUtils.OpcodeMatch> searchFor = new List<PatchUtils.OpcodeMatch>
			{
				new PatchUtils.OpcodeMatch(OpCodes.Ldarg_0),
				new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand),
				new PatchUtils.OpcodeMatch(OpCodes.Ldfld, operand2)
			};
			int num = PatchUtils.LocateCodeSegment(0, list, searchFor);
			if (num == -1)
			{
				Plugin.LogError("Could not transpile 'LateUpdate' on 'PlayerControllerB.LateUpdate'!");
				return list;
			}
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo)
			}));
			return list;
		}

		internal static void TrySetPlayerBodyTransform(PlayerControllerB player)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)player == (Object)null) && player.isPlayerControlled && !player.isPlayerDead && player.inVehicleAnimation)
			{
				Transform playerModelArmsMetarig = player.playerModelArmsMetarig;
				Transform localArmsTransform = player.localArmsTransform;
				Transform transform = ((Component)player.playerBodyAnimator).transform;
				((Component)playerModelArmsMetarig.parent).transform.localRotation = armsMetarigParentRot;
				playerModelArmsMetarig.localRotation = armsMetarigRot;
				localArmsTransform.localPosition = localArmsPos;
				localArmsTransform.localRotation = localArmsRot;
				transform.localPosition = playerBodyPos;
				transform.localRotation = playerBodyRot;
			}
		}

		internal static void TryUpdatePhysicsRegionLocal(PlayerControllerB player, bool isOverride)
		{
			if (player is IPlayerManager playerManager)
			{
				Transform val = (isOverride ? player.overridePhysicsParent : player.physicsParent);
				VehicleManager vehicleManager = default(VehicleManager);
				if (!((Object)(object)val == (Object)null) && ((Component)val).TryGetComponent<VehicleManager>(ref vehicleManager))
				{
					playerManager.CurrentPlayerPhysicsRegion = vehicleManager.physicsRegion;
				}
			}
		}

		internal static void TrySetPlayerPhysicsRegion