Decompiled source of LC Office v1.2.5

LCOffice.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using DunGen.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using LCOffice.Patches;
using LethalLevelLoader;
using LethalLib.Modules;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LCOffice
{
	[BepInPlugin("Piggy.LCOffice", "LCOffice", "1.2.5")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(RoundManager))]
		internal class RoundManagerPatch
		{
			public static float spawnTimer;

			[HarmonyPatch("SpawnScrapInLevel")]
			[HarmonyPrefix]
			private static bool SetItemSpawnPoints(ref RuntimeDungeon ___dungeonGenerator)
			{
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				if (((Object)___dungeonGenerator.Generator.DungeonFlow).name != "OfficeDungeonFlow")
				{
					return true;
				}
				RoundManager instance = RoundManager.Instance;
				Vector3 position = GameObject.Find("LevelGenerationRoot").transform.position;
				Object.Instantiate<GameObject>(extLevelGeneration, new Vector3(position.x - 130f, position.y, position.z - 130f), Quaternion.Euler(0f, 0f, 0f));
				dungeonGenerator = GameObject.Find("A_DungeonGenerator").GetComponent<RuntimeDungeon>();
				instance.SpawnSyncedProps();
				if ((Object)(object)GameObject.Find("OfficeTeleport(Clone)") != (Object)null)
				{
					EntranceTeleport component = GameObject.Find("OfficeTeleport(Clone)").GetComponent<EntranceTeleport>();
					component.entranceId = 40;
				}
				if ((Object)(object)GameObject.Find("OfficeOutsideTeleport(Clone)") != (Object)null)
				{
					EntranceTeleport component2 = GameObject.Find("OfficeOutsideTeleport(Clone)").GetComponent<EntranceTeleport>();
					component2.entranceId = 40;
				}
				return true;
			}
		}

		private const string modGUID = "Piggy.LCOffice";

		private const string modName = "LCOffice";

		private const string modVersion = "1.2.5";

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

		private static Plugin Instance;

		public static ManualLogSource mls;

		public static AssetBundle Bundle;

		public static AudioClip ElevatorOpen;

		public static AudioClip ElevatorClose;

		public static AudioClip ElevatorUp;

		public static AudioClip ElevatorDown;

		public static AudioClip stanleyVoiceline1;

		public static AudioClip bossaLullaby;

		public static AudioClip shopTheme;

		public static AudioClip saferoomTheme;

		public static AudioClip cootieTheme;

		public static AudioClip bossaLullabyLowPitch;

		public static AudioClip shopThemeLowPitch;

		public static AudioClip saferoomThemeLowPitch;

		public static AudioClip garageDoorSlam;

		public static AudioClip garageSlide;

		public static AudioClip floorOpen;

		public static AudioClip floorClose;

		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 GameObject elevatorManager;

		public static GameObject storagePrefab;

		public static GameObject socketPrefab;

		public static GameObject socketInteractPrefab;

		public static GameObject insideCollider;

		public static EnemyType shrimpEnemy;

		public static EnemyType haltEnemy;

		public static GameObject officeRoundSystem;

		public static GameObject extLevelGeneration;

		public static ExtendedDungeonFlow officeExtendedDungeonFlow;

		public static DungeonArchetype officeArchetype;

		public static DungeonArchetype officeArchetype_A;

		public static DungeonFlow officeDungeonFlow;

		public static DungeonFlow officeDungeonFlow_A;

		public static TerminalNode shrimpTerminalNode;

		public static TerminalKeyword shrimpTerminalKeyword;

		public static TerminalKeyword elevatorKeyword;

		public static TerminalKeyword elevator1Keyword;

		public static TerminalKeyword elevator2Keyword;

		public static TerminalKeyword elevator3Keyword;

		public static TerminalNode elevator1Node;

		public static TerminalNode elevator2Node;

		public static TerminalNode elevator3Node;

		public static Item coinItem;

		public static GameObject coinPrefab;

		public static Item toolBoxItem;

		public static GameObject toolBoxPrefab;

		public static Item screwDriverItem;

		public static GameObject screwDriverPrefab;

		public static Item laptopItem;

		public static GameObject laptopPrefab;

		public static Item wrenchItem;

		public static GameObject wrenchPrefab;

		public static RuntimeDungeon dungeonGenerator;

		public static RuntimeAnimatorController playerScreenController;

		public static RuntimeAnimatorController playerScreenParentController;

		public static AudioClip haltMusic;

		public static AudioClip haltNoise1;

		public static AudioClip haltNoise2;

		public static AudioClip haltNoise3;

		public static AudioClip haltNoise4;

		public static AudioClip haltAttack;

		public static GameObject haltRoom;

		public static GameObject haltNoiseScreen;

		public static GameObject haltVolume;

		public static GameObject glitchSound;

		public static string PluginDirectory;

		private ConfigEntry<bool> configGuaranteedOffice;

		private ConfigEntry<int> configOfficeRarity;

		private ConfigEntry<string> configMoons;

		private ConfigEntry<int> shrimpSpawnWeight;

		private ConfigEntry<int> configLengthOverride;

		private ConfigEntry<bool> configEnableScraps;

		public static bool setKorean;

		public static int configHaltPropability;

		public static bool configDisableCameraShake;

		public static bool configDiversityHaltBrighness;

		public static float musicVolume;

		public static bool elevatorMusicPitchdown;

		public static bool emergencyPowerSystem;

		public static bool cameraDisable;

		public static int cameraFrameSpeed;

		public static Item bottleItem;

		public static Item goldencupItem;

		public static ItemGroup itemGroupGeneral;

		public static ItemGroup itemGroupTabletop;

		public static ItemGroup itemGroupSmall;

		public static bool diversityIntergrated;

		private void Awake()
		{
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Expected O, but got Unknown
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Expected O, but got Unknown
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Expected O, but got Unknown
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Expected O, but got Unknown
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Expected O, but got Unknown
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Expected O, but got Unknown
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_054b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Expected O, but got Unknown
			//IL_0594: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Expected O, but got Unknown
			//IL_0689: Unknown result type (might be due to invalid IL or missing references)
			//IL_0693: Expected O, but got Unknown
			//IL_071d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0727: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			PluginDirectory = ((BaseUnityPlugin)this).Info.Location;
			mls = Logger.CreateLogSource("Piggy.LCOffice");
			mls.LogInfo((object)"LC_Office is loaded!");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			Bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "lcoffice"));
			if ((Object)(object)Bundle == (Object)null)
			{
				mls.LogError((object)"Failed to load Office Dungeon assets.");
				return;
			}
			officeDungeonFlow = Bundle.LoadAsset<DungeonFlow>("OfficeDungeonFlow.asset");
			officeArchetype = Bundle.LoadAsset<DungeonArchetype>("OfficeArchetype.asset");
			extLevelGeneration = Bundle.LoadAsset<GameObject>("ExtLevelGeneration.prefab");
			configOfficeRarity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "OfficeRarity", 40, new ConfigDescription("How rare it is for the office to be chosen. Higher values increases the chance of spawning the office.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 300), Array.Empty<object>()));
			configGuaranteedOffice = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "OfficeGuaranteed", false, new ConfigDescription("If enabled, the office will be effectively guaranteed to spawn. Only recommended for debugging/sightseeing purposes.", (AcceptableValueBase)null, Array.Empty<object>()));
			configMoons = ((BaseUnityPlugin)this).Config.Bind<string>("General", "OfficeMoonsList", "free", new ConfigDescription("The moon(s) that the office can spawn on, in the form of a comma separated list of selectable level names (e.g. \"TitanLevel,RendLevel,DineLevel\")\nNOTE: These must be the internal data names of the levels (all vanilla moons are \"MoonnameLevel\", for modded moon support you will have to find their name if it doesn't follow the convention).\nThe following strings: \"all\", \"vanilla\", \"modded\", \"paid\", \"free\", \"none\" are dynamic presets which add the dungeon to that specified group (string must only contain one of these, or a manual moon name list).\nDefault dungeon generation size is balanced around the dungeon scale multiplier of Titan (2.35), moons with significantly different dungeon size multipliers (see Lethal Company wiki for values) may result in dungeons that are extremely small/large.", (AcceptableValueBase)null, Array.Empty<object>()));
			configLengthOverride = ((BaseUnityPlugin)this).Config.Bind<int>("General", "OfficeLengthOverride", -1, new ConfigDescription(string.Format("If not -1, overrides the office length to whatever you'd like. Adjusts how long/large the dungeon generates.\nBe *EXTREMELY* careful not to set this too high (anything too big on a moon with a high dungeon size multipier can cause catastrophic problems, like crashing your computer or worse)\nFor reference, the default value for the current version [{0}] is {1}. If it's too big, make this lower e.g. 6, if it's too small use something like 10 (or higher, but don't go too crazy with it).", "1.1.2", 4), (AcceptableValueBase)null, Array.Empty<object>()));
			configEnableScraps = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "OfficeCustomScrap", true, new ConfigDescription("When enabled, enables custom scrap spawning.", (AcceptableValueBase)null, Array.Empty<object>()));
			musicVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ElevatorMusicVolume", 100f, "Set the volume of music played in the elevator. (0 - 100)").Value;
			elevatorMusicPitchdown = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ElevatorMusicPitchDown", false, "Change the pitch of the elevator music. (bc i like it)").Value;
			configDisableCameraShake = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisableCameraShake", false, "Turn off custom camera shake.").Value;
			configDiversityHaltBrighness = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DiversityHaltBrighness", true, "Increase brightness when encountering Halt if Diversity mode is detected. Disabling it will make the game VERY difficult when encountering Halt!").Value;
			emergencyPowerSystem = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EmergencyPowerSystem", false, "(EXPERIMENTAL) When set to true, if a apparatus is removed from a facility, the elevator will not operate until the apparatus is inserted into the elevator's emergency power unit.").Value;
			cameraDisable = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable Camera", false, "Disable cameras inside the office.").Value;
			cameraFrameSpeed = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Camera Frame Speed", 20, "Specifies the camera speed inside the office. If it is over 100, it changes to real-time capture. (FPS)").Value;
			shrimpSpawnWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "ShrimpSpawnWeight", 5, new ConfigDescription("Sets the shrimp spawn weight for every moons.", (AcceptableValueBase)null, Array.Empty<object>()));
			configHaltPropability = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "HaltSpawnPropability", 12, "Sets the halt spawn propability for office interior. (0 - 100)").Value;
			setKorean = ((BaseUnityPlugin)this).Config.Bind<bool>("Translation", "Enable Korean", false, "Set language to Korean.").Value;
			if (configLengthOverride.Value == -1)
			{
				officeDungeonFlow.Length.Min = 3;
				officeDungeonFlow.Length.Max = 3;
			}
			else
			{
				mls.LogInfo((object)$"Office length override has been set to {configLengthOverride.Value}. Be careful with this value.");
				officeDungeonFlow.Length.Min = configLengthOverride.Value;
				officeDungeonFlow.Length.Max = configLengthOverride.Value;
			}
			ExtendedDungeonFlow val = ScriptableObject.CreateInstance<ExtendedDungeonFlow>();
			val.contentSourceName = "LC Office";
			val.dungeonFlow = officeDungeonFlow;
			val.dungeonDefaultRarity = 0;
			int num = (configGuaranteedOffice.Value ? 99999 : configOfficeRarity.Value);
			switch (configMoons.Value.ToLower())
			{
			case "all":
				val.dynamicLevelTagsList.Add(new StringWithRarity("Vanilla", num));
				val.dynamicLevelTagsList.Add(new StringWithRarity("Custom", num));
				mls.LogInfo((object)"Registered Office dungeon for all moons.");
				break;
			case "vanilla":
				val.dynamicLevelTagsList.Add(new StringWithRarity("Lethal Company", num));
				mls.LogInfo((object)"Registered Office dungeon for all vanilla moons.");
				break;
			case "modded":
				val.dynamicLevelTagsList.Add(new StringWithRarity("Custom", num));
				mls.LogInfo((object)"Registered Office dungeon for all modded moons.");
				break;
			case "paid":
				val.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(1f, 9999f), num));
				mls.LogInfo((object)"Registered Office dungeon for all paid moons.");
				break;
			case "free":
				val.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(0f, 0f), num));
				mls.LogInfo((object)"Registered Office dungeon for all free moons.");
				break;
			default:
			{
				mls.LogInfo((object)"Registering Office dungeon for predefined moon list.");
				string[] array = configMoons.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries);
				List<StringWithRarity> list = new List<StringWithRarity>();
				for (int i = 0; i < array.Length; i++)
				{
					string[] array2 = array[i].Split(new char[1] { '@' }, StringSplitOptions.RemoveEmptyEntries);
					int num2 = array2.Length;
					int result;
					if (num2 > 2)
					{
						mls.LogError((object)("Invalid setup for moon rarity config: " + array[i] + ". Skipping."));
					}
					else if (num2 == 1)
					{
						mls.LogInfo((object)$"Registering Office dungeon for moon {array[i]} at default rarity {num}");
						list.Add(new StringWithRarity(array[i], num));
					}
					else if (!int.TryParse(array2[1], out result))
					{
						mls.LogError((object)("Failed to parse rarity value for moon " + array2[0] + ": " + array2[1] + ". Skipping."));
					}
					else
					{
						mls.LogInfo((object)$"Registering Office dungeon for moon {array[i]} at default rarity {num}");
						list.Add(new StringWithRarity(array2[0], result));
					}
				}
				val.manualPlanetNameReferenceList = list;
				break;
			}
			}
			val.dungeonSizeMin = 1f;
			val.dungeonSizeMax = 1f;
			val.dungeonSizeLerpPercentage = 0f;
			PatchedContent.RegisterExtendedDungeonFlow(val);
			shrimpPrefab = Bundle.LoadAsset<GameObject>("Shrimp.prefab");
			shrimpEnemy = Bundle.LoadAsset<EnemyType>("ShrimpEnemy.asset");
			haltEnemy = Bundle.LoadAsset<EnemyType>("HaltEnemy.asset");
			elevatorManager = Bundle.LoadAsset<GameObject>("ElevatorSystem.prefab");
			storagePrefab = Bundle.LoadAsset<GameObject>("DepositPlace.prefab");
			socketPrefab = Bundle.LoadAsset<GameObject>("ElevatorSocket.prefab");
			socketInteractPrefab = Bundle.LoadAsset<GameObject>("LungPlacement.prefab");
			officeRoundSystem = Bundle.LoadAsset<GameObject>("OfficeRoundSystem.prefab");
			insideCollider = Bundle.LoadAsset<GameObject>("InsideCollider.prefab");
			bossaLullaby = Bundle.LoadAsset<AudioClip>("bossa_lullaby_refiltered.ogg");
			shopTheme = Bundle.LoadAsset<AudioClip>("shop_refiltered.ogg");
			saferoomTheme = Bundle.LoadAsset<AudioClip>("saferoom_refiltered.ogg");
			bossaLullabyLowPitch = Bundle.LoadAsset<AudioClip>("bossa_lullaby_low_wpitch.ogg");
			shopThemeLowPitch = Bundle.LoadAsset<AudioClip>("shop_low_wpitch.ogg");
			saferoomThemeLowPitch = Bundle.LoadAsset<AudioClip>("saferoom_low_wpitch.ogg");
			ElevatorOpen = Bundle.LoadAsset<AudioClip>("ElevatorOpen.ogg");
			ElevatorClose = Bundle.LoadAsset<AudioClip>("ElevatorClose.ogg");
			ElevatorDown = Bundle.LoadAsset<AudioClip>("ElevatorDown.ogg");
			ElevatorUp = Bundle.LoadAsset<AudioClip>("ElevatorUp.ogg");
			garageDoorSlam = Bundle.LoadAsset<AudioClip>("GarageDoorSlam.ogg");
			garageSlide = Bundle.LoadAsset<AudioClip>("GarageDoorSlide1.ogg");
			floorOpen = Bundle.LoadAsset<AudioClip>("FloorOpen.ogg");
			floorClose = Bundle.LoadAsset<AudioClip>("FloorClosed.ogg");
			footstep1 = Bundle.LoadAsset<AudioClip>("Footstep1.ogg");
			footstep2 = Bundle.LoadAsset<AudioClip>("Footstep2.ogg");
			footstep3 = Bundle.LoadAsset<AudioClip>("Footstep3.ogg");
			footstep4 = Bundle.LoadAsset<AudioClip>("Footstep4.ogg");
			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");
			stanleyVoiceline1 = Bundle.LoadAsset<AudioClip>("stanley.ogg");
			shrimpTerminalNode = Bundle.LoadAsset<TerminalNode>("ShrimpFile.asset");
			shrimpTerminalKeyword = Bundle.LoadAsset<TerminalKeyword>("shrimpTK.asset");
			elevator1Node = Bundle.LoadAsset<TerminalNode>("Elevator1Node.asset");
			elevator2Node = Bundle.LoadAsset<TerminalNode>("Elevator2Node.asset");
			elevator3Node = Bundle.LoadAsset<TerminalNode>("Elevator3Node.asset");
			elevatorKeyword = Bundle.LoadAsset<TerminalKeyword>("ElevatorKeyword.asset");
			elevator1Keyword = Bundle.LoadAsset<TerminalKeyword>("Elevator1f.asset");
			elevator2Keyword = Bundle.LoadAsset<TerminalKeyword>("Elevator2f.asset");
			elevator3Keyword = Bundle.LoadAsset<TerminalKeyword>("Elevator3f.asset");
			playerScreenController = Bundle.LoadAsset<RuntimeAnimatorController>("PlayerScreenRe.controller");
			playerScreenParentController = Bundle.LoadAsset<RuntimeAnimatorController>("PlayerScreenParent.controller");
			haltMusic = Bundle.LoadAsset<AudioClip>("HaltMusic.wav");
			haltNoise1 = Bundle.LoadAsset<AudioClip>("HaltNoise1.wav");
			haltNoise2 = Bundle.LoadAsset<AudioClip>("HaltNoise2.wav");
			haltNoise3 = Bundle.LoadAsset<AudioClip>("HaltNoise3.wav");
			haltNoise4 = Bundle.LoadAsset<AudioClip>("HaltNoise4.wav");
			haltAttack = Bundle.LoadAsset<AudioClip>("HaltAttack.wav");
			haltRoom = Bundle.LoadAsset<GameObject>("HaltTile.prefab");
			haltNoiseScreen = Bundle.LoadAsset<GameObject>("NoiseScreen.prefab");
			haltVolume = Bundle.LoadAsset<GameObject>("HaltVolume.prefab");
			glitchSound = Bundle.LoadAsset<GameObject>("GlitchSound.prefab");
			if (!setKorean)
			{
				shrimpTerminalNode.displayText = "Shrimp\r\n\r\nSigurd’s Danger Level: 60%\r\n\r\n\nScientific name: Canispiritus-Artemus\r\n\r\nShrimps are dog-like creatures, known to be the first tenant of the Upturned Inn. For the most part, he is relatively friendly to humans, following them around, curiously stalking them. Unfortunately, their passive temperament comes with a dangerously vicious hunger.\r\nDue to the nature of their biology, he has a much more unique stomach organ than most other creatures. The stomach lining is flexible, yet hardy, allowing a Shrimp to digest and absorb the nutrients from anything, biological or not, so long as it isn’t too large.\r\n\r\nHowever, this evolutionary adaptation was most likely a result of their naturally rapid metabolism. He uses nutrients so quickly that he needs to eat multiple meals a day to survive. The time between these meals are inconsistent, as the rate of caloric consumption is variable. This can range from hours to even minutes and causes the shrimp to behave monstrously if he has not eaten for a while.\r\n\r\nKnown to live in abandoned buildings, shrimp can often be seen in large abandoned factories or offices scavenging for scrap metal, to eat. That isn’t to say he can’t be found elsewhere. He is usually a lone hunters and expert trackers out of necessity.\r\n\r\nSigurd’s Note:\r\nIf this guy spots you, you’ll want to drop something you’re holding and let him eat it. It’s either you or that piece of scrap on you.\r\n\r\nit’s best to avoid letting him spot you. I swear… it’s almost like his eyes are staring into your soul.\r\nI never want to see one of these guys behind me again.\r\n\r\n\r\nIK: <i>Sir, don't be sad! Shrimp didn't hate you.\r\nhe was just... hungry.</i>\r\n\r\n";
				shrimpTerminalNode.creatureName = "Shrimp";
				shrimpTerminalKeyword.word = "shrimp";
			}
			else
			{
				shrimpTerminalNode.displayText = "쉬림프\r\n\r\n시구르드의 위험 수준: 60%\r\n\r\n\n학명: 카니스피리투스-아르테무스\r\n\r\n쉬림프는 개를 닮은 생명체로 Upturned Inn의 첫 번째 세입자로 알려져 있습니다. 평소에는 상대적으로 우호적이며, 호기심을 가지고 인간을 따라다닙니다. 불행하게도 그는 위험할 정도로 굉장한 식욕을 가지고 있습니다.\r\n생물학적 특성으로 인해, 그는 대부분의 다른 생물보다 훨씬 더 독특한 위장 기관을 가지고 있습니다. 위 내막은 유연하면서도 견고하기 때문에 어떤 물체라도 영양분을 소화하고 흡수할 수 있습니다.\r\n그러나 이러한 진화적 적응은 자연적으로 빠른 신진대사의 결과일 가능성이 높습니다. 그는 영양분을 너무 빨리 사용하기 때문에 생존하려면 하루에 여러 끼를 먹어야 합니다.\r\n칼로리 소비율이 다양하기 때문에 식사 사이의 시간이 일정하지 않습니다. 이는 몇 시간에서 몇 분까지 지속될 수 있으며, 쉬림프가 오랫동안 무언가를 먹지 않으면 매우 포악해지며 따라다니던 사람을 쫒습니다.\r\n\r\n버려진 건물에 사는 것으로 알려진 쉬림프는 버려진 공장이나 사무실에서 폐철물을 찾아다니는 것으로 발견할 수 있습니다. 그렇다고 다른 곳에서 그를 찾을 수 없다는 말은 아닙니다. 그는 일반적으로 고독한 사냥꾼이며, 때로는 전문적인 추적자가 되기도 합니다.\r\n\r\n시구르드의 노트: 이 녀석이 으르렁거리는 소리를 듣게 된다면, 먹이를 줄 수 있는 무언가를 가지고 있기를 바라세요. 아니면 당신이 이 녀석의 식사가 될 거예요.\r\n맹세컨대... 다시는 내 뒤에서 이 녀석을 보고 싶지 않아.\r\n\r\n\r\nIK: <i>손님, 슬퍼하지 마세요! 쉬림프는 당신을 싫어하지 않는답니다.\r\n걔는 그냥... 배고플 뿐이에요.</i>\r\n\r\n";
				shrimpTerminalNode.creatureName = "쉬림프";
				shrimpTerminalKeyword.word = "쉬림프";
			}
			socketInteractPrefab.AddComponent<ElevatorSystem>();
			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.hungerAudio = ((Component)shrimpPrefab.transform.GetChild(0).GetChild(3).GetChild(2)).GetComponent<AudioSource>();
			shrimpEnemyAI.sprintAudio = ((Component)shrimpPrefab.transform.GetChild(0).GetChild(3).GetChild(3)).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;
			elevatorManager.AddComponent<ElevatorSystem>();
			officeRoundSystem.AddComponent<OfficeRoundSystem>();
			insideCollider.AddComponent<ElevatorSystem>();
			insideCollider.AddComponent<ElevatorCollider>();
			NetworkPrefabs.RegisterNetworkPrefab(shrimpPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(elevatorManager);
			NetworkPrefabs.RegisterNetworkPrefab(storagePrefab);
			NetworkPrefabs.RegisterNetworkPrefab(socketInteractPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(officeRoundSystem);
			NetworkPrefabs.RegisterNetworkPrefab(insideCollider);
			NetworkPrefabs.RegisterNetworkPrefab(glitchSound);
			Enemies.RegisterEnemy(shrimpEnemy, shrimpSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[LC_Office] Successfully loaded assets!");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(GrabbableObjectPatch));
			harmony.PatchAll(typeof(TerminalPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
		}

		private void Start()
		{
			if (Chainloader.PluginInfos.Keys.Any((string k) => k == "Chaos.Diversity"))
			{
				mls.LogInfo((object)"LC_Office found Diversity!");
				diversityIntergrated = true;
			}
		}
	}
}
namespace LCOffice.Patches
{
	public class PlaceableLungProp : MonoBehaviour
	{
	}
	public class PlaceLung : NetworkBehaviour
	{
		public static bool emergencyPowerRequires;

		public static bool emergencyCheck;

		public static bool lungPlaced;

		public static bool lungPlacedThisFrame;

		public static bool placeLungNetwork;
	}
	public class OfficeRoundSystem : NetworkBehaviour
	{
		public bool isOffice;

		public bool isChecked;

		public bool isDungeonOfficeChecked;

		public static List<GrabbableObject> droppedItems = new List<GrabbableObject>();

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

		public static AudioSource haltMusicAudio;

		public static Animator haltNoiseScreen;

		public static Animator playerScreenAnimator;

		public static OfficeRoundSystem Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		private void Start()
		{
			SceneManager.sceneLoaded += ResetStaticVariable;
			haltMusicAudio = Object.Instantiate<GameObject>(GameObject.Find("Music2")).GetComponent<AudioSource>();
			haltNoiseScreen = Object.Instantiate<GameObject>(Plugin.haltNoiseScreen, GameObject.Find("DebugMessagesPanel").transform).GetComponent<Animator>();
			playerScreenAnimator = ((Component)GameObject.Find("PlayerScreen").transform.parent).gameObject.AddComponent<Animator>();
			playerScreenAnimator.runtimeAnimatorController = Plugin.playerScreenParentController;
			playerScreenAnimator.SetLayerWeight(1, 0.8f);
			GameObject.Find("HaltTurnBackText").GetComponent<TMP_Text>().font = GameObject.Find("TipLeft1").GetComponent<TMP_Text>().font;
			((Object)haltMusicAudio).name = "HaltMusic";
		}

		private void LateUpdate()
		{
			if (!isChecked && TimeOfDay.Instance.currentDayTimeStarted && (Object)(object)RoundManager.Instance.dungeonGenerator != (Object)null)
			{
				if (((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name == "OfficeDungeonFlow")
				{
					isOffice = true;
				}
				else
				{
					isOffice = false;
				}
				if (!isDungeonOfficeChecked)
				{
					((MonoBehaviour)this).StartCoroutine(CheckOfficeElevator());
					if (isOffice && ((NetworkBehaviour)this).IsOwner)
					{
						GameObject val = Object.Instantiate<GameObject>(Plugin.insideCollider);
						NetworkObject component = val.GetComponent<NetworkObject>();
						component.Spawn(false);
					}
					isDungeonOfficeChecked = true;
				}
			}
			if (isChecked && !TimeOfDay.Instance.currentDayTimeStarted)
			{
				if (!isOffice || ((NetworkBehaviour)this).IsOwner)
				{
				}
				isOffice = false;
				isChecked = false;
				isDungeonOfficeChecked = false;
			}
		}

		private void ResetStaticVariable(Scene scene, LoadSceneMode mode)
		{
			PlaceLung.emergencyPowerRequires = false;
			PlaceLung.emergencyCheck = false;
			PlaceLung.lungPlaced = false;
			ElevatorSystem.elevatorFloor.Value = 1;
			ElevatorSystem.isElevatorClosed = false;
			ElevatorSystem.spawnShrimpBool.Value = false;
			ElevatorSystem.isSetupEnd = false;
		}

		private IEnumerator CheckOfficeElevator()
		{
			yield return (object)new WaitForSeconds(7f);
			isChecked = true;
			if ((Object)(object)GameObject.Find("HaltOriginalTile(Clone)") != (Object)null)
			{
				GameObject.Find("HaltOriginalTile(Clone)").AddComponent<HaltRoom>();
			}
			SetKorean();
		}

		private void SetKorean()
		{
			InteractTrigger[] array = Object.FindObjectsOfType<InteractTrigger>();
			InteractTrigger[] array2 = array;
			foreach (InteractTrigger val in array2)
			{
				if (Plugin.setKorean)
				{
					if (val.hoverTip == "Open : [LMB]")
					{
						val.hoverTip = "열기 : [LMB]";
					}
					else if (val.hoverTip == "Open : [E]")
					{
						val.hoverTip = "열기 : [E]";
					}
					if (val.hoverTip == "Use door : [LMB]")
					{
						val.hoverTip = "문 사용하기 : [LMB]";
					}
					else if (val.hoverTip == "Use door : [E]")
					{
						val.hoverTip = "문 사용하기 : [E]";
					}
					if (val.hoverTip == "Go to the 1st floor : [LMB]")
					{
						val.hoverTip = "1층으로 이동하기 : [LMB]";
					}
					else if (val.hoverTip == "Go to the 1st floor : [E]")
					{
						val.hoverTip = "1층으로 이동하기 : [E]";
					}
					if (val.hoverTip == "Go to the 2nd floor : [LMB]")
					{
						val.hoverTip = "2층으로 이동하기 : [LMB]";
					}
					else if (val.hoverTip == "Go to the 2nd floor : [E]")
					{
						val.hoverTip = "2층으로 이동하기 : [E]";
					}
					if (val.hoverTip == "Go to the 3rd floor : [LMB]")
					{
						val.hoverTip = "3층으로 이동하기 : [LMB]";
					}
					else if (val.hoverTip == "Go to the 3rd floor : [E]")
					{
						val.hoverTip = "3층으로 이동하기 : [E]";
					}
					if (val.hoverTip == "Place Apparatus : [LMB]")
					{
						val.hoverTip = "장치 설치하기 : [LMB]";
					}
					else if (val.hoverTip == "Place Apparatus : [E]")
					{
						val.hoverTip = "장치 설치하기 : [E]";
					}
					if (val.hoverTip == "Store item : [LMB]")
					{
						val.hoverTip = "아이템 보관하기 : [LMB]";
					}
					else if (val.hoverTip == "Store item : [E]")
					{
						val.hoverTip = "아이템 보관하기 : [E]";
					}
					if (val.hoverTip == "Climb : [LMB]")
					{
						val.hoverTip = "오르기 : [LMB]";
					}
					else if (val.hoverTip == "Climb : [E]")
					{
						val.hoverTip = "오르기 : [E]";
					}
					if (val.hoverTip == "Flush: [LMB]")
					{
						val.hoverTip = "물 내리기: [LMB]";
					}
					else if (val.hoverTip == "Flush: [E]")
					{
						val.hoverTip = "물 내리기: [E]";
					}
					if (val.disabledHoverTip == "[Not holding Apparatus]")
					{
						val.disabledHoverTip = "[장치를 들고 있지 않음]";
					}
				}
			}
		}
	}
	public class ShrimpEnemyAI : EnemyAI
	{
		public AISearchRoutine searchForItems;

		public AISearchRoutine searchForPlayer;

		public float hungerValue;

		public Transform mouthTransform;

		private Vector3 mouthOriginalScale;

		public AudioSource growlAudio;

		public AudioSource hungerAudio;

		public AudioSource sprintAudio;

		public bool inKillAnimation;

		public bool startingKillAnimationLocalClient;

		[Space(3f)]
		public float angryTimer;

		public GrabbableObject targetItem;

		public HoarderBugItem heldItem;

		private Light lungLight;

		[Header("Animations")]
		[Space(5f)]
		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)
		{
			SyncHungerValueClientRpc(value);
		}

		[ClientRpc]
		private void SyncHungerValueClientRpc(float value)
		{
			hungerValue = value;
		}

		private void SetVariables()
		{
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: 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);
			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 = "Gifting";
			list.Add(val3);
			base.enemyBehaviourStates = list.ToArray();
		}

		public override void Start()
		{
			//IL_00d8: 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)
			SetVariables();
			((EnemyAI)this).Start();
			growlAudio.volume = 0f;
			growlAudio.loop = true;
			growlAudio.clip = Plugin.enragedScream;
			growlAudio.pitch = 0f;
			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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: 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_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (!inKillAnimation)
				{
					base.movingTowardsTargetPlayer = false;
					if ((Object)(object)base.targetPlayer == (Object)null && !searchForPlayer.inProgress)
					{
						((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayer);
					}
					else if (hungerValue > 5f && (Object.op_Implicit((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(65f, 80, -1)) || (Object)(object)base.targetPlayer != (Object)null))
					{
						base.targetPlayer = ((EnemyAI)this).CheckLineOfSightForPlayer(65f, 80, -1);
						((EnemyAI)this).SwitchToBehaviourState(1);
					}
				}
				break;
			case 1:
			{
				if (inKillAnimation)
				{
					break;
				}
				if (hungerValue <= 5f)
				{
					((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 (OfficeRoundSystem.droppedItems.Count > 0)
					{
						GameObject val2 = ((EnemyAI)this).CheckLineOfSight(OfficeRoundSystem.droppedObjects, 60f, 40, 5f, (Transform)null, (int[])null);
						if (Object.op_Implicit((Object)(object)val2))
						{
							GrabbableObject component2 = val2.GetComponent<GrabbableObject>();
							if (Object.op_Implicit((Object)(object)component2) && !component2.isHeld && !component2.isPocketed && !component2.deactivated)
							{
								SetGoTowardsTargetObject(val2);
							}
						}
					}
					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(OfficeRoundSystem.droppedObjects, 160f, 40, 5f, (Transform)null, (int[])null) != (Object)null)
				{
					base.agent.stoppingDistance = 0f;
					base.movingTowardsTargetPlayer = false;
					if (OfficeRoundSystem.droppedItems.Count > 0)
					{
						GameObject val3 = ((EnemyAI)this).CheckLineOfSight(OfficeRoundSystem.droppedObjects, 160f, 40, 5f, (Transform)null, (int[])null);
						if (Object.op_Implicit((Object)(object)val3))
						{
							GrabbableObject component3 = val3.GetComponent<GrabbableObject>();
							if (Object.op_Implicit((Object)(object)component3) && !component3.isHeld && !component3.isPocketed && !component3.deactivated)
							{
								SetGoTowardsTargetObject(val3);
							}
						}
					}
				}
				else
				{
					base.agent.stoppingDistance = 4.5f;
					base.movingTowardsTargetPlayer = true;
				}
				PlayerControllerB val4 = ((EnemyAI)this).CheckLineOfSightForPlayer(65f, 80, -1);
				if ((Object)(object)val4 != (Object)null)
				{
					noticePlayerTimer = 0f;
				}
				else
				{
					noticePlayerTimer += 0.075f;
					if (noticePlayerTimer > 1.8f)
					{
						lostPlayerInChase = true;
					}
				}
				if (lostPlayerInChase)
				{
					((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(OfficeRoundSystem.droppedObjects, 160f, 40, 5f, (Transform)null, (int[])null) != (Object)null)
				{
					base.agent.stoppingDistance = 0f;
					base.movingTowardsTargetPlayer = false;
					if (OfficeRoundSystem.droppedItems.Count > 0)
					{
						GameObject val = ((EnemyAI)this).CheckLineOfSight(OfficeRoundSystem.droppedObjects, 160f, 40, 5f, (Transform)null, (int[])null);
						if (Object.op_Implicit((Object)(object)val))
						{
							GrabbableObject component = val.GetComponent<GrabbableObject>();
							if (Object.op_Implicit((Object)(object)component) && !component.isHeld && !component.isPocketed && !component.deactivated)
							{
								SetGoTowardsTargetObject(val);
							}
						}
					}
				}
				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)
					{
						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) && OfficeRoundSystem.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.inSpecialAnimation && !base.isEnemyDead && !StartOfRound.Instance.allPlayersDead)
			{
				if (detectPlayersInterval <= 0f)
				{
					detectPlayersInterval = 0.2f;
					DetectAndLookAtPlayers();
				}
				else
				{
					detectPlayersInterval -= Time.deltaTime;
				}
				ShrimpAnimationController();
				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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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 * 2f));
			velX = Mathf.Lerp(velX, agentLocalVelocity.x, 10f * Time.deltaTime);
			base.creatureAnimator.SetFloat("VelocityX", Mathf.Clamp(velX, 0f - maxSpeed, maxSpeed));
			velZ = Mathf.Lerp(velZ, agentLocalVelocity.z, 10f * Time.deltaTime);
			base.creatureAnimator.SetFloat("VelocityZ", Mathf.Clamp(velZ, 0f - maxSpeed, maxSpeed));
			previousPosition = ((Component)this).transform.position;
		}

		private void AnimateLooking()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			base.agent.angularSpeed = 100f;
			if ((Object)(object)targetItem != (Object)null)
			{
				lookTarget.position = ((Component)targetItem).transform.position;
				lookingAtPositionOfInterest = true;
			}
			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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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 (OfficeRoundSystem.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 ((Object)(object)watchingPlayer != (Object)(object)val)
				{
					RoundManager.PlayRandomClip(base.creatureVoice, chitterSFX, true, 1f, 0, 1000);
				}
				if (!((NetworkBehaviour)this).IsOwner)
				{
					return;
				}
				if (base.currentBehaviourStateIndex != 2)
				{
					if (IsHoarderBugAngry())
					{
						lostPlayerInChase = false;
						base.targetPlayer = watchingPlayer;
					}
				}
				else
				{
					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 > 15f) && 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 void ShrimpAnimationController()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			float num = footStepTime;
			float deltaTime = Time.deltaTime;
			Vector3 velocity = base.agent.velocity;
			footStepTime = num + deltaTime * ((Vector3)(ref velocity)).sqrMagnitude / 8f;
			Animator creatureAnimator = base.creatureAnimator;
			velocity = base.agent.velocity;
			creatureAnimator.SetFloat("walkSpeed", Mathf.Clamp(((Vector3)(ref velocity)).sqrMagnitude / 5f, 0f, 3f));
			Animator creatureAnimator2 = base.creatureAnimator;
			velocity = base.agent.velocity;
			creatureAnimator2.SetFloat("runSpeed", Mathf.Clamp(((Vector3)(ref velocity)).sqrMagnitude / 2.7f, 3f, 4f));
			if (footStepTime > 0.5f)
			{
				switch (Random.Range(0, 5))
				{
				case 0:
					base.creatureVoice.PlayOneShot(Plugin.footstep1, Random.Range(0.8f, 1f));
					break;
				case 1:
					base.creatureVoice.PlayOneShot(Plugin.footstep2, Random.Range(0.8f, 1f));
					break;
				case 2:
					base.creatureVoice.PlayOneShot(Plugin.footstep3, Random.Range(0.8f, 1f));
					break;
				case 3:
					base.creatureVoice.PlayOneShot(Plugin.footstep4, Random.Range(0.8f, 1f));
					break;
				}
				footStepTime = 0f;
			}
		}

		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_01f6: 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_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_0625: Unknown result type (might be due to invalid IL or missing references)
			//IL_062f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			timeSinceHittingPlayer += Time.deltaTime;
			timeSinceLookingTowardsNoise += Time.deltaTime;
			if (timeSinceLookingTowardsNoise > 0.6f && !Object.op_Implicit((Object)(object)CheckLineOfSightForItem(80f, 40)))
			{
				lookingAtPositionOfInterest = false;
			}
			if (base.inSpecialAnimation || base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			if ((Object)(object)base.targetPlayer != (Object)null && ((NetworkBehaviour)this).IsOwner)
			{
				SyncHungerValueServerRpc(hungerValue += Time.deltaTime);
			}
			if (hungerValue > 36f)
			{
				hungerAudio.volume = Mathf.Lerp(hungerAudio.volume, 1f, Time.deltaTime * 2f);
			}
			else
			{
				hungerAudio.volume = Mathf.Lerp(hungerAudio.volume, 0f, Time.deltaTime * 2f);
			}
			if (!(hungerValue > 40f))
			{
				growlAudio.volume = Mathf.Lerp(growlAudio.volume, 0f, Time.deltaTime * 5f);
			}
			if (hungerValue > 45f)
			{
				growlAudio.volume = Mathf.Lerp(growlAudio.volume, 1f, Time.deltaTime * 3f);
				growlAudio.pitch = Mathf.Lerp(growlAudio.pitch, 0.8f, Time.deltaTime * 5f);
				mouthTransform.localScale = Vector3.Lerp(mouthTransform.localScale, new Vector3(0.005590725f, 0.01034348f, 0.02495567f), 30f * Time.deltaTime);
			}
			else
			{
				growlAudio.volume = Mathf.Lerp(growlAudio.volume, 0f, Time.deltaTime * 3f);
				growlAudio.pitch = Mathf.Lerp(growlAudio.pitch, 0f, Time.deltaTime * 3f);
				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);
			}
			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 (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 (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:
				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 = 16f;
				}
				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_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			DropItemClientRpc(objectRef, targetFloorPosition, droppedInNest);
		}

		[ClientRpc]
		public void DropItemClientRpc(NetworkObjectReference objectRef, Vector3 targetFloorPosition, bool droppedInNest)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			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_0003: Unknown result type (might be due to invalid IL or missing references)
			EatItemClientRpc(objectRef);
		}

		[ClientRpc]
		public void EatItemClientRpc(NetworkObjectReference objectRef)
		{
			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 && OfficeRoundSystem.droppedObjects.Count != 0)
			{
				OfficeRoundSystem.droppedObjects.Add(((Component)itemGrabbableObject).gameObject);
			}
		}

		private void EatItem(NetworkObject item)
		{
			SyncHungerValueServerRpc(hungerValue - 70f);
			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)
		{
			if (!inKillAnimation)
			{
				inKillAnimation = true;
				KillPlayerAnimationClientRpc(playerObjectId);
			}
			else
			{
				CancelKillAnimationClientRpc(playerObjectId);
			}
		}

		[ClientRpc]
		public void KillPlayerAnimationClientRpc(int playerObjectId)
		{
			((MonoBehaviour)this).StartCoroutine(KillPlayerAnimation(playerObjectId));
		}

		[ClientRpc]
		public void CancelKillAnimationClientRpc(int playerObjectId)
		{
			if ((int)GameNetworkManager.Instance.localPlayerController.playerClientId == playerObjectId)
			{
				startingKillAnimationLocalClient = false;
			}
		}

		public IEnumerator KillPlayerAnimation(int playerId)
		{
			base.creatureSFX.PlayOneShot(Plugin.ripPlayerApart);
			base.agent.speed = 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(hungerValue - 85f);
			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;
			inKillAnimation = false;
		}

		[ServerRpc(RequireOwnership = false)]
		public void HitPlayerServerRpc()
		{
			HitPlayerClientRpc();
		}

		[ClientRpc]
		public void HitPlayerClientRpc()
		{
			if (!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)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, false, -1);
			Debug.Log((object)"HA");
		}

		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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			List<GrabbableObject> droppedItems = OfficeRoundSystem.droppedItems;
			for (int i = 0; i < droppedItems.Count; i++)
			{
				if (!droppedItems[i].grabbableToEnemies || !droppedItems[i].isHeld || OfficeRoundSystem.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_0021: 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_003f: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: 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_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: 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_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: 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_0266: 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)
				{
					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);
		}
	}
	public class ShrimpAI : EnemyAI
	{
		private Coroutine killPlayerAnimCoroutine;

		public float networkPosDistance;

		public Vector3 prevPosition;

		public float stuckDetectionTimer;

		public float prevPositionDistance;

		public AISearchRoutine roamMap = new AISearchRoutine();

		private Vector3 spawnPosition;

		public PlayerControllerB hittedPlayer;

		[PublicNetworkVariable]
		public static LethalNetworkVariable<int> SelectNode = new LethalNetworkVariable<int>("SelectNode");

		[PublicNetworkVariable]
		public static LethalNetworkVariable<float> shrimpVelocity = new LethalNetworkVariable<float>("shrimpVelocity");

		[PublicNetworkVariable]
		public static LethalNetworkVariable<float> hungerValue = new LethalNetworkVariable<float>("hungerValue");

		[PublicNetworkVariable]
		public static LethalNetworkVariable<bool> isHitted = new LethalNetworkVariable<bool>("isHitted");

		[PublicNetworkVariable]
		public static LethalNetworkVariable<Vector3> networkPosition = new LethalNetworkVariable<Vector3>("networkPosition");

		[PublicNetworkVariable]
		public static LethalNetworkVariable<Vector3> networkRotation = new LethalNetworkVariable<Vector3>("networkRotation");

		public static LethalNetworkVariable<ulong> networkTargetPlayer = new LethalNetworkVariable<ulong>("networkTargetPlayer");

		public static PlayerControllerB nearestPlayer;

		public static LethalNetworkVariable<bool> isNetworkTargetPlayer = new LethalNetworkVariable<bool>("isNetworkTargetPlayer");

		public bool isKillingPlayer;

		public bool isSeenPlayer;

		public bool isEnraging;

		public bool isAngered;

		public bool canBeMoved;

		public bool isRunning;

		public bool dogRandomWalk;

		public float footStepTime;

		public float randomVal;

		public bool isTargetAvailable;

		public float networkTargetPlayerDistance;

		public float nearestItemDistance;

		public bool isNearestItem;

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

		public GameObject nearestDroppedItem;

		public Transform dogHead;

		public Ray lookRay;

		public Transform lookTarget;

		public BoxCollider[] allBoxCollider;

		public Transform IdleTarget;

		public bool isIdleTargetAvailable;

		public bool forceChangeTarget;

		public Rig lookRig;

		public Light lungLight;

		public bool ateLung;

		public bool isSatisfied;

		public float satisfyValue;

		public Transform leftEye;

		public Transform rightEye;

		public Transform shrimpEye;

		public Transform mouth;

		public GameObject shrimpKillTrigger;

		public Transform bittenObjectHolder;

		public float searchingForObjectTimer;

		private Vector3 scaleOfEyesNormally;

		public AudioSource mainAudio;

		public AudioSource voiceAudio;

		public AudioSource voice2Audio;

		public AudioSource dogMusic;

		public AudioSource sprintAudio;

		public Vector3 originalMouthScale;

		public float scaredBackingAway;

		public Ray backAwayRay;

		private RaycastHit hitInfo;

		private RaycastHit hitInfoB;

		public float followTimer;

		public EnemyBehaviourState roamingState;

		public EnemyBehaviourState followingPlayer;

		public EnemyBehaviourState enragedState;

		public List<EnemyBehaviourState> tempEnemyBehaviourStates;

		public List<SkinnedMeshRenderer> skinnedMeshRendererList;

		public List<MeshRenderer> meshRendererList;

		private float timeSinceLookingAtNoise;

		private Vector3 lookAtNoise;

		private void Awake()
		{
			base.agent = ((Component)this).GetComponent<NavMeshAgent>();
		}

		public override void Start()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//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)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Expected O, but got Unknown
			Object.Destroy((Object)(object)((Component)this).GetComponent<ShrimpAI>());
			isNetworkTargetPlayer.Value = false;
			SelectNode.Value = 0;
			shrimpVelocity.Value = 0f;
			hungerValue.Value = 0f;
			isHitted.Value = false;
			base.enemyType = Plugin.shrimpEnemy;
			base.skinnedMeshRenderers = ((Component)this).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
			base.meshRenderers = ((Component)this).gameObject.GetComponentsInChildren<MeshRenderer>();
			base.thisNetworkObject = ((Component)this).gameObject.GetComponentInChildren<NetworkObject>();
			base.serverPosition = ((Component)this).transform.position;
			base.thisEnemyIndex = RoundManager.Instance.numberOfEnemiesInScene;
			RoundManager instance = RoundManager.Instance;
			instance.numberOfEnemiesInScene++;
			base.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
			base.path1 = new NavMeshPath();
			mouth = GameObject.Find("ShrimpMouth").transform;
			leftEye = GameObject.Find("ShrimpLeftEye").transform;
			rightEye = GameObject.Find("ShrimpRightEye").transform;
			shrimpKillTrigger = GameObject.Find("ShrimpKillTrigger");
			base.creatureAnimator = ((Component)((Component)this).transform.GetChild(0).GetChild(1)).gameObject.GetComponent<Animator>();
			base.creatureAnimator.SetTrigger("Walk");
			mainAudio = GameObject.Find("ShrimpMainAudio").GetComponent<AudioSource>();
			voiceAudio = GameObject.Find("ShrimpGrowlAudio").GetComponent<AudioSource>();
			voice2Audio = GameObject.Find("ShrimpAngerAudio").GetComponent<AudioSource>();
			lookRig = GameObject.Find("ShrimpLookAtPlayer").GetComponent<Rig>();
			lungLight = GameObject.Find("LungFlash").GetComponent<Light>();
			lungLight.intensity = 0f;
			AudioSource[] componentsInChildren = ((Component)((Component)this).transform).GetComponentsInChildren<AudioSource>();
			AudioSource[] array = componentsInChildren;
			foreach (AudioSource val in array)
			{
				val.outputAudioMixerGroup = GameObject.Find("StatusEffectAudio").GetComponent<AudioSource>().outputAudioMixerGroup;
			}
			lookTarget = GameObject.Find("Shrimp_Look_target").transform;
			dogHead = GameObject.Find("ShrimpLookPoint").transform;
			bittenObjectHolder = GameObject.Find("BittenObjectHolder").transform;
			shrimpEye = GameObject.Find("ShrimpEye").transform;
			scaleOfEyesNormally = leftEye.localScale;
			originalMouthScale = mouth.localScale;
			voice2Audio.clip = Plugin.dogSprint;
			voice2Audio.Play();
			base.creatureVoice = voice2Audio;
			base.creatureSFX = voice2Audio;
			base.eye = shrimpEye;
			SetupBehaviour();
			tempEnemyBehaviourStates.Add(roamingState);
			tempEnemyBehaviourStates.Add(followingPlayer);
			tempEnemyBehaviourStates.Add(enragedState);
			base.enemyBehaviourStates = tempEnemyBehaviourStates.ToArray();
			spawnPosition = ((Component)this).transform.position;
			roamMap = new AISearchRoutine();
			ItemElevatorCheck[] array2 = Object.FindObjectsOfType<ItemElevatorCheck>();
			ItemElevatorCheck[] array3 = array2;
			foreach (ItemElevatorCheck itemElevatorCheck in array3)
			{
			}
			if (Plugin.setKorean)
			{
				((Component)((Component)this).transform.GetChild(1)).GetComponent<ScanNodeProperties>().headerText = "쉬림프";
			}
			ShrimpAI[] array4 = Object.FindObjectsOfType<ShrimpAI>();
			ShrimpAI[] array5 = array4;
			foreach (ShrimpAI shrimpAI in array5)
			{
				if ((Object)(object)shrimpAI != (Object)(object)this)
				{
					Object.Destroy((Object)(object)((Component)shrimpAI).gameObject);
				}
			}
		}

		public IEnumerator stunnedTimer(PlayerControllerB playerWhoHit)
		{
			if (!(scaredBackingAway > 0f))
			{
				isHitted.Value = false;
				hittedPlayer = playerWhoHit;
				base.agent.speed = 0f;
				base.creatureAnimator.SetTrigger("Recoil");
				mainAudio.PlayOneShot(Plugin.cry1, 1f);
				yield return (object)new WaitForSeconds(0.5f);
				scaredBackingAway = 2f;
				yield return (object)new WaitForSeconds(2f);
				hittedPlayer = null;
			}
		}

		private void StunTest()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			if (scaredBackingAway > 0f)
			{
				if (((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner)
				{
					lookTarget.position = Vector3.Lerp(lookTarget.position, ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, true, 0, false, 50, false).position, 10f * Time.deltaTime);
					base.agent.SetDestination(((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, true, 0, false, 50, false).position);
				}
				scaredBackingAway -= Time.deltaTime;
			}
		}

		public void FootStepSound()
		{
			randomVal = Random.Range(0, 5);
			float num = randomVal;
			float num2 = num;
			if (num2 != 0f)
			{
				if (num2 != 1f)
				{
					if (num2 != 2f)
					{
						if (num2 == 3f)
						{
							mainAudio.PlayOneShot(Plugin.footstep4, Random.Range(0.8f, 1f));
						}
					}
					else
					{
						mainAudio.PlayOneShot(Plugin.footstep3, Random.Range(0.8f, 1f));
					}
				}
				else
				{
					mainAudio.PlayOneShot(Plugin.footstep2, Random.Range(0.8f, 1f));
				}
			}
			else
			{
				mainAudio.PlayOneShot(Plugin.footstep1, Random.Range(0.8f, 1f));
			}
		}

		private IEnumerator DogSatisfied()
		{
			canBeMoved = false;
			yield return (object)new WaitForSeconds(1f);
			if (!isKillingPlayer)
			{
				mainAudio.PlayOneShot(Plugin.dogSatisfied);
				base.creatureAnimator.SetTrigger("PlayBow");
			}
			yield return (object)new WaitForSeconds(2f);
			canBeMoved = true;
			isNetworkTargetPlayer.Value = false;
		}

		public override void Update()
		{
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: 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_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0777: Unknown result type (might be due to invalid IL or missing references)
			//IL_078d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0792: Unknown result type (might be due to invalid IL or missing references)
			//IL_0796: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0835: Unknown result type (might be due to invalid IL or missing references)
			//IL_083f: Unknown result type (might be due to invalid IL or missing references)
			//IL_084f: Unknown result type (might be due to invalid IL or missing references)
			//IL_080a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0867: Unknown result type (might be due to invalid IL or missing references)
			//IL_086c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0870: Unknown result type (might be due to invalid IL or missing references)
			//IL_087a: Unknown result type (might be due to invalid IL or missing references)
			//IL_088a: Unknown result type (might be due to invalid IL or missing references)
			//IL_088f: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0903: Unknown result type (might be due to invalid IL or missing references)
			//IL_0913: Unknown result type (might be due to invalid IL or missing references)
			//IL_092a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0930: Unknown result type (might be due to invalid IL or missing references)
			//IL_0940: Unknown result type (might be due to invalid IL or missing references)
			//IL_0976: Unknown result type (might be due to invalid IL or missing references)
			//IL_097c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0986: Unknown result type (might be due to invalid IL or missing references)
			//IL_0996: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0618: Unknown result type (might be due to invalid IL or missing references)
			//IL_0664: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_066f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0674: Unknown result type (might be due to invalid IL or missing references)
			//IL_0676: Unknown result type (might be due to invalid IL or missing references)
			//IL_067e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_0687: Unknown result type (might be due to invalid IL or missing references)
			//IL_0693: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_070d: Unknown result type (might be due to invalid IL or missing references)
			timeSinceLookingAtNoise += Time.deltaTime;
			footStepTime += Time.deltaTime * shrimpVelocity.Value / 8f;
			if (footStepTime > 0.5f)
			{
				FootStepSound();
				footStepTime = 0f;
			}
			if (!isSatisfied)
			{
				CheckPlayer();
			}
			base.creatureAnimator.SetFloat("walkSpeed", Mathf.Clamp(shrimpVelocity.Value / 5f, 0f, 3f));
			base.creatureAnimator.SetFloat("runSpeed", Mathf.Clamp(shrimpVelocity.Value / 2.7f, 3f, 4f));
			SetByHunger();
			if (isNetworkTargetPlayer.Value)
			{
				EatItem();
			}
			if (!isSatisfied)
			{
				CheckTargetAvailable();
			}
			if (isHitted.Value)
			{
				((MonoBehaviour)this).StartCoroutine(stunnedTimer(LethalNetworkExtensions.GetPlayerController(networkTargetPlayer.Value)));
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				((EnemyAI)this).SyncPositionToClients();
			}
			else
			{
				((EnemyAI)this).SetClientCalculatingAI(false);
			}
			if (ateLung)
			{
				lungLight.intensity = Mathf.Lerp(lungLight.intensity, 1500f, Time.deltaTime * 10f);
			}
			if (satisfyValue >= 21f && !isSatisfied)
			{
				((MonoBehaviour)this).StartCoroutine(DogSatisfied());
				isSatisfied = true;
			}
			if (isSatisfied && satisfyValue > 0f)
			{
				satisfyValue