Decompiled source of TheDoctor v1.0.2

TheDoctor.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using LegaFusionCore;
using LegaFusionCore.Behaviours.Addons;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using TheDoctor.Behaviours;
using TheDoctor.Behaviours.Enemies;
using TheDoctor.Behaviours.Items;
using TheDoctor.Managers;
using TheDoctor.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

[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.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]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace 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";
	}
	[BepInPlugin("Lega.TheDoctor", "The Doctor", "1.0.2")]
	public class TheDoctor : BaseUnityPlugin
	{
		private const string modGUID = "Lega.TheDoctor";

		private const string modName = "The Doctor";

		private const string modVersion = "1.0.2";

		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 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 static Material redShader;

		public static Material yellowShader;

		public void Awake()
		{
			mls = Logger.CreateLogSource("TheDoctor");
			configFile = ((BaseUnityPlugin)this).Config;
			ConfigManager.Load();
			NetcodePatcher();
			LoadEnemies();
			LoadItems();
			LoadHazards();
			LoadParticles();
			LoadAudios();
			LoadMaterials();
		}

		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");
			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 LoadHazards()
		{
			doctorClone = RegisterGameObject("Assets/DoctorClone/DoctorClone.prefab");
		}

		public void LoadParticles()
		{
			darkExplosionParticle = RegisterGameObject("Assets/Particles/DarkExplosionParticle.prefab");
			electroExplosionParticle = RegisterGameObject("Assets/Particles/ElectroExplosionParticle.prefab");
		}

		public void LoadAudios()
		{
			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");
			redShader = bundle.LoadAsset<Material>("Assets/Shaders/Materials/RedMaterial.mat");
			yellowShader = bundle.LoadAsset<Material>("Assets/Shaders/Materials/YellowMaterial.mat");
		}
	}
	internal class TDUtilities
	{
		public static void Shuffle<T>(IList<T> collection)
		{
			for (int num = collection.Count - 1; num > 0; num--)
			{
				int num2 = Random.Range(0, num + 1);
				int index = num2;
				int index2 = num;
				T value = collection[num];
				T value2 = collection[num2];
				collection[index] = value;
				collection[index2] = value2;
			}
		}
	}
	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.Managers
{
	public class ConfigManager
	{
		public static ConfigEntry<string> spawnWeights;

		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> brainAbilityCooldown;

		public static ConfigEntry<int> brainMinValue;

		public static ConfigEntry<int> brainMaxValue;

		public static void Load()
		{
			spawnWeights = TheDoctor.configFile.Bind<string>("_Global_", "Spawn weights", "Vanilla:20,Modded:20", "Brain enemy spawn weights");
			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?");
			brainAbilityCooldown = TheDoctor.configFile.Bind<int>("Brain", "Special ability cooldown", 120, "Cooldown time for the Brain item's special ability");
			brainMinValue = TheDoctor.configFile.Bind<int>("Brain", "Min value", 50, "Brain min value");
			brainMaxValue = TheDoctor.configFile.Bind<int>("Brain", "Max value", 100, "Brain max value");
		}

		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);
		}
	}
	public class CustomPassManager : MonoBehaviour
	{
		public static AuraCustomPass auraPass;

		public static CustomPassVolume customPassVolume;

		public static CustomPassVolume CustomPassVolume
		{
			get
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)customPassVolume == (Object)null)
				{
					customPassVolume = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).gameObject.AddComponent<CustomPassVolume>();
					if ((Object)(object)customPassVolume != (Object)null)
					{
						customPassVolume.targetCamera = GameNetworkManager.Instance.localPlayerController.gameplayCamera;
						customPassVolume.injectionPoint = (CustomPassInjectionPoint)1;
						customPassVolume.isGlobal = true;
						auraPass = new AuraCustomPass();
						customPassVolume.customPasses.Add((CustomPass)(object)auraPass);
					}
				}
				return customPassVolume;
			}
		}

		public static void SetupAuraForObjects(GameObject[] objects, Material material)
		{
			Renderer[] filteredRenderersFromObjects = GetFilteredRenderersFromObjects(objects);
			if (filteredRenderersFromObjects.Length != 0)
			{
				SetupCustomPass(filteredRenderersFromObjects, material);
			}
		}

		public static void SetupCustomPass(Renderer[] renderers, Material material)
		{
			if ((Object)(object)CustomPassVolume == (Object)null)
			{
				TheDoctor.mls.LogError((object)"CustomPassVolume is not assigned.");
				return;
			}
			auraPass = CustomPassVolume.customPasses.Find((CustomPass pass) => pass is AuraCustomPass) as AuraCustomPass;
			if (auraPass == null)
			{
				TheDoctor.mls.LogError((object)"AuraCustomPass could not be found in CustomPassVolume.");
			}
			else
			{
				auraPass.AddTargetRenderers(renderers, material);
			}
		}

		private static Renderer[] GetFilteredRenderersFromObjects(GameObject[] objects)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			LayerMask val = LayerMask.op_Implicit(524288);
			List<Renderer> list = new List<Renderer>();
			EnemyAI val3 = default(EnemyAI);
			PlayerControllerB val4 = default(PlayerControllerB);
			foreach (GameObject val2 in objects)
			{
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				List<Renderer> list2 = val2.GetComponentsInChildren<Renderer>().ToList();
				if (list2.Count == 0)
				{
					continue;
				}
				if (val2.TryGetComponent<EnemyAI>(ref val3) || val2.TryGetComponent<PlayerControllerB>(ref val4))
				{
					list2 = list2.Where((Renderer r) => r is SkinnedMeshRenderer).ToList();
				}
				if (list2.Count == 0)
				{
					TheDoctor.mls.LogError((object)("No renderer could be found on " + ((Object)val2).name + "."));
				}
				else
				{
					list.AddRange(list2);
				}
			}
			return list.ToArray();
		}

		public static void RemoveAura(Renderer[] renderers)
		{
			auraPass?.RemoveTargetRenderers(renderers);
		}

		public static void ClearAura()
		{
			auraPass?.ClearTargetRenderers();
		}
	}
}
namespace TheDoctor.Behaviours
{
	public class AuraCustomPass : CustomPass
	{
		private readonly Dictionary<Renderer, Material> targetRenderers = new Dictionary<Renderer, Material>();

		public void AddTargetRenderers(Renderer[] renderers, Material material)
		{
			foreach (Renderer val in renderers)
			{
				if (!((Object)(object)val == (Object)null) && !targetRenderers.ContainsKey(val))
				{
					targetRenderers.Add(val, material);
				}
			}
		}

		public void RemoveTargetRenderers(Renderer[] renderers)
		{
			foreach (Renderer val in renderers)
			{
				if (!((Object)(object)val == (Object)null) && targetRenderers.ContainsKey(val))
				{
					targetRenderers.Remove(val);
				}
			}
		}

		public void ClearTargetRenderers()
		{
			targetRenderers.Clear();
		}

		public override void Execute(CustomPassContext ctx)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (targetRenderers == null || targetRenderers.Count == 0)
			{
				return;
			}
			foreach (KeyValuePair<Renderer, Material> targetRenderer in targetRenderers)
			{
				Renderer key = targetRenderer.Key;
				Material value = targetRenderer.Value;
				if (!((Object)(object)key == (Object)null) && !((Object)(object)value == (Object)null) && key.sharedMaterials != null)
				{
					for (int i = 0; i < key.sharedMaterials.Length; i++)
					{
						ctx.cmd.DrawRenderer(key, value);
					}
				}
			}
		}
	}
}
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;
			}
			enemies.Where((EnemyAI e) => Vector3.Distance(((Component)e).transform.position, explosionPosition) <= 5f).ToList().ForEach(delegate(EnemyAI e)
			{
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				e.HitEnemyOnLocalClient(1, 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();
		}

		[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");
			}
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				int scrapValueClientRpc = Random.Range(ConfigManager.brainMinValue.Value, ConfigManager.brainMaxValue.Value);
				SetScrapValueClientRpc(scrapValueClientRpc);
			}
		}

		[ClientRpc]
		public void SetScrapValueClientRpc(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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3340504545u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, value);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3340504545u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((GrabbableObject)this).SetScrapValue(value);
				}
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			ActivateSpecialAbilityServerRpc();
		}

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

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

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_DoctorBrain()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3340504545u, new RpcReceiveHandler(__rpc_handler_3340504545));
			NetworkManager.__rpc_func_table.Add(1902395735u, new RpcReceiveHandler(__rpc_handler_1902395735));
			NetworkManager.__rpc_func_table.Add(3459645133u, new RpcReceiveHandler(__rpc_handler_3459645133));
		}

		private static void __rpc_handler_3340504545(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 scrapValueClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref scrapValueClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((DoctorBrain)(object)target).SetScrapValueClientRpc(scrapValueClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1902395735(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;
				((DoctorBrain)(object)target).ActivateSpecialAbilityServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3459645133(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((DoctorBrain)(object)target).ActivateSpecialAbilityClientRpc();
				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]";
			if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)
			{
				return;
			}
			doctorBrain.canLoseChase = false;
			DoctorCorpseAI doctorCorpseAI = doctorBrain.corpses.FirstOrDefault((DoctorCorpseAI c) => (Object)(object)c != (Object)null);
			foreach (DoctorCorpseAI corpse in doctorBrain.corpses)
			{
				if (!((Object)(object)corpse == (Object)null))
				{
					if ((Object)(object)corpse != (Object)(object)doctorCorpseAI)
					{
						((EnemyAI)corpse).targetPlayer = null;
						((EnemyAI)corpse).SwitchToBehaviourStateOnLocalClient(0);
					}
					else
					{
						((EnemyAI)corpse).targetPlayer = ((GrabbableObject)this).playerHeldBy;
						((EnemyAI)corpse).SwitchToBehaviourStateOnLocalClient(2);
					}
				}
			}
		}

		public override void ItemDeactivate()
		{
			base.ItemDeactivate();
			doctorBrain.SwitchCamera(switchingBack: true);
			doctorBrain.canLoseChase = false;
			foreach (DoctorCorpseAI item in doctorBrain.corpses.Where((DoctorCorpseAI c) => (Object)(object)c != (Object)null && ((EnemyAI)c).currentBehaviourStateIndex != 2).Take(2).ToList())
			{
				((EnemyAI)item).targetPlayer = ((GrabbableObject)this).playerHeldBy;
				((EnemyAI)item).SwitchToBehaviourStateOnLocalClient(2);
			}
		}

		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();
		}

		[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();
		}

		[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;

		[ClientRpc]
		public void InitializeDoctorItemClientRpc(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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3375704753u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, value);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3375704753u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
				{
					doctorBrain = ((Component)val3).gameObject.GetComponentInChildren<DoctorBrainAI>();
					((GrabbableObject)this).SetScrapValue(value);
				}
			}
		}

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

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

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

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

		public override void SetControlTipsForItem()
		{
			if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((GrabbableObject)this).isPocketed && !((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;
			((GrabbableObject)this).SetControlTipsForItem();
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_DoctorItem()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3375704753u, new RpcReceiveHandler(__rpc_handler_3375704753));
			NetworkManager.__rpc_func_table.Add(719449572u, new RpcReceiveHandler(__rpc_handler_719449572));
			NetworkManager.__rpc_func_table.Add(890898305u, new RpcReceiveHandler(__rpc_handler_890898305));
		}

		private static void __rpc_handler_3375704753(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)2;
				((DoctorItem)(object)target).InitializeDoctorItemClientRpc(obj, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_719449572(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).StartTrackingServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "DoctorItem";
		}
	}
	public class SpectralDecoy : AddonComponent
	{
		public override void ActivateSpecialAbility()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			if (!base.onCooldown)
			{
				PlayerControllerB val = ((Component)this).GetComponentInParent<GrabbableObject>()?.playerHeldBy;
				if (!((Object)(object)val == (Object)null))
				{
					((AddonComponent)this).StartCooldown(ConfigManager.brainAbilityCooldown.Value);
					Object.Instantiate<GameObject>(TheDoctor.doctorClone, ((Component)val).transform.position + ((Component)val).transform.forward * 1.5f, ((Component)val).transform.rotation);
				}
			}
		}
	}
}
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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			playerCamera = localPlayerController.gameplayCamera;
			base.currentBehaviourStateIndex = 0;
			entrances = Object.FindObjectsOfType<EntranceTeleport>().ToList();
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				SpawnCorpses();
			}
			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 SpawnCorpses()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] corpsesPositions = GetCorpsesPositions();
			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.InitializeCorpseClientRpc(NetworkObjectReference.op_Implicit(((Component)this).GetComponent<NetworkObject>()));
				corpses.Add(component);
			}
		}

		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();
			}
			TDUtilities.Shuffle(list);
			return list.Take(value).ToArray();
		}

		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_007c: 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)
			if (killCoroutine != null)
			{
				return;
			}
			List<DoctorCorpseAI> list = corpses.Where((DoctorCorpseAI c) => (Object)(object)c != (Object)null && ((EnemyAI)c).currentBehaviourStateIndex == 2).ToList();
			if (canLoseChase && list.Any())
			{
				bool flag = true;
				foreach (DoctorCorpseAI item in list)
				{
					if ((Object)(object)((EnemyAI)(item?)).targetPlayer != (Object)null && Vector3.Distance(((Component)item).transform.position, ((Component)((EnemyAI)item).targetPlayer).transform.position) <= 20f)
					{
						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()
		{
			TDUtilities.Shuffle(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(60f, 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 (!((NetworkBehaviour)this).IsOwner)
			{
				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 (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				if (scanCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(scanCoroutine);
					scanCoroutine = null;
				}
				KillAnimationServerRpc(destroy);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void KillAnimationServerRpc(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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2404218375u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroy, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2404218375u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					KillAnimationClientRpc(destroy);
				}
			}
		}

		[ClientRpc]
		public void KillAnimationClientRpc(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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2352189954u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroy, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2352189954u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && killCoroutine == null)
				{
					killCoroutine = ((MonoBehaviour)this).StartCoroutine(KillAnimationCoroutine(destroy));
				}
			}
		}

		public IEnumerator KillAnimationCoroutine(bool destroy)
		{
			base.creatureSFX.PlayOneShot(deathSound);
			auraParticle.Play();
			if (((NetworkBehaviour)this).IsServer || ((NetworkBehaviour)this).IsHost)
			{
				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 (((NetworkBehaviour)this).IsServer || ((NetworkBehaviour)this).IsHost)
			{
				<>n__0(destroy);
				SpawnBrain();
			}
		}

		public void SwitchCamera(bool switchingBack)
		{
			//IL_007c: 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 }, TheDoctor.yellowShader);
				corpses.ForEach(delegate(DoctorCorpseAI c)
				{
					CustomPassManager.SetupAuraForObjects((GameObject[])(object)new GameObject[1] { ((Component)c).gameObject }, TheDoctor.redShader);
				});
			}
			else
			{
				CustomPassManager.ClearAura();
			}
		}

		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);
		}

		public void SpawnBrain()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(TheDoctor.doctorBrain.spawnPrefab, ((Component)this).transform.position + Vector3.up * 0.5f, Quaternion.identity, StartOfRound.Instance.propsContainer);
			DoctorBrain component = val.GetComponent<DoctorBrain>();
			((GrabbableObject)component).fallTime = 0f;
			((GrabbableObject)component).isInFactory = !base.isOutside;
			val.GetComponent<NetworkObject>().Spawn(false);
		}

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

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_DoctorBrainAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2404218375u, new RpcReceiveHandler(__rpc_handler_2404218375));
			NetworkManager.__rpc_func_table.Add(2352189954u, new RpcReceiveHandler(__rpc_handler_2352189954));
		}

		private static void __rpc_handler_2404218375(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).KillAnimationServerRpc(destroy);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2352189954(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)2;
				((DoctorBrainAI)(object)target).KillAnimationClientRpc(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);
			}
		}

		[ClientRpc]
		public void InitializeCorpseClientRpc(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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(688737658u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 688737658u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
				{
					doctorBrain = ((Component)val3).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;
			UpdateStateClientRpc();
		}

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

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

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

		[ServerRpc(RequireOwnership = false)]
		public void AttackServerRpc(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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2125414537u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2125414537u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					AttackClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		public void AttackClientRpc(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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3497587922u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3497587922u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && 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))
				{
					TDUtilities.Shuffle(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 (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).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.InitializeDoctorItemClientRpc(NetworkObjectReference.op_Implicit(((Component)doctorBrain).GetComponent<NetworkObject>()), value);
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				KillExplosionServerRpc(destroy);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void KillExplosionServerRpc(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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3310529958u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroy, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3310529958u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					KillExplosionClientRpc(destroy);
				}
			}
		}

		[ClientRpc]
		public void KillExplosionClientRpc(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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1945139736u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref destroy, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1945139736u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up, true, 0f, 4f, 20, 0f, (GameObject)null, false);
					((EnemyAI)this).KillEnemy(destroy);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DoAnimationServerRpc(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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2542813096u, val, (RpcDelivery)0);
				bool flag = animationState != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationState, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2542813096u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				DoAnimationClientRpc(animationState);
			}
		}

		[ClientRpc]
		public void DoAnimationClientRpc(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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1487104u, val, (RpcDelivery)0);
				bool flag = animationState != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationState, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1487104u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.creatureAnimator.SetTrigger(animationState);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_DoctorCorpseAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(688737658u, new RpcReceiveHandler(__rpc_handler_688737658));
			NetworkManager.__rpc_func_table.Add(3205391388u, new RpcReceiveHandler(__rpc_handler_3205391388));
			NetworkManager.__rpc_func_table.Add(2125414537u, new RpcReceiveHandler(__rpc_handler_2125414537));
			NetworkManager.__rpc_func_table.Add(3497587922u, new RpcReceiveHandler(__rpc_handler_3497587922));
			NetworkManager.__rpc_func_table.Add(3310529958u, new RpcReceiveHandler(__rpc_handler_3310529958));
			NetworkManager.__rpc_func_table.Add(1945139736u, new RpcReceiveHandler(__rpc_handler_1945139736));
			NetworkManager.__rpc_func_table.Add(2542813096u, new RpcReceiveHandler(__rpc_handler_2542813096));
			NetworkManager.__rpc_func_table.Add(1487104u, new RpcReceiveHandler(__rpc_handler_1487104));
		}

		private static void __rpc_handler_688737658(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)2;
				((DoctorCorpseAI)(object)target).InitializeCorpseClientRpc(obj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_2125414537(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).AttackServerRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3497587922(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)2;
				((DoctorCorpseAI)(object)target).AttackClientRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3310529958(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).KillExplosionServerRpc(destroy);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1945139736(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)2;
				((DoctorCorpseAI)(object)target).KillExplosionClientRpc(destroy);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2542813096(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).DoAnimationServerRpc(animationState);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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