Decompiled source of SCPFoundationDungeon v4.3.4

BepInEx/plugins/SCPCBDunGen/SCPCBDunGen.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using LethalLevelLoader;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using On;
using PiggyVarietyMod;
using SCPCBDunGen.NetcodePatcher;
using SCPCBDunGen.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SCPCBDunGen")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("4.3.4.0")]
[assembly: AssemblyInformationalVersion("4.3.4+effb0360ba5e19c8134781c129e09319de632a03")]
[assembly: AssemblyProduct("SCPCBDunGen")]
[assembly: AssemblyTitle("SCPCBDunGen")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.3.4.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 SCPCBDunGen
{
	public class SCP914Converter : NetworkBehaviour
	{
		public enum SCP914Setting
		{
			ROUGH,
			COARSE,
			ONETOONE,
			FINE,
			VERYFINE
		}

		public BoxCollider InputStore;

		public Collider colliderOutput;

		public InteractTrigger SettingKnobTrigger;

		public GameObject SettingKnobPivot;

		public AudioSource SettingKnobSoundSrc;

		public InteractTrigger ActivateTrigger;

		public AudioSource ActivateAudioSrc;

		public AudioSource RefineAudioSrc;

		public Animator DoorIn;

		public Animator DoorOut;

		private readonly (SCP914Setting, float)[] SCP914SettingRotations = new(SCP914Setting, float)[5]
		{
			(SCP914Setting.ROUGH, 90f),
			(SCP914Setting.COARSE, 45f),
			(SCP914Setting.ONETOONE, 0f),
			(SCP914Setting.FINE, -45f),
			(SCP914Setting.VERYFINE, -90f)
		};

		private Dictionary<Item, List<Item>>[] arItemMappings = new Dictionary<Item, List<Item>>[5]
		{
			new Dictionary<Item, List<Item>>(),
			new Dictionary<Item, List<Item>>(),
			new Dictionary<Item, List<Item>>(),
			new Dictionary<Item, List<Item>>(),
			new Dictionary<Item, List<Item>>()
		};

		private Dictionary<EnemyType, List<EnemyType>>[] arEnemyMappings = new Dictionary<EnemyType, List<EnemyType>>[5]
		{
			new Dictionary<EnemyType, List<EnemyType>>(),
			new Dictionary<EnemyType, List<EnemyType>>(),
			new Dictionary<EnemyType, List<EnemyType>>(),
			new Dictionary<EnemyType, List<EnemyType>>(),
			new Dictionary<EnemyType, List<EnemyType>>()
		};

		private Dictionary<Item, List<EnemyType>>[] arItemEnemyMappings = new Dictionary<Item, List<EnemyType>>[5]
		{
			new Dictionary<Item, List<EnemyType>>(),
			new Dictionary<Item, List<EnemyType>>(),
			new Dictionary<Item, List<EnemyType>>(),
			new Dictionary<Item, List<EnemyType>>(),
			new Dictionary<Item, List<EnemyType>>()
		};

		private Dictionary<EnemyType, List<Item>>[] arEnemyItemMappings = new Dictionary<EnemyType, List<Item>>[5]
		{
			new Dictionary<EnemyType, List<Item>>(),
			new Dictionary<EnemyType, List<Item>>(),
			new Dictionary<EnemyType, List<Item>>(),
			new Dictionary<EnemyType, List<Item>>(),
			new Dictionary<EnemyType, List<Item>>()
		};

		private int iCurrentState;

		private bool bActive;

		private Transform ScrapTransform;

		private RoundManager roundManager;

		private StartOfRound StartOfRound;

		private EnemyType MaskedType;

		public void AddConversion(SCP914Setting setting, Item itemInput, List<Item> lItemOutputs)
		{
			Dictionary<Item, List<Item>> dictionary = arItemMappings[(int)setting];
			if (dictionary.TryGetValue(itemInput, out var value))
			{
				value.AddRange(lItemOutputs);
			}
			else
			{
				arItemMappings[(int)setting].Add(itemInput, lItemOutputs);
			}
		}

		public void AddConversion(SCP914Setting setting, EnemyType enemyInput, List<EnemyType> lEnemyOutputs)
		{
			Dictionary<EnemyType, List<EnemyType>> dictionary = arEnemyMappings[(int)setting];
			if (dictionary.TryGetValue(enemyInput, out var value))
			{
				value.AddRange(lEnemyOutputs);
			}
			else
			{
				arEnemyMappings[(int)setting].Add(enemyInput, lEnemyOutputs);
			}
		}

		public void AddConversion(SCP914Setting setting, Item itemInput, List<EnemyType> lEnemyOutputs)
		{
			Dictionary<Item, List<EnemyType>> dictionary = arItemEnemyMappings[(int)setting];
			if (dictionary.TryGetValue(itemInput, out var value))
			{
				value.AddRange(lEnemyOutputs);
			}
			else
			{
				arItemEnemyMappings[(int)setting].Add(itemInput, lEnemyOutputs);
			}
		}

		public void AddConversion(SCP914Setting setting, EnemyType enemyInput, List<Item> lItemOutputs)
		{
			Dictionary<EnemyType, List<Item>> dictionary = arEnemyItemMappings[(int)setting];
			if (dictionary.TryGetValue(enemyInput, out var value))
			{
				value.AddRange(lItemOutputs);
			}
			else
			{
				arEnemyItemMappings[(int)setting].Add(enemyInput, lItemOutputs);
			}
		}

		private Dictionary<Item, List<Item>> GetItemMapping()
		{
			return arItemMappings[iCurrentState];
		}

		private Dictionary<EnemyType, List<EnemyType>> GetEnemyMapping()
		{
			return arEnemyMappings[iCurrentState];
		}

		private Dictionary<Item, List<EnemyType>> GetItemEnemyMapping()
		{
			return arItemEnemyMappings[iCurrentState];
		}

		private Dictionary<EnemyType, List<Item>> GetEnemyItemMapping()
		{
			return arEnemyItemMappings[iCurrentState];
		}

		private Vector3 GetRandomNavMeshPositionInCollider(Collider collider)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = collider.bounds;
			Vector3 center = ((Bounds)(ref bounds)).center;
			bounds = collider.bounds;
			float x = ((Bounds)(ref bounds)).extents.x;
			bounds = collider.bounds;
			float num = Math.Min(x, ((Bounds)(ref bounds)).extents.z);
			center.x += Random.Range(0f - num, num);
			center.z += Random.Range(0f - num, num);
			ref float y = ref center.y;
			float num2 = y;
			bounds = collider.bounds;
			y = num2 - ((Bounds)(ref bounds)).extents.y / 2f;
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(center, ref val, 5f, -1))
			{
				return ((NavMeshHit)(ref val)).position;
			}
			return center;
		}

		private Vector3 GetRandomPositionInCollider(Collider collider)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = collider.bounds;
			Vector3 center = ((Bounds)(ref bounds)).center;
			bounds = collider.bounds;
			float x = ((Bounds)(ref bounds)).extents.x;
			bounds = collider.bounds;
			float num = Math.Min(x, ((Bounds)(ref bounds)).extents.z);
			center.x += Random.Range(0f - num, num);
			center.z += Random.Range(0f - num, num);
			return center;
		}

		[ServerRpc(RequireOwnership = false)]
		public void TurnStateServerRpc()
		{
			//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(2627837757u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2627837757u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					int iNewState = (iCurrentState + 1) % 5;
					TurnStateClientRpc(iNewState);
				}
			}
		}

		[ClientRpc]
		public void TurnStateClientRpc(int iNewState)
		{
			//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_0071: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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(301590527u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, iNewState);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 301590527u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					iCurrentState = iNewState;
					Quaternion rotation = SettingKnobPivot.transform.rotation;
					Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
					eulerAngles.z = SCP914SettingRotations[iCurrentState].Item2;
					SettingKnobPivot.transform.rotation = Quaternion.Euler(eulerAngles);
					SettingKnobSoundSrc.Play();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ActivateServerRpc()
		{
			//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(1051910848u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1051910848u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !bActive)
				{
					bActive = true;
					ActivateClientRpc();
					((MonoBehaviour)this).StartCoroutine(ConversionProcess());
				}
			}
		}

		[ClientRpc]
		public void ActivateClientRpc()
		{
			//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(3833341719u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3833341719u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					ActivateTrigger.interactable = false;
					SettingKnobTrigger.interactable = false;
					ActivateAudioSrc.Play();
					DoorIn.SetBoolString("open", false);
					DoorOut.SetBoolString("open", false);
				}
			}
		}

		[ClientRpc]
		public void RefineFinishClientRpc()
		{
			//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(4143732333u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4143732333u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					ActivateTrigger.interactable = true;
					SettingKnobTrigger.interactable = true;
					DoorIn.SetBoolString("open", true);
					DoorOut.SetBoolString("open", true);
				}
			}
		}

		[ClientRpc]
		public void SpawnItemsClientRpc(NetworkObjectReference[] arNetworkObjectReferences, int[] arScrapValues, bool bChargeBattery)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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(4044311993u, val, (RpcDelivery)0);
				bool flag = arNetworkObjectReferences != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(arNetworkObjectReferences, default(ForNetworkSerializable));
				}
				bool flag2 = arScrapValues != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<int>(arScrapValues, default(ForPrimitives));
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref bChargeBattery, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4044311993u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			NetworkObject val3 = default(NetworkObject);
			for (int i = 0; i < arNetworkObjectReferences.Length; i++)
			{
				SCPCBDunGen.Logger.LogInfo((object)$"Item conversion scrap value {i}: {arScrapValues[i]}");
				if (((NetworkObjectReference)(ref arNetworkObjectReferences[i])).TryGet(ref val3, (NetworkManager)null))
				{
					GrabbableObject component = ((Component)val3).GetComponent<GrabbableObject>();
					if (component.itemProperties.isScrap)
					{
						component.SetScrapValue(arScrapValues[i]);
					}
					if (component.itemProperties.requiresBattery)
					{
						component.insertedBattery.charge = (bChargeBattery ? 1f : 0f);
					}
				}
			}
		}

		private IEnumerator ConversionProcess()
		{
			RefineAudioSrc.Play();
			yield return (object)new WaitForSeconds(7f);
			if ((Object)(object)roundManager == (Object)null)
			{
				SCPCBDunGen.Logger.LogInfo((object)"Getting round manager");
				roundManager = Object.FindObjectOfType<RoundManager>();
				if ((Object)(object)roundManager == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"Failed to find round manager.");
					yield break;
				}
			}
			if ((Object)(object)ScrapTransform == (Object)null)
			{
				SCP914Converter sCP914Converter = this;
				GameObject obj = GameObject.FindGameObjectWithTag("MapPropsContainer");
				sCP914Converter.ScrapTransform = ((obj != null) ? obj.transform : null);
				if ((Object)(object)ScrapTransform == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"SCPCB Failed to find props container.");
					yield break;
				}
			}
			List<NetworkObjectReference> list = new List<NetworkObjectReference>();
			List<int> list2 = new List<int>();
			bool bChargeBattery = iCurrentState > 1;
			BoxCollider inputStore = InputStore;
			if ((Object)(object)inputStore == (Object)null)
			{
				SCPCBDunGen.Logger.LogError((object)"Failed to get input store collider.");
				yield break;
			}
			Collider[] array = Physics.OverlapBox(inputStore.center + ((Component)inputStore).gameObject.transform.position, inputStore.size / 2f);
			SCPCBDunGen.Logger.LogInfo((object)$"Contained item count: {array.Length}");
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				GameObject gameObject = ((Component)val).gameObject;
				SCPCBDunGen.Logger.LogInfo((object)("Converting " + ((Object)gameObject).name));
				GrabbableObject component = gameObject.GetComponent<GrabbableObject>();
				if ((Object)(object)component != (Object)null)
				{
					SCPCBDunGen.Logger.LogInfo((object)"Converting item.");
					ConvertItem(list, list2, component);
					continue;
				}
				PlayerControllerB component2 = gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component2 != (Object)null)
				{
					SCPCBDunGen.Logger.LogInfo((object)"Converting player.");
					ConvertPlayer(component2);
					continue;
				}
				EnemyAI componentInParent = gameObject.GetComponentInParent<EnemyAI>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					SCPCBDunGen.Logger.LogInfo((object)"Converting enemy.");
					ConvertEnemy(list, list2, componentInParent);
				}
				else
				{
					SCPCBDunGen.Logger.LogWarning((object)("Unidentified object: " + ((Object)gameObject).name + ". Not converting."));
				}
			}
			SCPCBDunGen.Logger.LogInfo((object)"Finished spawning scrap, syncing with clients");
			SpawnItemsClientRpc(list.ToArray(), list2.ToArray(), bChargeBattery);
			yield return (object)new WaitForSeconds(7f);
			RefineFinishClientRpc();
			bActive = false;
		}

		private void ConvertItemToItem(List<NetworkObjectReference> lNetworkObjectReferences, List<int> lScrapValues, GrabbableObject grabbable)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 randomPositionInCollider = GetRandomPositionInCollider(colliderOutput);
			GameObject val = null;
			NetworkObject val2 = null;
			GrabbableObject val3 = null;
			if (GetItemMapping().TryGetValue(grabbable.itemProperties, out List<Item> value))
			{
				SCPCBDunGen.Logger.LogInfo((object)"Mapping found");
				Item val4 = value[roundManager.AnomalyRandom.Next(value.Count)];
				if ((Object)(object)val4 != (Object)null)
				{
					SCPCBDunGen.Logger.LogInfo((object)"Conversion found");
					val = Object.Instantiate<GameObject>(val4.spawnPrefab, randomPositionInCollider, Quaternion.identity, ScrapTransform);
					val2 = val.GetComponent<NetworkObject>();
					val3 = val.GetComponent<GrabbableObject>();
				}
			}
			else
			{
				SCPCBDunGen.Logger.LogInfo((object)"No conversion, making new item copy with new scrap value");
				val = Object.Instantiate<GameObject>(grabbable.itemProperties.spawnPrefab, randomPositionInCollider, Quaternion.identity, ScrapTransform);
				val2 = val.GetComponent<NetworkObject>();
				val3 = val.GetComponent<GrabbableObject>();
			}
			SCPCBDunGen.Logger.LogInfo((object)"Preprocessing done");
			if ((Object)(object)val3 == (Object)null)
			{
				SCPCBDunGen.Logger.LogInfo((object)"Conversion was null, item is intended to be destroyed in process.");
				return;
			}
			Item itemProperties = val3.itemProperties;
			if (itemProperties.isScrap)
			{
				SCPCBDunGen.Logger.LogInfo((object)"Item is scrap or null, generating a copy with new value");
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				int num = (int)((float)roundManager.AnomalyRandom.Next(itemProperties.minValue, itemProperties.maxValue) * roundManager.scrapValueMultiplier);
				component.SetScrapValue(num);
				SCPCBDunGen.Logger.LogInfo((object)$"new scrap value: {num}");
				lScrapValues.Add(num);
			}
			else
			{
				SCPCBDunGen.Logger.LogInfo((object)"Item is not scrap, adding empty scrap value");
				lScrapValues.Add(0);
			}
			val2.Spawn(true);
			lNetworkObjectReferences.Add(NetworkObjectReference.op_Implicit(val2));
		}

		private void ConvertItemToEnemy(GrabbableObject grabbable, EnemyType enemyType)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput);
			roundManager.SpawnEnemyGameObject(randomNavMeshPositionInCollider, 0f, -1, enemyType);
		}

		private void ConvertItem(List<NetworkObjectReference> lNetworkObjectReferences, List<int> lScrapValues, GrabbableObject grabbable)
		{
			if (grabbable.isHeld)
			{
				return;
			}
			SCPCBDunGen.Logger.LogInfo((object)("Found grabbable item " + ((Object)grabbable.itemProperties).name));
			Dictionary<Item, List<Item>> itemMapping = GetItemMapping();
			Dictionary<Item, List<EnemyType>> itemEnemyMapping = GetItemEnemyMapping();
			if (itemEnemyMapping.TryGetValue(grabbable.itemProperties, out var value))
			{
				if (roundManager.AnomalyRandom.Next(2) == 0 && itemMapping.ContainsKey(grabbable.itemProperties))
				{
					ConvertItemToItem(lNetworkObjectReferences, lScrapValues, grabbable);
				}
				else
				{
					ConvertItemToEnemy(grabbable, value[roundManager.AnomalyRandom.Next(value.Count)]);
				}
			}
			else
			{
				ConvertItemToItem(lNetworkObjectReferences, lScrapValues, grabbable);
			}
			Object.Destroy((Object)(object)((Component)grabbable).gameObject);
		}

		[ClientRpc]
		private void ConvertPlayerTeleportClientRpc(NetworkBehaviourReference netBehaviourRefPlayer, Vector3 vPosition)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0111: 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(3018499267u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref vPosition);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3018499267u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkBehaviour val3 = null;
				((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null);
				if ((Object)(object)val3 == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"Failed to get player controller.");
					return;
				}
				PlayerControllerB val4 = (PlayerControllerB)val3;
				val4.TeleportPlayer(vPosition, false, 0f, false, true);
			}
		}

		[ClientRpc]
		private void ConvertPlayerKillClientRpc(NetworkBehaviourReference netBehaviourRefPlayer)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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(1252059581u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1252059581u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkBehaviour val3 = null;
				((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null);
				if ((Object)(object)val3 == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"Failed to get player controller.");
					return;
				}
				PlayerControllerB val4 = (PlayerControllerB)val3;
				val4.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 0, default(Vector3));
			}
		}

		[ClientRpc]
		private void ConvertPlayerAlterHealthClientRpc(NetworkBehaviourReference netBehaviourRefPlayer, int iHealthDelta)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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(527346026u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, iHealthDelta);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 527346026u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkBehaviour val3 = null;
				((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null);
				if ((Object)(object)val3 == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"Failed to get player controller.");
					return;
				}
				PlayerControllerB val4 = (PlayerControllerB)val3;
				val4.DamagePlayer(iHealthDelta, true, true, (CauseOfDeath)8, 0, false, default(Vector3));
			}
		}

		[ClientRpc]
		private void ConvertPlayerRandomSkinClientRpc(NetworkBehaviourReference netBehaviourRefPlayer, int iSuitID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			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(1669287785u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, iSuitID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1669287785u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			if ((Object)(object)StartOfRound == (Object)null)
			{
				StartOfRound = Object.FindObjectOfType<StartOfRound>();
				if ((Object)(object)StartOfRound == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"Failed to find StartOfRound.");
					return;
				}
			}
			NetworkBehaviour val3 = null;
			((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null);
			if ((Object)(object)val3 == (Object)null)
			{
				SCPCBDunGen.Logger.LogError((object)"Failed to get player controller.");
				return;
			}
			PlayerControllerB val4 = (PlayerControllerB)val3;
			int num = 0;
			foreach (UnlockableItem unlockable in StartOfRound.unlockablesList.unlockables)
			{
				if ((Object)(object)unlockable.suitMaterial != (Object)null)
				{
					SCPCBDunGen.Logger.LogInfo((object)$"Found suit at index {num}");
				}
				num++;
			}
			UnlockableItem val5 = StartOfRound.unlockablesList.unlockables[iSuitID];
			if (val5 == null)
			{
				SCPCBDunGen.Logger.LogError((object)$"Invalid suit ID: {iSuitID}");
				return;
			}
			Material suitMaterial = val5.suitMaterial;
			((Renderer)val4.thisPlayerModel).material = suitMaterial;
			((Renderer)val4.thisPlayerModelLOD1).material = suitMaterial;
			((Renderer)val4.thisPlayerModelLOD2).material = suitMaterial;
			((Renderer)val4.thisPlayerModelArms).material = suitMaterial;
			val4.currentSuitID = iSuitID;
		}

		private void ConvertPlayerRandomSkin(PlayerControllerB playerController)
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)StartOfRound == (Object)null)
			{
				StartOfRound = Object.FindObjectOfType<StartOfRound>();
				if ((Object)(object)StartOfRound == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"Failed to find StartOfRound.");
					return;
				}
			}
			List<int> list = new List<int>();
			int num = 0;
			foreach (UnlockableItem unlockable in StartOfRound.unlockablesList.unlockables)
			{
				if ((Object)(object)unlockable.suitMaterial != (Object)null && num != playerController.currentSuitID)
				{
					list.Add(num);
				}
				num++;
			}
			int count = list.Count;
			if (count == 0)
			{
				SCPCBDunGen.Logger.LogError((object)"No suits to swap to found.");
				return;
			}
			int index = roundManager.AnomalyRandom.Next(0, count);
			NetworkBehaviourReference netBehaviourRefPlayer = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController);
			ConvertPlayerRandomSkinClientRpc(netBehaviourRefPlayer, list[index]);
		}

		private IEnumerator ConvertPlayerMaskedWaitForSpawn(NetworkObjectReference netObjRefMasked, NetworkBehaviourReference netBehaviourRefPlayer)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			NetworkObject netObjMasked = null;
			NetworkBehaviour netBehaviourPlayer = null;
			float fStartTime = Time.realtimeSinceStartup;
			yield return (object)new WaitUntil((Func<bool>)(() => Time.realtimeSinceStartup - fStartTime > 20f || ((NetworkObjectReference)(ref netObjRefMasked)).TryGet(ref netObjMasked, (NetworkManager)null)));
			yield return (object)new WaitUntil((Func<bool>)(() => Time.realtimeSinceStartup - fStartTime > 20f || ((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref netBehaviourPlayer, (NetworkManager)null)));
			PlayerControllerB playerController = (PlayerControllerB)netBehaviourPlayer;
			if ((Object)(object)playerController.deadBody == (Object)null)
			{
				yield return (object)new WaitUntil((Func<bool>)(() => Time.realtimeSinceStartup - fStartTime > 20f || (Object)(object)playerController.deadBody != (Object)null));
			}
			if ((Object)(object)playerController.deadBody != (Object)null)
			{
				playerController.deadBody.DeactivateBody(false);
				if ((Object)(object)netObjMasked != (Object)null)
				{
					MaskedPlayerEnemy component = ((Component)netObjMasked).GetComponent<MaskedPlayerEnemy>();
					component.mimickingPlayer = playerController;
					component.SetSuit(playerController.currentSuitID);
					((EnemyAI)component).SetEnemyOutside(false);
					playerController.redirectToEnemy = (EnemyAI)(object)component;
				}
			}
		}

		[ClientRpc]
		private void ConvertPlayerMaskedClientRpc(NetworkObjectReference netObjRefMasked, NetworkBehaviourReference netBehaviourRefPlayer)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_011f: 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)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: 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(358260797u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRefMasked, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 358260797u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			NetworkBehaviour val3 = null;
			((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null);
			if ((Object)(object)val3 == (Object)null)
			{
				SCPCBDunGen.Logger.LogError((object)"Failed to get player controller.");
				return;
			}
			PlayerControllerB val4 = (PlayerControllerB)val3;
			val4.KillPlayer(Vector3.zero, true, (CauseOfDeath)5, 0, default(Vector3));
			if ((Object)(object)val4.deadBody != (Object)null)
			{
				val4.deadBody.DeactivateBody(false);
			}
			((MonoBehaviour)this).StartCoroutine(ConvertPlayerMaskedWaitForSpawn(netObjRefMasked, netBehaviourRefPlayer));
		}

		private void ConvertPlayerMasked(NetworkBehaviourReference netBehaviourRefPlayer, Vector3 vMaskedPosition)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			NetworkBehaviour val = null;
			((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val, (NetworkManager)null);
			if ((Object)(object)val == (Object)null)
			{
				SCPCBDunGen.Logger.LogError((object)"Failed to get player controller.");
				return;
			}
			PlayerControllerB val2 = (PlayerControllerB)val;
			val2.KillPlayer(Vector3.zero, true, (CauseOfDeath)5, 0, default(Vector3));
			if ((Object)(object)StartOfRound == (Object)null)
			{
				StartOfRound = Object.FindObjectOfType<StartOfRound>();
				if ((Object)(object)StartOfRound == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"Failed to find StartOfRound.");
					return;
				}
			}
			if ((Object)(object)MaskedType == (Object)null)
			{
				SelectableLevel val3 = Array.Find(StartOfRound.levels, (SelectableLevel x) => x.PlanetName == "8 Titan");
				if ((Object)(object)val3 == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"Failed to get Titan level data.");
					return;
				}
				MaskedType = val3.Enemies.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == "Masked")?.enemyType;
				if ((Object)(object)MaskedType == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"Failed to get masked enemy type.");
					return;
				}
			}
			NetworkObjectReference netObjRefMasked = roundManager.SpawnEnemyGameObject(vMaskedPosition, 0f, -1, MaskedType);
			NetworkObject val4 = default(NetworkObject);
			if (((NetworkObjectReference)(ref netObjRefMasked)).TryGet(ref val4, (NetworkManager)null))
			{
				SCPCBDunGen.Logger.LogInfo((object)"Got network object for mask enemy");
				MaskedPlayerEnemy component = ((Component)val4).GetComponent<MaskedPlayerEnemy>();
				component.SetSuit(val2.currentSuitID);
				component.mimickingPlayer = val2;
				((EnemyAI)component).SetEnemyOutside(false);
				val2.redirectToEnemy = (EnemyAI)(object)component;
				if ((Object)(object)val2.deadBody != (Object)null)
				{
					val2.deadBody.DeactivateBody(false);
				}
			}
			ConvertPlayerMaskedClientRpc(netObjRefMasked, netBehaviourRefPlayer);
		}

		private void ConvertPlayer(PlayerControllerB playerController)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			SCPCBDunGen.Logger.LogInfo((object)"Player detected, doing player conversion");
			SCP914Setting sCP914Setting = (SCP914Setting)iCurrentState;
			Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput);
			NetworkBehaviourReference netBehaviourRefPlayer = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController);
			ConvertPlayerTeleportClientRpc(netBehaviourRefPlayer, randomNavMeshPositionInCollider);
			switch (sCP914Setting)
			{
			case SCP914Setting.ROUGH:
				ConvertPlayerKillClientRpc(netBehaviourRefPlayer);
				break;
			case SCP914Setting.COARSE:
				ConvertPlayerAlterHealthClientRpc(netBehaviourRefPlayer, 50);
				break;
			case SCP914Setting.ONETOONE:
				ConvertPlayerRandomSkin(playerController);
				break;
			case SCP914Setting.FINE:
				ConvertPlayerAlterHealthClientRpc(netBehaviourRefPlayer, -50);
				break;
			case SCP914Setting.VERYFINE:
				if (!playerController.AllowPlayerDeath())
				{
					SCPCBDunGen.Logger.LogInfo((object)"Refined player with Very Fine, but player death is prevented. Doing nothing.");
				}
				else
				{
					ConvertPlayerMasked(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController), randomNavMeshPositionInCollider);
				}
				break;
			default:
				SCPCBDunGen.Logger.LogError((object)"Invalid SCP 914 setting when attempting to convert player.");
				break;
			}
		}

		[ClientRpc]
		private void TeleportEnemyClientRpc(NetworkBehaviourReference netBehaviourRefEnemy, Vector3 vPosition)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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(2839432350u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefEnemy, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref vPosition);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2839432350u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkBehaviour val3 = null;
				((NetworkBehaviourReference)(ref netBehaviourRefEnemy)).TryGet(ref val3, (NetworkManager)null);
				if ((Object)(object)val3 == (Object)null)
				{
					SCPCBDunGen.Logger.LogError((object)"Failed to get enemy AI.");
					return;
				}
				EnemyAI val4 = (EnemyAI)val3;
				val4.serverPosition = vPosition;
			}
		}

		private void MoveEnemy(EnemyAI enemy, Vector3 NavPosition)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			SCPCBDunGen.Logger.LogInfo((object)$"No conversions for enemy: {enemy.enemyType.enemyName}. Teleporting to {NavPosition}");
			NetworkBehaviourReference netBehaviourRefEnemy = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)enemy);
			TeleportEnemyClientRpc(netBehaviourRefEnemy, NavPosition);
			enemy.agent.Warp(NavPosition);
			enemy.SyncPositionToClients();
			if (iCurrentState == 0)
			{
				enemy.KillEnemyOnOwnerClient(false);
			}
		}

		private void ConvertEnemyToEnemy(EnemyAI enemy)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<EnemyType, List<EnemyType>> enemyMapping = GetEnemyMapping();
			Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput);
			if (enemyMapping.TryGetValue(enemy.enemyType, out var value) && value.Count != 0)
			{
				EnemyType val = value[roundManager.AnomalyRandom.Next(value.Count)];
				roundManager.SpawnEnemyGameObject(randomNavMeshPositionInCollider, 0f, -1, val);
				Object.Destroy((Object)(object)((Component)enemy).gameObject);
			}
			MoveEnemy(enemy, randomNavMeshPositionInCollider);
		}

		private void ConvertEnemyToItem(List<NetworkObjectReference> lNetworkObjectReferences, List<int> lScrapValues, EnemyAI enemy)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			Vector3 randomPositionInCollider = GetRandomPositionInCollider(colliderOutput);
			GameObject val = null;
			NetworkObject val2 = null;
			GrabbableObject val3 = null;
			if (GetEnemyItemMapping().TryGetValue(enemy.enemyType, out List<Item> value))
			{
				SCPCBDunGen.Logger.LogInfo((object)"Mapping found");
				Item val4 = value[roundManager.AnomalyRandom.Next(value.Count)];
				Object.Destroy((Object)(object)((Component)enemy).gameObject);
				if ((Object)(object)val4 != (Object)null)
				{
					SCPCBDunGen.Logger.LogInfo((object)"Conversion found");
					val = Object.Instantiate<GameObject>(val4.spawnPrefab, randomPositionInCollider, Quaternion.identity, ScrapTransform);
					val2 = val.GetComponent<NetworkObject>();
					val3 = val.GetComponent<GrabbableObject>();
				}
			}
			else
			{
				SCPCBDunGen.Logger.LogInfo((object)"No conversion, teleporting enemy");
				Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput);
				MoveEnemy(enemy, randomNavMeshPositionInCollider);
			}
			SCPCBDunGen.Logger.LogInfo((object)"Preprocessing done");
			if ((Object)(object)val3 == (Object)null)
			{
				SCPCBDunGen.Logger.LogInfo((object)"Conversion was null, item is intended to be destroyed in process.");
				return;
			}
			Item itemProperties = val3.itemProperties;
			if (itemProperties.isScrap)
			{
				SCPCBDunGen.Logger.LogInfo((object)"Item is scrap or null, generating a copy with new value");
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				int num = (int)((float)roundManager.AnomalyRandom.Next(itemProperties.minValue, itemProperties.maxValue) * roundManager.scrapValueMultiplier);
				component.SetScrapValue(num);
				SCPCBDunGen.Logger.LogInfo((object)$"new scrap value: {num}");
				lScrapValues.Add(num);
			}
			else
			{
				SCPCBDunGen.Logger.LogInfo((object)"Item is not scrap, adding empty scrap value");
				lScrapValues.Add(0);
			}
			val2.Spawn(true);
			lNetworkObjectReferences.Add(NetworkObjectReference.op_Implicit(val2));
		}

		private void ConvertEnemy(List<NetworkObjectReference> lNetworkObjectReferences, List<int> lScrapValues, EnemyAI enemy)
		{
			//IL_0082: 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)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<EnemyType, List<Item>> enemyItemMapping = GetEnemyItemMapping();
			Dictionary<EnemyType, List<EnemyType>> enemyMapping = GetEnemyMapping();
			if (GetEnemyMapping().TryGetValue(enemy.enemyType, out List<EnemyType> _))
			{
				if (roundManager.AnomalyRandom.Next(2) == 0 && GetEnemyItemMapping().ContainsKey(enemy.enemyType))
				{
					ConvertEnemyToItem(lNetworkObjectReferences, lScrapValues, enemy);
				}
				else
				{
					ConvertEnemyToEnemy(enemy);
				}
			}
			else if (GetEnemyItemMapping().ContainsKey(enemy.enemyType))
			{
				ConvertEnemyToItem(lNetworkObjectReferences, lScrapValues, enemy);
			}
			else
			{
				Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput);
				MoveEnemy(enemy, randomNavMeshPositionInCollider);
			}
			Object.Destroy((Object)(object)((Component)enemy).gameObject);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SCP914Converter()
		{
			//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
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2627837757u, new RpcReceiveHandler(__rpc_handler_2627837757));
			NetworkManager.__rpc_func_table.Add(301590527u, new RpcReceiveHandler(__rpc_handler_301590527));
			NetworkManager.__rpc_func_table.Add(1051910848u, new RpcReceiveHandler(__rpc_handler_1051910848));
			NetworkManager.__rpc_func_table.Add(3833341719u, new RpcReceiveHandler(__rpc_handler_3833341719));
			NetworkManager.__rpc_func_table.Add(4143732333u, new RpcReceiveHandler(__rpc_handler_4143732333));
			NetworkManager.__rpc_func_table.Add(4044311993u, new RpcReceiveHandler(__rpc_handler_4044311993));
			NetworkManager.__rpc_func_table.Add(3018499267u, new RpcReceiveHandler(__rpc_handler_3018499267));
			NetworkManager.__rpc_func_table.Add(1252059581u, new RpcReceiveHandler(__rpc_handler_1252059581));
			NetworkManager.__rpc_func_table.Add(527346026u, new RpcReceiveHandler(__rpc_handler_527346026));
			NetworkManager.__rpc_func_table.Add(1669287785u, new RpcReceiveHandler(__rpc_handler_1669287785));
			NetworkManager.__rpc_func_table.Add(358260797u, new RpcReceiveHandler(__rpc_handler_358260797));
			NetworkManager.__rpc_func_table.Add(2839432350u, new RpcReceiveHandler(__rpc_handler_2839432350));
		}

		private static void __rpc_handler_2627837757(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;
				((SCP914Converter)(object)target).TurnStateServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_1051910848(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;
				((SCP914Converter)(object)target).ActivateServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3833341719(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;
				((SCP914Converter)(object)target).ActivateClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4143732333(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;
				((SCP914Converter)(object)target).RefineFinishClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4044311993(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				NetworkObjectReference[] arNetworkObjectReferences = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref arNetworkObjectReferences, default(ForNetworkSerializable));
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				int[] arScrapValues = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref arScrapValues, default(ForPrimitives));
				}
				bool bChargeBattery = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref bChargeBattery, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP914Converter)(object)target).SpawnItemsClientRpc(arNetworkObjectReferences, arScrapValues, bChargeBattery);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3018499267(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference netBehaviourRefPlayer = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable));
				Vector3 vPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref vPosition);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP914Converter)(object)target).ConvertPlayerTeleportClientRpc(netBehaviourRefPlayer, vPosition);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1252059581(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference netBehaviourRefPlayer = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP914Converter)(object)target).ConvertPlayerKillClientRpc(netBehaviourRefPlayer);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_527346026(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference netBehaviourRefPlayer = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable));
				int iHealthDelta = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref iHealthDelta);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP914Converter)(object)target).ConvertPlayerAlterHealthClientRpc(netBehaviourRefPlayer, iHealthDelta);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1669287785(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference netBehaviourRefPlayer = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable));
				int iSuitID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref iSuitID);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP914Converter)(object)target).ConvertPlayerRandomSkinClientRpc(netBehaviourRefPlayer, iSuitID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_358260797(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netObjRefMasked = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRefMasked, default(ForNetworkSerializable));
				NetworkBehaviourReference netBehaviourRefPlayer = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP914Converter)(object)target).ConvertPlayerMaskedClientRpc(netObjRefMasked, netBehaviourRefPlayer);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2839432350(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference netBehaviourRefEnemy = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefEnemy, default(ForNetworkSerializable));
				Vector3 vPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref vPosition);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP914Converter)(object)target).TeleportEnemyClientRpc(netBehaviourRefEnemy, vPosition);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SCP914Converter";
		}
	}
	public class SCPDoorMover : NetworkBehaviour
	{
		public NavMeshObstacle navObstacle;

		public Animator doors;

		public List<AudioClip> doorAudioClips;

		public AudioClip doorAudioClipFast;

		public AudioSource doorSFXSource;

		public InteractTrigger ButtonA;

		public InteractTrigger ButtonB;

		private bool bDoorOpen;

		private bool bDoorWaiting;

		private List<EnemyAICollisionDetect> EnemiesInCollider = new List<EnemyAICollisionDetect>();

		private void OnTriggerEnter(Collider other)
		{
			if (!((Object)(object)NetworkManager.Singleton == (Object)null) && ((NetworkBehaviour)this).IsServer && ((Component)other).CompareTag("Enemy"))
			{
				EnemyAICollisionDetect component = ((Component)other).GetComponent<EnemyAICollisionDetect>();
				if (!((Object)(object)component == (Object)null))
				{
					SCPCBDunGen.Logger.LogInfo((object)("Enemy entered trigger: " + ((Object)component.mainScript.enemyType).name));
					EnemiesInCollider.Add(component);
				}
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if (!((Object)(object)NetworkManager.Singleton == (Object)null) && ((NetworkBehaviour)this).IsServer && ((Component)other).CompareTag("Enemy"))
			{
				EnemyAICollisionDetect component = ((Component)other).GetComponent<EnemyAICollisionDetect>();
				if (!((Object)(object)component == (Object)null) && !EnemiesInCollider.Remove(component))
				{
					SCPCBDunGen.Logger.LogWarning((object)"Enemy left door trigger but somehow wasn't detected in trigger entry.");
				}
			}
		}

		private void Update()
		{
			if ((Object)(object)NetworkManager.Singleton == (Object)null || !((NetworkBehaviour)this).IsServer || bDoorOpen || bDoorWaiting || EnemiesInCollider.Count == 0)
			{
				return;
			}
			SCPCBDunGen.Logger.LogInfo((object)"Enemy attempting to open door...");
			float num = 0f;
			foreach (EnemyAICollisionDetect item in EnemiesInCollider)
			{
				EnemyAI mainScript = item.mainScript;
				if (!mainScript.isEnemyDead)
				{
					SCPCBDunGen.Logger.LogInfo((object)$"Enemy {((Object)mainScript.enemyType).name} with open mult {mainScript.openDoorSpeedMultiplier}");
					float val = mainScript.openDoorSpeedMultiplier;
					if (((Object)mainScript.enemyType).name == "MaskedPlayerEnemy")
					{
						val = 1f;
					}
					if (((Object)mainScript.enemyType).name == "Crawler")
					{
						val = 2f;
					}
					num = Math.Max(num, val);
				}
			}
			SCPCBDunGen.Logger.LogInfo((object)$"Highest multiplier is {num}.");
			if (num != 0f)
			{
				SCPCBDunGen.Logger.LogInfo((object)"Door being opened.");
				if (num > 1.5f)
				{
					OpenDoorFastServerRpc();
				}
				else
				{
					ToggleDoorServerRpc();
				}
			}
		}

		[ServerRpc]
		public void OpenDoorFastServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(289563691u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 289563691u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SCPCBDunGen.Logger.LogInfo((object)"Opening door fast [SERVER].");
				bDoorWaiting = true;
				bDoorOpen = true;
				((Behaviour)navObstacle).enabled = false;
				OpenDoorFastClientRpc();
				((MonoBehaviour)this).StartCoroutine(DoorToggleButtonUsable());
			}
		}

		[ClientRpc]
		public void OpenDoorFastClientRpc()
		{
			//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(1678254293u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1678254293u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					SCPCBDunGen.Logger.LogInfo((object)"Opening door fast [CLIENT].");
					bDoorWaiting = true;
					bDoorOpen = true;
					ButtonA.interactable = false;
					ButtonB.interactable = false;
					((Behaviour)navObstacle).enabled = false;
					doorSFXSource.PlayOneShot(doorAudioClipFast);
					doors.SetTrigger("openfast");
				}
			}
		}

		private IEnumerator DoorToggleButtonUsable()
		{
			yield return (object)new WaitForSeconds(1f);
			bDoorWaiting = false;
			yield return (object)new WaitForSeconds(1f);
			EnableDoorButtonClientRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void ToggleDoorServerRpc()
		{
			//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(40313670u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 40313670u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !bDoorWaiting)
				{
					bool flag = !bDoorOpen;
					string text = (flag ? "opening" : "closing");
					SCPCBDunGen.Logger.LogInfo((object)("Door is " + text + "."));
					bDoorWaiting = true;
					bDoorOpen = flag;
					((Behaviour)navObstacle).enabled = !flag;
					ToggleDoorClientRpc(bDoorOpen);
					((MonoBehaviour)this).StartCoroutine(DoorToggleButtonUsable());
				}
			}
		}

		[ClientRpc]
		public void ToggleDoorClientRpc(bool _bDoorOpen)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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(659555206u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref _bDoorOpen, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 659555206u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					bDoorOpen = _bDoorOpen;
					ButtonA.interactable = false;
					ButtonB.interactable = false;
					((Behaviour)navObstacle).enabled = !_bDoorOpen;
					doorSFXSource.PlayOneShot(doorAudioClips[Random.Range(0, doorAudioClips.Count)]);
					doors.SetTrigger(bDoorOpen ? "open" : "close");
				}
			}
		}

		[ClientRpc]
		public void EnableDoorButtonClientRpc()
		{
			//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(1538705838u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1538705838u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					ButtonA.interactable = true;
					ButtonB.interactable = true;
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SCPDoorMover()
		{
			//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
			NetworkManager.__rpc_func_table.Add(289563691u, new RpcReceiveHandler(__rpc_handler_289563691));
			NetworkManager.__rpc_func_table.Add(1678254293u, new RpcReceiveHandler(__rpc_handler_1678254293));
			NetworkManager.__rpc_func_table.Add(40313670u, new RpcReceiveHandler(__rpc_handler_40313670));
			NetworkManager.__rpc_func_table.Add(659555206u, new RpcReceiveHandler(__rpc_handler_659555206));
			NetworkManager.__rpc_func_table.Add(1538705838u, new RpcReceiveHandler(__rpc_handler_1538705838));
		}

		private static void __rpc_handler_289563691(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCPDoorMover)(object)target).OpenDoorFastServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1678254293(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;
				((SCPDoorMover)(object)target).OpenDoorFastClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_40313670(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;
				((SCPDoorMover)(object)target).ToggleDoorServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_659555206(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCPDoorMover)(object)target).ToggleDoorClientRpc(flag);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1538705838(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;
				((SCPDoorMover)(object)target).EnableDoorButtonClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SCPDoorMover";
		}
	}
	public struct SCP914Conversion
	{
		public string ItemName;

		public List<string> RoughResults { get; set; }

		public List<string> CoarseResults { get; set; }

		public List<string> OneToOneResults { get; set; }

		public List<string> FineResults { get; set; }

		public List<string> VeryFineResults { get; set; }
	}
	public class SCP914ConversionSet : KeyedCollection<string, SCP914Conversion>
	{
		protected override string GetKeyForItem(SCP914Conversion conversion)
		{
			return conversion.ItemName;
		}
	}
	[BepInPlugin("SCPCBDunGen", "SCPCBDunGen", "4.3.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SCPCBDunGen : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Func<string, bool> <0>__Exists;

			public static Func<string, IEnumerable<string>> <1>__GetFiles;

			public static hook_SpawnScrapInLevel <2>__SetItemSpawnPoints;

			public static hook_SpawnScrapInLevel <3>__SCP914Configuration;
		}

		public static AssetBundle? SCPCBAssets;

		public SCP914ConversionSet SCP914Conversions = new SCP914ConversionSet();

		public static SCPCBDunGen Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			//IL_029f: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			NetcodePatcher();
			Hook();
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			SCPCBAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "scpcb_dungeon"));
			if ((Object)(object)SCPCBAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load SCPCB Dungeon assets.");
				return;
			}
			ExtendedDungeonFlow val = SCPCBAssets.LoadAsset<ExtendedDungeonFlow>("assets/Mods/SCP/data/SCPCBDunGenExtFlow.asset");
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)"Failed to load SCP:CB Extended Dungeon Flow.");
				return;
			}
			ConfigEntry<bool> val2 = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Default914Recipes", true, new ConfigDescription("If false, any custom 914 Json files named \"default.json\" will be ignored (i.e. the default 914 config will not be loaded).\nSome custom 914 implementations may want to fully override the default settings, in which case this can be set to false.", (AcceptableValueBase)null, Array.Empty<object>()));
			ConfigEntry<bool> val3 = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Compatibility", "PiggysVarietyMod", true, new ConfigDescription("If Piggys Variety Mod is present and this setting is enabled, tesla gates can spawn in the SCP Foundation.\nWARNING: Ensure this value matches across all clients or desync will occur.", (AcceptableValueBase)null, Array.Empty<object>()));
			if (val3.Value && Chainloader.PluginInfos.ContainsKey("Piggy.PiggyVarietyMod"))
			{
				CompatPVM(val);
			}
			if (Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility"))
			{
				CompatBMXLobby();
			}
			PatchedContent.RegisterExtendedDungeonFlow(val);
			foreach (string item in DiscoverConfiguredRecipeFiles())
			{
				if (!val2.Value && Path.GetFileName(item) == "default.json")
				{
					continue;
				}
				StreamReader streamReader = new StreamReader(item);
				string text = streamReader.ReadToEnd();
				try
				{
					List<SCP914Conversion> list = JsonConvert.DeserializeObject<List<SCP914Conversion>>(text);
					foreach (SCP914Conversion item2 in list)
					{
						if (SCP914Conversions.Contains(item2.ItemName.ToLowerInvariant()))
						{
							SCP914Conversions[item2.ItemName].RoughResults.AddRange(item2.RoughResults);
							SCP914Conversions[item2.ItemName].CoarseResults.AddRange(item2.CoarseResults);
							SCP914Conversions[item2.ItemName].OneToO