Decompiled source of Omshaq v1.0.4

plugins/Omshaq/aj.Omshaq.dll

Decompiled 16 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Omshaq.Configuration;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.Rendering.HighDefinition;
using aj.Omshaq.NetcodePatcher;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("aj.Omshaq")]
[assembly: AssemblyConfiguration("Public")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4")]
[assembly: AssemblyProduct("Omshaq")]
[assembly: AssemblyTitle("aj.Omshaq")]
[assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was created with the assistance of generative AI (code); see the README credits for which assets.")]
[assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 Omshaq
{
	public class OmshaqAI : EnemyAI
	{
		private enum VoiceLine
		{
			IdleWalking,
			Giggle,
			Caught,
			Pssh
		}

		private enum State
		{
			Roaming,
			Chasing,
			Hugging,
			JumpSlam,
			Eating
		}

		private enum Gait
		{
			Running,
			CatchingBreath,
			Recovering
		}

		private enum Hold
		{
			Spine,
			Face,
			Hands
		}

		public Transform holdPoint;

		public AudioClip[] stompClips;

		public AudioClip landClip;

		public AudioClip slamClip;

		public AudioClip crunchClip;

		public AudioClip jumpGruntClip;

		public AudioClip growlClip;

		public AudioClip whooshClip;

		public AudioClip farRumbleClip;

		public AudioClip idleWalkingClip;

		public AudioClip giggleClip;

		public AudioClip caughtClip;

		public AudioClip psshClip;

		public Transform facePoint;

		public Renderer[] mouthRenderers;

		private bool mouthShown = true;

		private Transform? swellBone;

		private float upperSwell = 1f;

		public Transform leftHand;

		public Transform rightHand;

		public ParticleSystem bloodBurst;

		public ParticleSystem bloodDrip;

		public AudioClip biteClip;

		public AudioClip[] chewClips;

		public AudioClip splatterClip;

		public AudioClip gulpClip;

		public AudioClip deathThudClip;

		public AudioClip deathSwellClip;

		public AudioClip[] deathLineClips;

		public GameObject nukePrefab;

		public Material remainsMaterial;

		private AudioSource lineSource;

		private float lineCooldown = 3f;

		private const float RoamSilenceMin = 12f;

		private const float RoamSilenceMax = 35f;

		private VoiceLine lastRoamLine = VoiceLine.Caught;

		private Random killLineRandom;

		private bool killLinePending;

		private const float FarRumbleFrom = 15f;

		private const float FarRumbleTo = 35f;

		private const float BuildingTremorFloor = 0.04f;

		private AudioSource farSource;

		private readonly AudioSource[] stepSources = (AudioSource[])(object)new AudioSource[2];

		private int stepSourceIndex;

		private const float StepTailFade = 0.6f;

		private static readonly int MoveSpeedId = Animator.StringToHash("moveSpeed");

		private static readonly int ChasingId = Animator.StringToHash("chasing");

		private static readonly int AnimSpeedId = Animator.StringToHash("animSpeed");

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

		private static readonly int JumpSlamId = Animator.StringToHash("jumpSlam");

		private static readonly int EatId = Animator.StringToHash("eat");

		private const float WalkClipSpeed = 0.53f;

		private const float RunClipSpeed = 1.81f;

		private const float HugKillTime = 1.7f;

		private const float HugEndTime = 2.6666667f;

		private const float HugEyesFrom = 0.45f;

		private const float HugEyesTo = 0.75f;

		private const float HugGrinFrom = 0.75f;

		private const float HugGrinTo = 1.35f;

		private const float FaceGap = 0.45f;

		private const float AfterKillGrabCooldown = 3f;

		private const float JumpLiftOff = 2f / 3f;

		private const float JumpGrab = 1f;

		private const float JumpThrow = 1.3f;

		private const float JumpTouchDown = 1.4666667f;

		private const float JumpLand = 1.5333333f;

		private const float JumpSlam1 = 1.8666667f;

		private const float JumpSlam2 = 2.2333333f;

		private const float JumpEnd = 3.5f;

		private const float EatGrab = 0.4f;

		private const float EatBite = 1.3333334f;

		private static readonly float[] EatChomps = new float[3] { 2f, 2.5333333f, 3.0666666f };

		private const float EatSwallow = 3.6f;

		private const float EatEnd = 5f;

		private const float DeathStagger = 0.4f;

		private const float SwellStart = 2f;

		private const float BurstTime = 8f;

		private const float SwellScale = 1.5f;

		private const string SwellBone = "Spine02";

		private const float PulseRateFrom = 0.8f;

		private const float PulseRateTo = 6f;

		private static readonly Color PulseColor = new Color(0.9f, 0.04f, 0.02f) * 0.3f;

		private const float BlastThroughCover = 0.3f;

		internal const float BlastEdgeDamage = 5f;

		private const float ExposedToDie = 0.5f;

		private const float DespawnAfterBurst = 3f;

		private const float SpotAngle = 55f;

		private const int SpotProximity = 3;

		private const float ChaseSightAngle = 70f;

		private const float ChaseSightProximity = 4f;

		private const float ChaseLineGapMin = 1.5f;

		private const float ChaseLineGapMax = 5f;

		internal const float JumpMinDistance = 4.5f;

		internal const float JumpMaxDistance = 11f;

		private const float PoundRadius = 3f;

		private const int PoundDamage = 30;

		private Random enemyRandom;

		private Random chewRandom;

		private float timeSinceSawTarget;

		private float jumpCooldown;

		private float grabCooldown;

		private const float RoamWalkMin = 8f;

		private const float RoamWalkMax = 20f;

		private const float RoamPauseMin = 3f;

		private const float RoamPauseMax = 7f;

		private float roamWalkTimer;

		private float roamPauseTimer;

		private Gait chaseGait;

		private float gaitTimer;

		private float chaseRunTime;

		private const float RecoverWalkMin = 1f;

		private const float RecoverWalkMax = 1.5f;

		private const float SpeedUpPerSecond = 3f;

		private const float SlowDownPerSecond = 6f;

		private bool animRunning;

		private float timeSinceFootstep;

		private Vector3 lastSeenTargetPosition;

		private Vector3 previousPosition;

		private float smoothedSpeed;

		private PlayerControllerB? pinnedPlayer;

		private Vector3 pinPosition;

		private Hold holdMode;

		private float holdTime;

		private Vector3 holdFrom;

		private int grinShape = -1;

		private int eyesShape = -1;

		private float faceEyes;

		private float faceGrin;

		private Coroutine? specialRoutine;

		private const float AirGrabReach = 6f;

		private const float LookAroundTime = 1.6f;

		private const float DoorReach = 2f;

		private const float DoorCooldown = 3f;

		private const float FollowSeenWithin = 3f;

		private const float FollowDoorRadius = 8f;

		private const float InsideSpotRange = 30f;

		private const float InsideChaseRange = 40f;

		private const float InsideGiveUpTime = 8f;

		private const float ReturnSpeed = 1.2f;

		private const float CrouchMargin = 2.5f;

		private const float ShipSpeed = 1.1f;

		private const float CrouchClipSpeed = 0.37f;

		private static readonly int LookAroundId = Animator.StringToHash("lookAround");

		private static readonly int CrouchingId = Animator.StringToHash("crouching");

		private EntranceTeleport? doorToUse;

		private float lookAroundTimer;

		private float lastDoorTime = -3f;

		private bool crouching;

		private bool loggedShip;

		private bool InKillMove
		{
			get
			{
				if (base.currentBehaviourStateIndex != 2 && base.currentBehaviourStateIndex != 3)
				{
					return base.currentBehaviourStateIndex == 4;
				}
				return true;
			}
		}

		private float SpotRange
		{
			get
			{
				if (!base.isOutside)
				{
					return 30f;
				}
				return Plugin.BoundConfig.OutsideSightRange.Value;
			}
		}

		private float ChaseRange
		{
			get
			{
				if (!base.isOutside)
				{
					return 40f;
				}
				return Plugin.BoundConfig.OutsideSightRange.Value;
			}
		}

		private float GiveUpTime
		{
			get
			{
				if (!base.isOutside)
				{
					return 8f;
				}
				return Plugin.BoundConfig.OutsideGiveUpTime.Value;
			}
		}

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public override void Start()
		{
			//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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + (int)((NetworkBehaviour)this).NetworkObjectId);
			killLineRandom = new Random(StartOfRound.Instance.randomMapSeed + (int)((NetworkBehaviour)this).NetworkObjectId + 7766);
			chewRandom = new Random(StartOfRound.Instance.randomMapSeed + (int)((NetworkBehaviour)this).NetworkObjectId + 7768);
			jumpCooldown = Plugin.BoundConfig.JumpSlamCooldown.Value * 0.5f;
			base.enemyHP = Mathf.Max(1, Plugin.BoundConfig.Health.Value);
			roamWalkTimer = RandomRange(8f, 20f);
			lineCooldown = Random.Range(4f, 35f);
			previousPosition = ((Component)this).transform.position;
			SetUpAudio();
			Mesh val = ((base.skinnedMeshRenderers.Length != 0) ? base.skinnedMeshRenderers[0].sharedMesh : null);
			if ((Object)(object)val != (Object)null)
			{
				grinShape = val.GetBlendShapeIndex("GrinWide");
				eyesShape = val.GetBlendShapeIndex("EyesWide");
			}
			ParticleSystem[] array = (ParticleSystem[])(object)new ParticleSystem[2] { bloodBurst, bloodDrip };
			foreach (ParticleSystem val2 in array)
			{
				CollisionModule collision = val2.collision;
				((CollisionModule)(ref collision)).collidesWith = LayerMask.op_Implicit(StartOfRound.Instance.collidersAndRoomMaskAndDefault);
			}
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
		}

		public override void Update()
		{
			//IL_00a6: 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_00c4: 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_0173: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				return;
			}
			grabCooldown -= Time.deltaTime;
			jumpCooldown -= Time.deltaTime;
			UpdateOutsideLook();
			timeSinceFootstep += Time.deltaTime;
			AudioSource val = stepSources[1 - stepSourceIndex];
			if ((Object)(object)val != (Object)null && val.isPlaying)
			{
				val.volume = Mathf.MoveTowards(val.volume, 0f, Time.deltaTime / 0.6f);
			}
			float num = ((Time.deltaTime > 0f) ? (Vector3.Distance(((Component)this).transform.position, previousPosition) / Time.deltaTime) : 0f);
			previousPosition = ((Component)this).transform.position;
			smoothedSpeed = Mathf.Lerp(smoothedSpeed, num, 6f * Time.deltaTime);
			animRunning = smoothedSpeed > 1.6f || (animRunning && smoothedSpeed > 1.2f);
			base.creatureAnimator.SetFloat(MoveSpeedId, smoothedSpeed);
			base.creatureAnimator.SetBool(ChasingId, animRunning);
			float num2 = (crouching ? 0.37f : (animRunning ? 1.81f : 0.53f)) * ((Component)base.creatureAnimator).transform.localScale.y;
			base.creatureAnimator.SetFloat(AnimSpeedId, Mathf.Clamp(smoothedSpeed / num2, crouching ? 0f : 0.6f, 2.4f));
			if (base.stunNormalizedTimer > 0f)
			{
				base.agent.speed = 0f;
				if ((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null || (Object)(object)pinnedPlayer != (Object)null)
				{
					CancelSpecial();
				}
			}
			if (((NetworkBehaviour)this).IsOwner && !base.inSpecialAnimation)
			{
				ChooseVoiceLine();
			}
		}

		private void ChooseVoiceLine()
		{
			lineCooldown -= Time.deltaTime;
			if (lineCooldown > 0f || lineSource.isPlaying || killLinePending)
			{
				return;
			}
			if (base.currentBehaviourStateIndex == 1)
			{
				bool flag = Random.value < 0.4f;
				PlayVoiceLineClientRpc((!flag) ? 1 : 2);
				lineCooldown = (flag ? caughtClip.length : giggleClip.length) + Random.Range(1.5f, 5f);
			}
			else if (base.currentBehaviourStateIndex == 0)
			{
				VoiceLine voiceLine;
				do
				{
					float value = Random.value;
					voiceLine = ((value < 0.2f) ? VoiceLine.Giggle : ((value < 0.5f) ? VoiceLine.Pssh : VoiceLine.IdleWalking));
				}
				while (voiceLine == lastRoamLine);
				lastRoamLine = voiceLine;
				PlayVoiceLineClientRpc((int)voiceLine);
				lineCooldown = LineClip((int)voiceLine).length + Random.Range(12f, 35f);
			}
		}

		[ClientRpc]
		public void PlayVoiceLineClientRpc(int line)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1625548173u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, line);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1625548173u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (!base.isEnemyDead)
				{
					PlayLine(LineClip(line));
				}
			}
		}

		private AudioClip LineClip(int line)
		{
			return (AudioClip)((VoiceLine)line switch
			{
				VoiceLine.Giggle => giggleClip, 
				VoiceLine.Caught => caughtClip, 
				VoiceLine.Pssh => psshClip, 
				_ => idleWalkingClip, 
			});
		}

		private void QueueKillLine()
		{
			killLinePending = true;
			((MonoBehaviour)this).StartCoroutine(KillLineRoutine(2f + (float)killLineRandom.NextDouble()));
		}

		private IEnumerator KillLineRoutine(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			while (lineSource.isPlaying && (Object)(object)lineSource.clip == (Object)(object)caughtClip)
			{
				yield return null;
			}
			if (!base.isEnemyDead)
			{
				PlayLine(psshClip);
				lineCooldown = psshClip.length + Random.Range(3f, 8f);
				killLinePending = false;
			}
		}

		private void PlayLine(AudioClip clip)
		{
			lineSource.Stop();
			lineSource.clip = clip;
			lineSource.Play();
		}

		private void LateUpdate()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: 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_008a: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: 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_018f: 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_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			ApplyExpression();
			if ((Object)(object)swellBone != (Object)null)
			{
				swellBone.localScale = Vector3.one * upperSwell;
			}
			PlayerControllerB val = null;
			if ((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null)
			{
				val = base.inSpecialAnimationWithPlayer;
				if (val.isPlayerDead || !val.isPlayerControlled)
				{
					ReleaseVictim();
					return;
				}
				if (holdMode == Hold.Spine)
				{
					((Component)val).transform.position = holdPoint.position;
					((Component)val).transform.rotation = holdPoint.rotation;
				}
				else
				{
					holdTime += Time.deltaTime;
					Vector3 val2 = ((holdMode == Hold.Face) ? (facePoint.position + ((Component)this).transform.forward * 0.45f) : ((leftHand.position + rightHand.position) * 0.5f + ((Component)this).transform.forward * 0.25f));
					if (holdMode == Hold.Hands)
					{
						val2.y = facePoint.position.y;
					}
					Vector3 val3 = ((Component)val.gameplayCamera).transform.position - ((Component)val).transform.position;
					float num = Mathf.SmoothStep(0f, 1f, holdTime / ((holdMode == Hold.Hands) ? 0.4f : 0.4f));
					((Component)val).transform.position = Vector3.Lerp(holdFrom, val2 - val3, num);
					((Component)val).transform.rotation = Quaternion.LookRotation(-((Component)this).transform.forward);
				}
			}
			else if ((Object)(object)pinnedPlayer != (Object)null)
			{
				val = pinnedPlayer;
				if (val.isPlayerDead || !val.isPlayerControlled)
				{
					ReleaseVictim();
					return;
				}
				((Component)val).transform.position = pinPosition;
			}
			if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				OmshaqCamera.LookAtThisFrame(facePoint.position);
			}
		}

		private void SetExpression(float eyes, float grin)
		{
			faceEyes = eyes;
			faceGrin = grin;
		}

		private void ApplyExpression()
		{
			if (base.skinnedMeshRenderers.Length == 0)
			{
				return;
			}
			SkinnedMeshRenderer val = base.skinnedMeshRenderers[0];
			if (eyesShape >= 0)
			{
				val.SetBlendShapeWeight(eyesShape, faceEyes * 100f);
			}
			if (grinShape >= 0)
			{
				val.SetBlendShapeWeight(grinShape, faceGrin * 100f);
			}
			bool flag = faceGrin > 0.01f;
			if (flag != mouthShown)
			{
				mouthShown = flag;
				Renderer[] array = mouthRenderers;
				foreach (Renderer val2 in array)
				{
					val2.enabled = flag;
				}
			}
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			if (lookAroundTimer > 0f)
			{
				base.agent.speed = 0f;
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
			{
				if (base.isOutside)
				{
					UpdateGoingBackIn();
					break;
				}
				UpdateRoamPause();
				EaseSpeed((roamPauseTimer > 0f) ? 0f : Plugin.BoundConfig.RoamSpeed.Value);
				PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(55f, (int)SpotRange, 3);
				if ((Object)(object)val != (Object)null && ((EnemyAI)this).PlayerIsTargetable(val, false, false, true))
				{
					BeginChase(val);
				}
				break;
			}
			case 1:
			{
				if (UpdateChase(out var canSee))
				{
					EaseSpeed(ChaseGaitSpeed(canSee));
				}
				break;
			}
			}
			if (crouching)
			{
				base.agent.speed = Mathf.Min(base.agent.speed, 1.1f);
			}
		}

		private void BeginChase(PlayerControllerB player)
		{
			//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)
			base.targetPlayer = player;
			doorToUse = null;
			timeSinceSawTarget = 0f;
			chaseGait = Gait.Running;
			chaseRunTime = 0f;
			lastSeenTargetPosition = ((Component)player).transform.position;
			((EnemyAI)this).StopSearch(base.currentSearch, true);
			((EnemyAI)this).SwitchToBehaviourClientRpc(1);
			GrowlClientRpc();
			if (!killLinePending)
			{
				PlayVoiceLineClientRpc(1);
				lineCooldown = giggleClip.length + Random.Range(1.5f, 5f);
			}
		}

		private void TurnOn(PlayerControllerB player)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			base.targetPlayer = player;
			doorToUse = null;
			timeSinceSawTarget = 0f;
			lastSeenTargetPosition = ((Component)player).transform.position;
		}

		private bool UpdateChase(out bool canSee)
		{
			//IL_00eb: 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_012a: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			canSee = false;
			if ((Object)(object)doorToUse != (Object)null && ((Object)(object)base.targetPlayer == (Object)null || !((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true)))
			{
				canSee = true;
				WalkToDoor();
				return true;
			}
			doorToUse = null;
			if ((Object)(object)base.targetPlayer == (Object)null || !((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true))
			{
				if (TryFollowThroughDoor())
				{
					canSee = true;
					WalkToDoor();
					return true;
				}
				PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(55f, (int)SpotRange, 3);
				if (!((Object)(object)val != (Object)null) || !((EnemyAI)this).PlayerIsTargetable(val, false, false, true))
				{
					LoseTrail(((Object)(object)base.targetPlayer != (Object)null) ? ((Component)base.targetPlayer).transform.position : ((Component)this).transform.position);
					return false;
				}
				base.targetPlayer = val;
			}
			canSee = ((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer.gameplayCamera).transform.position, 70f, (int)ChaseRange, 4f, (Transform)null);
			if (canSee)
			{
				timeSinceSawTarget = 0f;
				lastSeenTargetPosition = ((Component)base.targetPlayer).transform.position;
			}
			else
			{
				timeSinceSawTarget += base.AIIntervalTime;
				if (timeSinceSawTarget > GiveUpTime)
				{
					LoseTrail(lastSeenTargetPosition);
					return false;
				}
			}
			((EnemyAI)this).SetDestinationToPosition(canSee ? ((Component)base.targetPlayer).transform.position : lastSeenTargetPosition, false);
			if (canSee && jumpCooldown <= 0f && chaseGait == Gait.Running && !crouching)
			{
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position);
				float num2 = Plugin.BoundConfig.JumpSlamChancePerSecond.Value / 100f * base.AIIntervalTime;
				if (num > 4.5f && num < 11f && enemyRandom.NextDouble() < (double)num2)
				{
					TryStartJumpSlam(base.targetPlayer);
				}
			}
			return true;
		}

		private float ChaseGaitSpeed(bool canSee)
		{
			switch (chaseGait)
			{
			case Gait.CatchingBreath:
				gaitTimer -= base.AIIntervalTime;
				if (gaitTimer <= 0f)
				{
					chaseGait = Gait.Recovering;
					gaitTimer = RandomRange(1f, 1.5f);
				}
				return 0f;
			case Gait.Recovering:
				gaitTimer -= base.AIIntervalTime;
				if (gaitTimer <= 0f && canSee)
				{
					chaseGait = Gait.Running;
					chaseRunTime = 0f;
					PlayVoiceLineClientRpc(1);
					lineCooldown = giggleClip.length + Random.Range(1.5f, 5f);
					return Plugin.BoundConfig.ChaseSpeed.Value;
				}
				return Plugin.BoundConfig.RoamSpeed.Value;
			default:
				chaseRunTime += base.AIIntervalTime;
				if (chaseRunTime >= Plugin.BoundConfig.ChaseStamina.Value)
				{
					chaseGait = Gait.CatchingBreath;
					gaitTimer = Plugin.BoundConfig.CatchBreathTime.Value * RandomRange(0.85f, 1.25f);
					PlayVoiceLineClientRpc(0);
					return 0f;
				}
				return Plugin.BoundConfig.ChaseSpeed.Value;
			}
		}

		private void EaseSpeed(float target)
		{
			float num = ((target > base.agent.speed) ? 3f : 6f);
			base.agent.speed = Mathf.MoveTowards(base.agent.speed, target, num * base.AIIntervalTime);
		}

		private void UpdateRoamPause()
		{
			if (roamPauseTimer > 0f)
			{
				roamPauseTimer -= base.AIIntervalTime;
				if (roamPauseTimer <= 0f)
				{
					roamWalkTimer = RandomRange(8f, 20f);
				}
			}
			else
			{
				roamWalkTimer -= base.AIIntervalTime;
				if (roamWalkTimer <= 0f)
				{
					roamPauseTimer = RandomRange(3f, 7f);
				}
			}
		}

		private float RandomRange(float min, float max)
		{
			return min + (float)enemyRandom.NextDouble() * (max - min);
		}

		private void LoseTrail(Vector3 searchFrom)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (!base.isOutside)
			{
				GoBackToRoaming(searchFrom);
				return;
			}
			base.targetPlayer = null;
			doorToUse = null;
			((EnemyAI)this).SwitchToBehaviourClientRpc(0);
		}

		private void GoBackToRoaming(Vector3 searchFrom)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			base.targetPlayer = null;
			roamPauseTimer = 0f;
			roamWalkTimer = RandomRange(8f, 20f);
			((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			((EnemyAI)this).StartSearch(searchFrom, (AISearchRoutine)null);
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (!base.isEnemyDead && !(grabCooldown > 0f) && !(base.stunNormalizedTimer > 0f) && !base.inSpecialAnimation && !InKillMove && !(lookAroundTimer > 0f))
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val.inAnimationWithEnemy != (Object)null))
				{
					grabCooldown = 1f;
					GrabPlayerServerRpc((int)val.playerClientId);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void GrabPlayerServerRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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_017c: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: 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)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2471645592u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2471645592u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
			if (!base.isEnemyDead && !(base.stunNormalizedTimer > 0f) && !base.inSpecialAnimation && !((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null) && !InKillMove && !val3.isPlayerDead && !((Object)(object)val3.inAnimationWithEnemy != (Object)null))
			{
				Vector3 val4 = ((Component)val3).transform.position - ((Component)this).transform.position;
				val4.y = 0f;
				float y;
				if (!(((Vector3)(ref val4)).sqrMagnitude > 0.01f))
				{
					y = ((Component)this).transform.eulerAngles.y;
				}
				else
				{
					Quaternion val5 = Quaternion.LookRotation(val4);
					y = ((Quaternion)(ref val5)).eulerAngles.y;
				}
				float yRot = y;
				double num = enemyRandom.NextDouble() * 100.0;
				float num2 = (crouching ? 0f : Plugin.BoundConfig.GroundPoundChance.Value);
				if (num < (double)num2)
				{
					Vector3 val6 = ((Component)this).transform.position + ((Vector3)(ref val4)).normalized * 0.4f;
					NavMeshHit val7 = default(NavMeshHit);
					Vector3 land = (NavMesh.SamplePosition(val6, ref val7, 1f, -1) ? ((NavMeshHit)(ref val7)).position : ((Component)this).transform.position);
					JumpSlamClientRpc(playerId, ((Component)this).transform.position, land, caught: true);
				}
				else if (num < (double)(num2 + Plugin.BoundConfig.EatChance.Value))
				{
					EatClientRpc(playerId, ((Component)this).transform.position, yRot);
				}
				else
				{
					HugClientRpc(playerId, ((Component)this).transform.position, yRot);
				}
			}
		}

		[ClientRpc]
		public void HugClientRpc(int playerId, Vector3 position, float yRot)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00b1: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(859241093u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref yRot, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 859241093u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					StartSpecial(HugRoutine(StartOfRound.Instance.allPlayerScripts[playerId], position, yRot));
				}
			}
		}

		private IEnumerator HugRoutine(PlayerControllerB player, Vector3 position, float yRot)
		{
			//IL_0015: 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)
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
			FreezeForSpecial(position, yRot);
			GrabVictim(player, Hold.Face);
			base.creatureAnimator.SetTrigger(AttackId);
			PlayLine(caughtClip);
			for (float t = 0f; t < 1.7f; t += Time.deltaTime)
			{
				SetExpression(Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.45f, 0.75f, t)), Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.75f, 1.35f, t)));
				yield return null;
			}
			SetExpression(1f, 1f);
			base.creatureSFX.PlayOneShot(crunchClip, 1f);
			WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, crunchClip, 1f);
			if ((Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController && (Object)(object)player.inAnimationWithEnemy == (Object)(object)this && !player.isPlayerDead)
			{
				player.KillPlayer(((Component)this).transform.forward * 3f + Vector3.up * 2f, true, (CauseOfDeath)8, 0, default(Vector3), false);
			}
			ReleaseVictim();
			QueueKillLine();
			for (float t = 0f; t < 0.9666667f; t += Time.deltaTime)
			{
				float num = 1f - Mathf.SmoothStep(0f, 1f, t / 0.6f);
				SetExpression(num, num);
				yield return null;
			}
			EndSpecial(Vector3.zero);
		}

		[ClientRpc]
		public void EatClientRpc(int playerId, Vector3 position, float yRot)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00b1: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3300668715u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref yRot, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 3300668715u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					StartSpecial(EatRoutine(StartOfRound.Instance.allPlayerScripts[playerId], position, yRot));
				}
			}
		}

		private IEnumerator EatRoutine(PlayerControllerB player, Vector3 position, float yRot)
		{
			//IL_0015: 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)
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(4);
			FreezeForSpecial(position, yRot);
			GrabVictim(player, Hold.Hands);
			base.creatureAnimator.SetTrigger(EatId);
			base.creatureVoice.PlayOneShot(growlClip, 1f);
			yield return (object)new WaitForSeconds(1.3333334f);
			PlayGore(biteClip, 110);
			if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)(object)player && !player.isPlayerDead)
			{
				player.DropBlood(Vector3.down, true, false);
				if ((Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					player.KillPlayer(Vector3.zero, false, (CauseOfDeath)6, 0, default(Vector3), false);
				}
			}
			ReleaseVictim();
			SetBloodDrip(on: true);
			QueueKillLine();
			float num = 1.3333334f;
			float[] eatChomps = EatChomps;
			foreach (float chomp in eatChomps)
			{
				yield return (object)new WaitForSeconds(chomp - num);
				num = chomp;
				PlayGore(chewClips[chewRandom.Next(chewClips.Length)], 20);
			}
			yield return (object)new WaitForSeconds(3.6f - num);
			SetBloodDrip(on: false);
			base.creatureVoice.PlayOneShot(gulpClip, 1f);
			yield return (object)new WaitForSeconds(1.4000001f);
			EndSpecial(Vector3.zero);
		}

		private void PlayGore(AudioClip clip, int droplets)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			base.creatureSFX.PlayOneShot(clip, 1f);
			base.creatureSFX.PlayOneShot(splatterClip, (droplets > 50) ? 0.9f : 0.45f);
			WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, clip, 1f);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 20f, 0.6f, 0, false, 5467);
			bloodBurst.Emit(droplets);
		}

		private void SetBloodDrip(bool on)
		{
			if (on)
			{
				bloodDrip.Play();
			}
			else if (bloodDrip.isEmitting)
			{
				bloodDrip.Stop(true, (ParticleSystemStopBehavior)1);
			}
		}

		private void TryStartJumpSlam(PlayerControllerB player)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0035: 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_0044: 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)
			//IL_004a: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_00b7: 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)
			Vector3 val = ((Component)player).transform.position - ((Component)this).transform.position;
			val.y = 0f;
			Vector3 val2 = ((Component)player).transform.position - ((Vector3)(ref val)).normalized * 1.2f;
			NavMeshHit val3 = default(NavMeshHit);
			if (NavMesh.SamplePosition(val2, ref val3, 2f, -1) && !Physics.Linecast(base.eye.position, ((NavMeshHit)(ref val3)).position + Vector3.up * 1.5f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
			{
				jumpCooldown = Plugin.BoundConfig.JumpSlamCooldown.Value;
				JumpSlamClientRpc((int)player.playerClientId, ((Component)this).transform.position, ((NavMeshHit)(ref val3)).position, caught: false);
			}
		}

		[ClientRpc]
		public void JumpSlamClientRpc(int playerId, Vector3 start, Vector3 land, bool caught)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3374203433u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref start);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref land);
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref caught, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 3374203433u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					StartSpecial(JumpSlamRoutine(StartOfRound.Instance.allPlayerScripts[playerId], start, land, caught));
				}
			}
		}

		private IEnumerator JumpSlamRoutine(PlayerControllerB player, Vector3 start, Vector3 land, bool caught)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3);
			Vector3 val = land - start;
			val.y = 0f;
			float y;
			if (!(((Vector3)(ref val)).sqrMagnitude > 0.01f))
			{
				y = ((Component)this).transform.eulerAngles.y;
			}
			else
			{
				Quaternion val2 = Quaternion.LookRotation(val);
				y = ((Quaternion)(ref val2)).eulerAngles.y;
			}
			float yRot = y;
			FreezeForSpecial(start, yRot);
			base.creatureAnimator.SetTrigger(JumpSlamId);
			if (caught)
			{
				GrabVictim(player);
			}
			float t = 0f;
			bool grunted = false;
			bool grabbed = false;
			bool landed = false;
			bool slam1 = false;
			bool slam2 = false;
			NavMeshHit val4 = default(NavMeshHit);
			while (t < 3.5f)
			{
				t += Time.deltaTime;
				float num = Mathf.Clamp01((t - 2f / 3f) / 0.8f);
				num = num * num * (3f - 2f * num);
				((Component)this).transform.position = Vector3.Lerp(start, land, num);
				if (!grunted && t >= 37f / 60f)
				{
					grunted = true;
					base.creatureVoice.PlayOneShot(jumpGruntClip, 1f);
					base.creatureSFX.PlayOneShot(whooshClip, 0.8f);
				}
				if (!grabbed && t >= 1f)
				{
					grabbed = true;
					if (caught)
					{
						if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)(object)player)
						{
							PlayLine(caughtClip);
						}
					}
					else if (((NetworkBehaviour)this).IsServer && (Object)(object)player != (Object)null && !player.isPlayerDead && player.isPlayerControlled && (Object)(object)player.inAnimationWithEnemy == (Object)null && Vector3.Distance(((Component)player).transform.position, holdPoint.position) < 6f)
					{
						AirGrabClientRpc((int)player.playerClientId);
					}
				}
				if (t >= 1.3f && !slam2 && (Object)(object)base.inSpecialAnimationWithPlayer != (Object)null)
				{
					pinnedPlayer = base.inSpecialAnimationWithPlayer;
					base.inSpecialAnimationWithPlayer = null;
					Vector3 val3 = land + ((Component)this).transform.forward * 1.4f;
					pinPosition = (NavMesh.SamplePosition(val3, ref val4, 2f, -1) ? ((NavMeshHit)(ref val4)).position : land);
				}
				if (!landed && t >= 1.5333333f)
				{
					landed = true;
					Impact(landClip, land, 10f, 28f, (ScreenShakeType)1);
				}
				if (!slam1 && t >= 1.8666667f)
				{
					slam1 = true;
					Impact(slamClip, PoundPoint(land), 6f, 20f, (ScreenShakeType)3);
					DamageNearbyLocalPlayer(PoundPoint(land), 3f, 30);
				}
				if (!slam2 && t >= 2.2333333f)
				{
					slam2 = true;
					Impact(slamClip, PoundPoint(land), 6f, 20f, (ScreenShakeType)3);
					if ((Object)(object)pinnedPlayer != (Object)null && (Object)(object)pinnedPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController && !pinnedPlayer.isPlayerDead)
					{
						pinnedPlayer.KillPlayer(Vector3.down * 6f, true, (CauseOfDeath)2, 0, default(Vector3), false);
					}
					if ((Object)(object)pinnedPlayer != (Object)null)
					{
						base.creatureSFX.PlayOneShot(crunchClip, 1f);
						QueueKillLine();
					}
					ReleaseVictim();
					DamageNearbyLocalPlayer(PoundPoint(land), 3f, 30);
				}
				yield return null;
			}
			ReleaseVictim();
			EndSpecial(land);
		}

		[ClientRpc]
		public void AirGrabClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(123433061u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 123433061u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
				if (!base.isEnemyDead && base.currentBehaviourStateIndex == 3 && !((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null) && !((Object)(object)pinnedPlayer != (Object)null) && !val3.isPlayerDead)
				{
					GrabVictim(val3);
					PlayLine(caughtClip);
				}
			}
		}

		private Vector3 PoundPoint(Vector3 land)
		{
			//IL_0000: 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_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)
			return land + ((Component)this).transform.forward * 1.3f;
		}

		private void Impact(AudioClip clip, Vector3 where, float bigShakeRange, float smallShakeRange, ScreenShakeType closeShake)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			base.creatureSFX.PlayOneShot(clip, 1f);
			WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, clip, 1f);
			RoundManager.Instance.PlayAudibleNoise(where, 40f, 1f, 0, false, 5466);
			Quake(1.6f);
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!((Object)(object)localPlayerController == (Object)null) && !localPlayerController.isPlayerDead)
			{
				float num = Vector3.Distance(((Component)localPlayerController).transform.position, where);
				if (num < bigShakeRange)
				{
					HUDManager.Instance.ShakeCamera(closeShake);
				}
				else if (num < smallShakeRange)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
				}
			}
		}

		private void DamageNearbyLocalPlayer(Vector3 where, float radius, int damage)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!((Object)(object)localPlayerController == (Object)null) && !localPlayerController.isPlayerDead && !((Object)(object)localPlayerController == (Object)(object)pinnedPlayer) && !((Object)(object)localPlayerController.inAnimationWithEnemy == (Object)(object)this) && Vector3.Distance(((Component)localPlayerController).transform.position, where) < radius)
			{
				localPlayerController.DamagePlayer(damage, true, true, (CauseOfDeath)1, 0, false, default(Vector3));
			}
		}

		private void StartSpecial(IEnumerator routine)
		{
			if (specialRoutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(specialRoutine);
			}
			specialRoutine = ((MonoBehaviour)this).StartCoroutine(routine);
		}

		private void FreezeForSpecial(Vector3 position, float yRot)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			base.inSpecialAnimation = true;
			if (((NetworkBehaviour)this).IsOwner && ((Behaviour)base.agent).enabled)
			{
				if (base.agent.isOnNavMesh)
				{
					base.agent.ResetPath();
				}
				base.agent.velocity = Vector3.zero;
				((Behaviour)base.agent).enabled = false;
			}
			((Component)this).transform.position = position;
			((Component)this).transform.rotation = Quaternion.Euler(0f, yRot, 0f);
		}

		private void EndSpecial(Vector3 finalPosition)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			specialRoutine = null;
			SetBloodDrip(on: false);
			SetExpression(0f, 0f);
			if (finalPosition != Vector3.zero)
			{
				((Component)this).transform.position = finalPosition;
			}
			base.serverPosition = ((Component)this).transform.position;
			base.inSpecialAnimation = false;
			grabCooldown = 3f;
			if (((NetworkBehaviour)this).IsOwner)
			{
				((Behaviour)base.agent).enabled = true;
				base.agent.Warp(((Component)this).transform.position);
				((EnemyAI)this).SyncPositionToClients();
				PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(55f, (int)SpotRange, 3);
				if ((Object)(object)val != (Object)null && ((EnemyAI)this).PlayerIsTargetable(val, false, false, true))
				{
					BeginChase(val);
				}
				else
				{
					LoseTrail(((Component)this).transform.position);
				}
			}
		}

		private void CancelSpecial()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (specialRoutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(specialRoutine);
			}
			ReleaseVictim();
			NavMeshHit val = default(NavMeshHit);
			EndSpecial(NavMesh.SamplePosition(((Component)this).transform.position, ref val, 4f, -1) ? ((NavMeshHit)(ref val)).position : Vector3.zero);
		}

		private void GrabVictim(PlayerControllerB player, Hold hold = Hold.Spine)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			holdMode = hold;
			holdTime = 0f;
			holdFrom = ((Component)player).transform.position;
			base.inSpecialAnimationWithPlayer = player;
			player.inSpecialInteractAnimation = true;
			player.inAnimationWithEnemy = (EnemyAI)(object)this;
			player.isInElevator = false;
			player.isInHangarShipRoom = false;
		}

		private void ReleaseVictim()
		{
			PlayerControllerB[] array = (PlayerControllerB[])(object)new PlayerControllerB[2] { base.inSpecialAnimationWithPlayer, pinnedPlayer };
			foreach (PlayerControllerB val in array)
			{
				if ((Object)(object)val != (Object)null && (Object)(object)val.inAnimationWithEnemy == (Object)(object)this)
				{
					val.inSpecialInteractAnimation = false;
					val.inAnimationWithEnemy = null;
				}
			}
			base.inSpecialAnimationWithPlayer = null;
			pinnedPlayer = null;
			holdMode = Hold.Spine;
		}

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

		private void SetUpAudio()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			SoundManager instance = SoundManager.Instance;
			object obj;
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				AudioMixer diageticMixer = instance.diageticMixer;
				obj = ((diageticMixer != null) ? diageticMixer.FindMatchingGroups("SFX").FirstOrDefault() : null);
			}
			AudioMixerGroup val = (AudioMixerGroup)obj;
			farSource = new GameObject("FarRumble").AddComponent<AudioSource>();
			((Component)farSource).transform.SetParent(((Component)this).transform, false);
			farSource.spatialBlend = 0f;
			farSource.playOnAwake = false;
			farSource.dopplerLevel = 0f;
			GameObject val2 = Object.Instantiate<GameObject>(((Component)base.creatureVoice).gameObject, ((Component)base.creatureVoice).transform.parent);
			((Object)val2).name = "VoiceLines";
			lineSource = val2.GetComponent<AudioSource>();
			lineSource.Stop();
			lineSource.clip = null;
			lineSource.loop = false;
			lineSource.playOnAwake = false;
			lineSource.volume = 1f;
			lineSource.maxDistance = 32f;
			for (int i = 0; i < stepSources.Length; i++)
			{
				GameObject val3 = Object.Instantiate<GameObject>(((Component)base.creatureSFX).gameObject, ((Component)base.creatureSFX).transform.parent);
				((Object)val3).name = "Footsteps" + i;
				stepSources[i] = val3.GetComponent<AudioSource>();
				stepSources[i].Stop();
				stepSources[i].clip = null;
				stepSources[i].loop = false;
				stepSources[i].playOnAwake = false;
			}
			AudioSource[] array = (AudioSource[])(object)new AudioSource[6]
			{
				base.creatureSFX,
				base.creatureVoice,
				farSource,
				lineSource,
				stepSources[0],
				stepSources[1]
			};
			foreach (AudioSource val4 in array)
			{
				if ((Object)(object)val != (Object)null)
				{
					val4.outputAudioMixerGroup = val;
				}
			}
		}

		private float TremorAtLocalPlayer(out float distance)
		{
			//IL_0045: 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)
			distance = float.MaxValue;
			PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
			if ((Object)(object)val == (Object)null || val.isPlayerDead || val.isInsideFactory == base.isOutside)
			{
				return 0f;
			}
			distance = Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position);
			float num = Mathf.Pow(Mathf.Clamp01(1f - distance / Mathf.Max(1f, Plugin.BoundConfig.TremorRange.Value)), 1.5f);
			if (!base.isOutside)
			{
				return Mathf.Max(0.04f, num);
			}
			return num;
		}

		private float Quake(float weight)
		{
			float distance;
			float num = TremorAtLocalPlayer(out distance);
			if (num <= 0f)
			{
				return distance;
			}
			OmshaqCamera.AddTremor(num * weight);
			if (distance > 15f && distance < 35f && (Object)(object)farRumbleClip != (Object)null)
			{
				float num2 = 1f - (distance - 15f) / 20f;
				farSource.pitch = Random.Range(0.85f, 1.05f);
				farSource.PlayOneShot(farRumbleClip, Mathf.Clamp01(0.45f * num * weight * num2));
			}
			return distance;
		}

		public void PlayFootstep()
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			if (stompClips != null && stompClips.Length != 0 && !(timeSinceFootstep < 0.15f))
			{
				timeSinceFootstep = 0f;
				AudioClip val = stompClips[Random.Range(0, stompClips.Length)];
				bool flag = animRunning;
				stepSourceIndex = 1 - stepSourceIndex;
				AudioSource val2 = stepSources[stepSourceIndex];
				val2.Stop();
				val2.clip = val;
				val2.volume = (flag ? 0.7f : 0.55f);
				val2.pitch = Random.Range(0.9f, 1.05f);
				val2.Play();
				WalkieTalkie.TransmitOneShotAudio(val2, val, 0.55f);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, flag ? 25f : 18f, 0.6f, 0, false, 5465);
				float num = Quake(flag ? 1f : 0.7f);
				if (Plugin.BoundConfig.FootstepScreenShake.Value && flag && num < 6f)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
				}
			}
		}

		[ClientRpc]
		public void GrowlClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3119525548u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 3119525548u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					base.creatureVoice.PlayOneShot(growlClip, 1f);
				}
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (base.isEnemyDead)
			{
				return;
			}
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			base.enemyHP -= force;
			base.creatureVoice.PlayOneShot(growlClip, 0.8f);
			if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner)
			{
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
			}
			else if (((NetworkBehaviour)this).IsOwner && (Object)(object)playerWhoHit != (Object)null && ((EnemyAI)this).PlayerIsTargetable(playerWhoHit, false, false, true))
			{
				if (base.currentBehaviourStateIndex == 0)
				{
					BeginChase(playerWhoHit);
				}
				else if (base.currentBehaviourStateIndex == 1 && (Object)(object)base.targetPlayer != (Object)(object)playerWhoHit)
				{
					TurnOn(playerWhoHit);
				}
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			//IL_005b: 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)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).KillEnemy(destroy);
			if (!destroy)
			{
				if (specialRoutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(specialRoutine);
					specialRoutine = null;
				}
				ReleaseVictim();
				SetExpression(0f, 0f);
				SetBloodDrip(on: false);
				lineSource.Stop();
				killLinePending = false;
				NavMeshHit val = default(NavMeshHit);
				if (NavMesh.SamplePosition(((Component)this).transform.position, ref val, 4f, -1))
				{
					((Component)this).transform.position = ((NavMeshHit)(ref val)).position;
				}
				base.serverPosition = ((Component)this).transform.position;
				base.creatureAnimator.cullingMode = (AnimatorCullingMode)0;
				((MonoBehaviour)this).StartCoroutine(DeathRoutine());
			}
		}

		private IEnumerator DeathRoutine()
		{
			float t = 0f;
			bool staggered = false;
			bool spoke = false;
			bool swelling = false;
			swellBone = FindBone(((Component)base.creatureAnimator).transform, "Spine02");
			MaterialPropertyBlock block = new MaterialPropertyBlock();
			float phase = 0f;
			AudioClip lastWords = deathLineClips[new Random(StartOfRound.Instance.randomMapSeed + (int)((NetworkBehaviour)this).NetworkObjectId + 7767).Next(deathLineClips.Length)];
			float speakAt = 8f - lastWords.length;
			while (t < 8f)
			{
				t += Time.deltaTime;
				if (!spoke && t >= speakAt)
				{
					spoke = true;
					PlayLine(lastWords);
				}
				if (!staggered && t >= 0.4f)
				{
					staggered = true;
					base.creatureSFX.PlayOneShot(deathThudClip, 0.45f);
					Quake(0.6f);
				}
				if (!swelling && t >= 2f)
				{
					swelling = true;
					base.creatureSFX.PlayOneShot(deathSwellClip, 1f);
				}
				if (swelling)
				{
					float num = Mathf.Clamp01((t - 2f) / 6f);
					upperSwell = 1f + 0.5f * Mathf.Pow(num, 1.6f);
					phase += Time.deltaTime * Mathf.Lerp(0.8f, 6f, num * num) * MathF.PI * 2f;
					float num2 = Mathf.Pow(0.5f + 0.5f * Mathf.Sin(phase), 2f) * (0.3f + 0.7f * num);
					block.SetColor("_EmissiveColor", PulseColor * num2);
					block.SetFloat("_EmissiveExposureWeight", 0f);
					SkinnedMeshRenderer[] skinnedMeshRenderers = base.skinnedMeshRenderers;
					foreach (SkinnedMeshRenderer val in skinnedMeshRenderers)
					{
						((Renderer)val).SetPropertyBlock(block);
					}
				}
				yield return null;
			}
			Burst();
			if (((NetworkBehaviour)this).IsServer)
			{
				yield return (object)new WaitForSeconds(3f);
				if ((Object)(object)((NetworkBehaviour)this).NetworkObject != (Object)null && ((NetworkBehaviour)this).NetworkObject.IsSpawned)
				{
					((NetworkBehaviour)this).NetworkObject.Despawn(true);
				}
			}
		}

		private void Burst()
		{
			//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_0025: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: 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)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			lineSource.Stop();
			Vector3 val = holdPoint.parent.position + Vector3.up * 0.5f;
			Renderer[] componentsInChildren = ((Component)base.creatureAnimator).GetComponentsInChildren<Renderer>();
			foreach (Renderer val2 in componentsInChildren)
			{
				val2.enabled = false;
			}
			if ((Object)(object)nukePrefab != (Object)null)
			{
				OmshaqNuke omshaqNuke = OmshaqNuke.Spawn(nukePrefab, val, (int)((NetworkBehaviour)this).NetworkObjectId, base.creatureSFX.outputAudioMixerGroup);
				if (base.skinnedMeshRenderers.Length != 0)
				{
					omshaqNuke.LeaveLegs(base.skinnedMeshRenderers[0], remainsMaterial, ((Component)this).transform.position.y, StartOfRound.Instance.randomMapSeed + (int)((NetworkBehaviour)this).NetworkObjectId * 7919);
				}
			}
			RoundManager.Instance.PlayAudibleNoise(val, 60f, 1f, 0, false, 5468);
			PluginConfig boundConfig = Plugin.BoundConfig;
			float value = boundConfig.BlastKillRadius.Value;
			float num = Mathf.Max(value + 0.1f, boundConfig.BlastDamageRadius.Value);
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController != (Object)null && !localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled)
			{
				Vector3 val3 = ((Component)localPlayerController).transform.position - val;
				float magnitude = ((Vector3)(ref val3)).magnitude;
				val3 = ((magnitude > 0.01f) ? (val3 / magnitude) : Vector3.up);
				Vector3 position = ((Component)localPlayerController.gameplayCamera).transform.position;
				float num2 = Exposure(val, position, ((Component)localPlayerController).transform.position + Vector3.up * 1.1f, ((Component)localPlayerController).transform.position + Vector3.up * 0.2f, ((Component)localPlayerController).transform.position + Vector3.up * 1.1f + ((Component)localPlayerController).transform.right * 0.35f, ((Component)localPlayerController).transform.position + Vector3.up * 1.1f - ((Component)localPlayerController).transform.right * 0.35f);
				float num3 = Shielded(num2);
				if (magnitude < value && num2 >= 0.5f)
				{
					localPlayerController.KillPlayer(val3 * 35f + Vector3.up * 12f, true, (CauseOfDeath)3, 0, default(Vector3), false);
				}
				else if (magnitude < num)
				{
					float num4 = ((magnitude < value) ? 0f : ((magnitude - value) / (num - value)));
					float num5 = ((magnitude < value) ? 100f : Mathf.Lerp((float)boundConfig.BlastMaxDamage.Value, 5f, num4));
					int num6 = Mathf.Max(1, Mathf.RoundToInt(num5 * num3));
					localPlayerController.DamagePlayer(num6, true, true, (CauseOfDeath)3, 0, false, val3 * 20f * (1f - num4) * num3);
					localPlayerController.externalForceAutoFade += (val3 + Vector3.up * 0.3f) * 18f * (1f - num4) * num3;
				}
				if (!localPlayerController.isPlayerDead)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)((magnitude < num) ? 3 : ((magnitude < num * 2f) ? 1 : 2)));
					if (localPlayerController.isInsideFactory)
					{
						OmshaqCamera.AddTremor(Mathf.Clamp(1.6f - magnitude / 40f, 0.25f, 1.6f));
					}
				}
			}
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			EnemyAI[] array = RoundManager.Instance.SpawnedEnemies.ToArray();
			foreach (EnemyAI val4 in array)
			{
				if (!((Object)(object)val4 == (Object)null) && !((Object)(object)val4 == (Object)(object)this) && !val4.isEnemyDead)
				{
					float num7 = Vector3.Distance(((Component)val4).transform.position, val);
					if (!(num7 >= num))
					{
						float num8 = Exposure(val, ((Component)val4).transform.position + Vector3.up * 0.5f, ((Component)val4).transform.position + Vector3.up * 1.5f);
						int num9 = ((num7 < value && num8 >= 0.5f) ? 20 : Mathf.Max(1, Mathf.RoundToInt(((num7 < value) ? 20f : 3f) * Shielded(num8))));
						val4.HitEnemyOnLocalClient(num9, ((Component)val4).transform.position - val, (PlayerControllerB)null, false, -1);
					}
				}
			}
		}

		private static Transform? FindBone(Transform root, string name)
		{
			Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (((Object)val).name == name)
				{
					return val;
				}
			}
			return null;
		}

		private static float Exposure(Vector3 center, params Vector3[] points)
		{
			//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_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)
			int num = 0;
			foreach (Vector3 val in points)
			{
				if (!Physics.Linecast(center, val, OmshaqNuke.Solid, (QueryTriggerInteraction)1))
				{
					num++;
				}
			}
			return (float)num / (float)points.Length;
		}

		private static float Shielded(float exposure)
		{
			return exposure + (1f - exposure) * 0.3f;
		}

		private void UpdateOutsideLook()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			lookAroundTimer -= Time.deltaTime;
			bool flag = false;
			if (base.isOutside && (Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.shipInnerRoomBounds != (Object)null)
			{
				Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds;
				((Bounds)(ref bounds)).Expand(5f);
				flag = ((Bounds)(ref bounds)).Contains(((Component)this).transform.position);
				if (!loggedShip)
				{
					Bounds bounds2 = StartOfRound.Instance.shipInnerRoomBounds.bounds;
					if (((Bounds)(ref bounds2)).Contains(((Component)this).transform.position))
					{
						loggedShip = true;
						ManualLogSource logger = Plugin.Logger;
						bounds2 = StartOfRound.Instance.shipInnerRoomBounds.bounds;
						logger.LogInfo((object)$"Omshaq is squeezing into the ship (room {((Bounds)(ref bounds2)).size.y:F1} m tall).");
					}
				}
			}
			if (flag != crouching)
			{
				crouching = flag;
				base.creatureAnimator.SetBool(CrouchingId, crouching);
			}
		}

		private bool TryFollowThroughDoor()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.BoundConfig.FollowOutside.Value || (Object)(object)base.targetPlayer == (Object)null || base.targetPlayer.isPlayerDead || base.targetPlayer.isInsideFactory == base.isOutside || timeSinceSawTarget > 3f)
			{
				return false;
			}
			doorToUse = NearestDoor(lastSeenTargetPosition, 8f);
			return (Object)(object)doorToUse != (Object)null;
		}

		private void UpdateGoingBackIn()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(55f, (int)SpotRange, 3);
			if ((Object)(object)val != (Object)null && ((EnemyAI)this).PlayerIsTargetable(val, false, false, true))
			{
				doorToUse = null;
				BeginChase(val);
				return;
			}
			if ((Object)(object)doorToUse == (Object)null)
			{
				doorToUse = NearestDoor(((Component)this).transform.position, 0f);
			}
			EaseSpeed(1.2f);
			WalkToDoor();
		}

		private EntranceTeleport? NearestDoor(Vector3 near, float radius)
		{
			//IL_0058: 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)
			EntranceTeleport result = null;
			float num = ((radius > 0f) ? radius : float.MaxValue);
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>();
			foreach (EntranceTeleport val in array)
			{
				if (val.isEntranceToBuilding == base.isOutside && !((Object)(object)val.entrancePoint == (Object)null) && (!((Object)(object)val.exitScript == (Object)null) || val.FindExitPoint()))
				{
					float num2 = Vector3.Distance(near, val.entrancePoint.position);
					if (num2 < num)
					{
						result = val;
						num = num2;
					}
				}
			}
			return result;
		}

		private void WalkToDoor()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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)
			if (!((Object)(object)doorToUse == (Object)null))
			{
				Vector3 position = doorToUse.entrancePoint.position;
				((EnemyAI)this).SetDestinationToPosition(position, false);
				if (Vector3.Distance(((Component)this).transform.position, position) < 2f && Time.realtimeSinceStartup - lastDoorTime > 3f)
				{
					Vector3 position2 = doorToUse.exitScript.entrancePoint.position;
					bool outside = !base.isOutside;
					doorToUse = null;
					GoThroughDoor(position2, outside);
					GoThroughDoorServerRpc(position2, outside);
				}
			}
		}

		[ServerRpc]
		public void GoThroughDoorServerRpc(Vector3 to, bool outside)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Invalid comparison between Unknown and I4
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4177582087u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref to);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref outside, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 4177582087u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				GoThroughDoorClientRpc(to, outside);
			}
		}

		[ClientRpc]
		public void GoThroughDoorClientRpc(Vector3 to, bool outside)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2185115904u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref to);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref outside, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2185115904u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (!((NetworkBehaviour)this).IsOwner)
				{
					GoThroughDoor(to, outside);
				}
			}
		}

		private void GoThroughDoor(Vector3 to, bool outside)
		{
			//IL_0010: 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_0019: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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_0165: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			lastDoorTime = Time.realtimeSinceStartup;
			Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(to, default(NavMeshHit), 5f, -1);
			if (((NetworkBehaviour)this).IsOwner)
			{
				((Behaviour)base.agent).enabled = false;
				((Component)this).transform.position = navMeshPosition;
				((Behaviour)base.agent).enabled = true;
			}
			else
			{
				((Component)this).transform.position = navMeshPosition;
			}
			base.serverPosition = navMeshPosition;
			previousPosition = navMeshPosition;
			((EnemyAI)this).SetEnemyOutside(outside);
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>();
			foreach (EntranceTeleport val in array)
			{
				if (val.isEntranceToBuilding == outside && (Object)(object)val.entrancePoint != (Object)null && (Object)(object)val.entrancePointAudio != (Object)null && val.doorAudios != null && val.doorAudios.Length != 0 && Vector3.Distance(val.entrancePoint.position, to) < 3f)
				{
					val.entrancePointAudio.PlayOneShot(val.doorAudios[Random.Range(0, val.doorAudios.Length)]);
				}
			}
			if (outside)
			{
				lookAroundTimer = 1.6f;
				base.creatureAnimator.SetTrigger(LookAroundId);
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (base.currentBehaviourStateIndex == 1 && (Object)(object)base.targetPlayer != (Object)null)
				{
					timeSinceSawTarget = 0f;
					lastSeenTargetPosition = ((Component)base.targetPlayer).transform.position;
				}
				else if (!outside)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1625548173u, new RpcReceiveHandler(__rpc_handler_1625548173), "PlayVoiceLineClientRpc");
			((NetworkBehaviour)this).__registerRpc(2471645592u, new RpcReceiveHandler(__rpc_handler_2471645592), "GrabPlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(859241093u, new RpcReceiveHandler(__rpc_handler_859241093), "HugClientRpc");
			((NetworkBehaviour)this).__registerRpc(3300668715u, new RpcReceiveHandler(__rpc_handler_3300668715), "EatClientRpc");
			((NetworkBehaviour)this).__registerRpc(3374203433u, new RpcReceiveHandler(__rpc_handler_3374203433), "JumpSlamClientRpc");
			((NetworkBehaviour)this).__registerRpc(123433061u, new RpcReceiveHandler(__rpc_handler_123433061), "AirGrabClientRpc");
			((NetworkBehaviour)this).__registerRpc(3119525548u, new RpcReceiveHandler(__rpc_handler_3119525548), "GrowlClientRpc");
			((NetworkBehaviour)this).__registerRpc(4177582087u, new RpcReceiveHandler(__rpc_handler_4177582087), "GoThroughDoorServerRpc");
			((NetworkBehaviour)this).__registerRpc(2185115904u, new RpcReceiveHandler(__rpc_handler_2185115904), "GoThroughDoorClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_1625548173(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int line = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref line);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((OmshaqAI)(object)target).PlayVoiceLineClientRpc(line);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2471645592(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((OmshaqAI)(object)target).GrabPlayerServerRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_859241093(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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)
			//IL_004f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				float yRot = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref yRot, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((OmshaqAI)(object)target).HugClientRpc(playerId, position, yRot);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3300668715(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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)
			//IL_004f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				float yRot = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref yRot, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((OmshaqAI)(object)target).EatClientRpc(playerId, position, yRot);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3374203433(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				Vector3 start = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref start);
				Vector3 land = default(Vector3);
				((FastBufferRea