Decompiled source of PhysicsAPI v1.0.0

comicalteam.ComicalCompany.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ComicalCompany.Configuration;
using ComicalCompany.Patches;
using ComicalCompany.Utils;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.AI.Navigation;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using comicalteam.ComicalCompany.NetcodePatcher;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[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.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("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("comicalteam.ComicalCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ComicalCompany")]
[assembly: AssemblyTitle("comicalteam.ComicalCompany")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ComicalCompany
{
	[BepInPlugin("comicalteam.ComicalCompany", "ComicalCompany", "1.0.0")]
	public class ComicalCompany : BaseUnityPlugin
	{
		public static AssetBundle? assetBundle;

		public static GameObject ventPrefab;

		private bool prefabRegistered = false;

		public static GameObject lollipopPrefab;

		public static GameObject hatPrefab;

		public static ComicalCompany Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		internal static ComicalCompanyConfig BoundConfig { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			BoundConfig = new ComicalCompanyConfig(((BaseUnityPlugin)this).Config);
			Patch();
			Logger.LogInfo((object)"comicalteam.ComicalCompany v1.0.0 has loaded!");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			assetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "physicsapi"));
			if ((Object)(object)assetBundle == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			lollipopPrefab = assetBundle.LoadAsset<GameObject>("assets/LethalCompany/Custom/lollipop.prefab");
			hatPrefab = assetBundle.LoadAsset<GameObject>("assets/LethalCompany/Custom/hat.prefab");
			ventPrefab = assetBundle.LoadAsset<GameObject>("assets/LethalCompany/Custom/vent.prefab");
			SceneManager.sceneLoaded += OnSceneLoaded;
			NetcodePatcher();
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (!prefabRegistered && (Object)(object)NetworkManager.Singleton != (Object)null && (Object)(object)ventPrefab != (Object)null)
			{
				NetworkManager.Singleton.AddNetworkPrefab(ventPrefab);
				prefabRegistered = true;
			}
		}

		private static void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		internal static void Patch()
		{
			//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)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("comicalteam.ComicalCompany");
			}
			Logger.LogDebug((object)"Patching...");
			if ((DateTime.UtcNow.Month == 4 && DateTime.UtcNow.Day == 1) || (DateTime.UtcNow.Month == 3 && DateTime.UtcNow.Day == 31) || (DateTime.UtcNow.Month == 4 && DateTime.UtcNow.Day == 2) || BoundConfig.alwaysEnableMod.Value)
			{
				Harmony.CreateClassProcessor(typeof(NetworkingPatch)).Patch();
				Harmony.CreateClassProcessor(typeof(StartOfRoundPatch)).Patch();
				Harmony.CreateClassProcessor(typeof(RoundManagerPatch)).Patch();
				if (BoundConfig.enableSwitchPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(SwitchPatch)).Patch();
				}
				if (BoundConfig.enableTeleporterPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(TeleporterPatch)).Patch();
				}
				if (BoundConfig.enableApparatusPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(ApparatusPatch)).Patch();
				}
				if (BoundConfig.enableBoomBoxPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(BoomBoxPatch)).Patch();
				}
				if (BoundConfig.enableCoilheadPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(CoilheadPatch)).Patch();
				}
				if (BoundConfig.enableEnemySizePatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(EnemySizePatch)).Patch();
				}
				if (BoundConfig.enableFallDamagePatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(FallDamagePatch)).Patch();
				}
				if (BoundConfig.enableGovernmentPropertyPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(GovernmentPropertyPatch)).Patch();
				}
				if (BoundConfig.enableGreenModePatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(GreenModePatch)).Patch();
				}
				if (BoundConfig.enableItemChargerPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(ItemChargerPatch)).Patch();
				}
				if (BoundConfig.enableItemNamePatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(ItemNamePatch)).Patch();
				}
				if (BoundConfig.enableJesterInfestation.Value)
				{
					Harmony.CreateClassProcessor(typeof(JesterInfestation)).Patch();
				}
				if (BoundConfig.enableJumpPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(JumpPatch)).Patch();
				}
				if (BoundConfig.enableLadderPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(LadderPatch)).Patch();
				}
				if (BoundConfig.enableLandminePatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(LandminePatch)).Patch();
				}
				if (BoundConfig.enableOrbitDoorPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(OrbitDoorPatch)).Patch();
				}
				if (BoundConfig.enableQuicksandPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(QuicksandPatch)).Patch();
				}
				if (BoundConfig.enableTZPPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(TZPPatch)).Patch();
				}
				if (BoundConfig.enableVentPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(VentPatch)).Patch();
				}
				if (BoundConfig.enablePropsPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(PropsPatch)).Patch();
				}
				if (BoundConfig.enableInspirationPatch.Value)
				{
					Harmony.CreateClassProcessor(typeof(InspirationPatch)).Patch();
				}
			}
			Logger.LogInfo((object)"Patched methods:");
			foreach (MethodBase patchedMethod in Harmony.GetPatchedMethods())
			{
				Logger.LogInfo((object)GeneralExtensions.FullDescription(patchedMethod));
			}
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "comicalteam.ComicalCompany";

		public const string PLUGIN_NAME = "ComicalCompany";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ComicalCompany.Utils
{
	public class ComicalNetworking : NetworkBehaviour
	{
		public static ComicalNetworking? Instance;

		public override void OnNetworkSpawn()
		{
			Instance = this;
			ComicalCompany.Logger.LogInfo((object)"ComicalNetworking awakened!");
			((NetworkBehaviour)this).OnNetworkSpawn();
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnLandmineServerRpc(Vector3 position, bool spawnExplosionEffect, float killRange, float damageRange, int nonLethalDamage, float physicsForce)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3784662291u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref spawnExplosionEffect, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref killRange, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref damageRange, default(ForPrimitives));
					BytePacker.WriteValueBitPacked(val2, nonLethalDamage);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref physicsForce, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3784662291u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SpawnLandmineClientRpc(position, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce);
				}
			}
		}

		[ClientRpc]
		public void SpawnLandmineClientRpc(Vector3 position, bool spawnExplosionEffect, float killRange, float damageRange, int nonLethalDamage, float physicsForce)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1802435030u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref spawnExplosionEffect, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref killRange, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref damageRange, default(ForPrimitives));
					BytePacker.WriteValueBitPacked(val2, nonLethalDamage);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref physicsForce, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1802435030u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Landmine.SpawnExplosion(position, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, (GameObject)null, false);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ChargeItemServerRPC()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2050317958u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2050317958u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ChargeItemClientRPC();
				}
			}
		}

		[ClientRpc]
		public void ChargeItemClientRPC()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3764226617u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3764226617u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					ItemCharger val3 = Object.FindObjectOfType<ItemCharger>();
					((MonoBehaviour)val3).StartCoroutine(ItemChargerPatch.explosionRoutine(val3));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnEasterEggExplosionServerRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3045273105u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3045273105u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SpawnEasterEggExplosionClientRpc(position);
				}
			}
		}

		[ClientRpc]
		public void SpawnEasterEggExplosionClientRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2073405064u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2073405064u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			GameObject val3 = StartOfRound.Instance.allItemsList.itemsList.Find((Item item) => item.itemName.ToLower().Contains("easter") || item.itemName.ToLower().Contains("spheroid"))?.spawnPrefab;
			if ((Object)(object)val3 == (Object)null)
			{
				ComicalCompany.Logger.LogWarning((object)"Egg not found in allItemsList!");
				return;
			}
			StunGrenadeItem component = Object.Instantiate<GameObject>(val3, position, Quaternion.identity).GetComponent<StunGrenadeItem>();
			component.explodeOnThrow = true;
			component.explodeOnCollision = true;
			component.chanceToExplode = 100f;
			component.DestroyGrenade = true;
			if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost)
			{
				((Component)component).GetComponent<NetworkObject>().Spawn(false);
			}
			component.ExplodeStunGrenade(false);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ComicalNetworking()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3784662291u, new RpcReceiveHandler(__rpc_handler_3784662291));
			NetworkManager.__rpc_func_table.Add(1802435030u, new RpcReceiveHandler(__rpc_handler_1802435030));
			NetworkManager.__rpc_func_table.Add(2050317958u, new RpcReceiveHandler(__rpc_handler_2050317958));
			NetworkManager.__rpc_func_table.Add(3764226617u, new RpcReceiveHandler(__rpc_handler_3764226617));
			NetworkManager.__rpc_func_table.Add(3045273105u, new RpcReceiveHandler(__rpc_handler_3045273105));
			NetworkManager.__rpc_func_table.Add(2073405064u, new RpcReceiveHandler(__rpc_handler_2073405064));
		}

		private static void __rpc_handler_3784662291(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0081: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				bool spawnExplosionEffect = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref spawnExplosionEffect, default(ForPrimitives));
				float killRange = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref killRange, default(ForPrimitives));
				float damageRange = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref damageRange, default(ForPrimitives));
				int nonLethalDamage = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref nonLethalDamage);
				float physicsForce = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref physicsForce, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ComicalNetworking)(object)target).SpawnLandmineServerRpc(position, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1802435030(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0081: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				bool spawnExplosionEffect = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref spawnExplosionEffect, default(ForPrimitives));
				float killRange = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref killRange, default(ForPrimitives));
				float damageRange = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref damageRange, default(ForPrimitives));
				int nonLethalDamage = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref nonLethalDamage);
				float physicsForce = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref physicsForce, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ComicalNetworking)(object)target).SpawnLandmineClientRpc(position, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2050317958(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;
				((ComicalNetworking)(object)target).ChargeItemServerRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3764226617(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)2;
				((ComicalNetworking)(object)target).ChargeItemClientRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3045273105(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ComicalNetworking)(object)target).SpawnEasterEggExplosionServerRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2073405064(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ComicalNetworking)(object)target).SpawnEasterEggExplosionClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ComicalNetworking";
		}
	}
	public class Utils
	{
		public static List<EnemyType> allEnemyTypes;

		public static void DestroyGameObject(GameObject gameObject)
		{
			Object.Destroy((Object)(object)gameObject);
			MeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren<MeshRenderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.Destroy((Object)(object)componentsInChildren[i]);
			}
			Collider[] componentsInChildren2 = gameObject.GetComponentsInChildren<Collider>();
			for (int j = 0; j < componentsInChildren2.Length; j++)
			{
				Object.Destroy((Object)(object)componentsInChildren2[j]);
			}
		}
	}
}
namespace ComicalCompany.Patches
{
	[HarmonyPatch]
	public class ApparatusPatch
	{
		[HarmonyPatch(typeof(GrabbableObject), "OnHitGround")]
		[HarmonyPostfix]
		public static void OnHitGround(GrabbableObject __instance)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (!StartOfRound.Instance.inShipPhase && (((NetworkBehaviour)StartOfRound.Instance).IsHost || ((NetworkBehaviour)StartOfRound.Instance).IsServer) && ((NetworkBehaviour)__instance).__getTypeName() == "LungProp" && Random.value < 0.1f)
			{
				ComicalNetworking.Instance?.SpawnEasterEggExplosionServerRpc(((Component)__instance).transform.position);
				global::ComicalCompany.Utils.Utils.DestroyGameObject(((Component)__instance).gameObject);
			}
		}
	}
	[HarmonyPatch]
	public class BoomBoxPatch
	{
		public static GameObject? boomBoxItem;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(BoomboxItem), "ItemActivate")]
		public static void ItemActivate(BoomboxItem __instance)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (((GrabbableObject)__instance).isHeld && !StartOfRound.Instance.inShipPhase)
			{
				PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy;
				if (playerHeldBy != null)
				{
					playerHeldBy.DestroyItemInSlot(((GrabbableObject)__instance).playerHeldBy.currentItemSlot);
				}
				ComicalNetworking.Instance?.SpawnLandmineServerRpc(((Component)__instance).gameObject.transform.position, spawnExplosionEffect: true, 3f, 7f, 80, 20f);
			}
		}

		[HarmonyPriority(200)]
		[HarmonyPostfix]
		[HarmonyPatch(typeof(BoomboxItem), "Start")]
		public static void ItemStart(BoomboxItem __instance)
		{
			if (((object)__instance).GetType() == typeof(BoomboxItem))
			{
				((GrabbableObject)__instance).ItemActivate(true, true);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
		public static void SpawnBoomBox(RoundManager __instance)
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			if ((!((NetworkBehaviour)__instance).NetworkManager.IsServer && !((NetworkBehaviour)__instance).NetworkManager.IsHost) || !((double)Random.value < 0.15))
			{
				return;
			}
			if ((Object)(object)boomBoxItem == (Object)null)
			{
				Item val = StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName.Contains("box"));
				if ((Object)(object)val == (Object)null)
				{
					ComicalCompany.Logger.LogError((object)"Boombox item not found in allItemsList!");
					return;
				}
				boomBoxItem = val.spawnPrefab;
			}
			RandomScrapSpawn[] array = Object.FindObjectsOfType<RandomScrapSpawn>();
			Vector3 val2 = ((Component)array[Random.RandomRangeInt(0, array.Length)]).gameObject.transform.position + new Vector3(0f, 1f, 0f);
			GameObject val3 = Object.Instantiate<GameObject>(boomBoxItem, val2, Quaternion.identity, __instance.playersManager.propsContainer);
			val3.GetComponent<GrabbableObject>().fallTime = 0f;
			val3.GetComponent<NetworkObject>().Spawn(false);
		}
	}
	[HarmonyPatch]
	public class CoilheadPatch
	{
		public static float randomTimer = 0f;

		public static float randomval = 1f;

		public static Random random = new Random(1245678);

		public static MethodInfo checkRandomMethod = AccessTools.Method(typeof(CoilheadPatch), "CheckRandom", (Type[])null, (Type[])null);

		public static bool CheckRandom()
		{
			randomTimer += Time.deltaTime;
			if (randomTimer > 2f)
			{
				randomTimer = 0f;
				randomval = (float)random.NextDouble();
			}
			if (Random.value < 0.025f)
			{
				return false;
			}
			return true;
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(SpringManAI), "Update")]
		public static IEnumerable<CodeInstruction> Patch_Update(IEnumerable<CodeInstruction> instructions, ILGenerator il)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			int num = 0;
			Label label = il.DefineLabel();
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Stloc_3)
				{
					num++;
					switch (num)
					{
					case 1:
						list.Insert(i + 1, new CodeInstruction(OpCodes.Call, (object)checkRandomMethod));
						list.Insert(i + 2, new CodeInstruction(OpCodes.Brfalse_S, (object)label));
						continue;
					case 3:
						break;
					default:
						continue;
					}
					list[i - 5].labels.Add(label);
					break;
				}
			}
			return list;
		}
	}
	[HarmonyPatch]
	public class EnemySizePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(EnemyAI), "Start")]
		public static void Awake(EnemyAI __instance)
		{
			//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_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			if (((object)__instance).GetType() == typeof(ForestGiantAI))
			{
				((Component)__instance).transform.localScale = ((Component)__instance).transform.localScale / 4f;
				__instance.enemyType.enemyName = "Forest";
				__instance.agent.height = 1f;
				__instance.agent.radius = 0.5f;
				if ((Object)(object)ComicalCompany.lollipopPrefab != (Object)null && (Object)(object)ComicalCompany.hatPrefab != (Object)null)
				{
					Transform val = ((Component)((Component)__instance).gameObject.transform.Find("FGiantModelContainer")).transform.Find("AnimContainer");
					Transform val2 = ((Component)((Component)((Component)((Component)val).transform.Find("metarig")).transform.Find("spine")).transform.Find("spine.003")).transform.Find("shoulder.L");
					GameObject val3 = Object.Instantiate<GameObject>(ComicalCompany.hatPrefab, val2);
					val3.transform.localPosition = new Vector3(0.006f, -0.055f, 0.145f);
					val3.transform.localRotation = Quaternion.Euler(34f, -112.5f, -89f);
					Transform val4 = ((Component)((Component)((Component)val2).transform.Find("upper_arm.L")).transform.Find("forearm.L")).transform.Find("hand.L");
					GameObject val5 = Object.Instantiate<GameObject>(ComicalCompany.lollipopPrefab, val4);
					val5.transform.localPosition = new Vector3(-0.076f, 0.239f, -0.013f);
					val5.transform.localRotation = Quaternion.Euler(90f, 83.5f, 86f);
				}
			}
			else if (((object)__instance).GetType() == typeof(SandSpiderAI))
			{
				((Component)__instance).transform.localScale = ((Component)__instance).transform.localScale / 5f;
			}
			else if (((object)__instance).GetType() == typeof(RadMechAI))
			{
				((Component)__instance).transform.localScale = ((Component)__instance).transform.localScale / 5f;
				__instance.agent.height = 1f;
				__instance.agent.radius = 0.5f;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(SandSpiderWebTrap), "Awake")]
		public static void WebAwake(SandSpiderWebTrap __instance)
		{
			//IL_000d: 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)
			((Component)__instance).transform.localScale = ((Component)__instance).transform.localScale * 2f;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class FallDamagePatch
	{
		[HarmonyPatch("PlayerHitGroundEffects")]
		[HarmonyPrefix]
		public static void BeforeHitGround(ref float ___carryWeight, ref float ___fallValueUncapped, ref float ___fallValue, ref bool ___takingFallDamage)
		{
			___takingFallDamage = true;
			float num = 1f + 0.8f * (___carryWeight - 1f);
			if (___fallValueUncapped < -15f)
			{
				___fallValueUncapped *= num;
				___fallValue *= num;
			}
		}
	}
	[HarmonyPatch]
	public class GovernmentPropertyPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(DepositItemsDesk), "SellItemsOnServer")]
		public static void SellItemsOnServer(DepositItemsDesk __instance)
		{
			if (!((NetworkBehaviour)__instance).IsServer)
			{
				return;
			}
			for (int i = 0; i < __instance.itemsOnCounter.Count; i++)
			{
				if (__instance.itemsOnCounter[i].itemProperties.itemName.ToLower().Contains("government"))
				{
					__instance.itemsOnCounter[i].scrapValue = -__instance.itemsOnCounter[i].scrapValue;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(DepositItemsDesk), "delayedAcceptanceOfItems")]
		public static void delayedAcceptanceOfItems(GrabbableObject[] objectsOnDesk)
		{
			for (int i = 0; i < objectsOnDesk.Length; i++)
			{
				if (objectsOnDesk[i].itemProperties.itemName.ToLower().Contains("government"))
				{
					HUDManager.Instance.DisplayTip("Government property detected", "Fine deducted from credits", true, false, "LC_Tip1");
					break;
				}
			}
		}
	}
	[HarmonyPatch]
	public class GreenModePatch
	{
		private static float greenModePercentChance = 2f;

		[HarmonyPatch(typeof(StartOfRound), "StartGame")]
		[HarmonyPostfix]
		private static void StartGamePostfix()
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			if (!((float)Random.Range(0, 100) >= greenModePercentChance))
			{
				GameObject val = GameObject.Find("VolumeMain");
				Volume component = val.GetComponent<Volume>();
				ColorAdjustments val2 = default(ColorAdjustments);
				if ((Object)(object)component == (Object)null)
				{
					ComicalCompany.Logger.LogError((object)"Main volume not found. Skipping green mode...");
				}
				else if (component.profile.TryGet<ColorAdjustments>(ref val2))
				{
					HUDManager.Instance.DisplayTip("Green mode enabled", "Green mode enabled", false, false, "LC_Tip1");
					((VolumeParameter)val2.colorFilter).overrideState = true;
					((VolumeParameter<Color>)(object)val2.colorFilter).value = Color.green;
				}
				else
				{
					ComicalCompany.Logger.LogWarning((object)"ColorAdjustments not found. Skipping green mode...");
				}
			}
		}

		[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
		[HarmonyPrefix]
		private static void DespawnPropsPrefix()
		{
			GameObject val = GameObject.Find("VolumeMain");
			Volume component = val.GetComponent<Volume>();
			ColorAdjustments val2 = default(ColorAdjustments);
			if ((Object)(object)component == (Object)null)
			{
				ComicalCompany.Logger.LogWarning((object)"Main volume not found. You must remain green :(");
			}
			else if (component.profile.TryGet<ColorAdjustments>(ref val2))
			{
				((VolumeParameter)val2.colorFilter).overrideState = false;
			}
			else
			{
				ComicalCompany.Logger.LogWarning((object)"ColorAdjustments not found. You must remain green :(");
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class InspirationPatch
	{
		[HarmonyPatch("StartGame")]
		[HarmonyPostfix]
		private static void StartGamePostfix()
		{
			int randomMapSeed = StartOfRound.Instance.randomMapSeed;
			switch (randomMapSeed % 100)
			{
			case 1:
				HUDManager.Instance.DisplayTip("sdfjkds", "adkjsd HJASBA Jhsajd  shjkad", false, false, "LC_Tip1");
				break;
			case 2:
				HUDManager.Instance.DisplayTip("hello", "hi", false, false, "LC_Tip1");
				break;
			case 3:
				HUDManager.Instance.DisplayTip("whatg's up..", "not a lot and u", false, false, "LC_Tip1");
				break;
			case 4:
				HUDManager.Instance.DisplayTip("why leg do that", "bro ur sideways rn", false, false, "LC_Tip1");
				break;
			case 6:
				HUDManager.Instance.DisplayTip("haahhahahaha", "wait this isn’t funny", false, false, "LC_Tip1");
				break;
			case 7:
				HUDManager.Instance.DisplayTip("???", "ok but like how did we get HERE", false, false, "LC_Tip1");
				break;
			case 8:
				HUDManager.Instance.DisplayTip("me when the", "yeah", false, false, "LC_Tip1");
				break;
			case 11:
				HUDManager.Instance.DisplayTip("whomst laddered", "he do be climbing tho", false, false, "LC_Tip1");
				break;
			case 13:
				HUDManager.Instance.DisplayTip("69% loaded", "nice", false, false, "LC_Tip1");
				break;
			case 14:
				HUDManager.Instance.DisplayTip("do NOT open that", "he opened it", false, false, "LC_Tip1");
				break;
			case 15:
				HUDManager.Instance.DisplayTip("u ok bro?", "no i heard the music", true, false, "LC_Tip1");
				break;
			case 17:
				HUDManager.Instance.DisplayTip("HUNGY", "floor snack?", false, false, "LC_Tip1");
				break;
			case 18:
				HUDManager.Instance.DisplayTip("keybind lost", "walk forward to apologize", false, false, "LC_Tip1");
				break;
			case 19:
				HUDManager.Instance.DisplayTip("help", "vent jsut looked at me", false, false, "LC_Tip1");
				break;
			case 21:
				HUDManager.Instance.DisplayTip("oopsie woopsie", "we did a killie willie", false, false, "LC_Tip1");
				break;
			case 22:
				HUDManager.Instance.DisplayTip("who coded this", "seriously who made thsi", false, false, "LC_Tip1");
				break;
			case 23:
				HUDManager.Instance.DisplayTip("vent doing vent things", "classic vent moment", false, false, "LC_Tip1");
				break;
			case 24:
				HUDManager.Instance.DisplayTip("where am i", "no seriously where’s the exit", false, false, "LC_Tip1");
				break;
			case 25:
				HUDManager.Instance.DisplayTip("bro what", "did the door just sigh", false, false, "LC_Tip1");
				break;
			case 26:
				HUDManager.Instance.DisplayTip("tuesday", "it’s always tuesday here", false, false, "LC_Tip1");
				break;
			case 28:
				HUDManager.Instance.DisplayTip("get in loser", "we’re dying today", true, false, "LC_Tip1");
				break;
			case 5:
			case 9:
			case 10:
			case 12:
			case 16:
			case 20:
			case 27:
				break;
			}
		}
	}
	[HarmonyPatch]
	public class ItemChargerPatch
	{
		[HarmonyPriority(600)]
		[HarmonyPrefix]
		[HarmonyPatch(typeof(ItemCharger), "Update")]
		public static void Update(ItemCharger __instance, ref bool __runOriginal)
		{
			__runOriginal = false;
			if ((Object)(object)NetworkManager.Singleton == (Object)null)
			{
				return;
			}
			if (__instance.updateInterval > 1f)
			{
				__instance.updateInterval = 0f;
				if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
				{
					__instance.triggerScript.interactable = (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer == (Object)null || GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.isConductiveMetal || GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.requiresBattery;
				}
			}
			else
			{
				__instance.updateInterval += Time.deltaTime;
			}
		}

		[HarmonyPriority(600)]
		[HarmonyPrefix]
		[HarmonyPatch(typeof(ItemCharger), "ChargeItem")]
		public static void ChargeItem(ref ItemCharger __instance, ref bool __runOriginal)
		{
			GrabbableObject currentlyHeldObjectServer = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer;
			if ((Object)(object)currentlyHeldObjectServer == (Object)null || (currentlyHeldObjectServer.itemProperties.isConductiveMetal && !currentlyHeldObjectServer.itemProperties.requiresBattery))
			{
				__runOriginal = false;
				ComicalNetworking.Instance?.ChargeItemServerRPC();
			}
			else
			{
				__runOriginal = true;
			}
		}

		public static IEnumerator explosionRoutine(ItemCharger __instance)
		{
			__instance.zapAudio.Play();
			yield return (object)new WaitForSeconds(0.75f);
			__instance.chargeStationAnimator.SetTrigger("zap");
			if (!StartOfRound.Instance.inShipPhase)
			{
				Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 2f, 6f, 60, 10f, (GameObject)null, false);
			}
		}
	}
	[HarmonyPatch]
	public class ItemNamePatch
	{
		[HarmonyPatch(typeof(GrabbableObject), "Start")]
		[HarmonyPostfix]
		public static void ItemStartPatch(GrabbableObject __instance)
		{
			string name = ((Object)__instance).name;
			string text = name;
			if (text == null)
			{
				return;
			}
			switch (text.Length)
			{
			case 14:
				switch (text[2])
				{
				case 'r':
					if (text == "Airhorn(Clone)")
					{
						__instance.itemProperties.itemName = "Loud Tube";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Loud Tube";
					}
					break;
				case 'g':
					if (text == "BigBolt(Clone)")
					{
						__instance.itemProperties.itemName = "Small metal thing";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Small metal thing";
					}
					break;
				case 's':
					if (text == "Dustpan(Clone)")
					{
						__instance.itemProperties.itemName = "Cookie mold pan";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Cookie mold pan";
					}
					break;
				case 'f':
					if (text == "GiftBox(Clone)")
					{
						int num = Random.Range(0, 2);
						__instance.itemProperties.itemName = ((num == 0) ? "Loot box" : "Gambling addiction");
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = ((num == 0) ? "Loot box" : "Gambling addiction");
					}
					break;
				case 'l':
					if (text == "GoldBar(Clone)")
					{
						__instance.itemProperties.itemName = "Brass bar";
						__instance.scrapValue /= 4;
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Brass bar";
					}
					break;
				case 'y':
					if (text == "ToyCube(Clone)")
					{
						__instance.itemProperties.itemName = "(R'U'R)y'x'(RU')(R'F)(RUR')(RUR'U')R'FRUR'U'F'";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "(R'U'R)y'x'(RU')(R'F)(RUR')(RUR'U')R'FRUR'U'F'";
					}
					break;
				}
				break;
			case 20:
				switch (text[0])
				{
				case 'L':
					if (text == "LungApparatus(Clone)")
					{
						__instance.itemProperties.itemName = "Battery";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Battery";
					}
					break;
				case 'R':
					if (text == "RedLocustHive(Clone)")
					{
						__instance.itemProperties.itemName = "Bee ball";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Bee ball";
					}
					break;
				case 'C':
					if (text == "CookieMoldPan(Clone)")
					{
						__instance.itemProperties.itemName = "Dust pan";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Dust pan";
					}
					break;
				case 'P':
					if (text == "PerfumeBottle(Clone)")
					{
						__instance.itemProperties.itemName = "Weird soda";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Weird soda";
					}
					break;
				case 'S':
					if (text == "SteeringWheel(Clone)")
					{
						__instance.itemProperties.itemName = "Fidget spinner";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Fidget spinner";
					}
					break;
				case 'Z':
					if (text == "ZeddogPlushie(Clone)")
					{
						__instance.itemProperties.itemName = "Dog action figure";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Dog action figure";
					}
					break;
				case 'M':
					if (text == "MappingDevice(Clone)")
					{
						__instance.itemProperties.itemName = "Maper";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Maper";
					}
					break;
				}
				break;
			case 23:
				switch (text[2])
				{
				case 'n':
					if (text == "BinFullOfBottles(Clone)")
					{
						__instance.itemProperties.itemName = "Liquid holder holder";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Liquid holder holder";
					}
					break;
				case 's':
					if (text == "CashRegisterItem(Clone)")
					{
						__instance.itemProperties.itemName = "Typewriter";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Typewriter";
					}
					break;
				case 'i':
					if (text == "ToiletPaperRolls(Clone)")
					{
						__instance.itemProperties.itemName = "Pandemic currency";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Pandemic currency";
					}
					break;
				case 'v':
					if (text == "CaveDwellerEnemy(Clone)")
					{
						int num2 = Random.Range(0, 2);
						__instance.itemProperties.itemName = ((num2 == 0) ? "Your son, Jeremy" : "Your daughter, Megan");
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = ((num2 == 0) ? "Your son, Jeremy" : "Your daughter, Megan");
					}
					break;
				}
				break;
			case 15:
				switch (text[0])
				{
				case 'H':
					if (text == "HandBell(Clone)")
					{
						__instance.itemProperties.itemName = "Church";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Church";
					}
					break;
				case 'O':
					if (text == "OldPhone(Clone)")
					{
						__instance.itemProperties.itemName = "Walkie-talkie";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Walkie-talkie";
					}
					break;
				case 'P':
					if (text == "Painting(Clone)")
					{
						__instance.itemProperties.itemName = "Stained canvas";
						__instance.scrapValue /= 3;
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Stained canvas";
					}
					break;
				case 'R':
					if (text == "RobotToy(Clone)")
					{
						__instance.itemProperties.itemName = "Old bird action figure";
						__instance.scrapValue *= 2;
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Old bird action figure";
					}
					break;
				case 'S':
					if (text == "StopSign(Clone)")
					{
						__instance.itemProperties.itemName = "Government property";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Government property";
					}
					break;
				case 'D':
					if (text == "Dentures(Clone)")
					{
						__instance.itemProperties.itemName = "THAT WHICH CONSUMES";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "THAT WHICH CONSUMES";
					}
					break;
				case 'T':
					if (text == "ToyTrain(Clone)")
					{
						__instance.itemProperties.itemName = "Autism car";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Autism car";
					}
					break;
				}
				break;
			case 12:
				switch (text[2])
				{
				case 'n':
					if (text == "Candy(Clone)")
					{
						__instance.itemProperties.itemName = "Free candy";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Free candy";
					}
					break;
				case 'o':
					if (text == "Clock(Clone)")
					{
						__instance.itemProperties.itemName = "Wheel of time";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Wheel of time";
					}
					break;
				case 'a':
					if (text == "Flask(Clone)")
					{
						__instance.itemProperties.itemName = "Christmas bulb";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Christmas bulb";
					}
					break;
				}
				break;
			case 18:
				switch (text[2])
				{
				case 'e':
					if (text == "ChemicalJug(Clone)")
					{
						__instance.itemProperties.itemName = "3,4-dichloro-4-ethyl-5-methylheptane";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "3,4-dichloro-4-ethyl-5-methylheptane";
					}
					break;
				case 'o':
					if (text == "ShotgunItem(Clone)")
					{
						__instance.itemProperties.itemName = "Desert eagle";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Desert eagle";
					}
					break;
				case 'b':
					if (text == "RubberDucky(Clone)")
					{
						__instance.itemProperties.itemName = "Duck action figure";
						__instance.scrapValue *= 2;
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Duck action figure";
					}
					break;
				case 'a':
					if (text == "TragedyMask(Clone)")
					{
						__instance.itemProperties.itemName = "You know you want to";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "You know you want to";
					}
					break;
				case 't':
					if (text == "JetpackItem(Clone)")
					{
						__instance.itemProperties.itemName = "Jtepacl";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Jtepacl";
					}
					break;
				case 'u':
					if (text == "StunGrenade(Clone)")
					{
						__instance.itemProperties.itemName = "Stujn grenad";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Stujn grenad";
					}
					break;
				case 'P':
					if (text == "TZPChemical(Clone)")
					{
						__instance.itemProperties.itemName = "Skooma";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Skooma";
					}
					break;
				}
				break;
			case 16:
				switch (text[5])
				{
				case 'h':
					if (text == "Clownhorn(Clone)")
					{
						__instance.itemProperties.itemName = "Long loud tube";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Long loud tube";
					}
					break;
				case 'r':
					switch (text)
					{
					case "EasterEgg(Clone)":
						__instance.itemProperties.itemName = "Celebratory spheroid";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Celebratory spheroid";
						break;
					case "Hairbrush(Clone)":
						__instance.itemProperties.itemName = "Ouch";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Ouch";
						break;
					case "Hairdryer(Clone)":
						__instance.itemProperties.itemName = "Wind gun";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Wind gun";
						break;
					}
					break;
				case 'a':
					if (text == "EggBeater(Clone)")
					{
						__instance.itemProperties.itemName = "Magic wand";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Magic wand";
					}
					break;
				case 'L':
					if (text == "FancyLamp(Clone)")
					{
						__instance.itemProperties.itemName = "ÅRSTID";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "ÅRSTID";
					}
					break;
				case 'e':
					if (text == "PickleJar(Clone)")
					{
						__instance.itemProperties.itemName = "TV show reference";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "TV show reference";
					}
					break;
				case 'I':
					if (text == "KnifeItem(Clone)")
					{
						__instance.itemProperties.itemName = "Murder";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Murder";
					}
					break;
				case 'R':
					if (text == "FancyRing(Clone)")
					{
						__instance.itemProperties.itemName = "Regret";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Regret";
					}
					break;
				case 't':
					if (text == "TeaKettle(Clone)")
					{
						__instance.itemProperties.itemName = "Britain";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Britain";
					}
					break;
				case 'S':
					if (text == "YieldSign(Clone)")
					{
						__instance.itemProperties.itemName = "Government property";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Government property";
					}
					break;
				}
				break;
			case 10:
				switch (text[0])
				{
				case 'M':
					if (text == "Mug(Clone)")
					{
						__instance.itemProperties.itemName = "Office theft";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Office theft";
					}
					break;
				case 'C':
					if (text == "Cog(Clone)")
					{
						__instance.itemProperties.itemName = "Heavy metal thing";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Heavy metal thing";
					}
					break;
				case 'K':
					if (text == "Key(Clone)")
					{
						__instance.itemProperties.itemName = "Hey";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Hey";
					}
					break;
				}
				break;
			case 17:
				switch (text[4])
				{
				case 'd':
					if (text == "ComedyMask(Clone)")
					{
						__instance.itemProperties.itemName = "PVP mode";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "PVP mode";
					}
					break;
				case 'r':
					if (text == "ControlPad(Clone)")
					{
						__instance.itemProperties.itemName = "Keyboard";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Keyboard";
					}
					break;
				case 'a':
					if (text == "GarbageLid(Clone)")
					{
						__instance.itemProperties.itemName = "Hat";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Hat";
					}
					break;
				case 'y':
					if (text == "FancyGlass(Clone)")
					{
						__instance.itemProperties.itemName = "Copper cup";
						__instance.scrapValue /= 3;
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Copper cup";
					}
					break;
				case 'c':
					if (text == "Magic7Ball(Clone)")
					{
						__instance.itemProperties.itemName = "Regular 7 ball";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Regular 7 ball";
					}
					break;
				case 'B':
					if (text == "PillBottle(Clone)")
					{
						__instance.itemProperties.itemName = "Mystery gummies";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Mystery gummies";
					}
					break;
				case 't':
					if (text == "PlasticCup(Clone)")
					{
						__instance.itemProperties.itemName = "Small bucket";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Small bucket";
					}
					break;
				case 'o':
					if (text == "RedSodaCan(Clone)")
					{
						__instance.itemProperties.itemName = "Off-brand Dr Pepper";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Off-brand Dr Pepper";
					}
					break;
				case 'e':
					if (!(text == "SoccerBall(Clone)"))
					{
						if (text == "ShovelItem(Clone)")
						{
							__instance.itemProperties.itemName = "Shover";
							((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Shover";
						}
					}
					else
					{
						__instance.itemProperties.itemName = "Basketball";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Basketball";
					}
					break;
				case 'l':
					if (text == "MetalSheet(Clone)")
					{
						__instance.itemProperties.itemName = "Music genre";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Music genre";
					}
					break;
				case 'h':
					if (text == "Toothpaste(Clone)")
					{
						__instance.itemProperties.itemName = "THAT WHICH CONSUMES paste";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "THAT WHICH CONSUMES paste";
					}
					break;
				case 'n':
					if (text == "EnginePart(Clone)")
					{
						__instance.itemProperties.itemName = "2.39 MW (3,200 hp) EMD 12-710";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "2.39 MW (3,200 hp) EMD 12-710";
					}
					break;
				}
				break;
			case 22:
				switch (text[0])
				{
				case 'M':
					if (text == "MagnifyingGlass(Clone)")
					{
						__instance.itemProperties.itemName = "Magnificent glass";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Magnificent glass";
					}
					break;
				case 'E':
					if (text == "ExtensionLadder(Clone)")
					{
						__instance.itemProperties.itemName = "Extnesion ladder";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Extnesion ladder";
					}
					break;
				}
				break;
			case 19:
				switch (text[0])
				{
				case 'F':
					if (text == "FishTestProp(Clone)")
					{
						__instance.itemProperties.itemName = "Fish action figure";
						__instance.scrapValue *= 2;
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Fish action figure";
					}
					break;
				case 'S':
					if (text == "ShotgunShell(Clone)")
					{
						__instance.itemProperties.itemName = ".50 cal AE 12.7x33mmRB";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = ".50 cal AE 12.7x33mmRB";
					}
					break;
				case 'B':
					if (text == "BBFlashlight(Clone)")
					{
						__instance.itemProperties.itemName = "Flashlghti";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Flashlghti";
					}
					break;
				case 'D':
					if (text == "DiyFlashbang(Clone)")
					{
						__instance.itemProperties.itemName = "Vodka";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Vodka";
					}
					break;
				case 'L':
					if (text == "LaserPointer(Clone)")
					{
						__instance.itemProperties.itemName = "Laser gun";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Laser gun";
					}
					break;
				case 'R':
					if (text == "RadarBooster(Clone)")
					{
						__instance.itemProperties.itemName = "Rader bboster";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Radar bboster";
					}
					break;
				}
				break;
			case 21:
				switch (text[0])
				{
				case 'W':
					if (text == "WhoopieCushion(Clone)")
					{
						__instance.itemProperties.itemName = "Weird gold bar";
						__instance.scrapValue *= 8;
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Weird gold bar";
					}
					break;
				case 'F':
					if (text == "FlashlightItem(Clone)")
					{
						__instance.itemProperties.itemName = "Pro-flasglight";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Pro-flasglight";
					}
					break;
				case 'P':
					if (text == "PatcherGunItem(Clone)")
					{
						__instance.itemProperties.itemName = "Zap ugn";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Maper";
					}
					break;
				}
				break;
			case 13:
				if (text == "Remote(Clone)")
				{
					__instance.itemProperties.itemName = "Telephone";
					((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Telephone";
				}
				break;
			case 11:
				break;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(EnemyAI), "Start")]
		public static void Awake(EnemyAI __instance)
		{
			if (((object)__instance).GetType() == typeof(ForestGiantAI))
			{
				__instance.enemyType.enemyName = "Forest";
				((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Forest";
			}
			else if (((object)__instance).GetType() == typeof(SandSpiderAI))
			{
				__instance.enemyType.enemyName = "Forbidden protein";
				((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Forbidden protein";
			}
			else if (((object)__instance).GetType() == typeof(ClaySurgeonAI))
			{
				__instance.enemyType.enemyName = "Origami maker (you are the origami)";
				((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Origami maker (you are the origami)";
			}
			else if (((object)__instance).GetType() == typeof(FlowermanAI))
			{
				__instance.enemyType.enemyName = "Unlockable character";
				((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Unlockable character";
			}
			else if (((object)__instance).GetType() == typeof(ButlerEnemyAI))
			{
				__instance.enemyType.enemyName = "A brit";
				((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "A brit";
			}
			else if (((object)__instance).GetType() == typeof(SpringManAI))
			{
				__instance.enemyType.enemyName = "Are you sure?";
				((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Are you sure?";
			}
			else
			{
				if (((object)__instance).GetType() == typeof(DressGirlAI))
				{
					return;
				}
				if (((object)__instance).GetType() == typeof(HoarderBugAI))
				{
					__instance.enemyType.enemyName = "Communism";
					((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Communism";
				}
				else if (((object)__instance).GetType() == typeof(BlobAI))
				{
					__instance.enemyType.enemyName = "Gatorade puddle";
					((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Gatorade puddle";
				}
				else if (((object)__instance).GetType() == typeof(JesterAI))
				{
					__instance.enemyType.enemyName = "Funny box";
					((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Funny box";
				}
				else if (((object)__instance).GetType() == typeof(CaveDwellerAI))
				{
					__instance.enemyType.enemyName = "Baby (grown up)";
					((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Baby (grown up)";
				}
				else if (!(((object)__instance).GetType() == typeof(MaskedPlayerEnemy)))
				{
					if (((object)__instance).GetType() == typeof(ButlerBeesEnemyAI))
					{
						__instance.enemyType.enemyName = "Bloody hell innit";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Bloody hell innit";
					}
					else if (((object)__instance).GetType() == typeof(NutcrackerEnemyAI))
					{
						__instance.enemyType.enemyName = "Aimbot hacker";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Aimbot hacker";
					}
					else if (((object)__instance).GetType() == typeof(CentipedeAI))
					{
						__instance.enemyType.enemyName = "Mphhhmhh";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Mphhhmhh";
					}
					else if (((object)__instance).GetType() == typeof(PufferAI))
					{
						__instance.enemyType.enemyName = "Thumper";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Thumper";
					}
					else if (((object)__instance).GetType() == typeof(CrawlerAI))
					{
						__instance.enemyType.enemyName = "Spore Lizard";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Spore Lizard";
					}
					else if (((object)__instance).GetType() == typeof(BaboonBirdAI))
					{
						__instance.enemyType.enemyName = "Coward";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Coward";
					}
					else if (((object)__instance).GetType() == typeof(SandWormAI))
					{
						__instance.enemyType.enemyName = "DUNE intellectual property";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "DUNE intellectual property";
					}
					else if (((object)__instance).GetType() == typeof(MouthDogAI))
					{
						__instance.enemyType.enemyName = "He doesn't bite";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "He doesn't bite";
					}
					else if (((object)__instance).GetType() == typeof(RadMechAI))
					{
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Old bird action figure (gone wrong)";
					}
					else if (((object)__instance).GetType() == typeof(RedLocustBees))
					{
						__instance.enemyType.enemyName = "Roaming locust";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Roaming locust";
					}
					else if (((object)__instance).GetType() == typeof(DoublewingAI))
					{
						__instance.enemyType.enemyName = "Birb";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Birb";
					}
					else if (((object)__instance).GetType() == typeof(DocileLocustBeesAI))
					{
						__instance.enemyType.enemyName = "Circuit bees";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "Circuit bees";
					}
					else if (((object)__instance).GetType() == typeof(FlowerSnakeEnemy))
					{
						__instance.enemyType.enemyName = "GET OFF OF ME";
						((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = "GET OFF OF ME";
					}
				}
			}
		}
	}
	[HarmonyPatch]
	public class JesterInfestation
	{
		[HarmonyTranspiler]
		[HarmonyPatch(typeof(RoundManager), "RefreshEnemiesList")]
		public static IEnumerable<CodeInstruction> PatchRefreshEnemiesList(IEnumerable<CodeInstruction> instructions)
		{
			foreach (CodeInstruction instruction in instructions)
			{
				int num;
				if (instruction.opcode == OpCodes.Ldstr)
				{
					object operand = instruction.operand;
					if (operand is string str)
					{
						num = ((str == "Nutcracker") ? 1 : 0);
						goto IL_00b1;
					}
				}
				num = 0;
				goto IL_00b1;
				IL_00b1:
				if (num != 0)
				{
					ComicalCompany.Logger.LogInfo((object)$"Found instruction: {instruction}");
					yield return new CodeInstruction(OpCodes.Ldstr, (object)"Jester");
				}
				else
				{
					yield return instruction;
				}
			}
		}
	}
	[HarmonyPatch]
	public class JumpPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")]
		public static void Jump_performed(CallbackContext context, ref bool __runOriginal)
		{
			if (Random.Range(0, 100) < 2)
			{
				__runOriginal = false;
			}
		}
	}
	[HarmonyPatch(typeof(HangarShipDoor))]
	public class LadderPatch
	{
		private static bool hasPatchedLadders;

		[HarmonyPatch("SetDoorButtonsEnabled")]
		[HarmonyPostfix]
		private static void HangarDoorsOpenPostfix()
		{
			//IL_0076: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			if (hasPatchedLadders)
			{
				return;
			}
			hasPatchedLadders = true;
			GameObject val = GameObject.Find("LadderShort");
			GameObject val2 = GameObject.Find("LadderShort (1)");
			GameObject[] array = (GameObject[])(object)new GameObject[2] { val, val2 };
			GameObject val3 = GameObject.Find("OutsideShipRoom/Ladder");
			GameObject[] array2 = array;
			foreach (GameObject val4 in array2)
			{
				BoxCollider componentInChildren = val4.GetComponentInChildren<BoxCollider>();
				componentInChildren.size = new Vector3(1f, 2.6f, 0.594941f);
				componentInChildren.center = new Vector3(0f, -1.34f, -0.2025296f);
				for (int j = 0; j < 3; j++)
				{
					GameObject val5 = Object.Instantiate<GameObject>(val3, Vector3.zero, Quaternion.identity, val4.transform);
					((Component)val5.transform.GetChild(0)).gameObject.SetActive(false);
					val5.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
					val5.transform.localScale = Vector3.one;
					val5.transform.localPosition = new Vector3(0f, -7.321347f, 0f) + (float)j * new Vector3(0f, -9.044013f, 0f);
				}
			}
		}
	}
	[HarmonyPatch]
	public class LandminePatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(Landmine), "Detonate")]
		public static void Detonate(Landmine __instance, ref bool __runOriginal)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			__runOriginal = false;
			__instance.mineAudio.pitch = Random.Range(0.93f, 1.07f);
			__instance.mineAudio.PlayOneShot(__instance.mineDetonate, 1f);
			Landmine.SpawnExplosion(((Component)__instance).transform.position + Vector3.up, false, 0f, 10f, 90, 100f, (GameObject)null, false);
		}
	}
	[HarmonyPatch]
	public class NetworkingPatch
	{
		private static GameObject? networkPrefab;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		public static void Init()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			if (!((Object)(object)networkPrefab != (Object)null))
			{
				networkPrefab = (GameObject)ComicalCompany.assetBundle.LoadAsset("assets/LethalCompany/Custom/ComicalNetworkHandler.prefab");
				networkPrefab.AddComponent<ComicalNetworking>();
				NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void SpawnNetworkHandler()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
				ComicalCompany.Logger.LogInfo((object)"Network handler spawned!");
			}
		}
	}
	[HarmonyPatch]
	public class OrbitDoorPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "SetShipReadyToLand")]
		public static void ShipHasLeft()
		{
			Object.FindObjectOfType<HangarShipDoor>().SetDoorButtonsEnabled(true);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HangarShipDoor), "SetDoorOpen")]
		public static void SetDoorOpen(HangarShipDoor __instance, ref bool __runOriginal)
		{
			if (StartOfRound.Instance.inShipPhase)
			{
				StartOfRound.Instance.FirePlayersAfterDeadlineClientRpc(new int[4]
				{
					StartOfRound.Instance.gameStats.daysSpent,
					StartOfRound.Instance.gameStats.scrapValueCollected,
					StartOfRound.Instance.gameStats.deaths,
					StartOfRound.Instance.gameStats.allStepsTaken
				}, true);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "playersFiredGameOver")]
		public static void playersFiredGameOver(ref IEnumerator __result, bool abridgedVersion)
		{
			if (StartOfRound.Instance.inShipPhase && abridgedVersion)
			{
				__result = abridgedPlayersFiredGameOver(__result);
			}
		}

		public static IEnumerator abridgedPlayersFiredGameOver(IEnumerator originalEnumerator)
		{
			for (int i = 0; i < 3; i++)
			{
				originalEnumerator.MoveNext();
			}
			while (originalEnumerator.MoveNext())
			{
				yield return originalEnumerator.Current;
			}
			HangarShipDoor hangarDoor = Object.FindObjectOfType<HangarShipDoor>();
			if ((Object)(object)hangarDoor != (Object)null)
			{
				hangarDoor.SetDoorClosed();
				hangarDoor.PlayDoorAnimation(true);
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager), "SpawnOutsideHazards")]
	public static class PropsPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(RoundManager __instance)
		{
			CustomSpawnMapObjects(__instance);
			return false;
		}

		private static void CustomSpawnMapObjects(RoundManager __instance)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Invalid comparison between Unknown and I4
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: 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_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: 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_04f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_063b: 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_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			Random random = new Random(StartOfRound.Instance.randomMapSeed + 2);
			__instance.outsideAINodes = (from x in GameObject.FindGameObjectsWithTag("OutsideAINode")
				orderby Vector3.Distance(x.transform.position, Vector3.zero)
				select x).ToArray();
			NavMeshHit val = default(NavMeshHit);
			int num = 0;
			if ((int)TimeOfDay.Instance.currentLevelWeather == 1)
			{
				num = random.Next(5, 15);
				num *= StartOfRound.Instance.randomMapSeed % 10;
				if (random.Next(0, 100) < 7)
				{
					num = random.Next(5, 30);
				}
				for (int i = 0; i < num; i++)
				{
					Vector3 position = __instance.outsideAINodes[random.Next(0, __instance.outsideAINodes.Length)].transform.position;
					Vector3 val2 = __instance.GetRandomNavMeshPositionInBoxPredictable(position, 30f, val, random, -1) + Vector3.up;
					GameObject val3 = Object.Instantiate<GameObject>(__instance.quicksandPrefab, val2, Quaternion.identity, __instance.mapPropsContainer.transform);
				}
			}
			int num2 = 0;
			List<Vector3> list = new List<Vector3>();
			__instance.spawnDenialPoints = GameObject.FindGameObjectsWithTag("SpawnDenialPoint");
			if (__instance.currentLevel.spawnableOutsideObjects != null)
			{
				RaycastHit val4 = default(RaycastHit);
				for (int j = 0; j < __instance.currentLevel.spawnableOutsideObjects.Length; j++)
				{
					double num3 = random.NextDouble();
					num = (int)__instance.currentLevel.spawnableOutsideObjects[j].randomAmount.Evaluate((float)num3);
					num *= StartOfRound.Instance.randomMapSeed % 10;
					if (__instance.increasedMapPropSpawnRateIndex == j)
					{
						num += 12;
					}
					if ((float)random.Next(0, 100) < 20f)
					{
						num *= 2;
					}
					for (int k = 0; k < num; k++)
					{
						int num4 = random.Next(0, __instance.outsideAINodes.Length);
						Vector3 randomNavMeshPositionInBoxPredictable = __instance.GetRandomNavMeshPositionInBoxPredictable(__instance.outsideAINodes[num4].transform.position, 30f, val, random, -1);
						if (__instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.spawnableFloorTags != null)
						{
							bool flag = false;
							if (Physics.Raycast(randomNavMeshPositionInBoxPredictable + Vector3.up, Vector3.down, ref val4, 5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
							{
								for (int l = 0; l < __instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.spawnableFloorTags.Length; l++)
								{
									if (((Component)((Component)((RaycastHit)(ref val4)).collider).transform).CompareTag(__instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.spawnableFloorTags[l]))
									{
										flag = true;
										break;
									}
								}
							}
							if (!flag)
							{
								continue;
							}
						}
						randomNavMeshPositionInBoxPredictable = __instance.PositionEdgeCheck(randomNavMeshPositionInBoxPredictable, (float)__instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.objectWidth);
						if (randomNavMeshPositionInBoxPredictable == Vector3.zero)
						{
							continue;
						}
						bool flag2 = false;
						for (int m = 0; m < __instance.shipSpawnPathPoints.Length; m++)
						{
							if (Vector3.Distance(((Component)__instance.shipSpawnPathPoints[m]).transform.position, randomNavMeshPositionInBoxPredictable) < (float)__instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.objectWidth + 6f)
							{
								flag2 = true;
								break;
							}
						}
						if (flag2)
						{
							continue;
						}
						for (int n = 0; n < __instance.spawnDenialPoints.Length; n++)
						{
							if (Vector3.Distance(__instance.spawnDenialPoints[n].transform.position, randomNavMeshPositionInBoxPredictable) < (float)__instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.objectWidth + 6f)
							{
								flag2 = true;
								break;
							}
						}
						if (flag2)
						{
							continue;
						}
						if (Vector3.Distance(GameObject.FindGameObjectWithTag("ItemShipLandingNode").transform.position, randomNavMeshPositionInBoxPredictable) < (float)__instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.objectWidth + 4f)
						{
							flag2 = true;
							break;
						}
						if (flag2)
						{
							continue;
						}
						if (__instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.objectWidth > 4)
						{
							flag2 = false;
							for (int num5 = 0; num5 < list.Count; num5++)
							{
								if (Vector3.Distance(randomNavMeshPositionInBoxPredictable, list[num5]) < (float)__instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.objectWidth)
								{
									flag2 = true;
									break;
								}
							}
							if (flag2)
							{
								continue;
							}
						}
						list.Add(randomNavMeshPositionInBoxPredictable);
						GameObject val5 = Object.Instantiate<GameObject>(__instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.prefabToSpawn, randomNavMeshPositionInBoxPredictable - Vector3.up * 0.7f, Quaternion.identity, __instance.mapPropsContainer.transform);
						num2++;
						if (__instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.spawnFacingAwayFromWall)
						{
							val5.transform.eulerAngles = new Vector3(0f, __instance.YRotationThatFacesTheFarthestFromPosition(randomNavMeshPositionInBoxPredictable + Vector3.up * 0.2f, 25f, 6), 0f);
						}
						else
						{
							int num6 = random.Next(0, 360);
							val5.transform.eulerAngles = new Vector3(val5.transform.eulerAngles.x, (float)num6, val5.transform.eulerAngles.z);
						}
						val5.transform.localEulerAngles = new Vector3(val5.transform.localEulerAngles.x + __instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.rotationOffset.x, val5.transform.localEulerAngles.y + __instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.rotationOffset.y, val5.transform.localEulerAngles.z + __instance.currentLevel.spawnableOutsideObjects[j].spawnableObject.rotationOffset.z);
					}
				}
			}
			if (num2 > 0)
			{
				GameObject val6 = GameObject.FindGameObjectWithTag("OutsideLevelNavMesh");
				if ((Object)(object)val6 != (Object)null)
				{
					val6.GetComponent<NavMeshSurface>().BuildNavMesh();
				}
			}
			__instance.bakedNavMesh = true;
		}
	}
	[HarmonyPatch]
	internal class QuicksandPatch
	{
		private static bool patched;

		[HarmonyPatch(typeof(QuicksandTrigger), "OnTriggerStay")]
		[HarmonyPostfix]
		public static void OnTriggerStayPostfix(QuicksandTrigger __instance)
		{
			if (!patched)
			{
				__instance.sinkingSpeedMultiplier = 1.75f;
			}
		}
	}
	[HarmonyPatch]
	public class RoundManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingLevel")]
		public static void FinishGeneratingLevel(RoundManager __instance)
		{
			CoilheadPatch.random = new Random(StartOfRound.Instance.randomMapSeed + 1001);
			TeleporterPatch.random = new Random(StartOfRound.Instance.randomMapSeed + 3002);
		}
	}
	[HarmonyPatch]
	public class StartOfRoundPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		public static void Awake()
		{
			global::ComicalCompany.Utils.Utils.allEnemyTypes = Resources.FindObjectsOfTypeAll<EnemyType>().ToList();
		}
	}
	[HarmonyPatch]
	public class SwitchPatch
	{
		private static bool isSwappedCall;

		[HarmonyPatch(typeof(StartOfRound), "SetMagnetOn")]
		[HarmonyPrefix]
		public static void SetMagnetOn_Prefix(bool on, ref bool __runOriginal)
		{
			if (!isSwappedCall)
			{
				isSwappedCall = true;
				ShipLights val = Object.FindObjectOfType<ShipLights>();
				val.SetShipLightsBoolean(on);
				isSwappedCall = false;
				__runOriginal = false;
			}
			else
			{
				__runOriginal = true;
			}
		}

		[HarmonyPatch(typeof(ShipLights), "ToggleShipLights")]
		[HarmonyPrefix]
		public static void ToggleShipLights(ref bool __runOriginal)
		{
			if (!isSwappedCall)
			{
				isSwappedCall = true;
				StartOfRound.Instance.SetMagnetOn(!StartOfRound.Instance.magnetOn);
				isSwappedCall = false;
				__runOriginal = false;
			}
			else
			{
				__runOriginal = true;
			}
		}
	}
	[HarmonyPatch]
	public class TeleporterPatch
	{
		public static PlayerControllerB? beamingPlayer;

		public static Random random = new Random(10002);

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ShipTeleporter), "beamUpPlayer")]
		public static void beamUpPlayer(ShipTeleporter __instance, ref bool __runOriginal, ref IEnumerator __result)
		{
			__runOriginal = true;
			ComicalCompany.Logger.LogInfo((object)"Beaming up player");
			if (!StartOfRound.Instance.shipIsLeaving && !StartOfRound.Instance.inShipPhase && random.NextDouble() < 0.5)
			{
				ComicalCompany.Logger.LogInfo((object)"Beaming up mimic");
				__result = teleportMasked(__instance);
				__runOriginal = false;
			}
		}

		public static IEnumerator teleportMasked(ShipTeleporter __instance)
		{
			__instance.shipTeleporterAudio.PlayOneShot(__instance.teleporterSpinSFX);
			if (((NetworkBehaviour)StartOfRound.Instance).IsHost || ((NetworkBehaviour)StartOfRound.Instance).IsServer)
			{
				Vector3 position = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
				GameObject gameObject = Object.Instantiate<GameObject>(global::ComicalCompany.Utils.Utils.allEnemyTypes.Find((EnemyType x) => x.enemyName.ToLower().Contains("mask")).enemyPrefab, position, Quaternion.Euler(new Vector3(0f, 0f, 0f)));
				gameObject.GetComponent<MaskedPlayerEnemy>().mimickingPlayer = null;
				gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
				RoundManager.Instance.SpawnedEnemies.Add(gameObject.GetComponent<EnemyAI>());
				((EnemyAI)gameObject.GetComponent<MaskedPlayerEnemy>()).ShipTeleportEnemy();
			}
			yield return (object)new WaitForSeconds(3f);
			__instance.shipTeleporterAudio.PlayOneShot(__instance.teleporterBeamUpSFX);
			if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
		}
	}
	[HarmonyPatch]
	public class TZPPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(TetraChemicalItem), "Update")]
		public static void Update(TetraChemicalItem __instance)
		{
			if (__instance.emittingGas)
			{
				__instance.previousPlayerHeldBy.drunknessInertia = 3f;
				__instance.previousPlayerHeldBy.drunkness = 1f;
			}
		}
	}
	[HarmonyPatch]
	public class VentPatch
	{
		[HarmonyPatch(typeof(StartOfRound), "StartGame")]
		[HarmonyPostfix]
		private static void GameLoadPostfix()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("VentEntrance");
			if ((Object)(object)val == (Object)null)
			{
				ComicalCompany.Logger.LogError((object)"Can't find ship vent");
				return;
			}
			GameObject val2 = Object.Instantiate<GameObject>(ComicalCompany.ventPrefab);
			NetworkObject component = val2.GetComponent<NetworkObject>();
			if ((Object)(object)component != (Object)null && !component.IsSpawned)
			{
				component.Spawn(false);
			}
			val2.transform.position = val.transform.position;
			val2.transform.rotation = val.transform.rotation;
			((Object)val2).name = ((Object)val).name;
			val2.transform.parent = val.transform.parent;
			Object.Destroy((Object)(object)val);
		}

		[HarmonyPatch(typeof(StartOfRound), "AllPlayersHaveRevivedClientRpc")]
		[HarmonyPrefix]
		private static void DespawnPropsPrefix()
		{
			GameObject val = GameObject.Find("VentEntrance");
			if ((Object)(object)val != (Object)null)
			{
				AudioSource component = val.GetComponent<AudioSource>();
				if (component != null)
				{
					component.Stop();
				}
				if ((Object)(object)val.GetComponent<Animator>() != (Object)null)
				{
					val.GetComponent<Animator>().Play("New State");
				}
				if ((Object)(object)val.GetComponent<EnemyVent>() != (Object)null)
				{
					val.GetComponent<EnemyVent>().ventIsOpen = false;
				}
			}
		}
	}
}
namespace ComicalCompany.Configuration
{
	internal class ComicalCompanyConfig
	{
		public readonly ConfigEntry<bool> enableApparatusPatch;

		public readonly ConfigEntry<bool> enableBoomBoxPatch;

		public readonly ConfigEntry<bool> enableCoilheadPatch;

		public readonly ConfigEntry<bool> enableEnemySizePatch;

		public readonly ConfigEntry<bool> enableFallDamagePatch;

		public readonly ConfigEntr