Decompiled source of SCP053 v1.0.4

SCP053.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using GameNetcodeStuff;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using SCP053.NetcodePatcher;
using SCP053.Scripts;
using SCP053.Utils;
using SCP682.SCPEnemy;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SCP053")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("SCP053")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b99349799be4105ed6ef7bd031a22144bcdd0034")]
[assembly: AssemblyProduct("SCP053")]
[assembly: AssemblyTitle("SCP053")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SCP053
{
	[BepInPlugin("projectSCP.scp053", "scp053", "1.0.4")]
	public class Scp053Plugin : BaseUnityPlugin
	{
		private const string GUID = "projectSCP.scp053";

		private const string NAME = "scp053";

		private const string VERSION = "1.0.4";

		public static Scp053Plugin instance;

		public bool isSCP682Installed;

		public static string SCP682pReferenceChain = "ProjectSCP.SCP682";

		public GameObject SCP053ActionsObject;

		public Scp053Actions currentSCP053Actions;

		public ConfigEntry<string> spawnMoonRarity;

		public ConfigEntry<int> maxSpawn;

		public ConfigEntry<int> powerLevel;

		public ConfigEntry<float> freezePlayerTime;

		public ConfigEntry<float> timeUntilDeath;

		public ConfigEntry<int> playerCurseDamage;

		private void Awake()
		{
			instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Scp053 starting....");
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "scp053");
			AssetBundle bundle = AssetBundle.LoadFromFile(text);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Scp053 bundle found !");
			NetcodePatcher();
			LoadConfigs();
			RegisterMonster(bundle);
			Check682();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Scp053 is ready!");
		}

		public void Check682()
		{
			if (Chainloader.PluginInfos.ContainsKey(SCP682pReferenceChain))
			{
				Debug.Log((object)"SCP682 found !");
				isSCP682Installed = true;
			}
		}

		private string RarityString(int rarity)
		{
			return $"Modded:{rarity},ExperimentationLevel:{rarity},AssuranceLevel:{rarity},VowLevel:{rarity},OffenseLevel:{rarity},MarchLevel:{rarity},RendLevel:{rarity},DineLevel:{rarity},TitanLevel:{rarity},Adamance:{rarity},Embrion:{rarity},Artifice:{rarity}";
		}

		private void LoadConfigs()
		{
			spawnMoonRarity = ((BaseUnityPlugin)this).Config.Bind<string>("General", "SpawnRarity", "Modded:65,ExperimentationLevel:55,AssuranceLevel:55,VowLevel:55,OffenseLevel:55,MarchLevel:55,RendLevel:65,DineLevel:65,TitanLevel:70,Adamance:50,Embrion:60,Artifice:70", "Chance for SCP 053 to spawn for any moon, example => assurance:100,offense:50 . You need to restart the game.");
			CreateStringConfig(spawnMoonRarity, requireRestart: true);
			maxSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("General", "maxSpawn", 1, "Max SCP053 spawn in one day");
			CreateIntConfig(maxSpawn, 1, 30);
			powerLevel = ((BaseUnityPlugin)this).Config.Bind<int>("General", "powerLevel", 1, "SCP053 power level");
			CreateIntConfig(powerLevel, 1, 10);
			freezePlayerTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "freezePlayerTimePercent", 0.5f, "Freeze player duration when she sees a player. This is a percent of timeUntilDeath config value");
			CreateFloatConfig(freezePlayerTime, 0f, 1f);
			timeUntilDeath = ((BaseUnityPlugin)this).Config.Bind<float>("General", "timeUntilDeath", 10f, "Time needed to SCP053 to look at a player and kill him if she don't loose line of sight");
			CreateFloatConfig(timeUntilDeath, 3f, 11f);
			playerCurseDamage = ((BaseUnityPlugin)this).Config.Bind<int>("General", "playerCurseDamage", 2, "Curse damage when a player sees another player");
			CreateIntConfig(playerCurseDamage);
		}

		private void RegisterMonster(AssetBundle bundle)
		{
			EnemyType val = bundle.LoadAsset<EnemyType>("Assets/LethalCompany/Mods/SCP053/SCP053.asset");
			TerminalNode terminalNode = bundle.LoadAsset<TerminalNode>("Assets/LethalCompany/Mods/SCP053/SCP053TerminalNode.asset");
			TerminalKeyword terminalKeyword = bundle.LoadAsset<TerminalKeyword>("Assets/LethalCompany/Mods/SCP053/SCP053TerminalKeyword.asset");
			val.MaxCount = maxSpawn.Value;
			val.PowerLevel = powerLevel.Value;
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)val).name + " FOUND"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"{val.enemyPrefab} prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Utilities.FixMixerGroups(val.enemyPrefab);
			RegisterUtil.RegisterEnemyWithConfig(spawnMoonRarity.Value, val, terminalNode, terminalKeyword, val.PowerLevel, val.MaxCount);
			SCP053ActionsObject = bundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/SCP053/SCP053Actions.prefab");
			((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)SCP053ActionsObject).name + " FOUND"));
		}

		public void SpawnActionsObject()
		{
			if (!((Object)(object)currentSCP053Actions != (Object)null))
			{
				GameObject val = Object.Instantiate<GameObject>(SCP053ActionsObject);
				currentSCP053Actions = val.GetComponent<Scp053Actions>();
				Debug.Log((object)(((Object)currentSCP053Actions).name + " SPAWNED"));
			}
		}

		private static void NetcodePatcher()
		{
			Type[] array;
			try
			{
				array = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				array = ex.Types.Where((Type type) => type != null).ToArray();
			}
			Type[] array2 = array;
			foreach (Type type2 in array2)
			{
				MethodInfo[] methods = type2.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					try
					{
						if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
						{
							methodInfo.Invoke(null, null);
						}
					}
					catch
					{
					}
				}
			}
		}

		private void CreateFloatConfig(ConfigEntry<float> configEntry, float min = 0f, float max = 100f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = min;
			((BaseRangeOptions<float>)val).Max = max;
			((BaseOptions)val).RequiresRestart = false;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		private void CreateIntConfig(ConfigEntry<int> configEntry, int min = 0, int max = 100)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			IntSliderOptions val = new IntSliderOptions();
			((BaseRangeOptions<int>)val).Min = min;
			((BaseRangeOptions<int>)val).Max = max;
			((BaseOptions)val).RequiresRestart = false;
			IntSliderConfigItem val2 = new IntSliderConfigItem(configEntry, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		private void CreateStringConfig(ConfigEntry<string> configEntry, bool requireRestart = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			TextInputFieldConfigItem val = new TextInputFieldConfigItem(configEntry, new TextInputFieldOptions
			{
				RequiresRestart = requireRestart
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}

		public bool StringContain(string name, string verifiedName)
		{
			string text = name.ToLower();
			while (text.Contains(" "))
			{
				text = text.Replace(" ", "");
			}
			string text2 = verifiedName.ToLower();
			while (text2.Contains(" "))
			{
				text2 = text2.Replace(" ", "");
			}
			return text.Contains(text2);
		}

		private void CreateBoolConfig(ConfigEntry<bool> configEntry)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(configEntry, new BoolCheckBoxOptions
			{
				RequiresRestart = false
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "SCP053";

		public const string PLUGIN_NAME = "SCP053";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SCP053.Utils
{
	public class RegisterUtil
	{
		public static void RegisterEnemyWithConfig(string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword, float powerLevel, int spawnCount)
		{
			enemy.MaxCount = spawnCount;
			enemy.PowerLevel = powerLevel;
			var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
			Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword);
		}

		public static void RegisterScrapWithConfig(string configMoonRarity, Item scrap)
		{
			var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
			Items.RegisterScrap(scrap, dictionary, dictionary2);
		}

		public static void RegisterShopItemWithConfig(bool enabledScrap, Item item, TerminalNode terminalNode, int itemCost, string configMoonRarity)
		{
			Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, terminalNode, itemCost);
			if (enabledScrap)
			{
				RegisterScrapWithConfig(configMoonRarity, item);
			}
		}

		public static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			foreach (string item in from s in configMoonRarity.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (!int.TryParse(array[1], out var result))
				{
					continue;
				}
				if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
				{
					dictionary[result2] = result;
					continue;
				}
				string value = text + "Level";
				if (Enum.TryParse<LevelTypes>(value, ignoreCase: true, out result2))
				{
					dictionary[result2] = result;
				}
				else
				{
					dictionary2[text] = result;
				}
			}
			return (dictionary, dictionary2);
		}
	}
}
namespace SCP053.Scripts
{
	public class Scp053Actions : MonoBehaviour
	{
		public Canvas canvas;

		public Volume volume;

		private void Start()
		{
			Enable(enable: false);
		}

		public void Enable(bool enable)
		{
			((Component)canvas).gameObject.SetActive(enable);
			((Component)volume).gameObject.SetActive(enable);
			if (!enable)
			{
				SetVolumeWeight(0f);
			}
		}

		public void SetVolumeWeight(float weight)
		{
			volume.weight = weight;
		}
	}
	public class SCP053EnemyAI : EnemyAI, IHittable
	{
		[CompilerGenerated]
		private sealed class <KillPlayer>d__60 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public SCP053EnemyAI <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <KillPlayer>d__60(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Expected O, but got Unknown
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_0111: Expected O, but got Unknown
				//IL_016b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0175: Unknown result type (might be due to invalid IL or missing references)
				//IL_017b: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.SwitchLightsActive(active: false);
					<>4__this.meshObject.SetActive(false);
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.meshObject.SetActive(true);
					((Behaviour)<>4__this.killPlayerLight).enabled = true;
					((EnemyAI)<>4__this).creatureVoice.Stop();
					((EnemyAI)<>4__this).creatureVoice.PlayOneShot(<>4__this.killPlayerSound);
					if (<>4__this.isLocalPlayerTargeted)
					{
						Scp053Plugin.instance.currentSCP053Actions.Enable(enable: true);
						Scp053Plugin.instance.currentSCP053Actions.SetVolumeWeight(0.9f);
						HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
					}
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					((Behaviour)<>4__this.killPlayerLight).enabled = false;
					<>4__this.SwitchLightsActive(active: true);
					<>4__this.ligthsClose.Clear();
					if (<>4__this.isLocalPlayerTargeted)
					{
						GameNetworkManager.Instance.localPlayerController.KillPlayer(Vector3.back, true, (CauseOfDeath)0, 0, default(Vector3));
						<>4__this.CancelPlayerEffect();
						<>4__this.player = null;
						Scp053Plugin.instance.currentSCP053Actions.Enable(enable: false);
						<>4__this.ChangeTargetPlayerIdServerRpc(53uL);
						((EnemyAI)<>4__this).SwitchToBehaviourServerRpc(0);
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <PlayWithLights>d__50 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public SCP053EnemyAI <>4__this;

			private List<Light> <lights>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PlayWithLights>d__50(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<lights>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.ligthsClose.Clear();
					<lights>5__1 = Object.FindObjectsByType<Light>((FindObjectsInactive)0, (FindObjectsSortMode)0).ToList();
					<lights>5__1.ForEach(delegate(Light l)
					{
						//IL_000f: Unknown result type (might be due to invalid IL or missing references)
						//IL_001a: Unknown result type (might be due to invalid IL or missing references)
						if (((Behaviour)l).enabled && Vector3.Distance(((Component)l).transform.position, ((Component)<>4__this).transform.position) < 15f)
						{
							<>4__this.ligthsClose.Add(l);
						}
					});
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (((EnemyAI)<>4__this).currentBehaviourStateIndex == 1)
				{
					<>4__this.RandomEnableLights();
					<>2__current = (object)new WaitForSeconds(Random.Range(0.2f, 0.8f));
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <RemovePlayerFromCurse>d__59 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ulong id;

			public SCP053EnemyAI <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <RemovePlayerFromCurse>d__59(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(60f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.playersSeen.Remove(id);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static readonly int Scared = Animator.StringToHash("scared");

		private static readonly int Idle = Animator.StringToHash("idle");

		public List<AudioClip> walkSounds;

		public AudioClip scaredSoundBuildUp;

		public AudioClip killPlayerSound;

		public Light killPlayerLight;

		public GameObject meshObject;

		public AudioSource voiceLinesAudio;

		public List<AudioClip> roamingAudios;

		public List<AudioClip> scaredAudios;

		public List<AudioClip> following682Audios;

		private readonly float walkSpeed = 3.5f;

		private float aiInterval = 0.2f;

		private int lastBehaviorState;

		private readonly float walkSoundDelayRun = 0.5f;

		private readonly float walkSoundDelayWalk = 0.9f;

		private float walkSoundTimer;

		private bool isLocalPlayerTargeted;

		private PlayerControllerB player;

		private float timeInFear = 0f;

		private float maxTimeInFear = 10f;

		private float fearPower = 0f;

		private List<Light> ligthsClose = new List<Light>();

		private Coroutine lightCoroutine;

		private ulong? currentTargetPlayerId;

		private List<ulong> playersSeen = new List<ulong>();

		private float hitPlayerCurseTimer;

		private float hitPlayerCurseDelay = 0.5f;

		private float seePlayerTimer;

		private float seePlayerDelay = 4f;

		private float showActionsTimer;

		private float showActionsBaseTime = 4f;

		private float voiceLineRoamingTimer;

		private float voiceLineRoamingDelay = 10f;

		private float voiceLineScaredTimer;

		private float voiceLineScaredDelay = 4f;

		private bool isCloseTo682;

		private float freezePlayerTimePercent = 0.5f;

		private int curseDamage = 2;

		public override void Start()
		{
			Scp053Plugin.instance.SpawnActionsObject();
			Scp053Plugin.instance.Check682();
			((EnemyAI)this).Start();
			base.agent.speed = walkSpeed;
			base.agent.acceleration = 255f;
			base.agent.angularSpeed = 900f;
			((Behaviour)killPlayerLight).enabled = false;
			if (((NetworkBehaviour)this).IsServer)
			{
				SetDefaultValueClientRpc(Scp053Plugin.instance.playerCurseDamage.Value, Scp053Plugin.instance.freezePlayerTime.Value, Scp053Plugin.instance.timeUntilDeath.Value);
			}
		}

		[ClientRpc]
		private void SetDefaultValueClientRpc(int playerCurseDamage, float freezePlayerTime, float timeUntilDeath)
		{
			//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)
			//IL_0104: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1752170817u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerCurseDamage);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref freezePlayerTime, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref timeUntilDeath, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1752170817u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					curseDamage = playerCurseDamage;
					freezePlayerTimePercent = freezePlayerTime;
					maxTimeInFear = timeUntilDeath;
				}
			}
		}

		public override void Update()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			hitPlayerCurseTimer -= Time.deltaTime;
			showActionsTimer -= Time.deltaTime;
			seePlayerTimer -= Time.deltaTime;
			if (lastBehaviorState != base.currentBehaviourStateIndex)
			{
				lastBehaviorState = base.currentBehaviourStateIndex;
				AllClientOnSwitchBehaviorState();
			}
			if (base.currentBehaviourStateIndex == 1 && GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.25f, 100f, 60, -1f))
			{
				GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.8f, true);
			}
			if (playersSeen.Contains(GameNetworkManager.Instance.localPlayerController.playerClientId))
			{
				if (hitPlayerCurseTimer > 0f)
				{
					return;
				}
				hitPlayerCurseTimer = hitPlayerCurseDelay;
				StartOfRound.Instance.allPlayerScripts.ToList().ForEach(delegate(PlayerControllerB p)
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)p).transform.position, 40f, 60, -1f) && GameNetworkManager.Instance.localPlayerController.playerClientId != p.playerClientId && !p.isPlayerDead && !GameNetworkManager.Instance.localPlayerController.isPlayerDead)
					{
						DamagePlayerFromCurseServerRpc(p.playerClientId);
						showActionsTimer = showActionsBaseTime;
					}
				});
			}
			walkSoundTimer -= Time.deltaTime;
			if (walkSoundTimer <= 0f)
			{
				if (base.currentBehaviourStateIndex != 0)
				{
					return;
				}
				AudioClip val = walkSounds[Random.Range(0, walkSounds.Count)];
				base.creatureSFX.PlayOneShot(val);
				walkSoundTimer = ((base.currentBehaviourStateIndex == 1) ? walkSoundDelayRun : walkSoundDelayWalk);
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				voiceLineRoamingTimer -= Time.deltaTime;
				voiceLineScaredTimer -= Time.deltaTime;
				if (voiceLineRoamingTimer < 0f && base.currentBehaviourStateIndex == 0 && !isCloseTo682)
				{
					voiceLineRoamingTimer = voiceLineRoamingDelay;
					PlayRoamingVoiceClientRpc(Random.Range(0, roamingAudios.Count));
				}
				if (voiceLineRoamingTimer < 0f && base.currentBehaviourStateIndex == 0 && isCloseTo682)
				{
					voiceLineRoamingTimer = voiceLineRoamingDelay;
					PlayFollowingVoiceClientRpc(Random.Range(0, following682Audios.Count));
				}
				if (voiceLineScaredTimer < 0f && base.currentBehaviourStateIndex == 1)
				{
					voiceLineScaredTimer = voiceLineScaredDelay;
					PlayScaredVoiceClientRpc(Random.Range(0, scaredAudios.Count));
				}
				if (aiInterval <= 0f)
				{
					aiInterval = base.AIIntervalTime;
					((EnemyAI)this).DoAIInterval();
				}
			}
		}

		private void CancelPlayerEffect()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)player))
			{
				player.disableLookInput = false;
				player.disableMoveInput = false;
				((Component)player.gameplayCamera).transform.localRotation = Quaternion.Euler(new Vector3(((Component)player.gameplayCamera).transform.localRotation.x, 0f, 0f));
			}
		}

		private void LateUpdate()
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			if (base.currentBehaviourStateIndex == 1)
			{
				timeInFear += Time.deltaTime;
			}
			fearPower = Mathf.Clamp(timeInFear / maxTimeInFear, 0f, 1f);
			if (base.currentBehaviourStateIndex == 1)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts.ToList().Find((PlayerControllerB p) => p.playerClientId == currentTargetPlayerId);
				((Component)this).transform.LookAt(((Component)val.gameplayCamera).transform);
				((Component)this).transform.eulerAngles = new Vector3(0f, ((Component)this).transform.eulerAngles.y, 0f);
			}
			if (isLocalPlayerTargeted)
			{
				player = GameNetworkManager.Instance.localPlayerController;
			}
			if (isLocalPlayerTargeted && base.currentBehaviourStateIndex == 1)
			{
				if (!((EnemyAI)this).CheckLineOfSightForPosition(((Component)player.gameplayCamera).transform.position, 80f, 60, -1f, (Transform)null))
				{
					((EnemyAI)this).SwitchToBehaviourServerRpc(0);
				}
				if (fearPower > 0.8f)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
				}
				else if (fearPower > 0.6f)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
				}
				else if (fearPower > 0.4f)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
				}
				Scp053Plugin.instance.currentSCP053Actions.Enable(enable: true);
				Scp053Plugin.instance.currentSCP053Actions.SetVolumeWeight(fearPower);
				((Component)player).transform.LookAt(base.eye);
				Transform transform = ((Component)player).transform;
				Quaternion localRotation = ((Component)player).transform.localRotation;
				transform.localRotation = Quaternion.Euler(new Vector3(0f, ((Quaternion)(ref localRotation)).eulerAngles.y, 0f));
				((Component)player.gameplayCamera).transform.LookAt(base.eye);
				player.disableLookInput = true;
				if (fearPower < freezePlayerTimePercent)
				{
					player.disableMoveInput = true;
				}
				else
				{
					player.disableMoveInput = false;
				}
				if (fearPower >= 1f)
				{
					((EnemyAI)this).SwitchToBehaviourServerRpc(2);
				}
			}
			else if (base.currentBehaviourStateIndex == 2)
			{
				if (isLocalPlayerTargeted && Object.op_Implicit((Object)(object)player))
				{
					player.disableMoveInput = true;
					player.disableLookInput = true;
				}
				PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts.ToList().Find((PlayerControllerB p) => p.playerClientId == currentTargetPlayerId);
				Vector3 val3 = ((Component)val2.gameplayCamera).transform.position + ((Component)val2.gameplayCamera).transform.forward * 1.7f;
				((Component)this).transform.position = val3 - Vector3.up * 1f;
				((Component)this).transform.LookAt(((Component)val2.gameplayCamera).transform);
				((Component)this).transform.eulerAngles = new Vector3(0f, ((Component)this).transform.eulerAngles.y, 0f);
			}
			else if (showActionsTimer > 0f && !isLocalPlayerTargeted)
			{
				Scp053Plugin.instance.currentSCP053Actions.Enable(enable: true);
				((Behaviour)Scp053Plugin.instance.currentSCP053Actions.canvas).enabled = false;
				Scp053Plugin.instance.currentSCP053Actions.SetVolumeWeight(showActionsTimer / showActionsBaseTime * 0.75f);
			}
			else
			{
				Scp053Plugin.instance.currentSCP053Actions.Enable(enable: false);
			}
		}

		private Vector3 GetClosePositionToPosition(Vector3 position, float maxDistance = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			return position + new Vector3(Random.Range(0f - maxDistance, maxDistance), 0f, Random.Range(0f - maxDistance, maxDistance));
		}

		private bool TryToFollowScp682()
		{
			//IL_0041: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			ModEnemyAINetworkLayer val = Object.FindObjectsByType<ModEnemyAINetworkLayer>((FindObjectsSortMode)0).ToList().Find((ModEnemyAINetworkLayer m) => Vector3.Distance(((Component)m).transform.position, ((Component)this).transform.position) < 200f);
			if (Object.op_Implicit((Object)(object)val) && ((EnemyAI)val).currentSearch.inProgress)
			{
				((EnemyAI)this).SetDestinationToPosition(GetClosePositionToPosition(((Component)val).transform.position, 4f), true);
				isCloseTo682 = Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) <= 20f;
				return true;
			}
			return false;
		}

		public override void DoAIInterval()
		{
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				((EnemyAI)this).TargetClosestPlayer(1.5f, true, 80f);
				if ((Object)(object)base.targetPlayer == (Object)null)
				{
					if (!Scp053Plugin.instance.isSCP682Installed || !TryToFollowScp682())
					{
						isCloseTo682 = false;
						if (!base.currentSearch.inProgress)
						{
							AISearchRoutine val = new AISearchRoutine();
							val.searchWidth = 50f;
							val.searchPrecision = 8f;
							((EnemyAI)this).StartSearch(((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, true, 0, false, 50, false).position, val);
						}
					}
				}
				else if (((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false) && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 12f && !(seePlayerTimer > 0f))
				{
					ChangeTargetPlayerIdClientRpc(base.targetPlayer.playerClientId);
					((EnemyAI)this).SwitchToBehaviourState(1);
				}
				break;
			case 1:
				if (!Object.op_Implicit((Object)(object)base.targetPlayer))
				{
					ChangeTargetPlayerIdClientRpc(53uL);
					((EnemyAI)this).SwitchToBehaviourState(0);
				}
				break;
			case 2:
				break;
			}
		}

		private void AllClientOnSwitchBehaviorState()
		{
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				timeInFear = 0f;
				fearPower = 0f;
				base.agent.speed = walkSpeed;
				base.creatureAnimator.SetBool(Scared, false);
				base.creatureAnimator.SetBool(Idle, false);
				seePlayerTimer = seePlayerDelay;
				base.creatureVoice.Stop();
				CancelPlayerEffect();
				if (lightCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(lightCoroutine);
				}
				SwitchLightsActive(active: true);
				ligthsClose.Clear();
				break;
			case 1:
				base.agent.speed = 0f;
				base.creatureAnimator.SetBool(Scared, true);
				base.creatureAnimator.SetBool(Idle, false);
				base.creatureVoice.PlayOneShot(scaredSoundBuildUp);
				lightCoroutine = ((MonoBehaviour)this).StartCoroutine(PlayWithLights());
				break;
			case 2:
				base.agent.speed = 0f;
				base.creatureAnimator.SetBool(Scared, true);
				base.creatureAnimator.SetBool(Idle, true);
				voiceLinesAudio.Stop();
				if (((NetworkBehaviour)this).IsServer)
				{
					KillPlayerClientRpc();
				}
				if (lightCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(lightCoroutine);
				}
				break;
			}
		}

		private void SwitchLightsActive(bool active)
		{
			ligthsClose.ForEach(delegate(Light l)
			{
				((Behaviour)l).enabled = active;
			});
		}

		private void RandomEnableLights()
		{
			ligthsClose.ForEach(delegate(Light l)
			{
				((Behaviour)l).enabled = Random.Range(0f, 1f) > 0.3f;
			});
		}

		[IteratorStateMachine(typeof(<PlayWithLights>d__50))]
		private IEnumerator PlayWithLights()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PlayWithLights>d__50(0)
			{
				<>4__this = this
			};
		}

		[ClientRpc]
		private void KillPlayerClientRpc()
		{
			//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)
			//IL_00c1: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(722118770u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 722118770u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(KillPlayer());
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void ChangeTargetPlayerIdServerRpc(ulong id, bool instaKill = false)
		{
			//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)
			//IL_00e9: 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(2988497838u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, id);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref instaKill, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2988497838u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					ChangeTargetPlayerIdClientRpc(id, instaKill);
				}
			}
		}

		[ClientRpc]
		private void ChangeTargetPlayerIdClientRpc(ulong id, bool instaKill = false)
		{
			//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)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(973786130u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, id);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref instaKill, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 973786130u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			currentTargetPlayerId = id;
			isLocalPlayerTargeted = id == GameNetworkManager.Instance.localPlayerController.playerClientId;
			playersSeen.Add(id);
			((MonoBehaviour)this).StartCoroutine(RemovePlayerFromCurse(id));
			if (isLocalPlayerTargeted)
			{
				GameNetworkManager.Instance.localPlayerController.sprintMeter = 0f;
				if (instaKill)
				{
					((EnemyAI)this).SwitchToBehaviourServerRpc(2);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void DamagePlayerFromCurseServerRpc(ulong id)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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(4169646637u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, id);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4169646637u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					DamagePlayerFromCurseClientRpc(id);
				}
			}
		}

		[ClientRpc]
		private void DamagePlayerFromCurseClientRpc(ulong id)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3965957586u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, id);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3965957586u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (id == GameNetworkManager.Instance.localPlayerController.playerClientId)
				{
					GameNetworkManager.Instance.localPlayerController.DamagePlayer(curseDamage, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				}
			}
		}

		[ClientRpc]
		private void PlayRoamingVoiceClientRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(394930828u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 394930828u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					voiceLinesAudio.PlayOneShot(roamingAudios[index]);
				}
			}
		}

		[ClientRpc]
		private void PlayScaredVoiceClientRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1160956985u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1160956985u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					voiceLinesAudio.PlayOneShot(scaredAudios[index]);
				}
			}
		}

		[ClientRpc]
		private void PlayFollowingVoiceClientRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(354813339u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 354813339u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					voiceLinesAudio.PlayOneShot(following682Audios[index]);
				}
			}
		}

		[IteratorStateMachine(typeof(<RemovePlayerFromCurse>d__59))]
		private IEnumerator RemovePlayerFromCurse(ulong id)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <RemovePlayerFromCurse>d__59(0)
			{
				<>4__this = this,
				id = id
			};
		}

		[IteratorStateMachine(typeof(<KillPlayer>d__60))]
		private IEnumerator KillPlayer()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <KillPlayer>d__60(0)
			{
				<>4__this = this
			};
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			player = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, true);
			base.targetPlayer = player;
			if ((Object)(object)player != (Object)null && base.currentBehaviourStateIndex != 2)
			{
				ChangeTargetPlayerIdServerRpc(player.playerClientId, instaKill: true);
			}
		}

		public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)playerWhoHit))
			{
				playerWhoHit.KillPlayer(Vector3.back, true, (CauseOfDeath)0, 0, default(Vector3));
			}
			return false;
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1752170817u, new RpcReceiveHandler(__rpc_handler_1752170817), "SetDefaultValueClientRpc");
			((NetworkBehaviour)this).__registerRpc(722118770u, new RpcReceiveHandler(__rpc_handler_722118770), "KillPlayerClientRpc");
			((NetworkBehaviour)this).__registerRpc(2988497838u, new RpcReceiveHandler(__rpc_handler_2988497838), "ChangeTargetPlayerIdServerRpc");
			((NetworkBehaviour)this).__registerRpc(973786130u, new RpcReceiveHandler(__rpc_handler_973786130), "ChangeTargetPlayerIdClientRpc");
			((NetworkBehaviour)this).__registerRpc(4169646637u, new RpcReceiveHandler(__rpc_handler_4169646637), "DamagePlayerFromCurseServerRpc");
			((NetworkBehaviour)this).__registerRpc(3965957586u, new RpcReceiveHandler(__rpc_handler_3965957586), "DamagePlayerFromCurseClientRpc");
			((NetworkBehaviour)this).__registerRpc(394930828u, new RpcReceiveHandler(__rpc_handler_394930828), "PlayRoamingVoiceClientRpc");
			((NetworkBehaviour)this).__registerRpc(1160956985u, new RpcReceiveHandler(__rpc_handler_1160956985), "PlayScaredVoiceClientRpc");
			((NetworkBehaviour)this).__registerRpc(354813339u, new RpcReceiveHandler(__rpc_handler_354813339), "PlayFollowingVoiceClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_1752170817(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 playerCurseDamage = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerCurseDamage);
				float freezePlayerTime = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref freezePlayerTime, default(ForPrimitives));
				float timeUntilDeath = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref timeUntilDeath, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP053EnemyAI)(object)target).SetDefaultValueClientRpc(playerCurseDamage, freezePlayerTime, timeUntilDeath);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_722118770(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;
				((SCP053EnemyAI)(object)target).KillPlayerClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2988497838(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)
			{
				ulong id = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref id);
				bool instaKill = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref instaKill, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP053EnemyAI)(object)target).ChangeTargetPlayerIdServerRpc(id, instaKill);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_973786130(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)
			{
				ulong id = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref id);
				bool instaKill = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref instaKill, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP053EnemyAI)(object)target).ChangeTargetPlayerIdClientRpc(id, instaKill);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4169646637(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)
			{
				ulong id = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref id);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP053EnemyAI)(object)target).DamagePlayerFromCurseServerRpc(id);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3965957586(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)
			{
				ulong id = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref id);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP053EnemyAI)(object)target).DamagePlayerFromCurseClientRpc(id);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_394930828(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 index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP053EnemyAI)(object)target).PlayRoamingVoiceClientRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1160956985(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 index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP053EnemyAI)(object)target).PlayScaredVoiceClientRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_354813339(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 index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP053EnemyAI)(object)target).PlayFollowingVoiceClientRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "SCP053EnemyAI";
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace SCP053.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}