Decompiled source of Mimics v2.7.0

BepInEx/plugins/Mimics.dll

Decompiled a day ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyMimics.Properties;
using Microsoft.CodeAnalysis;
using Mimics.API;
using Mimics.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Mimics")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A mod for Lethal Company that adds a dangerous new enemy")]
[assembly: AssemblyFileVersion("2.7.0.0")]
[assembly: AssemblyInformationalVersion("2.7.0+706d7d08776e43ab76cb7e2f61d69b80750cf601")]
[assembly: AssemblyProduct("Mimics")]
[assembly: AssemblyTitle("Mimics")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.7.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
	}
}
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 LethalCompanyMimics.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("LethalCompanyMimics.Properties.Resources", typeof(Resources).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] mimicdoor => (byte[])ResourceManager.GetObject("mimicdoor", resourceCulture);

		internal Resources()
		{
		}
	}
}
namespace Mimics
{
	[BepInPlugin("x753.Mimics", "Mimics", "2.7.0")]
	public class Mimics : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(GameNetworkManager))]
		internal class GameNetworkManagerPatch
		{
			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			private static void StartPatch()
			{
				((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(MimicNetworkerPrefab);
			}
		}

		[HarmonyPatch(typeof(StartOfRound))]
		internal class StartOfRoundPatch
		{
			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			private static void StartPatch(ref StartOfRound __instance)
			{
				if (((NetworkBehaviour)__instance).IsServer && (Object)(object)MimicNetworker.Instance == (Object)null)
				{
					Object.Instantiate<GameObject>(MimicNetworkerPrefab).GetComponent<NetworkObject>().Spawn(false);
				}
			}
		}

		[HarmonyPatch(typeof(Terminal))]
		internal class TerminalPatch
		{
			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			private static void StartPatch(ref StartOfRound __instance)
			{
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Expected O, but got Unknown
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e1: Expected O, but got Unknown
				Terminal val = Object.FindObjectOfType<Terminal>();
				if (!Object.op_Implicit((Object)(object)val.enemyFiles.Find((TerminalNode node) => node.creatureName == "Mimics")))
				{
					MimicCreatureID = val.enemyFiles.Count;
					MimicFile.creatureFileID = MimicCreatureID;
					val.enemyFiles.Add(MimicFile);
					TerminalKeyword val2 = val.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info");
					TerminalKeyword val3 = new TerminalKeyword
					{
						word = "mimics",
						isVerb = false,
						defaultVerb = val2
					};
					List<CompatibleNoun> list = val2.compatibleNouns.ToList();
					list.Add(new CompatibleNoun
					{
						noun = val3,
						result = MimicFile
					});
					val2.compatibleNouns = list.ToArray();
					List<TerminalKeyword> list2 = val.terminalNodes.allKeywords.ToList();
					list2.Add(val3);
					val.terminalNodes.allKeywords = list2.ToArray();
				}
			}
		}

		[HarmonyPatch(typeof(RoundManager))]
		internal class RoundManagerPatch
		{
			[HarmonyPatch("SetExitIDs")]
			[HarmonyPostfix]
			private static void SetExitIDsPatch(ref RoundManager __instance, Vector3 mainEntrancePosition)
			{
				//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_02de: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0302: Unknown result type (might be due to invalid IL or missing references)
				//IL_0307: Unknown result type (might be due to invalid IL or missing references)
				//IL_0313: Unknown result type (might be due to invalid IL or missing references)
				//IL_031a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0326: Unknown result type (might be due to invalid IL or missing references)
				//IL_05da: Unknown result type (might be due to invalid IL or missing references)
				//IL_05df: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e3: 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_0659: Unknown result type (might be due to invalid IL or missing references)
				//IL_0730: Unknown result type (might be due to invalid IL or missing references)
				//IL_0735: Unknown result type (might be due to invalid IL or missing references)
				//IL_0739: Unknown result type (might be due to invalid IL or missing references)
				//IL_0745: Unknown result type (might be due to invalid IL or missing references)
				//IL_074a: Unknown result type (might be due to invalid IL or missing references)
				//IL_074e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0753: Unknown result type (might be due to invalid IL or missing references)
				//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d3: 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_03de: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_047b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0483: Unknown result type (might be due to invalid IL or missing references)
				//IL_048c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0496: Unknown result type (might be due to invalid IL or missing references)
				//IL_0836: Unknown result type (might be due to invalid IL or missing references)
				//IL_0840: Expected O, but got Unknown
				//IL_093e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0965: Unknown result type (might be due to invalid IL or missing references)
				//IL_08df: Unknown result type (might be due to invalid IL or missing references)
				//IL_0906: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a15: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a3c: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)MimicNetworker.Instance == (Object)null)
				{
					return;
				}
				MimicsAPI.MainAPI.RefreshMimicEventHandler();
				MimicDoor.allMimics = new List<MimicDoor>();
				int num = 0;
				Dungeon currentDungeon = __instance.dungeonGenerator.Generator.CurrentDungeon;
				if (!InteriorWhitelist.Contains(((Object)currentDungeon.DungeonFlow).name.ToLower().Trim()))
				{
					return;
				}
				int num2 = 0;
				int[] array = new int[6]
				{
					MimicNetworker.Instance.SpawnWeight0.Value,
					MimicNetworker.Instance.SpawnWeight1.Value,
					MimicNetworker.Instance.SpawnWeight2.Value,
					MimicNetworker.Instance.SpawnWeight3.Value,
					MimicNetworker.Instance.SpawnWeight4.Value,
					MimicNetworker.Instance.SpawnWeightMax.Value
				};
				int num3 = 0;
				int[] array2 = array;
				foreach (int num4 in array2)
				{
					num3 += num4;
				}
				Random random = new Random(StartOfRound.Instance.randomMapSeed + 753);
				int num5 = random.Next(0, num3);
				int num6 = 0;
				for (int j = 0; j < array.Length; j++)
				{
					if (num5 < array[j] + num6)
					{
						num2 = j;
						break;
					}
					num6 += array[j];
				}
				if (num2 == 5)
				{
					num2 = 999;
				}
				int num7 = (Object.FindObjectsOfType<EntranceTeleport>(false).Length - 2) / 2;
				if (MimicNetworker.Instance.SpawnRateDynamic.Value && num2 < num7 && num7 > 1)
				{
					num2 += random.Next(0, 2);
				}
				if (MimicNetworker.Instance.SpawnRateDynamic.Value && currentDungeon.AllTiles.Count > 100)
				{
					num2 += random.Next(0, 2);
				}
				if (((NetworkBehaviour)RoundManager.Instance).IsOwner)
				{
					Debug.Log((object)("I am the host. Desired mimics: " + num2));
				}
				else
				{
					Debug.Log((object)("I am the client. Desired mimics: " + num2));
				}
				List<Doorway> list = new List<Doorway>();
				Bounds val2 = default(Bounds);
				foreach (Tile allTile in currentDungeon.AllTiles)
				{
					foreach (Doorway unusedDoorway in allTile.UnusedDoorways)
					{
						if (!MimicsAPI.MainAPI.IgnoreDefaultPlacementValidation(unusedDoorway))
						{
							if (unusedDoorway.HasDoorPrefabInstance || (Object)(object)((Component)unusedDoorway).GetComponentInChildren<SpawnSyncedObject>(true) == (Object)null)
							{
								continue;
							}
							GameObject gameObject = ((Component)((Component)((Component)unusedDoorway).GetComponentInChildren<SpawnSyncedObject>(true)).transform.parent).gameObject;
							if (!((Object)gameObject).name.StartsWith("AlleyExitDoorContainer") || gameObject.activeSelf)
							{
								continue;
							}
							bool flag = false;
							Matrix4x4 val = Matrix4x4.TRS(((Component)unusedDoorway).transform.position, ((Component)unusedDoorway).transform.rotation, new Vector3(1f, 1f, 1f));
							((Bounds)(ref val2))..ctor(new Vector3(0f, 1.5f, 5.5f), new Vector3(2f, 6f, 8f));
							((Bounds)(ref val2)).center = ((Matrix4x4)(ref val)).MultiplyPoint3x4(((Bounds)(ref val2)).center);
							Collider[] array3 = Physics.OverlapBox(((Bounds)(ref val2)).center, ((Bounds)(ref val2)).extents, ((Component)unusedDoorway).transform.rotation, LayerMask.GetMask(new string[3] { "Room", "Railing", "MapHazards" }));
							int i = 0;
							if (i < array3.Length)
							{
								_ = array3[i];
								flag = true;
							}
							if (flag)
							{
								continue;
							}
							foreach (Tile allTile2 in currentDungeon.AllTiles)
							{
								if (!((Object)(object)allTile == (Object)(object)allTile2))
								{
									Vector3 origin = ((Component)unusedDoorway).transform.position + 5f * ((Component)unusedDoorway).transform.forward;
									Bounds val3 = UnityUtil.CalculateProxyBounds(((Component)allTile2).gameObject, true, Vector3.up);
									Ray val4 = default(Ray);
									((Ray)(ref val4)).origin = origin;
									((Ray)(ref val4)).direction = Vector3.up;
									if (((Bounds)(ref val3)).IntersectRay(val4) && (((Object)allTile2).name.Contains("Catwalk") || ((Object)allTile2).name.Contains("LargeForkTile") || ((Object)allTile2).name.Contains("4x4BigStair") || ((Object)allTile2).name.Contains("ElevatorConnector") || (((Object)allTile2).name.Contains("StartRoom") && !((Object)allTile2).name.Contains("Manor"))))
									{
										flag = true;
									}
									val4 = default(Ray);
									((Ray)(ref val4)).origin = origin;
									((Ray)(ref val4)).direction = Vector3.down;
									if (((Bounds)(ref val3)).IntersectRay(val4) && (((Object)allTile2).name.Contains("MediumRoomHallway1B") || ((Object)allTile2).name.Contains("LargeForkTile") || ((Object)allTile2).name.Contains("4x4BigStair") || ((Object)allTile2).name.Contains("ElevatorConnector") || ((Object)allTile2).name.Contains("StartRoom")))
									{
										flag = true;
									}
								}
							}
							if (flag)
							{
								continue;
							}
						}
						if (MimicsAPI.MainAPI.IsPlacementValid(unusedDoorway))
						{
							list.Add(unusedDoorway);
						}
					}
				}
				Shuffle(list, StartOfRound.Instance.randomMapSeed);
				List<Vector3> list2 = new List<Vector3>();
				foreach (Doorway item in list)
				{
					if (num >= num2)
					{
						break;
					}
					bool flag2 = false;
					Vector3 val5 = ((Component)item).transform.position + 5f * ((Component)item).transform.forward;
					foreach (Vector3 item2 in list2)
					{
						if (Vector3.Distance(val5, item2) < 4f)
						{
							flag2 = true;
							break;
						}
					}
					if (flag2)
					{
						continue;
					}
					list2.Add(val5);
					GameObject gameObject2 = ((Component)((Component)((Component)item).GetComponentInChildren<SpawnSyncedObject>(true)).transform.parent).gameObject;
					GameObject val6 = Object.Instantiate<GameObject>(MimicPrefab, ((Component)item).transform);
					val6.transform.position = gameObject2.transform.position;
					MimicDoor component = val6.GetComponent<MimicDoor>();
					component.scanNode.creatureScanID = MimicCreatureID;
					AudioSource[] componentsInChildren = val6.GetComponentsInChildren<AudioSource>(true);
					foreach (AudioSource obj in componentsInChildren)
					{
						obj.volume = MimicVolume / 100f;
						obj.outputAudioMixerGroup = StartOfRound.Instance.ship3DAudio.outputAudioMixerGroup;
					}
					if (SpawnRates[5] == 9753 && num == 0)
					{
						val6.transform.position = new Vector3(-7f, 0f, -10f);
					}
					MimicDoor.allMimics.Add(component);
					component.mimicIndex = num;
					num++;
					GameObject gameObject3 = ((Component)((Component)item).transform.GetChild(0)).gameObject;
					gameObject3.SetActive(false);
					Bounds bounds = ((Collider)component.frameBox).bounds;
					Vector3 center = ((Bounds)(ref bounds)).center;
					bounds = ((Collider)component.frameBox).bounds;
					Collider[] array3 = Physics.OverlapBox(center, ((Bounds)(ref bounds)).extents, Quaternion.identity);
					foreach (Collider val7 in array3)
					{
						if (((Object)((Component)val7).gameObject).name.Contains("Shelf"))
						{
							((Component)val7).gameObject.SetActive(false);
						}
					}
					Light componentInChildren = gameObject2.GetComponentInChildren<Light>(true);
					((Component)componentInChildren).transform.parent.SetParent(val6.transform);
					MeshRenderer[] componentsInChildren2 = val6.GetComponentsInChildren<MeshRenderer>();
					for (int i = 0; i < componentsInChildren2.Length; i++)
					{
						Material[] materials = ((Renderer)componentsInChildren2[i]).materials;
						foreach (Material obj2 in materials)
						{
							obj2.shader = ((Renderer)gameObject3.GetComponentInChildren<MeshRenderer>(true)).material.shader;
							obj2.renderQueue = ((Renderer)gameObject3.GetComponentInChildren<MeshRenderer>(true)).material.renderQueue;
						}
					}
					component.interactTrigger.onInteract = new InteractEvent();
					((UnityEvent<PlayerControllerB>)(object)component.interactTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)component.TouchMimic);
					MimicsAPI.MainAPI.OnMimicCreated(component, item);
					if (MimicsAPI.MainAPI.OverrideDefaultImperfectionCreation(component, item))
					{
						MimicsAPI.MainAPI.OnMimicCreateImperfections(component);
						break;
					}
					if (MimicPerfection)
					{
						continue;
					}
					component.interactTrigger.timeToHold = 0.9f;
					if (!ColorBlindMode)
					{
						if ((StartOfRound.Instance.randomMapSeed + num) % 2 == 0)
						{
							((Renderer)val6.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.490566f, 0.1226415f, 0.1302275f);
							((Renderer)val6.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(0.4339623f, 0.1043965f, 0.1150277f);
							componentInChildren.colorTemperature = 1250f;
						}
						else
						{
							((Renderer)val6.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.5f, 0.1580188f, 0.1657038f);
							((Renderer)val6.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(43f / 106f, 0.1358579f, 0.1393619f);
							componentInChildren.colorTemperature = 1300f;
						}
					}
					else if ((StartOfRound.Instance.randomMapSeed + num) % 2 == 0)
					{
						component.interactTrigger.timeToHold = 1.1f;
					}
					else
					{
						component.interactTrigger.timeToHold = 1f;
					}
					if (!EasyMode)
					{
						continue;
					}
					switch (new Random(StartOfRound.Instance.randomMapSeed + num).Next(0, 4))
					{
					case 0:
						if (!ColorBlindMode)
						{
							((Renderer)val6.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.489f, 0.2415526f, 0.1479868f);
							((Renderer)val6.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(0.489f, 0.2415526f, 0.1479868f);
						}
						else
						{
							component.interactTrigger.timeToHold = 1.5f;
						}
						break;
					case 1:
						component.interactTrigger.hoverTip = "Feed : [LMB]";
						component.interactTrigger.holdTip = "Feed : [LMB]";
						break;
					case 2:
						component.interactTrigger.hoverIcon = component.LostFingersIcon;
						break;
					case 3:
						component.interactTrigger.holdTip = "DIE : [LMB]";
						component.interactTrigger.timeToHold = 0.5f;
						break;
					default:
						component.interactTrigger.hoverTip = "BUG, REPORT TO DEVELOPER";
						break;
					}
				}
			}
		}

		[HarmonyPatch(typeof(SprayPaintItem))]
		internal class SprayPaintItemPatch
		{
			[HarmonyPatch("SprayPaintClientRpc")]
			[HarmonyPostfix]
			private static void SprayPaintClientRpcPatch(SprayPaintItem __instance, Vector3 sprayPos, Vector3 sprayRot)
			{
				//IL_000f: 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)
				if ((Object)(object)MimicNetworker.Instance == (Object)null)
				{
					return;
				}
				RaycastHit sprayHit = __instance.sprayHit;
				if ((Object)(object)((RaycastHit)(ref sprayHit)).collider != (Object)null && ((Object)((RaycastHit)(ref sprayHit)).collider).name == "MimicSprayCollider")
				{
					MimicDoor component = ((Component)((Component)((RaycastHit)(ref sprayHit)).collider).transform.parent.parent).GetComponent<MimicDoor>();
					component.sprayCount++;
					if (component.sprayCount > 8)
					{
						MimicNetworker.Instance.MimicAddAnger(1, component.mimicIndex);
					}
				}
			}
		}

		[HarmonyPatch(typeof(LockPicker))]
		internal class LockPickerPatch
		{
			[HarmonyPatch("ItemActivate")]
			[HarmonyPostfix]
			private static void ItemActivatePatch(LockPicker __instance, bool used, bool buttonDown = true)
			{
				//IL_000f: 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_0028: 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)
				if ((Object)(object)MimicNetworker.Instance == (Object)null)
				{
					return;
				}
				RaycastHit hit = __instance.hit;
				if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) && !((object)(RaycastHit)(ref hit)).Equals((object)default(RaycastHit)) && !((Object)(object)((RaycastHit)(ref hit)).transform.parent == (Object)null))
				{
					Transform parent = ((RaycastHit)(ref hit)).transform.parent;
					if (((Object)parent).name.StartsWith("MimicDoor"))
					{
						MimicNetworker.Instance.MimicLockPick(__instance, ((Component)parent).GetComponent<MimicDoor>().mimicIndex);
					}
				}
			}
		}

		private const string modGUID = "x753.Mimics";

		private const string modName = "Mimics";

		private const string modVersion = "2.7.0";

		private readonly Harmony harmony = new Harmony("x753.Mimics");

		internal static ManualLogSource MimicsLogger;

		private static Mimics Instance;

		public static GameObject MimicPrefab;

		public static GameObject MimicNetworkerPrefab;

		public static TerminalNode MimicFile;

		public static int MimicCreatureID;

		public static int[] SpawnRates;

		public static bool MimicPerfection;

		public static bool UpgradeCompatibility;

		public static bool EasyMode;

		public static bool ColorBlindMode;

		public static float MimicVolume;

		public static bool DynamicSpawnRate;

		public static List<string> InteriorWhitelist;

		private void Awake()
		{
			AssetBundle obj = AssetBundle.LoadFromMemory(Resources.mimicdoor);
			MimicPrefab = obj.LoadAsset<GameObject>("Assets/MimicDoor.prefab");
			MimicNetworkerPrefab = obj.LoadAsset<GameObject>("Assets/MimicNetworker.prefab");
			MimicFile = obj.LoadAsset<TerminalNode>("Assets/MimicFile.asset");
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			harmony.PatchAll();
			MimicsLogger = Logger.CreateLogSource("x753.Mimics");
			MimicsLogger.LogInfo((object)"Plugin Mimics is loaded!!");
			InteriorWhitelist = (from s in ((BaseUnityPlugin)this).Config.Bind<string>("Compatibility", "Interiors Whitelist", "Level1Flow, Level1Flow3Exits, Level1FlowExtraLarge, Level2Flow, SDMLevel, OfficeDungeonFlow, TranquillityManorFlow", "Comma separated list of interiors that mimics can spawn in. Not all interiors will work.").Value.ToLower().Split(',')
				select s.Trim()).ToList();
			SpawnRates = new int[6]
			{
				((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Zero Mimics", 23, "Weight of zero mimics spawning").Value,
				((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "One Mimic", 69, "Weight of one mimic spawning").Value,
				((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Two Mimics", 7, "Weight of two mimics spawning").Value,
				((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Three Mimics", 1, "Weight of three mimics spawning").Value,
				((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Four Mimics", 0, "Weight of four mimics spawning").Value,
				((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Maximum Mimics", 0, "Weight of maximum mimics spawning").Value
			};
			DynamicSpawnRate = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawn Rate", "Dynamic Spawn Rate", true, "Increases mimic spawn rate based on dungeon size and the number of instances of the real thing.").Value;
			MimicPerfection = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Perfect Mimics", false, "Select this if you want mimics to be the exact same color as the real thing. Overrides all difficulty settings.").Value;
			UpgradeCompatibility = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Upgrade Compatibility", false, "Mimics won't instantly attack when struck with a powerful blow, such as an upgraded shovel.").Value;
			EasyMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Easy Mode", false, "Each mimic will have one of several possible imperfections to help you tell if it's a mimic.").Value;
			ColorBlindMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Color Blind Mode", false, "Replaces all color differences with another way to differentiate mimics.").Value;
			MimicVolume = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SFX Volume", 100, "Volume of the mimic's SFX (0-100)").Value;
			if (MimicVolume < 0f)
			{
				MimicVolume = 0f;
			}
			if (MimicVolume > 100f)
			{
				MimicVolume = 100f;
			}
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		public static void Shuffle<T>(IList<T> list, int seed)
		{
			Random random = new Random(seed);
			int num = list.Count;
			while (num > 1)
			{
				num--;
				int index = random.Next(num + 1);
				T value = list[index];
				list[index] = list[num];
				list[num] = value;
			}
		}
	}
	public class MimicNetworker : NetworkBehaviour
	{
		public static MimicNetworker Instance;

		public NetworkVariable<int> SpawnWeight0 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public NetworkVariable<int> SpawnWeight1 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public NetworkVariable<int> SpawnWeight2 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public NetworkVariable<int> SpawnWeight3 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public NetworkVariable<int> SpawnWeight4 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public NetworkVariable<int> SpawnWeightMax = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public NetworkVariable<bool> SpawnRateDynamic = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public override void OnNetworkSpawn()
		{
			Instance = this;
			if (((NetworkBehaviour)this).IsServer)
			{
				Instance.SpawnWeight0.Value = Mimics.SpawnRates[0];
				Instance.SpawnWeight1.Value = Mimics.SpawnRates[1];
				Instance.SpawnWeight2.Value = Mimics.SpawnRates[2];
				Instance.SpawnWeight3.Value = Mimics.SpawnRates[3];
				Instance.SpawnWeight4.Value = Mimics.SpawnRates[4];
				Instance.SpawnWeightMax.Value = Mimics.SpawnRates[5];
				Instance.SpawnRateDynamic.Value = Mimics.DynamicSpawnRate;
			}
		}

		public void MimicAttack(int playerId, int mimicIndex, bool ownerOnly = false)
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				Instance.MimicAttackClientRpc(playerId, mimicIndex);
			}
			else if (!ownerOnly)
			{
				Instance.MimicAttackServerRpc(playerId, mimicIndex);
			}
		}

		[ClientRpc]
		public void MimicAttackClientRpc(int playerId, int mimicIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			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(2885019175u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					BytePacker.WriteValueBitPacked(val2, mimicIndex);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2885019175u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].Attack(playerId));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void MimicAttackServerRpc(int playerId, int mimicIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			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(1024971481u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					BytePacker.WriteValueBitPacked(val2, mimicIndex);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1024971481u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Instance.MimicAttackClientRpc(playerId, mimicIndex);
				}
			}
		}

		public void MimicAddAnger(int amount, int mimicIndex)
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				Instance.MimicAddAngerClientRpc(amount, mimicIndex);
			}
			else
			{
				Instance.MimicAddAngerServerRpc(amount, mimicIndex);
			}
		}

		[ClientRpc]
		public void MimicAddAngerClientRpc(int amount, int mimicIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			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(1137632670u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, amount);
					BytePacker.WriteValueBitPacked(val2, mimicIndex);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1137632670u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].AddAnger(amount));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void MimicAddAngerServerRpc(int amount, int mimicIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			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(669208889u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, amount);
					BytePacker.WriteValueBitPacked(val2, mimicIndex);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 669208889u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Instance.MimicAddAngerClientRpc(amount, mimicIndex);
				}
			}
		}

		public void MimicLockPick(LockPicker lockPicker, int mimicIndex, bool ownerOnly = false)
		{
			int playerId = (int)((GrabbableObject)lockPicker).playerHeldBy.playerClientId;
			if (((NetworkBehaviour)this).IsOwner)
			{
				Instance.MimicLockPickClientRpc(playerId, mimicIndex);
			}
			else if (!ownerOnly)
			{
				Instance.MimicLockPickServerRpc(playerId, mimicIndex);
			}
		}

		[ClientRpc]
		public void MimicLockPickClientRpc(int playerId, int mimicIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			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(3716888238u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					BytePacker.WriteValueBitPacked(val2, mimicIndex);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3716888238u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].MimicLockPick(playerId));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void MimicLockPickServerRpc(int playerId, int mimicIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			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(1897916243u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					BytePacker.WriteValueBitPacked(val2, mimicIndex);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1897916243u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Instance.MimicLockPickClientRpc(playerId, mimicIndex);
				}
			}
		}

		protected override void __initializeVariables()
		{
			if (SpawnWeight0 == null)
			{
				throw new Exception("MimicNetworker.SpawnWeight0 cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)SpawnWeight0).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight0, "SpawnWeight0");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight0);
			if (SpawnWeight1 == null)
			{
				throw new Exception("MimicNetworker.SpawnWeight1 cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)SpawnWeight1).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight1, "SpawnWeight1");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight1);
			if (SpawnWeight2 == null)
			{
				throw new Exception("MimicNetworker.SpawnWeight2 cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)SpawnWeight2).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight2, "SpawnWeight2");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight2);
			if (SpawnWeight3 == null)
			{
				throw new Exception("MimicNetworker.SpawnWeight3 cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)SpawnWeight3).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight3, "SpawnWeight3");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight3);
			if (SpawnWeight4 == null)
			{
				throw new Exception("MimicNetworker.SpawnWeight4 cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)SpawnWeight4).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight4, "SpawnWeight4");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight4);
			if (SpawnWeightMax == null)
			{
				throw new Exception("MimicNetworker.SpawnWeightMax cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)SpawnWeightMax).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeightMax, "SpawnWeightMax");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeightMax);
			if (SpawnRateDynamic == null)
			{
				throw new Exception("MimicNetworker.SpawnRateDynamic cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)SpawnRateDynamic).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnRateDynamic, "SpawnRateDynamic");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnRateDynamic);
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_MimicNetworker()
		{
			//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
			NetworkManager.__rpc_func_table.Add(2885019175u, new RpcReceiveHandler(__rpc_handler_2885019175));
			NetworkManager.__rpc_func_table.Add(1024971481u, new RpcReceiveHandler(__rpc_handler_1024971481));
			NetworkManager.__rpc_func_table.Add(1137632670u, new RpcReceiveHandler(__rpc_handler_1137632670));
			NetworkManager.__rpc_func_table.Add(669208889u, new RpcReceiveHandler(__rpc_handler_669208889));
			NetworkManager.__rpc_func_table.Add(3716888238u, new RpcReceiveHandler(__rpc_handler_3716888238));
			NetworkManager.__rpc_func_table.Add(1897916243u, new RpcReceiveHandler(__rpc_handler_1897916243));
		}

		private static void __rpc_handler_2885019175(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				int mimicIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((MimicNetworker)(object)target).MimicAttackClientRpc(playerId, mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1024971481(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				int mimicIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((MimicNetworker)(object)target).MimicAttackServerRpc(playerId, mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1137632670(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			{
				int amount = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref amount);
				int mimicIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((MimicNetworker)(object)target).MimicAddAngerClientRpc(amount, mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_669208889(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			{
				int amount = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref amount);
				int mimicIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((MimicNetworker)(object)target).MimicAddAngerServerRpc(amount, mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3716888238(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				int mimicIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((MimicNetworker)(object)target).MimicLockPickClientRpc(playerId, mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1897916243(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				int mimicIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((MimicNetworker)(object)target).MimicLockPickServerRpc(playerId, mimicIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "MimicNetworker";
		}
	}
	public class MimicDoor : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass14_0
		{
			public PlayerControllerB player;

			public float startTime;

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

		[CompilerGenerated]
		private sealed class <>c__DisplayClass15_0
		{
			public LockPicker lockPicker;

			public float startTime;

			internal bool <MimicLockPick>b__0()
			{
				if (((GrabbableObject)lockPicker).isHeld)
				{
					return Time.timeSinceLevelLoad - startTime > 10f;
				}
				return true;
			}
		}

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

			private object <>2__current;

			public MimicDoor <>4__this;

			public int amount;

			private Sprite <oldIcon>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Expected O, but got Unknown
				//IL_0137: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Expected O, but got Unknown
				//IL_01a1: 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)
				int num = <>1__state;
				MimicDoor mimicDoor = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (mimicDoor.angering)
					{
						return false;
					}
					if (mimicDoor.attacking)
					{
						return false;
					}
					mimicDoor.angering = true;
					mimicDoor.anger += amount;
					if (mimicDoor.anger == 1)
					{
						<oldIcon>5__2 = mimicDoor.interactTrigger.hoverIcon;
						mimicDoor.interactTrigger.hoverIcon = mimicDoor.LostFingersIcon;
						mimicDoor.mimicAnimator.SetTrigger("Growl");
						<>2__current = (object)new WaitForSeconds(2.75f);
						<>1__state = 1;
						return true;
					}
					if (mimicDoor.anger == 2)
					{
						mimicDoor.interactTrigger.holdTip = "DIE : [LMB]";
						mimicDoor.interactTrigger.timeToHold = 0.25f;
						<oldIcon>5__2 = mimicDoor.interactTrigger.hoverIcon;
						mimicDoor.interactTrigger.hoverIcon = mimicDoor.LostFingersIcon;
						mimicDoor.mimicAnimator.SetTrigger("Growl");
						<>2__current = (object)new WaitForSeconds(2.75f);
						<>1__state = 2;
						return true;
					}
					if (mimicDoor.anger > 2)
					{
						PlayerControllerB val = null;
						float num2 = 9999f;
						PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
						foreach (PlayerControllerB val2 in allPlayerScripts)
						{
							float num3 = Vector3.Distance(((Component)mimicDoor).transform.position, ((Component)val2).transform.position);
							if (num3 < num2)
							{
								num2 = num3;
								val = val2;
							}
						}
						if ((Object)(object)val != (Object)null)
						{
							MimicNetworker.Instance.MimicAttackClientRpc((int)val.playerClientId, mimicDoor.mimicIndex);
						}
					}
					mimicDoor.sprayCount = 0;
					mimicDoor.angering = false;
					return false;
				case 1:
					<>1__state = -1;
					mimicDoor.interactTrigger.hoverIcon = <oldIcon>5__2;
					mimicDoor.sprayCount = 0;
					mimicDoor.angering = false;
					return false;
				case 2:
					<>1__state = -1;
					mimicDoor.interactTrigger.hoverIcon = <oldIcon>5__2;
					mimicDoor.sprayCount = 0;
					mimicDoor.angering = false;
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public int playerId;

			public MimicDoor <>4__this;

			private <>c__DisplayClass14_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00bc: 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_00d6: Expected O, but got Unknown
				//IL_0101: 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_011b: Expected O, but got Unknown
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Unknown result type (might be due to invalid IL or missing references)
				//IL_0160: Expected O, but got Unknown
				//IL_018b: 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_01a5: Expected O, but got Unknown
				//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b2: Expected O, but got Unknown
				//IL_0249: Unknown result type (might be due to invalid IL or missing references)
				//IL_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_0393: Unknown result type (might be due to invalid IL or missing references)
				//IL_039d: Expected O, but got Unknown
				//IL_0444: Unknown result type (might be due to invalid IL or missing references)
				//IL_044e: Expected O, but got Unknown
				//IL_020d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0217: Expected O, but got Unknown
				//IL_0270: Unknown result type (might be due to invalid IL or missing references)
				//IL_027a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0280: Unknown result type (might be due to invalid IL or missing references)
				//IL_0362: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				MimicDoor mimicDoor = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass14_0();
					<>8__1.player = StartOfRound.Instance.allPlayerScripts[playerId];
					MimicsAPI.MainAPI.OnMimicAttackStart(mimicDoor, <>8__1.player);
					mimicDoor.attacking = true;
					mimicDoor.interactTrigger.interactable = false;
					mimicDoor.mimicAnimator.SetTrigger("Attack");
					mimicDoor.playerTarget.transform.position = ((Component)<>8__1.player).transform.position;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					mimicDoor.playerTarget.transform.position = ((Component)<>8__1.player).transform.position;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					mimicDoor.playerTarget.transform.position = ((Component)<>8__1.player).transform.position;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					mimicDoor.playerTarget.transform.position = ((Component)<>8__1.player).transform.position;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 4;
					return true;
				case 4:
				{
					<>1__state = -1;
					float num2 = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)mimicDoor.frameBox).transform.position);
					if (num2 < 8f)
					{
						HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
					}
					else if (num2 < 14f)
					{
						HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
					}
					<>2__current = (object)new WaitForSeconds(0.2f);
					<>1__state = 5;
					return true;
				}
				case 5:
					<>1__state = -1;
					if (((NetworkBehaviour)<>8__1.player).IsOwner && Vector3.Distance(((Component)<>8__1.player).transform.position, ((Component)mimicDoor).transform.position) < 8.45f)
					{
						<>8__1.player.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0, default(Vector3));
					}
					<>8__1.startTime = Time.timeSinceLevelLoad;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)<>8__1.player.deadBody != (Object)null || Time.timeSinceLevelLoad - <>8__1.startTime > 4f));
					<>1__state = 6;
					return true;
				case 6:
					<>1__state = -1;
					if ((Object)(object)<>8__1.player.deadBody != (Object)null)
					{
						<>8__1.player.deadBody.attachedTo = mimicDoor.grabPoint.transform;
						<>8__1.player.deadBody.attachedLimb = <>8__1.player.deadBody.bodyParts[5];
						<>8__1.player.deadBody.matchPositionExactly = true;
						for (int i = 0; i < <>8__1.player.deadBody.bodyParts.Length; i++)
						{
							((Component)<>8__1.player.deadBody.bodyParts[i]).GetComponent<Collider>().excludeLayers = LayerMask.op_Implicit(-1);
						}
					}
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 7;
					return true;
				case 7:
					<>1__state = -1;
					if ((Object)(object)<>8__1.player.deadBody != (Object)null)
					{
						<>8__1.player.deadBody.attachedTo = null;
						<>8__1.player.deadBody.attachedLimb = null;
						<>8__1.player.deadBody.matchPositionExactly = false;
						((Component)((Component)<>8__1.player.deadBody).transform.GetChild(0)).gameObject.SetActive(false);
						<>8__1.player.deadBody = null;
					}
					<>2__current = (object)new WaitForSeconds(4.5f);
					<>1__state = 8;
					return true;
				case 8:
					<>1__state = -1;
					mimicDoor.attacking = false;
					mimicDoor.interactTrigger.interactable = true;
					MimicsAPI.MainAPI.OnMimicAttackEnd(mimicDoor);
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public MimicDoor <>4__this;

			public int playerId;

			private <>c__DisplayClass15_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0220: Unknown result type (might be due to invalid IL or missing references)
				//IL_0230: Unknown result type (might be due to invalid IL or missing references)
				//IL_0246: 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_0260: Unknown result type (might be due to invalid IL or missing references)
				//IL_026a: Expected O, but got Unknown
				//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02da: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0302: Expected O, but got Unknown
				//IL_0352: Unknown result type (might be due to invalid IL or missing references)
				//IL_035e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fa: Expected O, but got Unknown
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_019a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				int num = <>1__state;
				MimicDoor mimicDoor = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass15_0();
					if (mimicDoor.angering)
					{
						return false;
					}
					if (mimicDoor.attacking)
					{
						return false;
					}
					ref LockPicker lockPicker = ref <>8__1.lockPicker;
					GrabbableObject currentlyHeldObjectServer = StartOfRound.Instance.allPlayerScripts[playerId].currentlyHeldObjectServer;
					lockPicker = (LockPicker)(object)((currentlyHeldObjectServer is LockPicker) ? currentlyHeldObjectServer : null);
					if ((Object)(object)<>8__1.lockPicker == (Object)null)
					{
						return false;
					}
					mimicDoor.attacking = true;
					mimicDoor.interactTrigger.interactable = false;
					AudioSource component = ((Component)<>8__1.lockPicker).GetComponent<AudioSource>();
					component.PlayOneShot(<>8__1.lockPicker.placeLockPickerClips[Random.Range(0, <>8__1.lockPicker.placeLockPickerClips.Length)]);
					<>8__1.lockPicker.armsAnimator.SetBool("mounted", true);
					<>8__1.lockPicker.armsAnimator.SetBool("picking", true);
					component.Play();
					component.pitch = Random.Range(0.94f, 1.06f);
					<>8__1.lockPicker.isOnDoor = true;
					<>8__1.lockPicker.isPickingLock = true;
					((GrabbableObject)<>8__1.lockPicker).grabbable = false;
					if (((NetworkBehaviour)<>8__1.lockPicker).IsOwner)
					{
						((GrabbableObject)<>8__1.lockPicker).playerHeldBy.DiscardHeldObject(true, ((NetworkBehaviour)MimicNetworker.Instance).NetworkObject, ((Component)mimicDoor).transform.position + ((Component)mimicDoor).transform.up * 1.5f - ((Component)mimicDoor).transform.forward * 1.15f, true);
					}
					<>8__1.startTime = Time.timeSinceLevelLoad;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => !((GrabbableObject)<>8__1.lockPicker).isHeld || Time.timeSinceLevelLoad - <>8__1.startTime > 10f));
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					((Component)<>8__1.lockPicker).transform.localEulerAngles = new Vector3(((Component)mimicDoor).transform.eulerAngles.x, ((Component)mimicDoor).transform.eulerAngles.y + 90f, ((Component)mimicDoor).transform.eulerAngles.z);
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>8__1.lockPicker.RetractClaws();
					((Component)<>8__1.lockPicker).transform.SetParent((Transform)null);
					((GrabbableObject)<>8__1.lockPicker).startFallingPosition = ((Component)<>8__1.lockPicker).transform.position;
					((GrabbableObject)<>8__1.lockPicker).FallToGround(false, false, default(Vector3));
					((GrabbableObject)<>8__1.lockPicker).grabbable = true;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 3;
					return true;
				case 3:
				{
					<>1__state = -1;
					mimicDoor.anger = 3;
					mimicDoor.attacking = false;
					mimicDoor.interactTrigger.interactable = false;
					PlayerControllerB val = null;
					float num2 = 9999f;
					PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val2 in allPlayerScripts)
					{
						float num3 = Vector3.Distance(((Component)mimicDoor).transform.position, ((Component)val2).transform.position);
						if (num3 < num2)
						{
							num2 = num3;
							val = val2;
						}
					}
					if ((Object)(object)val != (Object)null)
					{
						MimicNetworker.Instance.MimicAttackClientRpc((int)val.playerClientId, mimicDoor.mimicIndex);
					}
					else
					{
						mimicDoor.interactTrigger.interactable = true;
					}
					return false;
				}
				}
			}

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

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

		public GameObject playerTarget;

		public BoxCollider frameBox;

		public Sprite LostFingersIcon;

		public Animator mimicAnimator;

		public GameObject grabPoint;

		public InteractTrigger interactTrigger;

		public ScanNodeProperties scanNode;

		public int anger;

		public bool angering;

		public int sprayCount;

		private bool attacking;

		public static List<MimicDoor> allMimics;

		public int mimicIndex;

		public void TouchMimic(PlayerControllerB player)
		{
			if (!attacking)
			{
				MimicNetworker.Instance.MimicAttack((int)player.playerClientId, mimicIndex);
			}
		}

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

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

		[IteratorStateMachine(typeof(<AddAnger>d__16))]
		public IEnumerator AddAnger(int amount)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AddAnger>d__16(0)
			{
				<>4__this = this,
				amount = amount
			};
		}
	}
	public class MimicCollider : MonoBehaviour, IHittable
	{
		public MimicDoor mimic;

		bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (Mimics.UpgradeCompatibility)
			{
				force = 1;
			}
			MimicNetworker.Instance.MimicAddAnger(force, mimic.mimicIndex);
			return true;
		}
	}
	public class MimicListener : MonoBehaviour, INoiseListener
	{
		public MimicDoor mimic;

		private int tolerance = 100;

		void INoiseListener.DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if ((noiseLoudness >= 0.9f || noiseID == 101158) && Vector3.Distance(noisePosition, ((Component)mimic).transform.position) < 5f)
			{
				switch (noiseID)
				{
				case 75:
					tolerance--;
					break;
				case 5:
					tolerance -= 15;
					break;
				case 101158:
					tolerance -= 35;
					break;
				default:
					tolerance -= 30;
					break;
				}
				if (tolerance <= 0)
				{
					tolerance = 100;
					MimicNetworker.Instance.MimicAddAnger(1, mimic.mimicIndex);
				}
			}
		}
	}
}
namespace Mimics.API
{
	public static class MimicsAPI
	{
		private static MainMimicsAPI _API;

		internal static MainMimicsAPI MainAPI
		{
			get
			{
				if (_API == null)
				{
					_API = new MainMimicsAPI();
				}
				return _API;
			}
		}

		public static IMimicsAPI GetAPI()
		{
			return MainAPI;
		}
	}
	public interface IMimicsAPI
	{
		void RegisterMimicEventHandler(MimicEventHandler handler);

		MimicEventHandler GetCurrentMimicEventHandler();
	}
	internal class MainMimicsAPI : IMimicsAPI
	{
		internal List<MimicEventHandler> mimicEventHandlers = new List<MimicEventHandler>();

		internal MimicEventHandler _currentMimicEventHandler;

		public void RegisterMimicEventHandler(MimicEventHandler handler)
		{
			Mimics.MimicsLogger.LogInfo((object)("Registered handler for " + handler.ModGUID));
			mimicEventHandlers.Add(handler);
		}

		public MimicEventHandler GetCurrentMimicEventHandler()
		{
			return _currentMimicEventHandler;
		}

		internal void RefreshMimicEventHandler()
		{
			_currentMimicEventHandler = null;
			foreach (MimicEventHandler mimicEventHandler in mimicEventHandlers)
			{
				try
				{
					if (mimicEventHandler.IsMyInteriorLoaded && (_currentMimicEventHandler == null || mimicEventHandler.Priority > _currentMimicEventHandler.Priority))
					{
						_currentMimicEventHandler = mimicEventHandler;
					}
				}
				catch (Exception ex)
				{
					string text = ((_currentMimicEventHandler != null) ? _currentMimicEventHandler.ModGUID : "NULL");
					Mimics.MimicsLogger.LogError((object)("Error with IsMyInteriorLoaded/Priority function for handler " + mimicEventHandler.ModGUID + " or " + text));
					Mimics.MimicsLogger.LogError((object)ex.ToString());
				}
			}
		}

		internal bool IgnoreDefaultPlacementValidation(Doorway doorway)
		{
			try
			{
				if (_currentMimicEventHandler == null)
				{
					return false;
				}
				return _currentMimicEventHandler.IgnoreDefaultPlacementValidation(doorway);
			}
			catch (Exception ex)
			{
				Mimics.MimicsLogger.LogError((object)("Error with IgnoreDefaultPlacementValidation function for handler " + _currentMimicEventHandler.ModGUID));
				Mimics.MimicsLogger.LogError((object)ex.ToString());
			}
			return false;
		}

		internal bool IsPlacementValid(Doorway doorway)
		{
			try
			{
				if (_currentMimicEventHandler == null)
				{
					return true;
				}
				return _currentMimicEventHandler.IsPlacementValid(doorway);
			}
			catch (Exception ex)
			{
				Mimics.MimicsLogger.LogError((object)("Error with IsPlacementValid function for handler " + _currentMimicEventHandler.ModGUID));
				Mimics.MimicsLogger.LogError((object)ex.ToString());
			}
			return true;
		}

		internal bool OverrideDefaultImperfectionCreation(MimicDoor mimicDoor, Doorway doorway)
		{
			try
			{
				if (_currentMimicEventHandler == null)
				{
					return false;
				}
				return _currentMimicEventHandler.OverrideDefaultImperfectionCreation(mimicDoor, doorway);
			}
			catch (Exception ex)
			{
				Mimics.MimicsLogger.LogError((object)("Error with OverrideDefaultImperfectionCreation function for handler " + _currentMimicEventHandler.ModGUID));
				Mimics.MimicsLogger.LogError((object)ex.ToString());
			}
			return false;
		}

		internal void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway)
		{
			try
			{
				_currentMimicEventHandler?.OnMimicCreated(mimicDoor, doorway);
			}
			catch (Exception ex)
			{
				Mimics.MimicsLogger.LogError((object)("Error with OnMimicCreated function for handler " + _currentMimicEventHandler.ModGUID));
				Mimics.MimicsLogger.LogError((object)ex.ToString());
			}
		}

		internal void OnMimicCreateImperfections(MimicDoor mimicDoor)
		{
			try
			{
				_currentMimicEventHandler?.OnMimicCreateImperfections(mimicDoor);
			}
			catch (Exception ex)
			{
				Mimics.MimicsLogger.LogError((object)("Error with OnMimicCreateImperfections function for handler " + _currentMimicEventHandler.ModGUID));
				Mimics.MimicsLogger.LogError((object)ex.ToString());
			}
		}

		internal void OnMimicAttackStart(MimicDoor mimicDoor, PlayerControllerB playerToAttack)
		{
			try
			{
				_currentMimicEventHandler?.OnMimicAttackStart(mimicDoor, playerToAttack);
			}
			catch (Exception ex)
			{
				Mimics.MimicsLogger.LogError((object)("Error with OnMimicAttackStart function for handler " + _currentMimicEventHandler.ModGUID));
				Mimics.MimicsLogger.LogError((object)ex.ToString());
			}
		}

		internal void OnMimicAttackEnd(MimicDoor mimicDoor)
		{
			try
			{
				_currentMimicEventHandler?.OnMimicAttackEnd(mimicDoor);
			}
			catch (Exception ex)
			{
				Mimics.MimicsLogger.LogError((object)("Error with OnMimicAttackEnd function for handler " + _currentMimicEventHandler.ModGUID));
				Mimics.MimicsLogger.LogError((object)ex.ToString());
			}
		}
	}
	public abstract class MimicEventHandler
	{
		public abstract string ModGUID { get; }

		public virtual bool IsMyInteriorLoaded => false;

		public virtual int Priority => 0;

		public virtual bool IsPlacementValid(Doorway doorway)
		{
			return true;
		}

		public virtual bool IgnoreDefaultPlacementValidation(Doorway doorway)
		{
			return false;
		}

		public virtual bool OverrideDefaultImperfectionCreation(MimicDoor mimicDoor, Doorway doorway)
		{
			return false;
		}

		public virtual void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway)
		{
		}

		public virtual void OnMimicCreateImperfections(MimicDoor mimicDoor)
		{
		}

		public virtual void OnMimicAttackStart(MimicDoor mimicDoor, PlayerControllerB playerToAttack)
		{
		}

		public virtual void OnMimicAttackEnd(MimicDoor mimicDoor)
		{
		}
	}
}
namespace Mimics.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}