Decompiled source of SCP939 v1.0.1

SCP939.dll

Decompiled 3 weeks 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 SCP939.NetcodePatcher;
using SCP939.Scripts;
using SCP939.Utils;
using Unity.Netcode;
using UnityEngine;

[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("SCP939")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("SCP939")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+792bb78b1f791c15dd2ebc6cdb21e22ef5b1f97b")]
[assembly: AssemblyProduct("SCP939")]
[assembly: AssemblyTitle("SCP939")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SCP939
{
	[BepInPlugin("project_scp.scp939", "SCP939", "1.0.1")]
	public class SCP939Plugin : BaseUnityPlugin
	{
		private const string GUID = "project_scp.scp939";

		private const string NAME = "SCP939";

		private const string VERSION = "1.0.1";

		public GameObject SCP939GameObject;

		public static SCP939Plugin instance;

		public List<SCP939EnemyAI> Scp939EnemyAisSpawned = new List<SCP939EnemyAI>();

		public ConfigEntry<bool> debug;

		public ConfigEntry<string> spawnMoonRarity;

		public ConfigEntry<int> maxSpawn;

		public ConfigEntry<int> powerLevel;

		public ConfigEntry<int> damage;

		public ConfigEntry<float> walkSpeed;

		public ConfigEntry<float> runSpeed;

		public ConfigEntry<float> minVoiceLineDelay;

		public ConfigEntry<float> maxVoiceLineDelay;

		public bool isMirageInstalled = false;

		private void Awake()
		{
			instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SCP939 starting....");
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "scp939");
			AssetBundle bundle = AssetBundle.LoadFromFile(text);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SCP939 bundle found !");
			if (Chainloader.PluginInfos.ContainsKey("qwbarch.Mirage"))
			{
				Debug.Log((object)"Mirage mod found !");
				isMirageInstalled = true;
			}
			NetcodePatcher();
			LoadConfigs();
			RegisterMonster(bundle);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SCP939 is ready!");
		}

		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:50,ExperimentationLevel:40,AssuranceLevel:40,VowLevel:40,OffenseLevel:45,MarchLevel:45,RendLevel:50,DineLevel:50,TitanLevel:60,Adamance:45,Embrion:50,Artifice:60", "Chance for SCP 939 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", 4, "Max SCP939 spawn in one day");
			CreateIntConfig(maxSpawn, 1, 30);
			powerLevel = ((BaseUnityPlugin)this).Config.Bind<int>("General", "powerLevel", 1, "SCP939 power level");
			CreateIntConfig(maxSpawn, 1, 10);
			damage = ((BaseUnityPlugin)this).Config.Bind<int>("Behavior", "damage", 20, "SCP939 damage");
			CreateIntConfig(damage);
			walkSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Behavior", "walkSpeed", 3.5f, "SCP939 walk speed");
			CreateFloatConfig(walkSpeed, 1f, 20f);
			runSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Behavior", "runSpeed", 6.5f, "SCP939 run speed");
			CreateFloatConfig(runSpeed, 1f, 30f);
			minVoiceLineDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Voices", "minVoiceLineDelay", 20f, "Min voiceline delay");
			CreateFloatConfig(minVoiceLineDelay, 1f, 300f);
			maxVoiceLineDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Voices", "maxVoiceLineDelay", 20f, "Max voiceline delay");
			CreateFloatConfig(maxVoiceLineDelay, 1f, 300f);
			debug = ((BaseUnityPlugin)this).Config.Bind<bool>("Dev", "Debug", false, "Enable debug logs");
			CreateBoolConfig(debug);
		}

		private void RegisterMonster(AssetBundle bundle)
		{
			EnemyType val = bundle.LoadAsset<EnemyType>("Assets/LethalCompany/Mods/SCP939/SCP939.asset");
			TerminalNode terminalNode = bundle.LoadAsset<TerminalNode>("Assets/LethalCompany/Mods/SCP939/SCP939TerminalNode.asset");
			TerminalKeyword terminalKeyword = bundle.LoadAsset<TerminalKeyword>("Assets/LethalCompany/Mods/SCP939/SCP939TerminalKeyword.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);
			SCP939GameObject = val.enemyPrefab;
			RegisterUtil.RegisterEnemyWithConfig(spawnMoonRarity.Value, val, terminalNode, terminalKeyword, val.PowerLevel, val.MaxCount);
		}

		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)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		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 = "SCP939";

		public const string PLUGIN_NAME = "SCP939";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SCP939.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 SCP939.Scripts
{
	public class SCP939EnemyAI : EnemyAI
	{
		[CompilerGenerated]
		private sealed class <SmokeAnimation>d__51 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject fog;

			public SCP939EnemyAI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.smokeParticles.ForEach(delegate(ParticleSystem p)
					{
						p.Stop();
					});
					<>2__current = (object)new WaitForSeconds(8.5f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					Object.Destroy((Object)(object)fog);
					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 Run = Animator.StringToHash("run");

		private static readonly int Attack = Animator.StringToHash("attack");

		private static readonly int Hit = Animator.StringToHash("hit");

		private static readonly int Die = Animator.StringToHash("die");

		public List<AudioClip> walkSounds;

		public GameObject fogObject;

		public List<ParticleSystem> smokeParticles;

		public AudioClip biteClip;

		public List<AudioClip> voiceLinesClips;

		public bool isChief;

		private float runSpeed = 6.5f;

		private float walkSpeed = 3.5f;

		private int damage = 20;

		private float aiInterval = 0.2f;

		private int lastBehaviorState;

		private readonly float walkSoundDelayRun = 0.5f;

		private readonly float walkSoundDelayWalk = 0.9f;

		private float walkSoundTimer;

		private int soundHeard;

		private int maxSoundHeard = 3;

		private float heardLastSoundTimer = 0f;

		private float heardLastSoundDelay = 3f;

		private float disableHeardSoundTimer = 0f;

		private float disableHeardSoundDelay = 1.5f;

		private float hitPlayerTimer = 0f;

		private float hitPlayerDelay = 1f;

		private float makeSmokeTimer = 0f;

		private float makeSmokeDelay = 30f;

		private float detectPlayerTimer = 0f;

		private float detectPlayerDelay = 2f;

		private float maxLastWalkPosTimer = 15f;

		private float maxLastWalkPosDelay = 15f;

		private float playRandomVoiceTimer = 10f;

		private float disabledTimer = 2f;

		private Vector3 lastSearchPosition;

		private Vector3 lastNoisePosition;

		private void SpawnAFriend()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (SCP939Plugin.instance.Scp939EnemyAisSpawned.Count % 2 != 0)
			{
				GameObject val = Object.Instantiate<GameObject>(SCP939Plugin.instance.SCP939GameObject, ((Component)this).transform.position, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
				RoundManager.Instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>());
			}
		}

		[ClientRpc]
		private void SyncInformationClientRpc(float walk, float run, int dmg)
		{
			//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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4024654827u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref walk, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref run, default(ForPrimitives));
					BytePacker.WriteValueBitPacked(val2, dmg);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4024654827u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					walkSpeed = walk;
					runSpeed = run;
					damage = dmg;
				}
			}
		}

		public override void Start()
		{
			((EnemyAI)this).Start();
			disabledTimer = Random.Range(0f, 2f);
			SCP939Plugin.instance.Scp939EnemyAisSpawned.Add(this);
			base.agent.speed = walkSpeed;
			base.agent.acceleration = 255f;
			base.agent.angularSpeed = 900f;
			if (((NetworkBehaviour)this).IsServer)
			{
				SpawnAFriend();
				if ((Object)(object)GetChief() == (Object)null)
				{
					isChief = true;
					SetChiefServerRpc(value: true);
				}
				SyncInformationClientRpc(SCP939Plugin.instance.walkSpeed.Value, SCP939Plugin.instance.runSpeed.Value, SCP939Plugin.instance.damage.Value);
			}
		}

		[ClientRpc]
		private void SetDestinationClientRpc(Vector3 destination)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1499440625u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref destination);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1499440625u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((EnemyAI)this).SetDestinationToPosition(destination, true);
				}
			}
		}

		public override void Update()
		{
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				return;
			}
			heardLastSoundTimer -= Time.deltaTime;
			hitPlayerTimer -= Time.deltaTime;
			disableHeardSoundTimer -= Time.deltaTime;
			makeSmokeTimer -= Time.deltaTime;
			detectPlayerTimer -= Time.deltaTime;
			playRandomVoiceTimer -= Time.deltaTime;
			disabledTimer -= Time.deltaTime;
			maxLastWalkPosTimer -= Time.deltaTime;
			if (detectPlayerTimer < 0f)
			{
				base.targetPlayer = null;
			}
			if (heardLastSoundTimer < 0f && soundHeard > 0)
			{
				if (SCP939Plugin.instance.debug.Value)
				{
					Debug.Log((object)$"Reduce sound heard : {soundHeard}");
				}
				soundHeard--;
				heardLastSoundTimer = heardLastSoundDelay;
			}
			if (lastBehaviorState != base.currentBehaviourStateIndex)
			{
				if (SCP939Plugin.instance.debug.Value)
				{
					Debug.Log((object)$"New behavior state : {base.currentBehaviourStateIndex} last : {lastBehaviorState}");
				}
				lastBehaviorState = base.currentBehaviourStateIndex;
				AllClientOnSwitchBehaviorState();
			}
			walkSoundTimer -= Time.deltaTime;
			if (walkSoundTimer <= 0f)
			{
				AudioClip val = walkSounds[Random.Range(0, walkSounds.Count)];
				base.creatureSFX.PlayOneShot(val);
				walkSoundTimer = ((base.currentBehaviourStateIndex == 2) ? walkSoundDelayRun : walkSoundDelayWalk);
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				if (playRandomVoiceTimer < 0f)
				{
					PlayRandomVoiceLineServerRpc();
					playRandomVoiceTimer = Random.Range(SCP939Plugin.instance.minVoiceLineDelay.Value, SCP939Plugin.instance.maxVoiceLineDelay.Value);
				}
				if (aiInterval <= 0f)
				{
					aiInterval = base.AIIntervalTime;
					((EnemyAI)this).DoAIInterval();
				}
				if (base.currentBehaviourStateIndex == 2 && !Object.op_Implicit((Object)(object)base.targetPlayer) && base.agent.remainingDistance <= base.agent.stoppingDistance)
				{
					lastSearchPosition = GetClosePositionToPosition(lastNoisePosition, 4f);
					SetDestinationClientRpc(lastSearchPosition);
				}
			}
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			if (base.isEnemyDead || (disableHeardSoundTimer >= 0f && base.currentBehaviourStateIndex != 2))
			{
				return;
			}
			((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
			if (((NetworkBehaviour)this).IsServer && !((double)noiseLoudness < 0.25))
			{
				if (soundHeard < maxSoundHeard)
				{
					soundHeard++;
				}
				heardLastSoundTimer = heardLastSoundDelay;
				lastNoisePosition = noisePosition;
				if (SCP939Plugin.instance.debug.Value)
				{
					Debug.Log((object)$"DETECT sound : {soundHeard}");
				}
				CallOther939();
				disableHeardSoundTimer = disableHeardSoundDelay;
			}
		}

		public override void DoAIInterval()
		{
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_00b2: 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_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			if (base.isEnemyDead || disabledTimer > 0f)
			{
				return;
			}
			((EnemyAI)this).DoAIInterval();
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (soundHeard <= 0)
				{
					if (isChief)
					{
						if (!base.currentSearch.inProgress)
						{
							AISearchRoutine val = new AISearchRoutine();
							val.searchWidth = Random.Range(25f, 60f);
							val.searchPrecision = 8f;
							((EnemyAI)this).StartSearch(((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, true, 0, false, 50, false).position, val);
						}
					}
					else if (base.agent.remainingDistance <= base.agent.stoppingDistance || maxLastWalkPosTimer < 0f)
					{
						SCP939EnemyAI chief = GetChief();
						SetDestinationClientRpc(GetClosePositionToPosition(((Component)chief).transform.position, 10f));
						maxLastWalkPosTimer = maxLastWalkPosDelay;
					}
				}
				else
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourState(1);
				}
				break;
			case 1:
				SetDestinationClientRpc(lastNoisePosition);
				if ((double)Vector3.Distance(lastNoisePosition, ((Component)this).transform.position) <= 0.1)
				{
					((EnemyAI)this).SwitchToBehaviourState(0);
					if (makeSmokeTimer <= 0f)
					{
						InstantiateFogServerRpc();
					}
				}
				else if (soundHeard > 1)
				{
					SetDestinationClientRpc(lastNoisePosition);
					((EnemyAI)this).SwitchToBehaviourState(2);
				}
				break;
			case 2:
				if (Object.op_Implicit((Object)(object)base.targetPlayer))
				{
					((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
				}
				else if (soundHeard <= 0)
				{
					((EnemyAI)this).SwitchToBehaviourState(0);
				}
				break;
			}
		}

		private void AllClientOnSwitchBehaviorState()
		{
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.creatureAnimator.SetBool(Run, false);
				base.agent.speed = walkSpeed;
				break;
			case 1:
				base.creatureAnimator.SetBool(Run, false);
				base.agent.speed = walkSpeed;
				break;
			case 2:
				base.creatureAnimator.SetBool(Run, true);
				base.agent.speed = runSpeed;
				break;
			}
		}

		private static SCP939EnemyAI GetChief()
		{
			SCP939EnemyAI chief = null;
			SCP939Plugin.instance.Scp939EnemyAisSpawned.ForEach(delegate(SCP939EnemyAI m)
			{
				if (m.isChief)
				{
					chief = m;
				}
			});
			return chief;
		}

		[ServerRpc]
		public void SetChiefServerRpc(bool value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_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(1099323713u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1099323713u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SetChiefClientRpc(value);
			}
		}

		[ClientRpc]
		private void SetChiefClientRpc(bool value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(638489291u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 638489291u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (SCP939Plugin.instance.debug.Value)
				{
					Debug.Log((object)$"New chief : {value}");
				}
				isChief = value;
			}
		}

		[ServerRpc]
		private void InstantiateFogServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((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(1255967031u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1255967031u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				makeSmokeTimer = makeSmokeDelay;
				InstantiateFogClientRpc();
			}
		}

		[ClientRpc]
		private void InstantiateFogClientRpc()
		{
			//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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4029885716u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4029885716u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				GameObject fog = Object.Instantiate<GameObject>(fogObject, ((Component)this).transform.position, Quaternion.identity);
				smokeParticles.ForEach(delegate(ParticleSystem p)
				{
					p.Play();
				});
				((MonoBehaviour)this).StartCoroutine(SmokeAnimation(fog));
			}
		}

		[ServerRpc]
		private void PlayRandomVoiceLineServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((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(1055933178u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1055933178u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				PlayRandomVoiceLineClientRpc(Random.Range(0, voiceLinesClips.Count));
			}
		}

		[ClientRpc]
		private void PlayRandomVoiceLineClientRpc(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)
			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(450818795u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 450818795u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.creatureVoice.PlayOneShot(voiceLinesClips[index]);
				}
			}
		}

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

		private void CallOther939()
		{
			if (soundHeard > 0)
			{
				List<SCP939EnemyAI> close = GetClose939();
				close.ForEach(delegate(SCP939EnemyAI scp)
				{
					//IL_0003: Unknown result type (might be due to invalid IL or missing references)
					scp.GetCalledByAnother939(lastNoisePosition, soundHeard);
				});
			}
		}

		private void GetCalledByAnother939(Vector3 position, int soundCount)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (base.currentBehaviourStateIndex != 2 || soundCount >= 2)
			{
				if (SCP939Plugin.instance.debug.Value)
				{
					Debug.Log((object)$"939 CALLED FROM ANOTHER : {soundCount}, {position}");
				}
				Vector3 closePositionToPosition = GetClosePositionToPosition(position, 2f);
				lastNoisePosition = closePositionToPosition;
				soundHeard = soundCount;
				disableHeardSoundTimer = disableHeardSoundDelay;
				heardLastSoundTimer = heardLastSoundDelay;
			}
		}

		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 List<SCP939EnemyAI> GetClose939()
		{
			List<SCP939EnemyAI> list = new List<SCP939EnemyAI>();
			SCP939Plugin.instance.Scp939EnemyAisSpawned.ToList().ForEach(delegate(SCP939EnemyAI s)
			{
				//IL_0007: 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)
				if (Vector3.Distance(((Component)s).transform.position, ((Component)this).transform.position) < 50f && (Object)(object)s != (Object)(object)this)
				{
					list.Add(s);
				}
			});
			return list;
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if (!base.isEnemyDead)
			{
				base.creatureAnimator.SetTrigger(Hit);
				((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
				base.enemyHP -= force;
				((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
				detectPlayerTimer = detectPlayerDelay;
				soundHeard = maxSoundHeard;
				((EnemyAI)this).DetectNoise(((Object)(object)playerWhoHit != (Object)null) ? ((Component)playerWhoHit).transform.position : ((Component)this).transform.position, 1f, 0, 0);
				if (base.enemyHP <= 0)
				{
					((EnemyAI)this).KillEnemy(false);
				}
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			((EnemyAI)this).KillEnemy(destroy);
			base.creatureAnimator.SetBool(Run, false);
			base.creatureAnimator.SetBool(Die, true);
			SCP939Plugin.instance.Scp939EnemyAisSpawned.Remove(this);
			if (!((NetworkBehaviour)this).IsServer || !isChief)
			{
				return;
			}
			SetChiefServerRpc(value: false);
			bool foundChief = false;
			SCP939Plugin.instance.Scp939EnemyAisSpawned.ForEach(delegate(SCP939EnemyAI m)
			{
				if (!foundChief && !((EnemyAI)m).isEnemyDead)
				{
					m.SetChiefServerRpc(value: true);
					foundChief = true;
				}
			});
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			if (!base.isEnemyDead && !(hitPlayerTimer >= 0f))
			{
				base.creatureAnimator.SetTrigger(Attack);
				base.creatureVoice.PlayOneShot(biteClip);
				((EnemyAI)this).OnCollideWithPlayer(other);
				((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
				detectPlayerTimer = detectPlayerDelay;
				soundHeard = maxSoundHeard;
				((EnemyAI)this).DetectNoise(((Component)other).transform.position, 1f, 0, 0);
				hitPlayerTimer = hitPlayerDelay;
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if (Object.op_Implicit((Object)(object)val))
				{
					val.DamagePlayer(damage, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				}
			}
		}

		public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy = null)
		{
			if (base.isEnemyDead || hitPlayerTimer >= 0f)
			{
				return;
			}
			((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy);
			if ((Object)(object)collidedEnemy != (Object)null && !(collidedEnemy.enemyType.enemyName == "SCP 939") && !collidedEnemy.isEnemyDead)
			{
				base.creatureAnimator.SetTrigger(Attack);
				if (collidedEnemy != null)
				{
					collidedEnemy.HitEnemy(2, (PlayerControllerB)null, true, -1);
				}
				hitPlayerTimer = hitPlayerDelay;
			}
		}

		public override void OnDestroy()
		{
			((EnemyAI)this).OnDestroy();
			SCP939Plugin.instance.Scp939EnemyAisSpawned.Remove(this);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SCP939EnemyAI()
		{
			//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
			NetworkManager.__rpc_func_table.Add(4024654827u, new RpcReceiveHandler(__rpc_handler_4024654827));
			NetworkManager.__rpc_func_table.Add(1499440625u, new RpcReceiveHandler(__rpc_handler_1499440625));
			NetworkManager.__rpc_func_table.Add(1099323713u, new RpcReceiveHandler(__rpc_handler_1099323713));
			NetworkManager.__rpc_func_table.Add(638489291u, new RpcReceiveHandler(__rpc_handler_638489291));
			NetworkManager.__rpc_func_table.Add(1255967031u, new RpcReceiveHandler(__rpc_handler_1255967031));
			NetworkManager.__rpc_func_table.Add(4029885716u, new RpcReceiveHandler(__rpc_handler_4029885716));
			NetworkManager.__rpc_func_table.Add(1055933178u, new RpcReceiveHandler(__rpc_handler_1055933178));
			NetworkManager.__rpc_func_table.Add(450818795u, new RpcReceiveHandler(__rpc_handler_450818795));
		}

		private static void __rpc_handler_4024654827(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			{
				float walk = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref walk, default(ForPrimitives));
				float run = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref run, default(ForPrimitives));
				int dmg = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref dmg);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP939EnemyAI)(object)target).SyncInformationClientRpc(walk, run, dmg);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1499440625(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 destinationClientRpc = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref destinationClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP939EnemyAI)(object)target).SetDestinationClientRpc(destinationClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1099323713(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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_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
			{
				bool chiefServerRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref chiefServerRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP939EnemyAI)(object)target).SetChiefServerRpc(chiefServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		private static void __rpc_handler_4029885716(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;
				((SCP939EnemyAI)(object)target).InstantiateFogClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_450818795(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)2;
				((SCP939EnemyAI)(object)target).PlayRandomVoiceLineClientRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "SCP939EnemyAI";
		}
	}
	public class SCP939Fog : MonoBehaviour
	{
		private float addDrunkTimer = 0f;

		private float addDrunkDelay = 0.25f;

		private void Update()
		{
			addDrunkTimer -= Time.deltaTime;
		}

		private void OnTriggerStay(Collider other)
		{
			if (!(addDrunkTimer >= 0f) && ((Component)other).CompareTag("Player"))
			{
				PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
				if (!((Object)(object)component == (Object)null) && !component.isPlayerDead && component.playerClientId == GameNetworkManager.Instance.localPlayerController.playerClientId)
				{
					addDrunkTimer = addDrunkDelay;
					component.drunkness += 0.1f;
				}
			}
		}
	}
}
namespace SCP939.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}