Decompiled source of Chocobo Getaway Interiors v1.0.0

plugins/DungeonBasement.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using LethalConfig;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DungeonBasement")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DungeonBasement")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6224a905-0b6f-4435-9bcf-5428e5d05717")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DungeonBasement;

public class Patch
{
	public static void Activate()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		string location = Assembly.GetExecutingAssembly().Location;
		string filePath = Path.Combine(Path.GetDirectoryName(location), "basement.png");
		Texture2D val = LoadTexture(filePath);
		Sprite modIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero);
		LethalConfigManager.SetModIcon(modIcon);
		LethalConfigManager.SetModDescription("This is the config for the Scarlet Devil Mansion's Basement dungeon variant.");
	}

	private static Texture2D LoadTexture(string FilePath)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		if (File.Exists(FilePath))
		{
			byte[] array = File.ReadAllBytes(FilePath);
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			return val;
		}
		return null;
	}
}
[BepInPlugin("dev.ladyalice.scarletmansion.basement", "Scarlet Basement", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	public const string modGUID = "dev.ladyalice.scarletmansion.basement";

	private const string modName = "Scarlet Basement";

	private const string modVersion = "1.0.0";

	public const string targetModGUID = "ainavt.lc.lethalconfig";

	public const string targetModVersion = "1.4.2";

	public readonly Harmony harmony = new Harmony("dev.ladyalice.scarletmansion.basement");

	public static ManualLogSource logger { get; internal set; }

	private void Awake()
	{
		logger = Logger.CreateLogSource("dev.ladyalice.scarletmansion.basement");
		logger.LogInfo((object)"Plugin Scarlet Basement has been added!");
		if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"))
		{
			PluginInfo val = Chainloader.PluginInfos["ainavt.lc.lethalconfig"];
			Version version = val.Metadata.Version;
			bool flag;
			if (string.IsNullOrWhiteSpace("1.4.2"))
			{
				flag = true;
			}
			else
			{
				Version version2 = new Version("1.4.2");
				flag = version >= version2;
			}
			if (flag)
			{
				logger.LogInfo((object)"Lethal config compability patch added!");
				Patch.Activate();
			}
		}
	}
}

plugins/DungeonFoyer.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using LethalConfig;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DungeonFoyer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DungeonFoyer")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a0e41aed-7c98-4a4d-b09b-1e59375420d9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DungeonFoyer;

public class Patch
{
	public static void Activate()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		string location = Assembly.GetExecutingAssembly().Location;
		string filePath = Path.Combine(Path.GetDirectoryName(location), "foyer.png");
		Texture2D val = LoadTexture(filePath);
		Sprite modIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero);
		LethalConfigManager.SetModIcon(modIcon);
		LethalConfigManager.SetModDescription("This is the config for the Scarlet Devil Mansion's Foyer dungeon variant.");
	}

	private static Texture2D LoadTexture(string FilePath)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		if (File.Exists(FilePath))
		{
			byte[] array = File.ReadAllBytes(FilePath);
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			return val;
		}
		return null;
	}
}
[BepInPlugin("dev.ladyalice.scarletmansion.foyer", "Scarlet Foyer", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	public const string modGUID = "dev.ladyalice.scarletmansion.foyer";

	private const string modName = "Scarlet Foyer";

	private const string modVersion = "1.0.0";

	public const string targetModGUID = "ainavt.lc.lethalconfig";

	public const string targetModVersion = "1.4.2";

	public readonly Harmony harmony = new Harmony("dev.ladyalice.scarletmansion.foyer");

	public static ManualLogSource logger { get; internal set; }

	private void Awake()
	{
		logger = Logger.CreateLogSource("dev.ladyalice.scarletmansion.foyer");
		logger.LogInfo((object)"Plugin Scarlet Foyer has been added!");
		if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"))
		{
			PluginInfo val = Chainloader.PluginInfos["ainavt.lc.lethalconfig"];
			Version version = val.Metadata.Version;
			bool flag;
			if (string.IsNullOrWhiteSpace("1.4.2"))
			{
				flag = true;
			}
			else
			{
				Version version2 = new Version("1.4.2");
				flag = version >= version2;
			}
			if (flag)
			{
				logger.LogInfo((object)"Lethal config compability patch added!");
				Patch.Activate();
			}
		}
	}
}

plugins/LCOffice.dll

Decompiled 7 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.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);
			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");
			socketInteractPrefab.AddComponent<ElevatorSystem>();
			officeRoundSystem.AddComponent<OfficeRoundSystem>();
			insideCollider.AddComponent<ElevatorSystem>();
			insideCollider.AddComponent<ElevatorCollider>();
			NetworkPrefabs.RegisterNetworkPrefab(elevatorManager);
			NetworkPrefabs.RegisterNetworkPrefab(storagePrefab);
			NetworkPrefabs.RegisterNetworkPrefab(socketInteractPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(officeRoundSystem);
			NetworkPrefabs.RegisterNetworkPrefab(insideCollider);
			NetworkPrefabs.RegisterNetworkPrefab(glitchSound);
			((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 -= Time.deltaTime;
				isSeenPlayer = false;
			}
			if (satisfyValue <= 0f && isSatisfied)
			{
				isSatisfied = false;
				droppedItems.Clear();
				satisfyValue = 0f;
			}
			if (!isNetworkTargetPlayer.Value && !isNearestItem && (Object)(object)base.targetNode == (Object)null)
			{
				int num = Random.Range(1, base.allAINodes.Length);
				if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[num].transform.position) > 5f && SelectNode.Value != num && ((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsOwner)
				{
					SelectNode.Value = num;
				}
			}
			else if (!isNetworkTargetPlayer.Value && !isNearestItem && (Object)(object)base.targetNode != (Object)null)
			{
				int num2 = Random.Range(1, base.allAINodes.Length);
				if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[SelectNode.Value].transform.position) < 1f && SelectNode.Value != num2 && ((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsOwner)
				{
					SelectNode.Value = num2;
				}
			}
			if (stuckDetectionTimer > 3.5f)
			{
				int num3 = Random.Range(1, base.allAINodes.Length);
				if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[num3].transform.position) > 5f && SelectNode.Value != num3)
				{
					if (((NetworkBehaviour)this).IsOwner)
					{
						SelectNode.Value = num3;
					}
					stuckDetectionTimer = 0f;
				}
				else if (Vector3.Distance(((Component)this).transform.position, base.allAINodes[num3].transform.position) > 5f)
				{
					stuckDetectionTimer = 0f;
				}
			}
			Vector3 velocity;
			if ((!isNetworkTargetPlayer.Value && !isNearestItem) || isSatisfied)
			{
				if (timeSinceLookingAtNoise < 2f && scaredBackingAway <= 0f && !isNetworkTargetPlayer.Value && !isSatisfied)
				{
					lookRig.weight = Mathf.Lerp(lookRig.weight, 1f, Time.deltaTime);
					lookTarget.position = Vector3.Lerp(lookTarget.position, lookAtNoise, 10f * Time.deltaTime * 10f);
					if (((NetworkBehaviour)this).IsOwner)
					{
						Vector3 val = lookTarget.position - ((Component)this).transform.position;
						((Vector3)(ref val)).Normalize();
						((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(val), 8f * Time.deltaTime);
					}
				}
				else if (scaredBackingAway <= 0f)
				{
					lookRig.weight = Mathf.Lerp(lookRig.weight, 0f, Time.deltaTime);
				}
				if ((Object)(object)base.targetNode != (Object)null)
				{
					if (((Behaviour)base.agent).enabled && ((NetworkBehaviour)this).IsOwner)
					{
						base.agent.SetDestination(base.targetNode.position);
					}
					if (shrimpVelocity.Value < 0.5f)
					{
						stuckDetectionTimer += Time.deltaTime;
					}
					else
					{
						stuckDetectionTimer = 0f;
					}
					Vector3 val2 = ((Component)this).transform.position - prevPosition;
					velocity = base.agent.velocity;
					float num4 = Vector3.Angle(val2, ((Vector3)(ref velocity)).normalized);
					velocity = base.agent.velocity;
					if (Vector3.Angle(val2, ((Vector3)(ref velocity)).normalized) > 30f)
					{
						Plugin.mls.LogInfo((object)("angle diff: " + num4 + ", " + "30" + " rad."));
					}
					prevPosition = ((Component)this).transform.position;
				}
			}
			base.targetNode = base.allAINodes[SelectNode.Value].transform;
			if (isNetworkTargetPlayer.Value || isNearestItem)
			{
				dogRandomWalk = false;
				stuckDetectionTimer = 0f;
			}
			Quaternion rotation;
			if (((NetworkBehaviour)this).IsOwner)
			{
				networkPosition.Value = ((Component)this).transform.position;
				LethalNetworkVariable<Vector3> obj = networkRotation;
				rotation = ((Component)this).transform.rotation;
				obj.Value = ((Quaternion)(ref rotation)).eulerAngles;
				LethalNetworkVariable<float> obj2 = shrimpVelocity;
				velocity = base.agent.velocity;
				obj2.Value = ((Vector3)(ref velocity)).sqrMagnitude;
			}
			else
			{
				networkPosDistance = Vector3.Distance(((Component)this).transform.position, networkPosition.Value);
				if (networkPosDistance > 3f)
				{
					((Component)this).transform.position = networkPosition.Value;
					Plugin.mls.LogWarning((object)"Force the shrimp to change position.");
				}
				else
				{
					((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, networkPosition.Value, Time.deltaTime * 10f);
				}
				Transform transform = ((Component)this).transform;
				rotation = ((Component)this).transform.rotation;
				transform.rotation = Quaternion.Euler(Vector3.Lerp(((Quaternion)(ref rotation)).eulerAngles, networkRotation.Value, Time.deltaTime * 10f));
				if (networkPosDistance > 15f)
				{
					Plugin.mls.LogFatal((object)"Shrimp spawned successfully, but the current position is VERY far from the network position. This error typically occurs when network quality is low or the server is experiencing heavy traffic.");
				}
			}
			if (isNetworkTargetPlayer.Value)
			{
				isTargetAvailable = true;
			}
			if (hungerValue.Value < 55f)
			{
				leftEye.localScale = Vector3.Lerp(leftEye.localScale, scaleOfEyesNormally, 20f * Time.deltaTime);
				rightEye.localScale = Vector3.Lerp(rightEye.localScale, scaleOfEyesNormally, 20f * Time.deltaTime);
			}
			else if (hungerValue.Value > 55f)
			{
				leftEye.localScale = Vector3.Lerp(leftEye.localScale, scaleOfEyesNormally * 0.4f, 20f * Time.deltaTime);
				rightEye.localScale = Vector3.Lerp(rightEye.localScale, scaleOfEyesNormally * 0.4f, 20f * Time.deltaTime);
			}
			base.creatureAnimator.SetBool("DogRandomWalk", dogRandomWalk);
			if (!isRunning)
			{
				if (canBeMoved)
				{
					base.creatureAnimator.SetBool("Running", false);
					base.agent.speed = 5.5f;
					base.agent.acceleration = 7f;
					base.agent.angularSpeed = 150f;
				}
				else
				{
					base.creatureAnimator.SetBool("Running", false);
					base.agent.speed = 0f;
					base.agent.angularSpeed = 0f;
				}
			}
			else
			{
				base.creatureAnimator.SetBool("Running", true);
				base.agent.speed = Mathf.Lerp(base.agent.speed, 15f, Time.deltaTime * 2f);
				base.agent.angularSpeed = 10000f;
				base.agent.acceleration = 50f;
			}
			StunTest();
		}

		private IEnumerator SyncRotation()
		{
			Transform transform = ((Component)this).transform;
			Quaternion rotation = ((Component)this

plugins/ScarletMansion.dll

Decompiled 7 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
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 DunGen.Tags;
using DunGenPlus;
using DunGenPlus.Collections;
using DunGenPlus.Components.Scripting;
using DunGenPlus.Managers;
using DungeonBasement;
using DungeonFoyer;
using FacilityMeltdown.API;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalConfig.MonoBehaviours;
using LethalLevelLoader;
using LethalLib.Modules;
using OdinSerializer;
using ReservedItemSlotCore.Data;
using ScarletMansion.Configs;
using ScarletMansion.DunGenPatch;
using ScarletMansion.GamePatch;
using ScarletMansion.GamePatch.Components;
using ScarletMansion.GamePatch.Components.TreasureRoom;
using ScarletMansion.GamePatch.Enemies;
using ScarletMansion.GamePatch.FixValues;
using ScarletMansion.GamePatch.Items;
using ScarletMansion.GamePatch.Managers;
using ScarletMansion.GamePatch.Props;
using ScarletMansion.Lights;
using ScarletMansion.ModPatch;
using ScarletMansion.NetcodePatcher;
using TMPro;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ScarletMansion")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScarletMansion")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d7e169df-3f43-44b0-a300-c23b9aa44d48")]
[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: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace ScarletMansion
{
	public static class Assets
	{
		public class Enemy
		{
			public GameObject enemy;

			public EnemyType enemyType;

			public Func<int> rarityFunc;

			public TerminalNode terminalNode;

			public TerminalKeyword terminalKeyword;

			public Enemy(GameObject enemy, TerminalNode node, TerminalKeyword keyword)
			{
				this.enemy = enemy;
				terminalNode = node;
				terminalKeyword = keyword;
			}

			public SpawnableEnemyWithRarity GetItemEntry(int rarity)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				SpawnableEnemyWithRarity val = new SpawnableEnemyWithRarity();
				val.enemyType = enemyType;
				val.rarity = rarity;
				return val;
			}
		}

		public class GlobalItem
		{
			public Item item;

			private int _itemId;

			public Func<ConfigItem> configItemEntryFunc;

			public int itemId
			{
				get
				{
					if (_itemId == -1 && Object.op_Implicit((Object)(object)StartOfRound.Instance))
					{
						string text = (Object.op_Implicit((Object)(object)item) ? item.itemName : "NULL");
						_itemId = Utility.GetGlobalItemId(item);
						if (_itemId != -1)
						{
							Plugin.logger.LogWarning((object)$"Cached {_itemId} itemId for item {text}");
							return _itemId;
						}
						Plugin.logger.LogWarning((object)("Tried to get itemId for item " + text + " but failed"));
					}
					return _itemId;
				}
				set
				{
					_itemId = value;
				}
			}

			public GlobalItem(Item item, Func<ConfigItem> configItemEntryFunc)
			{
				this.item = item;
				_itemId = -1;
				this.configItemEntryFunc = configItemEntryFunc;
			}

			public ConfigItem GetConfigItemEntry()
			{
				return configItemEntryFunc();
			}
		}

		public class ScrapItem : GlobalItem
		{
			public Func<ConfigScrapItem> configScrapItemEntryFunc;

			public bool SpawnsOnMap => configScrapItemEntryFunc != null;

			public ScrapItem(Item item, Func<ConfigScrapItem> configScrapItemEntryFunc)
				: base(item, configScrapItemEntryFunc)
			{
				this.configScrapItemEntryFunc = configScrapItemEntryFunc;
			}

			public void UpdateItemValue()
			{
				if (SpawnsOnMap)
				{
					ConfigScrapItem configScrapItemEntry = GetConfigScrapItemEntry();
					item.minValue = configScrapItemEntry.valueRange.min;
					item.maxValue = configScrapItemEntry.valueRange.max;
				}
			}

			public SpawnableItemWithRarity GetItemRarity()
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Expected O, but got Unknown
				ConfigScrapItem configScrapItemEntry = GetConfigScrapItemEntry();
				SpawnableItemWithRarity val = new SpawnableItemWithRarity();
				val.spawnableItem = item;
				val.rarity = configScrapItemEntry?.spawnWeight ?? 0;
				return val;
			}

			public ConfigScrapItem GetConfigScrapItemEntry()
			{
				return configScrapItemEntryFunc();
			}
		}

		public class Flashlight : GlobalItem
		{
			public string assetName;

			public string displayName;

			public Item lethalVanillaItem;

			public int lethalHelmetIndex = -1;

			public int scarletHelmetIndex = -1;

			public Flashlight(string baseName, int lethalHelmetIndex, Func<ConfigItem> configEntryFunc)
				: base(null, configEntryFunc)
			{
				assetName = "Scarlet" + baseName;
				displayName = "D. " + baseName;
				this.lethalHelmetIndex = lethalHelmetIndex;
			}

			public bool ContainsItemCheckConfig(Item compareItem)
			{
				if (!GetConfigItemEntry().enabled)
				{
					return false;
				}
				return ContainsItem(compareItem);
			}

			public bool ContainsItem(Item compareItem)
			{
				return (Object)(object)compareItem == (Object)(object)item || (Object)(object)compareItem == (Object)(object)lethalVanillaItem;
			}
		}

		public static ActionList onAssetsLoadEvent = new ActionList("onAssetsLoad");

		public static ActionList<CoronerParameters> onPlayerDeath = new ActionList<CoronerParameters>("onPlayerDeath");

		private const string mainAssetBundleName = "scarletmansion";

		public static AssetBundle MainAssetBundle = null;

		public static ExtendedMod extendedMod;

		public static NetworkObjectListScriptableObject networkObjectList;

		public static AudioClip entranceAudioClip;

		public static Enemy knight;

		public static Enemy maid;

		public static List<GlobalItem> globalItems;

		public static List<ScrapItem> scrapItems;

		public static Dictionary<string, Func<ConfigScrapItem>> itemConfigTable = new Dictionary<string, Func<ConfigScrapItem>>
		{
			{
				"Deco. crystal",
				() => SyncedInstance<ConfigMain>.Instance.crystalValue
			},
			{
				"Shattered deco. crystal",
				() => SyncedInstance<ConfigMain>.Instance.crystalBrokenValue
			},
			{
				"Doll Snow Globe",
				() => SyncedInstance<ConfigMain>.Instance.snowGlobeValue
			},
			{
				"Gohei",
				() => SyncedInstance<ConfigMain>.Instance.goheiValue
			}
		};

		public static GlobalItem key;

		public static Flashlight flashlight;

		public static Flashlight flashlightBB;

		public static ItemGroup genericItemGroup;

		public static ItemGroup tabletopItemGroup;

		public static ItemGroup smallItemGroup;

		public static bool dungeonMapHazardFound;

		public static GameObject dungeonTurretMapHazard;

		public static GameObject dungeonMinesMapHazard;

		public static GameObject dungeonSpikeTrapMapHazard;

		public static Sprite hoverIcon;

		private static ManualLogSource logger => Plugin.logger;

		public static GlobalItem GetGlobalItem(Item item)
		{
			return globalItems.FirstOrDefault((GlobalItem x) => (Object)(object)x.item == (Object)(object)item);
		}

		public static Flashlight GetFlashlight(Item item)
		{
			if (flashlight.ContainsItem(item))
			{
				return flashlight;
			}
			if (flashlightBB.ContainsItem(item))
			{
				return flashlightBB;
			}
			return null;
		}

		public static Flashlight GetFlashlightCheckConfig(Item item)
		{
			if (flashlight.ContainsItemCheckConfig(item))
			{
				return flashlight;
			}
			if (flashlightBB.ContainsItemCheckConfig(item))
			{
				return flashlightBB;
			}
			return null;
		}

		public static void LoadAssetBundle()
		{
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
				if (manifestResourceNames.Length >= 1)
				{
					string text = manifestResourceNames[0];
					using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text);
					Plugin.logger.LogDebug((object)("Loading resource " + text));
					MainAssetBundle = AssetBundle.LoadFromStream(stream);
				}
			}
			Plugin.ConfigFoyer.dungeon = Assets.Load<DungeonFlow>("sdmFoyer", onlyReportErrors: true);
			Plugin.ConfigFoyer.dunGenExtender = Assets.Load<DunGenExtender>("foyerExtender", onlyReportErrors: true);
			Plugin.ConfigBasement.dungeon = Assets.Load<DungeonFlow>("sdmBasement", onlyReportErrors: true);
			Plugin.ConfigBasement.dunGenExtender = Assets.Load<DunGenExtender>("basementExtender", onlyReportErrors: true);
			networkObjectList = Assets.Load<NetworkObjectListScriptableObject>("SDMList", onlyReportErrors: true);
			entranceAudioClip = Assets.Load<AudioClip>("entrance_ogg", onlyReportErrors: true);
			knight = new Enemy(Assets.Load<GameObject>("NET_KnightEnemy", onlyReportErrors: true), Assets.Load<TerminalNode>("KnightNode", onlyReportErrors: true), Assets.Load<TerminalKeyword>("KnightKeyword", onlyReportErrors: true));
			maid = new Enemy(Assets.Load<GameObject>("NET_MaidEnemy", onlyReportErrors: true), Assets.Load<TerminalNode>("MaidNode", onlyReportErrors: true), Assets.Load<TerminalKeyword>("MaidKeyword", onlyReportErrors: true));
			RegisterNetworkPrefab(networkObjectList.networkDungeon);
			RegisterNetworkPrefab(networkObjectList.networkDoors);
			RegisterNetworkPrefab(networkObjectList.networkItems);
			RegisterNetworkPrefab(networkObjectList.networkFrames);
			RegisterNetworkPrefab(networkObjectList.networkOther);
			globalItems = new List<GlobalItem>();
			scrapItems = new List<ScrapItem>();
			foreach (Item scrapItem in networkObjectList.scrapItems)
			{
				Func<ConfigScrapItem> itemConfigFunction = GetItemConfigFunction(scrapItem);
				ScrapItem item = new ScrapItem(scrapItem, itemConfigFunction);
				scrapItems.Add(item);
				globalItems.Add(item);
				Items.RegisterScrap(scrapItem, 0, (LevelTypes)1);
				NetworkPrefabs.RegisterNetworkPrefab(scrapItem.spawnPrefab);
				Plugin.logger.LogDebug((object)("Scrap Item " + scrapItem.itemName + " registered"));
			}
			key = new GlobalItem(networkObjectList.items[0], () => SyncedInstance<ConfigMain>.Instance.scarletKeyValue);
			globalItems.Add(key);
			Items.RegisterItem(key.item);
			flashlight = new Flashlight("Pro Flashlight", 0, () => SyncedInstance<ConfigMain>.Instance.decoProFlashlightValue);
			flashlightBB = new Flashlight("Flashlight", 1, () => SyncedInstance<ConfigMain>.Instance.decoFlashlightValue);
			globalItems.Add(flashlight);
			globalItems.Add(flashlightBB);
			foreach (EnemyType enemy in networkObjectList.enemies)
			{
				Enemies.RegisterEnemy(enemy, 0, (LevelTypes)1, (TerminalNode)null, (TerminalKeyword)null);
				NetworkPrefabs.RegisterNetworkPrefab(enemy.enemyPrefab);
			}
			onAssetsLoadEvent.Call();
		}

		public static Func<ConfigScrapItem> GetItemConfigFunction(Item item)
		{
			string itemName = item.itemName;
			if (itemConfigTable.TryGetValue(itemName, out var value))
			{
				return value;
			}
			return null;
		}

		private static void RegisterNetworkPrefab(List<GameObject> list)
		{
			foreach (GameObject item in list)
			{
				NetworkPrefabs.RegisterNetworkPrefab(item);
			}
		}

		public static T Load<T>(string name, bool onlyReportErrors = true) where T : Object
		{
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				logger.LogError((object)"Trying to load in asset but asset bundle is missing");
				return default(T);
			}
			T val = MainAssetBundle.LoadAsset<T>(name);
			bool flag = (Object)(object)val == (Object)null;
			if (flag || onlyReportErrors)
			{
				logger.LogDebug((object)("Loading asset " + name));
			}
			if (flag)
			{
				logger.LogError((object)"...but it was not found");
			}
			return val;
		}
	}
	public class FloorCleanup : MonoBehaviour
	{
		[Serializable]
		public class State
		{
			public int value;

			public Material material;

			public float rotation;
		}

		[Header("References")]
		public MeshRenderer targetRenderer;

		public GameObject targerGameObject;

		public int bitValueCheck;

		[Header("Logic")]
		public GameObject[] neighbors;

		public int[] stateValues;

		public Material[] stateMaterials;

		public float[] stateRotations;

		public State[] states;

		private void Reset()
		{
			targetRenderer = ((Component)this).GetComponent<MeshRenderer>();
			targerGameObject = ((Component)this).gameObject;
		}

		public bool UpdateRender()
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			int num2 = (1 << neighbors.Length) - 1;
			for (int i = 0; i < neighbors.Length; i++)
			{
				GameObject val = neighbors[i];
				if ((Object)(object)val != (Object)null && neighbors[i].activeSelf)
				{
					num += 1 << i;
				}
			}
			if (num == num2)
			{
				return false;
			}
			for (int j = 0; j < stateValues.Length; j++)
			{
				if (stateValues[j] == num)
				{
					((Renderer)targetRenderer).material = stateMaterials[j];
					((Component)targetRenderer).transform.localEulerAngles = new Vector3(0f, stateRotations[j], 0f);
					return false;
				}
			}
			if ((Object)(object)targerGameObject == (Object)null)
			{
				Plugin.logger.LogError((object)"FloorCleanup null. dev fix plz");
				return false;
			}
			bool activeSelf = targerGameObject.activeSelf;
			targerGameObject.SetActive(false);
			return activeSelf;
		}

		private void OnDrawGizmosSelected()
		{
			//IL_0001: 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)
			Gizmos.color = Color.green;
			for (int i = 0; i < neighbors.Length; i++)
			{
				if ((bitValueCheck & (1 << i)) > 0)
				{
					Gizmos.DrawCube(neighbors[i].transform.position, Vector3.one);
				}
			}
		}
	}
	public class FloorCleanUpParent : MonoBehaviour, IDungeonCompleteReceiver
	{
		public FloorCleanup[] children;

		public string tileParentName;

		private void Reset()
		{
			children = ((Component)this).GetComponentsInChildren<FloorCleanup>();
		}

		private void Awake()
		{
			tileParentName = ((Object)((Component)((Component)this).GetComponentInParent<Tile>()).gameObject).name ?? "";
		}

		public void OnDungeonComplete(Dungeon dungeon)
		{
			DoorwayManager.AddActionHook((DunGenScriptingHook)1, (Action)UpdateChildren);
		}

		public void UpdateChildren()
		{
			bool flag = true;
			while (flag)
			{
				flag = false;
				FloorCleanup[] array = children;
				foreach (FloorCleanup floorCleanup in array)
				{
					if (!((Object)(object)floorCleanup == (Object)null))
					{
						bool flag2 = floorCleanup.UpdateRender();
						flag = flag || flag2;
					}
				}
			}
		}
	}
	public class KnightSpawnPoint : MonoBehaviour
	{
		public int index;

		public GameObject renderGameObject;

		public const float minTime = 4f;

		public const float maxTime = 8f;

		public const float minSqrDistance = 36f;

		public void Start()
		{
			if (GameNetworkManager.Instance.isHostingGame)
			{
				((MonoBehaviour)this).StartCoroutine(GetNearbyPlayers());
			}
		}

		public IEnumerator GetNearbyPlayers()
		{
			while (true)
			{
				float randomWait = Random.Range(4f, 8f);
				yield return (object)new WaitForSeconds(randomWait);
				StartOfRound sround = StartOfRound.Instance;
				PlayerControllerB[] players = sround.allPlayerScripts;
				int playerCount = sround.connectedPlayersAmount + 1;
				int i = 0;
				while (i < playerCount)
				{
					PlayerControllerB player = players[i];
					if (player.isPlayerControlled || !player.isPlayerDead)
					{
						float dist = Vector3.SqrMagnitude(((Component)this).transform.position - ((Component)player).transform.position);
						if (dist <= 36f)
						{
							KnightSpawnManager.Instance.lastKnightSeenPlayer = index;
							Plugin.logger.LogDebug((object)$"Knight {index} has noticed player {player.playerUsername}");
						}
					}
					int num = i + 1;
					i = num;
				}
			}
		}

		public void OnStop()
		{
			renderGameObject.SetActive(false);
			((MonoBehaviour)this).StopAllCoroutines();
		}
	}
	public class ScarletVent : EnemyVent
	{
		[Header("References")]
		public ScarletVentVisuals visuals;

		public EnemyType ignoreEnemyType;

		private void Awake()
		{
			ignoreEnemyType = Assets.knight.enemyType;
		}

		public void ScarletUpdate()
		{
			if (base.occupied && (Object)(object)base.enemyType != (Object)(object)ignoreEnemyType)
			{
				float num = base.spawnTime - base.roundManager.timeScript.currentDayTime;
				if (base.isPlayingAudio)
				{
					float num2 = Mathf.Abs(num / base.enemyType.timeToPlayAudio - 1f);
					visuals.SetVolumeLazy(num2);
					base.lowPassFilter.lowpassResonanceQ = Math.Abs(num2 * 2f - 2f);
				}
				else if (num < base.enemyType.timeToPlayAudio)
				{
					base.isPlayingAudio = true;
					visuals.StartSpawnParticles();
				}
			}
			else if (base.isPlayingAudio)
			{
				base.isPlayingAudio = false;
				visuals.StopSpawnParticles();
				visuals.StopLightningParticles();
			}
		}

		public void OpenVent()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			ScarletNetworkManager.Instance.CreateSpawnAudioPrefabLocal(((Component)this).transform.position);
		}

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

		protected internal override string __getTypeName()
		{
			return "ScarletVent";
		}
	}
	public class KnightGhostVariant : EnemyAI
	{
		public float maxChaseSpeed = 14.5f;

		public float slowChaseSpeed = 6f;

		private float currentAnimSpeed = 1f;

		public Collider mainCollider;

		public MeshRenderer[] knightMeshRenderers;

		public AudioClip[] ramAudioClips;

		public KnightSpawnPoint spawnPoint;

		public bool activated;

		private bool calledDisappear = false;

		public override void Start()
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			maxChaseSpeed = SyncedInstance<ConfigMain>.Instance.revEnemyValue.speed;
			if (StartOfRound.Instance.ClientPlayerList.TryGetValue(((NetworkBehaviour)this).NetworkObject.OwnerClientId, out var value))
			{
				base.targetPlayer = StartOfRound.Instance.allPlayerScripts[value];
				Plugin.logger.LogInfo((object)("Targeting " + base.targetPlayer.playerUsername + " for death"));
			}
			if (!((NetworkBehaviour)this).IsOwner)
			{
				MeshRenderer[] array = knightMeshRenderers;
				foreach (MeshRenderer val in array)
				{
					((Renderer)val).enabled = false;
				}
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				int num = (Object.op_Implicit((Object)(object)KnightSpawnManager.Instance) ? KnightSpawnManager.Instance.GetSpawnPointIndex() : (-1));
				if (num == -1)
				{
					EnemyVent[] allEnemyVents = RoundManager.Instance.allEnemyVents;
					EnemyVent val2 = allEnemyVents[Random.Range(0, allEnemyVents.Length)];
					SyncKnightAtPositionClientRpc(val2.floorNode.position, Quaternion.Euler(0f, val2.floorNode.eulerAngles.y, 0f));
				}
				else
				{
					SyncKnightReplacementClientRpc(num);
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			base.movingTowardsTargetPlayer = true;
			if ((Object)(object)base.targetPlayer == (Object)null || !((NetworkBehaviour)base.targetPlayer).IsOwner || base.isEnemyDead || base.timeSinceSpawn < 1f)
			{
				return;
			}
			if (!((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false))
			{
				CallDisappear();
				return;
			}
			bool flag = base.targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f);
			int num = (flag ? 1 : 0);
			if (flag)
			{
				base.targetPlayer.JumpToFearLevel(0.75f, true);
			}
			if (num != base.currentBehaviourStateIndex)
			{
				((EnemyAI)this).SwitchToBehaviourState(num);
			}
		}

		public override void Update()
		{
			((EnemyAI)this).Update();
			if (!base.isEnemyDead && !(base.timeSinceSpawn < 1f))
			{
				if (!activated)
				{
					activated = true;
					base.creatureAnimator.SetBool("Activate", true);
				}
				float num = ((base.currentBehaviourStateIndex == 0) ? maxChaseSpeed : slowChaseSpeed);
				if (((NetworkBehaviour)this).IsOwner)
				{
					base.agent.speed = Mathf.MoveTowards(base.agent.speed, num, (maxChaseSpeed - slowChaseSpeed) * 4f * Time.deltaTime);
				}
				currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, num * 0.4597f, 4f * Time.deltaTime);
				base.creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed);
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (base.timeSinceSpawn < 1f)
			{
				return;
			}
			PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
			if ((Object)(object)val != (Object)null && ((NetworkBehaviour)val).IsOwner && (Object)(object)val == (Object)(object)base.targetPlayer)
			{
				int markedDamageToPlayer = ScarletNetworkManagerUtility.GetMarkedDamageToPlayer(val);
				val.DamagePlayer(markedDamageToPlayer, true, true, (CauseOfDeath)6, 1, false, default(Vector3));
				val.JumpToFearLevel(1f, true);
				ScarletNetworkManagerUtility.MarkPlayerForDeath(val);
				if (val.isPlayerDead)
				{
					Assets.onPlayerDeath.Call(new CoronerParameters(val, CoronerDeathEnum.GhostKnight));
				}
				RoundManager.PlayRandomClip(base.creatureVoice, ramAudioClips, false, 1f, 1, 1000);
				CallDisappear();
			}
		}

		[ClientRpc]
		public void SyncKnightReplacementClientRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2391938005u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, index);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2391938005u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Plugin.logger.LogDebug((object)$"Spawning ghost knight at {index}");
			try
			{
				spawnPoint = KnightSpawnManager.Instance.GetSpawnPoint(index);
				KnightSpawnManager.Instance.SpawnEnemyOnSpawnPoint((EnemyAI)(object)this, spawnPoint);
			}
			catch (Exception ex)
			{
				Plugin.logger.LogError((object)$"Tried to ghost knight spawn at {index}, but completely failed");
				Plugin.logger.LogError((object)ex);
			}
		}

		[ClientRpc]
		public void SyncKnightAtPositionClientRpc(Vector3 position, Quaternion rotation)
		{
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2455274832u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2455274832u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Plugin.logger.LogDebug((object)$"Spawning ghost knight at {position}");
			try
			{
				KnightSpawnManager.Instance.SpawnEnemyOnSpawnPoint((EnemyAI)(object)this, position, rotation);
			}
			catch (Exception ex)
			{
				Plugin.logger.LogError((object)$"Tried to ghost knight spawn at {position}, but completely failed");
				Plugin.logger.LogError((object)ex);
			}
		}

		public void CallDisappear()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (!calledDisappear)
			{
				Plugin.logger.LogDebug((object)"Killing ghost knight");
				calledDisappear = true;
				mainCollider.enabled = false;
				((Component)mainCollider).gameObject.SetActive(false);
				ScarletNetworkManager.Instance.CreateSpawnAudioPrefab(((Component)this).transform.position, base.targetPlayer.actualClientId);
				DisappearServerRpc();
			}
		}

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

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_KnightGhostVariant()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2391938005u, new RpcReceiveHandler(__rpc_handler_2391938005));
			NetworkManager.__rpc_func_table.Add(2455274832u, new RpcReceiveHandler(__rpc_handler_2455274832));
			NetworkManager.__rpc_func_table.Add(722636660u, new RpcReceiveHandler(__rpc_handler_722636660));
		}

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

		private static void __rpc_handler_2455274832(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				Quaternion rotation = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((KnightGhostVariant)(object)target).SyncKnightAtPositionClientRpc(position, rotation);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "KnightGhostVariant";
		}
	}
	public class KnightVariant : EnemyAI
	{
		public AISearchRoutine searchForPlayers;

		private bool stoppingMovement;

		private bool hasStopped;

		public AnimationStopPoints animStopPoints;

		private float currentChaseSpeed = 10.875f;

		private float currentAnimSpeed = 1f;

		private PlayerControllerB previousTarget;

		private bool wasOwnerLastFrame;

		private float stopAndGoMinimumInterval;

		private float timeSinceHittingPlayer;

		public AudioClip[] springNoises;

		public Collider mainCollider;

		public override void Start()
		{
			((EnemyAI)this).Start();
			if (((NetworkBehaviour)this).IsOwner && Object.op_Implicit((Object)(object)KnightSpawnManager.Instance))
			{
				int spawnPointIndex = KnightSpawnManager.Instance.GetSpawnPointIndex();
				if (spawnPointIndex != -1)
				{
					SyncKnightReplacementClientRpc(spawnPointIndex);
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			StartOfRound instance = StartOfRound.Instance;
			if (instance.allPlayersDead || base.isEnemyDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 1:
				if (searchForPlayers.inProgress)
				{
					((EnemyAI)this).StopSearch(searchForPlayers, true);
				}
				if (((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f))
				{
					if ((Object)(object)previousTarget != (Object)(object)base.targetPlayer)
					{
						previousTarget = base.targetPlayer;
						((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
					}
					base.movingTowardsTargetPlayer = true;
				}
				else
				{
					((EnemyAI)this).SwitchToBehaviourState(0);
					((EnemyAI)this).ChangeOwnershipOfEnemy(instance.allPlayerScripts[0].actualClientId);
				}
				break;
			case 0:
			{
				if (!((NetworkBehaviour)this).IsServer)
				{
					((EnemyAI)this).ChangeOwnershipOfEnemy(instance.allPlayerScripts[0].actualClientId);
					break;
				}
				for (int i = 0; i < ModCompability.GetStartOfRoundScriptLength(); i++)
				{
					PlayerControllerB val = instance.allPlayerScripts[i];
					if (((EnemyAI)this).PlayerIsTargetable(val, false, false))
					{
						bool flag = !Physics.Linecast(((Component)this).transform.position + Vector3.up * 0.5f, ((Component)val.gameplayCamera).transform.position, instance.collidersAndRoomMaskAndDefault);
						bool flag2 = Vector3.SqrMagnitude(((Component)this).transform.position - ((Component)val).transform.position) < 900f;
						if (flag && flag2)
						{
							((EnemyAI)this).SwitchToBehaviourState(1);
							return;
						}
					}
				}
				base.agent.speed = 6f;
				if (!searchForPlayers.inProgress)
				{
					base.movingTowardsTargetPlayer = false;
					((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayers);
				}
				break;
			}
			}
		}

		public override void Update()
		{
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				return;
			}
			if (timeSinceHittingPlayer >= 0f)
			{
				timeSinceHittingPlayer -= Time.deltaTime;
			}
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			StartOfRound instance = StartOfRound.Instance;
			if (currentBehaviourStateIndex == 0 || currentBehaviourStateIndex != 1)
			{
				return;
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (stopAndGoMinimumInterval > 0f)
				{
					stopAndGoMinimumInterval -= Time.deltaTime;
				}
				if (!wasOwnerLastFrame)
				{
					wasOwnerLastFrame = true;
					if (!stoppingMovement && timeSinceHittingPlayer < 0.12f)
					{
						base.agent.speed = currentChaseSpeed;
					}
					else
					{
						base.agent.speed = 0f;
					}
				}
				bool flag = false;
				for (int i = 0; i < ModCompability.GetStartOfRoundScriptLength(); i++)
				{
					PlayerControllerB val = instance.allPlayerScripts[i];
					if (((EnemyAI)this).PlayerIsTargetable(val, false, false))
					{
						bool flag2 = val.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f);
						bool flag3 = Vector3.SqrMagnitude(((Component)val.gameplayCamera).transform.position - base.eye.position) > 0.09f;
						if (flag2 && flag3)
						{
							flag = true;
						}
					}
				}
				if (base.stunNormalizedTimer > 0f)
				{
					flag = true;
				}
				if (flag != stoppingMovement && stopAndGoMinimumInterval <= 0f)
				{
					stopAndGoMinimumInterval = 0.15f;
					if (flag)
					{
						SetAnimationStopServerRpc();
					}
					else
					{
						SetAnimationGoServerRpc();
					}
					stoppingMovement = flag;
				}
			}
			if (stoppingMovement)
			{
				if (!animStopPoints.canAnimationStop)
				{
					return;
				}
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if (!hasStopped)
				{
					hasStopped = true;
					if (localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 70f, 25, -1f))
					{
						float num = Vector3.SqrMagnitude(((Component)this).transform.position - ((Component)localPlayerController).transform.position);
						if (num < 16f)
						{
							localPlayerController.JumpToFearLevel(0.9f, true);
						}
						else if (num < 81f)
						{
							localPlayerController.JumpToFearLevel(0.4f, true);
						}
					}
					if (currentAnimSpeed > 2f)
					{
						RoundManager.PlayRandomClip(base.creatureVoice, springNoises, false, 1f, 0, 1000);
						if (animStopPoints.animationPosition == 1)
						{
							base.creatureAnimator.SetTrigger("springBoing");
						}
						else
						{
							base.creatureAnimator.SetTrigger("springBoingPosition2");
						}
					}
				}
				bool flag4 = Vector3.SqrMagnitude(((Component)localPlayerController).transform.position - ((Component)this).transform.position) > 0.0625f;
				if (mainCollider.isTrigger && flag4)
				{
					mainCollider.isTrigger = false;
				}
				base.creatureAnimator.SetFloat("walkSpeed", 0f);
				currentAnimSpeed = 0f;
				if (((NetworkBehaviour)this).IsOwner)
				{
					base.agent.speed = 0f;
				}
			}
			else
			{
				if (hasStopped)
				{
					hasStopped = false;
					mainCollider.isTrigger = true;
				}
				currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, 5f, 3f * Time.deltaTime);
				base.creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed);
				if (((NetworkBehaviour)this).IsOwner)
				{
					base.agent.speed = Mathf.Lerp(base.agent.speed, currentChaseSpeed, 4.5f * Time.deltaTime);
				}
			}
		}

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

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

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

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

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (!stoppingMovement && base.currentBehaviourStateIndex == 1 && !(timeSinceHittingPlayer >= 0f))
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null)
				{
					timeSinceHittingPlayer = 0.2f;
					val.DamagePlayer(90, true, true, (CauseOfDeath)6, 1, false, default(Vector3));
					val.JumpToFearLevel(1f, true);
				}
			}
		}

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

		public void SyncKnightReplacement(int index)
		{
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_KnightVariant()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3882357060u, new RpcReceiveHandler(__rpc_handler_3882357060));
			NetworkManager.__rpc_func_table.Add(1023489990u, new RpcReceiveHandler(__rpc_handler_1023489990));
			NetworkManager.__rpc_func_table.Add(1320084365u, new RpcReceiveHandler(__rpc_handler_1320084365));
			NetworkManager.__rpc_func_table.Add(3930434877u, new RpcReceiveHandler(__rpc_handler_3930434877));
			NetworkManager.__rpc_func_table.Add(3956096293u, new RpcReceiveHandler(__rpc_handler_3956096293));
		}

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

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

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

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

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

		protected internal override string __getTypeName()
		{
			return "KnightVariant";
		}
	}
	public class KnightSpawnManager : MonoBehaviour, IDungeonCompleteReceiver
	{
		public List<KnightSpawnPoint> spawnPoints;

		public List<KnightSpawnPoint> unusedSpawnPoints;

		public int lastKnightSeenPlayer = -1;

		public bool disableNextKnightSpecialSpawn;

		public static KnightSpawnManager Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		public static bool WillSpawnOnSpawnPoint()
		{
			if (Object.op_Implicit((Object)(object)Instance))
			{
				return !Instance.disableNextKnightSpecialSpawn && Instance.spawnPoints.Count > 0;
			}
			return false;
		}

		public void OnDungeonComplete(Dungeon dungeon)
		{
			KnightSpawnPoint[] componentsInChildren = ((Component)dungeon).GetComponentsInChildren<KnightSpawnPoint>();
			spawnPoints = componentsInChildren.ToList();
			for (int i = 0; i < spawnPoints.Count; i++)
			{
				spawnPoints[i].index = i;
			}
			unusedSpawnPoints = componentsInChildren.ToList();
			Plugin.logger.LogDebug((object)$"Found {spawnPoints.Count} spawn points for the knight");
		}

		public int GetSpawnPointIndex()
		{
			if (disableNextKnightSpecialSpawn)
			{
				disableNextKnightSpecialSpawn = true;
				return -1;
			}
			if (unusedSpawnPoints.Count == 0)
			{
				return -1;
			}
			if (lastKnightSeenPlayer >= 0)
			{
				KnightSpawnPoint knightSpawnPoint = spawnPoints[lastKnightSeenPlayer];
				if (((Component)knightSpawnPoint).gameObject.activeInHierarchy)
				{
					Plugin.logger.LogDebug((object)$"Using the last knight {knightSpawnPoint.index} that saw a player");
					unusedSpawnPoints.Remove(knightSpawnPoint);
					lastKnightSeenPlayer = -1;
					return knightSpawnPoint.index;
				}
			}
			int index = Random.Range(0, unusedSpawnPoints.Count);
			KnightSpawnPoint knightSpawnPoint2 = unusedSpawnPoints[index];
			unusedSpawnPoints.RemoveAt(index);
			return knightSpawnPoint2.index;
		}

		public KnightSpawnPoint GetSpawnPoint(int index)
		{
			return spawnPoints[index];
		}

		public void SpawnEnemyOnSpawnPoint(EnemyAI enemyAI, KnightSpawnPoint spawnPoint)
		{
			//IL_0009: 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)
			SpawnEnemyOnSpawnPoint(enemyAI, ((Component)spawnPoint).transform.position, ((Component)spawnPoint).transform.rotation);
			spawnPoint.OnStop();
		}

		public void SpawnEnemyOnSpawnPoint(EnemyAI enemyAI, Vector3 position, Quaternion rotation)
		{
			//IL_0007: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			((Component)enemyAI).transform.position = position;
			((Component)enemyAI).transform.rotation = rotation;
			enemyAI.serverPosition = position;
			if ((Object)(object)enemyAI.agent == (Object)null)
			{
				enemyAI.agent = ((Component)enemyAI).GetComponentInChildren<NavMeshAgent>();
			}
			enemyAI.agent.Warp(position);
			if (((NetworkBehaviour)enemyAI).IsOwner)
			{
				enemyAI.SyncPositionToClients();
			}
			ScarletNetworkManager.Instance?.CreateSpawnAudioPrefabLocal(position);
		}
	}
	public struct ScarletNetworkParams : INetworkSerializeByMemcpy
	{
		public int scrapValue;

		public int specialValue;
	}
	public class ItemReference
	{
		public Item item;

		public int itemId;

		public int value;

		public ItemReference(Item item, int itemId, int value)
		{
			this.item = item;
			this.itemId = itemId;
			this.value = value;
		}

		public override string ToString()
		{
			string arg = (Object.op_Implicit((Object)(object)item) ? ((Object)item).name : "NULL");
			return $"{arg}:{itemId} ({value})";
		}
	}
	public class EnemyReference
	{
		public EnemyType enemy;

		public int index;

		public EnemyReference(EnemyType enemy, int index)
		{
			this.enemy = enemy;
			this.index = index;
		}

		public override string ToString()
		{
			string arg = (Object.op_Implicit((Object)(object)enemy) ? ((Object)enemy).name : "NULL");
			return $"{arg}:{index}";
		}
	}
	public class EnemyReferenceSpawnLogic : EnemyReference
	{
		public enum SpawnLogic
		{
			None,
			Special
		}

		public SpawnLogic logic;

		public EnemyReferenceSpawnLogic(EnemyType enemy, int index, SpawnLogic logic)
			: base(enemy, index)
		{
			this.logic = logic;
		}

		public void ApplySpawnLogic()
		{
			if (logic != 0)
			{
				string text = ((Object)enemy).name.ToLowerInvariant();
				if (text == "knight")
				{
					KnightSpawnManager.Instance.disableNextKnightSpecialSpawn = true;
				}
				else if (text == "jester")
				{
					JesterAIPatch.active = true;
				}
			}
		}

		public override string ToString()
		{
			string text = base.ToString();
			return text + " [" + logic.ToString() + "]";
		}
	}
	public class ScarletNetworkManager : NetworkBehaviour
	{
		public static ScarletNetworkManager Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		[ServerRpc(RequireOwnership = false)]
		public void DestroyPlayerItemInSlotServerRpc(NetworkBehaviourReference playerRef, int itemSlot, ServerRpcParams callParams = default(ServerRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3412664016u, callParams, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val, itemSlot);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 3412664016u, callParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				PlayerControllerB val2 = default(PlayerControllerB);
				if (((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref val2, (NetworkManager)null))
				{
					Plugin.logger.LogDebug((object)$"P{((NetworkBehaviour)val2).OwnerClientId}, S{callParams.Receive.SenderClientId}");
					DestroyPlayerItemInSlotClientRpc(playerRef, itemSlot);
				}
				else
				{
					Plugin.logger.LogError((object)"Error trying to get player script (SERVERRPC)");
				}
			}
		}

		[ClientRpc]
		public void DestroyPlayerItemInSlotClientRpc(NetworkBehaviourReference playerRef, int itemSlot)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(345840887u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, itemSlot);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 345840887u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB val3 = default(PlayerControllerB);
				if (((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null) && !((NetworkBehaviour)val3).IsOwner)
				{
					val3.DestroyPlayerItemInSlot_SDM(itemSlot);
				}
				else if ((Object)(object)val3 == (Object)null)
				{
					Plugin.logger.LogError((object)"Error trying to get player script (CLIENTRPC)");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void CreateItemServerRpc(int itemId, Vector3 position, ScarletNetworkParams callParams = default(ScarletNetworkParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4119288164u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, itemId);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4119288164u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					CreateItem(itemId, fromScrapArray: false, position, null, callParams);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void CreateItemServerRpc(int itemId, Vector3 position, NetworkBehaviourReference playerRef, ScarletNetworkParams callParams = default(ScarletNetworkParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1939319057u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, itemId);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1939319057u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayerControllerB player = default(PlayerControllerB);
					((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref player, (NetworkManager)null);
					CreateItem(itemId, fromScrapArray: false, position, player, callParams);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void CreateScrapItemServerRpc(int itemId, Vector3 position, ScarletNetworkParams callParams = default(ScarletNetworkParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1250011204u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, itemId);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1250011204u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					CreateItem(itemId, fromScrapArray: true, position, null, callParams);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void CreateScrapItemServerRpc(int itemId, Vector3 position, NetworkBehaviourReference playerRef, ScarletNetworkParams callParams = default(ScarletNetworkParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3991430686u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, itemId);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3991430686u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayerControllerB player = default(PlayerControllerB);
					((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref player, (NetworkManager)null);
					CreateItem(itemId, fromScrapArray: true, position, player, callParams);
				}
			}
		}

		private void CreateItem(int itemId, bool fromScrapArray, Vector3 position, PlayerControllerB player, ScarletNetworkParams callParams = default(ScarletNetworkParams))
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			GameObject prefab = ((!fromScrapArray) ? StartOfRound.Instance.allItemsList.itemsList[itemId].spawnPrefab : Utility.GetDungeonItems()[itemId].spawnableItem.spawnPrefab);
			GrabbableObject val = CreateGrabbableObject(prefab, player, position);
			((MonoBehaviour)this).StartCoroutine(WaitForEndOfFrameToUpdateItemInitialProperities(val));
			UpdateItemFallingProperites(val, position);
			UpdateItemElevator(val, player);
			if (val is IScarletItem scarletItem)
			{
				scarletItem.UpdateSpecialProperties(callParams.specialValue);
			}
			int scrapValue = callParams.scrapValue;
			if (scrapValue > 0)
			{
				UpdateItemValueProperties(val, scrapValue);
			}
			((NetworkBehaviour)val).NetworkObject.Spawn(false);
			if ((Object)(object)player == (Object)null)
			{
				CreateItemClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val), position, callParams);
			}
			else
			{
				CreateItemClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val), position, NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)player), callParams);
			}
		}

		[ClientRpc]
		public void CreateItemClientRpc(NetworkBehaviourReference itemRef, Vector3 position, ScarletNetworkParams callParams = default(ScarletNetworkParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3004287685u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref itemRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3004287685u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Vector3 position2 = position;
			ScarletNetworkParams callParams2 = callParams;
			if (!((NetworkBehaviour)this).IsServer)
			{
				((MonoBehaviour)this).StartCoroutine(WaitForItem(itemRef, delegate(GrabbableObject c)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					CreateItem(c, position2, null, callParams2);
				}));
			}
		}

		[ClientRpc]
		public void CreateItemClientRpc(NetworkBehaviourReference itemRef, Vector3 position, NetworkBehaviourReference playerRef, ScarletNetworkParams callParams = default(ScarletNetworkParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2816052745u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref itemRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<ScarletNetworkParams>(ref callParams, default(ForStructs));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2816052745u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			Vector3 position2 = position;
			ScarletNetworkParams callParams2 = callParams;
			if (!((NetworkBehaviour)this).IsServer)
			{
				((MonoBehaviour)this).StartCoroutine(WaitForItemAndPlayer(itemRef, playerRef, delegate(GrabbableObject c, PlayerControllerB p)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					CreateItem(c, position2, p, callParams2);
				}));
			}
		}

		private IEnumerator WaitForItem(NetworkBehaviourReference itemRef, Action<GrabbableObject> action)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			float t = Time.realtimeSinceStartup + 8f;
			GrabbableObject comp = default(GrabbableObject);
			while (!((NetworkBehaviourReference)(ref itemRef)).TryGet<GrabbableObject>(ref comp, (NetworkManager)null))
			{
				yield return null;
				if (Time.realtimeSinceStartup > t)
				{
					Plugin.logger.LogError((object)"Failed to find network object (ITEM)");
					yield break;
				}
			}
			yield return (object)new WaitForEndOfFrame();
			action(comp);
		}

		private IEnumerator WaitForItemAndPlayer(NetworkBehaviourReference itemRef, NetworkBehaviourReference playerRef, Action<GrabbableObject, PlayerControllerB> action)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			float t = Time.realtimeSinceStartup + 8f;
			GrabbableObject comp = default(GrabbableObject);
			while (!((NetworkBehaviourReference)(ref itemRef)).TryGet<GrabbableObject>(ref comp, (NetworkManager)null))
			{
				yield return null;
				if (Time.realtimeSinceStartup > t)
				{
					Plugin.logger.LogError((object)"Failed to find network object (ITEM)");
					yield break;
				}
			}
			PlayerControllerB player = default(PlayerControllerB);
			while (!((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref player, (NetworkManager)null))
			{
				yield return null;
				if (Time.realtimeSinceStartup > t)
				{
					Plugin.logger.LogError((object)"Failed to find network object (PLAYER)");
					yield break;
				}
			}
			yield return (object)new WaitForEndOfFrame();
			action(comp, player);
		}

		private void CreateItem(GrabbableObject item, Vector3 position, PlayerControllerB player, ScarletNetworkParams callParams = default(ScarletNetworkParams))
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			UpdateItemFallingProperites(item, position);
			UpdateItemElevator(item, player);
			if (item is IScarletItem scarletItem)
			{
				scarletItem.UpdateSpecialProperties(callParams.specialValue);
			}
			int scrapValue = callParams.scrapValue;
			if (scrapValue > 0)
			{
				UpdateItemValueProperties(item, scrapValue);
			}
		}

		private GrabbableObject CreateGrabbableObject(GameObject prefab, PlayerControllerB player, Vector3 position)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Transform itemSpawnTransform = GetItemSpawnTransform(player);
			GameObject val = Object.Instantiate<GameObject>(prefab, position, Quaternion.identity, itemSpawnTransform);
			return val.GetComponent<GrabbableObject>();
		}

		private Transform GetItemSpawnTransform(PlayerControllerB player)
		{
			if ((((Object)(object)player != (Object)null && player.isInElevator) || StartOfRound.Instance.inShipPhase) && (Object)(object)RoundManager.Instance.spawnedScrapContainer != (Object)null)
			{
				return RoundManager.Instance.spawnedScrapContainer;
			}
			return StartOfRound.Instance.elevatorTransform;
		}

		private IEnumerator WaitForEndOfFrameToUpdateItemInitialProperities(GrabbableObject comp)
		{
			yield return (object)new WaitForEndOfFrame();
			UpdateItemInitialProperites(comp);
		}

		private void UpdateItemInitialProperites(GrabbableObject comp)
		{
			comp.reachedFloorTarget = false;
			comp.hasHitGround = false;
			comp.fallTime = 0f;
		}

		private void UpdateItemFallingProperites(GrabbableObject comp, Vector3 position)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			comp.startFallingPosition = position;
			comp.targetFloorPosition = comp.GetItemFloorPosition(position);
		}

		private void UpdateItemValueProperties(GrabbableObject comp, int value)
		{
			comp.SetScrapValue(value);
			RoundManager instance = RoundManager.Instance;
			instance.totalScrapValueInLevel += (float)value;
		}

		private void UpdateItemElevator(GrabbableObject comp, PlayerControllerB player)
		{
			if ((Object)(object)player != (Object)null && player.isInHangarShipRoom)
			{
				player.SetItemInElevator(true, true, comp);
			}
		}

		public void RequestEvilSkinApply(NetworkObjectReference reference, string enemyName)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (SyncedInstance<ConfigMain>.Instance.paintingEnemyEvilSkinValue && ScarletBedroom.ENEMY_EVIL_LIST.Contains(enemyName))
			{
				RequestEvilSkinApplyClientRpc(reference);
			}
		}

		[ClientRpc]
		public void RequestEvilSkinApplyClientRpc(NetworkObjectReference reference)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(112037380u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref reference, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 112037380u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkObjectReference)(ref reference)).TryGet(ref val3, (NetworkManager)null))
			{
				return;
			}
			EnemyAI componentInParent = ((Component)val3).GetComponentInParent<EnemyAI>();
			if ((Object)(object)componentInParent == (Object)null)
			{
				return;
			}
			string name = ((Object)componentInParent).name;
			try
			{
				Plugin.logger.LogDebug((object)("Applying evil material to " + name));
				ApplyMaterialToRenderers<SkinnedMeshRenderer>(((Component)componentInParent).GetComponentsInChildren<SkinnedMeshRenderer>());
				ApplyMaterialToRenderers<MeshRenderer>(((Component)componentInParent).GetComponentsInChildren<MeshRenderer>());
			}
			catch (Exception ex)
			{
				Plugin.logger.LogWarning((object)("Failed to apply evil material to " + name));
				Plugin.logger.LogWarning((object)ex.ToString());
			}
			static void ApplyMaterialToRenderers<T>(T[] renderers) where T : Renderer
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				foreach (T val4 in renderers)
				{
					Material[] materials = ((Renderer)val4).materials;
					for (int j = 0; j < materials.Length; j++)
					{
						Material val5 = new Material(Assets.networkObjectList.ghostMaterial);
						val5.mainTexture = materials[j].mainTexture;
						materials[j] = val5;
					}
					((Renderer)val4).materials = materials;
				}
			}
		}

		public void CreateSpawnAudioPrefab(Vector3 positon, ulong playerId)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			CreateSpawnAudioPrefabServerRpc(positon, playerId);
			CreateSpawnAudioPrefabLocal(positon);
		}

		[ServerRpc(RequireOwnership = false)]
		public void CreateSpawnAudioPrefabServerRpc(Vector3 position, ulong playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1476417038u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1476417038u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					CreateSpawnAudioPrefabClientRpc(position, playerId);
				}
			}
		}

		[ClientRpc]
		public void CreateSpawnAudioPrefabClientRpc(Vector3 position, ulong playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1753138479u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1753138479u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && StartOfRound.Instance.localPlayerController.actualClientId != playerId)
				{
					CreateSpawnAudioPrefabLocal(position);
				}
			}
		}

		public void CreateSpawnAudioPrefabLocal(Vector3 position)
		{
			//IL_000b: 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)
			GameObject val = Object.Instantiate<GameObject>(Assets.networkObjectList.yukariSpawnPrefab, position, Quaternion.identity);
			AudioSource componentInChildren = val.GetComponentInChildren<AudioSource>();
			componentInChildren.time = 0.5f;
			Object.Destroy((Object)(object)val, 5f);
		}

		[ClientRpc]
		public void SetupBookPathsClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2713883165u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2713883165u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)ScarletGenericManager.Instance == (Object)null))
			{
				ScarletBookPath[] bookPaths = ScarletGenericManager.Instance.bookPaths;
				ScarletBookPath[] array = bookPaths;
				foreach (ScarletBookPath scarletBookPath in array)
				{
					scarletBookPath.ResetPath();
				}
			}
		}

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

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ScarletNetworkManager()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3412664016u, new RpcReceiveHandler(__rpc_handler_3412664016));
			NetworkManager.__rpc_func_table.Add(345840887u, new RpcReceiveHandler(__rpc_handler_345840887));
			NetworkManager.__rpc_func_table.Add(4119288164u, new RpcReceiveHandler(__rpc_handler_4119288164));
			NetworkManager.__rpc_func_table.Add(1939319057u, new RpcReceiveHandler(__rpc_handler_1939319057));
			NetworkManager.__rpc_func_table.Add(1250011204u, new RpcReceiveHandler(__rpc_handler_1250011204));
			NetworkManager.__rpc_func_table.Add(3991430686u, new RpcReceiveHandler(__rpc_handler_3991430686));
			NetworkManager.__rpc_func_table.Add(3004287685u, new RpcReceiveHandler(__rpc_handler_3004287685));
			NetworkManager.__rpc_func_table.Add(2816052745u, new RpcReceiveHandler(__rpc_handler_2816052745));
			NetworkManager.__rpc_func_table.Add(112037380u, new RpcReceiveHandler(__rpc_handler_112037380));
			NetworkManager.__rpc_func_table.Add(1476417038u, new RpcReceiveHandler(__rpc_handler_1476417038));
			NetworkManager.__rpc_func_table.Add(1753138479u, new RpcReceiveHandler(__rpc_handler_1753138479));
			NetworkManager.__rpc_func_table.Add(2713883165u, new RpcReceiveHandler(__rpc_handler_2713883165));
			NetworkManager.__rpc_func_table.Add(3435869490u, new RpcReceiveHandler(__rpc_handler_3435869490));
		}

		private static void __rpc_handler_3412664016(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_004c: Unknown result type 

plugins/ScarletMansionCoronerPatch.dll

Decompiled 7 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using Coroner;
using HarmonyLib;
using ScarletMansion;
using ScarletMansion.ModPatch;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ScarletMansionCoronerPatch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScarletMansionCoronerPatch")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cb30b9c8-2679-4c65-86a3-b4680b73da4f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ScarletMansionCoronerPatch;

public class Patch
{
	public static Dictionary<CoronerDeathEnum, object> causesOfDeath;

	public static void Activate()
	{
		//IL_0016: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		causesOfDeath = new Dictionary<CoronerDeathEnum, object>();
		causesOfDeath.Add((CoronerDeathEnum)0, AdvancedCauseOfDeath.Build("DeathEnemyKnight"));
		causesOfDeath.Add((CoronerDeathEnum)1, AdvancedCauseOfDeath.Build("DeathEnemyMaid"));
		causesOfDeath.Add((CoronerDeathEnum)2, AdvancedCauseOfDeath.Build("DeathPitVoid"));
		causesOfDeath.Add((CoronerDeathEnum)3, AdvancedCauseOfDeath.Build("DeathEnemyGhostKnight"));
		causesOfDeath.Add((CoronerDeathEnum)4, AdvancedCauseOfDeath.Build("DeathPlayerMaidKnife"));
		causesOfDeath.Add((CoronerDeathEnum)5, AdvancedCauseOfDeath.Build("DeathPlayerMaidKnifeFeed"));
		causesOfDeath.Add((CoronerDeathEnum)6, AdvancedCauseOfDeath.Build("DeathPlayerMaidKnifeFriendlyFire"));
		Assets.onPlayerDeath.AddEvent("CoronerPatch", (Action<CoronerParameters>)ProcessCauseOfDeath);
	}

	public static void ProcessCauseOfDeath(CoronerParameters parameters)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		if (causesOfDeath.TryGetValue(parameters.death, out var value))
		{
			API.SetCauseOfDeath(parameters.player, (AdvancedCauseOfDeath?)(AdvancedCauseOfDeath)value);
			Plugin.logger.LogInfo((object)parameters.death);
		}
	}
}
[BepInPlugin("dev.ladyalice.scarletmansion.coronerpatch", "Scarlet Mansion Coroner Patch", "1.0.0")]
[BepInDependency("dev.ladyalice.scarletmansion", "1.3.27")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	public const string modGUID = "dev.ladyalice.scarletmansion.coronerpatch";

	private const string modName = "Scarlet Mansion Coroner Patch";

	private const string modVersion = "1.0.0";

	public const string targetModGUID = "com.elitemastereric.coroner";

	public const string targetModVersion = "2.1.0";

	public readonly Harmony harmony = new Harmony("dev.ladyalice.scarletmansion.coronerpatch");

	public static Plugin Instance { get; private set; }

	public static ManualLogSource logger { get; internal set; }

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		logger = Logger.CreateLogSource("dev.ladyalice.scarletmansion.coronerpatch");
		if (Chainloader.PluginInfos.ContainsKey("com.elitemastereric.coroner"))
		{
			PluginInfo val = Chainloader.PluginInfos["com.elitemastereric.coroner"];
			Version version = val.Metadata.Version;
			bool flag;
			if (string.IsNullOrWhiteSpace("2.1.0"))
			{
				flag = true;
			}
			else
			{
				Version version2 = new Version("2.1.0");
				flag = version >= version2;
			}
			if (flag)
			{
				logger.LogInfo((object)"Plugin Scarlet Mansion Coroner Patch has been added!");
				Patch.Activate();
			}
		}
	}
}

plugins/ScarletMansionMimicsPatch.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using Mimics;
using Mimics.API;
using ScarletMansion;
using ScarletMansion.DunGenPatch;
using ScarletMansion.GamePatch.Components;
using ScarletMansion.GamePatch.FixValues;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ScarletMansionMimicsPatch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScarletMansionMimicsPatch")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6aab73ec-489e-4baa-8bd1-7ca944359cec")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ScarletMansionMimicsPatch;

public class Patch
{
	public class SDMMimicEventHandler : MimicEventHandler
	{
		public override string ModGUID => "dev.ladyalice.scarletmansion.mimicspatch";

		public override bool IsMyInteriorLoaded => Patch.active;

		public override void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway)
		{
			FixFireExit componentInChildren = ((Component)doorway).GetComponentInChildren<FixFireExit>(true);
			componentInChildren.ForcefullyEnableDoorway();
			Transform mimicDoorMesh = Utility.FindChildRecurvisely(((Component)mimicDoor).transform, "DoorMesh");
			Transform mimicFrame = Utility.FindChildRecurvisely(((Component)mimicDoor).transform, "Frame");
			Transform mimicLight = Utility.FindChildRecurvisely(((Component)mimicDoor).transform, "Light");
			if (componentInChildren.EnableVanillaFireExit)
			{
				FixDoorwayForVanillaFireExit(componentInChildren, mimicDoorMesh, mimicFrame, mimicLight);
			}
			else
			{
				FixDoorwayForSDMFireExit(componentInChildren, mimicDoorMesh, mimicFrame, mimicLight);
			}
			Plugin.logger.LogDebug((object)"Fixed a doorway for a mimic");
		}

		public override void OnMimicAttackStart(MimicDoor mimicDoor, PlayerControllerB playerToAttack)
		{
			Doorway componentInParent = ((Component)mimicDoor).GetComponentInParent<Doorway>();
			ScarletFireExit componentInChildren = ((Component)componentInParent).GetComponentInChildren<ScarletFireExit>();
			if (componentInChildren != null)
			{
				componentInChildren.DisableEnablePortal();
			}
		}
	}

	private static bool colorBlindModeLastValue;

	public static void Activate()
	{
		MimicsAPI.GetAPI().RegisterMimicEventHandler((MimicEventHandler)(object)new SDMMimicEventHandler());
		AddToWhiteList("sdmFoyer");
		AddToWhiteList("sdmBasement");
		Plugin.Instance.harmony.PatchAll(typeof(Patch));
	}

	private static void AddToWhiteList(string dungeonName)
	{
		dungeonName = dungeonName.ToLower().Trim();
		if (!Mimics.InteriorWhitelist.Contains(dungeonName))
		{
			Mimics.InteriorWhitelist.Add(dungeonName);
		}
	}

	[HarmonyPrefix]
	[HarmonyPatch("Mimics.Mimics+RoundManagerPatch, Mimics", "SetExitIDsPatch")]
	public static void SetExitIDsPatchPrefix()
	{
		colorBlindModeLastValue = Mimics.ColorBlindMode;
	}

	[HarmonyPostfix]
	[HarmonyPatch("Mimics.Mimics+RoundManagerPatch, Mimics", "SetExitIDsPatch")]
	public static void SetExitIDsPatchPostfix()
	{
		Mimics.ColorBlindMode = colorBlindModeLastValue;
	}

	private static void FixDoorwayForVanillaFireExit(FixFireExit fixFireExit, Transform mimicDoorMesh, Transform mimicFrame, Transform mimicLight)
	{
		//IL_001d: 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_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)mimicDoorMesh != (Object)null)
		{
			mimicDoorMesh.localPosition = new Vector3(-0.07f, 0f, 0.06f);
			Vector3 localScale = mimicDoorMesh.localScale;
			localScale.y = -0.0002f;
			localScale.z = -0.000161f;
			mimicDoorMesh.localScale = localScale;
		}
		else
		{
			Plugin.logger.LogWarning((object)"Could not find DoorMesh in mimic gameobject. It will look weird but nothing should break");
		}
		if ((Object)(object)mimicFrame != (Object)null)
		{
			mimicFrame.localPosition = new Vector3(0f, -0.02f, 0.07f);
			mimicFrame.localScale = new Vector3(1.08f, 1.008f, 1.02f);
		}
		else
		{
			Plugin.logger.LogWarning((object)"Could not find Frame in mimic gameobject. It will look weird but nothing should break");
		}
	}

	private static void FixDoorwayForSDMFireExit(FixFireExit fixFireExit, Transform mimicDoorMesh, Transform mimicFrame, Transform mimicLight)
	{
		Mimics.ColorBlindMode = true;
		fixFireExit.ForcefullyEnableSDMRender();
		fixFireExit.sdmFireExit.enablePortalAnimation = true;
		if ((Object)(object)mimicDoorMesh != (Object)null)
		{
			((Component)mimicDoorMesh).gameObject.SetActive(false);
		}
		else
		{
			Plugin.logger.LogWarning((object)"Could not find DoorMesh in mimic gameobject. It will look weird but nothing should break");
		}
		if ((Object)(object)mimicFrame != (Object)null)
		{
			((Component)mimicFrame).gameObject.SetActive(false);
		}
		else
		{
			Plugin.logger.LogWarning((object)"Could not find Frame in mimic gameobject. It will look weird but nothing should break");
		}
		if ((Object)(object)mimicLight != (Object)null)
		{
			((Component)mimicLight).gameObject.SetActive(false);
		}
		else
		{
			Plugin.logger.LogWarning((object)"Could not find Light in mimic gameobject. It will look weird but nothing should break");
		}
	}
}
[BepInPlugin("dev.ladyalice.scarletmansion.mimicspatch", "Scarlet Mansion Mimics Patch", "1.0.0")]
[BepInDependency("dev.ladyalice.scarletmansion", "1.3.22")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	public const string modGUID = "dev.ladyalice.scarletmansion.mimicspatch";

	private const string modName = "Scarlet Mansion Mimics Patch";

	private const string modVersion = "1.0.0";

	public const string targetModGUID = "x753.Mimics";

	public const string targetModVersion = "2.6.0";

	public readonly Harmony harmony = new Harmony("dev.ladyalice.scarletmansion.mimicspatch");

	public static Plugin Instance { get; private set; }

	public static ManualLogSource logger { get; internal set; }

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		logger = Logger.CreateLogSource("dev.ladyalice.scarletmansion.mimicspatch");
		if (Chainloader.PluginInfos.ContainsKey("x753.Mimics"))
		{
			PluginInfo val = Chainloader.PluginInfos["x753.Mimics"];
			Version version = val.Metadata.Version;
			bool flag;
			if (string.IsNullOrWhiteSpace("2.6.0"))
			{
				flag = true;
			}
			else
			{
				Version version2 = new Version("2.6.0");
				flag = version >= version2;
			}
			if (flag)
			{
				logger.LogInfo((object)"Plugin Scarlet Mansion Mimics Patch has been added!");
				Patch.Activate();
			}
		}
	}
}

plugins/WesleysInteriorShenanigans.dll

Decompiled 7 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using DunGen;
using DunGen.Tags;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("WesleysInteriorShenanigans")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WesleysInteriorShenanigans")]
[assembly: AssemblyTitle("WesleysInteriorShenanigans")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace WesleysInteriorShenanigans
{
	[BepInPlugin("MW.MagicWesleyInteriors", "Wesley's interior shenanigans", "1.0.0")]
	public class InteriorModifier : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("MW.MagicWesleyInteriors");

		internal ManualLogSource help;

		private TileConnectionRule acRule;

		private TileConnectionRule gaRule;

		public Tag dungRoomTag = new Tag(8886);

		public Tag dungTransRoomTag = new Tag(8887);

		public Tag normRoomTag = new Tag(8888);

		public Tag catRoomTag = new Tag(8889);

		public Tag hallRoomTag = new Tag(38843);

		private static readonly List<Tag> GrandDoorwayTags = new List<Tag>
		{
			new Tag(7770),
			new Tag(7771),
			new Tag(7772),
			new Tag(7773),
			new Tag(7774)
		};

		private void Awake()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			help = Logger.CreateLogSource("The man in the rubber rooms");
			help.LogError((object)"You made a mistake.. but it's fine.. the world will survive.. I think..");
			harmony.PatchAll();
			help.LogError((object)"Maybe not.");
			acRule = new TileConnectionRule(new CanTilesConnectDelegate(CitadelConnections), 0);
			DoorwayPairFinder.CustomConnectionRules.Add(acRule);
			gaRule = new TileConnectionRule(new CanTilesConnectDelegate(ArmoryConnections), 0);
			DoorwayPairFinder.CustomConnectionRules.Add(gaRule);
		}

		private ConnectionResult CitadelConnections(Tile tileA, Tile tileB, Doorway doorwayA, Doorway doorwayB)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			bool flag = tileA.Tags.HasTag(normRoomTag);
			bool flag2 = tileB.Tags.HasTag(catRoomTag);
			bool flag3 = tileA.Tags.HasTag(dungRoomTag);
			bool flag4 = tileB.Tags.HasTag(dungTransRoomTag);
			bool flag5 = doorwayA.Tags.HasTag(hallRoomTag);
			bool flag6 = doorwayB.Tags.HasTag(hallRoomTag);
			if ((flag && flag2) || (flag3 && flag4) || (flag5 && flag6))
			{
				return (ConnectionResult)1;
			}
			return (ConnectionResult)2;
		}

		private ConnectionResult ArmoryConnections(Tile tileA, Tile tileB, Doorway doorwayA, Doorway doorwayB)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			foreach (Tag tag in doorwayA.Tags)
			{
				if (GrandDoorwayTags.Contains(tag) && !((IEnumerable<Tag>)doorwayB.Tags).Contains(tag))
				{
					doorwayA.BlockerPrefabWeights.Clear();
					doorwayB.BlockerPrefabWeights.Clear();
					return (ConnectionResult)1;
				}
			}
			return (ConnectionResult)2;
		}
	}
}