Decompiled source of LC Shrimp v1.0.5

Shrimp.dll

Decompiled 2 months 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.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Shrimp.NetcodePatcher;
using Shrimp.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LcOffice")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LcOffice")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 Shrimp
{
	[BepInPlugin("Piggy.Shrimp", "Shrimp", "1.0.5")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "Piggy.Shrimp";

		private const string modName = "Shrimp";

		private const string modVersion = "1.0.5";

		private readonly Harmony harmony = new Harmony("Piggy.Shrimp");

		private static Plugin Instance;

		public static ManualLogSource mls;

		public static AssetBundle Bundle;

		public static AudioClip[] footsteps;

		public static AudioClip footstep1;

		public static AudioClip footstep2;

		public static AudioClip footstep3;

		public static AudioClip footstep4;

		public static AudioClip dogEatItem;

		public static AudioClip dogEatPlayer;

		public static AudioClip bigGrowl;

		public static AudioClip enragedScream;

		public static AudioClip dogSprint;

		public static AudioClip ripPlayerApart;

		public static AudioClip cry1;

		public static AudioClip dogHowl;

		public static AudioClip stomachGrowl;

		public static AudioClip eatenExplode;

		public static AudioClip dogSneeze;

		public static AudioClip dogSatisfied;

		public static GameObject shrimpPrefab;

		public static EnemyType shrimpEnemy;

		public static GameObject shrimpItemManager;

		public static TerminalNode shrimpTerminalNode;

		public static TerminalKeyword shrimpTerminalKeyword;

		public static string PluginDirectory;

		private ConfigEntry<int> shrimpSpawnWeight;

		public static bool setKorean;

		public static bool debugLog;

		private void Awake()
		{
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			PluginDirectory = ((BaseUnityPlugin)this).Info.Location;
			mls = Logger.CreateLogSource("Piggy.Shrimp");
			try
			{
				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);
						}
					}
				}
			}
			catch (Exception ex)
			{
				mls.LogError((object)ex);
			}
			mls.LogInfo((object)"[Shrimp] Loaded!");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			Bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "shrimp"));
			if ((Object)(object)Bundle == (Object)null)
			{
				mls.LogError((object)"Failed to load Shrimp assets.");
				return;
			}
			shrimpSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "ShrimpSpawnWeight", 5, new ConfigDescription("Sets the shrimp spawn weight for every moons.", (AcceptableValueBase)null, Array.Empty<object>()));
			setKorean = ((BaseUnityPlugin)this).Config.Bind<bool>("Translation", "Enable Korean", false, "Set language to Korean.").Value;
			debugLog = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Enable Debug Log", false, "Outputs logs for debugging purposes").Value;
			shrimpPrefab = Bundle.LoadAsset<GameObject>("Shrimp.prefab");
			shrimpEnemy = Bundle.LoadAsset<EnemyType>("ShrimpEnemy.asset");
			shrimpItemManager = Bundle.LoadAsset<GameObject>("ShrimpItemManager.prefab");
			footstep1 = Bundle.LoadAsset<AudioClip>("Footstep1.ogg");
			footstep2 = Bundle.LoadAsset<AudioClip>("Footstep2.ogg");
			footstep3 = Bundle.LoadAsset<AudioClip>("Footstep3.ogg");
			footstep4 = Bundle.LoadAsset<AudioClip>("Footstep4.ogg");
			List<AudioClip> list = new List<AudioClip>();
			list.Add(footstep1);
			list.Add(footstep2);
			list.Add(footstep3);
			list.Add(footstep4);
			footsteps = list.ToArray();
			dogEatItem = Bundle.LoadAsset<AudioClip>("DogEatObject.ogg");
			dogEatPlayer = Bundle.LoadAsset<AudioClip>("EatPlayer.ogg");
			bigGrowl = Bundle.LoadAsset<AudioClip>("BigGrowl.ogg");
			enragedScream = Bundle.LoadAsset<AudioClip>("DogRage.ogg");
			dogSprint = Bundle.LoadAsset<AudioClip>("DogSprint.ogg");
			ripPlayerApart = Bundle.LoadAsset<AudioClip>("RipPlayerApart.ogg");
			cry1 = Bundle.LoadAsset<AudioClip>("Cry1.ogg");
			dogHowl = Bundle.LoadAsset<AudioClip>("DogHowl.ogg");
			stomachGrowl = Bundle.LoadAsset<AudioClip>("StomachGrowl.ogg");
			eatenExplode = Bundle.LoadAsset<AudioClip>("eatenExplode.ogg");
			dogSneeze = Bundle.LoadAsset<AudioClip>("Sneeze.ogg");
			dogSatisfied = Bundle.LoadAsset<AudioClip>("PlayBow.ogg");
			shrimpTerminalKeyword = Bundle.LoadAsset<TerminalKeyword>("shrimpTK.asset");
			if (!setKorean)
			{
				shrimpTerminalNode = Bundle.LoadAsset<TerminalNode>("ShrimpFile.asset");
				shrimpTerminalNode.creatureName = "Shrimp";
				shrimpTerminalKeyword.word = "shrimp";
			}
			else
			{
				shrimpTerminalNode = Bundle.LoadAsset<TerminalNode>("ShrimpKoreanFile.asset");
				shrimpTerminalNode.creatureName = "쉬림프";
				shrimpTerminalKeyword.word = "쉬림프";
			}
			ShrimpEnemyAI shrimpEnemyAI = shrimpPrefab.AddComponent<ShrimpEnemyAI>();
			((EnemyAI)shrimpEnemyAI).enemyType = shrimpEnemy;
			((EnemyAI)shrimpEnemyAI).creatureAnimator = ((Component)shrimpPrefab.transform.GetChild(0).GetChild(1)).GetComponent<Animator>();
			((EnemyAI)shrimpEnemyAI).creatureVoice = ((Component)shrimpPrefab.transform.GetChild(0).GetChild(3).GetChild(0)).GetComponent<AudioSource>();
			shrimpEnemyAI.growlAudio = ((Component)shrimpPrefab.transform.GetChild(0).GetChild(3).GetChild(1)).GetComponent<AudioSource>();
			shrimpEnemyAI.dogRageAudio = ((Component)shrimpPrefab.transform.GetChild(0).GetChild(3).GetChild(2)).GetComponent<AudioSource>();
			shrimpEnemyAI.hungerAudio = ((Component)shrimpPrefab.transform.GetChild(0).GetChild(3).GetChild(3)).GetComponent<AudioSource>();
			shrimpEnemyAI.sprintAudio = ((Component)shrimpPrefab.transform.GetChild(0).GetChild(3).GetChild(4)).GetComponent<AudioSource>();
			shrimpEnemyAI.mouthTransform = shrimpPrefab.transform.GetChild(0).GetChild(1).GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(2)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(4);
			((EnemyAI)shrimpEnemyAI).creatureSFX = shrimpPrefab.GetComponent<AudioSource>();
			((EnemyAI)shrimpEnemyAI).dieSFX = dogSneeze;
			((EnemyAI)shrimpEnemyAI).AIIntervalTime = 0.2f;
			((EnemyAI)shrimpEnemyAI).updatePositionThreshold = 1f;
			((EnemyAI)shrimpEnemyAI).syncMovementSpeed = 0.22f;
			shrimpEnemyAI.chitterSFX = (AudioClip[])(object)new AudioClip[1];
			shrimpEnemyAI.chitterSFX[0] = dogSatisfied;
			shrimpEnemyAI.angryScreechSFX = (AudioClip[])(object)new AudioClip[1];
			shrimpEnemyAI.angryScreechSFX[0] = dogEatItem;
			shrimpEnemyAI.angryVoiceSFX = dogHowl;
			shrimpEnemyAI.bugFlySFX = footstep4;
			shrimpEnemyAI.hitPlayerSFX = dogEatItem;
			((Component)shrimpPrefab.transform.GetChild(0)).GetComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)shrimpEnemyAI;
			shrimpItemManager.AddComponent<ShrimpItemManager>();
			shrimpEnemy.enemyPrefab = shrimpPrefab;
			NetworkPrefabs.RegisterNetworkPrefab(shrimpPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(shrimpItemManager);
			Enemies.RegisterEnemy(shrimpEnemy, shrimpSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded assets!");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}
}
namespace Shrimp.Patches
{
	public class ItemGrabChecker : NetworkBehaviour
	{
		public bool isInElevatorB;

		public bool droppedItemMoment;

		private bool droppedItemAppended;

		public float dogEatTimer;

		public bool isHeldBefore;

		public GrabbableObject grabbableObject;

		private void Start()
		{
			grabbableObject = ((Component)this).GetComponent<GrabbableObject>();
		}

		private void Update()
		{
			if (grabbableObject.deactivated)
			{
				return;
			}
			if (grabbableObject.isHeld)
			{
				if (!isHeldBefore)
				{
					isHeldBefore = true;
				}
				dogEatTimer = 0f;
				droppedItemMoment = true;
				droppedItemAppended = false;
				ShrimpItemManager.Instance.droppedItems.Remove(grabbableObject);
				ShrimpItemManager.Instance.droppedObjects.Remove(((Component)this).gameObject);
				return;
			}
			if (droppedItemMoment && grabbableObject.reachedFloorTarget && !droppedItemAppended)
			{
				ShrimpItemManager.Instance.droppedItems.Add(grabbableObject);
				ShrimpItemManager.Instance.droppedObjects.Add(((Component)this).gameObject);
				droppedItemAppended = true;
			}
			dogEatTimer += Time.deltaTime;
			if (dogEatTimer > 3f)
			{
				ShrimpItemManager.Instance.droppedItems.Remove(grabbableObject);
				ShrimpItemManager.Instance.droppedObjects.Remove(((Component)this).gameObject);
				dogEatTimer = 0f;
				droppedItemMoment = false;
				droppedItemAppended = false;
			}
		}

		private void OnDestroy()
		{
			ShrimpItemManager.Instance.droppedItems.Remove(grabbableObject);
			ShrimpItemManager.Instance.droppedObjects.Remove(((Component)this).gameObject);
		}

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

		protected internal override string __getTypeName()
		{
			return "ItemGrabChecker";
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void Start_Prefix(GrabbableObject __instance)
		{
			GameObject val = Object.Instantiate<GameObject>(Plugin.shrimpItemManager);
			val.GetComponent<NetworkObject>().Spawn(false);
		}
	}
	public class ShrimpItemManager : NetworkBehaviour
	{
		public List<GrabbableObject> droppedItems = new List<GrabbableObject>();

		public List<GameObject> droppedObjects = new List<GameObject>();

		public static ShrimpItemManager Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			else if ((Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		}

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

		protected internal override string __getTypeName()
		{
			return "ShrimpItemManager";
		}
	}
	public class ShrimpEnemyAI : EnemyAI
	{
		public AISearchRoutine searchForItems;

		public AISearchRoutine searchForPlayer;

		public bool seePlayerFirstTime;

		public float hungerValue;

		public Transform mouthTransform;

		private Vector3 mouthOriginalScale;

		public AudioSource growlAudio;

		public AudioSource dogRageAudio;

		public AudioSource hungerAudio;

		public AudioSource sprintAudio;

		public bool inKillAnimation;

		public bool startingKillAnimationLocalClient;

		private float scaredBackingAway;

		private Ray backAwayRay;

		private RaycastHit hitInfo;

		private RaycastHit hitInfoB;

		private PlayerControllerB lastHitPlayer;

		[Space(3f)]
		public float angryTimer;

		public GrabbableObject targetItem;

		public HoarderBugItem heldItem;

		private Light lungLight;

		[Header("Animations")]
		[Space(5f)]
		private Transform rightEye;

		private Transform leftEye;

		private Vector3 scaleOfEyesNormally;

		private Vector3 agentLocalVelocity;

		private Vector3 previousPosition;

		private float velX;

		private float velZ;

		public Transform turnCompass;

		private float armsHoldLayerWeight;

		[Space(5f)]
		public Transform animationContainer;

		public Transform grabTarget;

		public TwoBoneIKConstraint headLookRig;

		public Transform headLookTarget;

		[Header("Special behaviour states")]
		private float annoyanceMeter;

		public bool watchingPlayerNearPosition;

		public PlayerControllerB watchingPlayer;

		public Transform lookTarget;

		public bool lookingAtPositionOfInterest;

		private Vector3 positionOfInterest;

		private bool isAngry;

		[Header("Misc logic")]
		private bool sendingGrabOrDropRPC;

		private float waitingAtNestTimer;

		private bool waitingAtNest;

		private float timeSinceSeeingAPlayer;

		[Header("Chase logic")]
		private bool lostPlayerInChase;

		private float noticePlayerTimer;

		public PlayerControllerB angryAtPlayer;

		private bool inChase;

		[Header("Audios")]
		public AudioClip[] chitterSFX;

		[Header("Audios")]
		public AudioClip[] angryScreechSFX;

		public AudioClip angryVoiceSFX;

		public AudioClip bugFlySFX;

		public AudioClip hitPlayerSFX;

		private float timeSinceHittingPlayer;

		private float timeSinceLookingTowardsNoise;

		private float timeSinceLookingTowardsItem;

		private float detectPlayersInterval;

		private bool inReturnToNestMode;

		private float footStepTime;

		[ServerRpc(RequireOwnership = false)]
		private void SyncHungerValueServerRpc(float value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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(2235873628u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2235873628u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SyncHungerValueClientRpc(value);
				}
			}
		}

		[ClientRpc]
		private void SyncHungerValueClientRpc(float value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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(3241092987u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3241092987u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					hungerValue = value;
				}
			}
		}

		private void SetVariables()
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Expected O, but got Unknown
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Expected O, but got Unknown
			base.agent = ((Component)this).GetComponent<NavMeshAgent>();
			base.eye = ((Component)this).transform.GetChild(0).GetChild(1).GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(2)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(1);
			leftEye = ((Component)this).transform.GetChild(0).GetChild(1).GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(2)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(2);
			rightEye = ((Component)this).transform.GetChild(0).GetChild(1).GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(2)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(3);
			scaleOfEyesNormally = leftEye.localScale;
			headLookRig = ((Component)((Component)this).transform.GetChild(0).GetChild(1).GetChild(2)
				.GetChild(0)).GetComponent<TwoBoneIKConstraint>();
			animationContainer = ((Component)this).transform.GetChild(0);
			grabTarget = ((Component)this).transform.GetChild(0).GetChild(1).GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(2)
				.GetChild(0)
				.GetChild(0)
				.GetChild(0)
				.GetChild(5);
			headLookTarget = ((Component)this).transform.GetChild(0).GetChild(1).GetChild(2)
				.GetChild(0)
				.GetChild(0);
			lookTarget = ((Component)this).transform.GetChild(2);
			turnCompass = ((Component)this).transform.GetChild(3);
			lungLight = GameObject.Find("LungFlash").GetComponent<Light>();
			lungLight.intensity = 0f;
			List<EnemyBehaviourState> list = new List<EnemyBehaviourState>();
			EnemyBehaviourState val = new EnemyBehaviourState();
			val.name = "Roaming";
			list.Add(val);
			EnemyBehaviourState val2 = new EnemyBehaviourState();
			val2.name = "Following";
			list.Add(val2);
			EnemyBehaviourState val3 = new EnemyBehaviourState();
			val3.name = "Chasing";
			list.Add(val3);
			base.enemyBehaviourStates = list.ToArray();
		}

		public override void Start()
		{
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			SetVariables();
			((EnemyAI)this).Start();
			lastHitPlayer = StartOfRound.Instance.allPlayerScripts[0];
			dogRageAudio.volume = 0f;
			dogRageAudio.loop = true;
			dogRageAudio.clip = Plugin.enragedScream;
			dogRageAudio.pitch = 0f;
			dogRageAudio.Play();
			growlAudio.volume = 0f;
			growlAudio.loop = true;
			growlAudio.clip = Plugin.bigGrowl;
			growlAudio.Play();
			hungerAudio.volume = 0f;
			hungerAudio.loop = true;
			hungerAudio.clip = Plugin.stomachGrowl;
			hungerAudio.Play();
			sprintAudio.volume = 0f;
			sprintAudio.loop = true;
			sprintAudio.clip = Plugin.dogSprint;
			sprintAudio.Play();
			mouthOriginalScale = mouthTransform.localScale;
			heldItem = null;
			base.creatureAnimator.SetTrigger("Walk");
			lungLight.intensity = 0f;
		}

		private bool EatTargetItemIfClose()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			if ((Object)(object)targetItem != (Object)null && heldItem == null && Vector3.Distance(((Component)this).transform.position, ((Component)targetItem).transform.position) < 0.75f && !targetItem.deactivated)
			{
				NetworkObject component = ((Component)targetItem).GetComponent<NetworkObject>();
				EatItemServerRpc(NetworkObjectReference.op_Implicit(component));
				return true;
			}
			return false;
		}

		public override void DoAIInterval()
		{
			//IL_006c: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_00a2: 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_00ad: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_037e: 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_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: 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_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			CalculateAnimationDirection();
			if (base.currentBehaviourStateIndex != 2 && scaredBackingAway > 0.003f && hungerValue < 40f)
			{
				Vector3 position = ((Component)lastHitPlayer).transform.position;
				position.y = ((Component)this).transform.position.y;
				Vector3 val = position - ((Component)this).transform.position;
				backAwayRay = new Ray(((Component)this).transform.position, val * -1f);
				if (Physics.Raycast(backAwayRay, ref hitInfo, 60f, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
				{
					if (((RaycastHit)(ref hitInfo)).distance < 4f)
					{
						if (Physics.Linecast(((Component)this).transform.position, ((RaycastHit)(ref hitInfo)).point + Vector3.Cross(val, Vector3.up) * 25.5f, ref hitInfoB, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
						{
							float distance = ((RaycastHit)(ref hitInfoB)).distance;
							if (Physics.Linecast(((Component)this).transform.position, ((RaycastHit)(ref hitInfo)).point + Vector3.Cross(val, Vector3.up) * -25.5f, ref hitInfoB, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
							{
								float distance2 = ((RaycastHit)(ref hitInfoB)).distance;
								if (Mathf.Abs(distance - distance2) < 5f)
								{
									base.agent.destination = ((RaycastHit)(ref hitInfo)).point + Vector3.Cross(val, Vector3.up) * -4.5f;
								}
								else if (distance < distance2)
								{
									base.agent.destination = ((RaycastHit)(ref hitInfo)).point + Vector3.Cross(val, Vector3.up) * -4.5f;
								}
								else
								{
									base.agent.destination = ((RaycastHit)(ref hitInfo)).point + Vector3.Cross(val, Vector3.up) * 4.5f;
								}
							}
						}
					}
					else
					{
						base.agent.destination = ((RaycastHit)(ref hitInfo)).point;
					}
				}
				base.agent.stoppingDistance = 0f;
				Quaternion val2 = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(val), 3f * Time.deltaTime);
				((Component)this).transform.eulerAngles = new Vector3(0f, ((Quaternion)(ref val2)).eulerAngles.y, 0f);
				base.agent.speed = 13f;
				base.creatureAnimator.SetFloat("walkSpeed", -3.5f);
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (inKillAnimation)
				{
					break;
				}
				base.movingTowardsTargetPlayer = false;
				if (!searchForPlayer.inProgress)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayer);
				}
				else if (hungerValue > 0f && (Object.op_Implicit((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(65f, 80, -1)) || (Object)(object)base.targetPlayer != (Object)null))
				{
					if (!seePlayerFirstTime)
					{
						seePlayerFirstTime = true;
					}
					base.targetPlayer = ((EnemyAI)this).CheckLineOfSightForPlayer(65f, 80, -1);
					((EnemyAI)this).SwitchToBehaviourState(1);
				}
				break;
			case 1:
			{
				if (inKillAnimation)
				{
					break;
				}
				((EnemyAI)this).StopSearch(searchForPlayer, true);
				if (hungerValue <= 0f)
				{
					((EnemyAI)this).SwitchToBehaviourState(0);
				}
				if ((Object)(object)targetItem != (Object)null && heldItem == null && Vector3.Distance(((Component)this).transform.position, ((Component)targetItem).transform.position) < 0.75f && !targetItem.deactivated)
				{
					if (ShrimpItemManager.Instance.droppedItems.Count > 0)
					{
						GameObject val4 = ((EnemyAI)this).CheckLineOfSight(ShrimpItemManager.Instance.droppedObjects, 60f, 40, 5f, (Transform)null, (int[])null);
						if (Object.op_Implicit((Object)(object)val4))
						{
							GrabbableObject component2 = val4.GetComponent<GrabbableObject>();
							if (Object.op_Implicit((Object)(object)component2) && !component2.isHeld && !component2.isPocketed && !component2.deactivated)
							{
								SetGoTowardsTargetObject(val4);
							}
						}
					}
					base.movingTowardsTargetPlayer = false;
				}
				else if (((Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 2.5f) || ((Object)(object)watchingPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)watchingPlayer).transform.position) < 2.5f))
				{
					base.agent.stoppingDistance = 4.5f;
					base.movingTowardsTargetPlayer = false;
					BackAway();
				}
				else if ((Object)(object)((EnemyAI)this).CheckLineOfSight(ShrimpItemManager.Instance.droppedObjects, 160f, 40, 5f, (Transform)null, (int[])null) != (Object)null)
				{
					base.agent.stoppingDistance = 0f;
					base.movingTowardsTargetPlayer = false;
					if (ShrimpItemManager.Instance.droppedItems.Count > 0)
					{
						GameObject val5 = ((EnemyAI)this).CheckLineOfSight(ShrimpItemManager.Instance.droppedObjects, 160f, 40, 5f, (Transform)null, (int[])null);
						if (Object.op_Implicit((Object)(object)val5))
						{
							GrabbableObject component3 = val5.GetComponent<GrabbableObject>();
							if (Object.op_Implicit((Object)(object)component3) && !component3.isHeld && !component3.isPocketed && !component3.deactivated)
							{
								SetGoTowardsTargetObject(val5);
							}
						}
					}
				}
				else
				{
					base.agent.stoppingDistance = 4.5f;
					base.movingTowardsTargetPlayer = true;
				}
				PlayerControllerB val6 = ((EnemyAI)this).CheckLineOfSightForPlayer(65f, 80, -1);
				if ((Object)(object)val6 != (Object)null)
				{
					noticePlayerTimer = 0f;
				}
				else
				{
					noticePlayerTimer += 0.075f;
					if (noticePlayerTimer > 3f)
					{
						lostPlayerInChase = true;
					}
				}
				if (lostPlayerInChase && (Object)(object)targetItem == (Object)null)
				{
					((EnemyAI)this).SwitchToBehaviourState(0);
				}
				break;
			}
			case 2:
				if (inKillAnimation)
				{
					break;
				}
				inReturnToNestMode = false;
				if (heldItem != null)
				{
				}
				if (lostPlayerInChase)
				{
					if (!searchForPlayer.inProgress)
					{
						searchForPlayer.searchWidth = 30f;
						((EnemyAI)this).StartSearch(((Component)base.targetPlayer).transform.position, searchForPlayer);
						Debug.Log((object)(((Object)((Component)this).gameObject).name + ": Lost player in chase; beginning search where the player was last seen"));
					}
					break;
				}
				if ((Object)(object)((EnemyAI)this).CheckLineOfSight(ShrimpItemManager.Instance.droppedObjects, 160f, 40, 5f, (Transform)null, (int[])null) != (Object)null)
				{
					base.agent.stoppingDistance = 0f;
					base.movingTowardsTargetPlayer = false;
					if (ShrimpItemManager.Instance.droppedItems.Count > 0)
					{
						GameObject val3 = ((EnemyAI)this).CheckLineOfSight(ShrimpItemManager.Instance.droppedObjects, 160f, 40, 5f, (Transform)null, (int[])null);
						if (Object.op_Implicit((Object)(object)val3))
						{
							GrabbableObject component = val3.GetComponent<GrabbableObject>();
							if (Object.op_Implicit((Object)(object)component) && !component.isHeld && !component.isPocketed && !component.deactivated)
							{
								SetGoTowardsTargetObject(val3);
							}
						}
					}
				}
				if (hungerValue < 40f)
				{
					((EnemyAI)this).SwitchToBehaviourState(0);
				}
				if ((Object)(object)base.targetPlayer == (Object)null)
				{
					Debug.LogError((object)"TargetPlayer is null even though bug is in chase; setting targetPlayer to watchingPlayer");
					if ((Object)(object)watchingPlayer != (Object)null)
					{
						if (!seePlayerFirstTime)
						{
							seePlayerFirstTime = true;
						}
						base.targetPlayer = watchingPlayer;
					}
				}
				if (searchForPlayer.inProgress)
				{
					((EnemyAI)this).StopSearch(searchForPlayer, true);
					Debug.Log((object)(((Object)((Component)this).gameObject).name + ": Found player during chase; stopping search coroutine and moving after target player"));
				}
				break;
			case 3:
				break;
			}
		}

		private void SetGoTowardsTargetObject(GameObject foundObject)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			base.agent.stoppingDistance = 0f;
			if (((EnemyAI)this).SetDestinationToPosition(foundObject.transform.position, true) && ShrimpItemManager.Instance.droppedObjects.Contains(foundObject))
			{
				Debug.Log((object)(((Object)((Component)this).gameObject).name + ": Setting target object and going towards it."));
				targetItem = foundObject.GetComponent<GrabbableObject>();
				EatTargetItemIfClose();
				((EnemyAI)this).StopSearch(searchForItems, false);
			}
			else
			{
				targetItem = null;
				Debug.Log((object)(((Object)((Component)this).gameObject).name + ": i found an object but cannot reach it (or it has been taken by another bug): " + ((Object)foundObject).name));
			}
		}

		private void ExitChaseMode()
		{
			if (inChase)
			{
				inChase = false;
				Debug.Log((object)(((Object)((Component)this).gameObject).name + ": Exiting chase mode"));
				if (searchForPlayer.inProgress)
				{
					((EnemyAI)this).StopSearch(searchForPlayer, true);
				}
				base.movingTowardsTargetPlayer = false;
				base.creatureAnimator.SetBool("Chase", false);
				base.creatureSFX.Stop();
			}
		}

		private void LateUpdate()
		{
			if (base.currentBehaviourStateIndex != 2 && scaredBackingAway > 0.003f && hungerValue < 40f)
			{
				scaredBackingAway -= Time.deltaTime;
			}
			if (!base.inSpecialAnimation && !base.isEnemyDead && !StartOfRound.Instance.allPlayersDead)
			{
				if (detectPlayersInterval <= 0f)
				{
					detectPlayersInterval = 0.2f;
					DetectAndLookAtPlayers();
				}
				else
				{
					detectPlayersInterval -= Time.deltaTime;
				}
				AnimateLooking();
			}
		}

		private void CalculateAnimationDirection(float maxSpeed = 1f)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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)
			//IL_003d: 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)
			agentLocalVelocity = animationContainer.InverseTransformDirection(Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f) / (Time.deltaTime * 4f));
			base.creatureAnimator.SetFloat("walkSpeed", Mathf.Clamp(((Vector3)(ref agentLocalVelocity)).magnitude / 5f, 0f, 3f));
			base.creatureAnimator.SetFloat("runSpeed", Mathf.Clamp(((Vector3)(ref agentLocalVelocity)).magnitude / 2.7f, 3f, 4f));
			CalculateAnimationDirectionServerRpc(agentLocalVelocity, base.creatureAnimator.GetFloat("walkSpeed"), base.creatureAnimator.GetFloat("runSpeed"));
		}

		[ServerRpc]
		private void CalculateAnimationDirectionServerRpc(Vector3 localVel, float walkSp, float runSp)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Invalid comparison between Unknown and I4
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_0105: 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(2756366285u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref localVel);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref walkSp, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref runSp, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2756366285u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				CalculateAnimationDirectionClientRpc(localVel, walkSp, runSp);
			}
		}

		[ClientRpc]
		private void CalculateAnimationDirectionClientRpc(Vector3 localVel, float walkSp, float runSp)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00bf: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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(1326862066u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref localVel);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref walkSp, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref runSp, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1326862066u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					agentLocalVelocity = localVel;
					previousPosition = ((Component)this).transform.position;
					base.creatureAnimator.SetFloat("walkSpeed", walkSp);
					base.creatureAnimator.SetFloat("runSpeed", runSp);
				}
			}
		}

		private void AnimateLooking()
		{
			//IL_005c: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: 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_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			if (hungerValue < 47f)
			{
				base.agent.angularSpeed = 100f;
			}
			else
			{
				base.agent.angularSpeed = 1000f;
			}
			if ((Object)(object)targetItem != (Object)null)
			{
				lookTarget.position = ((Component)targetItem).transform.position;
				lookingAtPositionOfInterest = true;
				if (targetItem.isHeld)
				{
					if ((Object)(object)base.targetPlayer != (Object)null)
					{
						lookTarget.position = ((Component)base.targetPlayer).transform.position;
					}
					else
					{
						lookingAtPositionOfInterest = false;
					}
					targetItem = null;
				}
			}
			if ((Object)(object)lookTarget != (Object)null && !lookingAtPositionOfInterest && (Object)(object)watchingPlayer != (Object)null)
			{
				lookTarget.position = ((Component)watchingPlayer.gameplayCamera).transform.position;
			}
			else if (!lookingAtPositionOfInterest)
			{
				((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headLookRig).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headLookRig).weight, 0f, 10f);
				return;
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
			}
			if ((Object)(object)watchingPlayer != (Object)null && !lookingAtPositionOfInterest)
			{
				float num = Vector3.Angle(((Component)this).transform.forward, lookTarget.position - ((Component)this).transform.position);
				Vector3 val = ((Component)watchingPlayer).transform.position - ((Component)this).transform.position;
				if (num > 22f)
				{
					Quaternion val2 = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(val), 3f * Time.deltaTime);
					((Component)this).transform.eulerAngles = new Vector3(0f, ((Quaternion)(ref val2)).eulerAngles.y, 0f);
				}
			}
			else
			{
				lookTarget.position = positionOfInterest;
			}
			((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headLookRig).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headLookRig).weight, 0.5f, 7f);
			headLookTarget.position = Vector3.Lerp(headLookTarget.position, lookTarget.position, 8f * Time.deltaTime);
		}

		private void DetectAndLookAtPlayers()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)this).transform.position;
			PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(70f, 30, base.eye, 1.2f, -1);
			if (allPlayersInLineOfSight != null)
			{
				PlayerControllerB val = watchingPlayer;
				timeSinceSeeingAPlayer = 0f;
				float num = 500f;
				bool flag = false;
				if ((Object)(object)base.stunnedByPlayer != (Object)null)
				{
					flag = true;
					angryAtPlayer = base.stunnedByPlayer;
				}
				for (int i = 0; i < allPlayersInLineOfSight.Length; i++)
				{
					if (IsHoarderBugAngry() && (Object)(object)allPlayersInLineOfSight[i] == (Object)(object)angryAtPlayer)
					{
						watchingPlayer = angryAtPlayer;
					}
					else
					{
						float num2 = Vector3.Distance(((Component)allPlayersInLineOfSight[i]).transform.position, position);
						if (num2 < num)
						{
							num = num2;
							watchingPlayer = allPlayersInLineOfSight[i];
						}
					}
					float num3 = Vector3.Distance(((Component)allPlayersInLineOfSight[i]).transform.position, ((Component)this).transform.position);
					if (ShrimpItemManager.Instance.droppedItems.Count > 0 && (num3 < 4f || (inChase && num3 < 8f)) && angryTimer < 3.25f)
					{
						angryAtPlayer = allPlayersInLineOfSight[i];
						watchingPlayer = allPlayersInLineOfSight[i];
						angryTimer = 3.25f;
						break;
					}
					if (base.currentBehaviourStateIndex != 2 && Vector3.Distance(((Component)this).transform.position, ((Component)allPlayersInLineOfSight[i]).transform.position) < 2.5f)
					{
						annoyanceMeter += 0.2f;
						if (annoyanceMeter > 2.5f)
						{
							angryAtPlayer = allPlayersInLineOfSight[i];
							watchingPlayer = allPlayersInLineOfSight[i];
							angryTimer = 3.25f;
						}
					}
				}
				watchingPlayerNearPosition = num < 6f;
				if (!((NetworkBehaviour)this).IsOwner)
				{
					return;
				}
				if (base.currentBehaviourStateIndex != 2)
				{
					if (IsHoarderBugAngry())
					{
						lostPlayerInChase = false;
						if (!seePlayerFirstTime)
						{
							seePlayerFirstTime = true;
						}
						base.targetPlayer = watchingPlayer;
					}
				}
				else
				{
					if (!seePlayerFirstTime)
					{
						seePlayerFirstTime = true;
					}
					base.targetPlayer = watchingPlayer;
					if (lostPlayerInChase)
					{
						lostPlayerInChase = false;
					}
				}
				return;
			}
			timeSinceSeeingAPlayer += 0.2f;
			watchingPlayerNearPosition = false;
			if (base.currentBehaviourStateIndex != 2)
			{
				if (timeSinceSeeingAPlayer > 1.5f)
				{
					watchingPlayer = null;
				}
				return;
			}
			if (timeSinceSeeingAPlayer > 1.25f)
			{
				watchingPlayer = null;
			}
			if (((NetworkBehaviour)this).IsOwner && timeSinceSeeingAPlayer > 2.5f)
			{
				lostPlayerInChase = true;
			}
		}

		private bool IsHoarderBugAngry()
		{
			if (base.stunNormalizedTimer > 0f)
			{
				angryTimer = 4f;
				if (Object.op_Implicit((Object)(object)base.stunnedByPlayer))
				{
					angryAtPlayer = base.stunnedByPlayer;
				}
				return true;
			}
			int num = 0;
			int num2 = 0;
			if (!(angryTimer > 0f))
			{
				return num2 > 0;
			}
			return true;
		}

		public override void Update()
		{
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0630: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			footStepTime += Time.deltaTime * ((Vector3)(ref agentLocalVelocity)).magnitude / 8f;
			if (footStepTime > 0.25f)
			{
				base.creatureVoice.PlayOneShot(Plugin.footsteps[Random.Range(0, 5)], Random.Range(0.8f, 1f));
				footStepTime = 0f;
			}
			if (Plugin.debugLog)
			{
				Plugin.mls.LogInfo((object)$"hungerValue: {hungerValue}, currentBehaviourState: {base.currentBehaviourStateIndex}");
			}
			timeSinceHittingPlayer += Time.deltaTime;
			timeSinceLookingTowardsNoise += Time.deltaTime;
			if (timeSinceLookingTowardsNoise > 0.6f && !Object.op_Implicit((Object)(object)CheckLineOfSightForItem(120f, 40)))
			{
				lookingAtPositionOfInterest = false;
			}
			if (base.inSpecialAnimation || base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			if (((Object)(object)base.targetPlayer != (Object)null || hungerValue <= 0f) && ((NetworkBehaviour)this).IsOwner)
			{
				SyncHungerValueServerRpc(hungerValue += Time.deltaTime);
			}
			if (hungerValue > 34f)
			{
				hungerAudio.volume = Mathf.Lerp(hungerAudio.volume, 1f, Time.deltaTime * 2f);
			}
			else
			{
				hungerAudio.volume = Mathf.Lerp(hungerAudio.volume, 0f, Time.deltaTime * 2f);
			}
			if (hungerValue > 40f)
			{
				leftEye.localScale = Vector3.Lerp(leftEye.localScale, scaleOfEyesNormally * 0.4f, 20f * Time.deltaTime);
				rightEye.localScale = Vector3.Lerp(rightEye.localScale, scaleOfEyesNormally * 0.4f, 20f * Time.deltaTime);
				growlAudio.volume = 1f;
			}
			else
			{
				leftEye.localScale = Vector3.Lerp(leftEye.localScale, scaleOfEyesNormally, 20f * Time.deltaTime);
				rightEye.localScale = Vector3.Lerp(rightEye.localScale, scaleOfEyesNormally, 20f * Time.deltaTime);
				growlAudio.volume = Mathf.Lerp(growlAudio.volume, 0f, Time.deltaTime * 5f);
			}
			if (hungerValue > 45f)
			{
				dogRageAudio.volume = 1f;
				dogRageAudio.pitch = 0.8f;
				mouthTransform.localScale = Vector3.Lerp(mouthTransform.localScale, new Vector3(0.005590725f, 0.01034348f, 0.02495567f), 30f * Time.deltaTime);
			}
			else
			{
				dogRageAudio.volume = Mathf.Lerp(dogRageAudio.volume, 0f, Time.deltaTime * 10f);
				dogRageAudio.pitch = Mathf.Lerp(dogRageAudio.pitch, 0f, Time.deltaTime * 10f);
				mouthTransform.localScale = Vector3.Lerp(mouthTransform.localScale, mouthOriginalScale, 20f * Time.deltaTime);
			}
			if (hungerValue > 48f)
			{
				sprintAudio.volume = Mathf.Lerp(sprintAudio.volume, 1f, Time.deltaTime * 10f);
				base.creatureAnimator.SetBool("running", true);
				if (base.currentBehaviourStateIndex != 2)
				{
					((EnemyAI)this).SwitchToBehaviourState(2);
				}
			}
			else
			{
				sprintAudio.volume = Mathf.Lerp(sprintAudio.volume, 0f, Time.deltaTime * 10f);
				base.creatureAnimator.SetBool("running", false);
				if (base.currentBehaviourStateIndex == 2)
				{
					((EnemyAI)this).SwitchToBehaviourState(0);
				}
			}
			base.creatureAnimator.SetBool("stunned", base.stunNormalizedTimer > 0f);
			bool flag = IsHoarderBugAngry();
			if (!isAngry && flag)
			{
				isAngry = true;
				base.creatureVoice.clip = angryVoiceSFX;
				base.creatureVoice.Play();
			}
			else if (isAngry && !flag)
			{
				isAngry = false;
				angryAtPlayer = null;
				base.creatureVoice.Stop();
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (inKillAnimation)
				{
					break;
				}
				if (Object.op_Implicit((Object)(object)CheckLineOfSightForItem(160f, 40)))
				{
					timeSinceLookingTowardsItem = 0f;
					positionOfInterest = ((Component)CheckLineOfSightForItem(160f, 40)).transform.position;
					lookingAtPositionOfInterest = true;
				}
				else if (timeSinceLookingTowardsItem < 0.6f)
				{
					timeSinceLookingTowardsItem += Time.deltaTime;
				}
				if (!searchForPlayer.inProgress)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayer);
					break;
				}
				base.addPlayerVelocityToDestination = 0f;
				if (base.stunNormalizedTimer > 0f)
				{
					base.agent.speed = 0f;
				}
				else
				{
					base.agent.speed = 6f;
				}
				break;
			case 1:
				if (!inKillAnimation)
				{
					if (Object.op_Implicit((Object)(object)CheckLineOfSightForItem(160f, 40)))
					{
						timeSinceLookingTowardsItem = 0f;
						positionOfInterest = ((Component)CheckLineOfSightForItem(160f, 40)).transform.position;
						lookingAtPositionOfInterest = true;
					}
					else if (timeSinceLookingTowardsItem < 0.6f)
					{
						timeSinceLookingTowardsItem += Time.deltaTime;
					}
					base.addPlayerVelocityToDestination = 0f;
					if (base.stunNormalizedTimer > 0f)
					{
						base.agent.speed = 0f;
					}
					else
					{
						base.agent.speed = 6f;
					}
					base.agent.acceleration = 30f;
				}
				break;
			case 2:
				if (inKillAnimation)
				{
					break;
				}
				base.agent.stoppingDistance = 0f;
				if (!inChase)
				{
					inChase = true;
					if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.75f, 60f, 15, -1f))
					{
						GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.7f, true);
					}
				}
				base.addPlayerVelocityToDestination = 2f;
				if (((NetworkBehaviour)this).IsOwner)
				{
					if (base.stunNormalizedTimer > 0f)
					{
						base.agent.speed = 0f;
					}
					else
					{
						base.agent.speed = 18f;
					}
					base.agent.acceleration = 100f;
				}
				break;
			}
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_0002: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
			if (base.currentBehaviourStateIndex == 0 && timesPlayedInOneSpot <= 10 && !(timeSinceLookingTowardsNoise < 0.6f))
			{
				timeSinceLookingTowardsNoise = 0f;
				float num = Vector3.Distance(noisePosition, ((Component)this).transform.position);
				positionOfInterest = noisePosition;
				lookingAtPositionOfInterest = true;
			}
		}

		private void DropItemAndCallDropRPC(NetworkObject dropItemNetworkObject, bool droppedInNest = true)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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)
			Vector3 targetFloorPosition = RoundManager.Instance.RandomlyOffsetPosition(heldItem.itemGrabbableObject.GetItemFloorPosition(default(Vector3)), 1.2f, 0.4f);
			DropItem(dropItemNetworkObject, targetFloorPosition);
			sendingGrabOrDropRPC = true;
			DropItemServerRpc(NetworkObjectReference.op_Implicit(dropItemNetworkObject), targetFloorPosition, droppedInNest);
		}

		[ServerRpc]
		public void DropItemServerRpc(NetworkObjectReference objectRef, Vector3 targetFloorPosition, bool droppedInNest)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Invalid comparison between Unknown and I4
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_0105: 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(3273023761u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetFloorPosition);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref droppedInNest, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3273023761u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				DropItemClientRpc(objectRef, targetFloorPosition, droppedInNest);
			}
		}

		[ClientRpc]
		public void DropItemClientRpc(NetworkObjectReference objectRef, Vector3 targetFloorPosition, bool droppedInNest)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00bf: 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)
			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(118616207u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetFloorPosition);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref droppedInNest, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 118616207u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkObject item = default(NetworkObject);
				if (((NetworkObjectReference)(ref objectRef)).TryGet(ref item, (NetworkManager)null))
				{
					DropItem(item, targetFloorPosition, droppedInNest);
				}
				else
				{
					Debug.LogError((object)(((Object)((Component)this).gameObject).name + ": Failed to get network object from network object reference (Drop item RPC)"));
				}
			}
		}

		[ServerRpc]
		public void EatItemServerRpc(NetworkObjectReference objectRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Invalid comparison between Unknown and I4
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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(3300887884u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3300887884u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				EatItemClientRpc(objectRef);
			}
		}

		[ClientRpc]
		public void EatItemClientRpc(NetworkObjectReference objectRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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(489629970u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref objectRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 489629970u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkObject item = default(NetworkObject);
				if (((NetworkObjectReference)(ref objectRef)).TryGet(ref item, (NetworkManager)null))
				{
					EatItem(item);
				}
				else
				{
					Debug.LogError((object)(((Object)((Component)this).gameObject).name + ": Failed to get network object from network object reference (Grab item RPC)"));
				}
			}
		}

		private void DropItem(NetworkObject item, Vector3 targetFloorPosition, bool droppingInNest = true)
		{
			//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_008f: 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_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)
			if (sendingGrabOrDropRPC)
			{
				sendingGrabOrDropRPC = false;
				return;
			}
			if (heldItem == null)
			{
				Debug.LogError((object)"Hoarder bug: my held item is null when attempting to drop it!!");
				return;
			}
			GrabbableObject itemGrabbableObject = heldItem.itemGrabbableObject;
			itemGrabbableObject.parentObject = null;
			((Component)itemGrabbableObject).transform.SetParent(StartOfRound.Instance.propsContainer, true);
			itemGrabbableObject.EnablePhysics(true);
			itemGrabbableObject.fallTime = 0f;
			itemGrabbableObject.startFallingPosition = ((Component)itemGrabbableObject).transform.parent.InverseTransformPoint(((Component)itemGrabbableObject).transform.position);
			itemGrabbableObject.targetFloorPosition = ((Component)itemGrabbableObject).transform.parent.InverseTransformPoint(targetFloorPosition);
			itemGrabbableObject.floorYRot = -1;
			itemGrabbableObject.DiscardItemFromEnemy();
			heldItem = null;
			if (!droppingInNest && ShrimpItemManager.Instance.droppedObjects.Count != 0)
			{
				ShrimpItemManager.Instance.droppedObjects.Add(((Component)itemGrabbableObject).gameObject);
			}
		}

		private void EatItem(NetworkObject item)
		{
			SyncHungerValueServerRpc(hungerValue - 120f);
			targetItem = null;
			base.creatureAnimator.SetTrigger("eat");
			base.creatureSFX.PlayOneShot(Plugin.dogEatItem);
			GrabbableObject component = ((Component)item).gameObject.GetComponent<GrabbableObject>();
			((NetworkBehaviour)component).NetworkObject.Despawn(true);
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (base.currentBehaviourStateIndex == 2 && !base.isEnemyDead)
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, inKillAnimation || startingKillAnimationLocalClient, false);
				if ((Object)(object)val != (Object)null)
				{
					KillPlayerAnimationServerRpc((int)val.playerClientId);
					startingKillAnimationLocalClient = true;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void KillPlayerAnimationServerRpc(int playerObjectId)
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(684832026u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerObjectId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 684832026u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				if (!inKillAnimation)
				{
					inKillAnimation = true;
					KillPlayerAnimationClientRpc(playerObjectId);
				}
				else
				{
					CancelKillAnimationClientRpc(playerObjectId);
				}
			}
		}

		[ClientRpc]
		public void KillPlayerAnimationClientRpc(int playerObjectId)
		{
			//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(380405851u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerObjectId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 380405851u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StartCoroutine(KillPlayerAnimation(playerObjectId));
				}
			}
		}

		[ClientRpc]
		public void CancelKillAnimationClientRpc(int playerObjectId)
		{
			//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(3353791596u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerObjectId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3353791596u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (int)GameNetworkManager.Instance.localPlayerController.playerClientId == playerObjectId)
				{
					startingKillAnimationLocalClient = false;
				}
			}
		}

		public IEnumerator KillPlayerAnimation(int playerId)
		{
			base.creatureSFX.PlayOneShot(Plugin.ripPlayerApart);
			base.agent.speed = 0f;
			base.agent.angularSpeed = 0f;
			PlayerControllerB killPlayer = StartOfRound.Instance.allPlayerScripts[playerId];
			killPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 0, default(Vector3));
			base.creatureAnimator.SetTrigger("RipObject");
			float startTime = Time.realtimeSinceStartup;
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)killPlayer.deadBody != (Object)null || Time.realtimeSinceStartup - startTime > 2f));
			DeadBodyInfo body = killPlayer.deadBody;
			if ((Object)(object)body != (Object)null && (Object)(object)body.attachedTo == (Object)null)
			{
				body.attachedLimb = body.bodyParts[5];
				body.attachedTo = grabTarget;
				body.matchPositionExactly = true;
			}
			yield return (object)new WaitForSeconds(0.03f);
			SyncHungerValueServerRpc(-20f);
			yield return (object)new WaitForSeconds(4f);
			base.creatureAnimator.SetTrigger("eat");
			base.creatureSFX.PlayOneShot(Plugin.dogEatPlayer);
			((NetworkBehaviour)killPlayer.deadBody.grabBodyObject).NetworkObject.Despawn(true);
			yield return (object)new WaitForSeconds(1.7f);
			base.agent.speed = 6f;
			base.agent.angularSpeed = 10f;
			inKillAnimation = false;
		}

		[ServerRpc(RequireOwnership = false)]
		public void HitPlayerServerRpc()
		{
			//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(1477397876u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1477397876u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					HitPlayerClientRpc();
				}
			}
		}

		[ClientRpc]
		public void HitPlayerClientRpc()
		{
			//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(2399613090u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2399613090u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !base.isEnemyDead)
				{
					base.creatureAnimator.SetTrigger("HitPlayer");
					base.creatureSFX.PlayOneShot(hitPlayerSFX);
					WalkieTalkie.TransmitOneShotAudio(base.creatureSFX, hitPlayerSFX, 1f);
				}
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (hungerValue < 40f)
			{
				((MonoBehaviour)this).StartCoroutine(stunnedTimer());
				lastHitPlayer = playerWhoHit;
			}
		}

		private IEnumerator stunnedTimer()
		{
			base.agent.speed = 0f;
			base.creatureAnimator.SetTrigger("Recoil");
			base.creatureVoice.PlayOneShot(Plugin.cry1, 1f);
			yield return (object)new WaitForSeconds(0.5f);
			scaredBackingAway = 2.2f;
			yield return (object)new WaitForSeconds(0.3f);
		}

		public override void KillEnemy(bool destroy = false)
		{
			((EnemyAI)this).KillEnemy(false);
			base.agent.speed = 0f;
			base.creatureVoice.Stop();
			base.creatureSFX.Stop();
		}

		public GrabbableObject CheckLineOfSightForItem(float width = 45f, int range = 60, float proximityAwareness = 3f)
		{
			//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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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)
			List<GrabbableObject> droppedItems = ShrimpItemManager.Instance.droppedItems;
			for (int i = 0; i < droppedItems.Count; i++)
			{
				if (!droppedItems[i].grabbableToEnemies || !droppedItems[i].isHeld || ShrimpItemManager.Instance.droppedItems.Count > 0)
				{
					continue;
				}
				Vector3 position = ((Component)droppedItems[i]).transform.position;
				if (!Physics.Linecast(base.eye.position, position, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
				{
					Vector3 val = position - base.eye.position;
					if (Vector3.Angle(base.eye.forward, val) < width || Vector3.Distance(((Component)this).transform.position, position) < proximityAwareness)
					{
						return droppedItems[i];
					}
				}
			}
			return null;
		}

		private void BackAway()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: 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_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: 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_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: 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_022c: 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_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: 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_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
				if (Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < float.PositiveInfinity && num < 30f && !val.isPlayerDead)
				{
					if (!seePlayerFirstTime)
					{
						seePlayerFirstTime = true;
					}
					base.targetPlayer = val;
				}
			}
			base.agent.destination = ((Component)base.targetPlayer).transform.position;
			Vector3 position = ((Component)base.targetPlayer).transform.position;
			position.y = ((Component)this).transform.position.y;
			Vector3 val2 = position - ((Component)this).transform.position;
			Ray val3 = default(Ray);
			((Ray)(ref val3))..ctor(((Component)this).transform.position, val2 * -1f);
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(val3, ref val4, 60f, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
			{
				if (((RaycastHit)(ref val4)).distance < 4f)
				{
					RaycastHit val5 = default(RaycastHit);
					if (Physics.Linecast(((Component)this).transform.position, ((RaycastHit)(ref val4)).point + Vector3.Cross(val2, Vector3.up) * 25.5f, ref val5, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
					{
						float distance = ((RaycastHit)(ref val5)).distance;
						if (Physics.Linecast(((Component)this).transform.position, ((RaycastHit)(ref val4)).point + Vector3.Cross(val2, Vector3.up) * -25.5f, ref val5, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
						{
							float distance2 = ((RaycastHit)(ref val5)).distance;
							if (Mathf.Abs(distance - distance2) < 5f)
							{
								base.agent.destination = ((RaycastHit)(ref val4)).point + Vector3.Cross(val2, Vector3.up) * -4.5f;
							}
							else if (distance < distance2)
							{
								base.agent.destination = ((RaycastHit)(ref val4)).point + Vector3.Cross(val2, Vector3.up) * -4.5f;
							}
							else
							{
								base.agent.destination = ((RaycastHit)(ref val4)).point + Vector3.Cross(val2, Vector3.up) * 4.5f;
							}
						}
					}
				}
				else
				{
					base.agent.destination = ((RaycastHit)(ref val4)).point;
				}
			}
			else
			{
				base.agent.destination = ((Ray)(ref val3)).GetPoint(2.3f);
			}
			base.agent.stoppingDistance = 0.2f;
			Quaternion val6 = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(val2), 3f * Time.deltaTime);
			((Component)this).transform.eulerAngles = new Vector3(0f, ((Quaternion)(ref val6)).eulerAngles.y, 0f);
			base.agent.speed = 8f;
			base.agent.acceleration = 50000f;
			base.creatureAnimator.SetFloat("walkSpeed", -2.2f);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ShrimpEnemyAI()
		{
			//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
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2235873628u, new RpcReceiveHandler(__rpc_handler_2235873628));
			NetworkManager.__rpc_func_table.Add(3241092987u, new RpcReceiveHandler(__rpc_handler_3241092987));
			NetworkManager.__rpc_func_table.Add(2756366285u, new RpcReceiveHandler(__rpc_handler_2756366285));
			NetworkManager.__rpc_func_table.Add(1326862066u, new RpcReceiveHandler(__rpc_handler_1326862066));
			NetworkManager.__rpc_func_table.Add(3273023761u, new RpcReceiveHandler(__rpc_handler_3273023761));
			NetworkManager.__rpc_func_table.Add(118616207u, new RpcReceiveHandler(__rpc_handler_118616207));
			NetworkManager.__rpc_func_table.Add(3300887884u, new RpcReceiveHandler(__rpc_handler_3300887884));
			NetworkManager.__rpc_func_table.Add(489629970u, new RpcReceiveHandler(__rpc_handler_489629970));
			NetworkManager.__rpc_func_table.Add(684832026u, new RpcReceiveHandler(__rpc_handler_684832026));
			NetworkManager.__rpc_func_table.Add(380405851u, new RpcReceiveHandler(__rpc_handler_380405851));
			NetworkManager.__rpc_func_table.Add(3353791596u, new RpcReceiveHandler(__rpc_handler_3353791596));
			NetworkManager.__rpc_func_table.Add(1477397876u, new RpcReceiveHandler(__rpc_handler_1477397876));
			NetworkManager.__rpc_func_table.Add(2399613090u, new RpcReceiveHandler(__rpc_handler_2399613090));
		}

		private static void __rpc_handler_2235873628(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_0044: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float value = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ShrimpEnemyAI)(object)target).SyncHungerValueServerRpc(value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3241092987(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_0044: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float value = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShrimpEnemyAI)(object)target).SyncHungerValueClientRpc(value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2756366285(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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00db: 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!");
				}
				return;
			}
			Vector3 localVel = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref localVel);
			float walkSp = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref walkSp, default(ForPrimitives));
			float runSp = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref runSp, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((ShrimpEnemyAI)(object)target).CalculateAnimationDirectionServerRpc(localVel, walkSp, runSp);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}

		private static void __rpc_handler_1326862066(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_003c: 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_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_006c: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 localVel = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref localVel);
				float walkSp = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref walkSp, default(ForPrimitives));
				float runSp = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref runSp, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ShrimpEnemyAI)(object)target).CalculateAnimationDirectionClientRpc(localVel, walkSp, runSp);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3273023761(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