Decompiled source of Doggie v0.9.0

plugins/Doggie.dll

Decompiled an hour ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Voice;
using REPOLib.Modules;
using REPOLib.Objects.Sdk;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.Rendering;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SCP939
{
	public class AI939 : MonoBehaviour
	{
		public enum State
		{
			Spawn,
			Roam,
			Idle,
			Run,
			Crouch,
			Lunge,
			Land,
			Claw,
			Search,
			Lure,
			Cloud,
			Flee,
			Stun,
			Despawn
		}

		public Transform model;

		public Transform head;

		public Transform[] contacts;

		public Animation anim;

		public AudioSource breath;

		public AudioSource voice;

		public AudioSource feet;

		public AudioSource mimicSource;

		public float sole;

		public Vector3 modelHome;

		private Enemy enemy;

		private PhotonView photonView;

		private EnemyStateInvestigate investigate;

		private readonly SpringQuaternion rotationSpring = new SpringQuaternion
		{
			damping = 0.6f,
			speed = 10f
		};

		private Quaternion rotationTarget = Quaternion.identity;

		public State state;

		private int variant;

		private Vector3 focus;

		private bool impulse = true;

		private float timer;

		private float listenTick;

		private float cloudCooldown;

		private float fleeCooldown;

		private float mimicTimer;

		private float stuckTimer;

		private Vector3 heardAt;

		private Vector3 destination;

		private Vector3 lungeEnd;

		private float lungeTime = 1.1f;

		private PlayerAvatar heardWho;

		private PlayerAvatar lastVoice;

		private float heardTime = -99f;

		private float planTime = -99f;

		private bool hasVantage;

		private bool struck;

		private bool hasRoamHint;

		private Vector3 roamHint;

		private float approach;

		private readonly HashSet<PlayerAvatar> hitThisLunge = new HashSet<PlayerAvatar>();

		private const float ClawRange = 3.2f;

		private const float LungeMin = 3f;

		private AudioSource music;

		private float alertUntil;

		private readonly Dictionary<int, float> strikes = new Dictionary<int, float>();

		private static readonly RaycastHit[] hits = (RaycastHit[])(object)new RaycastHit[16];

		private State animState = (State)(-1);

		private bool clawSwingShown;

		private bool animSwing;

		private Vector3 lastPos;

		private float speed;

		private float stepTimer;

		private float planted = float.NaN;

		private static readonly RaycastHit[] floorHits = (RaycastHit[])(object)new RaycastHit[8];

		private readonly List<string> seq = new List<string>();

		private int seqIndex;

		private State soundState = (State)(-1);

		private int mimicAsked = -1;

		private int mimicClip = -1;

		private int mimicCount;

		private byte[][] mimicParts;

		private const int ChunkBytes = 6000;

		private static float LungeMax => Plugin.LungeRange.Value;

		private void Awake()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			enemy = ((Component)this).GetComponent<Enemy>();
			photonView = ((Component)this).GetComponent<PhotonView>();
			investigate = ((Component)this).GetComponent<EnemyStateInvestigate>();
			EnemyStateSpawn component = ((Component)this).GetComponent<EnemyStateSpawn>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.OnSpawn.AddListener(new UnityAction(OnSpawn));
			}
			if (Object.op_Implicit((Object)(object)investigate))
			{
				investigate.onInvestigateTriggered.AddListener(new UnityAction(OnInvestigate));
			}
			EnemyHealth component2 = ((Component)this).GetComponent<EnemyHealth>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.onDeath.AddListener(new UnityAction(OnDeath));
				component2.onHurt.AddListener(new UnityAction(OnHurt));
			}
		}

		private void OnEnable()
		{
			if (Object.op_Implicit((Object)(object)photonView))
			{
				photonView.RefreshRpcMonoBehaviourCache();
			}
			AddHurtFlash();
		}

		private void AddHurtFlash()
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			EnemyHealth component = ((Component)this).GetComponent<EnemyHealth>();
			if (!Object.op_Implicit((Object)(object)component) || component.instancedMaterials == null)
			{
				return;
			}
			int num = Shader.PropertyToID("_ColorOverlay");
			int num2 = Shader.PropertyToID("_ColorOverlayAmount");
			SkinnedMeshRenderer[] componentsInChildren = ((Component)(Object.op_Implicit((Object)(object)model) ? model : ((Component)this).transform)).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Material[] materials = ((Renderer)componentsInChildren[i]).materials;
				foreach (Material val in materials)
				{
					if (Object.op_Implicit((Object)(object)val) && val.HasProperty(num) && !component.instancedMaterials.Contains(val))
					{
						val.SetColor(num, Color.red);
						val.SetFloat(num2, 0f);
						component.instancedMaterials.Add(val);
					}
				}
			}
		}

		private void Update()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				HostLogic();
			}
			Animate();
			Sounds();
			AlertMusic();
		}

		private void Alert(string clip, float volume)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			AudioClip val = Assets939.Sound(clip);
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)voice))
			{
				if (!Object.op_Implicit((Object)(object)music))
				{
					music = ((Component)this).gameObject.AddComponent<AudioSource>();
					music.outputAudioMixerGroup = voice.outputAudioMixerGroup;
					music.spatialBlend = voice.spatialBlend;
					music.rolloffMode = voice.rolloffMode;
					music.minDistance = voice.minDistance;
					music.maxDistance = voice.maxDistance;
					music.playOnAwake = false;
					music.loop = false;
				}
				alertUntil = Time.time + 6f;
				if (!music.isPlaying || !(music.volume > 0.05f))
				{
					music.clip = val;
					music.volume = volume;
					music.Play();
				}
			}
		}

		private void AlertMusic()
		{
			if (!Object.op_Implicit((Object)(object)music) || !music.isPlaying)
			{
				return;
			}
			if (state == State.Run || state == State.Crouch || state == State.Lunge || state == State.Land || state == State.Claw)
			{
				alertUntil = Mathf.Max(alertUntil, Time.time + 3f);
			}
			if (state == State.Despawn || Time.time > alertUntil)
			{
				music.volume = Mathf.MoveTowards(music.volume, 0f, Time.deltaTime * 0.5f);
				if (music.volume <= 0f)
				{
					music.Stop();
				}
			}
		}

		private void OnDisable()
		{
			if (Object.op_Implicit((Object)(object)music))
			{
				music.Stop();
			}
		}

		public void OnInvestigate()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_007d: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMasterClientOrSingleplayer() || !Object.op_Implicit((Object)(object)investigate))
			{
				return;
			}
			Vector3 onInvestigateTriggeredPosition = investigate.onInvestigateTriggeredPosition;
			if (investigate.onInvestigateTriggeredPathfindOnly)
			{
				if (state == State.Idle || state == State.Roam)
				{
					roamHint = onInvestigateTriggeredPosition;
					hasRoamHint = true;
					Set(State.Roam, force: true);
				}
				return;
			}
			Vector3 val = (Object.op_Implicit((Object)(object)head) ? head.position : ((Component)this).transform.position);
			if (Vector3.Distance(val, onInvestigateTriggeredPosition) > 10f * Plugin.HearingRange.Value / 2.5f && Blocked(val, onInvestigateTriggeredPosition + Vector3.up * 0.5f, null))
			{
				return;
			}
			PlayerAvatar who = null;
			float num = 2f;
			foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
			{
				if (Alive(item))
				{
					float num2 = Vector3.Distance(((Component)item).transform.position, onInvestigateTriggeredPosition);
					if (num2 < num)
					{
						num = num2;
						who = item;
					}
				}
			}
			Heard(onInvestigateTriggeredPosition, who);
		}

		private void Listen()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			if ((listenTick -= Time.deltaTime) > 0f)
			{
				return;
			}
			listenTick = 0.2f;
			Vector3 val = (Object.op_Implicit((Object)(object)head) ? head.position : ((Component)this).transform.position);
			float num = Plugin.HearingRange.Value / 2.5f;
			PlayerAvatar val2 = null;
			float num2 = 0f;
			foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
			{
				if (!Alive(item))
				{
					continue;
				}
				float num3 = Vector3.Distance(((Component)item).transform.position, val);
				float num4 = (AmnesticCloud.Inside(((Component)item).transform.position + Vector3.up) ? 2f : 1f);
				float num5 = 0f;
				if (item.isMoving && !item.isCrouching && !item.isCrawling && !item.isTumbling)
				{
					num5 = (item.isSprinting ? 13f : 5.5f);
				}
				float num6 = (Object.op_Implicit((Object)(object)item.voiceChat) ? item.voiceChat.clipLoudness : 0f);
				if (num6 > 0.015f)
				{
					num5 = Mathf.Max(num5, Mathf.Clamp(7f + num6 * 120f, 7f, 20f));
					if (Object.op_Implicit((Object)(object)item.photonView))
					{
						Mimic.Talked(item.photonView.ViewID);
					}
				}
				if (num5 <= 0f)
				{
					continue;
				}
				num5 *= num * num4;
				if (Blocked(val, ((Component)item).transform.position + Vector3.up * 1.2f, item))
				{
					num5 *= 0.55f;
				}
				if (!(num3 > num5))
				{
					float num7 = 1f - num3 / num5;
					if (num6 > 0.015f)
					{
						lastVoice = item;
					}
					if (num7 > num2)
					{
						num2 = num7;
						val2 = item;
					}
				}
			}
			if (Object.op_Implicit((Object)(object)val2))
			{
				Heard(((Component)val2).transform.position, val2);
			}
		}

		private void Heard(Vector3 p, PlayerAvatar who)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			State state = this.state;
			if (state == State.Spawn || (uint)(state - 5) <= 1u || (uint)(state - 10) <= 3u || ((this.state == State.Run || this.state == State.Crouch || this.state == State.Claw) && (Object)(object)who == (Object)null && Object.op_Implicit((Object)(object)heardWho) && Time.time - heardTime < 4f))
			{
				return;
			}
			bool flag = Flat(heardAt, p) < 3f;
			bool flag2 = Time.time - heardTime > 6f || this.state == State.Roam || this.state == State.Idle || this.state == State.Search || this.state == State.Lure;
			Vector3 val = Feet();
			float num = Flat(val, p);
			if (Object.op_Implicit((Object)(object)who) && Object.op_Implicit((Object)(object)who.voiceChat) && who.voiceChat.clipLoudness > 0.015f)
			{
				lastVoice = who;
			}
			if (this.state == State.Lure && num > 14f)
			{
				return;
			}
			heardAt = p;
			heardWho = who;
			heardTime = Time.time;
			if (flag2 && this.state != State.Run && this.state != State.Crouch && this.state != State.Claw)
			{
				Sting(1);
			}
			if (num < 3.2f && Mathf.Abs(p.y - val.y) < 2f)
			{
				if (this.state != State.Claw)
				{
					Set(State.Claw);
				}
				else
				{
					focus = p;
				}
			}
			else if (this.state == State.Crouch)
			{
				focus = p;
			}
			else if (InLungeRange(val, p) && Clear(val, p))
			{
				Set(State.Crouch);
			}
			else
			{
				if (this.state == State.Run && (flag || Time.time - planTime < 1.5f))
				{
					return;
				}
				if (this.state == State.Claw && flag)
				{
					focus = p;
					return;
				}
				planTime = Time.time;
				hasVantage = FindVantage(p, out destination);
				if (!hasVantage)
				{
					destination = p;
				}
				if (this.state != State.Run)
				{
					Set(State.Run);
					return;
				}
				timer = 10f;
				SendState();
			}
		}

		private void HostLogic()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0694: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_0587: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0974: Unknown result type (might be due to invalid IL or missing references)
			//IL_0979: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0824: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			//IL_0630: Unknown result type (might be due to invalid IL or missing references)
			//IL_0632: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0baa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b89: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b1: Unknown result type (might be due to invalid IL or missing references)
			if (enemy.IsStunned())
			{
				Set(State.Stun);
			}
			else if ((int)enemy.CurrentState == 11)
			{
				Set(State.Despawn);
			}
			cloudCooldown -= Time.deltaTime;
			fleeCooldown -= Time.deltaTime;
			if (state != State.Spawn && state != State.Despawn && state != State.Stun)
			{
				Listen();
			}
			EnemyNavMeshAgent navMeshAgent = enemy.NavMeshAgent;
			switch (state)
			{
			case State.Spawn:
				if (Impulse())
				{
					timer = 2f;
				}
				if ((timer -= Time.deltaTime) <= 0f)
				{
					Set(State.Idle);
				}
				break;
			case State.Idle:
				if (Impulse())
				{
					timer = Random.Range(3f, 8f);
					StopMoving();
				}
				if (!SemiFunc.EnemySpawnIdlePause() && (timer -= Time.deltaTime) <= 0f)
				{
					Set(State.Roam);
				}
				break;
			case State.Roam:
				if (Impulse())
				{
					timer = 15f;
					NavMeshHit val2 = default(NavMeshHit);
					if (hasRoamHint && NavMesh.SamplePosition(roamHint, ref val2, 3f, -1))
					{
						destination = ((NavMeshHit)(ref val2)).position;
					}
					else if (!PickRoamPoint(out destination))
					{
						hasRoamHint = false;
						Set(State.Idle);
						break;
					}
					hasRoamHint = false;
				}
				navMeshAgent.OverrideAgent(1.7f, navMeshAgent.DefaultAcceleration, 0.2f);
				navMeshAgent.SetDestination(destination);
				if (enemy.Rigidbody.notMovingTimer > 1f)
				{
					timer -= Time.deltaTime;
				}
				if ((timer -= Time.deltaTime) <= 0f || Vector3.Distance(((Component)this).transform.position, destination) < 1.5f)
				{
					Set((!(Random.value < 0.35f)) ? State.Roam : State.Idle, force: true);
				}
				break;
			case State.Run:
			{
				if (Impulse())
				{
					timer = 10f;
					stuckTimer = 0f;
				}
				navMeshAgent.OverrideAgent(Plugin.RunSpeed.Value, 30f, 0.2f);
				enemy.Rigidbody.OverrideFollowPosition(0.2f, Plugin.RunSpeed.Value * 1.6f, -1f);
				navMeshAgent.SetDestination(destination);
				stuckTimer = ((enemy.Rigidbody.notMovingTimer > 0.6f) ? (stuckTimer + Time.deltaTime) : 0f);
				Vector3 val3 = Feet();
				if (Flat(val3, heardAt) < 3.2f && Mathf.Abs(heardAt.y - val3.y) < 2f)
				{
					Set(State.Claw);
					break;
				}
				if (InLungeRange(val3, heardAt) && Clear(val3, heardAt) && (Flat(val3, destination) < 1.2f || !hasVantage || Flat(val3, heardAt) < LungeMax - 1f))
				{
					Set(State.Crouch);
					break;
				}
				if (Flat(val3, destination) < 0.8f || stuckTimer > 1f)
				{
					hasVantage = FindVantage(heardAt, out destination);
					if (!hasVantage)
					{
						destination = heardAt;
						if (Flat(val3, heardAt) < 1.5f)
						{
							Set(State.Search);
							break;
						}
					}
					stuckTimer = 0f;
				}
				if ((timer -= Time.deltaTime) <= 0f)
				{
					Set(State.Search);
				}
				break;
			}
			case State.Crouch:
			{
				if (Impulse())
				{
					StopMoving();
					timer = 0.75f;
				}
				navMeshAgent.Stop(0.2f);
				if (!((timer -= Time.deltaTime) <= 0f))
				{
					break;
				}
				Vector3 val = Feet();
				if (InLungeRange(val, heardAt, 1.5f) && Clear(val, heardAt))
				{
					Set(State.Lunge);
					break;
				}
				if (Flat(val, heardAt) < 3.2f && Mathf.Abs(heardAt.y - val.y) < 2f)
				{
					Set(State.Claw);
					break;
				}
				hasVantage = FindVantage(heardAt, out destination);
				if (!hasVantage)
				{
					destination = heardAt;
				}
				Set(State.Run);
				break;
			}
			case State.Lunge:
				if (Impulse())
				{
					timer = 0f;
					struck = false;
					hitThisLunge.Clear();
					Vector3 val4 = Feet();
					Vector3 val5 = heardAt - val4;
					val5.y = 0f;
					val5 = ((((Vector3)(ref val5)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val5)).normalized : ((Component)this).transform.forward);
					lungeEnd = heardAt + val5 * 2.5f;
					NavMeshHit val6 = default(NavMeshHit);
					if (NavMesh.Raycast(val4, lungeEnd, ref val6, -1))
					{
						lungeEnd = ((NavMeshHit)(ref val6)).position;
					}
					lungeTime = Flat(val4, lungeEnd) / Mathf.Max(1f, Plugin.LungeSpeed.Value) + 0.5f;
					rotationTarget = Quaternion.LookRotation(val5);
				}
				timer += Time.deltaTime;
				navMeshAgent.OverrideAgent(Plugin.LungeSpeed.Value, 400f, 0.1f);
				enemy.Rigidbody.OverrideFollowPosition(0.1f, Plugin.LungeSpeed.Value * 2f, -1f);
				navMeshAgent.SetDestination(lungeEnd);
				LungeHits();
				if (struck || Flat(Feet(), lungeEnd) < 0.7f || timer > lungeTime || (timer > 0.6f && enemy.Rigidbody.notMovingTimer > 0.25f))
				{
					variant = (struck ? 1 : 0);
					Set(State.Land);
				}
				break;
			case State.Land:
				if (Impulse())
				{
					StopMoving();
					timer = ((variant == 1) ? 1.6f : 2.2f);
				}
				navMeshAgent.Stop(0.2f);
				if ((timer -= Time.deltaTime) <= 0f)
				{
					Set(State.Search);
				}
				break;
			case State.Claw:
			{
				if (Impulse())
				{
					timer = 0f;
					struck = false;
					variant = Random.Range(0, 2);
					stuckTimer = 0f;
					approach = 0f;
					focus = heardAt;
				}
				Vector3 a = Feet();
				if (timer <= 0f)
				{
					if ((approach += Time.deltaTime) > 3f)
					{
						Set(State.Search);
						break;
					}
					navMeshAgent.OverrideAgent(Plugin.RunSpeed.Value * 0.85f, 30f, 0.2f);
					navMeshAgent.SetDestination(heardAt);
					stuckTimer = ((enemy.Rigidbody.notMovingTimer > 0.4f) ? (stuckTimer + Time.deltaTime) : 0f);
					bool flag = false;
					foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
					{
						if (Alive(item) && InArc(item, 2.2f))
						{
							flag = true;
							break;
						}
					}
					if (Flat(a, heardAt) < 1.4f || flag || stuckTimer > 0.8f)
					{
						timer = 0.0001f;
						StopMoving();
						SendState();
					}
				}
				else
				{
					navMeshAgent.Stop(0.2f);
					timer += Time.deltaTime;
					if (!struck && timer > 0.45f)
					{
						struck = true;
						Slash();
					}
					if (timer > 1.15f)
					{
						Set(State.Search);
					}
				}
				break;
			}
			case State.Search:
				if (Impulse())
				{
					StopMoving();
					timer = Random.Range(4f, 6.5f);
					focus = heardAt;
				}
				navMeshAgent.Stop(0.2f);
				if ((timer -= Time.deltaTime) <= 0f)
				{
					AfterSearch();
				}
				break;
			case State.Lure:
				if (Impulse())
				{
					timer = 50f;
					mimicTimer = Random.Range(3f, 6f);
					stuckTimer = 0f;
					if (!FindHidingSpot(out destination))
					{
						Set(State.Roam);
						break;
					}
				}
				timer -= Time.deltaTime;
				if (Flat(Feet(), destination) > 0.8f && stuckTimer < 3f)
				{
					navMeshAgent.OverrideAgent(Plugin.RunSpeed.Value * 0.6f, 20f, 0.2f);
					navMeshAgent.SetDestination(destination);
					stuckTimer = ((enemy.Rigidbody.notMovingTimer > 0.6f) ? (stuckTimer + Time.deltaTime) : 0f);
				}
				else
				{
					navMeshAgent.Stop(0.2f);
					if ((mimicTimer -= Time.deltaTime) <= 0f)
					{
						mimicTimer = Random.Range(6f, 11f);
						int num = Mimic.PickTarget(lastVoice);
						if (num >= 0)
						{
							DoMimic(num);
						}
					}
				}
				if (timer <= 0f)
				{
					Set(State.Roam);
				}
				break;
			case State.Cloud:
				if (Impulse())
				{
					StopMoving();
					timer = 3.2f;
					cloudCooldown = 70f;
					struck = false;
				}
				navMeshAgent.Stop(0.2f);
				timer -= Time.deltaTime;
				if (!struck && timer < 2.2f)
				{
					struck = true;
					if (SemiFunc.IsMultiplayer())
					{
						photonView.RPC("Scp939_CloudRPC", (RpcTarget)0, new object[1] { Feet() });
					}
					else
					{
						Scp939_CloudRPC(Feet());
					}
				}
				if (timer <= 0f)
				{
					Set(State.Roam);
				}
				break;
			case State.Flee:
				if (Impulse())
				{
					timer = 3.5f;
					if (!PickFleePoint(out destination))
					{
						Set(State.Roam);
						break;
					}
				}
				navMeshAgent.OverrideAgent(Plugin.RunSpeed.Value * 1.1f, 40f, 0.2f);
				enemy.Rigidbody.OverrideFollowPosition(0.2f, Plugin.RunSpeed.Value * 1.7f, -1f);
				navMeshAgent.SetDestination(destination);
				if ((timer -= Time.deltaTime) <= 0f)
				{
					Set(State.Roam);
				}
				break;
			case State.Stun:
				if (Impulse())
				{
					StopMoving();
				}
				if (!enemy.IsStunned())
				{
					Set(State.Search);
				}
				break;
			case State.Despawn:
				if (Impulse())
				{
					StopMoving();
					enemy.EnemyParent.Despawn();
				}
				break;
			}
			RotationLogic();
		}

		private void AfterSearch()
		{
			if (Plugin.Mimic.Value && Random.value < Plugin.LureChance.Value && Mimic.PickTarget(lastVoice) >= 0)
			{
				Set(State.Lure);
			}
			else if (cloudCooldown <= 0f && Random.value < Plugin.CloudChance.Value)
			{
				Set(State.Cloud);
			}
			else
			{
				Set(State.Roam);
			}
		}

		private void DoMimic(int id)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			int num = Random.Range(0, 1000);
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("Scp939_MimicRPC", (RpcTarget)0, new object[2] { id, num });
			}
			else
			{
				Scp939_MimicRPC(id, num);
			}
		}

		private void LungeHits()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_0078: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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)
			Vector3 val = Feet() + ((Component)this).transform.forward * 0.9f;
			foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
			{
				if (Alive(item) && !hitThisLunge.Contains(item))
				{
					Vector3 position = ((Component)item).transform.position;
					if (Flat(val, position) < 1.5f && position.y - val.y > -1f && position.y - val.y < 1.8f && !Blocked(Feet() + Vector3.up * 0.8f, position + Vector3.up * 0.8f, item))
					{
						hitThisLunge.Add(item);
						struck = true;
						Strike(item, Plugin.LungeDamage.Value, 1, val, 1.5f);
					}
				}
			}
		}

		private void Slash()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
			{
				if (Alive(item) && InArc(item, 2.3f))
				{
					Strike(item, Plugin.ClawDamage.Value, 2, Feet(), 2.3f);
					flag = true;
				}
			}
			if (!flag)
			{
				Sting(3);
			}
		}

		private void Strike(PlayerAvatar p, int damage, int kind, Vector3 from, float reach)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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)
			if (Object.op_Implicit((Object)(object)p) && Object.op_Implicit((Object)(object)p.photonView))
			{
				int viewID = p.photonView.ViewID;
				strikes[viewID] = Time.time;
				if (!SemiFunc.IsMultiplayer() || p.isLocal)
				{
					Scp939_StrikeRPC(viewID, kind, from, reach);
					return;
				}
				photonView.RPC("Scp939_StrikeRPC", p.photonView.Owner, new object[4] { viewID, kind, from, reach });
			}
		}

		[PunRPC]
		public void Scp939_StrikeRPC(int victim, int kind, Vector3 from, float reach, PhotonMessageInfo info = default(PhotonMessageInfo))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.MasterOnlyRPC(info))
			{
				return;
			}
			PlayerAvatar val = (Object.op_Implicit((Object)(object)PlayerController.instance) ? PlayerController.instance.playerAvatarScript : null);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.photonView) || val.photonView.ViewID != victim || !Alive(val))
			{
				return;
			}
			Vector3 position = ((Component)val).transform.position;
			float num = position.y - from.y;
			if (!(Flat(from, position) > reach + 1f) && !(num < -1.8f) && !(num > 2.3f))
			{
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					Caught(val, kind);
					return;
				}
				photonView.RPC("Scp939_CaughtRPC", (RpcTarget)2, new object[2] { victim, kind });
			}
		}

		[PunRPC]
		public void Scp939_CaughtRPC(int victim, int kind, PhotonMessageInfo info = default(PhotonMessageInfo))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.IsMasterClient())
			{
				PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(victim);
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.photonView) && info.Sender != null && val.photonView.OwnerActorNr == info.Sender.ActorNumber)
				{
					Caught(val, kind);
				}
			}
		}

		private void Caught(PlayerAvatar p, int kind)
		{
			int viewID = p.photonView.ViewID;
			if (Alive(p) && strikes.TryGetValue(viewID, out var value) && !(Time.time - value > 2f))
			{
				strikes.Remove(viewID);
				Hit(p, (kind == 1) ? Plugin.LungeDamage.Value : Plugin.ClawDamage.Value, kind);
			}
		}

		private bool InArc(PlayerAvatar p, float range)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_0089: 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)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Feet();
			Vector3 val2 = ((Component)p).transform.position - val;
			if (Mathf.Abs(val2.y) > 1.8f)
			{
				return false;
			}
			val2.y = 0f;
			if (((Vector3)(ref val2)).magnitude > range)
			{
				return false;
			}
			if (((Vector3)(ref val2)).magnitude > 0.6f && Vector3.Angle(((Component)this).transform.forward, val2) > 65f)
			{
				return false;
			}
			if (!Blocked(val + Vector3.up * 0.9f, ((Component)p).transform.position + Vector3.up * 0.8f, p))
			{
				return true;
			}
			return !Blocked(val + Vector3.up * 0.35f, ((Component)p).transform.position + Vector3.up * 0.3f, p);
		}

		private void Hit(PlayerAvatar p, int damage, int kind)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)p) && Object.op_Implicit((Object)(object)p.playerHealth))
			{
				p.playerHealth.HurtOther(damage, Vector3.zero, false, SemiFunc.EnemyGetIndex(enemy), false);
				if (p.playerHealth.health > damage && Object.op_Implicit((Object)(object)p.tumble))
				{
					Vector3 val = ((Component)p).transform.position - ((Component)this).transform.position;
					val.y = 0f;
					val = ((((Vector3)(ref val)).sqrMagnitude > 0.001f) ? ((Vector3)(ref val)).normalized : ((Component)this).transform.forward);
					float num = ((kind == 1) ? 55f : 30f);
					p.tumble.TumbleRequest(true, false);
					p.tumble.TumbleOverrideTime((kind == 1) ? 1.4f : 0.8f);
					PlayerTumble tumble = p.tumble;
					Vector3 val2 = val + Vector3.up * 0.6f;
					tumble.TumbleForce(((Vector3)(ref val2)).normalized * num);
					p.tumble.TumbleTorque(Random.onUnitSphere * num);
				}
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("Scp939_HitRPC", (RpcTarget)0, new object[2]
					{
						p.photonView.ViewID,
						kind
					});
				}
				else
				{
					Scp939_HitRPC(p.photonView.ViewID, kind);
				}
			}
		}

		private Vector3 Feet()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)enemy.Rigidbody))
			{
				return ((Component)this).transform.position;
			}
			return new Vector3(((Component)enemy.Rigidbody).transform.position.x, ((Component)this).transform.position.y, ((Component)enemy.Rigidbody).transform.position.z);
		}

		private static float Flat(Vector3 a, Vector3 b)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			a.y = 0f;
			b.y = 0f;
			return Vector3.Distance(a, b);
		}

		private static bool InLungeRange(Vector3 from, Vector3 to, float slack = 0f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			float num = Flat(from, to);
			if (num >= 3f - slack && num <= LungeMax + slack)
			{
				return Mathf.Abs(to.y - from.y) < 1.2f;
			}
			return false;
		}

		private bool Clear(Vector3 from, Vector3 to)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(from, ref val, 1.5f, -1))
			{
				from = ((NavMeshHit)(ref val)).position;
			}
			NavMeshHit val2 = default(NavMeshHit);
			if (NavMesh.SamplePosition(to, ref val2, 1.5f, -1))
			{
				to = ((NavMeshHit)(ref val2)).position;
			}
			NavMeshHit val3 = default(NavMeshHit);
			if (NavMesh.Raycast(from, to, ref val3, -1))
			{
				return false;
			}
			if (!Blocked(from + Vector3.up * 0.6f, to + Vector3.up * 0.6f, null))
			{
				return !Blocked(from + Vector3.up * 1.2f, to + Vector3.up * 1.2f, null);
			}
			return false;
		}

		private bool Blocked(Vector3 a, Vector3 b, PlayerAvatar target)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = b - a;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (magnitude < 0.05f)
			{
				return false;
			}
			int mask = LayerMask.GetMask(new string[4] { "Default", "PhysGrabObject", "PhysGrabObjectHinge", "PhysGrabObjectCart" });
			int num = Physics.RaycastNonAlloc(a, val / magnitude, hits, magnitude, mask, (QueryTriggerInteraction)1);
			for (int i = 0; i < num; i++)
			{
				Collider collider = ((RaycastHit)(ref hits[i])).collider;
				if (Object.op_Implicit((Object)(object)collider) && (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)enemy.EnemyParent) || !((Component)collider).transform.IsChildOf(((Component)enemy.EnemyParent).transform)) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PlayerAvatar>()) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PlayerTumble>()))
				{
					return true;
				}
			}
			return false;
		}

		private bool FindVantage(Vector3 sound, out Vector3 spot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			spot = sound;
			Vector3 a = Feet();
			float num = float.MaxValue;
			bool result = false;
			float[] array = new float[3]
			{
				LungeMax * 0.45f,
				LungeMax * 0.65f,
				LungeMax * 0.85f
			};
			NavMeshHit val = default(NavMeshHit);
			foreach (float num2 in array)
			{
				for (int j = 0; j < 16; j++)
				{
					float num3 = (float)j * MathF.PI * 2f / 16f;
					if (NavMesh.SamplePosition(sound + new Vector3(Mathf.Cos(num3), 0f, Mathf.Sin(num3)) * num2, ref val, 1.2f, -1) && InLungeRange(((NavMeshHit)(ref val)).position, sound) && Clear(((NavMeshHit)(ref val)).position, sound))
					{
						float num4 = Flat(a, ((NavMeshHit)(ref val)).position);
						if (num4 < num)
						{
							num = num4;
							spot = ((NavMeshHit)(ref val)).position;
							result = true;
						}
					}
				}
			}
			return result;
		}

		private bool FindHidingSpot(out Vector3 spot)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			spot = Feet();
			Vector3 val = ((heardTime > 0f) ? heardAt : Feet());
			List<PlayerAvatar> players = SemiFunc.PlayerGetList();
			float num = float.MaxValue;
			bool flag = false;
			PhysGrabHinge[] array = Object.FindObjectsByType<PhysGrabHinge>((FindObjectsSortMode)0);
			NavMeshHit val3 = default(NavMeshHit);
			foreach (PhysGrabHinge val2 in array)
			{
				if (!Object.op_Implicit((Object)(object)val2) || !val2.closed)
				{
					continue;
				}
				Vector3 position = ((Component)val2).transform.position;
				float num2 = Vector3.Distance(position, val);
				if (num2 > 22f || num2 > num)
				{
					continue;
				}
				for (int j = 0; j < 12; j++)
				{
					float num3 = (float)j * MathF.PI / 6f;
					if (NavMesh.SamplePosition(position + new Vector3(Mathf.Cos(num3), 0f, Mathf.Sin(num3)) * 1.4f, ref val3, 1f, -1) && Unseen(((NavMeshHit)(ref val3)).position))
					{
						num = num2;
						spot = ((NavMeshHit)(ref val3)).position;
						flag = true;
						break;
					}
				}
			}
			if (flag)
			{
				return true;
			}
			NavMeshHit val5 = default(NavMeshHit);
			for (int k = 0; k < 20; k++)
			{
				LevelPoint val4 = SemiFunc.LevelPointGet(val, 4f, 16f);
				if (Object.op_Implicit((Object)(object)val4) && NavMesh.SamplePosition(((Component)val4).transform.position, ref val5, 2f, -1) && Unseen(((NavMeshHit)(ref val5)).position))
				{
					spot = ((NavMeshHit)(ref val5)).position;
					return true;
				}
			}
			return false;
			bool Unseen(Vector3 q)
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				foreach (PlayerAvatar item in players)
				{
					if (Alive(item) && (Vector3.Distance(((Component)item).transform.position, q) < 5f || !Blocked(((Component)item).transform.position + Vector3.up * 1.5f, q + Vector3.up * 0.7f, null)))
					{
						return false;
					}
				}
				return true;
			}
		}

		private bool PickRoamPoint(out Vector3 p)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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)
			p = ((Component)this).transform.position;
			LevelPoint val = SemiFunc.LevelPointGet(((Component)this).transform.position, 5f, 20f) ?? SemiFunc.LevelPointGet(((Component)this).transform.position, 0f, 999f);
			NavMeshHit val2 = default(NavMeshHit);
			if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 3f, ref val2, 5f, -1))
			{
				p = ((NavMeshHit)(ref val2)).position;
				return true;
			}
			return false;
		}

		private bool PickFleePoint(out Vector3 p)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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)
			//IL_00a5: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			p = ((Component)this).transform.position;
			PlayerAvatar val = null;
			float num = float.MaxValue;
			foreach (PlayerAvatar item in SemiFunc.PlayerGetList())
			{
				if (Alive(item))
				{
					float num2 = Vector3.Distance(((Component)item).transform.position, ((Component)this).transform.position);
					if (num2 < num)
					{
						num = num2;
						val = item;
					}
				}
			}
			Vector3 val2 = (Object.op_Implicit((Object)(object)val) ? (((Component)this).transform.position - ((Component)val).transform.position) : ((Component)this).transform.forward);
			val2.y = 0f;
			NavMeshHit val5 = default(NavMeshHit);
			for (int i = 0; i < 10; i++)
			{
				LevelPoint val3 = SemiFunc.LevelPointGet(((Component)this).transform.position, 8f, 25f);
				if (Object.op_Implicit((Object)(object)val3))
				{
					Vector3 val4 = ((Component)val3).transform.position - ((Component)this).transform.position;
					val4.y = 0f;
					if ((!Object.op_Implicit((Object)(object)val) || !(Vector3.Dot(val4, val2) < 0f)) && NavMesh.SamplePosition(((Component)val3).transform.position, ref val5, 3f, -1))
					{
						p = ((NavMeshHit)(ref val5)).position;
						return true;
					}
				}
			}
			return PickRoamPoint(out p);
		}

		private void RotationLogic()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.zero;
			switch (state)
			{
			case State.Crouch:
			case State.Search:
				val = heardAt - ((Component)this).transform.position;
				break;
			case State.Claw:
				val = ((!(timer > 0f)) ? enemy.NavMeshAgent.AgentVelocity : (focus - ((Component)this).transform.position));
				break;
			default:
				val = enemy.NavMeshAgent.AgentVelocity;
				break;
			case State.Lunge:
			case State.Land:
				break;
			}
			val.y = 0f;
			if (((Vector3)(ref val)).sqrMagnitude > 0.01f)
			{
				rotationTarget = Quaternion.LookRotation(val);
			}
			((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(rotationSpring, rotationTarget, -1f);
			enemy.Rigidbody.rotationSpeedIdle = 2f;
			enemy.Rigidbody.rotationSpeedChase = 5f;
		}

		private bool Impulse()
		{
			if (!impulse)
			{
				return false;
			}
			impulse = false;
			return true;
		}

		private void StopMoving()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			enemy.NavMeshAgent.ResetPath();
			enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false);
		}

		private static bool Alive(PlayerAvatar p)
		{
			if (Object.op_Implicit((Object)(object)p) && !p.isDisabled)
			{
				return !p.deadSet;
			}
			return false;
		}

		private void Set(State s, bool force = false)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.IsMasterClientOrSingleplayer() && (s != state || force))
			{
				state = s;
				impulse = true;
				timer = 0f;
				focus = heardAt;
				SendState();
			}
		}

		private void SendState()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("Scp939_StateRPC", (RpcTarget)1, new object[4]
				{
					(int)state,
					variant,
					focus,
					timer > 0f
				});
			}
			clawSwingShown = state == State.Claw && timer > 0f;
		}

		private void Sting(int id)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("Scp939_SoundRPC", (RpcTarget)0, new object[1] { id });
			}
			else
			{
				Scp939_SoundRPC(id);
			}
		}

		public void OnSpawn()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				SemiFunc.EnemySpawn(enemy);
				heardTime = -99f;
				lastVoice = null;
				state = State.Despawn;
				Set(State.Spawn);
			}
		}

		public void OnHurt()
		{
			if (Object.op_Implicit((Object)(object)voice))
			{
				voice.PlayOneShot(Assets939.Any("pain_1", "pain_2", "pain_4"), 1f);
			}
			if (SemiFunc.IsMasterClientOrSingleplayer() && !(fleeCooldown > 0f) && state != State.Despawn && state != State.Spawn && state != State.Stun)
			{
				fleeCooldown = 10f;
				Set(State.Flee);
			}
		}

		public void OnDeath()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)model))
			{
				AudioSource.PlayClipAtPoint(Assets939.Sound("death2"), model.position, 1f);
			}
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				enemy.EnemyParent.Despawn();
			}
		}

		private void Animate()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)anim) || !Object.op_Implicit((Object)(object)model))
			{
				return;
			}
			Vector3 position = model.position;
			Vector3 val = position - lastPos;
			float num = ((Vector3)(ref val)).magnitude / Mathf.Max(Time.deltaTime, 0.0001f);
			lastPos = position;
			speed = Mathf.Lerp(speed, Mathf.Min(num, 25f), Time.deltaTime * 6f);
			bool flag = speed > 0.35f;
			bool flag2 = state == State.Claw && clawSwingShown;
			if (state != animState || flag2 != animSwing)
			{
				switch (state)
				{
				case State.Crouch:
					Sequence("939_idleToCrouched", "939_crouched");
					break;
				case State.Lunge:
					Sequence("939_lunge", "939_lungeAir");
					break;
				case State.Land:
					Sequence((variant == 1) ? "939_lungeHit" : "939_lungeLand");
					break;
				case State.Claw:
					if (flag2)
					{
						Sequence((variant == 1) ? "939_slash2" : "939_slash");
					}
					else
					{
						seq.Clear();
					}
					break;
				case State.Cloud:
					Sequence("939_amnesticCloud_release");
					Speed("939_amnesticCloud_release", 2.4f);
					break;
				case State.Stun:
					Sequence((Random.value < 0.5f) ? "939_hit_02" : "939_hit_03");
					break;
				case State.Lure:
					seq.Clear();
					break;
				default:
					seq.Clear();
					break;
				}
				if (state == State.Claw && flag2 && Object.op_Implicit((Object)(object)voice))
				{
					voice.PlayOneShot(Assets939.Any("slash", "swing_1"), 0.9f);
				}
				if (state == State.Lunge && Object.op_Implicit((Object)(object)voice))
				{
					voice.PlayOneShot(Assets939.Sound("swing_1"), 1f);
				}
				if (state == State.Land && variant == 0 && Object.op_Implicit((Object)(object)voice))
				{
					voice.PlayOneShot(Assets939.Sound("exhaustion"), 0.8f);
				}
				if (state == State.Crouch)
				{
					Alert("chase_made_sound", 0.8f);
				}
				animState = state;
				animSwing = flag2;
			}
			AdvanceSequence();
			if (seq.Count != 0)
			{
				return;
			}
			string text = ((state == State.Lure) ? (flag ? "939_runForward" : "939_crouched") : ((!flag) ? "939_idle" : ((speed > 3.2f) ? "939_sprint" : "939_runForward")));
			if (!anim.IsPlaying(text))
			{
				Play(text, 0.3f);
			}
			if (text == "939_sprint")
			{
				anim[text].speed = Mathf.Clamp(speed / 6.5f, 0.7f, 1.8f);
			}
			else if (text == "939_runForward")
			{
				anim[text].speed = Mathf.Clamp(speed / 2.4f, 0.5f, 1.6f);
			}
			if (flag && (stepTimer -= Time.deltaTime * Mathf.Clamp(speed / 2f, 0.6f, 3.5f)) <= 0f)
			{
				stepTimer = 0.45f;
				if (Object.op_Implicit((Object)(object)feet))
				{
					feet.PlayOneShot(Assets939.Any("footstep1", "footstep2", "footstep3", "footstep4", "footstep5"), Mathf.Clamp(speed / 6f, 0.25f, 0.9f));
				}
			}
		}

		private void LateUpdate()
		{
			//IL_0090: 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)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)model))
			{
				return;
			}
			Transform parent = model.parent;
			if ((Object.op_Implicit((Object)(object)enemy) && Object.op_Implicit((Object)(object)enemy.Rigidbody) && Object.op_Implicit((Object)(object)enemy.Rigidbody.physGrabObject) && enemy.Rigidbody.physGrabObject.playerGrabbing.Count > 0) || Vector3.Angle(parent.up, Vector3.up) > 20f)
			{
				model.localPosition = modelHome;
				model.localRotation = Quaternion.identity;
				return;
			}
			int num = Physics.RaycastNonAlloc(parent.position + Vector3.up * 0.5f, Vector3.down, floorHits, 4f, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1);
			float num2 = float.NegativeInfinity;
			for (int i = 0; i < num; i++)
			{
				Collider collider = ((RaycastHit)(ref floorHits[i])).collider;
				if (Object.op_Implicit((Object)(object)collider) && (!Object.op_Implicit((Object)(object)enemy.EnemyParent) || !((Component)collider).transform.IsChildOf(((Component)enemy.EnemyParent).transform)) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PhysGrabObject>()))
				{
					num2 = Mathf.Max(num2, ((RaycastHit)(ref floorHits[i])).point.y);
				}
			}
			Vector3 val = parent.TransformPoint(modelHome);
			if (float.IsNegativeInfinity(num2))
			{
				model.position = val;
				return;
			}
			planted = ((float.IsNaN(planted) || Mathf.Abs(planted - num2) > 1.5f) ? num2 : Mathf.Lerp(planted, num2, Time.deltaTime * 12f));
			float num3 = planted;
			if (contacts != null && contacts.Length != 0 && state != State.Lunge)
			{
				float num4 = float.MaxValue;
				Transform[] array = contacts;
				foreach (Transform val2 in array)
				{
					if (Object.op_Implicit((Object)(object)val2))
					{
						num4 = Mathf.Min(num4, val2.position.y);
					}
				}
				if (num4 < float.MaxValue)
				{
					num3 = model.position.y - (num4 - sole - planted);
				}
				num3 = Mathf.Lerp(model.position.y, num3, Time.deltaTime * 15f);
			}
			model.position = new Vector3(val.x, num3, val.z);
		}

		private void Sequence(params string[] clips)
		{
			seq.Clear();
			foreach (string text in clips)
			{
				if ((TrackedReference)(object)anim[text] != (TrackedReference)null)
				{
					seq.Add(text);
				}
			}
			seqIndex = 0;
			if (seq.Count > 0)
			{
				StartStep();
			}
		}

		private void StartStep()
		{
			string text = seq[seqIndex];
			if (seqIndex < seq.Count - 1)
			{
				anim[text].wrapMode = (WrapMode)8;
			}
			else
			{
				anim[text].wrapMode = (WrapMode)(((Motion)anim[text].clip).isLooping ? 2 : 8);
			}
			Play(text, (seqIndex == 0) ? 0.15f : 0.1f);
		}

		private void AdvanceSequence()
		{
			if (seq.Count != 0 && seqIndex < seq.Count - 1)
			{
				AnimationState val = anim[seq[seqIndex]];
				if ((TrackedReference)(object)val != (TrackedReference)null && val.normalizedTime >= 0.97f)
				{
					seqIndex++;
					StartStep();
				}
			}
		}

		private void Speed(string clip, float s)
		{
			if ((TrackedReference)(object)anim[clip] != (TrackedReference)null)
			{
				anim[clip].speed = s;
			}
		}

		private void Play(string clip, float fade)
		{
			if (!((TrackedReference)(object)anim[clip] == (TrackedReference)null))
			{
				anim[clip].speed = 1f;
				anim.CrossFade(clip, fade);
			}
		}

		private void Sounds()
		{
			if (!Object.op_Implicit((Object)(object)breath) || state == soundState)
			{
				return;
			}
			soundState = state;
			AudioClip val = null;
			float volume = 0.6f;
			switch (state)
			{
			case State.Spawn:
			case State.Roam:
			case State.Idle:
			case State.Search:
			case State.Lure:
				val = Assets939.Any("idle_breathing", "idle_breathing_2");
				volume = 0.55f;
				break;
			case State.Run:
			case State.Crouch:
			case State.Claw:
			case State.Flee:
				val = Assets939.Sound("chase_quiet");
				volume = 0.8f;
				break;
			}
			if (state == State.Lure)
			{
				volume = 0.15f;
			}
			if ((Object)(object)val == (Object)null)
			{
				if (state == State.Despawn)
				{
					breath.Stop();
				}
				return;
			}
			if ((Object)(object)breath.clip != (Object)(object)val || !breath.isPlaying)
			{
				breath.clip = val;
				breath.Play();
			}
			breath.volume = volume;
		}

		[PunRPC]
		public void Scp939_StateRPC(int s, int v, Vector3 f, bool swinging, PhotonMessageInfo info = default(PhotonMessageInfo))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(info))
			{
				state = (State)s;
				variant = v;
				focus = f;
				clawSwingShown = swinging;
			}
		}

		[PunRPC]
		public void Scp939_SoundRPC(int id, PhotonMessageInfo info = default(PhotonMessageInfo))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(info) && Object.op_Implicit((Object)(object)voice))
			{
				switch (id)
				{
				case 1:
					Alert("chase_detected", 0.9f);
					break;
				case 3:
					voice.PlayOneShot(Assets939.Sound("claw_beta"), 0.7f);
					break;
				}
			}
		}

		[PunRPC]
		public void Scp939_HitRPC(int victim, int kind, PhotonMessageInfo info = default(PhotonMessageInfo))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			if (!SemiFunc.MasterOnlyRPC(info))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)voice))
			{
				voice.PlayOneShot((kind == 1) ? Assets939.Sound("bite_beta") : Assets939.Any("slash_hit_1", "slash_hit_2", "slash_hit_3"), 1f);
			}
			PlayerAvatar val = (Object.op_Implicit((Object)(object)PlayerController.instance) ? PlayerController.instance.playerAvatarScript : null);
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.photonView) && val.photonView.ViewID == victim)
			{
				AudioClip val2 = Assets939.Any("jumpscare_high", "jumpscare_mid", "jumpscare_low");
				if (Object.op_Implicit((Object)(object)val2))
				{
					GameObject val3 = new GameObject("939 Jumpscare");
					AudioSource obj = val3.AddComponent<AudioSource>();
					obj.spatialBlend = 0f;
					obj.outputAudioMixerGroup = (Object.op_Implicit((Object)(object)voice) ? voice.outputAudioMixerGroup : null);
					obj.PlayOneShot(val2, 0.9f);
					Object.Destroy((Object)val3, val2.length + 0.5f);
				}
				if (Object.op_Implicit((Object)(object)GameDirector.instance) && Object.op_Implicit((Object)(object)GameDirector.instance.CameraShake))
				{
					GameDirector.instance.CameraShake.Shake(6f, 0.4f);
				}
			}
			else if (Object.op_Implicit((Object)(object)GameDirector.instance) && Object.op_Implicit((Object)(object)GameDirector.instance.CameraShake) && Object.op_Implicit((Object)(object)model))
			{
				GameDirector.instance.CameraShake.ShakeDistance(3f, 2f, 8f, model.position, 0.25f);
			}
		}

		[PunRPC]
		public void Scp939_MimicRPC(int playerViewId, int seed, PhotonMessageInfo info = default(PhotonMessageInfo))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.MasterOnlyRPC(info) || !Plugin.Mimic.Value)
			{
				return;
			}
			mimicAsked = playerViewId;
			mimicClip = -1;
			mimicParts = null;
			PlayerAvatar val = (Object.op_Implicit((Object)(object)PlayerController.instance) ? PlayerController.instance.playerAvatarScript : null);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.photonView) || val.photonView.ViewID != playerViewId)
			{
				return;
			}
			float[] array = Mimic.MyClip(seed);
			if (array == null)
			{
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("Scp939_MimicTtsRPC", (RpcTarget)0, new object[1] { playerViewId });
				}
				else
				{
					Scp939_MimicTtsRPC(playerViewId);
				}
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(SendClip(Mimic.Encode(array), Random.Range(1, int.MaxValue)));
			}
		}

		private IEnumerator SendClip(byte[] data, int id)
		{
			int count = (data.Length + 6000 - 1) / 6000;
			for (int i = 0; i < count; i++)
			{
				byte[] array = new byte[Mathf.Min(6000, data.Length - i * 6000)];
				Array.Copy(data, i * 6000, array, 0, array.Length);
				if (SemiFunc.IsMultiplayer())
				{
					photonView.RPC("Scp939_MimicChunkRPC", (RpcTarget)0, new object[4] { id, i, count, array });
				}
				else
				{
					Scp939_MimicChunkRPC(id, i, count, array);
				}
				yield return (object)new WaitForSeconds(0.05f);
			}
		}

		private bool FromAsked(PhotonMessageInfo info)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMultiplayer())
			{
				return true;
			}
			PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(mimicAsked);
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.photonView) && info.Sender != null)
			{
				return val.photonView.OwnerActorNr == info.Sender.ActorNumber;
			}
			return false;
		}

		[PunRPC]
		public void Scp939_MimicChunkRPC(int id, int index, int count, byte[] part, PhotonMessageInfo info = default(PhotonMessageInfo))
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.Mimic.Value || !FromAsked(info) || count <= 0 || count > 40 || index < 0 || index >= count || part == null)
			{
				return;
			}
			if (id != mimicClip || mimicParts == null || mimicParts.Length != count)
			{
				mimicClip = id;
				mimicParts = new byte[count][];
				mimicCount = 0;
			}
			if (mimicParts[index] == null)
			{
				mimicParts[index] = part;
				mimicCount++;
			}
			if (mimicCount >= count)
			{
				int num = 0;
				byte[][] array = mimicParts;
				foreach (byte[] array2 in array)
				{
					num += array2.Length;
				}
				byte[] array3 = new byte[num];
				int num2 = 0;
				array = mimicParts;
				foreach (byte[] array4 in array)
				{
					Array.Copy(array4, 0, array3, num2, array4.Length);
					num2 += array4.Length;
				}
				mimicParts = null;
				mimicClip = -1;
				Mimic.PlayClip(mimicSource, Mimic.Decode(array3));
			}
		}

		[PunRPC]
		public void Scp939_MimicTtsRPC(int playerViewId, PhotonMessageInfo info = default(PhotonMessageInfo))
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.Mimic.Value && playerViewId == mimicAsked && FromAsked(info))
			{
				Mimic.SpeakAs(playerViewId, Object.op_Implicit((Object)(object)head) ? head : ((Component)this).transform);
			}
		}

		[PunRPC]
		public void Scp939_CloudRPC(Vector3 at, PhotonMessageInfo info = default(PhotonMessageInfo))
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.MasterOnlyRPC(info))
			{
				AmnesticCloud.Spawn(at, 25f);
			}
		}
	}
	internal class AmnesticCloud : MonoBehaviour
	{
		private const float Radius = 4.5f;

		private static readonly List<AmnesticCloud> live = new List<AmnesticCloud>();

		private static Material puffMat;

		private static Texture2D puff;

		private ParticleSystem ps;

		private float left;

		internal static void Spawn(Vector3 at, float seconds)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("SCP-939 Amnestic Cloud");
			val.transform.position = at + Vector3.up * 0.8f;
			AmnesticCloud amnesticCloud = val.AddComponent<AmnesticCloud>();
			amnesticCloud.left = seconds;
			amnesticCloud.ps = amnesticCloud.MakeParticles();
			live.Add(amnesticCloud);
		}

		internal static bool Inside(Vector3 p)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			foreach (AmnesticCloud item in live)
			{
				if (Object.op_Implicit((Object)(object)item) && item.left > 0f)
				{
					Vector3 val = p - ((Component)item).transform.position;
					if (((Vector3)(ref val)).sqrMagnitude < 20.25f)
					{
						return true;
					}
				}
			}
			return false;
		}

		private ParticleSystem MakeParticles()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem val = ((Component)this).gameObject.AddComponent<ParticleSystem>();
			val.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = val.main;
			((MainModule)(ref main)).duration = 1f;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(3f, 5f);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.2f, 1.1f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(1.4f, 3f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.75f, 0.12f, 0.1f, 0.4f));
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.01f);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).maxParticles = 350;
			EmissionModule emission = val.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(40f);
			ShapeModule shape = val.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = 1.6f;
			ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val2 = new Gradient();
			val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(1f, 0.25f),
				new GradientAlphaKey(0.7f, 0.7f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val2);
			SizeOverLifetimeModule sizeOverLifetime = val.sizeOverLifetime;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
			((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 0.6f, 1f, 2f));
			ParticleSystemRenderer component = ((Component)this).GetComponent<ParticleSystemRenderer>();
			Material val3 = PuffMaterial();
			if (Object.op_Implicit((Object)(object)val3))
			{
				((Renderer)component).sharedMaterial = val3;
			}
			component.renderMode = (ParticleSystemRenderMode)0;
			component.sortingFudge = 10f;
			val.Play();
			return val;
		}

		private static Material PuffMaterial()
		{
			//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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)puffMat))
			{
				return puffMat;
			}
			if (!Object.op_Implicit((Object)(object)puff))
			{
				puff = Overlay.Radial(128, blob: true);
				((Texture)puff).filterMode = (FilterMode)1;
			}
			Shader val = null;
			string[] array = new string[3] { "Sprites/Default", "Legacy Shaders/Particles/Alpha Blended", "UI/Default" };
			foreach (string text in array)
			{
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = Shader.Find(text);
				}
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			puffMat = new Material(val)
			{
				name = "SCP-939 Cloud",
				mainTexture = (Texture)(object)puff,
				renderQueue = 3000
			};
			return puffMat;
		}

		private void Update()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (left > 0f)
			{
				left -= Time.deltaTime;
				if (left <= 0f)
				{
					EmissionModule emission = ps.emission;
					((EmissionModule)(ref emission)).enabled = false;
					Object.Destroy((Object)(object)((Component)this).gameObject, 6f);
				}
			}
			if (left <= 0f)
			{
				return;
			}
			PlayerController instance = PlayerController.instance;
			if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.playerAvatarScript) && !instance.playerAvatarScript.isDisabled)
			{
				Vector3 val = ((Component)instance.playerAvatarScript).transform.position + Vector3.up - ((Component)this).transform.position;
				if (((Vector3)(ref val)).sqrMagnitude < 20.25f)
				{
					Overlay.Touch();
				}
			}
		}

		private void OnDestroy()
		{
			live.Remove(this);
		}
	}
	internal class Overlay : MonoBehaviour
	{
		private static Overlay instance;

		private static Texture2D tex;

		private float amount;

		private float touched;

		private AudioLowPassFilter muffle;

		internal static void Touch()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)instance))
			{
				GameObject val = new GameObject("SCP-939 Overlay");
				Object.DontDestroyOnLoad((Object)val);
				instance = val.AddComponent<Overlay>();
			}
			instance.touched = 0.25f;
		}

		private void Update()
		{
			touched -= Time.deltaTime;
			amount = Mathf.MoveTowards(amount, (touched > 0f) ? 1f : 0f, Time.deltaTime * ((touched > 0f) ? 0.7f : 1.2f));
			AudioListener val = (Object.op_Implicit((Object)(object)AudioListenerFollow.instance) ? ((Component)AudioListenerFollow.instance).GetComponent<AudioListener>() : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = Object.FindAnyObjectByType<AudioListener>();
			}
			if (Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)muffle) && amount > 0f && !Object.op_Implicit((Object)(object)((Component)val).GetComponent<AudioLowPassFilter>()))
			{
				muffle = ((Component)val).gameObject.AddComponent<AudioLowPassFilter>();
			}
			if (Object.op_Implicit((Object)(object)muffle))
			{
				muffle.cutoffFrequency = Mathf.Lerp(22000f, 900f, amount);
				if (amount <= 0f)
				{
					Object.Destroy((Object)(object)muffle);
					muffle = null;
				}
			}
		}

		private void OnGUI()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			if (!(amount <= 0.01f))
			{
				if (!Object.op_Implicit((Object)(object)tex))
				{
					tex = Radial(128, blob: false);
				}
				Color color = GUI.color;
				GUI.color = new Color(0.65f, 0.05f, 0.05f, amount * 0.85f);
				GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)tex, (ScaleMode)0);
				GUI.color = new Color(0.5f, 0.05f, 0.05f, amount * 0.25f);
				GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = color;
			}
		}

		internal static Texture2D Radial(int n, bool blob)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(n, n, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1
			};
			Color[] array = (Color[])(object)new Color[n * n];
			for (int i = 0; i < n; i++)
			{
				for (int j = 0; j < n; j++)
				{
					float num = ((float)j + 0.5f) / (float)n * 2f - 1f;
					float num2 = ((float)i + 0.5f) / (float)n * 2f - 1f;
					float num3 = Mathf.Sqrt(num * num + num2 * num2);
					float num4 = (blob ? Mathf.Clamp01(1f - num3) : Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.35f, 1f, num3 / 1.414f)));
					array[i * n + j] = new Color(1f, 1f, 1f, blob ? (num4 * num4) : num4);
				}
			}
			val.SetPixels(array);
			val.Apply();
			return val;
		}
	}
	internal static class Assets939
	{
		private const int SoundRate = 24000;

		private static readonly Dictionary<string, AudioClip> sounds = new Dictionary<string, AudioClip>();

		private static readonly Dictionary<string, Texture2D> textures = new Dictionary<string, Texture2D>();

		private static readonly HashSet<string> missing = new HashSet<string>();

		public static byte[] Embedded(string name)
		{
			using Stream stream = typeof(Assets939).Assembly.GetManifestResourceStream("SCP939." + name);
			if (stream == null)
			{
				throw new FileNotFoundException("Embedded resource missing: " + name);
			}
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			return memoryStream.ToArray();
		}

		private static bool Has(string name)
		{
			return typeof(Assets939).Assembly.GetManifestResourceInfo("SCP939." + name) != null;
		}

		public static Texture2D Texture(string name, bool linear = false)
		{
			//IL_003a: 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)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(name) || !Has(name + ".png"))
			{
				return null;
			}
			if (textures.TryGetValue(name, out var value) && Object.op_Implicit((Object)(object)value))
			{
				return value;
			}
			value = new Texture2D(2, 2, (TextureFormat)4, true, linear)
			{
				name = "SCP-939 " + name,
				wrapMode = (TextureWrapMode)0
			};
			ImageConversion.LoadImage(value, Embedded(name + ".png"));
			Texture2D obj = value;
			((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x20);
			return textures[name] = value;
		}

		public static AudioClip Sound(string name)
		{
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			if (sounds.TryGetValue(name, out var value) && Object.op_Implicit((Object)(object)value))
			{
				return value;
			}
			if (missing.Contains(name))
			{
				return null;
			}
			if (!Has("snd_" + name + ".pcm"))
			{
				missing.Add(name);
				Plugin.Log.LogWarning((object)("Missing sound " + name));
				return null;
			}
			byte[] array = Embedded("snd_" + name + ".pcm");
			float[] array2 = new float[array.Length / 2];
			for (int i = 0; i < array2.Length; i++)
			{
				array2[i] = (float)BitConverter.ToInt16(array, i * 2) / 32768f;
			}
			value = AudioClip.Create("SCP-939 " + name, array2.Length, 1, 24000, false);
			value.SetData(array2, 0);
			AudioClip obj = value;
			((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x20);
			return sounds[name] = value;
		}

		public static AudioClip Any(params string[] names)
		{
			return Sound(names[Random.Range(0, names.Length)]);
		}
	}
	internal static class Builder939
	{
		public const string PrefabName = "Enemy - SCP-939";

		public static EnemySetup Setup;

		private static bool tried;

		private static readonly string[] Contacts = new string[6] { "DEF-Foot.L", "DEF-Foot.R", "DEF-Hand.L", "DEF-Hand.R", "DEF-ToeB1.L", "DEF-ToeB1.R" };

		public static void BuildAndRegister(EnemyDirector director)
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Expected O, but got Unknown
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Expected O, but got Unknown
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Expected O, but got Unknown
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Expected O, but got Unknown
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Expected O, but got Unknown
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Expected O, but got Unknown
			//IL_039c: Unknown result type (might be due to invalid IL or missing r