Decompiled source of SnowyLib v1.25.2

Snowlance.SnowyLib.dll

Decompiled 18 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dawn;
using Dawn.Utils;
using Dissonance;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Snowlance.SnowyLib.NetcodePatcher;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[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("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: AssemblyCompany("Snowlance.SnowyLib")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.25.2.0")]
[assembly: AssemblyInformationalVersion("1.25.2+0232279118301afa39540a87e386c0cdb1b1eeca")]
[assembly: AssemblyProduct("SnowyLib")]
[assembly: AssemblyTitle("Snowlance.SnowyLib")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.25.2.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 SnowyLib
{
	public static class AttachableObjectManager
	{
		public static AutoDictionary<PlayerControllerB, List<AttachmentPoint>> PlayerAttachmentPoints = new AutoDictionary<PlayerControllerB, List<AttachmentPoint>>((PlayerControllerB player) => AvailableAttachmentPoints.ToList());

		public static List<AttachmentPoint> AvailableAttachmentPoints { get; } = new List<AttachmentPoint>();

		[StaticInit]
		public static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0535: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_064f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0663: Unknown result type (might be due to invalid IL or missing references)
			//IL_067e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_070b: Unknown result type (might be due to invalid IL or missing references)
			//IL_071f: Unknown result type (might be due to invalid IL or missing references)
			//IL_073a: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0769: Unknown result type (might be due to invalid IL or missing references)
			//IL_077d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0798: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07db: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_080a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0825: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Unknown result type (might be due to invalid IL or missing references)
			//IL_0854: Unknown result type (might be due to invalid IL or missing references)
			//IL_0868: Unknown result type (might be due to invalid IL or missing references)
			//IL_0883: Unknown result type (might be due to invalid IL or missing references)
			//IL_0897: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0910: Unknown result type (might be due to invalid IL or missing references)
			//IL_0924: Unknown result type (might be due to invalid IL or missing references)
			//IL_093f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0953: Unknown result type (might be due to invalid IL or missing references)
			//IL_096e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0982: Unknown result type (might be due to invalid IL or missing references)
			AddPoint(0, new Vector3(0f, 0.365f, 0.002f), new Vector3(0f, 0f, 0f));
			AddPoint(0, new Vector3(-0.1028f, 0.3071f, 0.0856f), new Vector3(-0.245f, 0.815f, 33.496f));
			AddPoint(0, new Vector3(0.138f, 0.3f, 0f), new Vector3(0f, 0f, -60.948f));
			AddPoint(0, new Vector3(0.1094f, 0f, 0f), new Vector3(0f, 0f, -60.948f));
			AddPoint(0, new Vector3(0.096f, 0.0902f, -0.0783f), new Vector3(-11.136f, 44.702f, -73.178f));
			AddPoint(0, new Vector3(0.0431f, 0.2706f, -0.1359f), new Vector3(-11.246f, 38.263f, -73.052f));
			AddPoint(0, new Vector3(-0.079f, 0.216f, -0.135f), new Vector3(-9.79f, 101.624f, -73.593f));
			AddPoint(0, new Vector3(-0.143f, 0.273f, -0.04f), new Vector3(-8.845f, 147.146f, -72.937f));
			AddPoint(0, new Vector3(-0.095f, 0.022f, -0.034f), new Vector3(-9.038f, 135.199f, -73.18f));
			AddPoint(1, new Vector3(-0.03f, -0.059f, -0.083f), new Vector3(-71.716f, 44.6f, -33.023f));
			AddPoint(1, new Vector3(0.0334f, -0.0434f, 0.0661f), new Vector3(-57.89f, -5.879f, -119.005f));
			AddPoint(1, new Vector3(-0.075f, 0.136f, 0.017f), new Vector3(-49.812f, 192.527f, -88.63f));
			AddPoint(1, new Vector3(0.048f, 0.14f, 0.004f), new Vector3(-27.101f, 193.738f, -270.77f));
			AddPoint(1, new Vector3(-0.026f, 0.131f, -0.051f), new Vector3(-16.438f, 306.002f, -303.578f));
			AddPoint(2, new Vector3(-0.008f, 0.042f, -0.069f), new Vector3(-18.538f, -70.192f, 104.316f));
			AddPoint(2, new Vector3(-0.038f, 0.167f, 0.065f), new Vector3(30.865f, 23.854f, 57.64f));
			AddPoint(2, new Vector3(-0.035f, 0.019f, 0.089f), new Vector3(26.452f, 226.07f, -112.116f));
			AddPoint(2, new Vector3(0.051f, 0.157f, -0.035f), new Vector3(-19.561f, 214.95f, 70.289f));
			AddPoint(3, new Vector3(0.089f, 0.009f, 0.02f), new Vector3(-35.165f, -24.071f, -92.253f));
			AddPoint(3, new Vector3(0.0282f, 0.2983f, -0.0863f), new Vector3(-50.138f, -293.786f, -117.426f));
			AddPoint(3, new Vector3(-0.0697f, 0.012f, 0.0797f), new Vector3(37.579f, -123.803f, -88.869f));
			AddPoint(3, new Vector3(-0.0672f, 0.1735f, -0.0732f), new Vector3(-10.263f, -223.565f, -125.123f));
			AddPoint(3, new Vector3(0.083f, 0.181f, -0.038f), new Vector3(-172.115f, -169.928f, -279.59f));
			AddPoint(3, new Vector3(0.0478f, 0.2481f, 0.0887f), new Vector3(-176.204f, -257.097f, -235.701f));
			AddPoint(3, new Vector3(-0.07f, 0.236f, 0.062f), new Vector3(-141.741f, -381.508f, -218.368f));
			AddPoint(4, new Vector3(-0.054f, -0.012f, -0.056f), new Vector3(-37.21f, -84.346f, 100.846f));
			AddPoint(4, new Vector3(-0.073f, 0.09f, -0.023f), new Vector3(-62.196f, -0.96f, 63.314f));
			AddPoint(4, new Vector3(0.053f, 0.155f, -0.081f), new Vector3(-101.773f, -126.592f, 86.861f));
			AddPoint(4, new Vector3(-0.0237f, 0.2073f, 0.1117f), new Vector3(-97.917f, -287.48f, 112.384f));
			AddPoint(5, new Vector3(-0.156f, 0.002f, 0.115f), new Vector3(63.455f, -365.208f, 26.286f));
			AddPoint(5, new Vector3(0.002f, 0.0025f, 0.1483f), new Vector3(-7.833f, -423.314f, -131.667f));
			AddPoint(5, new Vector3(0.216f, 0.31f, 0.108f), new Vector3(22.333f, -406.705f, -68.389f));
			AddPoint(5, new Vector3(-0.26f, 0.4082f, 0.0569f), new Vector3(30.392f, -462.337f, -40.781f));
			AddPoint(5, new Vector3(-0.2428f, -0.0008f, 0.0117f), new Vector3(64.106f, -374.719f, 93.005f));
			AddPoint(5, new Vector3(0.118f, 0.002f, 0.115f), new Vector3(56.17f, -212.746f, 73.226f));
			AddPoint(5, new Vector3(0.0688f, 0.16f, 0.161f), new Vector3(14.626f, -271.287f, 84.833f));
			AddPoint(5, new Vector3(0.2411f, 0.121f, -0.25f), new Vector3(-2.129f, -153.411f, 116.528f));
			AddPoint(5, new Vector3(-0.242f, 0.121f, -0.25f), new Vector3(65.686f, -12.508f, 102.029f));
			AddPoint(5, new Vector3(-0.061f, 0.12f, -0.339f), new Vector3(1.305f, -116.493f, 81.985f));
			AddPoint(5, new Vector3(-0.153f, 0.295f, -0.342f), new Vector3(23.736f, -33.542f, 116.857f));
			AddPoint(5, new Vector3(0.071f, 0.295f, -0.342f), new Vector3(-40.673f, -89.174f, 61.959f));
			AddPoint(5, new Vector3(0.071f, 0.4919f, -0.3132f), new Vector3(-22.328f, 68.897f, -9.012f));
			AddPoint(5, new Vector3(-0.189f, 0.492f, -0.313f), new Vector3(-59.425f, -114.368f, 110.685f));
			AddPoint(7, new Vector3(0.086f, 0.009f, 0.022f), new Vector3(-20.337f, -362.786f, 261.855f));
			AddPoint(7, new Vector3(0.049f, -0.004f, -0.102f), new Vector3(6.561f, -250.508f, 308.16f));
			AddPoint(7, new Vector3(-0.232f, -0.032f, -0.174f), new Vector3(23.031f, -333.859f, 241.566f));
			AddPoint(7, new Vector3(-0.03f, 0.017f, 0.114f), new Vector3(-35.427f, -304.178f, 98.455f));
			AddPoint(8, new Vector3(0.1021f, 0.1404f, 0.1034f), new Vector3(-38.722f, -226.187f, 64.424f));
			AddPoint(8, new Vector3(-0.0661f, -0.0196f, 0.0773f), new Vector3(-35.231f, -303.833f, 54.792f));
			AddPoint(8, new Vector3(-0.032f, 0.156f, -0.101f), new Vector3(-11.888f, -396.463f, 34.612f));
			AddPoint(8, new Vector3(0.092931f, 0.1944469f, 0.01660633f), new Vector3(92.15399f, -306.724f, 271.902f));
			AddPoint(8, new Vector3(-0.0823f, 0.0683f, -0.0716f), new Vector3(-0.41f, -363.386f, 120.789f));
		}

		private static void AddPoint(int bodyPartIndex, Vector3 position, Vector3 rotation)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			AvailableAttachmentPoints.Add(new AttachmentPoint(bodyPartIndex, position, rotation));
		}

		public static AttachmentPoint? FindAvailablePoint(PlayerControllerB player)
		{
			return PlayerAttachmentPoints[player].Where((AttachmentPoint x) => !x.IsOccupied).GetRandom();
		}

		public static bool TrySpawnItemOnPlayer(NamespacedKey<DawnItemInfo> key, PlayerControllerB player)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			AttachmentPoint attachmentPoint = FindAvailablePoint(player);
			if (attachmentPoint == null)
			{
				return false;
			}
			Utils.SpawnItem(key, Vector3.zero, default(Quaternion), null, destroyWithScene: false, delegate(GrabbableObject item)
			{
				AttachableObject attachableObject = item as AttachableObject;
				if ((Object)(object)attachableObject == (Object)null)
				{
					Plugin.logger.LogError((object)("Failed to attach " + ((Object)item).name + " to " + player.playerUsername + ", " + ((Object)item).name + " is not an AttachableObject"));
				}
				else
				{
					attachableObject.SetPlayerAttachedTo(player, attachmentPoint);
				}
			});
			return true;
		}
	}
	public class AttachmentPoint(int bodyPartIndex, Vector3 positionOffset, Vector3 rotationOffset)
	{
		public int bodyPartIndex = bodyPartIndex;

		public Vector3 positionOffset = positionOffset;

		public Vector3 rotationOffset = rotationOffset;

		public AttachableObject? occupant = null;

		public bool IsOccupied => (Object)(object)occupant != (Object)null;
	}
	public abstract class AttachableObject : PhysicsProp
	{
		public PlayerControllerB? playerAttachedTo;

		public AttachmentPoint? attachmentPoint;

		public override void LateUpdate()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)playerAttachedTo == (Object)null || attachmentPoint == null)
			{
				((GrabbableObject)this).LateUpdate();
				return;
			}
			Transform val = playerAttachedTo.bodyParts[attachmentPoint.bodyPartIndex];
			((Component)this).transform.rotation = val.rotation;
			((Component)this).transform.Rotate(attachmentPoint.rotationOffset);
			((Component)this).transform.position = val.position;
			Vector3 positionOffset = attachmentPoint.positionOffset;
			positionOffset = val.rotation * positionOffset;
			Transform transform = ((Component)this).transform;
			transform.position += positionOffset;
			if (((GrabbableObject)this).rotateObject)
			{
				((Component)this).transform.Rotate(new Vector3(0f, Time.deltaTime * 60f, 0f), (Space)0);
			}
			if ((Object)(object)((GrabbableObject)this).radarIcon != (Object)null)
			{
				((GrabbableObject)this).radarIcon.position = ((Component)this).transform.position;
			}
		}

		public override void EquipItem()
		{
			Detach();
			((PhysicsProp)this).EquipItem();
		}

		public override void OnDestroy()
		{
			Detach();
			((GrabbableObject)this).OnDestroy();
		}

		public void SetPlayerAttachedTo(PlayerControllerB player, AttachmentPoint attachmentPoint)
		{
			SetPlayerAttachedToRpc(player.actualClientId, AttachableObjectManager.PlayerAttachmentPoints[player].IndexOf(attachmentPoint));
		}

		public void Detach()
		{
			if (attachmentPoint != null || !((Object)(object)playerAttachedTo == (Object)null))
			{
				DetachRpc();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void DetachRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(113114426u, val3, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 113114426u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (attachmentPoint != null)
				{
					attachmentPoint.occupant = null;
				}
				attachmentPoint = null;
				if ((Object)(object)playerAttachedTo == (Object)(object)Plugin.localPlayer)
				{
					((GrabbableObject)this).EnablePhysics(true);
					((GrabbableObject)this).EnableItemMeshes(true);
				}
				playerAttachedTo = null;
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SetPlayerAttachedToRpc(ulong clientId, int attachmentPointIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(729612381u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				BytePacker.WriteValueBitPacked(val2, attachmentPointIndex);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 729612381u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			playerAttachedTo = Plugin.PlayerFromId(clientId);
			if ((Object)(object)playerAttachedTo == (Object)null)
			{
				Plugin.logger.LogError((object)"SetPlayerAttachedToRpc: Failed to get player from clientId");
				return;
			}
			if ((Object)(object)playerAttachedTo == (Object)(object)Plugin.localPlayer)
			{
				((GrabbableObject)this).EnablePhysics(false);
				((GrabbableObject)this).EnableItemMeshes(false);
			}
			attachmentPoint = AttachableObjectManager.PlayerAttachmentPoints[playerAttachedTo][attachmentPointIndex];
			attachmentPoint.occupant = this;
		}

		protected override void __initializeVariables()
		{
			((PhysicsProp)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
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(113114426u, new RpcReceiveHandler(__rpc_handler_113114426), "DetachRpc");
			((NetworkBehaviour)this).__registerRpc(729612381u, new RpcReceiveHandler(__rpc_handler_729612381), "SetPlayerAttachedToRpc");
			((PhysicsProp)this).__initializeRpcs();
		}

		private static void __rpc_handler_113114426(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AttachableObject)(object)target).DetachRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_729612381(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				int attachmentPointIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref attachmentPointIndex);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AttachableObject)(object)target).SetPlayerAttachedToRpc(clientId, attachmentPointIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string? __getTypeName()
		{
			return "AttachableObject";
		}
	}
	[Obsolete("Use StaticInitAttribute instead", true)]
	[AttributeUsage(AttributeTargets.Method)]
	public sealed class InitConfigAttribute : Attribute
	{
		[StaticInit]
		internal static void Initialize()
		{
			Assembly assembly = typeof(InitConfigAttribute).Assembly;
			string snowyLibName = assembly.GetName().Name;
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly2 in assemblies)
			{
				if (assembly2 == assembly)
				{
					ScanAssembly(assembly2);
				}
				else if (assembly2.GetReferencedAssemblies().Any((AssemblyName a) => a.Name == snowyLibName))
				{
					ScanAssembly(assembly2);
				}
			}
		}

		private static void ScanAssembly(Assembly assembly)
		{
			foreach (Type loadableType in GetLoadableTypes(assembly))
			{
				MethodInfo[] methods = loadableType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					try
					{
						if (methodInfo.IsDefined(typeof(InitConfigAttribute), inherit: false))
						{
							if (methodInfo.ReturnType != typeof(void))
							{
								throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " must return void.");
							}
							if (methodInfo.GetParameters().Length != 0)
							{
								throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " cannot have parameters.");
							}
							methodInfo.Invoke(null, null);
						}
					}
					catch (Exception ex)
					{
						Plugin.logger.LogError((object)ex);
					}
				}
			}
		}

		private static IEnumerable<Type> GetLoadableTypes(Assembly assembly)
		{
			try
			{
				return assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				return ex.Types.Where((Type t) => t != null);
			}
		}
	}
	[AttributeUsage(AttributeTargets.Method)]
	public sealed class OnFinishGeneratingLevelAttribute : Attribute
	{
		private static readonly List<Action> methods = new List<Action>();

		[StaticInit]
		internal static void Initialize()
		{
			methods.Clear();
			Assembly assembly = typeof(OnFinishGeneratingLevelAttribute).Assembly;
			string snowyLibName = assembly.GetName().Name;
			ScanAssembly(assembly);
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly2 in assemblies)
			{
				if (!(assembly2 == assembly) && assembly2.GetReferencedAssemblies().Any((AssemblyName a) => a.Name == snowyLibName))
				{
					ScanAssembly(assembly2);
				}
			}
		}

		private static void ScanAssembly(Assembly assembly)
		{
			foreach (Type loadableType in GetLoadableTypes(assembly))
			{
				MethodInfo[] array = loadableType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in array)
				{
					try
					{
						if (methodInfo.IsDefined(typeof(OnFinishGeneratingLevelAttribute), inherit: false))
						{
							if (methodInfo.ReturnType != typeof(void))
							{
								throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " must return void.");
							}
							if (methodInfo.GetParameters().Length != 0)
							{
								throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " cannot have parameters.");
							}
							methods.Add((Action)Delegate.CreateDelegate(typeof(Action), methodInfo));
						}
					}
					catch (Exception ex)
					{
						Plugin.logger.LogError((object)ex);
					}
				}
			}
		}

		private static IEnumerable<Type> GetLoadableTypes(Assembly assembly)
		{
			try
			{
				return assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				return ex.Types.Where((Type t) => t != null);
			}
		}

		internal static void OnFinishGeneratingLevel()
		{
			Utils.OnFinishGeneratingLevelPatches();
			foreach (Action method in methods)
			{
				try
				{
					method();
				}
				catch (Exception ex)
				{
					Plugin.logger.LogError((object)ex);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class OnFinishGeneratingLevelAttributePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingLevel")]
		private static void RoundManager_FinishGeneratingLevel_Postfix(GrabbableObject __instance)
		{
			try
			{
				OnFinishGeneratingLevelAttribute.OnFinishGeneratingLevel();
			}
			catch (Exception ex)
			{
				Plugin.logger.LogError((object)ex);
			}
		}
	}
	[AttributeUsage(AttributeTargets.Method)]
	public sealed class OnResetShipAttribute : Attribute
	{
		private static readonly List<Action> methods = new List<Action>();

		[StaticInit]
		internal static void Initialize()
		{
			methods.Clear();
			Assembly assembly = typeof(OnResetShipAttribute).Assembly;
			string snowyLibName = assembly.GetName().Name;
			ScanAssembly(assembly);
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly2 in assemblies)
			{
				if (!(assembly2 == assembly) && assembly2.GetReferencedAssemblies().Any((AssemblyName a) => a.Name == snowyLibName))
				{
					ScanAssembly(assembly2);
				}
			}
		}

		private static void ScanAssembly(Assembly assembly)
		{
			foreach (Type loadableType in GetLoadableTypes(assembly))
			{
				MethodInfo[] array = loadableType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in array)
				{
					try
					{
						if (methodInfo.IsDefined(typeof(OnResetShipAttribute), inherit: false))
						{
							if (methodInfo.ReturnType != typeof(void))
							{
								throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " must return void.");
							}
							if (methodInfo.GetParameters().Length != 0)
							{
								throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " cannot have parameters.");
							}
							Action action = (Action)Delegate.CreateDelegate(typeof(Action), methodInfo);
							methods.Add(action);
							action();
						}
					}
					catch (Exception ex)
					{
						Plugin.logger.LogError((object)ex);
					}
				}
			}
		}

		private static IEnumerable<Type> GetLoadableTypes(Assembly assembly)
		{
			try
			{
				return assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				return ex.Types.Where((Type t) => t != null);
			}
		}

		internal static void OnResetShip()
		{
			foreach (Action method in methods)
			{
				try
				{
					method();
				}
				catch (Exception ex)
				{
					Plugin.logger.LogError((object)ex);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class OnResetShipAttributePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "ResetShip")]
		private static void StartOfRound_ResetShip_Postfix()
		{
			try
			{
				OnResetShipAttribute.OnResetShip();
			}
			catch (Exception ex)
			{
				Plugin.logger.LogError((object)ex);
			}
		}
	}
	[AttributeUsage(AttributeTargets.Method)]
	public sealed class StaticInitAttribute : Attribute
	{
		internal static void Initialize()
		{
			Assembly assembly = typeof(StaticInitAttribute).Assembly;
			string snowyLibName = assembly.GetName().Name;
			ScanAssembly(assembly);
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly2 in assemblies)
			{
				if (!(assembly2 == assembly) && assembly2.GetReferencedAssemblies().Any((AssemblyName a) => a.Name == snowyLibName))
				{
					ScanAssembly(assembly2);
				}
			}
		}

		private static void ScanAssembly(Assembly assembly)
		{
			foreach (Type loadableType in GetLoadableTypes(assembly))
			{
				MethodInfo[] methods = loadableType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					try
					{
						if (methodInfo.IsDefined(typeof(StaticInitAttribute), inherit: false))
						{
							if (methodInfo.ReturnType != typeof(void))
							{
								throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " must return void.");
							}
							if (methodInfo.GetParameters().Length != 0)
							{
								throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " cannot have parameters.");
							}
							methodInfo.Invoke(null, null);
						}
					}
					catch (Exception ex)
					{
						Plugin.logger.LogError((object)ex);
					}
				}
			}
		}

		private static IEnumerable<Type> GetLoadableTypes(Assembly assembly)
		{
			try
			{
				return assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				return ex.Types.Where((Type t) => t != null);
			}
		}
	}
	[AttributeUsage(AttributeTargets.Method)]
	public sealed class StaticUpdateAttribute : Attribute
	{
		private static readonly List<Action> updates = new List<Action>();

		internal static void Initialize()
		{
			updates.Clear();
			Assembly assembly = typeof(StaticUpdateAttribute).Assembly;
			string snowyLibName = assembly.GetName().Name;
			ScanAssembly(assembly);
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly2 in assemblies)
			{
				if (!(assembly2 == assembly) && assembly2.GetReferencedAssemblies().Any((AssemblyName a) => a.Name == snowyLibName))
				{
					ScanAssembly(assembly2);
				}
			}
		}

		private static void ScanAssembly(Assembly assembly)
		{
			foreach (Type loadableType in GetLoadableTypes(assembly))
			{
				MethodInfo[] methods = loadableType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					try
					{
						if (methodInfo.IsDefined(typeof(StaticUpdateAttribute), inherit: false))
						{
							if (methodInfo.ReturnType != typeof(void))
							{
								throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " must return void.");
							}
							if (methodInfo.GetParameters().Length != 0)
							{
								throw new Exception(methodInfo.DeclaringType.FullName + "." + methodInfo.Name + " cannot have parameters.");
							}
							updates.Add((Action)Delegate.CreateDelegate(typeof(Action), methodInfo));
						}
					}
					catch (Exception ex)
					{
						Plugin.logger.LogError((object)ex);
					}
				}
			}
		}

		private static IEnumerable<Type> GetLoadableTypes(Assembly assembly)
		{
			try
			{
				return assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				return ex.Types.Where((Type t) => t != null);
			}
		}

		internal static void Update()
		{
			foreach (Action update in updates)
			{
				try
				{
					update();
				}
				catch (Exception ex)
				{
					Plugin.logger.LogError((object)ex);
				}
			}
		}
	}
	public class AutoDictionary<TKey, TValue> : Dictionary<TKey, TValue> where TValue : new()
	{
		private readonly Func<TKey, TValue> _factory;

		public new TValue this[TKey key]
		{
			get
			{
				if (!TryGetValue(key, out var value))
				{
					value = (base[key] = _factory(key));
				}
				return value;
			}
			set
			{
				base[key] = value;
			}
		}

		public AutoDictionary(Func<TKey, TValue> factory)
		{
			_factory = factory;
		}

		public AutoDictionary()
		{
			_factory = (TKey key) => default(TValue);
		}
	}
	public static class BoundsExtensions
	{
		public static Vector3 GetRandomPointInsideBounds(this Bounds bounds)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			for (int i = 0; i < 100; i++)
			{
				((Vector3)(ref val))..ctor(Random.Range(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x), Random.Range(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y), Random.Range(((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z));
				if (((Bounds)(ref bounds)).ClosestPoint(val) == val)
				{
					return val;
				}
			}
			return ((Bounds)(ref bounds)).center;
		}

		public static Vector3 GetRandomPointInsideBounds(this Bounds bounds, Random random)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			for (int i = 0; i < 100; i++)
			{
				((Vector3)(ref val))..ctor(RandomExtensions.NextFloat(random, ((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x), RandomExtensions.NextFloat(random, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y), RandomExtensions.NextFloat(random, ((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z));
				if (((Bounds)(ref bounds)).ClosestPoint(val) == val)
				{
					return val;
				}
			}
			return ((Bounds)(ref bounds)).center;
		}
	}
	public static class ColliderExtensions
	{
		public static Vector3 GetRandomPointOnSurface(this Collider collider)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = collider.bounds;
			Vector3 val = default(Vector3);
			Ray val5 = default(Ray);
			RaycastHit val7 = default(RaycastHit);
			for (int i = 0; i < 100; i++)
			{
				((Vector3)(ref val))..ctor(Random.Range(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x), Random.Range(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y), Random.Range(((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z));
				Vector3 onUnitSphere = Random.onUnitSphere;
				Vector3 val2 = val;
				Vector3 val3 = onUnitSphere;
				Vector3 val4 = ((Bounds)(ref bounds)).extents;
				val = val2 + val3 * ((Vector3)(ref val4)).magnitude * 2f;
				val4 = ((Bounds)(ref bounds)).center - val;
				onUnitSphere = ((Vector3)(ref val4)).normalized;
				((Ray)(ref val5))..ctor(val, onUnitSphere);
				Ray val6 = val5;
				val4 = ((Bounds)(ref bounds)).extents;
				if (collider.Raycast(val6, ref val7, ((Vector3)(ref val4)).magnitude * 4f))
				{
					return ((RaycastHit)(ref val7)).point;
				}
			}
			return collider.ClosestPoint(((Bounds)(ref bounds)).center);
		}

		public static Vector3 GetRandomPointInsideBounds(this Collider collider)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = collider.bounds;
			Vector3 val = default(Vector3);
			for (int i = 0; i < 100; i++)
			{
				((Vector3)(ref val))..ctor(Random.Range(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x), Random.Range(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y), Random.Range(((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z));
				if (collider.ClosestPoint(val) == val)
				{
					return val;
				}
			}
			Bounds bounds2 = collider.bounds;
			return ((Bounds)(ref bounds2)).center;
		}

		public static Vector3 GetRandomPointInsideBounds(this Collider collider, Random random)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = collider.bounds;
			Vector3 val = default(Vector3);
			for (int i = 0; i < 100; i++)
			{
				((Vector3)(ref val))..ctor(RandomExtensions.NextFloat(random, ((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x), RandomExtensions.NextFloat(random, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y), RandomExtensions.NextFloat(random, ((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z));
				if (collider.ClosestPoint(val) == val)
				{
					return val;
				}
			}
			Bounds bounds2 = collider.bounds;
			return ((Bounds)(ref bounds2)).center;
		}
	}
	public static class ComponentExtensions
	{
		public static bool TryGetComponentInChildren<T>(this Component comp, out T? component) where T : Component
		{
			component = comp.GetComponentInChildren<T>();
			return (Object)(object)component != (Object)null;
		}
	}
	public static class EnemyAIExtensions
	{
		public static StatusEffectController StatusEffectController(this EnemyAI enemy)
		{
			StatusEffectController statusEffectController = default(StatusEffectController);
			return ((Component)enemy).gameObject.TryGetComponent<StatusEffectController>(ref statusEffectController) ? statusEffectController : ((Component)enemy).gameObject.AddComponent<StatusEffectController>();
		}

		public static bool TargetClosestEnemy(this EnemyAI thisEnemy, out EnemyAI? targetEnemy, EnemyAI? previousTargetEnemy, Func<EnemyAI, bool> enemyIsTargetable, float bufferDistance = 1.5f, bool requireLineOfSight = false, float viewWidth = 70f, bool doGroundCast = false, bool requirePath = false, bool checkForMineshaftStartTile = true)
		{
			//IL_0057: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			targetEnemy = previousTargetEnemy;
			thisEnemy.mostOptimalDistance = 2000f;
			EnemyAI val = targetEnemy;
			targetEnemy = null;
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				if (!enemyIsTargetable(spawnedEnemy))
				{
					continue;
				}
				if (doGroundCast)
				{
					if (!Physics.Raycast(((Component)spawnedEnemy).transform.position, Vector3.down, ref thisEnemy.raycastHit, 5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) || (requirePath && thisEnemy.PathIsIntersectedByLineOfSight(((RaycastHit)(ref thisEnemy.raycastHit)).point, false, false, false)))
					{
						continue;
					}
				}
				else if (requirePath && thisEnemy.PathIsIntersectedByLineOfSight(((Component)spawnedEnemy).transform.position, false, false, false))
				{
					continue;
				}
				if (!requireLineOfSight || thisEnemy.CheckLineOfSightForPosition(((Component)spawnedEnemy.eye).transform.position, viewWidth, 40, -1f, (Transform)null))
				{
					thisEnemy.tempDist = Vector3.Distance(((Component)thisEnemy).transform.position, ((Component)spawnedEnemy).transform.position);
					if (thisEnemy.tempDist < thisEnemy.mostOptimalDistance)
					{
						thisEnemy.mostOptimalDistance = thisEnemy.tempDist;
						targetEnemy = spawnedEnemy;
					}
				}
			}
			if ((Object)(object)targetEnemy != (Object)null && bufferDistance > 0f && (Object)(object)val != (Object)null && Mathf.Abs(thisEnemy.mostOptimalDistance - Vector3.Distance(((Component)thisEnemy).transform.position, ((Component)val).transform.position)) < bufferDistance)
			{
				targetEnemy = val;
			}
			return (Object)(object)targetEnemy != (Object)null;
		}

		public static EnemyAI? CheckLineOfSightForClosestEnemy(this EnemyAI thisEnemy, out EnemyAI? targetEnemy, EnemyAI? previousTargetEnemy, float width = 45f, int range = 60, int proximityAwareness = -1, float bufferDistance = 0f)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			targetEnemy = previousTargetEnemy;
			if (thisEnemy.isOutside && !thisEnemy.enemyType.canSeeThroughFog && (int)TimeOfDay.Instance.currentLevelWeather == 3)
			{
				range = Mathf.Clamp(range, 0, 30);
			}
			float num = 1000f;
			float num2 = 1000f;
			EnemyAI val = null;
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				num = 1000f;
				Vector3 position = ((Component)spawnedEnemy.eye).transform.position;
				Vector3 val2 = position - thisEnemy.eye.position;
				bool flag = false;
				if (Vector3.Angle(thisEnemy.eye.forward, val2) < width)
				{
					flag = true;
				}
				else
				{
					num = Vector3.Distance(thisEnemy.eye.position, position);
					if (proximityAwareness != -1 && num < (float)proximityAwareness)
					{
						flag = true;
					}
				}
				if (flag && !Physics.Linecast(thisEnemy.eye.position, position, ref thisEnemy.raycastHit, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && !Physics.Linecast(position, thisEnemy.eye.position, ref thisEnemy.raycastHit, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
				{
					if (num == 1000f)
					{
						num = Vector3.Distance(thisEnemy.eye.position, position);
					}
					if (num < num2)
					{
						num2 = num;
						val = spawnedEnemy;
					}
				}
			}
			if ((Object)(object)targetEnemy != (Object)null && (Object)(object)val != (Object)null && (Object)(object)targetEnemy != (Object)(object)val && bufferDistance > 0f && Mathf.Abs(num2 - Vector3.Distance(((Component)thisEnemy).transform.position, ((Component)targetEnemy).transform.position)) < bufferDistance)
			{
				return null;
			}
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			thisEnemy.mostOptimalDistance = num2;
			return val;
		}

		public static int GetMaxHealth(this EnemyAI enemy)
		{
			return enemy.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP;
		}

		public static bool IsOutside(this EnemyAI enemy)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)enemy).transform.position.y > -80f;
		}

		public static void AddForce(this EnemyAI enemy, Vector3 direction, float force, float airTime = 1f)
		{
			//IL_0075: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			((Behaviour)enemy.agent).enabled = false;
			bool removeRigidbody = false;
			Rigidbody enemyRb = ((Component)enemy).gameObject.GetComponent<Rigidbody>();
			if ((Object)(object)enemyRb == (Object)null)
			{
				removeRigidbody = true;
				enemyRb = ((Component)enemy).gameObject.AddComponent<Rigidbody>();
			}
			enemyRb.isKinematic = false;
			enemyRb.velocity = Vector3.zero;
			enemyRb.AddForce(((Vector3)(ref direction)).normalized * force, (ForceMode)1);
			((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(RemoveRigidbodyAfterDelay(airTime, removeRigidbody));
			IEnumerator RemoveRigidbodyAfterDelay(float delay, bool flag)
			{
				yield return (object)new WaitForSeconds(delay);
				if ((Object)(object)enemyRb != (Object)null)
				{
					enemyRb.isKinematic = true;
					if (flag)
					{
						Object.Destroy((Object)(object)enemyRb);
					}
				}
				((Behaviour)enemy.agent).enabled = true;
			}
		}
	}
	public static class GameObjectExtensions
	{
		public static StatusEffectController StatusEffectController(this GameObject gameObject)
		{
			StatusEffectController statusEffectController = default(StatusEffectController);
			return gameObject.TryGetComponent<StatusEffectController>(ref statusEffectController) ? statusEffectController : gameObject.AddComponent<StatusEffectController>();
		}

		public static bool TryGetComponentInChildren<T>(this GameObject go, out T? component) where T : Component
		{
			component = go.GetComponentInChildren<T>();
			return (Object)(object)component != (Object)null;
		}
	}
	public static class GrabbableObjectExtensions
	{
		public static void GetItemMeshes(this GrabbableObject grabbableObject, out MeshRenderer[] meshRenderers, out SkinnedMeshRenderer[] skinnedMeshRenderers, bool includeDoNotSet = false, bool includeInteractTriggers = false)
		{
			meshRenderers = (from x in ((Component)grabbableObject).GetComponentsInChildren<MeshRenderer>()
				where includeDoNotSet || !((Component)x).CompareTag("DoNotSet")
				where includeInteractTriggers || !((Component)x).CompareTag("InteractTrigger")
				select x).ToArray();
			skinnedMeshRenderers = (from x in ((Component)grabbableObject).GetComponentsInChildren<SkinnedMeshRenderer>()
				where includeDoNotSet || !((Component)x).CompareTag("DoNotSet")
				where includeInteractTriggers || !((Component)x).CompareTag("InteractTrigger")
				select x).ToArray();
		}

		public static void DoActionAfterSpawn(this GrabbableObject grabbableObject, Action<GrabbableObject> actionAfterSpawn)
		{
			((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(doActionAfterSpawn(grabbableObject, actionAfterSpawn));
			static IEnumerator doActionAfterSpawn(GrabbableObject val, Action<GrabbableObject> action)
			{
				yield return null;
				yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)((NetworkBehaviour)val).NetworkObject != (Object)null && ((NetworkBehaviour)val).NetworkObject.IsSpawned));
				action(val);
			}
		}
	}
	public static class IEnumerableExtensions
	{
		public static T GetRandom<T>(this IEnumerable<T> source, Random random)
		{
			if (source is IList<T> list)
			{
				return list[random.Next(list.Count)];
			}
			T[] array = (source as T[]) ?? source.ToArray();
			return array[random.Next(array.Length)];
		}

		public static T GetRandom<T>(this IEnumerable<T> source)
		{
			if (source is IList<T> list)
			{
				return list[Random.Range(0, list.Count)];
			}
			T[] array = (source as T[]) ?? source.ToArray();
			return array[Random.Range(0, array.Length)];
		}

		public static T? GetClosestToPosition<T>(this IEnumerable<T> list, Vector3 position, Func<T, Vector3> positionSelector, out float closestDistance, bool fastDistanceCheck = false, IEnumerable<T>? excluded = null) where T : class
		{
			//IL_0048: 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)
			T result = null;
			closestDistance = float.PositiveInfinity;
			if (excluded == null)
			{
				excluded = Array.Empty<T>();
			}
			foreach (T item in list)
			{
				if (item != null && !excluded.Contains(item))
				{
					float num = Utils.SmartDistance(position, positionSelector(item), fastDistanceCheck);
					if (!(num >= closestDistance))
					{
						result = item;
						closestDistance = num;
					}
				}
			}
			return result;
		}

		public static T? GetClosestToPosition<T>(this IEnumerable<T> list, Vector3 position, Func<T, Vector3> positionSelector, bool fastDistanceCheck = false, IEnumerable<T>? excluded = null) where T : class
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			T result = null;
			float num = float.PositiveInfinity;
			if (excluded == null)
			{
				excluded = Array.Empty<T>();
			}
			foreach (T item in list)
			{
				if (item != null && !excluded.Contains(item))
				{
					float num2 = Utils.SmartDistance(position, positionSelector(item), fastDistanceCheck);
					if (!(num2 >= num))
					{
						result = item;
						num = num2;
					}
				}
			}
			return result;
		}

		public static T? GetFarthestFromPosition<T>(this IEnumerable<T> list, Vector3 position, Func<T, Vector3> positionSelector, out float farthestDistance, bool fastDistanceCheck = false, IEnumerable<T>? excluded = null) where T : class
		{
			//IL_0048: 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)
			T result = null;
			farthestDistance = 0f;
			if (excluded == null)
			{
				excluded = Array.Empty<T>();
			}
			foreach (T item in list)
			{
				if (item != null && !excluded.Contains(item))
				{
					float num = Utils.SmartDistance(position, positionSelector(item), fastDistanceCheck);
					if (!(num <= farthestDistance))
					{
						result = item;
						farthestDistance = num;
					}
				}
			}
			return result;
		}

		public static T? GetFarthestFromPosition<T>(this IEnumerable<T> list, Vector3 position, Func<T, Vector3> positionSelector, bool fastDistanceCheck = false, IEnumerable<T>? excluded = null) where T : class
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			T result = null;
			float num = 0f;
			if (excluded == null)
			{
				excluded = Array.Empty<T>();
			}
			foreach (T item in list)
			{
				if (item != null && !excluded.Contains(item))
				{
					float num2 = Utils.SmartDistance(position, positionSelector(item), fastDistanceCheck);
					if (!(num2 <= num))
					{
						result = item;
						num = num2;
					}
				}
			}
			return result;
		}

		public static IEnumerable<T> GetInRange<T>(this IEnumerable<T> list, Vector3 position, Func<T, Vector3> positionSelector, float range, IEnumerable<T>? excluded = null) where T : class
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			List<T> list2 = new List<T>();
			if (excluded == null)
			{
				excluded = Array.Empty<T>();
			}
			foreach (T item in list)
			{
				if (item != null && !excluded.Contains(item) && Vector3.Distance(position, positionSelector(item)) < range)
				{
					list2.Add(item);
				}
			}
			return list2;
		}

		public static Vector3 GetCenter(this IEnumerable<Vector3> positions)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			int num = 0;
			foreach (Vector3 position in positions)
			{
				val += position;
				num++;
			}
			return (num > 0) ? (val / (float)num) : Vector3.zero;
		}

		public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random random)
		{
			List<T> list = source.ToList();
			for (int num = list.Count() - 1; num > 0; num--)
			{
				int num2 = random.Next(num + 1);
				List<T> list2 = list;
				int index = num;
				int index2 = num2;
				T value = list[num2];
				T value2 = list[num];
				list2[index] = value;
				list[index2] = value2;
			}
			return list;
		}

		public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source)
		{
			List<T> list = source.ToList();
			for (int num = list.Count() - 1; num > 0; num--)
			{
				int num2 = Random.Range(0, num + 1);
				List<T> list2 = list;
				int index = num;
				int index2 = num2;
				T value = list[num2];
				T value2 = list[num];
				list2[index] = value;
				list[index2] = value2;
			}
			return list;
		}

		public static IEnumerable<T> OrderByDistance<T>(this IEnumerable<T> list, Vector3 position, Func<T, Vector3> positionSelector)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return list.OrderBy((T x) => Vector3.Distance(position, positionSelector(x)));
		}
	}
	public static class IListExtensions
	{
		public static IList<T> Shuffle<T>(this IList<T> list)
		{
			for (int num = list.Count - 1; num > 0; num--)
			{
				int num2 = Random.Range(0, num + 1);
				int index = num;
				int index2 = num2;
				T value = list[num2];
				T value2 = list[num];
				list[index] = value;
				list[index2] = value2;
			}
			return list;
		}

		public static IList<T> Shuffle<T>(this IList<T> list, Random random)
		{
			for (int num = list.Count - 1; num > 0; num--)
			{
				int num2 = random.Next(num + 1);
				int index = num;
				int index2 = num2;
				T value = list[num2];
				T value2 = list[num];
				list[index] = value;
				list[index2] = value2;
			}
			return list;
		}

		public static IList<T> OrderByDistance<T>(this IList<T> list, Vector3 position, Func<T, Vector3> positionSelector)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return list.OrderBy((T x) => Vector3.Distance(position, positionSelector(x))).ToList();
		}
	}
	public static class NetworkBehaviourExtensions
	{
		public static void DoActionAfterSpawn(this NetworkBehaviour networkBehaviour, Action<NetworkBehaviour> actionAfterSpawn)
		{
			((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(doActionAfterSpawn(networkBehaviour, actionAfterSpawn));
			static IEnumerator doActionAfterSpawn(NetworkBehaviour val, Action<NetworkBehaviour> action)
			{
				yield return null;
				yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)val.NetworkObject != (Object)null && val.NetworkObject.IsSpawned));
				action(val);
			}
		}
	}
	public static class NetworkObjectExtensions
	{
		public static void InvokeAfterSpawn(this NetworkObject networkObject, Action<NetworkObject> actionAfterSpawn, float maxWaitTime = 10f)
		{
			((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(invokeAfterSpawn());
			IEnumerator invokeAfterSpawn()
			{
				float elapsedTime = 0f;
				while ((Object)(object)networkObject != (Object)null && !networkObject.IsSpawned)
				{
					if (elapsedTime >= maxWaitTime)
					{
						yield break;
					}
					elapsedTime += Time.deltaTime;
					yield return null;
				}
				if ((Object)(object)networkObject != (Object)null && networkObject.IsSpawned)
				{
					actionAfterSpawn(networkObject);
				}
			}
		}

		public static void Spawn(this NetworkObject networkObject, bool destroyWithScene = false, Action<NetworkObject>? actionAfterSpawn = null, float maxWaitTime = 10f)
		{
			networkObject.Spawn(destroyWithScene);
			if (actionAfterSpawn != null)
			{
				networkObject.InvokeAfterSpawn(actionAfterSpawn, maxWaitTime);
			}
		}

		public static void Despawn(this NetworkObject networkObject, bool destroy = true, float despawnTime = 0f)
		{
			if (despawnTime <= 0f)
			{
				networkObject.Despawn(destroy);
			}
			else
			{
				((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(despawn(networkObject, destroy, despawnTime));
			}
			static IEnumerator despawn(NetworkObject val, bool flag, float num)
			{
				yield return (object)new WaitForSeconds(num);
				if ((Object)(object)val != (Object)null && val.IsSpawned)
				{
					val.Despawn(flag);
				}
			}
		}
	}
	public static class ObjectExtensions
	{
		public static void InvokeWhenNotNull(this Func<object?> getObject, Action<object> action, float maxWaitTime = 10f)
		{
			((MonoBehaviour)NetworkHandler.Instance).StartCoroutine(invokeWhenNotNull());
			IEnumerator invokeWhenNotNull()
			{
				float elapsedTime = 0f;
				object obj;
				while (true)
				{
					object obj2;
					obj = (obj2 = getObject());
					if (obj2 != null)
					{
						break;
					}
					elapsedTime += Time.deltaTime;
					if (elapsedTime > maxWaitTime)
					{
						yield break;
					}
					yield return null;
				}
				try
				{
					action(obj);
				}
				catch (Exception ex)
				{
					Exception e = ex;
					Plugin.logger.LogError((object)e);
				}
			}
		}
	}
	public static class PlayerControllerBExtensions
	{
		public static StatusEffectController StatusEffectController(this PlayerControllerB player)
		{
			StatusEffectController statusEffectController = default(StatusEffectController);
			return ((Component)player).gameObject.TryGetComponent<StatusEffectController>(ref statusEffectController) ? statusEffectController : ((Component)player).gameObject.AddComponent<StatusEffectController>();
		}

		public static bool GrabGrabbableObject(this PlayerControllerB player, GrabbableObject grabbableObject)
		{
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			if (player.twoHanded || player.sinkingValue > 0.73f)
			{
				return false;
			}
			player.currentlyGrabbingObject = grabbableObject;
			if (!GameNetworkManager.Instance.gameHasStarted && !player.currentlyGrabbingObject.itemProperties.canBeGrabbedBeforeGameStart && (Object)(object)StartOfRound.Instance.testRoom == (Object)null)
			{
				return false;
			}
			player.grabInvalidated = false;
			if ((Object)(object)player.currentlyGrabbingObject == (Object)null || player.inSpecialInteractAnimation || player.currentlyGrabbingObject.isHeld || player.currentlyGrabbingObject.isPocketed)
			{
				return false;
			}
			NetworkObject networkObject = ((NetworkBehaviour)player.currentlyGrabbingObject).NetworkObject;
			if ((Object)(object)networkObject == (Object)null || !networkObject.IsSpawned)
			{
				return false;
			}
			player.currentlyGrabbingObject.InteractItem();
			if (!player.currentlyGrabbingObject.grabbable || player.FirstEmptyItemSlot(player.currentlyGrabbingObject) == -1)
			{
				return false;
			}
			player.playerBodyAnimator.SetBool("GrabInvalidated", false);
			player.playerBodyAnimator.SetBool("GrabValidated", false);
			player.playerBodyAnimator.SetBool("cancelHolding", false);
			player.playerBodyAnimator.ResetTrigger("Throw");
			player.SetSpecialGrabAnimationBool(true, (GrabbableObject)null);
			player.isGrabbingObjectAnimation = true;
			((Behaviour)player.cursorIcon).enabled = false;
			((TMP_Text)player.cursorTip).text = "";
			player.twoHanded = player.currentlyGrabbingObject.itemProperties.twoHanded;
			player.carryWeight = Mathf.Clamp(player.carryWeight + (player.currentlyGrabbingObject.itemProperties.weight - 1f), 1f, 10f);
			StartOfRound.Instance.SendChangedWeightEvent();
			if (player.currentlyGrabbingObject.itemProperties.grabAnimationTime > 0f)
			{
				player.grabObjectAnimationTime = player.currentlyGrabbingObject.itemProperties.grabAnimationTime;
			}
			else
			{
				player.grabObjectAnimationTime = 0.4f;
			}
			if (!player.isTestingPlayer)
			{
				player.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(networkObject));
			}
			if (player.grabObjectCoroutine != null)
			{
				((MonoBehaviour)player).StopCoroutine(player.grabObjectCoroutine);
			}
			player.grabObjectCoroutine = ((MonoBehaviour)player).StartCoroutine(player.GrabObject());
			return true;
		}

		public static void FreezePlayer(this PlayerControllerB player, bool value)
		{
			Utils.localPlayerFrozen = value;
			player.disableInteract = value;
			player.disableLookInput = value;
			player.disableMoveInput = value;
		}

		public static void MakePlayerInvisible(this PlayerControllerB player, bool value)
		{
			GameObject gameObject = ((Component)((Component)player).gameObject.transform.Find("ScavengerModel")).gameObject;
			if ((Object)(object)gameObject == (Object)null)
			{
				Plugin.logger.LogError((object)"ScavengerModel not found");
				return;
			}
			((Component)gameObject.transform.Find("LOD1")).gameObject.SetActive(!value);
			((Component)gameObject.transform.Find("LOD2")).gameObject.SetActive(!value);
			((Component)gameObject.transform.Find("LOD3")).gameObject.SetActive(!value);
			((Component)gameObject.transform.Find("metarig/spine/spine.001/spine.002/spine.003/LevelSticker")).gameObject.SetActive(!value);
			((Component)gameObject.transform.Find("metarig/spine/spine.001/spine.002/spine.003/BetaBadge")).gameObject.SetActive(!value);
			((Component)player.playerBadgeMesh).gameObject.SetActive(!value);
		}

		public static void RebuildRig(this PlayerControllerB player)
		{
			if ((Object)(object)player != (Object)null && (Object)(object)player.playerBodyAnimator != (Object)null)
			{
				player.playerBodyAnimator.WriteDefaultValues();
				RigBuilder component = ((Component)player.playerBodyAnimator).GetComponent<RigBuilder>();
				if (component != null)
				{
					component.Build();
				}
			}
		}

		public static void MufflePlayer(this PlayerControllerB player, bool muffle)
		{
			if ((Object)(object)player.currentVoiceChatAudioSource == (Object)null)
			{
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
			if ((Object)(object)player.currentVoiceChatAudioSource != (Object)null)
			{
				((Component)player.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = (muffle ? 5f : 1f);
				OccludeAudio component = ((Component)player.currentVoiceChatAudioSource).GetComponent<OccludeAudio>();
				component.overridingLowPass = muffle;
				component.lowPassOverride = (muffle ? 500f : 20000f);
				player.voiceMuffledByEnemy = muffle;
			}
		}

		public static bool IsPlayerSpeaking(this PlayerControllerB player, float amplitudeThreshold = 0.005f, bool useRelativeAmplitude = true)
		{
			VoicePlayerState voicePlayerState = player.GetVoicePlayerState();
			if (voicePlayerState == null)
			{
				return false;
			}
			return voicePlayerState.IsSpeaking && player.GetPlayerVoiceAmplitude(useRelativeAmplitude) > amplitudeThreshold;
		}

		public static bool IsPlayerMuted(this PlayerControllerB player)
		{
			VoicePlayerState voicePlayerState = player.GetVoicePlayerState();
			return voicePlayerState == null || !voicePlayerState.IsConnected;
		}

		public static float GetPlayerVoiceAmplitude(this PlayerControllerB player, bool getRelativeAmplitude = false)
		{
			VoicePlayerState voicePlayerState = player.GetVoicePlayerState();
			if (voicePlayerState == null || !voicePlayerState.IsConnected)
			{
				return 0f;
			}
			return getRelativeAmplitude ? (voicePlayerState.Amplitude / Mathf.Clamp(StartOfRound.Instance.averageVoiceAmplitude, 0.008f, 0.5f)) : voicePlayerState.Amplitude;
		}

		public static VoicePlayerState? GetVoicePlayerState(this PlayerControllerB player)
		{
			VoicePlayerState val = player.voicePlayerState;
			if (PlayerControllerBExtensions.IsLocalPlayer(player) && !string.IsNullOrEmpty(StartOfRound.Instance.voiceChatModule.LocalPlayerName))
			{
				val = StartOfRound.Instance.voiceChatModule.FindPlayer(StartOfRound.Instance.voiceChatModule.LocalPlayerName);
			}
			if (val == null)
			{
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
			if (val == null)
			{
				val = player.voicePlayerState;
			}
			return val;
		}

		public static void DiscardItemInSlotAndSync(this PlayerControllerB player, int slot, bool placeObject = false, NetworkObject? parentObjectTo = null, Vector3 placePosition = default(Vector3), bool matchRotationOfParent = true, bool setInShip = false, bool setInElevator = false, Vector3 syncedPlayerPosition = default(Vector3), Vector3 syncedHeldObjectPosition = default(Vector3), Vector3 syncedHeldObjectRotation = default(Vector3), Vector3 syncedPlayerCamPosition = default(Vector3), Vector3 syncedPlayerCamRotation = default(Vector3))
		{
			//IL_0049: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)parentObjectTo != (Object)null)
			{
				NetworkHandler.Instance.DiscardItemInSlotRpc(player.actualClientId, slot, NetworkObjectReference.op_Implicit(parentObjectTo), placeObject, placePosition, matchRotationOfParent, setInShip, setInElevator, syncedPlayerPosition, syncedHeldObjectPosition, syncedHeldObjectRotation, syncedPlayerCamPosition, syncedPlayerCamRotation);
			}
			else
			{
				NetworkHandler.Instance.DiscardItemInSlotRpc(player.actualClientId, slot, placeObject, placePosition, matchRotationOfParent, setInShip, setInElevator, syncedPlayerPosition, syncedHeldObjectPosition, syncedHeldObjectRotation, syncedPlayerCamPosition, syncedPlayerCamRotation);
			}
		}

		public static void DiscardItemInSlot(this PlayerControllerB player, int slot, bool placeObject = false, NetworkObject? parentObjectTo = null, Vector3 placePosition = default(Vector3), bool matchRotationOfParent = true, bool setInShip = false, bool setInElevator = false, Vector3 syncedPlayerPosition = default(Vector3), Vector3 syncedHeldObjectPosition = default(Vector3), Vector3 syncedHeldObjectRotation = default(Vector3), Vector3 syncedPlayerCamPosition = default(Vector3), Vector3 syncedPlayerCamRotation = default(Vector3))
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (player.currentItemSlot == slot)
			{
				player.DiscardHeldObject(placeObject, parentObjectTo, placePosition, matchRotationOfParent);
				return;
			}
			GrabbableObject val = player.ItemSlots[slot];
			if (!((Object)(object)val == (Object)null))
			{
				player.DropHeldItem(val, true, false, syncedPlayerPosition, syncedHeldObjectPosition, syncedHeldObjectRotation, syncedPlayerCamPosition, syncedPlayerCamRotation, setInShip, setInElevator);
				if (((NetworkBehaviour)player).IsOwner)
				{
					((Behaviour)HUDManager.Instance.itemSlotIcons[slot]).enabled = false;
					player.ItemSlots[slot] = null;
				}
			}
		}

		public static bool IsPlayerWithinShipBounds(this PlayerControllerB player)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			int sceneCount = SceneManager.sceneCount;
			Scene[] array = (Scene[])(object)new Scene[sceneCount];
			int num = 0;
			for (int i = 0; i < sceneCount; i++)
			{
				array[i] = SceneManager.GetSceneAt(i);
				if (((Scene)(ref array[i])).name == "CompanyBuilding")
				{
					num++;
				}
			}
			if (num == 1)
			{
				return true;
			}
			if (GameNetworkManager.Instance.localPlayerController.isPlayerDead)
			{
				return false;
			}
			Bounds bounds = StartOfRound.Instance.shipBounds.bounds;
			return ((Bounds)(ref bounds)).Contains(((Component)player).transform.position);
		}

		public static void SpawnAndGrabItem(this PlayerControllerB player, NamespacedKey<DawnItemInfo> key)
		{
			NetworkHandler.Instance.SpawnAndGrabItemRpc(player.actualClientId, key);
		}

		public static void HealPlayer(this PlayerControllerB player, int healAmount, bool allowOverhealing = false)
		{
			player.health = (allowOverhealing ? (player.health + healAmount) : Mathf.Clamp(player.health + healAmount, 0, 100));
			if ((Object)(object)Plugin.localPlayer == (Object)(object)player)
			{
				HUDManager.Instance.UpdateHealthUI(player.health, false);
			}
		}

		public static void HealPlayerAndSync(this PlayerControllerB player, int healAmount, bool allowOverhealing = false)
		{
			NetworkHandler.Instance.HealPlayerRpc(player.actualClientId, healAmount, allowOverhealing);
		}

		public static int GetCurrentEmote(this PlayerControllerB player)
		{
			if (!player.performingEmote)
			{
				return 0;
			}
			return player.playerBodyAnimator.GetInteger("emoteNumber");
		}

		public static void AddForce(this PlayerControllerB player, Vector3 direction, float force)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			player.playerRigidbody.isKinematic = false;
			player.playerRigidbody.velocity = Vector3.zero;
			player.externalForceAutoFade += direction * force;
			player.playerRigidbody.isKinematic = true;
		}

		public static void ChangePlayerSize(this PlayerControllerB player, float size, bool hideScavengerHelmet = false)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			player.thisPlayerBody.localScale = new Vector3(size, size, size);
			player.RebuildRig();
			if (hideScavengerHelmet && (Object)(object)Plugin.localPlayer == (Object)(object)player)
			{
				if (size < 1f && ((Component)Plugin.localPlayer.localVisor).gameObject.activeSelf)
				{
					((Component)Plugin.localPlayer.localVisor).gameObject.SetActive(false);
				}
				else if (size >= 1f && !((Component)Plugin.localPlayer.localVisor).gameObject.activeSelf)
				{
					((Component)Plugin.localPlayer.localVisor).gameObject.SetActive(true);
				}
			}
		}

		public static void ChangePlayerSizeAndSync(this PlayerControllerB player, float size, bool hideScavengerHelmet = false)
		{
			NetworkHandler.Instance.ChangePlayerSizeRpc(player.actualClientId, size, hideScavengerHelmet);
		}

		public static void TeleportPlayerSynced(this PlayerControllerB player, Vector3 pos, bool withRotation = false, float rot = 0f, bool allowInteractTrigger = false, bool enableController = true)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			NetworkHandler.Instance.TeleportPlayerRpc(player.actualClientId, pos, withRotation, rot, allowInteractTrigger, enableController);
		}

		public static void TeleportPlayerSynced(this PlayerControllerB player, Vector3 pos, bool isInsideFactory, bool withRotation = false, float rot = 0f, bool allowInteractTrigger = false, bool enableController = true)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			NetworkHandler.Instance.TeleportPlayerRpc(player.actualClientId, pos, isInsideFactory, withRotation, rot, allowInteractTrigger, enableController);
		}
	}
	public static class SmartAgentNavigatorExtensions
	{
		public static bool SmartCanPathToPoint(this SmartAgentNavigator nav, Vector3 pos)
		{
			//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)
			return Utils.SmartCanPathToPoint(((Component)nav.agent).transform.position, pos, nav.IsAgentOutside());
		}

		public static bool SmartCanPathToPoint(this SmartAgentNavigator nav, Vector3 startPos, Vector3 endPos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return Utils.SmartCanPathToPoint(startPos, endPos, nav.IsAgentOutside());
		}

		public static bool CanPathToPoint(this SmartAgentNavigator nav, Vector3 pos)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return nav.CanPathToPoint(((Component)nav.agent).transform.position, pos) > 0f;
		}
	}
	public static class StringExtensions
	{
		public static string AddSpacesToPascalCase(this string input)
		{
			return Regex.Replace(input, "(?<!^)([A-Z])", " $1");
		}
	}
	public static class Vector3Extensions
	{
		public static Vector3 GetFloorPosition(this Vector3 position, float verticalOffset = 0f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(position, -Vector3.up, ref val, 80f, 268437761, (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref val)).point + Vector3.up * 0.04f + verticalOffset * Vector3.up;
			}
			return position;
		}

		public static T? GetClosestGameObjectOfType<T>(this Vector3 position) where T : Component
		{
			//IL_0028: 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)
			T[] array = Object.FindObjectsOfType<T>();
			T result = default(T);
			float num = float.PositiveInfinity;
			T[] array2 = array;
			foreach (T val in array2)
			{
				float num2 = Vector3.Distance(position, ((Component)val).transform.position);
				if (num2 < num)
				{
					num = num2;
					result = val;
				}
			}
			return result;
		}

		public static PlayerControllerB[] GetNearbyPlayers(this Vector3 position, float distance = 10f, List<PlayerControllerB>? ignoredPlayers = null)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && (ignoredPlayers == null || !ignoredPlayers.Contains(val)) && !(Vector3.Distance(position, ((Component)val).transform.position) > distance))
				{
					list.Add(val);
				}
			}
			return list.ToArray();
		}

		public static bool IsOutside(this Vector3 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return position.y > -80f;
		}
	}
	public abstract class GrabbableEnemy : GrabbableObject
	{
		public GrabbableEnemyAI ai = null;

		[HideInInspector]
		public PlayerControllerB previousPlayerHeldBy = null;

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			ai.PickUpGrabbableEnemyLocalClient();
			previousPlayerHeldBy = base.playerHeldBy;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void DropGrabbableEnemyRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			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(2295089515u, val3, val, (SendTo)5, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 2295089515u, val3, val, (SendTo)5, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					ai.DropGrabbableEnemyLocalClient();
				}
			}
		}

		public override void FallWithCurve()
		{
			if (((EnemyAI)ai).inSpecialAnimation)
			{
				((GrabbableObject)this).FallWithCurve();
			}
		}

		public override void Start()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be