Decompiled source of Surfaced v1.6.1

plugins/LC-Surfaced/Surfaced.dll

Decompiled 3 weeks ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 Dawn;
using Dawn.Utils;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On;
using On.GameNetcodeStuff;
using SolidLib.Components;
using SolidLib.Components.Sound;
using Surfaced;
using Surfaced.Configuration;
using Surfaced.Patches;
using Unity.Mathematics;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;

[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("Surfaced")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Adds Aquatic themed content.")]
[assembly: AssemblyFileVersion("1.6.1.0")]
[assembly: AssemblyInformationalVersion("1.6.1+1a9c515dba7577f12e192538425458b030253778")]
[assembly: AssemblyProduct("Surfaced")]
[assembly: AssemblyTitle("Surfaced")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.6.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class Bertha : NetworkBehaviour, IHittable
{
	[CompilerGenerated]
	private sealed class <DetonateDelay>d__18 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Bertha <>4__this;

		public PlayerControllerB playerWhoCollided;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			int num = <>1__state;
			Bertha bertha = <>4__this;
			switch (num)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(Plugin.BoundConfig.BerthaTimer.Value);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				bertha.Detonate(playerWhoCollided);
				bertha.BoomLight.SetActive(true);
				<>2__current = (object)new WaitForSeconds(0.1f);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				((Component)((Component)((Component)bertha).transform.parent).transform.Find("BigBertha")).gameObject.SetActive(false);
				<>2__current = (object)new WaitForSeconds(0.2f);
				<>1__state = 3;
				return true;
			case 3:
			{
				<>1__state = -1;
				bertha.BoomLight.SetActive(false);
				Collider[] componentsInChildren = ((Component)bertha).GetComponentsInChildren<Collider>();
				foreach (Collider val in componentsInChildren)
				{
					val.enabled = false;
				}
				<>2__current = (object)new WaitForSeconds(10f);
				<>1__state = 4;
				return true;
			}
			case 4:
				<>1__state = -1;
				if (((NetworkBehaviour)bertha).IsServer)
				{
					((NetworkBehaviour)bertha).NetworkObject.Despawn(true);
				}
				return false;
			}
		}

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

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

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

		private object <>2__current;

		public Bertha <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			int num = <>1__state;
			Bertha bertha = <>4__this;
			if (num != 0)
			{
				if (num != 1)
				{
					return false;
				}
				<>1__state = -1;
				bertha.PingAudio.PlayOneShot(bertha.mineBeep, 0.1f);
				bertha.mineAudio.pitch = (float)bertha.random.NextDouble() * 0.2f + 0.9f;
			}
			else
			{
				<>1__state = -1;
			}
			<>2__current = (object)new WaitForSeconds((float)bertha.random.Next(20, 40));
			<>1__state = 1;
			return true;
		}

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

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

	public bool hasExploded;

	public GameObject BoomLight;

	public ParticleSystem explosionParticle;

	public AudioSource mineAudio;

	public AudioSource FarAudio;

	public AudioSource PingAudio;

	public AudioClip mineDetonate;

	public AudioClip mineTrigger;

	public AudioClip mineBeep;

	public AudioClip BerthaBoom;

	private Random random;

	private void Start()
	{
		random = new Random(StartOfRound.Instance.randomMapSeed + 23);
		((MonoBehaviour)this).StartCoroutine(StartIdleAnimation());
	}

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

	private void OnTriggerEnter(Collider other)
	{
		if (hasExploded)
		{
			return;
		}
		if (((Component)other).CompareTag("Player"))
		{
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if ((Object)(object)component != (Object)null && !component.isPlayerDead && (Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				TriggerMineOnLocalClientByExiting(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, component));
			}
		}
		else if ((((Component)other).tag.StartsWith("PlayerRagdoll") || ((Component)other).CompareTag("PhysicsProp")) && !((Object)(object)((Component)other).GetComponent<DeadBodyInfo>() == (Object)null) && !((Object)(object)((Component)other).GetComponent<DeadBodyInfo>().playerScript != (Object)(object)GameNetworkManager.Instance.localPlayerController) && !((Object)(object)((Component)other).GetComponent<GrabbableObject>() == (Object)null) && ((NetworkBehaviour)((Component)other).GetComponent<GrabbableObject>()).NetworkObject.IsOwner)
		{
			TriggerMineOnLocalClientByExiting(-1);
		}
	}

	private void TriggerMineOnLocalClientByExiting(int playerIndex)
	{
		if (!hasExploded)
		{
			hasExploded = true;
			ExplodeMineServerRpc(playerIndex);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void ExplodeMineServerRpc(int playerIndex)
	{
		ExplodeMineClientRpc(playerIndex);
	}

	[ClientRpc]
	public void ExplodeMineClientRpc(int playerIndex)
	{
		hasExploded = true;
		SetOffMineAnimation((playerIndex <= -1) ? null : StartOfRound.Instance.allPlayerScripts[playerIndex]);
	}

	public void SetOffMineAnimation(PlayerControllerB playerWhoCollided = null)
	{
		mineAudio.PlayOneShot(mineTrigger, 1f);
		HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
		((MonoBehaviour)this).StartCoroutine(DetonateDelay(playerWhoCollided));
	}

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

	public void Detonate(PlayerControllerB playerWhoCollided = null)
	{
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		mineAudio.pitch = (float)random.NextDouble() * 0.14f + 0.93f;
		mineAudio.PlayOneShot(mineDetonate, 2f);
		FarAudio.PlayOneShot(BerthaBoom, 1f);
		HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
		CreateExplosion(((Component)this).transform.position + Vector3.up, 33, 6, (CauseOfDeath)3, playerWhoCollided);
	}

	public void CreateExplosion(Vector3 explosionPosition, int damage = 20, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null)
	{
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0333: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: 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_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0399: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: 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_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		float value = Plugin.BoundConfig.Range1.Value;
		float value2 = Plugin.BoundConfig.Range2.Value;
		float value3 = Plugin.BoundConfig.Range3.Value;
		int num = 0;
		explosionParticle.Play();
		num = ((!Plugin.BoundConfig.KillEnemies.Value) ? StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers : (StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers | LayerMask.GetMask(new string[1] { "Enemies" })));
		Collider[] array = Physics.OverlapSphere(explosionPosition, value3, num, (QueryTriggerInteraction)2);
		List<PlayerControllerB> list = new List<PlayerControllerB>();
		Collider[] array2 = array;
		foreach (Collider val in array2)
		{
			float num2 = Vector3.Distance(explosionPosition, ((Component)val).transform.position);
			Vector3 val2;
			if (((Component)val).gameObject.layer == 3)
			{
				PlayerControllerB component = ((Component)val).GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					list.Add(component);
					val2 = ((Component)component).transform.position - ((Component)this).transform.position;
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					if (num2 <= value)
					{
						normalized *= 500f;
						component.DamagePlayer(999, true, true, causeOfDeath, 6, false, normalized);
						HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
						continue;
					}
					if (num2 <= value2 && MineHasLineOfSight(((Component)component.gameplayCamera).transform.position))
					{
						HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
						normalized *= 400f;
						component.DamagePlayer(999, true, true, causeOfDeath, 6, false, normalized);
						continue;
					}
					if (num2 <= value3 && MineHasLineOfSight(((Component)component.gameplayCamera).transform.position))
					{
						normalized *= (float)Plugin.BoundConfig.Knockbackmultiplier.Value;
						HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
						float num3 = 1f - Mathf.Clamp01(num2 / value3);
						component.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 6, false, normalized);
						if (!component.isPlayerDead)
						{
							component.externalForces += normalized;
						}
						continue;
					}
				}
			}
			if (((Component)val).gameObject.layer == 19)
			{
				EnemyAICollisionDetect componentInChildren = ((Component)val).GetComponentInChildren<EnemyAICollisionDetect>();
				if ((Object)(object)componentInChildren != (Object)null && ((NetworkBehaviour)componentInChildren.mainScript).IsOwner && num2 <= value2 && MineHasLineOfSight(((Component)val).transform.position))
				{
					EnemyAI mainScript = componentInChildren.mainScript;
					val2 = default(Vector3);
					mainScript.HitEnemyOnLocalClient(enemyHitForce, val2, attacker, false, -1);
				}
			}
			else if (((Component)val).gameObject.layer == 21)
			{
				Landmine componentInChildren2 = ((Component)val).GetComponentInChildren<Landmine>();
				if ((Object)(object)componentInChildren2 != (Object)null && !componentInChildren2.hasExploded && num2 <= value3 && MineHasLineOfSight(((Component)val).transform.position))
				{
					((MonoBehaviour)componentInChildren2).StartCoroutine(componentInChildren2.TriggerOtherMineDelayed(componentInChildren2));
				}
			}
		}
		Seamine[] array3 = Object.FindObjectsByType<Seamine>((FindObjectsSortMode)1);
		Seamine[] array4 = array3;
		foreach (Seamine seamine in array4)
		{
			float num4 = Vector3.Distance(explosionPosition, ((Component)seamine).transform.position);
			if (!seamine.hasExploded && num4 <= value2)
			{
				seamine.SetOffMineAnimation();
			}
		}
		Collider[] array5 = Physics.OverlapSphere(explosionPosition, value3, StartOfRound.Instance.collidersAndRoomMaskAndDefault);
		Collider[] array6 = array5;
		foreach (Collider val3 in array6)
		{
			Rigidbody component2 = ((Component)val3).GetComponent<Rigidbody>();
			if (component2 != null)
			{
				component2.AddExplosionForce(1000f, explosionPosition, value3);
			}
		}
	}

	public bool MineHasLineOfSight(Vector3 pos)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit val = default(RaycastHit);
		return !Physics.Linecast(((Component)this).transform.position, pos, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1);
	}

	bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
	{
		if ((Object)(object)playerWhoHit != (Object)(object)GameNetworkManager.Instance.localPlayerController)
		{
			return false;
		}
		ExplodeMineServerRpc(((Object)(object)playerWhoHit != (Object)null) ? Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerWhoHit) : (-1));
		return true;
	}
}
public class Seamine : NetworkBehaviour, IHittable
{
	[CompilerGenerated]
	private sealed class <DetonateDelay>d__18 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Seamine <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			int num = <>1__state;
			Seamine seamine = <>4__this;
			switch (num)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(0.5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				seamine.Detonate();
				<>2__current = (object)new WaitForSeconds(0.1f);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				if (((NetworkBehaviour)seamine).IsServer)
				{
					Object.Destroy((Object)(object)((Component)((Component)seamine).transform.parent).gameObject);
				}
				return false;
			}
		}

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

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

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

		private object <>2__current;

		public Seamine <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			int num = <>1__state;
			Seamine seamine = <>4__this;
			if (num != 0)
			{
				if (num != 1)
				{
					return false;
				}
				<>1__state = -1;
				seamine.mineAudio.PlayOneShot(seamine.mineBeep, 0.1f);
				seamine.mineAudio.pitch = Random.Range(0.9f, 1.1f);
			}
			else
			{
				<>1__state = -1;
			}
			<>2__current = (object)new WaitForSeconds((float)Random.Range(Plugin.BoundConfig.SeamineSoundMin.Value, Plugin.BoundConfig.SeamineSoundMax.Value));
			<>1__state = 1;
			return true;
		}

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

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

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

		private object <>2__current;

		public Landmine mine;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (!mine.hasExploded)
				{
					mine.mineAudio.pitch = Random.Range(0.75f, 1.07f);
					mine.hasExploded = true;
					<>2__current = (object)new WaitForSeconds(0.2f);
					<>1__state = 1;
					return true;
				}
				break;
			case 1:
				<>1__state = -1;
				mine.SetOffMineAnimation();
				break;
			}
			return false;
		}

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

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

	private bool mineActivated = true;

	public bool hasExploded;

	public ParticleSystem explosionParticle;

	public AudioSource mineAudio;

	public AudioSource mineFarAudio;

	public AudioClip mineDetonate;

	public AudioClip mineTrigger;

	public AudioClip mineBeep;

	public AudioClip mineDetonateFar;

	private bool sendingExplosionRPC;

	private RaycastHit hit;

	private void Start()
	{
		((MonoBehaviour)this).StartCoroutine(StartIdleAnimation());
	}

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

	private void OnTriggerEnter(Collider other)
	{
		if (hasExploded || !mineActivated)
		{
			return;
		}
		if (((Component)other).CompareTag("Player"))
		{
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if ((Object)(object)component != (Object)null && !component.isPlayerDead && !((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController))
			{
				TriggerMineOnLocalClientByExiting();
			}
		}
		else
		{
			if (!((Component)other).tag.StartsWith("PlayerRagdoll") && !((Component)other).CompareTag("PhysicsProp"))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<DeadBodyInfo>()))
			{
				if ((Object)(object)((Component)other).GetComponent<DeadBodyInfo>().playerScript != (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					return;
				}
			}
			else if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<GrabbableObject>()) && !((NetworkBehaviour)((Component)other).GetComponent<GrabbableObject>()).NetworkObject.IsOwner)
			{
				return;
			}
			TriggerMineOnLocalClientByExiting();
		}
	}

	private void TriggerMineOnLocalClientByExiting()
	{
		if (!hasExploded)
		{
			SetOffMineAnimation();
			sendingExplosionRPC = true;
			ExplodeMineServerRpc();
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void ExplodeMineServerRpc()
	{
		ExplodeMineClientRpc();
	}

	[ClientRpc]
	public void ExplodeMineClientRpc()
	{
		if (sendingExplosionRPC)
		{
			sendingExplosionRPC = false;
		}
		else
		{
			SetOffMineAnimation();
		}
	}

	public void SetOffMineAnimation()
	{
		hasExploded = true;
		mineAudio.PlayOneShot(mineTrigger, 1f);
		((MonoBehaviour)this).StartCoroutine(DetonateDelay());
	}

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

	[IteratorStateMachine(typeof(<TriggerOtherMineDelayed>d__19))]
	private IEnumerator TriggerOtherMineDelayed(Landmine mine)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <TriggerOtherMineDelayed>d__19(0)
		{
			mine = mine
		};
	}

	public void Detonate()
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		mineAudio.pitch = Random.Range(0.93f, 1.07f);
		mineAudio.PlayOneShot(mineDetonate, 1f);
		CreateExplosion(((Component)this).transform.position + Vector3.up, spawnExplosionEffect: true, 100, 5.7f, 6f, 6, (CauseOfDeath)3);
	}

	public void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, int damage = 20, float minDamageRange = 0f, float maxDamageRange = 1f, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null)
	{
		//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_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0338: 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_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: 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)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: 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_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: 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)
		Transform val = null;
		if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null)
		{
			val = RoundManager.Instance.mapPropsContainer.transform;
		}
		if (spawnExplosionEffect)
		{
			Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true);
		}
		float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition);
		if (num < 14f)
		{
			HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
		}
		else if (num < 25f)
		{
			HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
		}
		Collider[] array = Physics.OverlapSphere(explosionPosition, maxDamageRange, 2621448, (QueryTriggerInteraction)2);
		PlayerControllerB val2 = null;
		for (int i = 0; i < array.Length; i++)
		{
			float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position);
			if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1))
			{
				continue;
			}
			Vector3 val3;
			if (((Component)array[i]).gameObject.layer == 3)
			{
				val2 = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner)
				{
					float num3 = 1f - Mathf.Clamp01((num2 - minDamageRange) / (maxDamageRange - minDamageRange));
					val3 = ((Component)val2).transform.position - ((Component)this).transform.position;
					Vector3 normalized = ((Vector3)(ref val3)).normalized;
					((Component)val2).GetComponent<Rigidbody>().AddForce(normalized * 500f);
					Vector3 val4 = Vector3.Normalize((((Component)val2).transform.position + Vector3.up * 0.75f - ((Component)this).transform.position) * 100f) * 30f;
					val2.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 0, false, val4);
				}
			}
			else if (((Component)array[i]).gameObject.layer == 21)
			{
				Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>();
				if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f)
				{
					((MonoBehaviour)componentInChildren).StartCoroutine(componentInChildren.TriggerOtherMineDelayed(componentInChildren));
				}
			}
			else if (((Component)array[i]).gameObject.layer == 19)
			{
				EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>();
				if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f)
				{
					EnemyAI mainScript = componentInChildren2.mainScript;
					val3 = default(Vector3);
					mainScript.HitEnemyOnLocalClient(enemyHitForce, val3, attacker, false, -1);
				}
			}
		}
		int num4 = ~LayerMask.GetMask(new string[1] { "Room" });
		num4 = ~LayerMask.GetMask(new string[1] { "Colliders" });
		array = Physics.OverlapSphere(explosionPosition, 10f, num4);
		for (int j = 0; j < array.Length; j++)
		{
			Rigidbody component = ((Component)array[j]).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				component.AddExplosionForce(70f, explosionPosition, 10f);
			}
		}
	}

	public bool MineHasLineOfSight(Vector3 pos)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		return !Physics.Linecast(((Component)this).transform.position, pos, ref hit, 256);
	}

	bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
	{
		SetOffMineAnimation();
		sendingExplosionRPC = true;
		ExplodeMineServerRpc();
		return true;
	}
}
namespace Scary
{
	internal class ScaryAI : EnemyAI
	{
		private enum State
		{
			MovingToPlayer,
			Teleporting
		}

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

			private object <>2__current;

			public ScaryAI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Expected O, but got Unknown
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: 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_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_011e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Expected O, but got Unknown
				int num = <>1__state;
				ScaryAI scaryAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if ((Object)(object)((EnemyAI)scaryAI).targetPlayer != (Object)null)
					{
						Vector3 val = Vector3.Normalize(((Component)((EnemyAI)scaryAI).targetPlayer.gameplayCamera).transform.position - ((Component)scaryAI).transform.position);
						float num2 = Vector3.Distance(((Component)((EnemyAI)scaryAI).targetPlayer).transform.position, ((Component)scaryAI).transform.position);
						if (num2 < 5f && Vector3.Dot(val, ((Component)((EnemyAI)scaryAI).targetPlayer.gameplayCamera).transform.forward) < -0.9f)
						{
							scaryAI.inactivityTimer = 0f;
							Plugin.Logger.LogInfo((object)"JUMPSCARE");
							scaryAI.jumpscaring = true;
							((EnemyAI)scaryAI).creatureSFX.volume = 0.4f;
							((EnemyAI)scaryAI).creatureSFX.pitch = 1f;
							((EnemyAI)scaryAI).creatureSFX.maxDistance = 25f;
							scaryAI.NetworkAudioSource.PlayOneShot(scaryAI.ScareSoundClip);
							<>2__current = (object)new WaitForSeconds(5f);
							<>1__state = 1;
							return true;
						}
					}
					break;
				case 1:
					<>1__state = -1;
					((EnemyAI)scaryAI).creatureSFX.volume = 0.4f;
					((EnemyAI)scaryAI).creatureSFX.pitch = 1f;
					((EnemyAI)scaryAI).creatureSFX.maxDistance = 25f;
					scaryAI.NetworkAudioSource.PlayOneShot(scaryAI.PoofSoundClip);
					scaryAI.EmitPSClientRpc();
					<>2__current = (object)new WaitForSeconds(0.35f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					((EnemyAI)scaryAI).SwitchToBehaviourClientRpc(1);
					scaryAI.jumpscaring = false;
					break;
				}
				scaryAI.PerformTeleportCoroutine = null;
				return false;
			}

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

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

		public Transform turnCompass;

		private float timeSinceHittingLocalPlayer;

		private float timeSinceLastProximitySound;

		private Random enemyRandom;

		private Coroutine? PerformTeleportCoroutine;

		private NavMeshAgent agent;

		public AudioClip PoofSoundClip;

		public AudioClip ScareSoundClip;

		public NetworkAudioSource NetworkAudioSource;

		public ParticleSystem Poofps;

		private bool jumpscaring;

		private Vector3 lastPosition;

		private float inactivityTimer;

		[Header("SoundSets")]
		[SerializeField]
		private SoundSet LureSoundSet;

		private UniqueRandomizer LureRandomizer;

		[SerializeField]
		private Transform movementSource;

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

		public override void Start()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			((EnemyAI)this).Start();
			Plugin.Logger.LogInfo((object)"IMPENDING DOOM APPROACHES...");
			LureRandomizer = new UniqueRandomizer(LureSoundSet);
			timeSinceHittingLocalPlayer = 0f;
			timeSinceLastProximitySound = 0f;
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			base.currentBehaviourStateIndex = 0;
			agent = ((Component)this).GetComponent<NavMeshAgent>();
		}

		public void PlayLureSound()
		{
			int nextStableRandomIndex = LureRandomizer.GetNextStableRandomIndex();
			base.creatureSFX.volume = 0.6f;
			base.creatureSFX.pitch = 1f;
			base.creatureSFX.maxDistance = 25f;
			NetworkAudioSource.PlayOneShot(LureSoundSet.GetAudioClip(nextStableRandomIndex));
		}

		public override void Update()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			timeSinceHittingLocalPlayer += Time.deltaTime;
			if (!jumpscaring)
			{
				timeSinceLastProximitySound += Time.deltaTime;
			}
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex == 0)
			{
				turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime);
			}
			if (((NetworkBehaviour)this).IsHost && (Object)(object)base.targetPlayer != (Object)null)
			{
				float num = Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position);
				if (num > 5f && !jumpscaring)
				{
					CheckInactivity();
				}
			}
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead)
			{
				switch (base.currentBehaviourStateIndex)
				{
				case 0:
					agent.speed = (jumpscaring ? 0f : 9f);
					MoveToClosestPlayer();
					break;
				case 1:
					agent.speed = 0f;
					TeleportToRandomNode();
					break;
				}
			}
		}

		private void MoveToClosestPlayer()
		{
			//IL_009c: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			if (TargetClosestPlayerInAnyCase() && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 3f)
			{
				if (timeSinceLastProximitySound >= (float)enemyRandom.Next(Plugin.BoundConfig.ScarySoundMin.Value, Plugin.BoundConfig.ScarySoundMax.Value))
				{
					PlayLureSound();
					timeSinceLastProximitySound = 0f;
				}
				if (PerformTeleportCoroutine == null)
				{
					PerformTeleportCoroutine = ((MonoBehaviour)this).StartCoroutine(PerformTeleportIfFacingPlayer());
				}
			}
			else
			{
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
			}
		}

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

		private void TeleportToRandomNode()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			Vector3 randomAINodePosition = GetRandomAINodePosition();
			if (randomAINodePosition != Vector3.zero)
			{
				agent.Warp(randomAINodePosition);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
			else
			{
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
		}

		private Vector3 GetRandomAINodePosition()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] insideAINodes = RoundManager.Instance.insideAINodes;
			List<Vector3> list = new List<Vector3>();
			GameObject[] array = insideAINodes;
			foreach (GameObject val in array)
			{
				list.Add(val.transform.position);
			}
			if (list.Count == 0)
			{
				return Vector3.zero;
			}
			Vector3 val2 = list[Random.Range(0, list.Count)];
			return RoundManager.Instance.GetRandomNavMeshPositionInRadius(val2, 3f, default(NavMeshHit));
		}

		private void CheckInactivity()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if (Vector3.Distance(((Component)this).transform.position, lastPosition) < 0.01f)
			{
				inactivityTimer += Time.deltaTime;
				if (inactivityTimer >= 3f)
				{
					TeleportToRandomNode();
					inactivityTimer = 0f;
				}
			}
			else
			{
				inactivityTimer = 0f;
				lastPosition = ((Component)this).transform.position;
			}
		}

		private bool TargetClosestPlayerInAnyCase()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			base.mostOptimalDistance = 2000f;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
				if (base.tempDist < base.mostOptimalDistance)
				{
					base.mostOptimalDistance = base.tempDist;
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
				}
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		[ClientRpc]
		public void EmitPSClientRpc()
		{
			Poofps.Play();
		}
	}
}
namespace Surfaced
{
	public class SurfacedHandler : ContentHandler<SurfacedHandler>
	{
		public class BellCrabAssets : AssetBundleLoader<BellCrabAssets>
		{
			public BellCrabAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class BigBerthaAssets : AssetBundleLoader<BigBerthaAssets>
		{
			public BigBerthaAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class BruceAssets : AssetBundleLoader<BruceAssets>
		{
			public BruceAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class HorseAssets : AssetBundleLoader<HorseAssets>
		{
			public HorseAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class NemoAssets : AssetBundleLoader<NemoAssets>
		{
			public NemoAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class RodrigoAssets : AssetBundleLoader<RodrigoAssets>
		{
			public RodrigoAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class ScaryAssets : AssetBundleLoader<ScaryAssets>
		{
			public ScaryAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class SeamineAssets : AssetBundleLoader<SeamineAssets>
		{
			public SeamineAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class ShrimpAssets : AssetBundleLoader<ShrimpAssets>
		{
			public ShrimpAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class UrchinAssets : AssetBundleLoader<UrchinAssets>
		{
			public UrchinAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public BigBerthaAssets? BigBertha;

		public BruceAssets? Bruce;

		public HorseAssets? Horse;

		public NemoAssets? Nemo;

		public RodrigoAssets? Rodrigo;

		public ScaryAssets? Scary;

		public SeamineAssets? Seamine;

		public ShrimpAssets? Shrimp;

		public UrchinAssets? Urchin;

		public BellCrabAssets? BellCrab;

		public SurfacedHandler(DuskMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<BellCrabAssets>("bellcrabassets", ref BellCrab, false);
			((ContentHandler)this).RegisterContent<BigBerthaAssets>("berthaassets", ref BigBertha, false);
			((ContentHandler)this).RegisterContent<BruceAssets>("bruceassets", ref Bruce, false);
			((ContentHandler)this).RegisterContent<HorseAssets>("horseassets", ref Horse, false);
			((ContentHandler)this).RegisterContent<NemoAssets>("nemoassets", ref Nemo, false);
			((ContentHandler)this).RegisterContent<RodrigoAssets>("rodrigoassets", ref Rodrigo, false);
			((ContentHandler)this).RegisterContent<ScaryAssets>("scaryassets", ref Scary, false);
			((ContentHandler)this).RegisterContent<SeamineAssets>("seamineassets", ref Seamine, false);
			((ContentHandler)this).RegisterContent<ShrimpAssets>("shrimpassets", ref Shrimp, false);
			((ContentHandler)this).RegisterContent<UrchinAssets>("urchinassets", ref Urchin, false);
		}
	}
	internal class BellCrabAI : EnemyAI
	{
		private enum State
		{
			Idle,
			Running,
			Grabbed,
			Death
		}

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

			private object <>2__current;

			public BellCrabAI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Expected O, but got Unknown
				int num = <>1__state;
				BellCrabAI bellCrabAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					if (((EnemyAI)bellCrabAI).currentBehaviourStateIndex == 0)
					{
						((EnemyAI)bellCrabAI).creatureAnimator.SetTrigger("Peak");
					}
					break;
				}
				if (!((EnemyAI)bellCrabAI).isEnemyDead)
				{
					<>2__current = (object)new WaitForSeconds((float)bellCrabAI.BellCrabRandom.NextDouble() * 10f + 10f);
					<>1__state = 1;
					return true;
				}
				return false;
			}

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

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

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

			private object <>2__current;

			public NavMeshAgent agent;

			public LineRenderer line;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (!((Behaviour)agent).enabled)
					{
						return false;
					}
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					line.SetPosition(0, ((Component)agent).transform.position);
					line.positionCount = agent.path.corners.Length;
					for (int i = 1; i < agent.path.corners.Length; i++)
					{
						line.SetPosition(i, agent.path.corners[i]);
					}
					return false;
				}
				}
			}

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

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

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

			private object <>2__current;

			public int playerID;

			public BellCrabAI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				int num = <>1__state;
				BellCrabAI bellCrabAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.2f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerID];
					bellCrabAI.DropCrabOnLocalClient(player);
					return false;
				}
				}
			}

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

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

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

			private object <>2__current;

			public BellCrabAI <>4__this;

			public int playerID;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				int num = <>1__state;
				BellCrabAI bellCrabAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.12f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					if (bellCrabAI.recentlyDamaged)
					{
						return false;
					}
					PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
					if ((Object)(object)bellCrabAI.playerHoldingCrab != (Object)null)
					{
						bellCrabAI.playerHoldingCrab.twoHanded = false;
						bellCrabAI.playerHoldingCrab = null;
						bellCrabAI.playerHoldingCrab.isHoldingObject = false;
					}
					if ((Object)(object)val != (Object)null)
					{
						val.inAnimationWithEnemy = (EnemyAI)(object)bellCrabAI;
						bellCrabAI.isAttached = true;
						((Behaviour)((EnemyAI)bellCrabAI).agent).enabled = false;
						((EnemyAI)bellCrabAI).agent.speed = 0f;
						bellCrabAI.Interact_Script.interactable = false;
						bellCrabAI.SetScanNodeType(EnemyNodeType);
						HUDManager.Instance.AttemptScanNewCreature(bellCrabAI.creatureID);
						bellCrabAI.playerHoldingCrab = val;
						bellCrabAI.playerHoldingCrab.twoHanded = true;
						bellCrabAI.playerHoldingCrab.isGrabbingObjectAnimation = true;
						bellCrabAI.playerHoldingCrab.isHoldingObject = true;
						bellCrabAI.playerHoldingCrab.hoveringOverTrigger = null;
						bellCrabAI.playerHoldingCrab.DropAllHeldItems(true, false);
						((EnemyAI)bellCrabAI).SwitchToBehaviourStateOnLocalClient(2);
						((EnemyAI)bellCrabAI).creatureAnimator.SetInteger("State", 2);
						bellCrabAI.PlayGrabbedSFX();
					}
					return false;
				}
				}
			}

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

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

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

			private object <>2__current;

			public BellCrabAI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				int num = <>1__state;
				BellCrabAI bellCrabAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					bellCrabAI.recentlyDamaged = true;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					bellCrabAI.recentlyDamaged = false;
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public BellCrabAI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				int num = <>1__state;
				BellCrabAI CS$<>8__locals0 = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => ((EnemyAI)CS$<>8__locals0).currentBehaviourStateIndex == 0));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((EnemyAI)CS$<>8__locals0).creatureSFX.Stop();
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public BellCrabAI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				int num = <>1__state;
				BellCrabAI bellCrabAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.8f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((NetworkBehaviour)bellCrabAI).NetworkObject.Despawn(true);
					return false;
				}
			}

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

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

		public InteractTrigger Interact_Script;

		[NonSerialized]
		public bool isAttached;

		[NonSerialized]
		public PlayerControllerB? playerHoldingCrab;

		public float BellCrabRunSpeed = 18f;

		private Random BellCrabRandom;

		private Random ScanNodeRandom;

		public AudioClip DeathSoundClip;

		public AudioClip BellLandSoundClip;

		public AudioClip[] SnipSoundClips;

		public AudioClip ScuttleSoundClip;

		public AudioClip PopInSoundClip;

		public AudioClip PopOutSoundClip;

		public AudioClip GrabbedSoundClip;

		public AudioClip PickupSoundClip;

		public ScanNodeProperties ScanNode;

		public NetworkTransform NetTransform;

		private Coroutine? recentlyDamagedCoroutine;

		private bool recentlyDamaged;

		private bool testBuild;

		private LineRenderer line;

		private int creatureID;

		private static int EnemyNodeType = 1;

		private static int ScrapNodeType = 2;

		public override void Start()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			creatureID = ScanNode.creatureScanID;
			ScanNode.creatureScanID = -1;
			isAttached = false;
			((Behaviour)base.agent).enabled = true;
			FindNextWanderPoint();
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1);
			base.creatureAnimator.SetInteger("State", 1);
			((Component)this).transform.localScale = new Vector3(1f, 1f, 1f);
			((UnityEvent<PlayerControllerB>)(object)Interact_Script.onInteract).AddListener((UnityAction<PlayerControllerB>)TriggerInteract);
			base.agent.speed = BellCrabRunSpeed;
			base.agent.acceleration = 100f;
			BellCrabRandom = new Random(StartOfRound.Instance.randomMapSeed);
			ScanNodeRandom = new Random(StartOfRound.Instance.randomMapSeed);
			((MonoBehaviour)this).StartCoroutine(DoPeakingCoroutine());
			SetScanNodeType(ScrapNodeType);
			Interact_Script.hoverTip = "Grab : [E]";
			if (testBuild)
			{
				line = ((Component)this).gameObject.AddComponent<LineRenderer>();
				line.widthMultiplier = 0.2f;
			}
		}

		public void SetScanNodeType(int type)
		{
			ScanNode.nodeType = type;
			if (type == ScrapNodeType)
			{
				ScanNode.headerText = "Brass bell";
				ScanNode.scrapValue = ScanNodeRandom.Next((int)(120f * RoundManager.Instance.scrapValueMultiplier), (int)(200f * RoundManager.Instance.scrapValueMultiplier));
				ScanNode.subText = "Value: " + ScanNode.scrapValue;
			}
			else
			{
				ScanNode.headerText = "Bell Crab";
				ScanNode.subText = "";
			}
		}

		private void FindNextWanderPoint()
		{
			//IL_0012: 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)
			//IL_0024: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			for (int i = 0; i < 4; i++)
			{
				flag = ((EnemyAI)this).SetDestinationToPosition(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 30f, default(NavMeshHit)), true);
				if (flag)
				{
					break;
				}
			}
			if (!flag)
			{
				((EnemyAI)this).SetDestinationToPosition(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 30f, default(NavMeshHit)), false);
			}
		}

		public void TriggerInteract(PlayerControllerB player)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (base.currentBehaviourStateIndex == 0 && Physics.Raycast(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, player.grabDistance, player.interactableObjectsMask))
			{
				player.SetHoverTipAndCurrentInteractTrigger();
				Interact_Script.interactable = false;
				Interact_Script.hasTriggered = true;
				if (!isAttached && (Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					PickupCrabServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PickupCrabServerRpc(int playerID)
		{
			PickupCrabClientRpc(playerID);
		}

		[ClientRpc]
		public void PickupCrabClientRpc(int playerID)
		{
			((MonoBehaviour)this).StartCoroutine(PickupCrabDelay(playerID));
		}

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

		[ServerRpc(RequireOwnership = false)]
		public void DropCrabServerRpc(int playerID)
		{
			DropCrabClientRpc(playerID);
			FindNextWanderPoint();
		}

		[ClientRpc]
		public void DropCrabClientRpc(int playerID)
		{
			StartOfRound.Instance.allPlayerScripts[playerID].inAnimationWithEnemy = null;
			((MonoBehaviour)this).StartCoroutine(DropCrabDelay(playerID));
		}

		public void DropCrabOnLocalClient(PlayerControllerB? player = null)
		{
			if ((Object)(object)player == (Object)null)
			{
				player = playerHoldingCrab;
			}
			if (isAttached || (Object)(object)player != (Object)null)
			{
				PlayDropBellSFX();
			}
			if ((Object)(object)player != (Object)null)
			{
				player.SetHoverTipAndCurrentInteractTrigger();
			}
			isAttached = false;
			((Behaviour)base.agent).enabled = true;
			base.agent.speed = BellCrabRunSpeed;
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player)
			{
				HUDManager.Instance.ClearControlTips();
			}
			if ((Object)(object)player != (Object)null)
			{
				player.twoHanded = false;
				player.inAnimationWithEnemy = null;
				player.isHoldingObject = false;
				player.isGrabbingObjectAnimation = false;
			}
			Interact_Script.interactable = false;
			playerHoldingCrab = null;
			if (base.enemyHP > 0)
			{
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1);
				base.creatureAnimator.SetInteger("State", 1);
				return;
			}
			((Behaviour)base.agent).enabled = false;
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3);
			base.creatureAnimator.SetTrigger("Death");
			base.creatureAnimator.SetInteger("State", 3);
		}

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

		public void snipPlayer()
		{
			//IL_002b: 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)
			if ((Object)(object)playerHoldingCrab != (Object)null)
			{
				playerHoldingCrab.DamagePlayer(Plugin.BoundConfig.BellCrabDamageValue.Value, true, true, (CauseOfDeath)17, 0, false, default(Vector3));
				playerHoldingCrab.DropAllHeldItems(true, false);
				PlayCreatureSound(SnipSoundClips[BellCrabRandom.Next(0, SnipSoundClips.Length)]);
			}
		}

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

		public void PlayPopInSFX()
		{
			PlayCreatureSound(PopInSoundClip);
			base.agent.speed = 0f;
			Interact_Script.hasTriggered = false;
			SetScanNodeType(ScrapNodeType);
		}

		public void PlayPopOutSFX()
		{
			PlayCreatureSound(PopOutSoundClip);
			SetScanNodeType(EnemyNodeType);
		}

		public void PlayDeathSFX()
		{
			base.creatureSFX.Stop();
			base.creatureSFX.PlayOneShot(DeathSoundClip);
		}

		public void PlayDropBellSFX()
		{
			base.creatureSFX.PlayOneShot(BellLandSoundClip);
		}

		public void PlayFootstepSFX()
		{
			if ((Object)(object)base.creatureSFX.clip != (Object)(object)ScuttleSoundClip || !base.creatureSFX.isPlaying)
			{
				PlayCreatureSound(ScuttleSoundClip, loop: true);
				((MonoBehaviour)this).StartCoroutine(StopScuttleSound());
			}
		}

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

		public void PlayGrabbedSFX()
		{
			base.creatureSFX.PlayOneShot(PickupSoundClip);
			base.creatureSFX.PlayOneShot(GrabbedSoundClip);
		}

		public void PlayCreatureSound(AudioClip clip, bool loop = false)
		{
			base.creatureSFX.loop = loop;
			base.creatureSFX.clip = clip;
			base.creatureSFX.Play();
		}

		public void spawnCrabScrap()
		{
			if (base.enemyHP <= 0)
			{
				HideEnemyGameObject();
			}
			if (((NetworkBehaviour)this).IsServer && base.enemyHP <= 0)
			{
				((MonoBehaviour)this).StartCoroutine(delayDestroy());
			}
		}

		public void HideEnemyGameObject()
		{
			((Component)((Component)this).transform.Find("BellCrab")).gameObject.SetActive(false);
		}

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

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (base.enemyHP > 1)
			{
				((EnemyAI)this).HitEnemy(force, playerWhoHit, true, hitID);
			}
			else
			{
				((EnemyAI)this).HitEnemy(force, playerWhoHit, false, hitID);
			}
			base.enemyHP -= force;
			Interact_Script.interactable = false;
			if ((Object)(object)playerWhoHit != (Object)null)
			{
				HUDManager.Instance.AttemptScanNewCreature(creatureID);
			}
			if (isAttached && (Object)(object)playerHoldingCrab != (Object)null && ((NetworkBehaviour)this).IsOwner)
			{
				DropCrabClientRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerHoldingCrab));
			}
			if (base.enemyHP > 0)
			{
				if (base.currentBehaviourStateIndex == 0)
				{
					base.creatureAnimator.SetTrigger("PopOut");
				}
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1);
				base.creatureAnimator.SetInteger("State", 1);
				if (recentlyDamagedCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(recentlyDamagedCoroutine);
				}
				recentlyDamagedCoroutine = ((MonoBehaviour)this).StartCoroutine(RecentlyDamagedCooldown());
			}
			else if (base.currentBehaviourStateIndex == 2)
			{
				((MonoBehaviour)this).StartCoroutine(DropCrabDelay(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerHoldingCrab)));
			}
			else
			{
				((Behaviour)base.agent).enabled = false;
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3);
				base.creatureAnimator.SetTrigger("Death");
				base.creatureAnimator.SetInteger("State", 3);
			}
		}

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

		private bool HasReachedDestination()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 velocity = base.agent.velocity;
			if ((double)((Vector3)(ref velocity)).magnitude <= 0.01)
			{
				return true;
			}
			return false;
		}

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

		public void AnimationEventCanRun()
		{
			base.agent.speed = BellCrabRunSpeed;
		}

		public override void Update()
		{
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: 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_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.currentBehaviourStateIndex == 2 && (Object)(object)playerHoldingCrab == (Object)null)
			{
				playerHoldingCrab = (from x in StartOfRound.Instance.allPlayerScripts
					where ((NetworkBehaviour)x).IsSpawned && x.isPlayerControlled && !x.isPlayerDead
					select x into player
					select new
					{
						Player = player,
						Distance = Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position)
					} into x
					orderby x.Distance
					select x).FirstOrDefault().Player;
			}
			else if (base.currentBehaviourStateIndex == 2 && ((Object)(object)playerHoldingCrab.inAnimationWithEnemy != (Object)(object)this || !isAttached))
			{
				playerHoldingCrab.inAnimationWithEnemy = (EnemyAI)(object)this;
				isAttached = true;
			}
			if (base.isEnemyDead)
			{
				return;
			}
			if ((Object)(object)playerHoldingCrab != (Object)null)
			{
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
				base.creatureAnimator.SetInteger("State", 2);
				if (playerHoldingCrab.isPlayerDead && ((NetworkBehaviour)this).IsHost)
				{
					DropCrabServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerHoldingCrab));
				}
			}
			if (!isAttached && base.currentBehaviourStateIndex == 1)
			{
				PlayerControllerB val = FindClosestPlayer(20f);
				if ((Object)(object)val != (Object)null)
				{
					((Component)this).transform.rotation = Quaternion.LookRotation(Vector3.Normalize(((Component)this).transform.position - ((Component)val).transform.position), Vector3.up);
				}
			}
			if ((Object)(object)playerHoldingCrab != (Object)null && isAttached && playerHoldingCrab.health > 0)
			{
				playerHoldingCrab.playerBodyAnimator.SetLayerWeight(playerHoldingCrab.playerBodyAnimator.GetLayerIndex("HoldingItemsBothHands"), 1f);
				((Component)this).transform.position = ((Component)playerHoldingCrab.bodyParts[5]).transform.position;
				Transform transform = ((Component)this).transform;
				transform.position += ((Component)this).transform.forward * 0.7f;
				((Component)this).transform.rotation = ((Component)playerHoldingCrab).transform.rotation;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void HandleGoingFromRunningToIdleServerRpc()
		{
			HandleGoingFromRunningToIdleClientRpc();
		}

		[ClientRpc]
		public void HandleGoingFromRunningToIdleClientRpc()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.rotation = Quaternion.identity;
			base.creatureAnimator.SetTrigger("PopIn");
			Interact_Script.interactable = true;
			Interact_Script.hoverTip = "Grab : [E]";
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0);
			ScanNode.creatureScanID = -1;
			base.creatureAnimator.SetInteger("State", 0);
			FindNextWanderPoint();
		}

		public override void DoAIInterval()
		{
			if (testBuild)
			{
				((MonoBehaviour)this).StartCoroutine(DrawPath(line, base.agent));
			}
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || !((NetworkBehaviour)this).IsHost)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 1:
				if (HasReachedDestination() && !recentlyDamaged)
				{
					HandleGoingFromRunningToIdleServerRpc();
				}
				break;
			case 0:
			case 2:
				break;
			}
		}

		[IteratorStateMachine(typeof(<DrawPath>d__57))]
		public static IEnumerator DrawPath(LineRenderer line, NavMeshAgent agent)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DrawPath>d__57(0)
			{
				line = line,
				agent = agent
			};
		}

		public PlayerControllerB FindClosestPlayer(float maxDistance = 10f)
		{
			//IL_001f: 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)
			PlayerControllerB result = null;
			float num = float.MaxValue;
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
				float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
				if (num2 < num && num2 <= maxDistance)
				{
					num = num2;
					result = val;
				}
			}
			return result;
		}

		[ClientRpc]
		public void DoAnimationClientRpc(string animationName)
		{
			base.creatureAnimator.SetTrigger(animationName);
		}
	}
	public class BruceAI : EnemyAI
	{
		private enum Detection
		{
			None,
			Small,
			Medium,
			BIG
		}

		private enum State
		{
			Roaming,
			Chasing,
			Biting
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass43_0
		{
			public PlayerControllerB killPlayer;

			public float startTime;

			internal bool <KillPlayer>b__0()
			{
				if (!((Object)(object)killPlayer.deadBody != (Object)null))
				{
					return Time.timeSinceLevelLoad - startTime > 2f;
				}
				return true;
			}
		}

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

			private object <>2__current;

			public BruceAI <>4__this;

			private Collider <attackCollider>5__2;

			private float <biteDuration>5__3;

			private float <startTime>5__4;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Expected O, but got Unknown
				//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: Expected O, but got Unknown
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: 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_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				BruceAI bruceAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					<attackCollider>5__2 = ((Component)bruceAI.attackArea).GetComponent<Collider>();
					if ((Object)(object)<attackCollider>5__2 == (Object)null)
					{
						return false;
					}
					int nextStableRandomIndex = bruceAI.biteRandomizer.GetNextStableRandomIndex();
					((EnemyAI)bruceAI).creatureSFX.volume = 1f;
					((EnemyAI)bruceAI).creatureSFX.pitch = 1f;
					((EnemyAI)bruceAI).creatureSFX.maxDistance = 30f;
					bruceAI.NetworkAudioSource.PlayOneShot(bruceAI.biteSet.GetAudioClip(nextStableRandomIndex));
					bruceAI.DoAnimationClientRpc("Bite");
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					<biteDuration>5__3 = 0.4f;
					<startTime>5__4 = Time.time;
					goto IL_01a6;
				case 2:
					<>1__state = -1;
					goto IL_01a6;
				case 3:
					{
						<>1__state = -1;
						if ((Object)(object)((EnemyAI)bruceAI).targetPlayer == (Object)null)
						{
							if (bruceAI.TargetClosestPlayerThatSmells())
							{
								((EnemyAI)bruceAI).SwitchToBehaviourClientRpc(1);
							}
							else
							{
								((EnemyAI)bruceAI).SwitchToBehaviourClientRpc(0);
							}
						}
						else
						{
							((EnemyAI)bruceAI).SwitchToBehaviourClientRpc(1);
						}
						Plugin.Logger.LogInfo((object)"Finish Bite");
						return false;
					}
					IL_01a6:
					if (Time.time - <startTime>5__4 < <biteDuration>5__3)
					{
						if (((EnemyAI)bruceAI).stunNormalizedTimer > 0f)
						{
							return false;
						}
						Bounds bounds = <attackCollider>5__2.bounds;
						Vector3 center = ((Bounds)(ref bounds)).center;
						bounds = <attackCollider>5__2.bounds;
						Collider[] array = Physics.OverlapBox(center, ((Bounds)(ref bounds)).extents, ((Component)<attackCollider>5__2).transform.rotation);
						bool flag = false;
						Collider[] array2 = array;
						foreach (Collider val in array2)
						{
							PlayerControllerB component = ((Component)val).GetComponent<PlayerControllerB>();
							if ((Object)(object)component != (Object)null)
							{
								flag = true;
								component.inAnimationWithEnemy = (EnemyAI)(object)bruceAI;
								bruceAI.KillPlayerServerRpc((int)component.playerClientId);
								((EnemyAI)bruceAI).targetPlayer = null;
								break;
							}
						}
						if (flag)
						{
							return false;
						}
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					<>2__current = (object)new WaitForSeconds(0.8f);
					<>1__state = 3;
					return true;
				}
			}

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

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

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

			private object <>2__current;

			public BruceAI <>4__this;

			public int playerId;

			private <>c__DisplayClass43_0 <>8__1;

			private Quaternion <rotateTo>5__2;

			private Quaternion <rotateFrom>5__3;

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

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

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

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

			private bool MoveNext()
			{
				//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_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d1: 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_01eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_022e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0234: Unknown result type (might be due to invalid IL or missing references)
				//IL_0244: Unknown result type (might be due to invalid IL or missing references)
				//IL_026c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0276: Expected O, but got Unknown
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Expected O, but got Unknown
				//IL_00ec: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				BruceAI bruceAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass43_0();
					if (((NetworkBehaviour)bruceAI).IsOwner)
					{
						((EnemyAI)bruceAI).agent.speed = Mathf.Clamp(((EnemyAI)bruceAI).agent.speed, 12f, 0f);
					}
					((EnemyAI)bruceAI).creatureVoice.pitch = Random.Range(0.96f, 1.04f);
					<>8__1.killPlayer = StartOfRound.Instance.allPlayerScripts[playerId];
					bruceAI.inKillAnimation = true;
					if (!((EnemyAI)bruceAI).isEnemyDead)
					{
						((EnemyAI)bruceAI).creatureAnimator.SetTrigger("FlingKill");
					}
					if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)<>8__1.killPlayer)
					{
						<>8__1.killPlayer.KillPlayer(<>8__1.killPlayer.velocityLastFrame, true, (CauseOfDeath)6, 7, default(Vector3));
					}
					<>8__1.startTime = Time.timeSinceLevelLoad;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)<>8__1.killPlayer.deadBody != (Object)null || Time.timeSinceLevelLoad - <>8__1.startTime > 2f));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((Object)(object)<>8__1.killPlayer.deadBody == (Object)null)
					{
						Plugin.Logger.LogInfo((object)"Bruce: Player body was not spawned or found within 2 seconds.");
						<>8__1.killPlayer.inAnimationWithEnemy = null;
						bruceAI.inKillAnimation = false;
						((EnemyAI)bruceAI).SwitchToBehaviourStateOnLocalClient(0);
						return false;
					}
					bruceAI.TakeBodyInMouth(<>8__1.killPlayer.deadBody);
					<>8__1.startTime = Time.timeSinceLevelLoad;
					<rotateTo>5__2 = Quaternion.Euler(new Vector3(0f, RoundManager.Instance.YRotationThatFacesTheFarthestFromPosition(((Component)bruceAI).transform.position + Vector3.up * 0.6f, 25f, 6), 0f));
					<rotateFrom>5__3 = ((Component)bruceAI).transform.rotation;
					goto IL_024e;
				case 2:
					<>1__state = -1;
					if (((NetworkBehaviour)bruceAI).IsOwner)
					{
						((Component)bruceAI).transform.rotation = Quaternion.RotateTowards(<rotateFrom>5__3, <rotateTo>5__2, 60f * Time.deltaTime);
					}
					goto IL_024e;
				case 3:
					{
						<>1__state = -1;
						bruceAI.DropCarriedBody();
						bruceAI.inKillAnimation = false;
						((EnemyAI)bruceAI).SwitchToBehaviourState(0);
						return false;
					}
					IL_024e:
					if (Time.timeSinceLevelLoad - <>8__1.startTime < 2f)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 3;
					return true;
				}
			}

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

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

		public Transform attackArea;

		private Vector3 StalkPos;

		public Random enemyRandom;

		private bool isDeadAnimationDone;

		[SerializeField]
		private Transform jawTransform;

		private DeadBodyInfo carryingBody;

		private Vector3 wanderTarget;

		private float biteDistance = 9f;

		private float wanderRadius = 25f;

		private Bounds SmellTargetShipBounds;

		private Bounds WanderPaddedShipBounds;

		[SerializeField]
		private AudioSource MovementAudioSource;

		[SerializeField]
		private NetworkAudioSource NetworkAudioSource;

		[SerializeField]
		private Collider bruceSaddleCollider;

		private bool inKillAnimation;

		private float roamingCooldown = 10f;

		private float lastRoamingTime;

		[Header("SoundSets")]
		[SerializeField]
		private SoundSet swimSet;

		[SerializeField]
		private SoundSet biteSet;

		private UniqueRandomizer swimRandomizer;

		private UniqueRandomizer biteRandomizer;

		[SerializeField]
		private Material bruceMaterial;

		[SerializeField]
		private Material blahajMaterial;

		private Coroutine killPlayerCoroutine;

		public override void Start()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			((EnemyAI)this).Start();
			((Renderer)base.skinnedMeshRenderers[0]).material = (Plugin.BoundConfig.BruceBlahaj.Value ? blahajMaterial : bruceMaterial);
			WanderPaddedShipBounds = StartOfRound.Instance.shipBounds.bounds;
			((Bounds)(ref WanderPaddedShipBounds)).Expand(10f);
			SmellTargetShipBounds = StartOfRound.Instance.shipBounds.bounds;
			Vector3 extents = ((Bounds)(ref SmellTargetShipBounds)).extents;
			((Bounds)(ref SmellTargetShipBounds)).extents = new Vector3(extents.x, extents.y + 6f, extents.z);
			Vector3 center = ((Bounds)(ref SmellTargetShipBounds)).center;
			((Bounds)(ref SmellTargetShipBounds)).center = new Vector3(center.x, center.y + 2f, center.z);
			base.agent.areaMask = 877;
			swimRandomizer = new UniqueRandomizer(swimSet);
			biteRandomizer = new UniqueRandomizer(biteSet);
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			isDeadAnimationDone = false;
			base.currentBehaviourStateIndex = 0;
		}

		public void PlaySwimSound()
		{
			int nextStableRandomIndex = swimRandomizer.GetNextStableRandomIndex();
			MovementAudioSource.volume = 0.4f;
			MovementAudioSource.pitch = Random.Range(0.9f, 1.1f);
			MovementAudioSource.maxDistance = 30f;
			MovementAudioSource.PlayOneShot(swimSet.GetAudioClip(nextStableRandomIndex));
			WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, swimSet.GetAudioClip(nextStableRandomIndex), 0.4f);
		}

		public override void AnimationEventA()
		{
			((EnemyAI)this).AnimationEventA();
			PlaySwimSound();
		}

		public override void Update()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			Animator creatureAnimator = base.creatureAnimator;
			Vector3 velocity = base.agent.velocity;
			creatureAnimator.SetFloat("Speed", ((Vector3)(ref velocity)).magnitude);
			if (base.stunNormalizedTimer > 0f)
			{
				base.agent.speed = 0f;
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
		}

		public override void DoAIInterval()
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (!((NetworkBehaviour)this).IsHost || base.isEnemyDead || StartOfRound.Instance.allPlayersDead || base.stunNormalizedTimer > 0f)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
			{
				base.agent.speed = 4f;
				base.agent.angularSpeed = 300f;
				base.agent.acceleration = 6f;
				PickleOnStickItem pickleStick;
				if (TargetClosestPlayerThatSmells())
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				else if (IsThereAPlayerHoldingPickleStick(out pickleStick))
				{
					if (!((Object)(object)pickleStick == (Object)null))
					{
						SetDestinationNotAllowedInShip(RoundManager.Instance.GetNavMeshPosition(pickleStick.pickleTransform.position + Vector3.down, default(NavMeshHit), 5f, -1));
					}
				}
				else if (Time.time - lastRoamingTime > roamingCooldown)
				{
					Wander();
					lastRoamingTime = Time.time;
				}
				break;
			}
			case 1:
				base.agent.speed = 5f;
				base.agent.angularSpeed = 50f;
				base.agent.acceleration = 10f;
				if (!TargetClosestPlayerThatSmells())
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					Wander();
				}
				else
				{
					PositionAroundPlayer();
				}
				break;
			case 2:
				base.agent.speed = 5.3f;
				PositionAroundPlayer();
				break;
			}
		}

		private bool IsThereAPlayerHoldingPickleStick(out PickleOnStickItem pickleStick)
		{
			//IL_0036: 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)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			float num = float.MaxValue;
			PickleOnStickItem pickleOnStickItem = null;
			for (int i = 0; i < allPlayerScripts.Length; i++)
			{
				PickleOnStickItem pickleOnStickItem2 = allPlayerScripts[i].currentlyHeldObjectServer as PickleOnStickItem;
				if (!((Object)(object)pickleOnStickItem2 == (Object)null))
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)allPlayerScripts[i]).transform.position);
					if (num2 < num && num2 < Plugin.BoundConfig.BrucePickleRange.Value)
					{
						num = num2;
						pickleOnStickItem = pickleOnStickItem2;
					}
				}
			}
			pickleStick = pickleOnStickItem;
			return (Object)(object)pickleStick != (Object)null;
		}

		public bool TargetClosestPlayerThatSmells(float bufferDistance = 1.5f)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: 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_00cb: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			base.mostOptimalDistance = 2000f;
			PlayerControllerB targetPlayer = base.targetPlayer;
			base.targetPlayer = null;
			Detection detection = Detection.None;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			NavMeshHit val2 = default(NavMeshHit);
			for (int i = 0; i < allPlayerScripts.Length; i++)
			{
				int health = allPlayerScripts[i].health;
				Detection detectionLevel = GetDetectionLevel(health);
				if (detectionLevel == Detection.None || !((EnemyAI)this).PlayerIsTargetable(allPlayerScripts[i], false, false) || ((Bounds)(ref SmellTargetShipBounds)).Contains(((Component)allPlayerScripts[i]).transform.position))
				{
					continue;
				}
				float detectionRadius = GetDetectionRadius(detectionLevel);
				base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)allPlayerScripts[i]).transform.position);
				if (!(base.tempDist <= detectionRadius) || (detectionLevel <= detection && (detectionLevel != detection || !(base.tempDist < base.mostOptimalDistance))))
				{
					continue;
				}
				NavMeshPath val = new NavMeshPath();
				if (NavMesh.SamplePosition(((Component)allPlayerScripts[i]).transform.position, ref val2, 3.5f, -1))
				{
					base.agent.CalculatePath(((NavMeshHit)(ref val2)).position, val);
					if ((int)val.status == 0)
					{
						base.mostOptimalDistance = base.tempDist;
						base.targetPlayer = allPlayerScripts[i];
						detection = detectionLevel;
					}
				}
			}
			if ((Object)(object)base.targetPlayer != (Object)null && bufferDistance > 0f && (Object)(object)targetPlayer != (Object)null && Mathf.Abs(base.mostOptimalDistance - Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer).transform.position)) < bufferDistance)
			{
				base.targetPlayer = targetPlayer;
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		private Detection GetDetectionLevel(int health)
		{
			if (health <= Plugin.BoundConfig.BruceBigRangeHealthThreshold.Value)
			{
				return Detection.BIG;
			}
			if (health <= Plugin.BoundConfig.BruceMediumRangeHealthThreshold.Value)
			{
				return Detection.Medium;
			}
			if (health <= Plugin.BoundConfig.BruceSmallRangeHealthThreshold.Value)
			{
				return Detection.Small;
			}
			return Detection.None;
		}

		private float GetDetectionRadius(Detection detection)
		{
			return detection switch
			{
				Detection.Small => Plugin.BoundConfig.BruceSmallRange.Value, 
				Detection.Medium => Plugin.BoundConfig.BruceMediumRange.Value, 
				Detection.BIG => Plugin.BoundConfig.BruceBigRange.Value, 
				_ => 0f, 
			};
		}

		private void PositionAroundPlayer()
		{
			//IL_0023: 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)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or