Decompiled source of SCP1507 v1.1.5

SCP1507/ProjectSCP.SCP1507.dll

Decompiled 2 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.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using ProjectSCP.SCP1507.NetcodePatcher;
using SCP1507.Configurations;
using SCP1507.DataClass;
using SCP1507.FlamingoManager;
using SCP1507.Patches;
using SCP1507.SCP1507;
using SCP1507.SCP1507Alpha;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ProjectSCP.SCP1507")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.5.0")]
[assembly: AssemblyInformationalVersion("1.1.5+135e7b678fbb21e64cb5a239eab957c0ab616d01")]
[assembly: AssemblyProduct("SCP1507")]
[assembly: AssemblyTitle("ProjectSCP.SCP1507")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.5.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SCP1507
{
	[BepInPlugin("ProjectSCP.SCP1507", "SCP1507", "1.1.5")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static AssetBundle? ModAssets;

		private readonly Harmony harmony = new Harmony("ProjectSCP.SCP1507");

		public static Config FlamingoConfig { get; internal set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			FlamingoConfig = new Config(((BaseUnityPlugin)this).Config);
			InitializeNetworkBehaviours();
			Logger.LogInfo((object)"Plugin ProjectSCP.SCP1507 loading asset bundles");
			string path = "scp1507modassets";
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
			if ((Object)(object)ModAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			Logger.LogInfo((object)"Extracting Enemies");
			EnemyType val = ModAssets.LoadAsset<EnemyType>("scp1507");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("SCP1507TN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("SCP1507TK");
			EnemyType val4 = ModAssets.LoadAsset<EnemyType>("SCP1507Alpha");
			TerminalNode val5 = ModAssets.LoadAsset<TerminalNode>("SCP1507ATN");
			TerminalKeyword val6 = ModAssets.LoadAsset<TerminalKeyword>("SCP1507ATK");
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>
			{
				{
					(LevelTypes)16,
					20
				},
				{
					(LevelTypes)64,
					20
				},
				{
					(LevelTypes)(-1),
					FlamingoConfig.RARITY_ALPHA.Value
				},
				{
					(LevelTypes)1024,
					40
				}
			};
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			NetworkPrefabs.RegisterNetworkPrefab(val4.enemyPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Logger.LogInfo((object)"Registered Prfabs");
			Enemies.RegisterEnemy(val, 0, (LevelTypes)(-1), val2, val3);
			Enemies.RegisterEnemy(val4, dictionary, dictionary2, val5, val6);
			Logger.LogInfo((object)"Registered enemies");
			harmony.PatchAll(typeof(ConfigurationsPatch));
			harmony.PatchAll(typeof(NoiseItemPatch));
			harmony.PatchAll(typeof(PhysicsProp));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(RoundManagerPatch));
			Logger.LogInfo((object)"Executed patches");
			Logger.LogInfo((object)"Plugin ProjectSCP.SCP1507 is loaded!");
		}

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

		public const string PLUGIN_NAME = "SCP1507";

		public const string PLUGIN_VERSION = "1.1.5";
	}
}
namespace SCP1507.SCP1507
{
	public class AnimationRelaySCP1507Alpha : MonoBehaviour
	{
		public Scp1507Alpha mainScript;

		public void AttackDoorAnimationHandle()
		{
			MonsterLogger("Started attack sequence against door! FROM ALPHA. This is not supposed to happen and may cause issue!", reportable: true);
		}

		public void AttackPlayerAnimationHandle()
		{
			mainScript.SwingAttackHitClientRpc();
		}

		public void FootStepAnimationHandle()
		{
			mainScript.walkingSource.Play();
		}

		private void MonsterLogger(string message, bool reportable = false)
		{
			if (!reportable)
			{
				Debug.Log((object)("[ProjectSCP.SCP1507][SCP1507Alpha.Animations][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message));
			}
			else
			{
				Debug.LogError((object)("[ProjectSCP.SCP1507][SCP1507Alpha.Animations][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message));
			}
		}
	}
	public class AnimationRelaySCP1507 : MonoBehaviour
	{
		public Scp1507 mainScript;

		public void AttackDoorAnimationHandle()
		{
			((EnemyAI)mainScript).creatureSFX.PlayOneShot(mainScript.destroyDoor);
			mainScript.SwingAttackHitDoor();
		}

		public void AttackPlayerAnimationHandle()
		{
			mainScript.SwingAttackHitClientRpc();
		}

		public void FootStepAnimationHandle()
		{
			mainScript.walkingSource.Play();
		}
	}
	public class Scp1507 : EnemyAI
	{
		[CompilerGenerated]
		private sealed class <DamagePlayerCoroutine>d__45 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Scp1507 <>4__this;

			public PlayerControllerB playerControllerB;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				Scp1507 scp = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.3f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((MonoBehaviour)scp).StopCoroutine(scp.KillCoroutine);
					playerControllerB.DamagePlayer(scp.damage, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					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 <StartCoroutineFLAMINGO>d__30 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Scp1507 <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				int num = <>1__state;
				Scp1507 scp = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(3f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					scp.TriggerRampage(2000);
					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 <TurnOffC>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Rigidbody rigidbody;

			public float time;

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

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

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

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

			private bool MoveNext()
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					rigidbody.detectCollisions = false;
					<>2__current = (object)new WaitForSeconds(time);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					rigidbody.detectCollisions = true;
					Object.Destroy((Object)(object)((Component)rigidbody).gameObject, 5f);
					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();
			}
		}

		[NonSerialized]
		[Header("Alpha")]
		public Scp1507Alpha alpha;

		[NonSerialized]
		public int alphaId;

		private bool isAlphaAlive;

		[Header("Attack")]
		public float attackCooldown;

		private float attackCooldownBeheader;

		public int damage;

		public Transform AttackArea;

		private Coroutine KillCoroutine;

		[Header("Audio")]
		public AudioClip destroyDoor;

		public AudioClip[] honks;

		public AudioClip[] attacks;

		public AudioClip attackDoor;

		public AudioSource walkingSource;

		private global::SCP1507.FlamingoManager.FlamingoManager flamingoManager;

		[Header("LookAt")]
		public Transform lookAt;

		public Transform defaultLookAt;

		private Coroutine startCo;

		[NonSerialized]
		private NetworkVariable<NetworkBehaviourReference> _playerNetVar = new NetworkVariable<NetworkBehaviourReference>(default(NetworkBehaviourReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public PlayerControllerB Scp1507TargetPlayer
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				return (PlayerControllerB)NetworkBehaviourReference.op_Implicit(_playerNetVar.Value);
			}
			set
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)value == (Object)null)
				{
					_playerNetVar.Value = default(NetworkBehaviourReference);
				}
				else
				{
					_playerNetVar.Value = new NetworkBehaviourReference((NetworkBehaviour)(object)value);
				}
			}
		}

		private void DoAttackSound()
		{
			try
			{
				base.creatureSFX.PlayOneShot(attacks[RandomNumberGenerator.GetInt32(attacks.Length)]);
			}
			catch (ArgumentNullException)
			{
			}
			catch (NullReferenceException)
			{
			}
		}

		public void DoQuackSound()
		{
			try
			{
				base.creatureVoice.PlayOneShot(honks[RandomNumberGenerator.GetInt32(honks.Length)]);
			}
			catch (ArgumentNullException)
			{
			}
			catch (NullReferenceException)
			{
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			MonsterLogger("We collided with something!");
			if (Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<DoorLock>()))
			{
				PlayAnimationClientRpc("AttackDoor", value: true);
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if (Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<DoorLock>()))
			{
				PlayAnimationClientRpc("AttackDoor", value: false);
			}
		}

		private void CheckIfCanBreakDoor(DoorLock Door)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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)
			//IL_0076: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			if (alpha.HitDoor(Door))
			{
				return;
			}
			try
			{
				GameObject gameObject = ((Component)((Component)((Component)((Component)Door).transform.parent).transform.parent).transform.parent).gameObject;
				if (!Object.op_Implicit((Object)(object)gameObject.GetComponent<Rigidbody>()) && Vector3.Distance(((Component)this).transform.position, gameObject.transform.position) <= 4f)
				{
					NetworkObjectReference netObjRef = NetworkObjectReference.op_Implicit(gameObject);
					Vector3 val = ((Component)base.targetPlayer).transform.position - ((Component)this).transform.position;
					BashDoorClientRpc(netObjRef, ((Vector3)(ref val)).normalized * 20f);
				}
			}
			catch (NullReferenceException)
			{
				try
				{
					Door.OpenDoorAsEnemyClientRpc();
				}
				catch (Exception ex)
				{
					Debug.Log((object)("The doors are not formatted the right way and as such Flamingo's may seems really stupid hitting doors " + ex));
				}
			}
		}

		[ClientRpc]
		public void BashDoorClientRpc(NetworkObjectReference netObjRef, Vector3 Position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			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(4184319842u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref Position);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4184319842u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				if (((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null))
				{
					GameObject gameObject = ((Component)val3).gameObject;
					Rigidbody val4 = gameObject.AddComponent<Rigidbody>();
					AudioSource val5 = gameObject.AddComponent<AudioSource>();
					val5.spatialBlend = 1f;
					val5.maxDistance = 60f;
					val5.rolloffMode = (AudioRolloffMode)1;
					val5.volume = 1f;
					((MonoBehaviour)this).StartCoroutine(TurnOffC(val4, 0.12f));
					val4.AddForce(Position, (ForceMode)1);
					val5.PlayOneShot(destroyDoor);
				}
			}
		}

		[IteratorStateMachine(typeof(<TurnOffC>d__6))]
		private IEnumerator TurnOffC(Rigidbody rigidbody, float time)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TurnOffC>d__6(0)
			{
				rigidbody = rigidbody,
				time = time
			};
		}

		public void SwingAttackHitDoor()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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)
			int num = 512;
			if (((NetworkBehaviour)this).IsHost)
			{
				Collider[] array = Physics.OverlapBox(AttackArea.position, AttackArea.localScale, Quaternion.identity, num);
				if (array.Length != 0)
				{
					Collider[] array2 = array;
					foreach (Collider val in array2)
					{
						DoorLock component = ((Component)val).gameObject.GetComponent<DoorLock>();
						if ((Object)(object)component != (Object)null)
						{
							CheckIfCanBreakDoor(component);
						}
					}
				}
			}
			attackCooldown = attackCooldownBeheader;
		}

		private void Awake()
		{
			attackCooldownBeheader = attackCooldown;
			attackCooldown = 0f;
			startCo = ((MonoBehaviour)this).StartCoroutine(StartCoroutineFLAMINGO());
			damage = Plugin.FlamingoConfig.DAMAGE_NORMAL.Value;
			if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null)
			{
				flamingoManager = global::SCP1507.FlamingoManager.FlamingoManager.Instance;
				flamingoManager.RegisterScp1507Instance(this);
			}
			Random random = new Random();
			bool value = random.Next(2) == 0;
			PlayAnimationClientRpc("DanceDirection", value);
		}

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

		[ClientRpc]
		public void StartCallAlphaClientRpc(int x)
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3896637521u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, x);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3896637521u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			((MonoBehaviour)this).StopCoroutine(startCo);
			Scp1507Alpha[] array = Object.FindObjectsOfType<Scp1507Alpha>();
			foreach (Scp1507Alpha scp1507Alpha in array)
			{
				if (scp1507Alpha.alphaId == x)
				{
					alpha = scp1507Alpha;
					alphaId = x;
					isAlphaAlive = true;
					break;
				}
			}
		}

		private void LateUpdate()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			if (isAlphaAlive)
			{
				if (alpha.LocalAnger >= 7)
				{
					if ((Object)(object)Scp1507TargetPlayer != (Object)null)
					{
						lookAt.position = Scp1507TargetPlayer.playerEye.position;
					}
					else
					{
						lookAt.position = defaultLookAt.position;
					}
				}
				else
				{
					lookAt.position = defaultLookAt.position;
				}
			}
			else if ((Object)(object)((EnemyAI)this).GetClosestPlayer(false, false, false) != (Object)null)
			{
				lookAt.position = ((Component)((EnemyAI)this).GetClosestPlayer(false, false, false)).transform.position;
			}
			attackCooldown += Time.deltaTime;
		}

		public override void DoAIInterval()
		{
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.isStopped = true;
				base.agent.speed = 5f;
				base.agent.ResetPath();
				break;
			case 1:
				base.agent.isStopped = false;
				Scp1507TargetPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false);
				base.agent.speed = 5f;
				if (base.creatureAnimator.GetBool("Dancing"))
				{
					PlayAnimationClientRpc("Dancing", value: false);
				}
				if (!((Object)(object)Scp1507TargetPlayer != (Object)null))
				{
					break;
				}
				if (Vector3.Distance(((Component)this).transform.position, ((Component)Scp1507TargetPlayer).transform.position) > 10f)
				{
					base.agent.SetDestination(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)alpha).transform.position, 10f, default(NavMeshHit)));
					base.agent.speed = 10f;
				}
				else if ((Object)(object)Scp1507TargetPlayer != (Object)null)
				{
					base.agent.SetDestination(((Component)Scp1507TargetPlayer).transform.position);
					if (Vector3.Distance(((Component)this).transform.position, ((Component)Scp1507TargetPlayer).transform.position) < 1.2f && attackCooldown >= 1f)
					{
						PlayAnimationClientRpc("Attack");
					}
				}
				break;
			case 2:
				base.agent.speed = 5f;
				Scp1507TargetPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false);
				if ((Object)(object)Scp1507TargetPlayer != (Object)null)
				{
					base.agent.SetDestination(((Component)Scp1507TargetPlayer).transform.position);
					if (Vector3.Distance(((Component)this).transform.position, ((Component)Scp1507TargetPlayer).transform.position) < 1.2f && attackCooldown >= 1f)
					{
						PlayAnimationClientRpc("Attack");
					}
				}
				else
				{
					base.agent.ResetPath();
				}
				break;
			default:
				MonsterLogger("WRONG BEHAVIOUR STATE INDEX!", reportable: true);
				break;
			case 3:
				break;
			}
		}

		public void StopMoving(int flamingoId)
		{
			if (flamingoId == alphaId)
			{
				PlayAnimationClientRpc("Walking", value: false);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
		}

		public void TriggerAlphaCharge(int flamingoId)
		{
			if (flamingoId == alphaId)
			{
				PlayAnimationClientRpc("Walking", value: true);
				((EnemyAI)this).SwitchToBehaviourClientRpc(1);
			}
		}

		public void TriggerRampage(int flamingoId)
		{
			if (flamingoId == alphaId || flamingoId == 2000)
			{
				PlayAnimationClientRpc("Walking", value: true);
				((EnemyAI)this).SwitchToBehaviourClientRpc(2);
			}
		}

		private bool CheckIfPlayerDances()
		{
			//IL_001e: 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)
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			int num = 0;
			if (num < allPlayerScripts.Length)
			{
				PlayerControllerB val = allPlayerScripts[num];
				if (!(Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < 10f) && val.performingEmote)
				{
					return true;
				}
			}
			return false;
		}

		[ClientRpc]
		public void PlayAnimationClientRpc(string animationName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			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(783826533u, val, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 783826533u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

		[ClientRpc]
		public void PlayAnimationClientRpc(string animationName, 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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)
			//IL_00d5: 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(3605508353u, val, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3605508353u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				base.creatureAnimator.SetBool(animationName, value);
			}
		}

		public void StartDance()
		{
			PlayAnimationClientRpc("Dancing", value: true);
		}

		public void StopDance()
		{
			PlayAnimationClientRpc("Dancing", value: false);
		}

		private void MonsterLogger(string message, bool reportable = false)
		{
			if (!reportable)
			{
				Plugin.Logger.LogInfo((object)("[ProjectSCP.SCP1507][SCP1507Instance][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message));
			}
			else
			{
				Plugin.Logger.LogError((object)("[ProjectSCP.SCP1507][SCP1507Instance][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message));
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if ((Object)(object)playerWhoHit != (Object)null && isAlphaAlive)
			{
				alpha.LocalAnger += 5;
				try
				{
					alpha.GiveServerAngerServerRpc(playerWhoHit.actualClientId, alpha.LocalAnger);
				}
				catch (InvalidOperationException)
				{
					MonsterLogger("Small error on calling!");
					throw;
				}
			}
			if (base.isEnemyDead)
			{
				return;
			}
			base.enemyHP -= force;
			if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead)
			{
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
				if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null)
				{
					global::SCP1507.FlamingoManager.FlamingoManager.Instance.UnregisterScp1507Instance(this);
				}
			}
		}

		[ClientRpc]
		public void SwingAttackHitClientRpc()
		{
			//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)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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(2851027910u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2851027910u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			int num = 8;
			Collider[] array = Physics.OverlapBox(AttackArea.position, AttackArea.localScale, Quaternion.identity, num);
			if (array.Length != 0)
			{
				Collider[] array2 = array;
				foreach (Collider val3 in array2)
				{
					PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false);
					if ((Object)(object)val4 != (Object)null)
					{
						base.creatureSFX.PlayOneShot(attacks[RandomNumberGenerator.GetInt32(attacks.Length)]);
						MonsterLogger(val4.health.ToString());
						KillCoroutine = ((MonoBehaviour)this).StartCoroutine(DamagePlayerCoroutine(val4));
					}
				}
			}
			attackCooldown = attackCooldownBeheader;
		}

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

		protected override void __initializeVariables()
		{
			if (_playerNetVar == null)
			{
				throw new Exception("Scp1507._playerNetVar cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)_playerNetVar).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_playerNetVar, "_playerNetVar");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_playerNetVar);
			((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
			((NetworkBehaviour)this).__registerRpc(4184319842u, new RpcReceiveHandler(__rpc_handler_4184319842), "BashDoorClientRpc");
			((NetworkBehaviour)this).__registerRpc(3896637521u, new RpcReceiveHandler(__rpc_handler_3896637521), "StartCallAlphaClientRpc");
			((NetworkBehaviour)this).__registerRpc(783826533u, new RpcReceiveHandler(__rpc_handler_783826533), "PlayAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(3605508353u, new RpcReceiveHandler(__rpc_handler_3605508353), "PlayAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(2851027910u, new RpcReceiveHandler(__rpc_handler_2851027910), "SwingAttackHitClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_4184319842(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netObjRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Scp1507)(object)target).BashDoorClientRpc(netObjRef, position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3896637521(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 x = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref x);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Scp1507)(object)target).StartCallAlphaClientRpc(x);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_783826533(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string animationName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Scp1507)(object)target).PlayAnimationClientRpc(animationName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3605508353(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_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string animationName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
				}
				bool value = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Scp1507)(object)target).PlayAnimationClientRpc(animationName, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2851027910(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;
				((Scp1507)(object)target).SwingAttackHitClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "Scp1507";
		}
	}
	public class HatHandler : MonoBehaviour
	{
		public List<GameObject> allHats;

		private void Awake()
		{
			if (Plugin.FlamingoConfig.CUSTOM_HAT.Value)
			{
				int @int = RandomNumberGenerator.GetInt32(allHats.Count);
				allHats[@int].SetActive(true);
				allHats.RemoveAt(@int);
			}
			foreach (GameObject allHat in allHats)
			{
				Object.Destroy((Object)(object)allHat);
			}
		}
	}
	public enum State
	{
		Unmoving,
		AlphaCharge,
		Rampage,
		None
	}
}
namespace SCP1507.Patches
{
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbableObjectPatch
	{
		[HarmonyPatch("GrabServerRpc")]
		[HarmonyPostfix]
		private static void PostFix(GrabbableObject __instance)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"WE DID GRAB ITEM!");
			if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null)
			{
				global::SCP1507.FlamingoManager.FlamingoManager.Instance.PickupItemTrigger(__instance.playerHeldBy, ((Component)__instance).transform.position);
			}
		}
	}
	[HarmonyPatch(typeof(NoisemakerProp))]
	internal class NoiseItemPatch
	{
		[HarmonyPatch("ItemActivate")]
		[HarmonyPrefix]
		private static bool PreFix(NoisemakerProp __instance, bool used, bool buttonDown = true)
		{
			if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null)
			{
				Debug.Log((object)"Activated!");
				if (((Object)__instance).name == "Airhorn(Clone)")
				{
					Debug.Log((object)"It's an Airhorn!");
					global::SCP1507.FlamingoManager.FlamingoManager.Instance.AirHornCheck(((GrabbableObject)__instance).playerHeldBy);
				}
				if (((Object)__instance).name == "Clownhorn(Clone)")
				{
					Debug.Log((object)"It's a clown Horn");
					global::SCP1507.FlamingoManager.FlamingoManager.Instance.ClownHornCheck(((GrabbableObject)__instance).playerHeldBy);
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("StartPerformingEmoteServerRpc")]
		[HarmonyPostfix]
		private static void PostFixStart(PlayerControllerB __instance)
		{
			if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null)
			{
				global::SCP1507.FlamingoManager.FlamingoManager.Instance.StartEmoting(__instance);
			}
		}

		[HarmonyPatch("StopPerformingEmoteServerRpc")]
		[HarmonyPostfix]
		private static void PostFixStop(PlayerControllerB __instance)
		{
			if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null)
			{
				global::SCP1507.FlamingoManager.FlamingoManager.Instance.StopEmoting(__instance);
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		[HarmonyPatch("UnloadSceneObjectsEarly")]
		[HarmonyPostfix]
		private static void PostFixStart(RoundManager __instance)
		{
			if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance != (Object)null)
			{
				global::SCP1507.FlamingoManager.FlamingoManager.Instance.DestroyManagerClientRpc();
			}
		}
	}
}
namespace SCP1507.FlamingoManager
{
	public class FlamingoManager : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <HonkForTimes>d__16 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public FlamingoManager <>4__this;

			public int numberOfHonks;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				int num = <>1__state;
				FlamingoManager flamingoManager = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					flamingoManager.honksDone = 0;
					break;
				case 1:
					<>1__state = -1;
					flamingoManager.honksDone++;
					break;
				}
				if (flamingoManager.honksDone < numberOfHonks)
				{
					flamingoManager.allFlamingo[RandomNumberGenerator.GetInt32(flamingoManager.allFlamingo.Count)].DoQuackSound();
					<>2__current = (object)new WaitForSeconds(RandomFloatBetween(0.1f, 1f));
					<>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();
			}
		}

		private static FlamingoManager _instance;

		private List<Scp1507> allFlamingo;

		private List<EmoteTime> playersDoingEmotes;

		private int honksDone;

		public static FlamingoManager Instance => _instance;

		private void Awake()
		{
			allFlamingo = new List<Scp1507>();
			playersDoingEmotes = new List<EmoteTime>();
			if ((Object)(object)_instance != (Object)null && (Object)(object)_instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			_instance = this;
			((MonoBehaviour)this).InvokeRepeating("CheckIfSeen", 2f, 7f);
			((MonoBehaviour)this).InvokeRepeating("Emotehandles", 5f, 1f);
			((MonoBehaviour)this).InvokeRepeating("HonkManager", 5f, 6f);
		}

		public void RegisterScp1507Instance(Scp1507 instance)
		{
			allFlamingo.Add(instance);
		}

		public void UnregisterScp1507Instance(Scp1507 instance)
		{
			foreach (Scp1507 item in allFlamingo)
			{
				if ((Object)(object)item == (Object)(object)instance)
				{
					allFlamingo.Remove(instance);
					break;
				}
			}
		}

		public void AirHornCheck(PlayerControllerB playerHeldBy)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			foreach (Scp1507 item in allFlamingo)
			{
				float num = Vector3.Distance(((Component)playerHeldBy).transform.position, ((Component)item).transform.position);
				if (num <= 5f && (Object)(object)item.alpha != (Object)null)
				{
					item.alpha.LocalAnger++;
					item.alpha.GiveServerAngerServerRpc(playerHeldBy.actualClientId, item.alpha.LocalAnger);
					break;
				}
			}
		}

		public void ClownHornCheck(PlayerControllerB playerHeldBy)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			foreach (Scp1507 item in allFlamingo)
			{
				float num = Vector3.Distance(((Component)playerHeldBy).transform.position, ((Component)item).transform.position);
				if (num <= 5f && (Object)(object)item.alpha != (Object)null)
				{
					item.alpha.LocalAnger--;
					item.alpha.GiveServerAngerServerRpc(playerHeldBy.actualClientId, item.alpha.LocalAnger);
					break;
				}
			}
		}

		public void PickupItemTrigger(PlayerControllerB playerHeldBy, Vector3 positionOfPickup)
		{
			//IL_0016: 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)
			foreach (Scp1507 item in allFlamingo)
			{
				float num = Vector3.Distance(positionOfPickup, ((Component)item).transform.position);
				if (num <= 5f)
				{
					item.alpha.LocalAnger += 2;
					item.alpha.GiveServerAngerServerRpc(playerHeldBy.actualClientId, item.alpha.LocalAnger);
					break;
				}
			}
		}

		public void CheckIfSeen()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] array = RoundManager.Instance.playersManager.allPlayerScripts.Where((PlayerControllerB player) => !player.isPlayerDead && player.isPlayerControlled && player.isInsideFactory).ToArray();
			if (array.Length == 0)
			{
				return;
			}
			PlayerControllerB val = array[RandomNumberGenerator.GetInt32(array.Length)];
			foreach (Scp1507 item in allFlamingo)
			{
				if ((Object)(object)item == (Object)null || !val.HasLineOfSightToPosition(((Component)item).transform.position, 45f, 60, -1f, -1) || !((Object)(object)item.alpha != (Object)null))
				{
					continue;
				}
				item.alpha.LocalAnger += 2;
				GrabbableObject[] itemSlots = val.ItemSlots;
				foreach (GrabbableObject val2 in itemSlots)
				{
					if ((Object)(object)val2 == (Object)null)
					{
						continue;
					}
					MonsterLogger("1 DONE");
					if (val2.isHeld)
					{
						MonsterLogger("2 DONE");
						if ((Object)(object)((Component)val2).gameObject.GetComponent<Shovel>() != (Object)null)
						{
							MonsterLogger("Holding shovel!");
							item.alpha.LocalAnger += 3;
							break;
						}
						if ((Object)(object)((Component)val2).gameObject.GetComponent<KnifeItem>() != (Object)null)
						{
							item.alpha.LocalAnger += 3;
							break;
						}
						if ((Object)(object)((Component)val2).gameObject.GetComponent<ShotgunItem>() != (Object)null)
						{
							item.alpha.LocalAnger += 7;
							break;
						}
					}
				}
				item.alpha.GiveServerAngerServerRpc(val.actualClientId, item.alpha.LocalAnger);
				break;
			}
		}

		public void Emotehandles()
		{
			foreach (EmoteTime playersDoingEmote in playersDoingEmotes)
			{
				playersDoingEmote.TimeEmoting++;
				if (allFlamingo != null)
				{
					switch (playersDoingEmote.TimeEmoting)
					{
					case 10:
						allFlamingo[0].alpha.LocalAnger--;
						allFlamingo[0].alpha.GiveServerAngerServerRpc(playersDoingEmote.ClientId, allFlamingo[0].alpha.LocalAnger);
						break;
					case 20:
						allFlamingo[0].alpha.LocalAnger -= 2;
						allFlamingo[0].alpha.GiveServerAngerServerRpc(playersDoingEmote.ClientId, allFlamingo[0].alpha.LocalAnger);
						break;
					case 30:
						allFlamingo[0].alpha.LocalAnger -= 3;
						allFlamingo[0].alpha.GiveServerAngerServerRpc(playersDoingEmote.ClientId, allFlamingo[0].alpha.LocalAnger);
						break;
					case 40:
						allFlamingo[0].alpha.LocalAnger -= 4;
						allFlamingo[0].alpha.GiveServerAngerServerRpc(playersDoingEmote.ClientId, allFlamingo[0].alpha.LocalAnger);
						break;
					}
				}
			}
		}

		public void StartEmoting(PlayerControllerB actualPlayer)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB actualPlayer2 = actualPlayer;
			bool flag = false;
			try
			{
				foreach (Scp1507 item in allFlamingo)
				{
					try
					{
						if (Vector3.Distance(((Component)item).transform.position, ((Component)actualPlayer2).transform.position) < 6f)
						{
							item.StartDance();
							flag = true;
						}
					}
					catch (NullReferenceException)
					{
						UnregisterScp1507Instance(item);
					}
				}
			}
			catch (InvalidOperationException)
			{
			}
			if (flag && playersDoingEmotes.FirstOrDefault((EmoteTime e) => e.ClientId == actualPlayer2.actualClientId) == null)
			{
				playersDoingEmotes.Add(new EmoteTime(actualPlayer2.actualClientId));
			}
		}

		public void HonkManager()
		{
			if (allFlamingo.Count != 0)
			{
				int num = allFlamingo.Count / 3;
				num++;
				((MonoBehaviour)this).StartCoroutine(HonkForTimes(num));
			}
		}

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

		public void StopEmoting(PlayerControllerB actualPlayer)
		{
			//IL_0034: 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)
			PlayerControllerB actualPlayer2 = actualPlayer;
			bool flag = false;
			foreach (Scp1507 item in allFlamingo)
			{
				if (!((Object)(object)item == (Object)null) && Vector3.Distance(((Component)item).transform.position, ((Component)actualPlayer2).transform.position) < 6f)
				{
					item.StopDance();
					flag = true;
				}
			}
			if (flag)
			{
				playersDoingEmotes.Remove(playersDoingEmotes.FirstOrDefault((EmoteTime e) => e.ClientId == actualPlayer2.actualClientId));
			}
		}

		public static float RandomFloatBetween(float min, float max)
		{
			Random random = new Random();
			double num = max - min;
			double num2 = random.NextDouble();
			double num3 = num2 * num + (double)min;
			return (float)num3;
		}

		[ClientRpc]
		public void DestroyManagerClientRpc()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void OnDestroy()
		{
			((MonoBehaviour)this).StopAllCoroutines();
			((MonoBehaviour)this).CancelInvoke("CheckIfSeen");
			((MonoBehaviour)this).CancelInvoke("Emotehandles");
			((MonoBehaviour)this).CancelInvoke("HonkManager");
		}

		private void MonsterLogger(string message, bool reportable = false)
		{
			if (!reportable)
			{
				Plugin.Logger.Log((LogLevel)16, (object)("[ProjectSCP.SCP1507][SCP1507Manager][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message));
			}
			else
			{
				Plugin.Logger.Log((LogLevel)2, (object)("[ProjectSCP.SCP1507][SCP1507Manager][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message));
			}
		}
	}
}
namespace SCP1507.DataClass
{
	public class PlayerRecord
	{
		private PlayerControllerB playerControllerB;

		private ulong clientId;

		private int angerMeter;

		private bool angered;

		public PlayerControllerB PlayerControllerB => playerControllerB;

		public ulong ClientId => clientId;

		public bool Angered
		{
			get
			{
				if (!playerControllerB.isPlayerDead && playerControllerB.isInsideFactory)
				{
					return angered;
				}
				return false;
			}
		}

		public int AngerMeter
		{
			get
			{
				return angerMeter;
			}
			set
			{
				if (value <= 0)
				{
					angerMeter = 0;
					return;
				}
				if (value >= Plugin.FlamingoConfig.ANGER_FOR_ANGRY_FLAMINGO.Value)
				{
					angered = true;
				}
				angerMeter = value;
			}
		}

		public PlayerRecord(ulong clientId, int angerMeter)
		{
			this.clientId = clientId;
			this.angerMeter = angerMeter;
			if (this.angerMeter >= Plugin.FlamingoConfig.ANGER_FOR_ANGRY_FLAMINGO.Value)
			{
				angered = true;
			}
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.playerClientId == clientId)
				{
					playerControllerB = val;
				}
			}
		}
	}
}
namespace SCP1507.SCP1507Alpha
{
	public class EmoteTime
	{
		private ulong clientId;

		private int timeEmoting;

		public int TimeEmoting
		{
			get
			{
				return timeEmoting;
			}
			set
			{
				timeEmoting = value;
			}
		}

		public ulong ClientId => clientId;

		public EmoteTime(ulong clientId)
		{
			this.clientId = clientId;
			timeEmoting = 0;
		}
	}
	public class Scp1507Alpha : EnemyAI
	{
		[CompilerGenerated]
		private sealed class <CheckIfLookedCoroutine>d__52 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Scp1507Alpha <>4__this;

			private int <numberOfSecondsSeen>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Expected O, but got Unknown
				int num = <>1__state;
				Scp1507Alpha scp1507Alpha = <>4__this;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
				}
				else
				{
					<>1__state = -1;
					<numberOfSecondsSeen>5__2 = 0;
				}
				while (!scp1507Alpha.CheckIfLocalPlayerHasVisionToCurrentPosition_ONEPLAYER())
				{
					<numberOfSecondsSeen>5__2 = 0;
				}
				<numberOfSecondsSeen>5__2++;
				switch (<numberOfSecondsSeen>5__2)
				{
				case 10:
					scp1507Alpha.AddToAnger(1);
					break;
				case 20:
					scp1507Alpha.AddToAnger(2);
					break;
				case 30:
					scp1507Alpha.AddToAnger(3);
					break;
				case 40:
					scp1507Alpha.AddToAnger(4);
					break;
				}
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			}

			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 <DamagePlayerCoroutine>d__61 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerControllerB playerControllerB;

			public Scp1507Alpha <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				//IL_0051: 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)
				int num = <>1__state;
				Scp1507Alpha scp1507Alpha = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					playerControllerB.DamagePlayer(scp1507Alpha.damage, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					((MonoBehaviour)scp1507Alpha).StopCoroutine(scp1507Alpha.KillCoroutine);
					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 <OrderCrusade>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Scp1507Alpha <>4__this;

			private Scp1507[] <>7__wrap1;

			private int <>7__wrap2;

			private Scp1507 <flamingo>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>7__wrap1 = null;
				<flamingo>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Expected O, but got Unknown
				int num = <>1__state;
				Scp1507Alpha scp1507Alpha = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>7__wrap1 = Object.FindObjectsOfType<Scp1507>();
					<>7__wrap2 = 0;
					break;
				case 1:
					<>1__state = -1;
					<flamingo>5__4.TriggerAlphaCharge(scp1507Alpha.alphaId);
					<flamingo>5__4 = null;
					<>7__wrap2++;
					break;
				}
				if (<>7__wrap2 < <>7__wrap1.Length)
				{
					<flamingo>5__4 = <>7__wrap1[<>7__wrap2];
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				}
				<>7__wrap1 = null;
				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 <OrderRampage>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Scp1507Alpha <>4__this;

			private Scp1507[] <>7__wrap1;

			private int <>7__wrap2;

			private Scp1507 <flamingo>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>7__wrap1 = null;
				<flamingo>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Expected O, but got Unknown
				int num = <>1__state;
				Scp1507Alpha scp1507Alpha = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>7__wrap1 = Object.FindObjectsOfType<Scp1507>();
					<>7__wrap2 = 0;
					break;
				case 1:
					<>1__state = -1;
					<flamingo>5__4.TriggerRampage(scp1507Alpha.alphaId);
					<flamingo>5__4 = null;
					<>7__wrap2++;
					break;
				}
				if (<>7__wrap2 < <>7__wrap1.Length)
				{
					<flamingo>5__4 = <>7__wrap1[<>7__wrap2];
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				}
				<>7__wrap1 = null;
				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 <OrderStop>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Scp1507Alpha <>4__this;

			private Scp1507[] <>7__wrap1;

			private int <>7__wrap2;

			private Scp1507 <flamingo>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>7__wrap1 = null;
				<flamingo>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Expected O, but got Unknown
				int num = <>1__state;
				Scp1507Alpha scp1507Alpha = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>7__wrap1 = Object.FindObjectsOfType<Scp1507>();
					<>7__wrap2 = 0;
					break;
				case 1:
					<>1__state = -1;
					<flamingo>5__4.StopMoving(scp1507Alpha.alphaId);
					<flamingo>5__4 = null;
					<>7__wrap2++;
					break;
				}
				if (<>7__wrap2 < <>7__wrap1.Length)
				{
					<flamingo>5__4 = <>7__wrap1[<>7__wrap2];
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				}
				<>7__wrap1 = null;
				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 <QuackAlpha>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Scp1507Alpha <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Expected O, but got Unknown
				int num = <>1__state;
				Scp1507Alpha scp1507Alpha = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					scp1507Alpha.DoQuackSound();
					break;
				}
				if (!((EnemyAI)scp1507Alpha).isEnemyDead)
				{
					<>2__current = (object)new WaitForSeconds(global::SCP1507.FlamingoManager.FlamingoManager.RandomFloatBetween(5f, 10f));
					<>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();
			}
		}

		private List<DoorHold> currentBreakingDoors;

		[Header("Make anger")]
		public int alphaId;

		private int localAnger;

		public List<PlayerRecord> listOfAnger;

		[Header("NetStats")]
		private ulong localPlayerId;

		private PlayerControllerB localPlayer;

		[Header("Audio")]
		public AudioClip[] honks;

		public AudioClip[] attacks;

		public AudioSource walkingSource;

		[Header("FlamingoBasics")]
		private bool isSeen;

		[Header("Attack")]
		public int damage;

		public Transform AttackArea;

		public float attackCooldown;

		private float attackCooldownBeheader;

		[Header("Look")]
		public Transform lookAt;

		public Transform defaultLookAt;

		private Coroutine beingLookedAtCoroutine;

		private Coroutine KillCoroutine;

		private int numberOfFlamingos;

		[NonSerialized]
		private NetworkVariable<NetworkBehaviourReference> _playerNetVar = new NetworkVariable<NetworkBehaviourReference>(default(NetworkBehaviourReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public int LocalAnger
		{
			get
			{
				return localAnger;
			}
			set
			{
				localAnger = value;
			}
		}

		public PlayerControllerB Scp1507AlphaTargetPlayer
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				return (PlayerControllerB)NetworkBehaviourReference.op_Implicit(_playerNetVar.Value);
			}
			set
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)value == (Object)null)
				{
					_playerNetVar.Value = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)null);
				}
				else
				{
					_playerNetVar.Value = new NetworkBehaviourReference((NetworkBehaviour)(object)value);
				}
			}
		}

		private void DoAttackSound()
		{
			try
			{
				base.creatureSFX.PlayOneShot(attacks[RandomNumberGenerator.GetInt32(attacks.Length)]);
			}
			catch (ArgumentNullException)
			{
			}
			catch (NullReferenceException)
			{
			}
		}

		private void DoQuackSound()
		{
			try
			{
				base.creatureVoice.PlayOneShot(honks[RandomNumberGenerator.GetInt32(honks.Length)]);
			}
			catch (ArgumentNullException)
			{
			}
			catch (NullReferenceException)
			{
			}
		}

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

		public bool HitDoor(DoorLock door)
		{
			foreach (DoorHold currentBreakingDoor in currentBreakingDoors)
			{
				if ((Object)(object)door == (Object)(object)currentBreakingDoor.Door)
				{
					currentBreakingDoor.NumberOfHits++;
					if (currentBreakingDoor.CanBreak)
					{
						return true;
					}
					return false;
				}
			}
			currentBreakingDoors.Add(new DoorHold(door));
			return false;
		}

		public void DeleteDoor(DoorLock door)
		{
			foreach (DoorHold currentBreakingDoor in currentBreakingDoors)
			{
				if ((Object)(object)door == (Object)(object)currentBreakingDoor.Door)
				{
					currentBreakingDoors.Remove(currentBreakingDoor);
				}
			}
		}

		public void SpawnNewFlamingo()
		{
			//IL_0060: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
			SelectableLevel currentLevel = RoundManager.Instance.currentLevel;
			list.AddRange(RoundManager.Instance.currentLevel.Enemies);
			SpawnableEnemyWithRarity val = list.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower() == "scp1507");
			if (val != null)
			{
				GameObject val2 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 10f, default(NavMeshHit)), (float)Random.RandomRangeInt(0, 360), RoundManager.Instance.currentLevel.Enemies.IndexOf(val), val.enemyType));
				val2.GetComponent<Scp1507>().StartCallAlphaClientRpc(alphaId);
				numberOfFlamingos++;
				if (RandomNumberGenerator.GetInt32(100) <= Plugin.FlamingoConfig.CHANCE_SPAWN_NEW_ALPHA.Value && Plugin.FlamingoConfig.CAN_SPAWN_ALPHA.Value)
				{
					SpawnNewAlphaFlamingo();
				}
			}
		}

		public void SpawnNewAlphaFlamingo()
		{
			//IL_0060: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
			SelectableLevel currentLevel = RoundManager.Instance.currentLevel;
			list.AddRange(RoundManager.Instance.currentLevel.Enemies);
			SpawnableEnemyWithRarity val = list.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower() == "scp1507alpha");
			if (val != null)
			{
				GameObject val2 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 10f, default(NavMeshHit)), (float)Random.RandomRangeInt(0, 360), RoundManager.Instance.currentLevel.Enemies.IndexOf(val), val.enemyType));
				val2.GetComponent<Scp1507>().StartCallAlphaClientRpc(alphaId);
			}
		}

		public void ActivateRampage()
		{
			((MonoBehaviour)this).StartCoroutine(OrderRampage());
		}

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

		public void StartCrusade()
		{
			MonsterLogger("Calling Crusade! ");
			Scp1507[] array = Object.FindObjectsOfType<Scp1507>();
			foreach (Scp1507 scp in array)
			{
				((MonoBehaviour)this).StartCoroutine(OrderCrusade());
			}
		}

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

		public void StopMoving()
		{
			Scp1507[] array = Object.FindObjectsOfType<Scp1507>();
			foreach (Scp1507 scp in array)
			{
				((MonoBehaviour)this).StartCoroutine(OrderStop());
			}
		}

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

		[ServerRpc(RequireOwnership = false)]
		public void GiveServerAngerServerRpc(ulong clientId, int anger)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1748763037u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				BytePacker.WriteValueBitPacked(val2, anger);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1748763037u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			try
			{
				PlayerRecord playerByClientId = GetPlayerByClientId(clientId);
				playerByClientId.AngerMeter = anger;
				MonsterLogger("Player is " + playerByClientId.AngerMeter);
			}
			catch (KeyNotFoundException value)
			{
				Console.WriteLine(value);
				listOfAnger.Add(new PlayerRecord(clientId, anger));
			}
		}

		[ClientRpc]
		public void StartLookAtCoroutineClientRpc()
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(100667040u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 100667040u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (beingLookedAtCoroutine == null)
				{
					beingLookedAtCoroutine = ((MonoBehaviour)this).StartCoroutine(CheckIfLookedCoroutine());
				}
			}
		}

		[ClientRpc]
		public void PlayAnimationClientRpc(string animationName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			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(81093682u, val, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 81093682u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

		[ClientRpc]
		public void PlayAnimationClientRpc(string animationName, 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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)
			//IL_00d5: 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(3413923772u, val, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3413923772u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				base.creatureAnimator.SetBool(animationName, value);
			}
		}

		private void Awake()
		{
			numberOfFlamingos = 0;
			damage = Plugin.FlamingoConfig.DAMAGE_NORMAL.Value;
			alphaId = RandomNumberGenerator.GetInt32(1000);
			localAnger = 0;
			listOfAnger = new List<PlayerRecord>();
		}

		public override void Start()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			((EnemyAI)this).Start();
			localPlayer = RoundManager.Instance.playersManager.localPlayerController;
			localPlayerId = localPlayer.playerClientId;
			StartAlphaSearch();
			attackCooldownBeheader = attackCooldown;
			attackCooldown = 0f;
			PlayAnimationClientRpc("IsAlpha", value: true);
			if ((Object)(object)global::SCP1507.FlamingoManager.FlamingoManager.Instance == (Object)null)
			{
				GameObject val = new GameObject("Scp1507Manager");
				val.AddComponent<global::SCP1507.FlamingoManager.FlamingoManager>();
			}
		}

		private void LateUpdate()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (!base.isEnemyDead)
			{
				if ((Object)(object)Scp1507AlphaTargetPlayer != (Object)null)
				{
					lookAt.position = Scp1507AlphaTargetPlayer.playerEye.position;
				}
				else
				{
					lookAt.position = defaultLookAt.position;
				}
			}
			attackCooldown += Time.deltaTime;
		}

		public override void DoAIInterval()
		{
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.isStopped = true;
				PlayAnimationClientRpc("Walking", value: false);
				if (!CheckIfAPlayerHasVisionToCurrentPosition())
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				if (FindAlphaTarget())
				{
					StartCrusade();
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
				}
				break;
			case 1:
				base.agent.isStopped = false;
				PlayAnimationClientRpc("Walking", value: true);
				if (CheckIfAPlayerHasVisionToCurrentPosition())
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				if (FindAlphaTarget())
				{
					StartCrusade();
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
				}
				if (RandomNumberGenerator.GetInt32(100) <= Plugin.FlamingoConfig.CHANCE_SPAWN_NEW_FLAMINGO.Value && numberOfFlamingos <= Plugin.FlamingoConfig.MAXIMUM_NUMBER_OF_FLAMINGO.Value)
				{
					SpawnNewFlamingo();
				}
				break;
			case 2:
				base.agent.isStopped = false;
				((MonoBehaviour)this).StopCoroutine(base.searchCoroutine);
				PlayAnimationClientRpc("Walking", value: true);
				base.agent.SetDestination(((Component)Scp1507AlphaTargetPlayer).transform.position);
				if (Vector3.Distance(((Component)this).transform.position, ((Component)Scp1507AlphaTargetPlayer).transform.position) < 1.2f && attackCooldown >= attackCooldownBeheader)
				{
					PlayAnimationClientRpc("Attack");
				}
				if (!Scp1507AlphaTargetPlayer.isInsideFactory || Scp1507AlphaTargetPlayer.isPlayerDead)
				{
					base.agent.ResetPath();
					StartAlphaSearch();
					StopMoving();
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				break;
			default:
				MonsterLogger("WRONG BEHAVIOUR STATE INDEX!", reportable: true);
				break;
			}
		}

		private bool CheckIfPlayerDances()
		{
			//IL_001e: 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)
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			int num = 0;
			if (num < allPlayerScripts.Length)
			{
				PlayerControllerB val = allPlayerScripts[num];
				if (Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < 6f && val.performingEmote)
				{
					return true;
				}
			}
			return false;
		}

		private void StartAlphaSearch()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (base.searchCoroutine == null)
			{
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			}
		}

		private bool FindAlphaTarget()
		{
			if (listOfAnger == null)
			{
				MonsterLogger("List of Anger is null", reportable: true);
				return false;
			}
			int num = 0;
			PlayerRecord playerRecord = null;
			foreach (PlayerRecord item in listOfAnger)
			{
				if (item == null)
				{
					MonsterLogger("Encounteed a null value Entry", reportable: true);
				}
				else if (item.Angered && num < item.AngerMeter)
				{
					num = item.AngerMeter;
					playerRecord = item;
				}
			}
			if (playerRecord == null)
			{
				return false;
			}
			Scp1507AlphaTargetPlayer = playerRecord.PlayerControllerB;
			return true;
		}

		private bool CheckIfAPlayerHasVisionToCurrentPosition()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f, -1))
				{
					isSeen = true;
					return true;
				}
			}
			return false;
		}

		private bool CheckIfLocalPlayerHasVisionToCurrentPosition_ONEPLAYER()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if (localPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f, -1))
			{
				isSeen = true;
				return true;
			}
			return false;
		}

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

		public void AddToAnger(int x)
		{
			localAnger += x;
			GiveServerAngerServerRpc(localPlayerId, localAnger);
		}

		public void SetToAnger(int x)
		{
			localAnger = x;
			GiveServerAngerServerRpc(localPlayerId, localAnger);
		}

		public void RemoveToAnger(int x)
		{
			localAnger -= x;
			GiveServerAngerServerRpc(localPlayerId, localAnger);
		}

		private PlayerRecord? GetPlayerByClientId(ulong clientId)
		{
			for (int i = 0; i < listOfAnger.Count; i++)
			{
				if (listOfAnger[i].ClientId == clientId)
				{
					return listOfAnger[i];
				}
			}
			throw new KeyNotFoundException("Player with the given ClientId was not found. CREATING NEW PROFILE");
		}

		private void MonsterLogger(string message, bool reportable = false)
		{
			if (!reportable)
			{
				Plugin.Logger.Log((LogLevel)16, (object)("[ProjectSCP.SCP1507][SCP1507Alpha][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message));
			}
			else
			{
				Plugin.Logger.Log((LogLevel)2, (object)("[ProjectSCP.SCP1507][SCP1507Alpha][" + (reportable ? "PLEASE REPORT TO US IN THE DISCORD CHANNEL" : "Don't Report") + "] ~ " + message));
			}
		}

		public override void OnDestroy()
		{
			((EnemyAI)this).OnDestroy();
		}

		public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if ((Object)(object)playerWhoHit != (Object)null)
			{
				GiveServerAngerServerRpc(playerWhoHit.actualClientId, 20);
			}
			if (base.isEnemyDead)
			{
				return;
			}
			base.enemyHP -= force;
			if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead)
			{
				if (base.searchCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(base.searchCoroutine);
				}
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
				ActivateRampage();
			}
		}

		[ClientRpc]
		public void SwingAttackHitClientRpc()
		{
			//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)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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(4249217996u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4249217996u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			int num = 8;
			Collider[] array = Physics.OverlapBox(AttackArea.position, AttackArea.localScale, Quaternion.identity, num);
			if (array.Length != 0)
			{
				Collider[] array2 = array;
				foreach (Collider val3 in array2)
				{
					PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false);
					if ((Object)(object)val4 != (Object)null)
					{
						DoAttackSound();
						KillCoroutine = ((MonoBehaviour)this).StartCoroutine(DamagePlayerCoroutine(val4));
					}
				}
			}
			attackCooldown = 0f;
		}

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

		protected override void __initializeVariables()
		{
			if (_playerNetVar == null)
			{
				throw new Exception("Scp1507Alpha._playerNetVar cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)_playerNetVar).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_playerNetVar, "_playerNetVar");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_playerNetVar);
			((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
			((NetworkBehaviour)this).__registerRpc(1748763037u, new RpcReceiveHandler(__rpc_handler_1748763037), "GiveServerAngerServerRpc");
			((NetworkBehaviour)this).__registerRpc(100667040u, new RpcReceiveHandler(__rpc_handler_100667040), "StartLookAtCoroutineClientRpc");
			((NetworkBehaviour)this).__registerRpc(81093682u, new RpcReceiveHandler(__rpc_handler_81093682), "PlayAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(3413923772u, new RpcReceiveHandler(__rpc_handler_3413923772), "PlayAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(4249217996u, new RpcReceiveHandler(__rpc_handler_4249217996), "SwingAttackHitClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_1748763037(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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)
			//IL_0043: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				int anger = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref anger);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Scp1507Alpha)(object)target).GiveServerAngerServerRpc(clientId, anger);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_100667040(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;
				((Scp1507Alpha)(object)target).StartLookAtCoroutineClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_81093682(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string animationName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Scp1507Alpha)(object)target).PlayAnimationClientRpc(animationName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3413923772(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_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string animationName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
				}
				bool value = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Scp1507Alpha)(object)target).PlayAnimationClientRpc(animationName, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_han