Decompiled source of Soul Devourer Enemy v1.3.4

SoulDev.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using SolidLib.Registry;
using SolidLib.Utils;
using SoulDev.NetcodePatcher;
using Soul_Devourer_Enemy;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("bcs4313")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Soul Devourer Enemy for Lethal Company.")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+de30a7b4fd06f505c14721da353043ab3517b186")]
[assembly: AssemblyProduct("Soul Devourer Enemy")]
[assembly: AssemblyTitle("SoulDev")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SoulDev
{
	internal class EntityWarp
	{
		public struct entrancePack
		{
			public EntranceTeleport tele;

			public Vector3 navPosition;
		}

		public static EntranceTeleport[] mapEntrances;

		public static entrancePack findNearestEntrance(EnemyAI __instance)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_0057: 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)
			float num = 100000000f;
			EntranceTeleport val = null;
			EntranceTeleport[] array = mapEntrances;
			for (int i = 0; i < array.Length; i++)
			{
				if (__instance.isOutside == array[i].isEntranceToBuilding && Vector3.Distance(((Component)__instance).transform.position, ((Component)array[i]).transform.position) < num)
				{
					num = Vector3.Distance(((Component)__instance).transform.position, ((Component)array[i]).transform.position);
					val = array[i];
				}
			}
			entrancePack result = default(entrancePack);
			NavMeshHit val2 = default(NavMeshHit);
			if ((Object)(object)val != (Object)null && NavMesh.SamplePosition(((Component)val).transform.position, ref val2, 10f, -1))
			{
				result.navPosition = ((NavMeshHit)(ref val2)).position;
			}
			result.tele = val;
			return result;
		}

		public static void SendEnemyInside(EnemyAI __instance)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			__instance.isOutside = false;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
			EntranceTeleport tele = findNearestEntrance(__instance).tele;
			if (!Object.op_Implicit((Object)(object)tele))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find entrance teleport.");
			}
			Transform entrancePoint = tele.entrancePoint;
			if (!Object.op_Implicit((Object)(object)entrancePoint))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find best exit position.");
			}
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(((Component)entrancePoint).transform.position, ref val, 10f, -1))
			{
				__instance.serverPosition = ((NavMeshHit)(ref val)).position;
				((Component)__instance).transform.position = ((NavMeshHit)(ref val)).position;
				__instance.agent.Warp(__instance.serverPosition);
				__instance.SyncPositionToClients();
			}
			else
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find exit NavmeshHit position");
			}
		}

		public static Transform findExitPoint(EntranceTeleport referenceDoor)
		{
			return referenceDoor.exitPoint;
		}

		public static void SendEnemyOutside(EnemyAI __instance, bool SpawnOnDoor = true)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			__instance.isOutside = true;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
			EntranceTeleport tele = findNearestEntrance(__instance).tele;
			if (!Object.op_Implicit((Object)(object)tele))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find entrance teleport.");
			}
			Transform entrancePoint = tele.entrancePoint;
			if (!Object.op_Implicit((Object)(object)entrancePoint))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find best exit position.");
			}
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(((Component)entrancePoint).transform.position, ref val, 10f, -1))
			{
				__instance.serverPosition = ((NavMeshHit)(ref val)).position;
				((Component)__instance).transform.position = ((NavMeshHit)(ref val)).position;
				__instance.agent.Warp(__instance.serverPosition);
				__instance.SyncPositionToClients();
			}
			else
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find exit NavmeshHit position");
			}
		}
	}
	internal class SoulDevourerAI : EnemyAI
	{
		public enum State
		{
			SearchingForPlayer,
			Staring,
			HeadingToEntrance,
			Attacking,
			Shredding,
			Leaping,
			Fleeing,
			HeadingToMusic,
			Crying
		}

		protected Animator animator;

		protected float starePoints = 0f;

		protected float angerRate = 110f;

		protected int attackState = 0;

		private bool proccedRoar = false;

		private bool proccedCrouch = false;

		private bool proccedRun = false;

		private bool proceedShred = false;

		private bool proceedLeap = false;

		private PlayerControllerB shreddedPlayer = null;

		public Collider uprightCollider;

		public Collider foursCollider;

		public Transform mouth;

		protected bool thrashingCorpse = false;

		protected PlayerControllerB attachedPlayer = null;

		private float attachTime = 0f;

		private bool isOutSwitch = false;

		private float lastThrashTime = 0f;

		public Transform legCastPoint;

		protected float baseLeapChance = 100f;

		protected float leaptime = 0f;

		protected Vector3 leapPos;

		protected EntranceTeleport nearestEntrance = null;

		public Vector3 nearestEntranceNavPosition = Vector3.zero;

		protected PlayerControllerB mostRecentPlayer = null;

		protected int entranceDelay = 0;

		protected float chanceToLocateEntrancePlayerBonus = 0f;

		protected float chanceToLocateEntrance = 0f;

		public List<EnemyAI> unreachableEnemies = new List<EnemyAI>();

		public Vector3 itemNavmeshPosition = Vector3.zero;

		protected int sourcecycle = 75;

		protected float stamina = 0f;

		protected bool recovering = false;

		public int provokePoints = 0;

		public Transform turnCompass;

		protected float timeSinceHittingLocalPlayer;

		protected float timeSinceNewRandPos;

		protected Vector3 positionRandomness;

		protected Vector3 StalkPos;

		protected Random enemyRandom;

		protected bool isDeadAnimationDone;

		private float timeSinceFleeStart = 0f;

		private Vector3 fleeDestination = Vector3.zero;

		public ParticleSystem shadowParticles;

		private bool awaitingShadowMode = false;

		private bool shadowEnable = false;

		private bool isVisible = true;

		public GameObject meshRenderRoot;

		private float timeControl = 1f;

		public AudioSource creatureRoar;

		public AudioSource creatureHit1;

		public AudioSource creatureHit2;

		private int hitRotation = 1;

		public AudioSource creatureStare;

		public AudioSource creatureExtract;

		public AudioSource creatureLeap;

		public AudioSource creatureDeath;

		public AudioSource creatureFlee;

		private bool markDead = false;

		public Volume postProcessVolume;

		protected float processScalar = 0.2f;

		protected float runAnimationCoefficient = 14f;

		protected float walkAnimationCoefficient = 3f;

		private bool musicPresent = false;

		private Vector3 musicDest = Vector3.zero;

		private float musicDist = 9999f;

		private int musicDelay = 0;

		public AudioSource creatureCrying;

		public float cryTime = 0f;

		public void LogDebug(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public void facePosition(Vector3 pos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_0020: 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_0030: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = pos - ((Component)this).transform.position;
			val.y = 0f;
			if (val != Vector3.zero)
			{
				Quaternion val2 = Quaternion.LookRotation(val);
				((Component)this).transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref val2)).eulerAngles.y, 0f);
			}
		}

		public override void OnDestroy()
		{
			((EnemyAI)this).OnDestroy();
		}

		public PlayerControllerB getNearestPlayer()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			PlayerControllerB result = null;
			float num = 1E+09f;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (Object.op_Implicit((Object)(object)val) && !val.isPlayerDead && val.isPlayerControlled && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < num)
				{
					num = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
					result = val;
				}
			}
			return result;
		}

		public void listenForMusic()
		{
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject val = GameObject.Find("ItemShip");
				musicPresent = false;
				if ((Object)(object)val != (Object)null)
				{
					if (base.currentBehaviourStateIndex == 8)
					{
						if (Vector3.Distance(val.transform.position, ((Component)this).transform.position) < 9f)
						{
							musicPresent = true;
							musicDest = val.transform.position;
							musicDist = Vector3.Distance(val.transform.position, ((Component)this).transform.position);
							return;
						}
					}
					else if (Vector3.Distance(val.transform.position, ((Component)this).transform.position) < 90f)
					{
						musicPresent = true;
						musicDest = val.transform.position;
						musicDist = Vector3.Distance(val.transform.position, ((Component)this).transform.position);
						return;
					}
				}
				BoomboxItem[] array = Object.FindObjectsOfType<BoomboxItem>();
				foreach (BoomboxItem val2 in array)
				{
					if (base.currentBehaviourStateIndex == 8)
					{
						if (Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position) < 9f && val2.isPlayingMusic)
						{
							musicPresent = true;
							musicDest = ((Component)val2).transform.position;
							musicDist = Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position);
							break;
						}
					}
					else if (Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position) < 34f && val2.isPlayingMusic)
					{
						musicPresent = true;
						musicDest = ((Component)val2).transform.position;
						musicDist = Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position);
						break;
					}
				}
			}
			catch (Exception ex)
			{
				Debug.Log((object)ex);
			}
		}

		public void baseHeadingToMusic()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			base.targetPlayer = null;
			Vector3 velocity = base.agent.velocity;
			if (((Vector3)(ref velocity)).magnitude > base.agent.speed / 4f)
			{
				if (((NetworkBehaviour)RoundManager.Instance).IsServer)
				{
					DoAnimationClientRpc(1);
				}
				velocity = base.agent.velocity;
				setAnimationSpeedClientRpc(((Vector3)(ref velocity)).magnitude / walkAnimationCoefficient);
			}
			else
			{
				velocity = base.agent.velocity;
				if (((Vector3)(ref velocity)).magnitude <= base.agent.speed / 8f)
				{
					if (((NetworkBehaviour)RoundManager.Instance).IsServer)
					{
						DoAnimationClientRpc(0);
					}
					setAnimationSpeedClientRpc(1f);
				}
			}
			((EnemyAI)this).SetDestinationToPosition(musicDest, false);
			if ((int)base.agent.pathStatus == 1)
			{
				musicDelay = 300;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
			if ((double)Vector3.Distance(((Component)this).transform.position, musicDest) < 7.0 + (double)((Component)this).gameObject.transform.localScale.x)
			{
				musicDelay = 300;
				cryTime = (float)(enemyRandom.NextDouble() * 60.0 + 15.0);
				((EnemyAI)this).SwitchToBehaviourClientRpc(8);
			}
			if (provokePoints > 0)
			{
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
			if (!musicPresent)
			{
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
		}

		public void forceVol()
		{
			base.creatureVoice.volume = Plugin.moaiGlobalMusicVol.Value;
			base.creatureSFX.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureRoar.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureDeath.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureExtract.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureFlee.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureHit1.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureHit2.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureStare.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureCrying.volume = Plugin.moaiGlobalMusicVol.Value;
		}

		public override void Start()
		{
			//IL_0087: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			EntityWarp.mapEntrances = Object.FindObjectsOfType<EntranceTeleport>(false);
			mostRecentPlayer = getNearestPlayer();
			animator = ((Component)this).gameObject.GetComponent<Animator>();
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				DoAnimationClientRpc(0);
			}
			stamina += 60f;
			forceVol();
			timeSinceHittingLocalPlayer = 0f;
			timeSinceNewRandPos = 0f;
			positionRandomness = new Vector3(0f, 0f, 0f);
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			isDeadAnimationDone = false;
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			moaiSoundPlayClientRpc("creatureVoice");
			base.enemyHP = Plugin.health.Value;
			float num = Plugin.moaiGlobalSize.Value;
			if (base.enemyType.enemyName.ToLower().Contains("inside"))
			{
				num *= 0.4f;
			}
			if (enemyRandom.NextDouble() <= (double)Plugin.moaiGlobalSizeVar.Value && base.isOutside)
			{
				num = ((!(Random.Range(0f, 1f) < 0.5f)) ? ((1f + Random.Range(0f, 2f)) * num) : ((1f - Random.Range(0f, 0.95f)) * num));
			}
			modifySizeClientRpc(num);
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				SoulDevourerAI[] array = Object.FindObjectsOfType<SoulDevourerAI>();
				if (array.Length > Plugin.maxCount.Value)
				{
					Debug.Log((object)"Soul Devourer: Destroyed Self (max count reached)");
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		[ClientRpc]
		public void modifySizeClientRpc(float size)
		{
			//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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(107833227u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 107833227u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					float num = (float)Math.Pow(size, 0.3);
					Transform transform = ((Component)this).gameObject.transform;
					transform.localScale *= size * Plugin.moaiGlobalSize.Value;
					NavMeshAgent component = ((Component)this).gameObject.GetComponent<NavMeshAgent>();
					component.height *= size;
					AudioSource creatureVoice = base.creatureVoice;
					creatureVoice.pitch /= num;
					AudioSource creatureSFX = base.creatureSFX;
					creatureSFX.pitch /= num;
					AudioSource obj = creatureRoar;
					obj.pitch /= num;
					AudioSource obj2 = creatureHit1;
					obj2.pitch /= num;
					AudioSource obj3 = creatureHit2;
					obj3.pitch /= num;
					AudioSource obj4 = creatureStare;
					obj4.pitch /= num;
					AudioSource obj5 = creatureExtract;
					obj5.pitch /= num;
					AudioSource obj6 = creatureLeap;
					obj6.pitch /= num;
					AudioSource obj7 = creatureDeath;
					obj7.pitch /= num;
					AudioSource obj8 = creatureFlee;
					obj8.pitch /= num;
					AudioSource obj9 = creatureCrying;
					obj9.pitch /= num;
					timeControl /= num;
				}
			}
		}

		public void LateUpdate()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = RoundManager.Instance.playersManager.localPlayerController;
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position);
			if (num > 40f || !Plugin.pulseFX.Value)
			{
				postProcessVolume.weight = 0f;
			}
			else
			{
				Volume obj = postProcessVolume;
				obj.weight /= 1f + 0.2f * num * processScalar;
			}
			if (Object.op_Implicit((Object)(object)attachedPlayer) && Math.Abs(Time.time - attachTime) > 1.2f && ((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				letGoOfPlayerClientRpc(((NetworkBehaviour)attachedPlayer).NetworkObject.NetworkObjectId);
			}
			if (Object.op_Implicit((Object)(object)attachedPlayer) && !thrashingCorpse)
			{
				((Component)attachedPlayer).transform.position = mouth.position;
				if ((float)enemyRandom.Next() < 0.25f)
				{
					attachedPlayer.DropBlood(default(Vector3), true, false);
					attachedPlayer.AddBloodToBody();
					attachedPlayer.bloodParticle.Play();
					attachedPlayer.deadBody.bloodSplashParticle.Play();
				}
			}
			if (Object.op_Implicit((Object)(object)attachedPlayer) && thrashingCorpse)
			{
				((Component)attachedPlayer.deadBody).transform.position = mouth.position;
				if ((float)enemyRandom.Next() < 0.25f)
				{
					attachedPlayer.deadBody.bloodSplashParticle.Play();
					attachedPlayer.deadBody.MakeCorpseBloody();
				}
			}
		}

		public override void Update()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.creatureVoice.volume != Plugin.moaiGlobalMusicVol.Value)
			{
				forceVol();
			}
			if (!base.isEnemyDead && base.enemyHP <= 0 && !markDead)
			{
				animator.speed = 1f;
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
				stopAllSound();
				AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Death"))
				{
					currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
					if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Exit"))
					{
						animator.Play("Death");
					}
				}
				base.isEnemyDead = true;
				base.enemyHP = 0;
				moaiSoundPlayClientRpc("creatureDeath");
				deadEventClientRpc();
				markDead = true;
			}
			if (base.isEnemyDead)
			{
				if (!isDeadAnimationDone)
				{
					animator.speed = 1f;
					isDeadAnimationDone = true;
					stopAllSound();
					base.creatureVoice.PlayOneShot(base.dieSFX);
				}
				return;
			}
			if ((Object)(object)base.targetPlayer != (Object)null && base.targetPlayer.isPlayerDead)
			{
				base.targetPlayer = null;
			}
			base.movingTowardsTargetPlayer = (Object)(object)base.targetPlayer != (Object)null;
			timeSinceHittingLocalPlayer += Time.deltaTime;
			timeSinceNewRandPos += Time.deltaTime;
			if ((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false))
			{
				turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
			}
			if (base.stunNormalizedTimer > 0f && ((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				base.stunNormalizedTimer = 0f;
				moaiSoundPlayClientRpc("creatureFlee");
				base.agent.speed = 0f;
				timeSinceFleeStart = Time.time;
				shadowEnable = false;
				awaitingShadowMode = true;
				fleeDestination = Vector3.zero;
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				setAnimationSpeedClientRpc(1f * timeControl);
				animPlayClientRpc("StandingStun");
				((EnemyAI)this).SwitchToBehaviourClientRpc(6);
			}
			if (awaitingShadowMode && !shadowEnable && ((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				base.agent.speed = 0f;
				setAnimationSpeedClientRpc(1f * timeControl);
				if (creatureFlee.time > 2.41f)
				{
					SetVisibleClientRpc(visible: false);
					shadowEnable = true;
				}
			}
			else if (base.currentBehaviourStateIndex != 6)
			{
				shadowEnable = false;
				awaitingShadowMode = false;
			}
			if (base.currentBehaviourStateIndex != 2)
			{
				return;
			}
			if (base.currentBehaviourStateIndex == 5)
			{
				if (((Component)foursCollider).gameObject.activeInHierarchy)
				{
					((Component)foursCollider).gameObject.SetActive(false);
				}
				if (((Component)uprightCollider).gameObject.activeInHierarchy)
				{
					((Component)uprightCollider).gameObject.SetActive(false);
				}
			}
			else if (base.currentBehaviourStateIndex == 4)
			{
				if (((Component)foursCollider).gameObject.activeInHierarchy)
				{
					((Component)foursCollider).gameObject.SetActive(false);
				}
				if (((Component)uprightCollider).gameObject.activeInHierarchy)
				{
					((Component)uprightCollider).gameObject.SetActive(false);
				}
			}
			else if (base.currentBehaviourStateIndex == 3)
			{
				if (!((Component)foursCollider).gameObject.activeInHierarchy)
				{
					((Component)foursCollider).gameObject.SetActive(true);
				}
				if (((Component)uprightCollider).gameObject.activeInHierarchy)
				{
					((Component)uprightCollider).gameObject.SetActive(false);
				}
			}
			else
			{
				if (((Component)foursCollider).gameObject.activeInHierarchy)
				{
					((Component)foursCollider).gameObject.SetActive(false);
				}
				if (!((Component)uprightCollider).gameObject.activeInHierarchy)
				{
					((Component)uprightCollider).gameObject.SetActive(true);
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (provokePoints > 0)
			{
				provokePoints--;
			}
			if (entranceDelay > 0)
			{
				entranceDelay--;
			}
			if (musicDelay > 0)
			{
				musicDelay--;
			}
			if (sourcecycle > 0)
			{
				sourcecycle--;
			}
			else
			{
				sourcecycle = 75;
				unreachableEnemies.Clear();
			}
			if (stamina <= 0f)
			{
				recovering = true;
			}
			else if (stamina > 60f)
			{
				recovering = false;
			}
			if (sourcecycle % 5 == 0)
			{
				EntityWarp.entrancePack entrancePack = EntityWarp.findNearestEntrance((EnemyAI)(object)this);
				listenForMusic();
				nearestEntrance = entrancePack.tele;
				nearestEntranceNavPosition = entrancePack.navPosition;
				if (stamina < 120f)
				{
					stamina += 8f;
				}
				mostRecentPlayer = getNearestPlayer();
			}
			if ((Object)(object)base.targetPlayer != (Object)null)
			{
				mostRecentPlayer = base.targetPlayer;
			}
			if (!isVisible && base.currentBehaviourStateIndex != 6)
			{
				SetVisibleClientRpc(visible: true);
			}
			AIInterval();
		}

		public void AIInterval()
		{
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				baseSearchingForPlayer();
				break;
			case 2:
				baseHeadingToEntrance();
				break;
			case 1:
				baseStaring();
				break;
			case 3:
				baseAttacking(32f);
				break;
			case 4:
				baseShredding();
				break;
			case 6:
				baseFleeing();
				break;
			case 7:
				baseHeadingToMusic();
				break;
			case 8:
				baseCrying();
				break;
			default:
				LogDebug("This Behavior State doesn't exist!");
				break;
			}
		}

		public void baseFleeing()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			if (!shadowEnable)
			{
				base.agent.speed = 0f;
				return;
			}
			base.agent.speed = 15f * Plugin.moaiGlobalSpeed.Value;
			if (fleeDestination == Vector3.zero)
			{
				fleeDestination = pickFleeDestination();
				return;
			}
			base.targetPlayer = null;
			((EnemyAI)this).SetDestinationToPosition(fleeDestination, false);
			if ((double)Vector3.Distance(fleeDestination, ((Component)this).transform.position) < 2.0 + (double)((Component)this).gameObject.transform.localScale.x || Time.time - timeSinceFleeStart > 9f)
			{
				stamina = 120f;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				shadowParticles.Stop();
				shadowEnable = false;
				awaitingShadowMode = false;
				base.targetPlayer = null;
				SetVisibleClientRpc(visible: true);
				animPlayClientRpc("Walk");
				DoAnimationClientRpc(1);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
		}

		[ClientRpc]
		private void SetVisibleClientRpc(bool visible)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(12838872u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref visible, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 12838872u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Renderer[] componentsInChildren = meshRenderRoot.GetComponentsInChildren<Renderer>(true);
				foreach (Renderer val3 in componentsInChildren)
				{
					val3.enabled = visible;
				}
				isVisible = visible;
				if (!visible)
				{
					shadowParticles.Play();
				}
				else
				{
					shadowParticles.Stop();
				}
			}
		}

		public Vector3 pickFleeDestination()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode");
			if (!base.isOutside)
			{
				array = GameObject.FindGameObjectsWithTag("AINode");
			}
			List<GameObject> list = new List<GameObject>();
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				if (Vector3.Distance(val.transform.position, ((Component)this).transform.position) > 60f)
				{
					list.Add(val);
				}
			}
			if (list.Count > 0)
			{
				return list[enemyRandom.Next(0, list.Count)].transform.position;
			}
			return array[enemyRandom.Next(0, array.Length)].transform.position;
		}

		public void baseShredding()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			if (!creatureHit1.isPlaying && !creatureHit2.isPlaying)
			{
				if (hitRotation == 1)
				{
					moaiSoundPlayClientRpc("creatureHit1");
					hitRotation = 2;
				}
				else
				{
					moaiSoundPlayClientRpc("creatureHit2");
					hitRotation = 1;
				}
			}
			AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
			if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Thrash") && !proceedShred)
			{
				animPlayClientRpc("Thrash");
				DoAnimationClientRpc(6);
				proceedShred = true;
			}
			setAnimationSpeedClientRpc(1f);
			currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
			if ((double)((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 0.8)
			{
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Thrash"))
				{
					attackState = 2;
					DoAnimationClientRpc(5);
					animPlayClientRpc("Run");
					((EnemyAI)this).SwitchToBehaviourClientRpc(3);
				}
			}
		}

		public void baseStaring()
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			base.agent.speed = 0f;
			setAnimationSpeedClientRpc(1f);
			if (animator.GetInteger("state") != 2)
			{
				starePoints = 0f;
				DoAnimationClientRpc(2);
				animPlayClientRpc("Stare");
				if (!creatureStare.isPlaying)
				{
					moaiSoundPlayClientRpc("creatureStare");
				}
			}
			if (FoundClosestPlayerInRange(stamina, needLineOfSight: true))
			{
				starePoints += angerRate / Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position);
				facePosition(((Component)base.targetPlayer).transform.position);
			}
			else
			{
				starePoints -= 2f;
			}
			AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
			if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Stare"))
			{
				return;
			}
			currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
			if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f)
			{
				if ((double)starePoints > enemyRandom.NextDouble() * 100.0)
				{
					attackState = 0;
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					proccedRoar = false;
					proccedCrouch = false;
					proccedRun = false;
					((EnemyAI)this).SwitchToBehaviourClientRpc(3);
				}
				else
				{
					stamina -= 80f;
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
			}
		}

		public void baseCrying()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			base.agent.speed = 0f * Plugin.moaiGlobalSpeed.Value;
			animator.speed = 1f;
			DoAnimationClientRpc(7);
			AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
			if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Cry"))
			{
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Walk"))
				{
					currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
					if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Stand"))
					{
						animPlayClientRpc("Cry");
					}
				}
			}
			if (!creatureCrying.isPlaying)
			{
				moaiSoundPlayClientRpc("creatureCrying");
			}
			cryTime -= 0.2f;
			if (cryTime <= 0f)
			{
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
			if (provokePoints > 0)
			{
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
			if (musicPresent)
			{
				return;
			}
			PlayerControllerB nearestPlayer = getNearestPlayer();
			if (Vector3.Distance(((Component)nearestPlayer).transform.position, musicDest) > 6f)
			{
				base.stunNormalizedTimer = 0f;
				moaiSoundPlayClientRpc("creatureFlee");
				base.agent.speed = 0f;
				timeSinceFleeStart = Time.time;
				shadowEnable = false;
				awaitingShadowMode = true;
				fleeDestination = Vector3.zero;
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				setAnimationSpeedClientRpc(1f * timeControl);
				animPlayClientRpc("StandingStun");
				((EnemyAI)this).SwitchToBehaviourClientRpc(6);
				return;
			}
			provokePoints += 100;
			base.targetPlayer = nearestPlayer;
			stamina = 100f;
			recovering = false;
			((EnemyAI)this).SwitchToBehaviourClientRpc(3);
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (base.enemyHP <= 0 && !markDead)
				{
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
					stopAllSound();
					base.isEnemyDead = true;
					moaiSoundPlayClientRpc("creatureDeath");
					deadEventClientRpc();
					markDead = true;
				}
				else
				{
					moaiSoundPlayClientRpc("creatureHit");
				}
			}
		}

		public void baseSearchingForPlayer(float lineOfSightRange = 28f)
		{
			//IL_0034: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			base.agent.speed = 6f * Plugin.moaiGlobalSpeed.Value;
			base.agent.angularSpeed = 120f;
			Vector3 velocity = base.agent.velocity;
			if (((Vector3)(ref velocity)).magnitude > base.agent.speed / 4f)
			{
				if (((NetworkBehaviour)RoundManager.Instance).IsServer)
				{
					DoAnimationClientRpc(1);
				}
				velocity = base.agent.velocity;
				setAnimationSpeedClientRpc(((Vector3)(ref velocity)).magnitude / walkAnimationCoefficient);
			}
			else
			{
				velocity = base.agent.velocity;
				if (((Vector3)(ref velocity)).magnitude <= base.agent.speed / 8f)
				{
					if (((NetworkBehaviour)RoundManager.Instance).IsServer)
					{
						DoAnimationClientRpc(0);
					}
					setAnimationSpeedClientRpc(1f);
				}
			}
			if (!base.creatureVoice.isPlaying)
			{
				moaiSoundPlayClientRpc("creatureVoice");
			}
			updateEntranceChance();
			if (enemyRandom.NextDouble() < (double)chanceToLocateEntrance && ((Component)this).gameObject.transform.localScale.x <= 2.2f && Plugin.canEnterIndoors.Value)
			{
				Debug.Log((object)"Soul Devourer: entrance state switch");
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				((EnemyAI)this).SwitchToBehaviourClientRpc(2);
			}
			if ((FoundClosestPlayerInRange(lineOfSightRange, needLineOfSight: true) && stamina >= 120f) || provokePoints > 0)
			{
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				return;
			}
			if (stamina < 100f)
			{
				base.targetPlayer = null;
			}
			if (musicPresent && musicDelay <= 0)
			{
				((EnemyAI)this).SwitchToBehaviourClientRpc(7);
			}
		}

		public void baseHeadingToEntrance()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Invalid comparison between Unknown and I4
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: 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_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			base.targetPlayer = null;
			Vector3 velocity = base.agent.velocity;
			if (((Vector3)(ref velocity)).magnitude > base.agent.speed / 4f)
			{
				if (((NetworkBehaviour)RoundManager.Instance).IsServer)
				{
					DoAnimationClientRpc(1);
				}
				velocity = base.agent.velocity;
				setAnimationSpeedClientRpc(((Vector3)(ref velocity)).magnitude / walkAnimationCoefficient);
			}
			else
			{
				velocity = base.agent.velocity;
				if (((Vector3)(ref velocity)).magnitude <= base.agent.speed / 8f)
				{
					if (((NetworkBehaviour)RoundManager.Instance).IsServer)
					{
						DoAnimationClientRpc(0);
					}
					setAnimationSpeedClientRpc(1f);
				}
			}
			((EnemyAI)this).SetDestinationToPosition(nearestEntranceNavPosition, false);
			if (base.isOutside != nearestEntrance.isEntranceToBuilding || (int)base.agent.pathStatus == 1)
			{
				entranceDelay = 150;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
			if ((double)Vector3.Distance(((Component)this).transform.position, nearestEntranceNavPosition) < 2.0 + (double)((Component)this).gameObject.transform.localScale.x)
			{
				if (nearestEntrance.isEntranceToBuilding)
				{
					Debug.Log((object)"SoulDev: Warp in");
					EntityWarp.SendEnemyInside((EnemyAI)(object)this);
					modifySizeClientRpc(0.4f);
					nearestEntrance.PlayAudioAtTeleportPositions();
				}
				else
				{
					Debug.Log((object)"SoulDev: Warp out");
					EntityWarp.SendEnemyOutside((EnemyAI)(object)this);
					nearestEntrance.PlayAudioAtTeleportPositions();
				}
				entranceDelay = 150;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
			if (provokePoints > 0)
			{
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
		}

		public void baseLeaping()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).SetDestinationToPosition(leapPos, false);
			if (!creatureLeap.isPlaying && !proceedLeap)
			{
				moaiSoundPlayClientRpc("creatureLeap");
			}
			setAnimationSpeedClientRpc(1f);
			if (Time.time - leaptime >= 1f)
			{
				attackState = 2;
				proccedRun = false;
				if (stamina < 10f)
				{
					stamina = 10f;
				}
				DoAnimationClientRpc(5);
				animPlayClientRpc("Run");
				attackState = 2;
				proccedRun = false;
				base.agent.acceleration = 14.5f * Plugin.moaiGlobalSpeed.Value;
				base.agent.speed = 14f * Plugin.moaiGlobalSpeed.Value;
				base.agent.angularSpeed = 145f;
				((EnemyAI)this).SwitchToBehaviourClientRpc(3);
			}
		}

		public Vector3 getLeapPos()
		{
			//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_004d: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)base.targetPlayer).transform.position;
			Vector3 val = default(Vector3);
			NavMeshHit val2 = default(NavMeshHit);
			for (int i = 0; i < 10; i++)
			{
				int num = enemyRandom.Next(-10, 10);
				int num2 = enemyRandom.Next(-35, 35);
				int num3 = enemyRandom.Next(-35, 35);
				((Vector3)(ref val))..ctor(position.x + (float)num2, position.y + (float)num, position.z + (float)num3);
				bool flag = NavMesh.SamplePosition(val, ref val2, 60f, -1);
				float num4 = Vector3.Distance(position, ((NavMeshHit)(ref val2)).position);
				if (flag && num4 > 13f)
				{
					return ((NavMeshHit)(ref val2)).position;
				}
			}
			return ((Component)base.targetPlayer).transform.position;
		}

		public void baseAttacking(float range = 22f, float noLOSDivisor = 1.8f)
		{
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			AnimatorStateInfo currentAnimatorStateInfo;
			if (attackState == 0)
			{
				if (!creatureRoar.isPlaying)
				{
					moaiSoundPlayClientRpc("creatureRoar");
				}
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Roar") && !proccedRoar)
				{
					animPlayClientRpc("Roar");
					DoAnimationClientRpc(3);
					proccedRoar = true;
				}
				setAnimationSpeedClientRpc(1f);
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if ((double)((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 0.8)
				{
					currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
					if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Roar"))
					{
						attackState = 1;
					}
				}
			}
			if (attackState == 1)
			{
				DoAnimationClientRpc(4);
				setAnimationSpeedClientRpc(2.5f);
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Prepare") && !proccedCrouch)
				{
					animPlayClientRpc("Prepare");
					DoAnimationClientRpc(3);
					proccedCrouch = true;
				}
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if ((double)((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 0.8)
				{
					currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
					if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Prepare"))
					{
						attackState = 2;
					}
				}
			}
			if (attackState == 2)
			{
				if (!base.creatureSFX.isPlaying)
				{
					moaiSoundPlayClientRpc("creatureSFX");
				}
				base.agent.speed = 20f * Plugin.moaiGlobalSpeed.Value;
				base.agent.acceleration = 14.5f * Plugin.moaiGlobalSpeed.Value;
				base.agent.angularSpeed = 140f;
				Vector3 velocity = base.agent.velocity;
				setAnimationSpeedClientRpc(((Vector3)(ref velocity)).magnitude / runAnimationCoefficient);
				DoAnimationClientRpc(5);
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Run") && !proccedRun)
				{
					animPlayClientRpc("Run");
					DoAnimationClientRpc(5);
					proccedRun = true;
				}
			}
			else
			{
				base.agent.speed = 0f * Plugin.moaiGlobalSpeed.Value;
			}
			updateEntranceChance();
			stamina -= 2.8f;
			if (!FoundClosestPlayerInRange(stamina / noLOSDivisor, needLineOfSight: false) && !FoundClosestPlayerInRange(stamina, needLineOfSight: true))
			{
				base.targetPlayer = null;
				starePoints = 0f;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				base.agent.acceleration = 14.5f * Plugin.moaiGlobalSpeed.Value;
			}
			else
			{
				StickingInFrontOfPlayer();
			}
		}

		public void updateEntranceChance()
		{
			//IL_001f: 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)
			if (!Object.op_Implicit((Object)(object)nearestEntrance))
			{
				return;
			}
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)nearestEntrance).transform.position);
			chanceToLocateEntrancePlayerBonus = 1f;
			if (Object.op_Implicit((Object)(object)mostRecentPlayer))
			{
				if (Object.op_Implicit((Object)(object)mostRecentPlayer) == base.isOutside)
				{
					chanceToLocateEntrancePlayerBonus = 1f;
				}
				else
				{
					chanceToLocateEntrancePlayerBonus = 1.5f;
				}
			}
			int num2 = 1;
			if (num < 20f)
			{
				num2 = 4;
			}
			if (num < 15f)
			{
				num2 = 6;
			}
			if (num < 10f)
			{
				num2 = 7;
			}
			if (num < 5f)
			{
				num2 = 10;
			}
			if (Object.op_Implicit((Object)(object)nearestEntrance))
			{
				chanceToLocateEntrance = (float)(1.0 / Math.Pow(num, 2.0)) * (float)num2 * chanceToLocateEntrancePlayerBonus - (float)entranceDelay;
			}
		}

		public bool FoundClosestPlayerInRange(float r, bool needLineOfSight)
		{
			if (recovering)
			{
				return false;
			}
			moaiTargetClosestPlayer(r, needLineOfSight);
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				return false;
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		public bool moaiTargetClosestPlayer(float range, bool requireLineOfSight)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (recovering)
			{
				return false;
			}
			base.mostOptimalDistance = range;
			PlayerControllerB targetPlayer = base.targetPlayer;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				if (((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && (!requireLineOfSight || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, Plugin.LOSWidth.Value, 80, -1f, (Transform)null)))
				{
					base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
					if (base.tempDist < base.mostOptimalDistance)
					{
						base.mostOptimalDistance = base.tempDist;
						base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
					}
				}
			}
			if ((Object)(object)base.targetPlayer != (Object)null && (Object)(object)targetPlayer != (Object)null)
			{
				base.targetPlayer = targetPlayer;
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, -1);
			if (base.isEnemyDead || (hitID == -1 && (Object)(object)playerWhoHit == (Object)null))
			{
				return;
			}
			base.enemyHP -= force;
			if ((Object)(object)playerWhoHit != (Object)null)
			{
				provokePoints += 20 * force;
				base.targetPlayer = playerWhoHit;
			}
			stamina = 60f;
			recovering = false;
			((EnemyAI)this).SwitchToBehaviourClientRpc(3);
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (base.enemyHP <= 0 && !markDead)
				{
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
					stopAllSound();
					base.isEnemyDead = true;
					moaiSoundPlayClientRpc("creatureDeath");
					deadEventClientRpc();
					markDead = true;
				}
				else
				{
					moaiSoundPlayClientRpc("creatureHit");
				}
			}
		}

		[ClientRpc]
		public void deadEventClientRpc()
		{
			//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)
			//IL_00c1: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(815579584u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 815579584u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					animator.Play("Death");
					base.isEnemyDead = true;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void letGoOfPlayerServerRpc(ulong playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_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)
			//IL_00ce: 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(3542143556u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3542143556u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					letGoOfPlayerClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		public void letGoOfPlayerClientRpc(ulong playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_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)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1919010792u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1919010792u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val3 = null;
			RoundManager instance = RoundManager.Instance;
			PlayerControllerB[] allPlayerScripts = instance.playersManager.allPlayerScripts;
			foreach (PlayerControllerB val4 in allPlayerScripts)
			{
				if (((NetworkBehaviour)val4).NetworkObject.NetworkObjectId == playerId)
				{
					val3 = val4;
				}
			}
			val3.playerCollider.enabled = true;
			NavMeshHit val5 = default(NavMeshHit);
			if (NavMesh.SamplePosition(((Component)val3).transform.position, ref val5, 15f, -1))
			{
				((Component)val3).transform.position = ((NavMeshHit)(ref val5)).position;
			}
			attachedPlayer = null;
		}

		private void StickingInFrontOfPlayer()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner)
			{
				StalkPos = ((Component)base.targetPlayer).transform.position;
				((EnemyAI)this).SetDestinationToPosition(StalkPos, false);
			}
		}

		public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy = null)
		{
			if (!(timeSinceHittingLocalPlayer < 0.5f) && !collidedEnemy.isEnemyDead && !base.isEnemyDead && !((Object)(object)collidedEnemy.enemyType == (Object)(object)base.enemyType))
			{
				string text = ((Object)collidedEnemy.enemyType).name.ToLower();
				if ((!text.Contains("mouth") || !text.Contains("dog")) && !collidedEnemy.enemyType.enemyName.ToLower().Contains("soul"))
				{
					timeSinceHittingLocalPlayer = 0f;
					collidedEnemy.HitEnemy(1, (PlayerControllerB)null, true, -1);
				}
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_0059: 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)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			if (timeSinceHittingLocalPlayer < 1.7f)
			{
				return;
			}
			PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
			if (lastThrashTime > Time.time + Plugin.thrashCooldown.Value || !((Object)(object)val != (Object)null))
			{
				return;
			}
			Vector3 position = ((Component)this).transform.position;
			Vector3 val2 = ((Component)val).transform.position + Vector3.up * 0.5f;
			Debug.Log((object)"LOSCHECK");
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Linecast(position, val2, ref val3, LayerMask.GetMask(new string[3] { "Default", "Room", "Terrain" })) && !((Component)((RaycastHit)(ref val3)).collider).transform.IsChildOf(((Component)val).transform))
			{
				return;
			}
			timeSinceHittingLocalPlayer = 0f;
			if (val.health <= 45)
			{
				val.KillPlayer(val.velocityLastFrame, true, (CauseOfDeath)6, 0, default(Vector3));
				if (((NetworkBehaviour)RoundManager.Instance).IsHost)
				{
					attachPlayerClientRpc(((NetworkBehaviour)val).NetworkObject.NetworkObjectId, lastHit: true, 20);
					lastThrashTime = Time.time;
				}
				else
				{
					attachPlayerServerRpc(((NetworkBehaviour)val).NetworkObject.NetworkObjectId, lastHit: true, 20);
					lastThrashTime = Time.time;
				}
			}
			else
			{
				val.DamagePlayer(45, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				if (((NetworkBehaviour)RoundManager.Instance).IsHost)
				{
					attachPlayerClientRpc(((NetworkBehaviour)val).NetworkObject.NetworkObjectId, lastHit: false, 10);
					lastThrashTime = Time.time;
				}
				else
				{
					attachPlayerServerRpc(((NetworkBehaviour)val).NetworkObject.NetworkObjectId, lastHit: false, 10);
					lastThrashTime = Time.time;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void attachPlayerServerRpc(ulong uid, bool lastHit, int staminaGrant)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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(3820758844u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, uid);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lastHit, default(ForPrimitives));
					BytePacker.WriteValueBitPacked(val2, staminaGrant);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3820758844u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					attachPlayerClientRpc(uid, lastHit, staminaGrant);
				}
			}
		}

		[ClientRpc]
		public void attachPlayerClientRpc(ulong uid, bool lastHit, int staminaGrant)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(158514313u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, uid);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref lastHit, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, staminaGrant);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 158514313u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			stamina += staminaGrant;
			proceedShred = false;
			attachTime = Time.time;
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				((EnemyAI)this).SwitchToBehaviourClientRpc(4);
			}
			RoundManager instance = RoundManager.Instance;
			PlayerControllerB[] allPlayerScripts = instance.playersManager.allPlayerScripts;
			foreach (PlayerControllerB val3 in allPlayerScripts)
			{
				if (((NetworkBehaviour)val3).NetworkObject.NetworkObjectId == uid)
				{
					shreddedPlayer = val3;
					if (!lastHit)
					{
						((Component)val3).transform.position = mouth.position;
						val3.playerCollider.enabled = false;
						attachedPlayer = val3;
						thrashingCorpse = false;
					}
					else
					{
						((Component)val3.deadBody).transform.position = mouth.position;
						attachedPlayer = val3;
						thrashingCorpse = true;
					}
					break;
				}
			}
		}

		public virtual void playSoundId(string id)
		{
		}

		public void stopAllSound()
		{
			base.creatureSFX.Stop();
			base.creatureVoice.Stop();
			creatureRoar.Stop();
			creatureStare.Stop();
			creatureFlee.Stop();
		}

		[ClientRpc]
		public void moaiSoundPlayClientRpc(string soundName)
		{
			//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_00ff: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2548432240u, val, (RpcDelivery)0);
				bool flag = soundName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(soundName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2548432240u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				switch (soundName)
				{
				case "creatureSFX":
					stopAllSound();
					base.creatureSFX.Play();
					break;
				case "creatureVoice":
				{
					stopAllSound();
					double[] array = new double[10] { 0.0, 0.8244, 11.564, 29.11, 34.491, 37.84, 48.689, 64.518, 89.535, 92.111 };
					int num = Random.Range(0, array.Length);
					base.creatureVoice.Play();
					base.creatureVoice.SetScheduledStartTime(array[num]);
					base.creatureVoice.time = (float)array[num];
					break;
				}
				case "creatureRoar":
					stopAllSound();
					creatureRoar.Play();
					break;
				case "creatureHit1":
					creatureHit1.Play();
					break;
				case "creatureHit2":
					creatureHit2.Play();
					break;
				case "creatureStare":
					creatureStare.Play();
					break;
				case "creatureLeap":
					creatureLeap.Play();
					break;
				case "creatureDeath":
					creatureDeath.Play();
					break;
				case "creatureFlee":
					stopAllSound();
					creatureFlee.Play();
					break;
				case "creatureCrying":
					stopAllSound();
					creatureCrying.Play();
					break;
				}
			}
		}

		[ClientRpc]
		public void setAnimationSpeedClientRpc(float speed)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2069716591u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2069716591u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					animator.speed = speed;
				}
			}
		}

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

		[ClientRpc]
		public void animPlayClientRpc(string name)
		{
			//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_00ff: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2747754932u, val, (RpcDelivery)0);
				bool flag = name != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2747754932u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				animator.Play(name);
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(107833227u, new RpcReceiveHandler(__rpc_handler_107833227), "modifySizeClientRpc");
			((NetworkBehaviour)this).__registerRpc(12838872u, new RpcReceiveHandler(__rpc_handler_12838872), "SetVisibleClientRpc");
			((NetworkBehaviour)this).__registerRpc(815579584u, new RpcReceiveHandler(__rpc_handler_815579584), "deadEventClientRpc");
			((NetworkBehaviour)this).__registerRpc(3542143556u, new RpcReceiveHandler(__rpc_handler_3542143556), "letGoOfPlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(1919010792u, new RpcReceiveHandler(__rpc_handler_1919010792), "letGoOfPlayerClientRpc");
			((NetworkBehaviour)this).__registerRpc(3820758844u, new RpcReceiveHandler(__rpc_handler_3820758844), "attachPlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(158514313u, new RpcReceiveHandler(__rpc_handler_158514313), "attachPlayerClientRpc");
			((NetworkBehaviour)this).__registerRpc(2548432240u, new RpcReceiveHandler(__rpc_handler_2548432240), "moaiSoundPlayClientRpc");
			((NetworkBehaviour)this).__registerRpc(2069716591u, new RpcReceiveHandler(__rpc_handler_2069716591), "setAnimationSpeedClientRpc");
			((NetworkBehaviour)this).__registerRpc(571941155u, new RpcReceiveHandler(__rpc_handler_571941155), "DoAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(2747754932u, new RpcReceiveHandler(__rpc_handler_2747754932), "animPlayClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_107833227(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)
			{
				float size = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SoulDevourerAI)(object)target).modifySizeClientRpc(size);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_12838872(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 visibleClientRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref visibleClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SoulDevourerAI)(object)target).SetVisibleClientRpc(visibleClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_815579584(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;
				((SoulDevourerAI)(object)target).deadEventClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3542143556(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)
			{
				ulong playerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SoulDevourerAI)(object)target).letGoOfPlayerServerRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1919010792(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)
			{
				ulong playerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SoulDevourerAI)(object)target).letGoOfPlayerClientRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3820758844(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong uid = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref uid);
				bool lastHit = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lastHit, default(ForPrimitives));
				int staminaGrant = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref staminaGrant);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SoulDevourerAI)(object)target).attachPlayerServerRpc(uid, lastHit, staminaGrant);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_158514313(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong uid = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref uid);
				bool lastHit = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lastHit, default(ForPrimitives));
				int staminaGrant = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref staminaGrant);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SoulDevourerAI)(object)target).attachPlayerClientRpc(uid, lastHit, staminaGrant);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2548432240(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 soundName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref soundName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SoulDevourerAI)(object)target).moaiSoundPlayClientRpc(soundName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2069716591(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)
			{
				float animationSpeedClientRpc = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref animationSpeedClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SoulDevourerAI)(object)target).setAnimationSpeedClientRpc(animationSpeedClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_2747754932(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 name = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SoulDevourerAI)(object)target).animPlayClientRpc(name);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "SoulDevourerAI";
		}
	}
}
namespace Soul_Devourer_Enemy
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("SoulDev", "Soul Devourer Enemy", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static class Assets
		{
			public static AssetBundle MainAssetBundle;

			public static void PopulateAssets()
			{
				string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
				MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "souldevbundle"));
				if ((Object)(object)MainAssetBundle == (Object)null)
				{
					Logger.LogError((object)"Failed to load custom assets.");
				}
			}
		}

		public static Harmony _harmony;

		public static ManualLogSource Logger;

		public static float rawSpawnMultiplier;

		public static ConfigEntry<float> moaiGlobalSize;

		public static ConfigEntry<float> moaiGlobalSizeVar;

		public static ConfigEntry<float> moaiSizeCap;

		public static ConfigEntry<float> moaiGlobalMusicVol;

		public static ConfigEntry<float> moaiGlobalSpeed;

		public static ConfigEntry<float> soulRarity;

		public static ConfigEntry<float> soulRarityIndoors;

		public static ConfigEntry<string> devourerSpawnDist;

		public static ConfigEntry<bool> spawnsOutside;

		public static ConfigEntry<bool> daytimeSpawn;

		public static ConfigEntry<float> LOSWidth;

		public static ConfigEntry<bool> pulseFX;

		public static ConfigEntry<float> thrashCooldown;

		public static ConfigEntry<int> maxCount;

		public static ConfigEntry<int> health;

		public static ConfigEntry<bool> canEnterIndoors;

		public static void LogDebug(string text)
		{
			Logger.LogInfo((object)text);
		}

		public static void LogProduction(string text)
		{
			Logger.LogInfo((object)text);
		}

		private void Awake()
		{
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			bindVars();
			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[] customA