Decompiled source of Scopophobia v1.2.8

BepInEx/plugins/Scopophobia.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Formatters.Binary;
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 HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Scopophobia;
using Scopophobia.Data;
using Scopophobia.Dependencies;
using Scopophobia.NetcodePatcher;
using Scopophobia.Patches;
using ShyGuy.AI;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Adds SCP-096 Shy Guy To Lethal Company, Complete with Custom Animations, Sound effects, and more.")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("TheUnknownCod3r")]
[assembly: AssemblyDescription("Adds SCP-096 Shy Guy To Lethal Company, Complete with Custom Animations, Sound effects, and more.")]
[assembly: AssemblyFileVersion("1.2.8.0")]
[assembly: AssemblyInformationalVersion("1.2.8")]
[assembly: AssemblyProduct("Scopophobia")]
[assembly: AssemblyTitle("Scopophobia")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.8.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;
		}
	}
}
[HarmonyPatch(typeof(RoundManager))]
internal static class RoundManagerPatch
{
	[HarmonyPatch("LoadNewLevel")]
	[HarmonyPostfix]
	private static void LoadNewLevelPatch()
	{
		EnemyDataManager.SetEnemyDataForCurrentLevel();
	}
}
[HarmonyPatch(typeof(StartOfRound))]
internal static class StartOfRoundPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void StartPatch()
	{
		EnemyDataManager.Initialize();
	}
}
[Serializable]
public class SyncedInstance<T>
{
	[NonSerialized]
	protected static int IntSize = 4;

	internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager;

	internal static bool IsClient => NetworkManager.Singleton.IsClient;

	internal static bool IsHost => NetworkManager.Singleton.IsHost;

	public static T Default { get; private set; }

	public static T Instance { get; private set; }

	public static bool Synced { get; internal set; }

	protected void InitInstance(T instance)
	{
		Default = instance;
		Instance = instance;
		IntSize = 4;
	}

	internal static void SyncInstance(byte[] data)
	{
		Instance = DeserializeFromBytes(data);
		Synced = true;
	}

	internal static void RevertSync()
	{
		Instance = Default;
		Synced = false;
	}

	public static byte[] SerializeToBytes(T val)
	{
		BinaryFormatter binaryFormatter = new BinaryFormatter();
		using MemoryStream memoryStream = new MemoryStream();
		try
		{
			binaryFormatter.Serialize(memoryStream, val);
			return memoryStream.ToArray();
		}
		catch (Exception arg)
		{
			ScopophobiaPlugin.logger.LogError((object)$"Error serializing instance: {arg}");
			return null;
		}
	}

	public static T DeserializeFromBytes(byte[] data)
	{
		BinaryFormatter binaryFormatter = new BinaryFormatter();
		using MemoryStream serializationStream = new MemoryStream(data);
		try
		{
			return (T)binaryFormatter.Deserialize(serializationStream);
		}
		catch (Exception arg)
		{
			ScopophobiaPlugin.logger.LogError((object)$"Error deserializing instance: {arg}");
			return default(T);
		}
	}
}
namespace ShyGuy.AI
{
	public class ShyGuyAI : EnemyAI
	{
		private Transform localPlayerCamera;

		public Vector3 mainEntrancePosition;

		public Collider mainCollider;

		public static bool canSeeFace;

		public VehicleController CompanyCruiser;

		public bool pryingOpenDoor;

		public HangarShipDoor shipDoor;

		private float pryingDoorAnimTime;

		public float pryOpenDoorAnimLength;

		public AudioClip breakAndEnter;

		public AudioClip shipAlarm;

		public AudioSource breakDownDoorAudio;

		public AudioSource farAudio;

		public AudioSource footstepSource;

		public AudioClip screamSFX;

		public AudioClip panicSFX;

		public AudioClip crySFX;

		public AudioClip crySittingSFX;

		public AudioClip killPlayerSFX;

		[Header("Containment Breach Sounds")]
		public AudioClip screamSFX_CB;

		public AudioClip panicSFX_CB;

		public AudioClip crySFX_CB;

		public AudioClip killPlayerSFX_CB;

		[Header("Alpha Containment Breach Sounds")]
		public AudioClip screamSFX_ACB;

		public AudioClip panicSFX_ACB;

		public AudioClip crySFX_ACB;

		public AudioClip killPlayerSFX_ACB;

		[Header("Secret Laboratory Sounds")]
		public AudioClip screamSFX_SL;

		public AudioClip panicSFX_SL;

		public AudioClip crySFX_SL;

		public AudioClip killPlayerSFX_SL;

		private int currentClipID = -1;

		private NetworkVariable<int> syncedAudioClipID = new NetworkVariable<int>(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public Material bloodyMaterial;

		public AISearchRoutine roamMap;

		public Transform shyGuyFace;

		private Vector3 spawnPosition;

		private Vector3 previousPosition;

		private int previousState = -1;

		private float roamWaitTime = 40f;

		[Header("Teleports")]
		public static EntranceTeleport[] entranceTeleports;

		public static List<EntranceTeleport> outsideTeleports = new List<EntranceTeleport>();

		public static List<EntranceTeleport> insideTeleports = new List<EntranceTeleport>();

		public bool pathingToTeleport;

		public Vector3 closestTeleportPosition;

		public static EntranceTeleport mainEntrance;

		public EntranceTeleport closestTeleport;

		private bool roamShouldSit;

		private bool sitting;

		private float lastRunSpeed;

		private float seeFaceTime;

		private float triggerTime;

		public float triggerDuration = 66.4f;

		private float timeToTrigger = 0.5f;

		private float lastInterval;

		private bool inKillAnimation;

		private bool isInElevatorStartRoom;

		private float timeAtLastUsingEntrance;

		public NavMeshAgent agent;

		public static MineshaftElevatorController elevatorScript;

		public List<PlayerControllerB> SCP096Targets = new List<PlayerControllerB>();

		public override void Start()
		{
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Expected O, but got Unknown
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Expected O, but got Unknown
			((EnemyAI)this).Start();
			if ((Object)(object)CompanyCruiser == (Object)null)
			{
				CompanyCruiser = Object.FindObjectOfType<VehicleController>();
			}
			if ((Object)(object)shipDoor == (Object)null)
			{
				shipDoor = Object.FindObjectOfType<HangarShipDoor>();
			}
			if ((Object)(object)agent == (Object)null)
			{
				agent = ((Component)this).GetComponentInChildren<NavMeshAgent>();
			}
			if ((Object)(object)elevatorScript == (Object)null)
			{
				elevatorScript = Object.FindObjectOfType<MineshaftElevatorController>();
			}
			triggerDuration = Config.triggerTime;
			PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>();
			PlaceableShipObject[] array2 = array;
			foreach (PlaceableShipObject val in array2)
			{
				if (val.unlockableID == 15 && !((Behaviour)val).isActiveAndEnabled)
				{
					Collider[] components = ((Component)val).GetComponents<Collider>();
					foreach (Collider val2 in components)
					{
						val2.enabled = false;
					}
				}
			}
			lastInterval = Time.realtimeSinceStartup;
			Transform val3 = null;
			Queue<Transform> queue = new Queue<Transform>();
			queue.Enqueue(((Component)this).transform);
			while (queue.Count > 0)
			{
				Transform val4 = queue.Dequeue();
				if (((Object)val4).name == "lefteye")
				{
					val3 = val4;
					break;
				}
				foreach (Transform item3 in val4)
				{
					Transform item = item3;
					queue.Enqueue(item);
				}
			}
			Transform val5 = null;
			queue = new Queue<Transform>();
			queue.Enqueue(((Component)this).transform);
			while (queue.Count > 0)
			{
				Transform val6 = queue.Dequeue();
				if (((Object)val6).name == "righteye")
				{
					val5 = val6;
					break;
				}
				foreach (Transform item4 in val6)
				{
					Transform item2 = item4;
					queue.Enqueue(item2);
				}
			}
			if (!Config.hasGlowingEyes && (Object)(object)val3 != (Object)null && (Object)(object)val5 != (Object)null)
			{
				((Component)val3).gameObject.SetActive(false);
				((Component)val5).gameObject.SetActive(false);
			}
			if (Config.bloodyTexture && (Object)(object)bloodyMaterial != (Object)null)
			{
				Transform val7 = ((Component)this).transform.Find("SCP096Model");
				if ((Object)(object)val7 != (Object)null)
				{
					Transform val8 = val7.Find("tsg_placeholder");
					if ((Object)(object)val8 != (Object)null)
					{
						SkinnedMeshRenderer component = ((Component)val8).GetComponent<SkinnedMeshRenderer>();
						if ((Object)(object)component != (Object)null)
						{
							((Renderer)component).material = bloodyMaterial;
						}
					}
				}
			}
			switch (Config.soundPack)
			{
			case "SCPCB":
				screamSFX = screamSFX_CB;
				crySFX = crySFX_CB;
				crySittingSFX = crySFX_CB;
				panicSFX = panicSFX_CB;
				killPlayerSFX = killPlayerSFX_CB;
				break;
			case "SCPCBOld":
				screamSFX = screamSFX_ACB;
				crySFX = crySFX_ACB;
				crySittingSFX = crySFX_ACB;
				panicSFX = panicSFX_ACB;
				killPlayerSFX = killPlayerSFX_ACB;
				break;
			case "SecretLab":
				screamSFX = screamSFX_SL;
				crySFX = crySFX_SL;
				crySittingSFX = crySFX_SL;
				panicSFX = panicSFX_SL;
				killPlayerSFX = killPlayerSFX_SL;
				break;
			}
			localPlayerCamera = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform;
			spawnPosition = ((Component)this).transform.position;
			base.isOutside = ((Component)this).transform.position.y > -80f;
			mainEntrance = RoundManager.FindMainEntranceScript(base.isOutside);
			mainEntrancePosition = RoundManager.Instance.GetNavMeshPosition(RoundManager.FindMainEntrancePosition(true, base.isOutside), default(NavMeshHit), 5f, -1);
			base.path1 = new NavMeshPath();
			outsideTeleports.Clear();
			insideTeleports.Clear();
			entranceTeleports = Object.FindObjectsByType<EntranceTeleport>((FindObjectsSortMode)0);
			for (int k = 0; k < entranceTeleports.Length; k++)
			{
				int entranceId = entranceTeleports[k].entranceId;
				if (entranceTeleports[k].isEntranceToBuilding)
				{
					if (entranceTeleports[k].FindExitPoint() && !((Object)(object)entranceTeleports[k].entrancePoint == (Object)null))
					{
						outsideTeleports.Add(entranceTeleports[k]);
						outsideTeleports.Sort((EntranceTeleport entranceA, EntranceTeleport entranceB) => entranceA.entranceId.CompareTo(entranceB.entranceId));
					}
				}
				else if (entranceTeleports[k].FindExitPoint() && !((Object)(object)entranceTeleports[k].entrancePoint == (Object)null))
				{
					insideTeleports.Add(entranceTeleports[k]);
					insideTeleports.Sort((EntranceTeleport entranceA, EntranceTeleport entranceB) => entranceA.entranceId.CompareTo(entranceB.entranceId));
				}
			}
			if (base.isOutside)
			{
				if (base.allAINodes == null || base.allAINodes.Length == 0)
				{
					base.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
				}
				if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
				{
					((EnemyAI)this).EnableEnemyMesh(!StartOfRound.Instance.hangarDoorsClosed || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom, false);
				}
			}
			else if (base.allAINodes == null || base.allAINodes.Length == 0)
			{
				base.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
			}
			base.openDoorSpeedMultiplier = 450f;
			SetShyGuyInitialValues();
		}

		private void CalculateAnimationSpeed()
		{
			//IL_0006: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)this).transform.position - previousPosition;
			float num = ((Vector3)(ref val)).magnitude;
			if (num > 0f)
			{
				num = 1f;
			}
			lastRunSpeed = Mathf.Lerp(lastRunSpeed, num, 5f * Time.deltaTime);
			base.creatureAnimator.SetFloat("VelocityZ", lastRunSpeed);
			previousPosition = ((Component)this).transform.position;
		}

		public override void DoAIInterval()
		{
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			//IL_0709: Unknown result type (might be due to invalid IL or missing references)
			//IL_0711: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_065d: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (StartOfRound.Instance.livingPlayers == 0)
			{
				lastInterval = Time.realtimeSinceStartup;
				return;
			}
			if (base.isEnemyDead)
			{
				lastInterval = Time.realtimeSinceStartup;
				return;
			}
			if (!((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsOwner && base.currentBehaviourStateIndex != 2)
			{
				((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
			{
				if (base.stunNormalizedTimer > 0f)
				{
					agent.speed = 0f;
				}
				else if (sitting)
				{
					agent.speed = 0f;
				}
				else
				{
					roamWaitTime -= Time.realtimeSinceStartup - lastInterval;
					base.openDoorSpeedMultiplier = 1f;
					agent.speed = 2.75f * Config.speedDocileMultiplier;
				}
				base.movingTowardsTargetPlayer = false;
				agent.stoppingDistance = 4f;
				base.addPlayerVelocityToDestination = 0f;
				PlayerControllerB targetPlayer2 = base.targetPlayer;
				if (roamWaitTime <= 20f && roamMap.inProgress && (Object)(object)base.targetPlayer == (Object)null)
				{
					((EnemyAI)this).StopSearch(roamMap, true);
					lastInterval = Time.realtimeSinceStartup;
				}
				else if (roamWaitTime > 2.5f && roamWaitTime <= 15f && !roamMap.inProgress && (Object)(object)base.targetPlayer == (Object)null && roamShouldSit)
				{
					base.creatureVoice.Stop();
					sitting = true;
					base.creatureAnimator.SetBool("Sitting", true);
					if (!base.creatureVoice.isPlaying || (Object)(object)base.creatureVoice.clip != (Object)(object)crySittingSFX)
					{
						PlayAudioFxServerRpc(0);
					}
					lastInterval = Time.realtimeSinceStartup;
				}
				else
				{
					if ((Object)(object)base.targetPlayer != (Object)null || !((Object)(object)targetPlayer2 == (Object)null) || roamMap.inProgress || !(roamWaitTime <= 0f))
					{
						break;
					}
					if (!sitting)
					{
						roamShouldSit = Random.Range(1, 5) == 1;
						roamWaitTime = Random.Range(25f, 32.5f);
						((EnemyAI)this).StartSearch(spawnPosition, roamMap);
						lastInterval = Time.realtimeSinceStartup;
						break;
					}
					sitting = false;
					base.creatureVoice.Stop();
					roamShouldSit = false;
					roamWaitTime = Random.Range(21f, 25f);
					base.creatureAnimator.SetBool("Sitting", false);
					if (!base.creatureVoice.isPlaying || (Object)(object)base.creatureVoice.clip != (Object)(object)crySFX)
					{
						PlayAudioFxServerRpc(1);
					}
					lastInterval = Time.realtimeSinceStartup;
				}
				break;
			}
			case 1:
				agent.speed = 0f;
				lastInterval = Time.realtimeSinceStartup;
				base.movingTowardsTargetPlayer = false;
				break;
			case 2:
			{
				agent.stoppingDistance = 0f;
				agent.avoidancePriority = 99;
				base.openDoorSpeedMultiplier = 450f;
				mainCollider.isTrigger = true;
				base.addPlayerVelocityToDestination = 1f;
				if (inKillAnimation)
				{
					agent.speed = 0f;
				}
				else
				{
					agent.speed = Mathf.Clamp(agent.speed + (Time.realtimeSinceStartup - lastInterval) * Config.speedRageMultiplier * 1.1f, 5f * Config.speedRageMultiplier, 14.75f * Config.speedRageMultiplier);
				}
				if (SCP096Targets.Count <= 0)
				{
					SitDown();
					break;
				}
				PlayerControllerB targetPlayer = base.targetPlayer;
				float num = 0f;
				for (int num2 = SCP096Targets.Count - 1; num2 >= 0; num2--)
				{
					PlayerControllerB val = SCP096Targets[num2];
					if ((Object)(object)val == (Object)null)
					{
						SCP096Targets.RemoveAt(num2);
						ScopophobiaPlugin.Instance.LogInfoExtended("Hunted Is Null.");
					}
					else
					{
						bool flag = val.isInsideFactory == !base.isOutside;
						bool flag2 = true;
						if (!Config.canExitFacility && !flag)
						{
							flag2 = false;
						}
						if (!val.isPlayerDead && flag2)
						{
							float num3 = Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position);
							if (!val.isPlayerDead && val.isPlayerControlled && (Object)(object)val.inAnimationWithEnemy == (Object)null && val.sinkingValue < 0.73f && num3 < float.PositiveInfinity)
							{
								num = Vector3.Magnitude(((Component)val).transform.position - ((Component)this).transform.position);
								base.targetPlayer = val;
								ScopophobiaPlugin.Instance.LogInfoExtended($"{base.targetPlayer.playerClientId} is Hunted!");
							}
						}
						else
						{
							ScopophobiaPlugin.Instance.LogInfoExtended($"Removing {val.playerClientId} from the Array");
							AddTargetToList((int)val.actualClientId, remove: true);
						}
					}
				}
				if ((Object)(object)base.targetPlayer != (Object)null)
				{
					if (base.targetPlayer.isPlayerDead)
					{
						AddTargetToList((int)base.targetPlayer.actualClientId, remove: true);
					}
					base.creatureAnimator.SetFloat("DistanceToTarget", Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position));
					if (roamMap.inProgress)
					{
						((EnemyAI)this).StopSearch(roamMap, true);
					}
					if ((Object)(object)base.targetPlayer != (Object)(object)targetPlayer)
					{
						((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
					}
					if (!base.isOutside && RoundManager.Instance.currentDungeonType == 4)
					{
						TryUsingElevator();
					}
					if (base.isOutside && base.targetPlayer.isInHangarShipRoom && !pryingOpenDoor && BreakIntoShip())
					{
						break;
					}
					if (base.targetPlayer.isInsideFactory != !base.isOutside)
					{
						if (!pathingToTeleport)
						{
							GetClosestTeleportAndMove();
						}
						if (Vector3.Distance(((Component)this).transform.position, closestTeleport.entrancePoint.position) < 1f && pathingToTeleport)
						{
							TeleAndRefreshEnemy(closestTeleport.exitPoint.position, !base.isOutside);
							agent.speed = 0f;
						}
						else
						{
							base.movingTowardsTargetPlayer = false;
							((EnemyAI)this).SetDestinationToPosition(closestTeleportPosition, false);
							ScopophobiaPlugin.Instance.LogInfoExtended(((Object)base.targetPlayer).name + " is Not in area, looking for entranceteleport");
						}
					}
					else if (((EnemyAI)this).PathIsIntersectedByLineOfSight(RoundManager.Instance.GetNavMeshPosition(((Component)base.targetPlayer).transform.position, default(NavMeshHit), 5f, -1), false, false, true))
					{
						((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
					}
					else
					{
						((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
					}
				}
				else if (SCP096Targets.Count <= 0)
				{
					SitDown();
				}
				break;
			}
			default:
				lastInterval = Time.realtimeSinceStartup;
				break;
			}
		}

		public void GetClosestTeleportAndMove()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_005c: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			List<EntranceTeleport> list = (base.isOutside ? outsideTeleports : insideTeleports);
			foreach (EntranceTeleport item in list)
			{
				if (!item.FindExitPoint() || (Object)(object)item.entrancePoint == (Object)null)
				{
					continue;
				}
				NavMeshPath val = new NavMeshPath();
				if (agent.CalculatePath(((Component)item.entrancePoint).transform.position, val) && (int)val.status == 0)
				{
					float num = Vector3.Distance(((Component)this).transform.position, item.entrancePoint.position);
					float num2 = Vector3.Distance(((Component)this).transform.position, mainEntrance.entrancePoint.position);
					if (num < num2 || item.entranceId == mainEntrance.entranceId)
					{
						ScopophobiaPlugin.Instance.LogInfoExtended($"Teleport Found: {item.entranceId}. Pathing Passed tests.");
						closestTeleport = item;
						closestTeleportPosition = item.entrancePoint.position;
						pathingToTeleport = true;
						break;
					}
				}
			}
		}

		public void TryUsingElevator()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (isInElevatorStartRoom)
			{
				if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorBottomPoint.position) < 3f)
				{
					isInElevatorStartRoom = false;
				}
			}
			else if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorTopPoint.position) < 3f)
			{
				isInElevatorStartRoom = true;
			}
			if (!isInElevatorStartRoom)
			{
				UseElevator(goUp: true);
			}
			else if (!base.targetPlayer.isPlayerDead && base.targetPlayer.isPlayerControlled && base.targetPlayer.isInsideFactory && Vector3.Distance(((Component)base.targetPlayer).transform.position, elevatorScript.elevatorTopPoint.position) > 50f)
			{
				UseElevator(goUp: false);
			}
		}

		public void TeleAndRefreshEnemy(Vector3 Pos, bool setOutside)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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)
			Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(Pos, RoundManager.Instance.navHit, 5f, -1);
			ScopophobiaPlugin.Instance.LogInfoExtended("Trying to teleport enemy");
			if (!setOutside)
			{
				if (insideTeleports == null)
				{
					ScopophobiaPlugin.Instance.LogErrorExtended("Inside Teleports is Null. Aborting Teleport Attempt. Interior is " + ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name + ", Report to Interior Developer");
					return;
				}
				if ((Object)(object)closestTeleport == (Object)null)
				{
					ScopophobiaPlugin.Instance.LogErrorExtended("Closest Teleport is Null. Aborting Teleport Attempt. Interior is " + ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name + ". Please report this error to the author of this interior.");
					return;
				}
				if ((Object)(object)insideTeleports[closestTeleport.entranceId] == (Object)null)
				{
					ScopophobiaPlugin.Instance.LogErrorExtended("insideTeleports[closestTeleport.entranceId].entrancePoint is null. Aborting Teleport Attempt. Interior is " + ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name + ". Please Report to the Interior Author");
					return;
				}
				_ = insideTeleports[closestTeleport.entranceId].entrancePoint.position;
				ScopophobiaPlugin.Instance.LogInfoExtended("Attempting to teleport");
				SetEnemyOutside(setOutside);
				agent.Warp(insideTeleports[closestTeleport.entranceId].entrancePoint.position);
				if (closestTeleport.doorAudios != null && closestTeleport.doorAudios.Length != 0)
				{
					closestTeleport.entrancePointAudio.PlayOneShot(closestTeleport.doorAudios[0]);
					WalkieTalkie.TransmitOneShotAudio(closestTeleport.entrancePointAudio, closestTeleport.doorAudios[0], 1f);
				}
				pathingToTeleport = false;
				closestTeleport = null;
			}
			else if (outsideTeleports == null)
			{
				ScopophobiaPlugin.Instance.LogErrorExtended("outside Teleports is Null. Aborting Teleport Attempt. Interior is " + ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name + ", Report to Interior Developer");
			}
			else if ((Object)(object)closestTeleport == (Object)null)
			{
				ScopophobiaPlugin.Instance.LogErrorExtended("Closest Teleport is Null. Aborting Teleport Attempt. Interior is " + ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name + ". Please report this error to the author of this interior.");
			}
			else if ((Object)(object)outsideTeleports[closestTeleport.entranceId] == (Object)null)
			{
				ScopophobiaPlugin.Instance.LogErrorExtended("outsideTeleports[closestTeleport.entranceId].entrancePoint is null. Aborting Teleport Attempt. Interior is " + ((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name + ". Please Report to the Interior Author");
			}
			else
			{
				_ = outsideTeleports[closestTeleport.entranceId].entrancePoint.position;
				ScopophobiaPlugin.Instance.LogInfoExtended("Attempting to teleport");
				SetEnemyOutside(setOutside);
				agent.Warp(outsideTeleports[closestTeleport.entranceId].entrancePoint.position);
				if (closestTeleport.doorAudios != null && closestTeleport.doorAudios.Length != 0)
				{
					closestTeleport.entrancePointAudio.PlayOneShot(closestTeleport.doorAudios[0]);
					WalkieTalkie.TransmitOneShotAudio(closestTeleport.entrancePointAudio, closestTeleport.doorAudios[0], 1f);
				}
				pathingToTeleport = false;
				closestTeleport = null;
			}
		}

		private bool UseElevator(bool goUp)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((!goUp) ? elevatorScript.elevatorTopPoint.position : elevatorScript.elevatorBottomPoint.position);
			if (elevatorScript.elevatorFinishedMoving && !((EnemyAI)this).PathIsIntersectedByLineOfSight(elevatorScript.elevatorInsidePoint.position, false, false, false))
			{
				if (elevatorScript.elevatorDoorOpen && Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) < 1f && elevatorScript.elevatorMovingDown == goUp)
				{
					elevatorScript.PressElevatorButtonOnServer(true);
				}
				((EnemyAI)this).SetDestinationToPosition(elevatorScript.elevatorInsidePoint.position, false);
				return true;
			}
			if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) > 1f && !((EnemyAI)this).PathIsIntersectedByLineOfSight(val, false, false, false))
			{
				if (elevatorScript.elevatorDoorOpen && Vector3.Distance(((Component)this).transform.position, val) < 1f && elevatorScript.elevatorMovingDown != goUp && !elevatorScript.elevatorCalled)
				{
					elevatorScript.CallElevatorOnServer(goUp);
				}
				((EnemyAI)this).SetDestinationToPosition(val, false);
				return true;
			}
			return false;
		}

		public override void Update()
		{
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			GameNetworkManager instance = GameNetworkManager.Instance;
			if (base.isEnemyDead || (Object)(object)instance == (Object)null)
			{
				return;
			}
			CalculateAnimationSpeed();
			if (pryingOpenDoor && base.inSpecialAnimation)
			{
				((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, shipDoor.outsideDoorPoint.position, 7f * Time.deltaTime);
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, shipDoor.outsideDoorPoint.rotation, 7f * Time.deltaTime);
				pryingDoorAnimTime = Mathf.Min(pryingDoorAnimTime + Time.deltaTime / pryOpenDoorAnimLength, 1f);
				base.creatureAnimator.SetFloat("pryOpenDoor", pryingDoorAnimTime);
				shipDoor.shipDoorsAnimator.SetFloat("pryOpenDoor", pryingDoorAnimTime);
				base.creatureAnimator.SetLayerWeight(0, Mathf.Max(0f, base.creatureAnimator.GetLayerWeight(0) - Time.deltaTime * 5f));
				if (pryingDoorAnimTime > 0.12f)
				{
					((EnemyAI)this).EnableEnemyMesh(true, false);
				}
				BreakIntoShip();
				return;
			}
			canSeeFace = GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(shyGuyFace.position, Config.faceTriggerRange, 45, -1f);
			if (canSeeFace)
			{
				float num = Quaternion.Angle(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.rotation, shyGuyFace.rotation);
				if (!(num <= 145f))
				{
					canSeeFace = false;
				}
			}
			if (canSeeFace)
			{
				seeFaceTime += Time.deltaTime;
				if (seeFaceTime >= Config.faceTriggerGracePeriod)
				{
					GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1.25f, true);
					if (!Config.hasMaxTargets || SCP096Targets.Count < Config.maxTargets)
					{
						ScopophobiaPlugin.Instance.LogInfoExtended($"Adding {GameNetworkManager.Instance.localPlayerController.actualClientId} To Targets. Has Seen Face: {canSeeFace}");
						AddTargetToList((int)GameNetworkManager.Instance.localPlayerController.actualClientId);
					}
					if (base.currentBehaviourStateIndex == 0)
					{
						ScopophobiaPlugin.Instance.LogInfoExtended("Switching to triggered State");
						((EnemyAI)this).SwitchToBehaviourState(1);
					}
				}
			}
			else
			{
				seeFaceTime = Mathf.Clamp(seeFaceTime - Time.deltaTime, 0f, timeToTrigger);
				if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1f, 30f, 60, -1f) && base.currentBehaviourStateIndex == 0)
				{
					if (!base.thisNetworkObject.IsOwner)
					{
						((EnemyAI)this).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
					}
					if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) < 10f)
					{
						GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.65f, true);
					}
					else
					{
						GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.25f, true);
					}
				}
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (previousState != 0)
				{
					SetShyGuyInitialValues();
					previousState = 0;
					mainCollider.isTrigger = true;
					farAudio.volume = 0f;
					base.creatureVoice.Stop();
					if (!base.creatureVoice.isPlaying || (Object)(object)base.creatureVoice.clip != (Object)(object)crySittingSFX)
					{
						PlayAudioFxServerRpc(0);
					}
				}
				if (roamMap.inProgress)
				{
					base.creatureVoice.Stop();
					if (!base.creatureVoice.isPlaying || (Object)(object)base.creatureVoice.clip != (Object)(object)crySFX)
					{
						PlayAudioFxServerRpc(1);
					}
				}
				break;
			case 1:
				if (previousState != 1)
				{
					previousState = 1;
					sitting = false;
					mainCollider.isTrigger = true;
					base.creatureAnimator.SetBool("Rage", false);
					base.creatureAnimator.SetBool("Sitting", false);
					base.creatureAnimator.SetBool("triggered", true);
					base.creatureVoice.Stop();
					if (!base.creatureVoice.isPlaying || (Object)(object)base.creatureVoice.clip != (Object)(object)panicSFX)
					{
						PlayAudioFxServerRpc(2);
					}
					agent.speed = 0f;
					triggerTime = triggerDuration;
				}
				triggerTime -= Time.deltaTime;
				if (triggerTime <= 0f)
				{
					((EnemyAI)this).SwitchToBehaviourState(2);
				}
				break;
			case 2:
				if (previousState != 2)
				{
					mainCollider.isTrigger = true;
					previousState = 2;
					base.creatureAnimator.SetBool("Rage", true);
					base.creatureAnimator.SetBool("triggered", false);
					farAudio.Stop();
					if (!base.creatureVoice.isPlaying || (Object)(object)base.creatureVoice.clip != (Object)(object)screamSFX)
					{
						PlayAudioFxServerRpc(3);
					}
				}
				break;
			}
			((EnemyAI)this).Update();
		}

		[ServerRpc]
		public void PlayAudioFxServerRpc(int audioClipID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)((NetworkBehaviour)this).__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(780869395u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, audioClipID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 780869395u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				PlayAudioFXClientRpc(audioClipID);
			}
		}

		[ClientRpc]
		public void PlayAudioFXClientRpc(int audioClipID)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3609315749u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, audioClipID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3609315749u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				switch (audioClipID)
				{
				case 0:
				{
					farAudio.Stop();
					base.creatureVoice.Stop();
					base.creatureVoice.volume = Config.VolumeConfigs * 0.1f;
					base.creatureVoice.clip = crySittingSFX;
					base.creatureVoice.loop = true;
					float time4 = base.creatureVoice.time;
					base.creatureVoice.time = time4;
					base.creatureVoice.Play();
					break;
				}
				case 1:
				{
					base.creatureVoice.Stop();
					base.creatureVoice.volume = Config.VolumeConfigs * 0.1f;
					base.creatureVoice.clip = crySFX;
					base.creatureVoice.loop = true;
					float time3 = base.creatureVoice.time;
					base.creatureVoice.time = time3;
					base.creatureVoice.Play();
					break;
				}
				case 2:
				{
					base.creatureVoice.Stop();
					farAudio.volume = Config.VolumeConfigs * 0.1f;
					farAudio.clip = panicSFX;
					float time2 = farAudio.time;
					farAudio.loop = true;
					farAudio.time = time2;
					farAudio.Play();
					break;
				}
				case 3:
				{
					farAudio.Stop();
					farAudio.volume = Config.VolumeConfigs * 0.1f - 0.1f;
					farAudio.clip = screamSFX;
					float time = farAudio.time;
					farAudio.loop = true;
					farAudio.time = time;
					farAudio.Play();
					break;
				}
				}
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsClient)
			{
				NetworkVariable<int> obj = syncedAudioClipID;
				obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnAudioClipChanged));
				if (syncedAudioClipID.Value >= 0)
				{
					PlayAudioFxServerRpc(syncedAudioClipID.Value);
				}
			}
		}

		private void OnAudioClipChanged(int oldValue, int newValue)
		{
			if (newValue >= 0)
			{
				PlayAudioFxServerRpc(newValue);
			}
		}

		public void SetEnemyOutside(bool outside = false)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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)
			base.isOutside = outside;
			mainEntrancePosition = RoundManager.Instance.GetNavMeshPosition(RoundManager.FindMainEntrancePosition(true, outside), default(NavMeshHit), 5f, -1);
			if (!outside)
			{
				base.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
			}
			else
			{
				base.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			if (!Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>()))
			{
				return;
			}
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (!inKillAnimation && !base.isEnemyDead && base.currentBehaviourStateIndex == 2)
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null && SCP096Targets.Contains(val))
				{
					inKillAnimation = true;
					((MonoBehaviour)this).StartCoroutine(killPlayerAnimation((int)val.playerClientId));
					KillPlayerServerRpc((int)val.playerClientId);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void KillPlayerServerRpc(int playerId)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2556963367u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2556963367u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					KillPlayerClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		private void KillPlayerClientRpc(int playerId)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2298532976u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2298532976u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StartCoroutine(killPlayerAnimation(playerId));
				}
			}
		}

		private IEnumerator killPlayerAnimation(int playerId)
		{
			inKillAnimation = true;
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId];
			if (base.isOutside && ((Component)this).transform.position.y < -80f)
			{
				SetEnemyOutside();
			}
			else if (!base.isOutside && ((Component)this).transform.position.y > -80f)
			{
				SetEnemyOutside(outside: true);
			}
			int count = SCP096Targets.Count;
			val.KillPlayer(((Component)val).transform.position, true, (CauseOfDeath)6, 1, default(Vector3));
			AddTargetToList(playerId, remove: true);
			base.creatureSFX.clip = killPlayerSFX;
			base.creatureSFX.Play();
			base.creatureAnimator.SetInteger("TargetsLeft", count - 1);
			base.creatureAnimator.SetTrigger("kill");
			if (count - 1 <= 0)
			{
				SitDown();
			}
			if (Config.deathMakesBloody && (Object)(object)bloodyMaterial != (Object)null)
			{
				Transform val2 = ((Component)this).transform.Find("SCP096Model");
				if ((Object)(object)val2 != (Object)null)
				{
					Transform val3 = val2.Find("tsg_placeholder");
					if ((Object)(object)val3 != (Object)null)
					{
						SkinnedMeshRenderer component = ((Component)val3).GetComponent<SkinnedMeshRenderer>();
						if ((Object)(object)component != (Object)null)
						{
							((Renderer)component).material = bloodyMaterial;
						}
					}
				}
			}
			yield return (object)new WaitForSeconds(1f);
			inKillAnimation = false;
		}

		public void SitDown()
		{
			((EnemyAI)this).SwitchToBehaviourState(0);
			SitDownOnLocalClient();
			SitDownServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		private void SitDownServerRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(652446748u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 652446748u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SitDownClientRpc();
				}
			}
		}

		[ClientRpc]
		private void SitDownClientRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2536632143u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2536632143u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					SitDownOnLocalClient();
				}
			}
		}

		public void SitDownOnLocalClient()
		{
			sitting = true;
			roamWaitTime = Random.Range(45f, 50f);
			base.creatureAnimator.SetBool("Rage", false);
			base.creatureAnimator.SetBool("Sitting", true);
		}

		public void AddTargetToList(int playerId, bool remove = false)
		{
			PlayerControllerB item = StartOfRound.Instance.allPlayerScripts[playerId];
			if (remove)
			{
				if (!SCP096Targets.Contains(item))
				{
					return;
				}
			}
			else if (SCP096Targets.Contains(item))
			{
				return;
			}
			AddTargetToListOnLocalClient(playerId, remove);
			AddTargetToListServerRpc(playerId, remove);
		}

		[ServerRpc(RequireOwnership = false)]
		public void AddTargetToListServerRpc(int playerId, bool remove)
		{
			//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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1207108010u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref remove, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1207108010u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					AddTargetToListClientRpc(playerId, remove);
				}
			}
		}

		[ClientRpc]
		public void AddTargetToListClientRpc(int playerId, bool remove)
		{
			//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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1413965488u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref remove, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1413965488u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					AddTargetToListOnLocalClient(playerId, remove);
				}
			}
		}

		public void AddTargetToListOnLocalClient(int playerId, bool remove)
		{
			PlayerControllerB item = StartOfRound.Instance.allPlayerScripts[playerId];
			if (remove)
			{
				if (SCP096Targets.Contains(item))
				{
					SCP096Targets.Remove(item);
				}
			}
			else if (!SCP096Targets.Contains(item))
			{
				SCP096Targets.Add(item);
			}
		}

		private void BeginPryOpenDoor()
		{
			StartPryOpenDoorAnimationOnLocalClient();
			PryOpenDoorServerRpc((int)GameNetworkManager.Instance.localPlayerController.actualClientId);
		}

		private void FinishPryOpenDoor(bool cancelledEarly)
		{
			FinishPryOpenDoorAnimationOnLocalClient(cancelledEarly);
			PryOpenDoorServerRpc((int)GameNetworkManager.Instance.localPlayerController.actualClientId, finishAnim: true, cancelledEarly);
		}

		[ServerRpc(RequireOwnership = false)]
		public void PryOpenDoorServerRpc(int playerWhoSent, bool finishAnim = false, bool cancelledEarly = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3983190202u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerWhoSent);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref finishAnim, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref cancelledEarly, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3983190202u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PryOpenDoorClientRpc(playerWhoSent, finishAnim, cancelledEarly);
				}
			}
		}

		[ClientRpc]
		public void PryOpenDoorClientRpc(int playerWhoSent, bool finishAnim = false, bool cancelledEarly = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2274076407u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerWhoSent);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref finishAnim, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref cancelledEarly, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2274076407u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (!finishAnim)
				{
					StartPryOpenDoorAnimationOnLocalClient();
				}
				else
				{
					FinishPryOpenDoorAnimationOnLocalClient(cancelledEarly);
				}
			}
		}

		private void FinishPryOpenDoorAnimationOnLocalClient(bool cancelledEarly = false)
		{
			if (!cancelledEarly)
			{
				shipDoor.shipDoorsAnimator.SetBool("Closed", false);
				StartOfRound.Instance.SetShipDoorsClosed(false);
				StartOfRound.Instance.SetShipDoorsOverheatLocalClient();
				shipDoor.doorPower = 0f;
			}
			pryingOpenDoor = false;
			base.inSpecialAnimation = false;
			base.creatureAnimator.SetBool("PryingOpenDoor", false);
			shipDoor.shipDoorsAnimator.SetBool("PryingOpenDoor", false);
			base.creatureAnimator.SetLayerWeight(0, 1f);
		}

		private void StartPryOpenDoorAnimationOnLocalClient()
		{
			//IL_008d: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			((Behaviour)agent).enabled = false;
			pryingOpenDoor = true;
			base.inSpecialAnimation = true;
			base.creatureAnimator.SetBool("PryingOpenDoor", true);
			shipDoor.shipDoorsAnimator.SetBool("PryingOpenDoor", true);
			shipDoor.shipDoorsAnimator.SetFloat("pryOpenDoor", 0f);
			breakDownDoorAudio.PlayOneShot(breakAndEnter);
			WalkieTalkie.TransmitOneShotAudio(breakDownDoorAudio, breakAndEnter, 1f);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 0.9f, 0, false, 0);
			StartOfRound.Instance.speakerAudioSource.PlayOneShot(shipAlarm);
			WalkieTalkie.TransmitOneShotAudio(StartOfRound.Instance.speakerAudioSource, shipAlarm, 1f);
			if (Vector3.Distance(((Component)StartOfRound.Instance.audioListener).transform.position, ((Component)this).transform.position) < 18f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
			}
		}

		public bool BreakIntoShip()
		{
			if ((Object)(object)shipDoor == (Object)null)
			{
				Debug.LogError((object)"Scopophobia error: ship door is null");
				return false;
			}
			if (pryingOpenDoor)
			{
				if (pryingDoorAnimTime >= 1f)
				{
					FinishPryOpenDoor(cancelledEarly: false);
				}
				return true;
			}
			if (CanStartPrying())
			{
				BeginPryOpenDoor();
				return true;
			}
			return false;
		}

		private bool CanStartPrying()
		{
			if (StartOfRound.Instance.hangarDoorsClosed && IsDestinationInShip())
			{
				return IsNearShipDoor();
			}
			return false;
		}

		private bool IsDestinationInShip()
		{
			//IL_000a: 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)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = StartOfRound.Instance.shipStrictInnerRoomBounds.bounds;
			return ((Bounds)(ref bounds)).Contains(base.destination);
		}

		private bool IsNearShipDoor()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			return Vector3.Distance(((Component)this).transform.position, shipDoor.outsideDoorPoint.position) < 4f;
		}

		private void SetShyGuyInitialValues()
		{
			mainCollider = ((Component)this).gameObject.GetComponentInChildren<Collider>();
			farAudio = ((Component)((Component)this).transform.Find("FarAudio")).GetComponent<AudioSource>();
			base.creatureVoice = ((Component)((Component)this).transform.Find("CreatureVoice")).GetComponent<AudioSource>();
			base.targetPlayer = null;
			inKillAnimation = false;
			pryingOpenDoor = false;
			base.updateDestinationInterval = 0.1f;
			agent.autoTraverseOffMeshLink = true;
			SCP096Targets.Clear();
			base.creatureAnimator.SetFloat("VelocityX", 0f);
			base.creatureAnimator.SetFloat("VelocityZ", 0f);
			base.creatureAnimator.SetFloat("DistanceToTarget", 999f);
			base.creatureAnimator.SetFloat("pryOpenDoor", 999f);
			base.creatureAnimator.SetInteger("SitActionTimer", 0);
			base.creatureAnimator.SetInteger("TargetsLeft", 0);
			base.creatureAnimator.SetBool("Rage", false);
			base.creatureAnimator.SetBool("Sitting", false);
			base.creatureAnimator.SetBool("triggered", false);
			base.creatureAnimator.SetBool("PryingOpenDoor", false);
			mainCollider.isTrigger = true;
			farAudio.volume = 0f;
			farAudio.Stop();
			base.creatureVoice.Stop();
		}

		protected override void __initializeVariables()
		{
			if (syncedAudioClipID == null)
			{
				throw new Exception("ShyGuyAI.syncedAudioClipID cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)syncedAudioClipID).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)syncedAudioClipID, "syncedAudioClipID");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)syncedAudioClipID);
			((EnemyAI)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ShyGuyAI()
		{
			//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
			NetworkManager.__rpc_func_table.Add(780869395u, new RpcReceiveHandler(__rpc_handler_780869395));
			NetworkManager.__rpc_func_table.Add(3609315749u, new RpcReceiveHandler(__rpc_handler_3609315749));
			NetworkManager.__rpc_func_table.Add(2556963367u, new RpcReceiveHandler(__rpc_handler_2556963367));
			NetworkManager.__rpc_func_table.Add(2298532976u, new RpcReceiveHandler(__rpc_handler_2298532976));
			NetworkManager.__rpc_func_table.Add(652446748u, new RpcReceiveHandler(__rpc_handler_652446748));
			NetworkManager.__rpc_func_table.Add(2536632143u, new RpcReceiveHandler(__rpc_handler_2536632143));
			NetworkManager.__rpc_func_table.Add(1207108010u, new RpcReceiveHandler(__rpc_handler_1207108010));
			NetworkManager.__rpc_func_table.Add(1413965488u, new RpcReceiveHandler(__rpc_handler_1413965488));
			NetworkManager.__rpc_func_table.Add(3983190202u, new RpcReceiveHandler(__rpc_handler_3983190202));
			NetworkManager.__rpc_func_table.Add(2274076407u, new RpcReceiveHandler(__rpc_handler_2274076407));
		}

		private static void __rpc_handler_780869395(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_0070: 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_009d: 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
			{
				int audioClipID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref audioClipID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ShyGuyAI)(object)target).PlayAudioFxServerRpc(audioClipID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3609315749(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 audioClipID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref audioClipID);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShyGuyAI)(object)target).PlayAudioFXClientRpc(audioClipID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2556963367(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 playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ShyGuyAI)(object)target).KillPlayerServerRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2298532976(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 playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShyGuyAI)(object)target).KillPlayerClientRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_652446748(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;
				((ShyGuyAI)(object)target).SitDownServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2536632143(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;
				((ShyGuyAI)(object)target).SitDownClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1207108010(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				bool remove = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref remove, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ShyGuyAI)(object)target).AddTargetToListServerRpc(playerId, remove);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1413965488(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				bool remove = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref remove, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShyGuyAI)(object)target).AddTargetToListClientRpc(playerId, remove);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3983190202(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerWhoSent = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoSent);
				bool finishAnim = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref finishAnim, default(ForPrimitives));
				bool cancelledEarly = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref cancelledEarly, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ShyGuyAI)(object)target).PryOpenDoorServerRpc(playerWhoSent, finishAnim, cancelledEarly);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2274076407(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerWhoSent = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoSent);
				bool finishAnim = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref finishAnim, default(ForPrimitives));
				bool cancelledEarly = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref cancelledEarly, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShyGuyAI)(object)target).PryOpenDoorClientRpc(playerWhoSent, finishAnim, cancelledEarly);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ShyGuyAI";
		}
	}
}
namespace Scopophobia
{
	[Serializable]
	public class Config : SyncedInstance<Config>
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__OnRequestSync;

			public static HandleNamedMessageDelegate <1>__OnReceiveSync;
		}

		public static ConfigEntry<bool> ExtendedLoggingConfig;

		public static ConfigEntry<bool> AppearsConfig;

		public static ConfigEntry<bool> HasGlowingEyesConfig;

		public static ConfigEntry<string> SoundPackConfig;

		public static ConfigEntry<bool> BloodyTextureConfig;

		public static ConfigEntry<bool> DeathMakesBloodyConfig;

		public static ConfigEntry<float> SpeedDocileMultiplierConfig;

		public static ConfigEntry<float> SpeedRageMultiplierConfig;

		public static ConfigEntry<float> VolumeConfig;

		public static ConfigEntry<float> TriggerTimeConfig;

		public static ConfigEntry<float> FaceTriggerRangeConfig;

		public static ConfigEntry<float> FaceTriggerGracePeriodConfig;

		public static ConfigEntry<bool> HasMaxTargetsConfig;

		public static ConfigEntry<int> MaxTargetsConfig;

		public static ConfigEntry<bool> CanExitFacilityConfig;

		public static ConfigEntry<string> SpawnProbabilityCurveConfig;

		public static ConfigEntry<float> ShyGuyPowerLevelConfig;

		public static ConfigEntry<int> paintingSpawnRateConfig;

		public static ConfigEntry<bool> hidePaintingNameConfig;

		public static ConfigEntry<string> nameToUseForPaintingConfig;

		public static ConfigEntry<int> ChanceOfShyGuyConfig;

		public static ConfigEntry<bool> TwitchIntegrationConfig;

		public static bool ExtendedLogging;

		public static bool appears;

		public static bool hasGlowingEyes;

		public static string soundPack;

		public static bool bloodyTexture;

		public static bool deathMakesBloody;

		public static bool DisableSpawnRates;

		public static float speedDocileMultiplier;

		public static float speedRageMultiplier;

		public static float VolumeConfigs;

		public static float triggerTime;

		public static float faceTriggerRange;

		public static float faceTriggerGracePeriod;

		public static bool hasMaxTargets;

		public static int maxTargets;

		public static bool canExitFacility;

		public static string SpawnProbabilityCurve;

		public static float midEnemySpawnCurve;

		public static float endEnemySpawnCurve;

		public static bool spawnOutsideHardPlanets;

		public static bool twitchIntegration;

		public static float ShyGuyPowerLevel;

		public static int PaintingSpawnRate;

		public static bool hidePaintingName;

		public static string nameToUseForPainting;

		public static int ChanceOfShyGuy;

		public static void SetModIcon(Sprite sprite)
		{
			if (LethalConfigProxy.Enabled)
			{
				LethalConfigProxy.SetModIcon(sprite);
			}
		}

		public static void SetModDescription(string description)
		{
			if (LethalConfigProxy.Enabled)
			{
				LethalConfigProxy.SetModDescription(description);
			}
		}

		public static void SkipAutoGen()
		{
			if (LethalConfigProxy.Enabled)
			{
				LethalConfigProxy.SkipAutoGen();
			}
		}

		public Config(ConfigFile cfg)
		{
			InitInstance(this);
			BindConfigs(cfg);
			SetupChangedEvents();
		}

		public void BindConfigs(ConfigFile cfg)
		{
			SkipAutoGen();
			AppearsConfig = Bind("General", "Enable the Shy Guy", defaultValue: true, requiresRestart: true, "Allows the Shy Guy to spawn in-game.");
			ExtendedLoggingConfig = Bind("General", "Enable Extended Logging", defaultValue: false, requiresRestart: false, "Enables Error and Warning Logs [Developer]");
			HasGlowingEyesConfig = Bind("Appearance", "Glowing Eyes", defaultValue: true, requiresRestart: false, "Gives the Shy Guy glowing eyes similar to the Bracken/Flowerman.");
			BloodyTextureConfig = Bind("Appearance", "Bloody Texture", defaultValue: false, requiresRestart: false, "Gives the Shy Guy his bloodier, original texture from SCP: Containment Breach.");
			DeathMakesBloodyConfig = Bind("Appearance", "Bloody Death", defaultValue: true, requiresRestart: false, "Causes the Shy Guy's material to become bloody once getting his first kill. Useless if Bloody Texture is enabled lol");
			SoundPackConfig = Bind("Appearance", "Sound Pack (Curated, SCPCB, SCPCBOld, SecretLab)", "Curated", requiresRestart: false, "Determines the sounds the Shy Guy uses. (SOME MAY NOT SYNC WELL WITH TRIGGER TIME) (Curated = Default, curated for the Lethal Company experience) (SCPCB = SCP-096 sounds from SCP: Containment Breach) (SCPCBOld = Old alpha SCP-096 sounds from SCP: Containment Breach) (SecretLab = SCP-096 sounds from SCP: Secret Laboratory)");
			SpeedDocileMultiplierConfig = Bind("General", "Speed Multiplier (Docile)", 1f, requiresRestart: false, "Determines the speed multiplier of the Shy Guy while docile.");
			SpeedRageMultiplierConfig = Bind("General", "Speed Multiplier (Rage)", 1f, requiresRestart: false, "Determines the speed multiplier of the Shy Guy while enraged.");
			VolumeConfig = Bind("General", "Enemy Volume", 5f, requiresRestart: false, "Determines the volume of the Shy Guy, and how loud he is. (Set this Anywhere between 0 and 10. Default: 5f, Old Default: 5f)");
			TriggerTimeConfig = Bind("Trigger Settings", "Trigger Time", 66.4f, requiresRestart: true, "Determines how long the Shy Guy must remain in the Triggered state to become fully enraged.");
			FaceTriggerRangeConfig = Bind("Trigger Settings", "Face Trigger Range", 17.5f, requiresRestart: true, "Determines the face's trigger radius.");
			FaceTriggerGracePeriodConfig = Bind("Trigger Settings", "Face Trigger Grace Period", 0.5f, requiresRestart: true, "Determines the grace period when you see the face of the Shy Guy before he becomes enraged.");
			HasMaxTargetsConfig = Bind("Trigger Settings", "Has Max Targets", defaultValue: false, requiresRestart: true, "Determines if the Shy Guy has a maximum amount of targets.");
			MaxTargetsConfig = Bind("Trigger Settings", "Max Targets", 32, requiresRestart: true, "Determines the max amount of targets the Shy Guy can have. (requires HasMaxTargets)");
			CanExitFacilityConfig = Bind("Trigger Settings", "Can Exit Facility", defaultValue: true, requiresRestart: false, "Determines if the Shy Guy can exit the facility and into the outdoors (and vice versa) to attack its target.");
			SpawnProbabilityCurveConfig = Bind("Spawn Settings", "ProbabilityCurve", "1.0, 1.0, 1.0", requiresRestart: false, "Determines how likely Shy guy is to spawn throughout the day. Accepts an array of floats with each entry separated by a comma.");
			ShyGuyPowerLevelConfig = Bind("Spawn Settings", "Shy Guy Power Level", 3f, requiresRestart: false, "Default Power Level for the Shy Guy to take up per level. (Default: 3.0)");
			paintingSpawnRateConfig = Bind("Painting Spawn Settings", "Shy Guy Painting Spawn Rarity", 5, requiresRestart: true, "Default Spawn Rarity for the ShyGuyPainting (Default: 5)");
			hidePaintingNameConfig = Bind("Painting Spawn Settings", "Hide Painting Name before Interaction", defaultValue: true, requiresRestart: true, "Disguise the painting as a different Loot Item? (Default: True)");
			nameToUseForPaintingConfig = Bind("Painting Spawn Settings", "Custom Painting Name", "Fancy Painting", requiresRestart: true, "Customise the Scannode name for the item on the map! (Default: Fancy Painting");
			ChanceOfShyGuyConfig = Bind("Painting Spawn Settings", "Spawn Chance", 35, requiresRestart: true, "Customise the spawn chance of shy guy spawning from the painting. Higher values mean more likely, lower values mean less likely. (Set to 100 for guaranteed spawns");
			appears = AppearsConfig.Value;
			ExtendedLogging = ExtendedLoggingConfig.Value;
			hasGlowingEyes = HasGlowingEyesConfig.Value;
			bloodyTexture = BloodyTextureConfig.Value;
			deathMakesBloody = DeathMakesBloodyConfig.Value;
			soundPack = SoundPackConfig.Value;
			speedDocileMultiplier = SpeedDocileMultiplierConfig.Value;
			speedRageMultiplier = SpeedRageMultiplierConfig.Value;
			VolumeConfigs = VolumeConfig.Value;
			triggerTime = TriggerTimeConfig.Value;
			faceTriggerRange = FaceTriggerRangeConfig.Value;
			faceTriggerGracePeriod = FaceTriggerGracePeriodConfig.Value;
			hasMaxTargets = HasMaxTargetsConfig.Value;
			maxTargets = MaxTargetsConfig.Value;
			canExitFacility = CanExitFacilityConfig.Value;
			SpawnProbabilityCurve = SpawnProbabilityCurveConfig.Value;
			ShyGuyPowerLevel = ShyGuyPowerLevelConfig.Value;
			PaintingSpawnRate = paintingSpawnRateConfig.Value;
			hidePaintingName = hidePaintingNameConfig.Value;
			nameToUseForPainting = nameToUseForPaintingConfig.Value;
			ChanceOfShyGuy = ChanceOfShyGuyConfig.Value;
		}

		private void SetupChangedEvents()
		{
			SpawnProbabilityCurveConfig.SettingChanged += SpawnProbabilityCurve_SettingChanged;
		}

		private void SpawnProbabilityCurve_SettingChanged(object sender, EventArgs e)
		{
			EnemyHelper.SetProbabilityCurve("Shy guy", Utils.ToFloatsArray(SpawnProbabilityCurveConfig.Value));
		}

		public static void RequestSync()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!SyncedInstance<Config>.IsClient)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1);
			try
			{
				SyncedInstance<Config>.MessageManager.SendNamedMessage("Scopophobia_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3);
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		public static void OnRequestSync(ulong clientId, FastBufferReader _)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			if (!SyncedInstance<Config>.IsHost)
			{
				return;
			}
			Plugin.logger.LogInfo((object)$"Config sync request received from client: {clientId}");
			byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance);
			int num = array.Length;
			int num2 = FastBufferWriter.GetWriteSize<byte>(array, -1, 0) + SyncedInstance<Config>.IntSize;
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(num2, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0);
				SyncedInstance<Config>.MessageManager.SendNamedMessage("Scopophobia_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3);
			}
			catch (Exception arg)
			{
				Plugin.logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}");
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, bool requiresRestart, string description, AcceptableValueBase acceptableValues = null, Action<T> settingChanged = null, ConfigFile configFile = null)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			Action<T> settingChanged2 = settingChanged;
			if (configFile == null)
			{
				configFile = ((BaseUnityPlugin)ScopophobiaPlugin.Instance).Config;
			}
			ConfigEntry<T> configEntry = ((acceptableValues == null) ? configFile.Bind<T>(section, key, defaultValue, description) : configFile.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty<object>())));
			if (settingChanged2 != null)
			{
				configEntry.SettingChanged += delegate
				{
					settingChanged2?.Invoke(configEntry.Value);
				};
			}
			if (LethalConfigProxy.Enabled)
			{
				if (acceptableValues == null)
				{
					LethalConfigProxy.AddConfig<T>(configEntry, requiresRestart);
				}
				else
				{
					LethalConfigProxy.AddConfigSlider<T>(configEntry, requiresRestart);
				}
			}
			return configEntry;
		}

		public static void OnReceiveSync(ulong _, FastBufferReader reader)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize))
			{
				Plugin.logger.LogError((object)"Config sync error: Could not begin reading buffer.");
				return;
			}
			int num = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
			if (!((FastBufferReader)(ref reader)).TryBeginRead(num))
			{
				Plugin.logger.LogError((object)"Config sync error: Host could not sync.");
				return;
			}
			byte[] data = new byte[num];
			((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0);
			SyncedInstance<Config>.SyncInstance(data);
			Plugin.logger.LogInfo((object)"Successfully synced config with host.");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		public static void InitializeLocalPlayer()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			if (SyncedInstance<Config>.IsHost)
			{
				CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager;
				object obj = <>O.<0>__OnRequestSync;
				if (obj == null)
				{
					HandleNamedMessageDelegate val = OnRequestSync;
					<>O.<0>__OnRequestSync = val;
					obj = (object)val;
				}
				messageManager.RegisterNamedMessageHandler("Scopophobia_OnRequestConfigSync", (HandleNamedMessageDelegate)obj);
				SyncedInstance<Config>.Synced = true;
				return;
			}
			SyncedInstance<Config>.Synced = false;
			CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager;
			object obj2 = <>O.<1>__OnReceiveSync;
			if (obj2 == null)
			{
				HandleNamedMessageDelegate val2 = OnReceiveSync;
				<>O.<1>__OnReceiveSync = val2;
				obj2 = (object)val2;
			}
			messageManager2.RegisterNamedMessageHandler("Scopophobia_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2);
			RequestSync();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
		public static void PlayerLeave()
		{
			SyncedInstance<Config>.RevertSync();
		}
	}
	internal static class EnemyDataManager
	{
		public const string EnemyName = "Shy guy";

		private static bool _initialized;

		public static List<EnemyData> EnemyDataList { get; private set; } = new List<EnemyData>();


		public static void Initialize()
		{
			if (!_initialized)
			{
				_initialized = true;
				InitializeEnemyDataList();
			}
		}

		private static void InitializeEnemyDataList()
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				Plugin.logger.LogError((object)"Failed to initialize enemy data list. StartOfRound Instance is null. (EnemyName: Shy guy)");
				return;
			}
			EnemyType enemyType = EnemyHelper.GetEnemyType("Shy guy");
			if ((Object)(object)enemyType == (Object)null)
			{
				Plugin.logger.LogError((object)"Failed to initialize enemy data list. EnemyType is null. (EnemyName: Shy guy)");
				return;
			}
			EnemyHelper.SetProbabilityCurve("Shy guy", Utils.ToFloatsArray(Config.SpawnProbabilityCurve));
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				if (val.spawnEnemiesAndScrap)
				{
					AddEnemyData(val);
				}
			}
			foreach (EnemyData enemyData in EnemyDataList)
			{
				int value = enemyData.ConfigData.SpawnWeight.Value;
				if (enemyData.ConfigData.SpawnInside.Value)
				{
					LevelHelper.AddEnemyToLevel(enemyData.PlanetName, "Shy guy", value, EnemyListType.Inside);
				}
				else
				{
					LevelHelper.RemoveEnemyFromLevel(enemyData.PlanetName, "Shy guy", EnemyListType.Inside);
				}
				if (enemyData.ConfigData.SpawnOutside.Value)
				{
					LevelHelper.AddEnemyToLevel(enemyData.PlanetName, "Shy guy", value, EnemyListType.Outside);
				}
				else
				{
					LevelHelper.RemoveEnemyFromLevel(enemyData.PlanetName, "Shy guy", EnemyListType.Outside);
				}
			}
		}

		public static void AddEnemyData(SelectableLevel level)
		{
			if (HasEnemyData(level.PlanetName))
			{
				Plugin.logger.LogWarning((object)("Failed to add enemy data for level \"" + level.PlanetName + "\". Enemy data already exists for SelectableLevel."));
				return;
			}
			EnemyType enemyType = EnemyHelper.GetEnemyType("Shy guy");
			if ((Object)(object)enemyType == (Object)null)
			{
				Plugin.logger.LogError((object)("Failed to add enemy data for level \"" + level.PlanetName + "\". EnemyType is null"));
				return;
			}
			int spawnWeight;
			bool flag = LevelHelper.LevelHasEnemy(level.PlanetName, "Shy guy", EnemyListType.Inside, out spawnWeight);
			int spawnWeight2;
			bool flag2 = LevelHelper.LevelHasEnemy(level.PlanetName, "Shy guy", EnemyListType.Outside, out spawnWeight2);
			int spawnWeight3 = 0;
			if (flag && flag2)
			{
				spawnWeight3 = Mathf.Max(spawnWeight, spawnWeight2);
			}
			else if (flag)
			{
				spawnWeight3 = spawnWeight;
			}
			else if (flag2)
			{
				spawnWeight3 = spawnWeight2;
			}
			EnemyConfigDataDefault defaultConfigValues = new EnemyConfigDataDefault(spawnWeight3, enemyType.MaxCount, flag, flag2);
			EnemyData enemyData = new EnemyData(level.PlanetName, defaultConfigValues);
			enemyData.BindConfigs();
			EnemyDataList.Add(enemyData);
		}

		public static EnemyData GetEnemyData(string planetName)
		{
			foreach (EnemyData enemyData in EnemyDataList)
			{
				if (enemyData.PlanetName == planetName)
				{
					return enemyData;
				}
			}
			return null;
		}

		public static bool HasEnemyData(string planetName)
		{
			return GetEnemyData(planetName) != null;
		}

		public static void SetEnemyDataForCurrentLevel()
		{
			EnemyData enemyData = GetEnemyData(LevelHelper.CurrentPlanetName);
			if (enemyData == null)
			{
				Plugin.logger.LogError((object)("Failed to set enemy data for current level. EnemyData is null. (PlanetName: " + LevelHelper.CurrentPlanetName + ")"));
			}
			else
			{
				EnemyHelper.SetMaxSpawnCount("Shy guy", enemyData.ConfigData.MaxSpawnCount.Value, LevelHelper.CurrentPlanetName);
			}
		}
	}
	public enum EnemyListType
	{
		Inside,
		Outside,
		Daytime
	}
	internal static class EnemyHelper
	{
		public static void SetSpawnWeight(string enemyName, int spawnWeight, EnemyListType enemyListType, string planetName)
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy spawn weight. StartOfRound Instance is null. (EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)}, PlanetName: {planetName})");
				return;
			}
			EnemyType enemyType = GetEnemyType(enemyName);
			if ((Object)(object)enemyType == (Object)null)
			{
				ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy spawn weight. EnemyType is null. (EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)}, PlanetName: {planetName})");
				return;
			}
			SelectableLevel levelByName = LevelHelper.GetLevelByName(planetName);
			if ((Object)(object)levelByName == (Object)null)
			{
				ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy spawn weight. SelectableLevel is null. (EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)}, PlanetName: {planetName})");
				return;
			}
			if (!LevelHelper.LevelHasEnemy(planetName, enemyName, enemyListType))
			{
				ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy spawn weight. SelectableLevel does not contain enemy. (EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)}, PlanetName: {planetName})");
				return;
			}
			List<SpawnableEnemyWithRarity> enemyList = LevelHelper.GetEnemyList(levelByName, enemyListType);
			foreach (SpawnableEnemyWithRarity item in enemyList)
			{
				if ((Object)(object)item.enemyType == (Object)(object)enemyType)
				{
					item.rarity = spawnWeight;
					break;
				}
			}
			ScopophobiaPlugin.Instance.LogInfoExtended($"Set enemy spawn weight. (EnemyName: {enemyName}, SpawnWeight: {spawnWeight}, EnemyListType: {Utils.GetEnumName(enemyListType)}, PlanetName: {planetName})");
		}

		public static void SetMaxSpawnCount(string enemyName, int maxSpawnCount, string planetName)
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy max spawn count. StartOfRound Instance is null. (EnemyName: {enemyName}, MaxSpawnCount: {maxSpawnCount}, PlanetName: {planetName})");
				return;
			}
			if (!LevelHelper.IsCurrentLevel(planetName))
			{
				ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy max spawn count. Planet name is not the current planet name. (EnemyName: {enemyName}, MaxSpawnCount: {maxSpawnCount}, PlanetName: {planetName})");
				return;
			}
			EnemyType enemyType = GetEnemyType(enemyName);
			if ((Object)(object)enemyType == (Object)null)
			{
				ScopophobiaPlugin.logger.LogError((object)$"Failed to set enemy max spawn count. EnemyType is null. (EnemyName: {enemyName}, MaxSpawnCount: {maxSpawnCount}, PlanetName: {planetName})");
				return;
			}
			enemyType.MaxCount = maxSpawnCount;
			ScopophobiaPlugin.Instance.LogInfoExtended($"Set enemy max spawn count. (EnemyName: {enemyName}, MaxSpawnCount: {maxSpawnCount}, PlanetName: {planetName})");
		}

		public static void SetProbabilityCu