Decompiled source of JPOGRaptor v1.0.4

plugins/JPOGRaptor/JPOGRaptor.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using JPOGRaptor.Configuration;
using JPOGRaptor.NetcodePatcher;
using JPOGRaptor.src;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JPOGRaptor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4+af76621c8e1d804ed31bb81ddd42fed3c3124051")]
[assembly: AssemblyProduct("JPOGRaptor")]
[assembly: AssemblyTitle("JPOGRaptor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JPOGRaptor
{
	internal class JPOGRaptorAI : EnemyAI
	{
		public enum State
		{
			SearchingForPlayer,
			StalkingPlayer,
			ChasingPlayer,
			RespondingToCall,
			AttackingPlayer
		}

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

			private object <>2__current;

			public bool shortBark;

			public JPOGRaptorAI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Expected O, but got Unknown
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Expected O, but got Unknown
				//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;
				JPOGRaptorAI jPOGRaptorAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (shortBark)
					{
						if (jPOGRaptorAI.respondingToHelpCall)
						{
							<>2__current = (object)new WaitForSeconds(0.5f);
							<>1__state = 1;
							return true;
						}
						goto IL_005d;
					}
					jPOGRaptorAI.DoAnimationClientRpc("shortBark");
					<>2__current = (object)new WaitForSeconds(1.3f);
					<>1__state = 3;
					return true;
				case 1:
					<>1__state = -1;
					goto IL_005d;
				case 2:
					<>1__state = -1;
					jPOGRaptorAI.inCallAnimation = false;
					break;
				case 3:
					{
						<>1__state = -1;
						break;
					}
					IL_005d:
					jPOGRaptorAI.DoAnimationClientRpc("barkCall");
					<>2__current = (object)new WaitForSeconds(3f);
					<>1__state = 2;
					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 <ReachtToHelp>d__68 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public JPOGRaptorAI <>4__this;

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

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

			[DebuggerHidden]
			public <ReachtToHelp>d__68(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;
				JPOGRaptorAI jPOGRaptorAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((EnemyAI)jPOGRaptorAI).SwitchToBehaviourServerRpc(3);
					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 static List<JPOGRaptorAI> AllRaptors = new List<JPOGRaptorAI>();

		public Transform turnCompass;

		public Transform attackArea;

		public AudioSource RaptorcallVoice;

		public AudioSource RaptorStepsSFX;

		public Transform MouthBone;

		private State? previousState;

		private float timeSinceHittingLocalPlayer;

		private float timeSinceHittingOtherEnemy;

		private bool isDeadAnimationDone;

		private bool inCallAnimation;

		private bool isClimbing;

		public NetworkVariable<float> CurrentSpeed = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1);

		private RaptorPounceHelper raptorPounceHelper;

		private RaptorTargetingHelper raptorTargetingHelper;

		public readonly float pouncePredictionTime = 1.5f;

		private bool respondingToHelpCall;

		private float lastHeardCallDistanceWhenHeard;

		private Vector3 noisePositionGuess;

		private float noiseApproximation = 14f;

		private bool wasOnOffMeshLink;

		public DeadBodyInfo? CarryingKilledPlayerBody { get; private set; }

		public int raptorId { get; private set; }

		public RoundManager roundManager { get; private set; }

		public Vector3 pounceDirection { get; private set; }

		public Vector3 TargetPlayerlastPosition { get; private set; }

		public Vector3 TargetPlayerVelocity { get; private set; }

		public string itemNameToDrop { get; private set; } = "Fancy lamp";


		public int numberOfItemsToDrop { get; private set; } = 1;


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

		public override void Start()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			assignImportantValues();
			timeSinceHittingLocalPlayer = 0f;
			timeSinceHittingOtherEnemy = 0f;
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
		}

		private void assignImportantValues()
		{
			AllRaptors.Add(this);
			raptorId = AllRaptors.Count - 1;
			roundManager = Object.FindObjectOfType<RoundManager>() ?? throw new Exception("JPOGRaptor: RoundManager not found!");
			raptorPounceHelper = new RaptorPounceHelper(this);
			raptorTargetingHelper = new RaptorTargetingHelper(this);
		}

		public override void Update()
		{
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				if (!isDeadAnimationDone)
				{
					isDeadAnimationDone = true;
					base.creatureVoice.Stop();
					base.creatureVoice.PlayOneShot(base.dieSFX);
					DoAnimationClientRpc("stopBreath");
				}
				return;
			}
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			CheckIfClimbing();
			if (((NetworkBehaviour)this).IsOwner && !raptorPounceHelper.IsPouncing && !isClimbing)
			{
				NetworkVariable<float> currentSpeed = CurrentSpeed;
				Vector3 velocity = base.agent.velocity;
				currentSpeed.Value = ((Vector3)(ref velocity)).magnitude;
			}
			base.creatureAnimator.SetFloat("moveSpeed", CurrentSpeed.Value);
			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);
			}
			raptorPounceHelper.MoveRaptorDuringPounce(base.targetPlayer);
			if (base.stunNormalizedTimer > 0f)
			{
				base.agent.speed = 0f;
			}
			timeSinceHittingLocalPlayer += Time.deltaTime;
			timeSinceHittingOtherEnemy += Time.deltaTime;
			raptorPounceHelper.UpdateTimeSincePounceAttack();
			if (base.agent.speed < 0.1f && (Object)(object)base.targetPlayer != (Object)null)
			{
				_ = base.currentBehaviourStateIndex;
				_ = 4;
			}
		}

		private void DropLoot()
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			Item val = null;
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				if (items.itemName == itemNameToDrop)
				{
					val = items;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				Plugin.Logger.LogError((object)$"JPOGRaptor[{raptorId}]: Item to drop '{itemNameToDrop}' not found in allItemsList!");
				return;
			}
			GrabbableObject val4 = default(GrabbableObject);
			for (int i = 0; i < numberOfItemsToDrop; i++)
			{
				Vector3 val2 = ((Component)this).transform.position + Random.insideUnitSphere * 1f;
				val2.y = ((Component)this).transform.position.y + 0.5f;
				GameObject val3 = Object.Instantiate<GameObject>(val.spawnPrefab, val2, Quaternion.identity);
				if (val3.TryGetComponent<GrabbableObject>(ref val4))
				{
					val4.fallTime = 0.5f;
					((NetworkBehaviour)val4).NetworkObject.Spawn(true);
					int scrapValue = Random.Range(20, 100);
					val4.scrapValue = scrapValue;
					Plugin.Logger.LogInfo((object)$"JPOGRaptor[{raptorId}]: Dropped '{((Object)val).name}' with NetworkObjectId: {((NetworkBehaviour)val4).NetworkObjectId}");
					Plugin.Logger.LogInfo((object)$"JPOGRaptor[{raptorId}]: Set scrapValue to: {val4.scrapValue}");
					continue;
				}
				Plugin.Logger.LogWarning((object)$"JPOGRaptor[{raptorId}]: Spawned item '{((Object)val).name}' does not have a GrabbableObject component!");
				break;
			}
		}

		public override void DoAIInterval()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: 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)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			raptorTargetingHelper.HandleTargetUnreachability();
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (base.previousBehaviourStateIndex != 0)
				{
					StateSwitchHelper(State.SearchingForPlayer);
					respondingToHelpCall = false;
					base.targetPlayer = null;
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				}
				if (raptorTargetingHelper.FoundClosestPlayerInRange(25f, 5f))
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				break;
			case 1:
				if (base.previousBehaviourStateIndex != 1)
				{
					CallForHelp();
					StateSwitchHelper(State.StalkingPlayer);
					if ((Object)(object)base.targetPlayer != (Object)null)
					{
						((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
					}
					if (!inCallAnimation)
					{
						inCallAnimation = true;
						((MonoBehaviour)this).StartCoroutine(PlayBark(shortBark: true));
					}
				}
				else if (!inCallAnimation)
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
				}
				break;
			case 2:
				if (base.previousBehaviourStateIndex != 2)
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					StateSwitchHelper(State.ChasingPlayer);
				}
				if (!raptorTargetingHelper.EnsureTarget())
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					break;
				}
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				raptorTargetingHelper.UpdatePathTimeout(base.targetPlayer);
				if (!raptorTargetingHelper.CheckIfTargetPlayerIsReachable(base.targetPlayer))
				{
					base.targetPlayer = null;
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					break;
				}
				CheckIfPlayersAreInPounceAreaServerRPC();
				if (raptorPounceHelper.InRangeForPounceAttack)
				{
					((EnemyAI)this).SwitchToBehaviourServerRpc(4);
				}
				else if (raptorTargetingHelper.IsTargetTooFar())
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				break;
			case 3:
				if (base.previousBehaviourStateIndex != 3)
				{
					StateSwitchHelper(State.RespondingToCall);
				}
				if ((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false))
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
					if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 15f)
					{
						respondingToHelpCall = false;
						((EnemyAI)this).SwitchToBehaviourServerRpc(2);
					}
				}
				else
				{
					respondingToHelpCall = false;
					((EnemyAI)this).SwitchToBehaviourServerRpc(0);
				}
				break;
			case 4:
				if (base.previousBehaviourStateIndex != 4)
				{
					StateSwitchHelper(State.AttackingPlayer);
					if (!raptorPounceHelper.IsPouncing)
					{
						raptorPounceHelper.StartPounce();
					}
				}
				else if (raptorPounceHelper.PounceAttackComplete)
				{
					if ((Object)(object)base.targetPlayer != (Object)null)
					{
						base.agent.speed = 8f;
						((EnemyAI)this).SwitchToBehaviourClientRpc(2);
					}
					else
					{
						base.agent.speed = 5f;
						((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					}
				}
				break;
			}
		}

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

		private void StateSwitchHelper(State state)
		{
			if (previousState != state || !previousState.HasValue)
			{
				base.previousBehaviourStateIndex = (int)state;
			}
			SeMovementSpeedPerSate(state);
		}

		private void SeMovementSpeedPerSate(State state)
		{
			switch (state)
			{
			case State.SearchingForPlayer:
				base.agent.speed = 5f;
				break;
			case State.StalkingPlayer:
				base.agent.speed = 3f;
				break;
			case State.ChasingPlayer:
				base.agent.speed = 8f;
				break;
			case State.RespondingToCall:
				base.agent.speed = 10f;
				break;
			case State.AttackingPlayer:
				base.agent.speed = 0f;
				break;
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (!(timeSinceHittingLocalPlayer < 1.5f) && !inCallAnimation && !raptorPounceHelper.IsPouncing)
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null)
				{
					DoAnimationClientRpc("biteAttack");
					timeSinceHittingLocalPlayer = 0f;
					val.DamagePlayer(30, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					SpawnPlayerBloodOnClientRpc(((NetworkBehaviour)val).NetworkObjectId, Vector3.zero);
				}
			}
		}

		public override void OnCollideWithEnemy(Collider other, EnemyAI? collidedEnemy = null)
		{
			if (!(timeSinceHittingOtherEnemy < 5f) && !((Object)(object)collidedEnemy == (Object)null) && !(collidedEnemy is JPOGRaptorAI) && !base.isEnemyDead && !collidedEnemy.isEnemyDead && collidedEnemy.enemyType.canDie)
			{
				((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy);
				DoAnimationClientRpc("biteAttack");
				collidedEnemy.HitEnemy(3, (PlayerControllerB)null, true, -1);
				timeSinceHittingOtherEnemy = 0f;
			}
		}

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

		public void CallForHelp()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			JPOGRaptorAI[] array = Object.FindObjectsOfType<JPOGRaptorAI>();
			for (int i = 0; i < array.Length; i++)
			{
				if ((Object)(object)array[i] != (Object)(object)this && (Object)(object)base.targetPlayer != (Object)null)
				{
					array[i].ReactToHelpCall(base.targetPlayer, ((Component)this).transform.position, urgent: true);
				}
			}
		}

		public void ReactToHelpCall(PlayerControllerB playerToTarget, Vector3 needsHelpRaptorPosition, bool urgent)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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)
			if (!respondingToHelpCall && base.currentBehaviourStateIndex == 0)
			{
				respondingToHelpCall = true;
				inCallAnimation = true;
				if (urgent && (Object)(object)base.targetPlayer != (Object)null)
				{
					((MonoBehaviour)this).StartCoroutine(PlayBark(shortBark: false));
					base.targetPlayer = playerToTarget;
					((MonoBehaviour)this).StartCoroutine(ReachtToHelp());
				}
				else
				{
					((MonoBehaviour)this).StartCoroutine(PlayBark(shortBark: true));
					lastHeardCallDistanceWhenHeard = Vector3.Distance(((Component)this).transform.position, needsHelpRaptorPosition);
					noisePositionGuess = roundManager.GetRandomNavMeshPositionInRadius(needsHelpRaptorPosition, lastHeardCallDistanceWhenHeard / noiseApproximation, default(NavMeshHit));
					((EnemyAI)this).SetDestinationToPosition(noisePositionGuess, false);
				}
			}
		}

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

		public void CheckIfClimbing()
		{
			if (base.agent.isOnOffMeshLink && !wasOnOffMeshLink)
			{
				wasOnOffMeshLink = true;
				isClimbing = true;
				SetAnimationBoolClientRPC("isClimbing", isClimbing);
			}
			else if (!base.agent.isOnOffMeshLink && wasOnOffMeshLink)
			{
				wasOnOffMeshLink = false;
				isClimbing = false;
				SetAnimationBoolClientRPC("isClimbing", isClimbing);
			}
		}

		[ClientRpc]
		public void DoAnimationClientRpc(string animationName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3138070205u, val, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3138070205u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

		[ClientRpc]
		public void SetAnimationWalkingSpeedClientRPC()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3608829678u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3608829678u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Vector3 velocity = base.agent.velocity;
					float magnitude = ((Vector3)(ref velocity)).magnitude;
					base.creatureAnimator.SetFloat("moveSpeed", magnitude, 0.1f, Time.deltaTime);
				}
			}
		}

		[ClientRpc]
		public void SetAnimationBoolClientRPC(string trigger, bool value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1219365971u, val, (RpcDelivery)0);
				bool flag = trigger != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(trigger, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1219365971u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.creatureAnimator.SetBool(trigger, value);
			}
		}

		[ServerRpc]
		public void CheckIfPlayersAreInPounceAreaServerRPC()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(489900578u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 489900578u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				CheckIfPlayersAreInPounceAreaClientRPC();
			}
		}

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

		public void PlayBarkClip(AudioClip audioClip)
		{
			RaptorcallVoice.PlayOneShot(audioClip);
			WalkieTalkie.TransmitOneShotAudio(RaptorcallVoice, audioClip, 1f);
		}

		public void PlayStepClip(AudioClip audioClip)
		{
			RaptorStepsSFX.PlayOneShot(audioClip);
		}

		public void PlayVoiceClip(AudioClip audioClip)
		{
			base.creatureVoice.PlayOneShot(audioClip);
			WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, audioClip, 1f);
		}

		[ServerRpc(RequireOwnership = false)]
		public void TakeBodyInMouthServerRpc(int killPlayerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3217027902u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, killPlayerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3217027902u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					TakeBodyInMouthClientRpc(killPlayerId);
				}
			}
		}

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

		private void TakeBodyInMouth(int playerId)
		{
			DeadBodyInfo deadBody = StartOfRound.Instance.allPlayerScripts[playerId].deadBody;
			if ((Object)(object)deadBody != (Object)null)
			{
				CarryingKilledPlayerBody = deadBody;
				deadBody.canBeGrabbedBackByPlayers = false;
				deadBody.attachedTo = MouthBone;
				deadBody.attachedLimb = deadBody.bodyParts[5];
				deadBody.matchPositionExactly = true;
				deadBody.MakeCorpseBloody();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DropBodyInMouthServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1709379253u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1709379253u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					DropBodyInMouthClientRpc();
				}
			}
		}

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

		private void DropBodyInMouth()
		{
			if ((Object)(object)CarryingKilledPlayerBody != (Object)null)
			{
				CarryingKilledPlayerBody.speedMultiplier = 3f;
				CarryingKilledPlayerBody.canBeGrabbedBackByPlayers = true;
				CarryingKilledPlayerBody.attachedTo = null;
				CarryingKilledPlayerBody.attachedLimb = null;
				CarryingKilledPlayerBody.matchPositionExactly = false;
				CarryingKilledPlayerBody = null;
			}
		}

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

		[ClientRpc]
		public void SpawnPlayerBloodOnClientRpc(ulong playerNetworkObjectId, Vector3 bloodDirection)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2632068254u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerNetworkObjectId);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref bloodDirection);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2632068254u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB val3 = default(PlayerControllerB);
				if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(playerNetworkObjectId, out var value))
				{
					Plugin.Logger.LogWarning((object)$"JPOGRaptor[{raptorId}]: Could not find networked player object with ID {playerNetworkObjectId} to spawn blood.");
				}
				else if (((Component)value).TryGetComponent<PlayerControllerB>(ref val3))
				{
					val3.DropBlood(bloodDirection, true, false);
				}
				else
				{
					Plugin.Logger.LogWarning((object)$"JPOGRaptor[{raptorId}]: Found NetworkObject with ID {playerNetworkObjectId} but no PlayerControllerB component for blood.");
				}
			}
		}

		protected override void __initializeVariables()
		{
			if (CurrentSpeed == null)
			{
				throw new Exception("JPOGRaptorAI.CurrentSpeed cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)CurrentSpeed).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)CurrentSpeed, "CurrentSpeed");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)CurrentSpeed);
			((EnemyAI)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_JPOGRaptorAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3138070205u, new RpcReceiveHandler(__rpc_handler_3138070205));
			NetworkManager.__rpc_func_table.Add(3608829678u, new RpcReceiveHandler(__rpc_handler_3608829678));
			NetworkManager.__rpc_func_table.Add(1219365971u, new RpcReceiveHandler(__rpc_handler_1219365971));
			NetworkManager.__rpc_func_table.Add(489900578u, new RpcReceiveHandler(__rpc_handler_489900578));
			NetworkManager.__rpc_func_table.Add(3018007498u, new RpcReceiveHandler(__rpc_handler_3018007498));
			NetworkManager.__rpc_func_table.Add(3217027902u, new RpcReceiveHandler(__rpc_handler_3217027902));
			NetworkManager.__rpc_func_table.Add(2831086148u, new RpcReceiveHandler(__rpc_handler_2831086148));
			NetworkManager.__rpc_func_table.Add(1709379253u, new RpcReceiveHandler(__rpc_handler_1709379253));
			NetworkManager.__rpc_func_table.Add(1690123830u, new RpcReceiveHandler(__rpc_handler_1690123830));
			NetworkManager.__rpc_func_table.Add(3223072178u, new RpcReceiveHandler(__rpc_handler_3223072178));
			NetworkManager.__rpc_func_table.Add(2632068254u, new RpcReceiveHandler(__rpc_handler_2632068254));
		}

		private static void __rpc_handler_3138070205(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string animationName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JPOGRaptorAI)(object)target).DoAnimationClientRpc(animationName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3608829678(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JPOGRaptorAI)(object)target).SetAnimationWalkingSpeedClientRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1219365971(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string trigger = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref trigger, false);
				}
				bool value = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JPOGRaptorAI)(object)target).SetAnimationBoolClientRPC(trigger, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_3018007498(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JPOGRaptorAI)(object)target).CheckIfPlayersAreInPounceAreaClientRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		private static void __rpc_handler_1709379253(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((JPOGRaptorAI)(object)target).DropBodyInMouthServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1690123830(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JPOGRaptorAI)(object)target).DropBodyInMouthClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3223072178(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JPOGRaptorAI)(object)target).CheckRaptorPounceHitBoxesClientRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2632068254(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong playerNetworkObjectId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerNetworkObjectId);
				Vector3 bloodDirection = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref bloodDirection);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JPOGRaptorAI)(object)target).SpawnPlayerBloodOnClientRpc(playerNetworkObjectId, bloodDirection);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "JPOGRaptorAI";
		}
	}
	[BepInPlugin("JPOGRaptor", "JPOGRaptor", "1.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static AssetBundle? ModAssets;

		internal static PluginConfig BoundConfig { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
			InitializeNetworkBehaviours();
			string path = "jpograptorassets";
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
			if ((Object)(object)ModAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			EnemyType val = ModAssets.LoadAsset<EnemyType>("JPOGRaptor");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("JPOGRaptorTN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("JPOGRaptorTK");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), val2, val3);
			Logger.LogInfo((object)"Plugin JPOGRaptor is loaded!");
		}

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

		public const string PLUGIN_NAME = "JPOGRaptor";

		public const string PLUGIN_VERSION = "1.0.4";
	}
}
namespace JPOGRaptor.src
{
	internal class RaptorPounceHelper
	{
		[CompilerGenerated]
		private sealed class <pounceRoutine>d__44 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RaptorPounceHelper <>4__this;

			private float <timer>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Expected O, but got Unknown
				int num = <>1__state;
				RaptorPounceHelper raptorPounceHelper = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					raptorPounceHelper.IsPouncing = true;
					raptorPounceHelper.PounceAttackDamage = true;
					raptorPounceHelper.PounceAttackComplete = false;
					raptorPounceHelper.TimeSincePounceAttack = Time.deltaTime;
					Vector3 val = (((Object)(object)((EnemyAI)raptorPounceHelper.jpogRaptorAI).targetPlayer != (Object)null) ? (((Component)((EnemyAI)raptorPounceHelper.jpogRaptorAI).targetPlayer).transform.position + raptorPounceHelper.pounceTargetPlayerVelocity * raptorPounceHelper.pouncePredictionTime) : (((Component)raptorPounceHelper.jpogRaptorAI).transform.forward * 5f));
					Vector3 val2 = val - ((Component)raptorPounceHelper.jpogRaptorAI).transform.position;
					raptorPounceHelper.pounceDirection = ((Vector3)(ref val2)).normalized;
					raptorPounceHelper.jpogRaptorAI.DoAnimationClientRpc("pounceAttack");
					<>2__current = (object)new WaitForSeconds(raptorPounceHelper.pounceDamagePeriod);
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					raptorPounceHelper.PounceAttackDamage = false;
					<timer>5__2 = 0f;
					break;
				case 2:
					<>1__state = -1;
					break;
				}
				if (<timer>5__2 < raptorPounceHelper.totalPounceTime - raptorPounceHelper.pounceDamagePeriod && ((EnemyAI)raptorPounceHelper.jpogRaptorAI).currentBehaviourStateIndex == 4)
				{
					<timer>5__2 += Time.deltaTime;
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				if (((EnemyAI)raptorPounceHelper.jpogRaptorAI).currentBehaviourStateIndex != 4)
				{
					raptorPounceHelper.ResetPounceFlags();
					return false;
				}
				raptorPounceHelper.jpogRaptorAI.DropBodyInMouthServerRpc();
				raptorPounceHelper.ResetPounceFlags();
				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 Coroutine? pounceCoroutine;

		private readonly JPOGRaptorAI jpogRaptorAI;

		private readonly float totalPounceTime = 4.5f;

		private readonly float pounceDamagePeriod = 2.5f;

		private readonly int raptorId;

		private Vector3 pounceDirection;

		private Vector3 pounceTargetPlayerVelocity;

		private Vector3 pounceTargetPlayerlastPosition;

		private readonly float pouncePredictionTime = 1.5f;

		public bool IsPouncing { get; private set; }

		public bool PounceAttackDamage { get; private set; }

		public float TimeSincePounceAttack { get; private set; } = 10f;


		public bool PounceAttackComplete { get; private set; }

		public float PounceTimer { get; private set; }

		public float PounceDuration { get; private set; } = 1f;


		public float PounceSpeed { get; private set; } = 15f;


		public bool InRangeForPounceAttack { get; private set; }

		public RaptorPounceHelper(JPOGRaptorAI jPOGRaptorAI)
		{
			jpogRaptorAI = jPOGRaptorAI;
			raptorId = jPOGRaptorAI.raptorId;
		}

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

		public void StartPounce()
		{
			if (!IsPouncing)
			{
				pounceCoroutine = ((MonoBehaviour)jpogRaptorAI).StartCoroutine(pounceRoutine());
			}
		}

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

		private void ResetPounceFlags()
		{
			IsPouncing = false;
			PounceAttackDamage = false;
			PounceAttackComplete = true;
			PounceTimer = 0f;
			TimeSincePounceAttack = 0f;
			InRangeForPounceAttack = false;
		}

		public void CancelPounce()
		{
			if (pounceCoroutine != null)
			{
				((MonoBehaviour)jpogRaptorAI).StopCoroutine(pounceCoroutine);
				pounceCoroutine = null;
			}
			IsPouncing = false;
		}

		private void PounceTargetting(PlayerControllerB? targetPlayer)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)targetPlayer == (Object)null))
			{
				pounceTargetPlayerVelocity = (((Component)targetPlayer).transform.position - pounceTargetPlayerlastPosition) / Time.deltaTime;
				pounceTargetPlayerlastPosition = ((Component)targetPlayer).transform.position;
			}
		}

		private void UpdatePounceTimer()
		{
			PounceTimer += Time.deltaTime;
		}

		public void UpdateTimeSincePounceAttack()
		{
			if (!IsPouncing)
			{
				TimeSincePounceAttack += Time.deltaTime;
			}
		}

		public void MoveRaptorDuringPounce(PlayerControllerB? targetPlayer)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)targetPlayer == (Object)null) && IsPouncing)
			{
				jpogRaptorAI.turnCompass.LookAt(((Component)targetPlayer.gameplayCamera).transform.position);
				PounceTargetting(targetPlayer);
				if (PounceAttackDamage)
				{
					jpogRaptorAI.CheckRaptorPounceHitBoxesClientRPC();
				}
				UpdatePounceTimer();
				if (PounceTimer < PounceDuration)
				{
					Transform transform = ((Component)jpogRaptorAI).transform;
					transform.position += pounceDirection * PounceSpeed * Time.deltaTime;
				}
			}
		}

		public void CheckIfPlayersAreInRangeForPounceAttack()
		{
			//IL_001e: 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)
			if ((Object)(object)((EnemyAI)jpogRaptorAI).targetPlayer != (Object)null)
			{
				float num = Vector3.Distance(((Component)jpogRaptorAI).transform.position, ((Component)((EnemyAI)jpogRaptorAI).targetPlayer).transform.position);
				if (num < 10f && HasClearLineToPlayer() && TimeSincePounceAttack >= 10f)
				{
					InRangeForPounceAttack = true;
				}
			}
			else
			{
				InRangeForPounceAttack = false;
			}
		}

		private bool HasClearLineToPlayer()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB targetPlayer = ((EnemyAI)jpogRaptorAI).targetPlayer;
			if ((Object)(object)targetPlayer == (Object)null)
			{
				return false;
			}
			Vector3 val = ((Component)jpogRaptorAI).transform.position + Vector3.up * 1f;
			Vector3 val2 = ((Component)targetPlayer).transform.position + Vector3.up * 1f;
			RaycastHit val3 = default(RaycastHit);
			bool flag = Physics.Linecast(val, val2, ref val3);
			if (flag && ((Component)((RaycastHit)(ref val3)).collider).transform.IsChildOf(((Component)jpogRaptorAI).transform))
			{
				flag = false;
			}
			return !flag;
		}

		public void CheckRaptorPounceHitBoxes()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			int num = 8;
			Collider[] array = Physics.OverlapBox(jpogRaptorAI.attackArea.position, jpogRaptorAI.attackArea.localScale, Quaternion.identity, num);
			if (array.Length == 0)
			{
				return;
			}
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				PlayerControllerB val2 = ((EnemyAI)jpogRaptorAI).MeetsStandardPlayerCollisionConditions(val, false, false);
				if ((Object)(object)val2 != (Object)null)
				{
					int num2 = ((!(Random.value < 0.9f)) ? 9 : 0);
					if ((Object)(object)jpogRaptorAI.CarryingKilledPlayerBody == (Object)null)
					{
						int killPlayerId = (int)val2.playerClientId;
						val2.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, num2, default(Vector3));
						jpogRaptorAI.TakeBodyInMouthServerRpc(killPlayerId);
					}
					else
					{
						val2.DamagePlayer(40, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					}
				}
			}
		}
	}
	internal class RaptorTargetingHelper
	{
		private readonly JPOGRaptorAI jPOGRaptorAI;

		private readonly int raptorId;

		private float lastTimeoutUpdate;

		public float MaxChaseDistance { get; private set; } = 30f;


		public float TimeWithoutPath { get; private set; }

		public float MaxUnreachableTime { get; private set; } = 7f;


		public RaptorTargetingHelper(JPOGRaptorAI jPOGRaptorAI)
		{
			this.jPOGRaptorAI = jPOGRaptorAI;
			raptorId = jPOGRaptorAI.raptorId;
		}

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

		public bool FoundClosestPlayerInRange(float range, float senseRange)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			TargetClosestPlayer(requireLOS: true);
			if ((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer == (Object)null)
			{
				TargetClosestPlayer(requireLOS: false);
				range = senseRange;
			}
			if ((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer != (Object)null)
			{
				return Vector3.Distance(((Component)jPOGRaptorAI).transform.position, ((Component)((EnemyAI)jPOGRaptorAI).targetPlayer).transform.position) < range;
			}
			return false;
		}

		public bool TargetClosestPlayer(bool requireLOS)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			float num = float.MaxValue;
			PlayerControllerB val = null;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val2 in allPlayerScripts)
			{
				if (!((Object)(object)val2 == (Object)null))
				{
					float num2 = Vector3.Distance(((Component)jPOGRaptorAI).transform.position, ((Component)val2).transform.position);
					if (!(num2 >= num) && (!requireLOS || ((EnemyAI)jPOGRaptorAI).CheckLineOfSightForPosition(((Component)val2).transform.position, 45f, 60, -1f, (Transform)null)) && (CheckIfTargetCanBeReachedInsideShip(val2) || CheckTargetPathReachability(val2)))
					{
						val = val2;
						num = num2;
					}
				}
			}
			((EnemyAI)jPOGRaptorAI).targetPlayer = val;
			if ((Object)(object)val != (Object)null)
			{
				((EnemyAI)jPOGRaptorAI).targetPlayer = val;
			}
			return (Object)(object)val != (Object)null;
		}

		public bool CheckIfTargetPlayerIsReachable(PlayerControllerB playerToCheck)
		{
			bool flag = CheckTargetPathReachability(playerToCheck);
			bool flag2 = HasTimedOutUnreachable();
			if (!flag && flag2)
			{
				TimeWithoutPath = 0f;
				return false;
			}
			return true;
		}

		public bool CheckTargetPathReachability(PlayerControllerB playerToCheck)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			NavMeshPath val = new NavMeshPath();
			bool flag = NavMesh.CalculatePath(((Component)((EnemyAI)jPOGRaptorAI).agent).transform.position, ((Component)playerToCheck).transform.position, -1, val) && (int)val.status == 0;
			bool flag2 = CheckIfTargetCanBeReachedInsideShip(playerToCheck);
			return flag && flag2;
		}

		public void UpdatePathTimeout(PlayerControllerB player)
		{
			if (CheckTargetPathReachability(player))
			{
				TimeWithoutPath = 0f;
				lastTimeoutUpdate = Time.time;
			}
			else if (Time.time - lastTimeoutUpdate >= 1f)
			{
				TimeWithoutPath += 1f;
				lastTimeoutUpdate = Time.time;
			}
		}

		private bool CheckIfTargetCanBeReachedInsideShip(PlayerControllerB playerToCheck)
		{
			if ((Object)(object)playerToCheck == (Object)null)
			{
				return false;
			}
			if (!playerToCheck.isInHangarShipRoom)
			{
				return true;
			}
			if (!StartOfRound.Instance.hangarDoorsClosed)
			{
				return true;
			}
			if (((EnemyAI)jPOGRaptorAI).isInsidePlayerShip)
			{
				return true;
			}
			return false;
		}

		public bool HasTimedOutUnreachable()
		{
			return TimeWithoutPath >= MaxUnreachableTime;
		}

		public bool PlayerHasHorizontalLOS(PlayerControllerB player)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)jPOGRaptorAI).transform.position - ((Component)player).transform.position;
			val.y = 0f;
			return Vector3.Angle(((Component)player).transform.forward, val) < 68f;
		}

		public bool IsTargetTooFar()
		{
			//IL_001e: 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)
			if ((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer != (Object)null)
			{
				return Vector3.Distance(((Component)jPOGRaptorAI).transform.position, ((Component)((EnemyAI)jPOGRaptorAI).targetPlayer).transform.position) > MaxChaseDistance;
			}
			return false;
		}

		public bool EnsureTarget()
		{
			if ((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer == (Object)null)
			{
				TargetClosestPlayer(requireLOS: false);
			}
			return (Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer != (Object)null;
		}

		public void TargetPlayerWhoHit(PlayerControllerB playerWhoHit)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (!((EnemyAI)jPOGRaptorAI).isEnemyDead && (Object)(object)playerWhoHit != (Object)null)
			{
				((EnemyAI)jPOGRaptorAI).targetPlayer = playerWhoHit;
				if (((EnemyAI)jPOGRaptorAI).currentBehaviourStateIndex == 0)
				{
					((EnemyAI)jPOGRaptorAI).SwitchToBehaviourServerRpc(2);
				}
				else if (((EnemyAI)jPOGRaptorAI).currentBehaviourStateIndex == 2)
				{
					((EnemyAI)jPOGRaptorAI).SetDestinationToPosition(((Component)((EnemyAI)jPOGRaptorAI).targetPlayer).transform.position, false);
				}
			}
		}

		public void HandleTargetUnreachability()
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer == (Object)null) && ((EnemyAI)jPOGRaptorAI).currentBehaviourStateIndex == 2 && (IsTargetTooFar() || !((EnemyAI)jPOGRaptorAI).targetPlayer.isPlayerControlled || !CheckIfTargetCanBeReachedInsideShip(((EnemyAI)jPOGRaptorAI).targetPlayer)))
			{
				PlayerControllerB targetPlayer = ((EnemyAI)jPOGRaptorAI).targetPlayer;
				((EnemyAI)jPOGRaptorAI).targetPlayer = null;
				TargetClosestPlayer(requireLOS: true);
				if ((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer == (Object)null)
				{
					TargetClosestPlayer(requireLOS: false);
				}
				if ((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer == (Object)null)
				{
					((EnemyAI)jPOGRaptorAI).SwitchToBehaviourServerRpc(0);
				}
				else
				{
					((EnemyAI)jPOGRaptorAI).SetDestinationToPosition(((Component)((EnemyAI)jPOGRaptorAI).targetPlayer).transform.position, false);
				}
			}
		}
	}
}
namespace JPOGRaptor.Configuration
{
	public class PluginConfig
	{
		public ConfigEntry<int> SpawnWeight;

		public PluginConfig(ConfigFile cfg)
		{
			SpawnWeight = cfg.Bind<int>("General", "Spawn weight", 20, "The spawn chance weight for JPOGRaptor, relative to other existing enemies.\nGoes up from 0, lower is more rare, 100 and up is very common.");
			ClearUnusedEntries(cfg);
		}

		private void ClearUnusedEntries(ConfigFile cfg)
		{
			PropertyInfo property = ((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(cfg, null);
			dictionary.Clear();
			cfg.Save();
		}
	}
}
namespace JPOGRaptor.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}