Decompiled source of TheDoctor v1.0.4

TheDoctor.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LegaFusionCore;
using LegaFusionCore.Behaviours.Addons;
using LegaFusionCore.Behaviours.Shaders;
using LegaFusionCore.Managers;
using LegaFusionCore.Utilities;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using TheDoctor.Behaviours.Enemies;
using TheDoctor.Behaviours.Items;
using TheDoctor.Managers;
using TheDoctor.NetcodePatcher;
using TheDoctor.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("TheDoctor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TheDoctor")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7cd86020-c68a-4a12-9d59-36e91e964aa1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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 TheDoctor
{
	public class Constants
	{
		public const string GLOBAL = "_Global_";

		public const string BRAIN = "Brain";

		public const string CORPSE = "Corpse";

		public const string HEART = "Heart";

		public const string EYE = "Eye";

		public const string SPECTRAL_DECOY = "Spectral Decoy";

		public const string SCREEN_MATERIALS_PREFIX = "MI_Doctor_Screen";

		public const string MSG_INFORMATION = "Information";

		public const string MSG_DOCTOR_ITEM_TIP = "This item will help you find the Doctor's brain.";
	}
	[BepInPlugin("Lega.TheDoctor", "The Doctor", "1.0.4")]
	public class TheDoctor : BaseUnityPlugin
	{
		internal const string modGUID = "Lega.TheDoctor";

		internal const string modName = "The Doctor";

		internal const string modVersion = "1.0.4";

		private readonly Harmony harmony = new Harmony("Lega.TheDoctor");

		private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "thedoctor"));

		internal static ManualLogSource mls;

		public static ConfigFile configFile;

		public static GameObject managerPrefab = NetworkPrefabs.CreateNetworkPrefab("TheDoctorNetworkManager");

		public static EnemyType doctorCorpseEnemy;

		public static Item doctorHeart;

		public static Item doctorEye;

		public static Item doctorBrain;

		public static GameObject doctorClone;

		public static GameObject darkExplosionParticle;

		public static GameObject electroExplosionParticle;

		public static GameObject doctorCloneAudio;

		public static Material inertScreen;

		public static Material scanningScreen;

		public static Material foundScreen;

		public void Awake()
		{
			mls = Logger.CreateLogSource("TheDoctor");
			configFile = ((BaseUnityPlugin)this).Config;
			ConfigManager.Load();
			LoadManager();
			NetcodePatcher();
			LoadEnemies();
			LoadItems();
			LoadGameObjects();
			LoadMaterials();
			harmony.PatchAll(typeof(StartOfRoundPatch));
		}

		public static void LoadManager()
		{
			Utilities.FixMixerGroups(managerPrefab);
			managerPrefab.AddComponent<TheDoctorNetworkManager>();
		}

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

		public static void LoadEnemies()
		{
			EnemyType val = bundle.LoadAsset<EnemyType>("Assets/DoctorBrainAI/DoctorBrainEnemy.asset");
			val.probabilityCurve = ConfigManager.ParseCurveFromString();
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			var (dictionary, dictionary2) = ConfigManager.GetEnemiesSpawns();
			Enemies.RegisterEnemy(val, dictionary, dictionary2, bundle.LoadAsset<TerminalNode>("Assets/DoctorBrainAI/DoctorBrainTN.asset"), bundle.LoadAsset<TerminalKeyword>("Assets/DoctorBrainAI/DoctorBrainTK.asset"));
			doctorCorpseEnemy = bundle.LoadAsset<EnemyType>("Assets/DoctorCorpseAI/DoctorCorpseEnemy.asset");
			NetworkPrefabs.RegisterNetworkPrefab(doctorCorpseEnemy.enemyPrefab);
			Enemies.RegisterEnemy(doctorCorpseEnemy, 0, (LevelTypes)1, bundle.LoadAsset<TerminalNode>("Assets/DoctorCorpseAI/DoctorCorpseTN.asset"), bundle.LoadAsset<TerminalKeyword>("Assets/DoctorCorpseAI/DoctorCorpseTK.asset"));
		}

		public void LoadItems()
		{
			doctorHeart = RegisterItem(typeof(DoctorHeart), bundle.LoadAsset<Item>("Assets/DoctorHeart/DoctorHeartItem.asset"));
			doctorEye = RegisterItem(typeof(DoctorEye), bundle.LoadAsset<Item>("Assets/DoctorEye/DoctorEyeItem.asset"));
			doctorBrain = RegisterItem(typeof(DoctorBrain), bundle.LoadAsset<Item>("Assets/DoctorBrain/DoctorBrainItem.asset"));
		}

		public Item RegisterItem(Type type, Item item)
		{
			if ((Object)(object)item.spawnPrefab.GetComponent(type) == (Object)null)
			{
				Component obj = item.spawnPrefab.AddComponent(type);
				PhysicsProp val = (PhysicsProp)(object)((obj is PhysicsProp) ? obj : null);
				((GrabbableObject)val).grabbable = true;
				((GrabbableObject)val).grabbableToEnemies = true;
				((GrabbableObject)val).itemProperties = item;
			}
			NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			Utilities.FixMixerGroups(item.spawnPrefab);
			Items.RegisterItem(item);
			return item;
		}

		public void LoadGameObjects()
		{
			darkExplosionParticle = RegisterGameObject("Assets/Particles/DarkExplosionParticle.prefab");
			electroExplosionParticle = RegisterGameObject("Assets/Particles/ElectroExplosionParticle.prefab");
			doctorClone = RegisterGameObject("Assets/DoctorClone/DoctorClone.prefab");
			doctorCloneAudio = RegisterGameObject("Assets/Audios/Assets/DoctorCloneAudio.prefab");
		}

		public GameObject RegisterGameObject(string path)
		{
			GameObject val = bundle.LoadAsset<GameObject>(path);
			NetworkPrefabs.RegisterNetworkPrefab(val);
			Utilities.FixMixerGroups(val);
			return val;
		}

		public static void LoadMaterials()
		{
			inertScreen = bundle.LoadAsset<Material>("Assets/DoctorCorpseAI/Materials/MI_Doctor_Screen_Inert.mat");
			scanningScreen = bundle.LoadAsset<Material>("Assets/DoctorCorpseAI/Materials/MI_Doctor_Screen_Scanning.mat");
			foundScreen = bundle.LoadAsset<Material>("Assets/DoctorCorpseAI/Materials/MI_Doctor_Screen_Found.mat");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TheDoctor";

		public const string PLUGIN_NAME = "TheDoctor";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace TheDoctor.Patches
{
	internal class StartOfRoundPatch
	{
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyBefore(new string[] { "evaisa.lethallib" })]
		[HarmonyPostfix]
		private static void StartRound(ref StartOfRound __instance)
		{
			if (NetworkManager.Singleton.IsHost && (Object)(object)TheDoctorNetworkManager.Instance == (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(TheDoctor.managerPrefab, ((Component)__instance).transform.parent);
				val.GetComponent<NetworkObject>().Spawn(false);
				TheDoctor.mls.LogInfo((object)"Spawning TheDoctorNetworkManager");
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable()
		{
			TheDoctorNetworkManager.Instance = null;
		}
	}
}
namespace TheDoctor.Managers
{
	public class ConfigManager
	{
		public static ConfigEntry<string> spawnWeights;

		public static ConfigEntry<string> probabilityCurve;

		public static ConfigEntry<int> amountCorpses;

		public static ConfigEntry<float> scanMinCooldown;

		public static ConfigEntry<float> scanMaxCooldown;

		public static ConfigEntry<bool> isShipDialogue;

		public static ConfigEntry<bool> isInsideDialogue;

		public static ConfigEntry<float> scanDuration;

		public static ConfigEntry<float> corpseSpeed;

		public static ConfigEntry<int> heartTrackingDuration;

		public static ConfigEntry<int> heartMinValue;

		public static ConfigEntry<int> heartMaxValue;

		public static ConfigEntry<int> eyeTrackingDuration;

		public static ConfigEntry<int> eyeMinValue;

		public static ConfigEntry<int> eyeMaxValue;

		public static ConfigEntry<bool> brainSpecialAbility;

		public static ConfigEntry<int> brainMinValue;

		public static ConfigEntry<int> brainMaxValue;

		public static ConfigEntry<int> spectralDecoyCooldown;

		public static ConfigEntry<int> spectralDecoyDamage;

		public static void Load()
		{
			spawnWeights = TheDoctor.configFile.Bind<string>("_Global_", "Spawn weights", "Vanilla:20,Modded:20", "Brain enemy spawn weights");
			probabilityCurve = TheDoctor.configFile.Bind<string>("_Global_", "Probability curve", "0,1;0.25,1;0.3,0;1,0", "Brain probability curve (format : time,value;time,value;...)");
			amountCorpses = TheDoctor.configFile.Bind<int>("_Global_", "Amount corpses", 8, "Amount of Corpse that spawn at the same time as the Brain");
			scanMinCooldown = TheDoctor.configFile.Bind<float>("_Global_", "Scan min", 2f, "Minimum cooldown duration between Corpse scans");
			scanMaxCooldown = TheDoctor.configFile.Bind<float>("_Global_", "Scan max", 8f, "Maximum cooldown duration between Corpse scans");
			isShipDialogue = TheDoctor.configFile.Bind<bool>("_Global_", "Ship dialogue", true, "Trigger the ship dialogue when the Brain spawns");
			isInsideDialogue = TheDoctor.configFile.Bind<bool>("_Global_", "Inside dialogue", true, "Trigger the inside dialogue when the Brain spawns");
			scanDuration = TheDoctor.configFile.Bind<float>("Corpse", "Scan duration", 7f, "Scan duration for the Corpse");
			corpseSpeed = TheDoctor.configFile.Bind<float>("Corpse", "Corpse speed", 5f, "Corpse speed");
			heartTrackingDuration = TheDoctor.configFile.Bind<int>("Heart", "Tracking duration", 45, "Heart tracking duration");
			heartMinValue = TheDoctor.configFile.Bind<int>("Heart", "Min value", 15, "Heart min value");
			heartMaxValue = TheDoctor.configFile.Bind<int>("Heart", "Max value", 30, "Heart max value");
			eyeTrackingDuration = TheDoctor.configFile.Bind<int>("Eye", "Tracking duration", 45, "Eye tracking duration");
			eyeMinValue = TheDoctor.configFile.Bind<int>("Eye", "Min value", 15, "Eye min value");
			eyeMaxValue = TheDoctor.configFile.Bind<int>("Eye", "Max value", 30, "Eye max value");
			brainSpecialAbility = TheDoctor.configFile.Bind<bool>("Brain", "Enable special ability", true, "Enable Brain item's special ability (Spectral Decoy)?");
			brainMinValue = TheDoctor.configFile.Bind<int>("Brain", "Min value", 50, "Brain min value");
			brainMaxValue = TheDoctor.configFile.Bind<int>("Brain", "Max value", 100, "Brain max value");
			spectralDecoyCooldown = TheDoctor.configFile.Bind<int>("Spectral Decoy", "Cooldown", 120, "Cooldown duration of the Spectral Decoy");
			spectralDecoyDamage = TheDoctor.configFile.Bind<int>("Spectral Decoy", "Damage", 2, "Damages inflicted by the Spectral Decoy");
		}

		public static AnimationCurve ParseCurveFromString()
		{
			//IL_0023: 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_0039: 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_0049: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_0113: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (!string.IsNullOrWhiteSpace(probabilityCurve.Value))
			{
				string[] array = probabilityCurve.Value.Split(';');
				List<Keyframe> list = new List<Keyframe>();
				string[] array2 = array;
				foreach (string text in array2)
				{
					string[] array3 = text.Split(',');
					if (array3.Length == 2 && float.TryParse(array3[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && float.TryParse(array3[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2))
					{
						list.Add(new Keyframe(result, result2));
					}
				}
				if (list.Count == 0)
				{
					return new AnimationCurve((Keyframe[])(object)new Keyframe[2]
					{
						new Keyframe(0f, 1f),
						new Keyframe(1f, 1f)
					});
				}
				return new AnimationCurve(list.ToArray());
			}
			return new AnimationCurve((Keyframe[])(object)new Keyframe[2]
			{
				new Keyframe(0f, 1f),
				new Keyframe(1f, 1f)
			});
		}

		public static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) GetEnemiesSpawns()
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			foreach (string item in from s in spawnWeights.Value.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (int.TryParse(array[1], out var result))
				{
					if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
					{
						dictionary[result2] = result;
					}
					else
					{
						dictionary2[text] = result;
					}
				}
			}
			return (dictionary, dictionary2);
		}
	}
	internal class TheDoctorNetworkManager : NetworkBehaviour
	{
		public static TheDoctorNetworkManager Instance;

		public void Awake()
		{
			Instance = this;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SpawnSpectralDecoyEveryoneRpc(int playerId)
		{
			//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_0043: 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_005f: 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_0072: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1781084080u, val2, val, (SendTo)6, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val3, playerId);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 1781084080u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
					Object.Instantiate<GameObject>(TheDoctor.doctorClone, ((Component)component).transform.position + ((Component)component).transform.forward * 1.5f, ((Component)component).transform.rotation);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1781084080u, new RpcReceiveHandler(__rpc_handler_1781084080), "SpawnSpectralDecoyEveryoneRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1781084080(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 playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TheDoctorNetworkManager)(object)target).SpawnSpectralDecoyEveryoneRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "TheDoctorNetworkManager";
		}
	}
}
namespace TheDoctor.Behaviours.MapObjects
{
	public class DoctorClone : NetworkBehaviour
	{
		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(AttractEnemiesCoroutine());
		}

		public IEnumerator AttractEnemiesCoroutine()
		{
			GameObject val = Object.Instantiate<GameObject>(TheDoctor.doctorCloneAudio, ((Component)this).transform.position, Quaternion.identity);
			AudioSource component = val.GetComponent<AudioSource>();
			if (component != null)
			{
				component.Play();
			}
			Vector3 explosionPosition = ((Component)this).transform.position + ((Component)this).transform.forward * 1.6f;
			List<EnemyAI> enemies = new List<EnemyAI>();
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 10f, 524288, (QueryTriggerInteraction)2);
			Collider[] array2 = array;
			foreach (Collider val2 in array2)
			{
				EnemyAI val3 = ((Component)val2).GetComponent<EnemyAICollisionDetect>()?.mainScript;
				if ((Object)(object)val3 != (Object)null)
				{
					enemies.Add(val3);
				}
			}
			for (float timePassed = 0f; timePassed < 5.5f; timePassed += Time.deltaTime)
			{
				enemies.ForEach(delegate(EnemyAI e)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					e.SetDestinationToPosition(explosionPosition, false);
					e.moveTowardsDestination = true;
				});
				yield return null;
			}
			if (LFCUtilities.IsServer)
			{
				enemies.Where((EnemyAI e) => Vector3.Distance(((Component)e).transform.position, explosionPosition) <= 5f).ToList().ForEach(delegate(EnemyAI e)
				{
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					e.HitEnemyOnLocalClient(ConfigManager.spectralDecoyDamage.Value, default(Vector3), (PlayerControllerB)null, false, -1);
				});
			}
			SpawnParticle(explosionPosition);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		public void SpawnParticle(Vector3 explosionPosition)
		{
			//IL_0005: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(TheDoctor.darkExplosionParticle, explosionPosition + ((Component)this).transform.up, Quaternion.identity);
			ParticleSystem component = val.GetComponent<ParticleSystem>();
			MainModule main = component.main;
			float duration = ((MainModule)(ref main)).duration;
			main = component.main;
			MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
			Object.Destroy((Object)(object)val, duration + ((MinMaxCurve)(ref startLifetime)).constantMax);
		}

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "DoctorClone";
		}
	}
}
namespace TheDoctor.Behaviours.Items
{
	public class DoctorBrain : PhysicsProp
	{
		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (ConfigManager.brainSpecialAbility.Value)
			{
				LFCUtilities.SetAddonComponent<SpectralDecoy>((GrabbableObject)(object)this, "Spectral Decoy", false);
			}
			if (LFCUtilities.IsServer)
			{
				int scrapValueEveryoneRpc = Random.Range(ConfigManager.brainMinValue.Value, ConfigManager.brainMaxValue.Value);
				SetScrapValueEveryoneRpc(scrapValueEveryoneRpc);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SetScrapValueEveryoneRpc(int value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: 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_0072: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(613876334u, val2, val, (SendTo)6, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val3, value);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 613876334u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((GrabbableObject)this).SetScrapValue(value);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(613876334u, new RpcReceiveHandler(__rpc_handler_613876334), "SetScrapValueEveryoneRpc");
			((PhysicsProp)this).__initializeRpcs();
		}

		private static void __rpc_handler_613876334(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 scrapValueEveryoneRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref scrapValueEveryoneRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoctorBrain)(object)target).SetScrapValueEveryoneRpc(scrapValueEveryoneRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "DoctorBrain";
		}
	}
	public class DoctorEye : DoctorItem
	{
		public Animator animator;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			currentTimeLeft = ConfigManager.eyeTrackingDuration.Value;
		}

		public override void Update()
		{
			//IL_0060: 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_006d: 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_008c: 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)
			//IL_00a2: 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_00c2: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (isTracking && !((Object)(object)doctorBrain == (Object)null) && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController) && !((GrabbableObject)this).playerHeldBy.quickMenuManager.isMenuOpen)
			{
				MovementActions movement = ((GrabbableObject)this).playerHeldBy.playerActions.Movement;
				Vector2 val = ((MovementActions)(ref movement)).Look.ReadValue<Vector2>() * (float)IngamePlayerSettings.Instance.settings.lookSensitivity * 0.008f;
				doctorBrain.cameraPivot.Rotate(new Vector3(0f, val.x, 0f));
				float num = doctorBrain.cameraPivot.localEulerAngles.x - val.y;
				num = ((num > 180f) ? (num - 360f) : num);
				num = Mathf.Clamp(num, -45f, 45f);
				doctorBrain.cameraPivot.localEulerAngles = new Vector3(num, doctorBrain.cameraPivot.localEulerAngles.y, 0f);
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			base.ItemActivate(used, buttonDown);
			if (!hasBeenUsed && isTracking && !((Object)(object)doctorBrain == (Object)null))
			{
				doctorBrain.SwitchCamera((Object)(object)doctorBrain.camera == (Object)(object)GameNetworkManager.Instance.localPlayerController.gameplayCamera);
			}
		}

		public override void StartTrackingForClients()
		{
			base.StartTrackingForClients();
			((GrabbableObject)this).itemProperties.toolTips[0] = "Switch camera : [LMB]";
		}

		public override void ItemDeactivate()
		{
			base.ItemDeactivate();
			doctorBrain?.SwitchCamera(switchingBack: true);
		}

		public override void PocketItem()
		{
			doctorBrain?.SwitchCamera(switchingBack: true);
			((GrabbableObject)this).PocketItem();
		}

		public override void DiscardItem()
		{
			doctorBrain?.SwitchCamera(switchingBack: true);
			((GrabbableObject)this).DiscardItem();
		}

		public override void OnDestroy()
		{
			doctorBrain?.SwitchCamera(switchingBack: true);
			((NetworkBehaviour)this).OnDestroy();
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			base.__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "DoctorEye";
		}
	}
	public class DoctorHeart : DoctorItem
	{
		public AudioSource audioSource;

		public Animator animator;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			currentTimeLeft = ConfigManager.heartTrackingDuration.Value;
		}

		public override void Update()
		{
			//IL_0039: 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)
			((GrabbableObject)this).Update();
			if (!hasBeenUsed && isTracking && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)doctorBrain == (Object)null))
			{
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)doctorBrain).transform.position);
				float num2 = Mathf.Pow(Mathf.Clamp01(1f - num / 100f), 2f);
				audioSource.pitch = Mathf.Lerp(0.75f, 2.5f, num2);
				animator.speed = Mathf.Lerp(1.2f, 4f, num2);
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (!audioSource.isPlaying)
			{
				base.ItemActivate(used, buttonDown);
			}
		}

		public override void StartTrackingForClients()
		{
			base.StartTrackingForClients();
			audioSource.Play();
			animator.Play("heartbeat", 0, 0f);
		}

		public override void ItemDeactivate()
		{
			base.ItemDeactivate();
			if (audioSource.isPlaying)
			{
				audioSource.Stop();
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			base.__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "DoctorHeart";
		}
	}
	public class DoctorItem : PhysicsProp
	{
		public bool hasBeenUsed;

		public bool isTracking;

		public int currentTimeLeft;

		public DoctorBrainAI doctorBrain;

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void InitializeDoctorItemEveryoneRpc(NetworkObjectReference obj, int value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: 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_0072: 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_0088: 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)
			//IL_00a9: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(894187736u, val2, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val3, value);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 894187736u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val4 = default(NetworkObject);
				if (((NetworkObjectReference)(ref obj)).TryGet(ref val4, (NetworkManager)null))
				{
					doctorBrain = ((Component)val4).gameObject.GetComponentInChildren<DoctorBrainAI>();
					((GrabbableObject)this).SetScrapValue(value);
				}
			}
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController))
			{
				HUDManager.Instance.DisplayTip("Information", "This item will help you find the Doctor's brain.", false, false, "LC_Tip1");
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!hasBeenUsed && !isTracking)
			{
				StartTrackingEveryoneRpc();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StartTrackingEveryoneRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: 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_0072: 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_0085: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3520928820u, val2, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 3520928820u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((Object)(object)doctorBrain == (Object)null)
				{
					TheDoctor.mls.LogError((object)"Doctor's Brain not found for the Doctor's item");
					return;
				}
				isTracking = true;
				StartTrackingForClients();
			}
		}

		public virtual void StartTrackingForClients()
		{
			((MonoBehaviour)this).StartCoroutine(StartTrackingCoroutine());
			doctorBrain.canLoseChase = false;
			IEnumerable<DoctorCorpseAI> enumerable = Array.Empty<DoctorCorpseAI>();
			if (!doctorBrain.corpses.Any((DoctorCorpseAI c) => (Object)(object)c != (Object)null && ((EnemyAI)c).currentBehaviourStateIndex == 2))
			{
				enumerable = doctorBrain.corpses.Where((DoctorCorpseAI c) => (Object)(object)c != (Object)null && ((EnemyAI)c).currentBehaviourStateIndex != 2).Take(3);
			}
			foreach (DoctorCorpseAI item in enumerable)
			{
				((EnemyAI)item).targetPlayer = ((GrabbableObject)this).playerHeldBy;
				((EnemyAI)item).SwitchToBehaviourStateOnLocalClient(2);
			}
		}

		public IEnumerator StartTrackingCoroutine()
		{
			while (currentTimeLeft > 0)
			{
				yield return (object)new WaitForSecondsRealtime(1f);
				currentTimeLeft--;
				((GrabbableObject)this).SetControlTipsForItem();
			}
			ItemDeactivate();
		}

		public override void SetControlTipsForItem()
		{
			if (!((GrabbableObject)this).isPocketed && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController))
			{
				string text = (isTracking ? $"[Time Left : {currentTimeLeft}]" : "");
				HUDManager.Instance.ChangeControlTipMultiple(((GrabbableObject)this).itemProperties.toolTips.Concat(new <>z__ReadOnlyArray<string>(new string[1] { text })).ToArray(), true, ((GrabbableObject)this).itemProperties);
			}
		}

		public virtual void ItemDeactivate()
		{
			hasBeenUsed = true;
			isTracking = false;
			if ((Object)(object)doctorBrain != (Object)null)
			{
				doctorBrain.canLoseChase = true;
			}
			((GrabbableObject)this).SetControlTipsForItem();
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(894187736u, new RpcReceiveHandler(__rpc_handler_894187736), "InitializeDoctorItemEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(3520928820u, new RpcReceiveHandler(__rpc_handler_3520928820), "StartTrackingEveryoneRpc");
			((PhysicsProp)this).__initializeRpcs();
		}

		private static void __rpc_handler_894187736(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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				int value = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref value);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoctorItem)(object)target).InitializeDoctorItemEveryoneRpc(obj, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3520928820(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;
				((DoctorItem)(object)target).StartTrackingEveryoneRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "DoctorItem";
		}
	}
	public class SpectralDecoy : AddonComponent
	{
		public override void ActivateAddonAbility()
		{
			if (!base.onCooldown && StartOfRound.Instance.shipHasLanded)
			{
				PlayerControllerB val = ((Component)this).GetComponentInParent<GrabbableObject>()?.playerHeldBy;
				if (!((Object)(object)val == (Object)null))
				{
					((AddonComponent)this).StartCooldown(ConfigManager.spectralDecoyCooldown.Value);
					TheDoctorNetworkManager.Instance.SpawnSpectralDecoyEveryoneRpc((int)val.playerClientId);
				}
			}
		}
	}
}
namespace TheDoctor.Behaviours.Enemies
{
	public class DoctorBrainAI : EnemyAI
	{
		public enum State
		{
			MANAGING
		}

		public List<EntranceTeleport> entrances;

		public List<DoctorCorpseAI> corpses = new List<DoctorCorpseAI>();

		public Camera camera;

		public Transform cameraPivot;

		public Camera playerCamera;

		public float scanTimer;

		public float scanCooldown = 5f;

		public bool canLoseChase = true;

		public Coroutine scanCoroutine;

		public Coroutine killCoroutine;

		public AudioClip speakerHackedSound;

		public AudioClip deathSound;

		public ParticleSystem auraParticle;

		public override void Start()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			playerCamera = localPlayerController.gameplayCamera;
			base.currentBehaviourStateIndex = 0;
			entrances = Object.FindObjectsOfType<EntranceTeleport>().ToList();
			if (LFCUtilities.IsServer)
			{
				SpawnCorpsesForServer();
			}
			if (localPlayerController.isInsideFactory && ConfigManager.isInsideDialogue.Value)
			{
				GameObject val = new GameObject("HackedSpeakerAudio");
				val.transform.parent = ((Component)localPlayerController).transform;
				val.transform.localPosition = Vector3.forward * 50f;
				AudioSource val2 = val.AddComponent<AudioSource>();
				val2.clip = speakerHackedSound;
				val2.spatialBlend = 1f;
				val2.minDistance = 10f;
				val2.maxDistance = 200f;
				val2.rolloffMode = (AudioRolloffMode)1;
				val2.Play();
				Object.Destroy((Object)(object)val, speakerHackedSound.length);
			}
			else if (!localPlayerController.isInsideFactory && ConfigManager.isShipDialogue.Value)
			{
				StartOfRound.Instance.speakerAudioSource.PlayOneShot(speakerHackedSound);
			}
		}

		private void SpawnCorpsesForServer()
		{
			//IL_0015: 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_0026: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] corpsesPositions = GetCorpsesPositions();
			List<NetworkObject> list = new List<NetworkObject>();
			Vector3[] array = corpsesPositions;
			foreach (Vector3 val in array)
			{
				GameObject val2 = Object.Instantiate<GameObject>(TheDoctor.doctorCorpseEnemy.enemyPrefab, val, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f));
				val2.GetComponentInChildren<NetworkObject>().Spawn(true);
				DoctorCorpseAI component = val2.GetComponent<DoctorCorpseAI>();
				component.InitializeCorpseEveryoneRpc(NetworkObjectReference.op_Implicit(((Component)this).GetComponent<NetworkObject>()));
				list.Add(((Component)component).GetComponent<NetworkObject>());
			}
			SpawnCorpsesEveryoneRpc(list.Select((NetworkObject obj) => NetworkObjectReference.op_Implicit(obj)).ToArray());
		}

		public Vector3[] GetCorpsesPositions()
		{
			int value = ConfigManager.amountCorpses.Value;
			List<Vector3> list = (from n in base.allAINodes
				select n.transform.position into p
				where Vector3.Distance(p, ((Component)this).transform.position) > 30f
				select p).ToList();
			if (list.Count < value)
			{
				list = (from n in base.allAINodes
					select n.transform.position into p
					where Vector3.Distance(p, ((Component)this).transform.position) > 30f
					select p).ToList();
			}
			LFCUtilities.Shuffle<Vector3>((IList<Vector3>)list);
			return list.Take(value).ToArray();
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SpawnCorpsesEveryoneRpc(NetworkObjectReference[] enemiesObj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: 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_0072: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_00d0: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2611349699u, val2, val, (SendTo)6, (RpcDelivery)0);
				bool flag = enemiesObj != null;
				((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(enemiesObj, default(ForNetworkSerializable));
				}
				((NetworkBehaviour)this).__endSendRpc(ref val3, 2611349699u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val5 = default(NetworkObject);
			for (int i = 0; i < enemiesObj.Length; i++)
			{
				NetworkObjectReference val4 = enemiesObj[i];
				if (((NetworkObjectReference)(ref val4)).TryGet(ref val5, (NetworkManager)null))
				{
					DoctorCorpseAI componentInChildren = ((Component)val5).gameObject.GetComponentInChildren<DoctorCorpseAI>();
					if ((Object)(object)componentInChildren != (Object)null && !corpses.Contains(componentInChildren))
					{
						corpses.Add(((Component)val5).gameObject.GetComponentInChildren<DoctorCorpseAI>());
					}
				}
			}
		}

		public override void Update()
		{
			((EnemyAI)this).Update();
			if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead)
			{
				if (scanCoroutine != null)
				{
					scanTimer = 0f;
				}
				scanTimer += Time.deltaTime;
			}
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead && killCoroutine == null && base.currentBehaviourStateIndex == 0)
			{
				DoManaging();
			}
		}

		public void DoManaging()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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)
			if (killCoroutine != null)
			{
				return;
			}
			List<DoctorCorpseAI> list = corpses.Where((DoctorCorpseAI c) => (Object)(object)c != (Object)null && ((EnemyAI)c).currentBehaviourStateIndex == 2).ToList();
			if (list.Any())
			{
				bool flag = true;
				foreach (DoctorCorpseAI item in list)
				{
					if ((Object)(object)((EnemyAI)(item?)).targetPlayer != (Object)null && (!canLoseChase || Vector3.Distance(((Component)item).transform.position, ((Component)((EnemyAI)item).targetPlayer).transform.position) <= 20f || Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)item).targetPlayer).transform.position) <= 5f))
					{
						flag = false;
						break;
					}
				}
				if (flag)
				{
					list.ForEach(delegate(DoctorCorpseAI c)
					{
						((EnemyAI)c).SwitchToBehaviourClientRpc(0);
					});
				}
			}
			if (corpses.Any((DoctorCorpseAI c) => (Object)(object)c != (Object)null && (((EnemyAI)c).currentBehaviourStateIndex == 2 || c.hitEnemyCoroutine != null)))
			{
				return;
			}
			if (scanTimer > scanCooldown)
			{
				scanTimer = 0f;
				scanCooldown = Random.Range(ConfigManager.scanMinCooldown.Value, ConfigManager.scanMaxCooldown.Value);
				scanCoroutine = ((MonoBehaviour)this).StartCoroutine(ScanningCoroutine());
			}
			else if (scanCoroutine == null)
			{
				corpses.Where((DoctorCorpseAI c) => (Object)(object)c != (Object)null && ((EnemyAI)c).currentBehaviourStateIndex == 1).ToList().ForEach(delegate(DoctorCorpseAI c)
				{
					((EnemyAI)c).SwitchToBehaviourClientRpc(0);
				});
			}
		}

		public IEnumerator ScanningCoroutine()
		{
			LFCUtilities.Shuffle<DoctorCorpseAI>((IList<DoctorCorpseAI>)corpses);
			List<DoctorCorpseAI> scanningCorpses = corpses.Where((DoctorCorpseAI c) => (Object)(object)c != (Object)null).Take(3).ToList();
			scanningCorpses.ForEach(delegate(DoctorCorpseAI c)
			{
				((EnemyAI)c).SwitchToBehaviourClientRpc(1);
			});
			yield return (object)new WaitForSeconds(0.5f);
			float timePassed = 0f;
			PlayerControllerB foundedPlayer = null;
			for (; timePassed < ConfigManager.scanDuration.Value; timePassed += 0.2f)
			{
				if (scanningCorpses.Any((DoctorCorpseAI c) => (Object)(object)(foundedPlayer = FoundClosestPlayerInRange(c)) != (Object)null))
				{
					break;
				}
				yield return (object)new WaitForSeconds(0.2f);
			}
			foreach (DoctorCorpseAI item in scanningCorpses)
			{
				((EnemyAI)item).creatureSFX.Stop();
				if ((Object)(object)foundedPlayer != (Object)null)
				{
					((EnemyAI)item).targetPlayer = foundedPlayer;
					((EnemyAI)item).SwitchToBehaviourClientRpc(2);
				}
				else
				{
					((EnemyAI)item).SwitchToBehaviourClientRpc(0);
				}
			}
			scanCoroutine = null;
		}

		public PlayerControllerB FoundClosestPlayerInRange(DoctorCorpseAI corpse)
		{
			PlayerControllerB val = ((EnemyAI)corpse).CheckLineOfSightForPlayer(65f, 20, 3);
			if (!((Object)(object)val != (Object)null) || !((EnemyAI)corpse).PlayerIsTargetable(val, false, false))
			{
				return null;
			}
			return val;
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (base.isEnemyDead || (Object)(object)playerWhoHit == (Object)null)
			{
				return;
			}
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			base.enemyHP -= force;
			if (!LFCUtilities.IsServer)
			{
				return;
			}
			corpses.ForEach(delegate(DoctorCorpseAI c)
			{
				if ((Object)(object)c != (Object)null && ((EnemyAI)c).currentBehaviourStateIndex != 2)
				{
					((EnemyAI)c).targetPlayer = playerWhoHit;
					((EnemyAI)c).SwitchToBehaviourClientRpc(2);
				}
			});
			if (base.enemyHP <= 0)
			{
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			if (LFCUtilities.IsServer)
			{
				if (scanCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(scanCoroutine);
					scanCoroutine = null;
				}
				KillAnimationEveryoneRpc(destroy);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void KillAnimationEveryoneRpc(bool destroy)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: 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_0072: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(12872973u, val2, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref destroy, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val3, 12872973u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (killCoroutine == null)
				{
					killCoroutine = ((MonoBehaviour)this).StartCoroutine(KillAnimationCoroutine(destroy));
				}
			}
		}

		public IEnumerator KillAnimationCoroutine(bool destroy)
		{
			base.creatureSFX.PlayOneShot(deathSound);
			auraParticle.Play();
			if (LFCUtilities.IsServer)
			{
				float interval = deathSound.length / (float)corpses.Count;
				foreach (DoctorCorpseAI corpse in corpses.ToList())
				{
					yield return (object)new WaitForSecondsRealtime(interval);
					if (!((Object)(object)((NetworkBehaviour)corpse).NetworkObject == (Object)null) && ((NetworkBehaviour)corpse).NetworkObject.IsSpawned)
					{
						((EnemyAI)corpse).KillEnemyOnOwnerClient(false);
					}
				}
			}
			else
			{
				yield return (object)new WaitForSecondsRealtime(deathSound.length);
			}
			SwitchCamera(switchingBack: true);
			SpawnParticle(((Component)this).transform.position);
			Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up, true, 6f, 6.3f, 50, 0f, (GameObject)null, false);
			if (LFCUtilities.IsServer)
			{
				<>n__0(destroy);
				LFCObjectsManager.SpawnObjectForServer(TheDoctor.doctorBrain.spawnPrefab, ((Component)this).transform.position + Vector3.up * 0.5f);
			}
		}

		public void SwitchCamera(bool switchingBack)
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			if (base.isEnemyDead || (Object)(object)camera == (Object)null || (Object)(object)playerCamera == (Object)null)
			{
				return;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			((Behaviour)camera).enabled = !switchingBack;
			localPlayerController.gameplayCamera = (switchingBack ? playerCamera : camera);
			((Renderer)localPlayerController.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)((!switchingBack) ? 1 : 3);
			if (!switchingBack)
			{
				((Component)cameraPivot).transform.LookAt(((Component)localPlayerController).transform.position);
				CustomPassManager.SetupAuraForObjects((GameObject[])(object)new GameObject[1] { ((Component)localPlayerController).gameObject }, LegaFusionCore.wallhackShader, "The Doctor", Color.yellow);
				CustomPassManager.SetupAuraForObjects(corpses.Select((DoctorCorpseAI c) => ((Component)c).gameObject).ToArray(), LegaFusionCore.wallhackShader, "The Doctor", Color.red);
			}
			else
			{
				CustomPassManager.RemoveAuraByTag("The Doctor");
			}
		}

		public void SpawnParticle(Vector3 explosionPosition)
		{
			//IL_0005: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(TheDoctor.electroExplosionParticle, explosionPosition + ((Component)this).transform.up, Quaternion.identity);
			ParticleSystem component = val.GetComponent<ParticleSystem>();
			MainModule main = component.main;
			float duration = ((MainModule)(ref main)).duration;
			main = component.main;
			MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
			Object.Destroy((Object)(object)val, duration + ((MinMaxCurve)(ref startLifetime)).constantMax);
		}

		[CompilerGenerated]
		[DebuggerHidden]
		private void <>n__0(bool destroy = false)
		{
			((EnemyAI)this).KillEnemy(destroy);
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2611349699u, new RpcReceiveHandler(__rpc_handler_2611349699), "SpawnCorpsesEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(12872973u, new RpcReceiveHandler(__rpc_handler_12872973), "KillAnimationEveryoneRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_2611349699(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_006e: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				NetworkObjectReference[] enemiesObj = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemiesObj, default(ForNetworkSerializable));
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoctorBrainAI)(object)target).SpawnCorpsesEveryoneRpc(enemiesObj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_12872973(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool destroy = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref destroy, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoctorBrainAI)(object)target).KillAnimationEveryoneRpc(destroy);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "DoctorBrainAI";
		}
	}
	public class DoctorCorpseAI : EnemyAI
	{
		public enum State
		{
			FREEZING,
			SCANNING,
			CHASING
		}

		public DoctorBrainAI doctorBrain;

		public Transform TurnCompass;

		public SkinnedMeshRenderer skinnedMeshRenderer;

		public Collider corpseCollider;

		public Light scanLight;

		public Light chaseLight;

		public int oldBehaviourStateIndex;

		public int amountHit;

		public float moveTimer;

		public bool hasDroppedItem;

		public Coroutine attackCoroutine;

		public Coroutine hitEnemyCoroutine;

		public AudioClip chaseSound;

		public AudioClip[] moveSounds = Array.Empty<AudioClip>();

		public AudioClip[] attackSounds = Array.Empty<AudioClip>();

		public ParticleSystem explosionParticle;

		public override void Start()
		{
			//IL_009c: 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_00f8: 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)
			((EnemyAI)this).Start();
			base.currentBehaviourStateIndex = 0;
			((MonoBehaviour)this).StartCoroutine(InitializeAnimatorCoroutine());
			skinnedMeshRenderer = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>();
			if ((Object)(object)skinnedMeshRenderer == (Object)null)
			{
				TheDoctor.mls.LogError((object)"SkinnedMeshRenderer not found for the DoctorCorpse");
			}
			Transform val = ((IEnumerable<Transform>)skinnedMeshRenderer.bones).FirstOrDefault((Func<Transform, bool>)((Transform b) => ((Object)b).name.Equals("PHYSICS_Head")));
			if ((Object)(object)val != (Object)null)
			{
				((Component)scanLight).transform.SetParent(val, false);
				((Component)scanLight).transform.localPosition = Vector3.zero;
				((Component)scanLight).transform.localRotation = Quaternion.Euler(-5f, 0f, 0f);
				((Component)scanLight).gameObject.SetActive(false);
				((Component)chaseLight).transform.SetParent(val, false);
				((Component)chaseLight).transform.localPosition = Vector3.zero;
				((Component)chaseLight).transform.localRotation = Quaternion.Euler(-5f, 0f, 0f);
				((Component)chaseLight).gameObject.SetActive(false);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void InitializeCorpseEveryoneRpc(NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: 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_0072: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3882977255u, val2, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val3, 3882977255u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val4 = default(NetworkObject);
				if (((NetworkObjectReference)(ref obj)).TryGet(ref val4, (NetworkManager)null))
				{
					doctorBrain = ((Component)val4).gameObject.GetComponentInChildren<DoctorBrainAI>();
				}
			}
		}

		public IEnumerator InitializeAnimatorCoroutine()
		{
			base.creatureAnimator.SetTrigger("startRun");
			yield return null;
			base.creatureAnimator.Play("run", 0, Random.value);
			base.creatureAnimator.speed = 0f;
		}

		public override void Update()
		{
			//IL_004e: 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)
			//IL_0074: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead)
			{
				PlayMoveSound();
				if ((Object)(object)base.targetPlayer != (Object)null && base.currentBehaviourStateIndex == 2)
				{
					TurnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
					((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, TurnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime);
				}
			}
		}

		public void PlayMoveSound()
		{
			if (base.currentBehaviourStateIndex == 2)
			{
				moveTimer -= Time.deltaTime;
				if (moveSounds.Length != 0 && moveTimer <= 0f)
				{
					base.creatureSFX.PlayOneShot(moveSounds[Random.Range(0, moveSounds.Length)]);
					moveTimer = 0.4f;
				}
			}
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead)
			{
				switch (base.currentBehaviourStateIndex)
				{
				case 0:
					DoFreezing();
					break;
				case 1:
					DoScanning();
					break;
				case 2:
					DoChasing();
					break;
				}
			}
		}

		public void DoFreezing()
		{
			base.agent.speed = 0f;
			UpdateStateEveryoneRpc();
		}

		public void DoScanning()
		{
			base.agent.speed = 0f;
			UpdateStateEveryoneRpc();
		}

		public void DoChasing()
		{
			base.agent.speed = ((attackCoroutine == null) ? ConfigManager.corpseSpeed.Value : 0f);
			UpdateStateEveryoneRpc();
			((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
			base.moveTowardsDestination = attackCoroutine == null;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void UpdateStateEveryoneRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: 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_0072: 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_0085: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(526680257u, val2, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 526680257u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (base.currentBehaviourStateIndex != oldBehaviourStateIndex)
			{
				oldBehaviourStateIndex = base.currentBehaviourStateIndex;
				switch (base.currentBehaviourStateIndex)
				{
				case 0:
					DoFreezingForClients();
					break;
				case 1:
					DoScanningForClients();
					break;
				case 2:
					DoChasingForClients();
					break;
				}
			}
		}

		public void DoFreezingForClients()
		{
			ConfigureClientState(TheDoctor.inertScreen, 0f, isTrigger: false, isScanLightActive: false, isChaseLightActive: false);
		}

		public void DoScanningForClients()
		{
			ConfigureClientState(TheDoctor.scanningScreen, 0f, isTrigger: false, isScanLightActive: true, isChaseLightActive: false);
		}

		public void DoChasingForClients()
		{
			ConfigureClientState(TheDoctor.foundScreen, 1f, isTrigger: true, isScanLightActive: false, isChaseLightActive: true);
		}

		private void ConfigureClientState(Material screenMaterial, float animationSpeed, bool isTrigger, bool isScanLightActive, bool isChaseLightActive)
		{
			SetScreenMaterial(screenMaterial);
			base.creatureAnimator.speed = animationSpeed;
			corpseCollider.isTrigger = isTrigger;
			((Component)scanLight).gameObject.SetActive(isScanLightActive);
			((Component)chaseLight).gameObject.SetActive(isChaseLightActive);
		}

		public void SetScreenMaterial(Material screenMaterial)
		{
			if ((Object)(object)screenMaterial == (Object)null)
			{
				return;
			}
			Material[] materials = ((Renderer)skinnedMeshRenderer).materials;
			for (int i = 0; i < materials.Length; i++)
			{
				if (((Object)materials[i]).name.StartsWith("MI_Doctor_Screen"))
				{
					materials[i] = screenMaterial;
					break;
				}
			}
			((Renderer)skinnedMeshRenderer).materials = materials;
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (base.currentBehaviourStateIndex == 2 && attackCoroutine == null)
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)GameNetworkManager.Instance.localPlayerController))
				{
					AttackEveryoneRpc((int)val.playerClientId);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void AttackEveryoneRpc(int playerId)
		{
			//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_0043: 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_005f: 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_0072: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2693399625u, val2, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val3, playerId);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 2693399625u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (attackCoroutine == null)
				{
					attackCoroutine = ((MonoBehaviour)this).StartCoroutine(AttackCoroutine(StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>()));
				}
			}
		}

		public IEnumerator AttackCoroutine(PlayerControllerB player)
		{
			base.creatureAnimator.SetTrigger("startAttack");
			base.creatureSFX.PlayOneShot(attackSounds[Random.Range(0, attackSounds.Length)]);
			base.agent.speed = 0f;
			base.moveTowardsDestination = false;
			yield return (object)new WaitForSeconds(0.5f);
			player.DamagePlayer(20, true, true, (CauseOfDeath)8, 0, false, default(Vector3));
			base.creatureAnimator.SetTrigger("startRun");
			attackCoroutine = null;
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (base.isEnemyDead || (Object)(object)playerWhoHit == (Object)null)
			{
				return;
			}
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if (hitEnemyCoroutine == null && base.currentBehaviourStateIndex == 2)
			{
				amountHit++;
				if (amountHit >= 2)
				{
					hitEnemyCoroutine = ((MonoBehaviour)this).StartCoroutine(HitEnemyCoroutine());
				}
			}
			else
			{
				if (hitEnemyCoroutine != null || (base.currentBehaviourStateIndex != 0 && base.currentBehaviourStateIndex != 1))
				{
					return;
				}
				if (doctorBrain.scanCoroutine != null)
				{
					((MonoBehaviour)doctorBrain).StopCoroutine(doctorBrain.scanCoroutine);
					doctorBrain.scanCoroutine = null;
				}
				foreach (DoctorCorpseAI item in doctorBrain.corpses.Where((DoctorCorpseAI c) => (Object)(object)c != (Object)null && ((EnemyAI)c).currentBehaviourStateIndex == 1))
				{
					((EnemyAI)item).creatureSFX.Stop();
					((EnemyAI)item).SwitchToBehaviourStateOnLocalClient(0);
				}
				if (!doctorBrain.corpses.Any((DoctorCorpseAI c) => (Object)(object)c != (Object)null && ((EnemyAI)c).currentBehaviourStateIndex == 2))
				{
					LFCUtilities.Shuffle<DoctorCorpseAI>((IList<DoctorCorpseAI>)doctorBrain.corpses);
					doctorBrain.corpses.Where((DoctorCorpseAI c) => (Object)(object)c != (Object)null && (Object)(object)c != (Object)(object)this).Take(2).ToList()
						.ForEach(delegate(DoctorCorpseAI c)
						{
							((EnemyAI)c).targetPlayer = playerWhoHit;
							((EnemyAI)c).SwitchToBehaviourStateOnLocalClient(2);
						});
				}
				base.targetPlayer = playerWhoHit;
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
			}
		}

		public IEnumerator HitEnemyCoroutine()
		{
			amountHit = 0;
			explosionParticle.Play();
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0);
			if (LFCUtilities.IsServer)
			{
				SpawnDoctorItem();
			}
			hasDroppedItem = true;
			yield return (object)new WaitForSeconds(4f);
			explosionParticle.Stop();
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
			hitEnemyCoroutine = null;
		}

		public void SpawnDoctorItem()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			if (!hasDroppedItem)
			{
				List<GameObject> list = new List<GameObject>(2)
				{
					TheDoctor.doctorHeart.spawnPrefab,
					TheDoctor.doctorEye.spawnPrefab
				};
				GameObject val = Object.Instantiate<GameObject>(list[new Random().Next(list.Count)], ((Component)this).transform.position + Vector3.up * 0.5f, Quaternion.identity, StartOfRound.Instance.propsContainer);
				DoctorItem component = val.GetComponent<DoctorItem>();
				((GrabbableObject)component).fallTime = 0f;
				((GrabbableObject)component).isInFactory = !base.isOutside;
				val.GetComponent<NetworkObject>().Spawn(false);
				int value = ((component is DoctorEye) ? Random.Range(ConfigManager.eyeMinValue.Value, ConfigManager.eyeMaxValue.Value) : Random.Range(ConfigManager.heartMinValue.Value, ConfigManager.heartMaxValue.Value));
				component.InitializeDoctorItemEveryoneRpc(NetworkObjectReference.op_Implicit(((Component)doctorBrain).GetComponent<NetworkObject>()), value);
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			if (LFCUtilities.IsServer)
			{
				KillExplosionEveryoneRpc(destroy);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void KillExplosionEveryoneRpc(bool destroy)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: 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_0072: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1766598522u, val2, val, (SendTo)6, (RpcDelivery)0);
					((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref destroy, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendRpc(ref val3, 1766598522u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up, true, 0f, 4f, 20, 0f, (GameObject)null, false);
					((EnemyAI)this).KillEnemy(destroy);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void DoAnimationEveryoneRpc(string animationState)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: 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_0072: 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_0093: 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_00bf: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1066493190u, val2, val, (SendTo)6, (RpcDelivery)0);
				bool flag = animationState != null;
				((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val3)).WriteValueSafe(animationState, false);
				}
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1066493190u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				base.creatureAnimator.SetTrigger(animationState);
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3882977255u, new RpcReceiveHandler(__rpc_handler_3882977255), "InitializeCorpseEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(526680257u, new RpcReceiveHandler(__rpc_handler_526680257), "UpdateStateEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(2693399625u, new RpcReceiveHandler(__rpc_handler_2693399625), "AttackEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(1766598522u, new RpcReceiveHandler(__rpc_handler_1766598522), "KillExplosionEveryoneRpc");
			((NetworkBehaviour)this).__registerRpc(1066493190u, new RpcReceiveHandler(__rpc_handler_1066493190), "DoAnimationEveryoneRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_3882977255(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoctorCorpseAI)(object)target).InitializeCorpseEveryoneRpc(obj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_526680257(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;
				((DoctorCorpseAI)(object)target).UpdateStateEveryoneRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2693399625(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 playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoctorCorpseAI)(object)target).AttackEveryoneRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1766598522(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool destroy = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref destroy, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((DoctorCorpseAI)(object)target).KillExplosionEveryoneRpc(destroy);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "DoctorCorpseAI";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace TheDoctor.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}