Decompiled source of Shambler Enemy v1.3.0

Shambler.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
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 System.Threading.Tasks;
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 On;
using On.GameNetcodeStuff;
using Shambler;
using Shambler.NetcodePatcher;
using Shambler.src.Soul_Devourer;
using SolidLib.Registry;
using SoulDev;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[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("Shambler Enemy for Lethal Company.")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c51dcc471e1537c434b4f4d6820e33495260355a")]
[assembly: AssemblyProduct("Shambler")]
[assembly: AssemblyTitle("Shambler")]
[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 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 ShamblerEnemy : EnemyAI
	{
		public enum State
		{
			SearchingForPlayer,
			HeadingToEntrance,
			Crouching,
			Leaping,
			ClosingDistance,
			StabbingCapturedPlayer,
			HeadingToNest,
			PlantingStake,
			SneakyStab
		}

		protected Animator animator;

		private Vector3 nestSpot = Vector3.zero;

		public static List<ulong> stuckPlayerIds = new List<ulong>();

		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 = 120f;

		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 bool markDead = false;

		public AudioSource creatureLeapLand;

		public AudioSource creatureAnger;

		private float angerSoundTimer = 0f;

		private float angerSoundTimer2 = 0f;

		public AudioSource creatureLaugh;

		public AudioSource creaturePlant;

		public AudioSource creatureSneakyStab;

		public AudioSource creatureDeath;

		public AudioSource creatureTakeDmg;

		public AudioSource creatureFrustrated;

		public AudioSource[] creatureSteps;

		public static List<ShamblerEnemy> shamblerInstances = new List<ShamblerEnemy>();

		protected float runAnimationCoefficient = 14f;

		protected float walkAnimationCoefficient = 3f;

		[Header("AI Debug")]
		public bool debugThoughts = true;

		public bool debugDrawGoal = true;

		private Vector3 lastGoal = Vector3.zero;

		private bool usingCustomGoal = false;

		private float sizeCheckCooldown = 2f;

		private bool stepSoundCycle1 = false;

		private bool stepSoundCycle2 = false;

		public float stabTimeout = 6f;

		private bool doneStab = false;

		private bool isStabbing = false;

		public Transform stabPoint;

		public AudioSource creatureStab;

		private bool doneLeap = false;

		private bool isLeaping = false;

		private float leapTimer = 9f;

		private float leapAnimationLength = 0.5f;

		private float leapPeakHeight = 3f;

		public List<ulong> EscapingEmployees = new List<ulong>();

		public PlayerControllerB capturedPlayer = null;

		public PlayerControllerB stabbedPlayer = null;

		private bool stabbedCapturedPlayer = false;

		public Transform capturePoint;

		public float captureRange = 5.35f;

		public float timeTillStab = 0f;

		private float crouchTimer = 0f;

		private float maxLeapDistance = 25f;

		public float crouchTimeout = 6f;

		private float spottedCooldown = 0f;

		private LayerMask WorldMask;

		private Vector3 stickyGoal = Vector3.zero;

		private float stickyScore = float.NegativeInfinity;

		private float stickyPickedAt = -999f;

		private float lastGoalDist = 9999f;

		private float stuckTimer = 0f;

		[SerializeField]
		private float goalMinLockSeconds = 1.2f;

		[SerializeField]
		private float goalRepathCooldown = 0.6f;

		[SerializeField]
		private float goalBetterBy = 0.35f;

		[SerializeField]
		private float goalArrivalTol = 0.9f;

		[SerializeField]
		private float stuckSpeedThresh = 0.15f;

		[SerializeField]
		private float stuckSeconds = 1.1f;

		private float coverLockUntil = -999f;

		private float lastSeenTime = -999f;

		[SerializeField]
		private float coverDwellSeconds = 5f;

		[SerializeField]
		private float seenGrace = 0.9f;

		public Transform footLCol;

		public Transform footRCol;

		public Transform armLCol;

		public Transform armRCol;

		public Transform headCol;

		[SerializeField]
		private float coverRequiredFraction = 0.7f;

		private float maxStabDistance = 4f;

		private float alertLevel = 0f;

		private float alertDecay = 1.5f;

		private float sneakyAlertLevel = 70f;

		private float alertRate = 1f;

		private float headingToNestTimeout = 6f;

		private float headingToNestDistance = 0f;

		private bool isPlanting = false;

		private bool donePlant = false;

		public GameObject heldStakeRef;

		public float plantCooldown = 5f;

		public float plantTime = -1f;

		private PlayerControllerB RageTarget = null;

		private bool inLegIndependentCoroutine = false;

		private void Think(string msg)
		{
			if (debugThoughts)
			{
				Debug.Log((object)$"[Shambler@{Time.time:F1}] {msg}");
			}
		}

		private void OnDrawGizmosSelected()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_005c: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			if (debugDrawGoal && !(lastGoal == Vector3.zero))
			{
				Gizmos.color = Color.cyan;
				Gizmos.DrawLine(((Component)this).transform.position + Vector3.up * 0.5f, lastGoal + Vector3.up * 0.5f);
				Gizmos.DrawSphere(lastGoal, 0.25f);
			}
		}

		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 bool PlayerHeldByAnyShambler(PlayerControllerB ply)
		{
			try
			{
				foreach (ShamblerEnemy shamblerInstance in shamblerInstances)
				{
					if (Object.op_Implicit((Object)(object)shamblerInstance.capturedPlayer) && ((NetworkBehaviour)shamblerInstance.capturedPlayer).NetworkObjectId == ((NetworkBehaviour)ply).NetworkObjectId)
					{
						return true;
					}
					if (Object.op_Implicit((Object)(object)shamblerInstance.stabbedPlayer) && ((NetworkBehaviour)shamblerInstance.stabbedPlayer).NetworkObjectId == ((NetworkBehaviour)ply).NetworkObjectId)
					{
						return true;
					}
				}
				return false;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex);
			}
			return false;
		}

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

		public PlayerControllerB getNearestPlayer(bool addFilter = true)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			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)
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
					if (num2 < num && (PlayerQualifies(val) || !addFilter))
					{
						num = num2;
						result = val;
					}
				}
			}
			return result;
		}

		public void SetAudioVolumes()
		{
			try
			{
				AudioSource obj = creatureAnger;
				obj.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource obj2 = creatureDeath;
				obj2.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource obj3 = creatureLaugh;
				obj3.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource obj4 = creatureLeapLand;
				obj4.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource obj5 = creaturePlant;
				obj5.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource creatureSFX = base.creatureSFX;
				creatureSFX.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource obj6 = creatureSneakyStab;
				obj6.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource obj7 = creatureStab;
				obj7.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource obj8 = creatureTakeDmg;
				obj8.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource creatureVoice = base.creatureVoice;
				creatureVoice.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource obj9 = creatureFrustrated;
				obj9.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f;
				AudioSource[] array = creatureSteps;
				foreach (AudioSource val in array)
				{
					AudioSource obj10 = creatureAnger;
					float volume = (obj10.volume *= Plugin.moaiGlobalMusicVol.Value / 0.6f);
					val.volume = volume;
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex);
			}
		}

		public override void Start()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: 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_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: 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_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			if (((NetworkBehaviour)RoundManager.Instance).IsHost && Object.FindObjectsOfType<ShamblerEnemy>().Length > Plugin.maxCount.Value)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				Debug.Log((object)"Shambler: Destroyed self (enemy count too high)");
			}
			maxStabDistance = 5f * ((Component)this).transform.localScale.x;
			maxLeapDistance = 20f * ((Component)this).transform.localScale.x;
			captureRange = 5.35f * ((Component)this).transform.localScale.x;
			nestSpot = ((Component)this).transform.position;
			EntityWarp.mapEntrances = Object.FindObjectsOfType<EntranceTeleport>(false);
			mostRecentPlayer = getNearestPlayer();
			animator = ((Component)this).gameObject.GetComponent<Animator>();
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				DoAnimationClientRpc(0);
			}
			shamblerInstances.Add(this);
			stamina = 120f;
			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;
			WorldMask = BuildWorldMask();
			Think($"WorldMask={((LayerMask)(ref WorldMask)).value} built.");
			PlayerControllerB nearestPlayer = getNearestPlayer();
			if (Object.op_Implicit((Object)(object)nearestPlayer))
			{
				Vector3 val = (Object.op_Implicit((Object)(object)nearestPlayer.playerEye) ? ((Component)nearestPlayer.playerEye).transform.position : (((Component)nearestPlayer).transform.position + Vector3.up * 1.6f));
				Vector3 val2 = ((Component)this).transform.position + Vector3.up * 1.2f;
				RaycastHit val3 = default(RaycastHit);
				bool flag = Physics.Linecast(val, val2, ref val3, LayerMask.op_Implicit(WorldMask), (QueryTriggerInteraction)1);
				Think(string.Format("Initial LOS blocked={0}, hit={1}, layer={2}", flag, Object.op_Implicit((Object)(object)((RaycastHit)(ref val3)).collider) ? ((Object)((RaycastHit)(ref val3)).collider).name : "none", Object.op_Implicit((Object)(object)((RaycastHit)(ref val3)).collider) ? LayerMask.LayerToName(((Component)((RaycastHit)(ref val3)).collider).gameObject.layer) : "none"));
			}
			if (base.currentBehaviourStateIndex == 3 && Object.op_Implicit((Object)(object)base.targetPlayer))
			{
				facePosition(((Component)base.targetPlayer).transform.position);
			}
			animator.SetLayerWeight(1, 0f);
			SetAudioVolumes();
		}

		private static bool IsPlayerStaked(PlayerControllerB p)
		{
			if ((Object)(object)p == (Object)null || (Object)(object)((NetworkBehaviour)p).NetworkObject == (Object)null)
			{
				return false;
			}
			return stuckPlayerIds.Contains(((NetworkBehaviour)p).NetworkObject.NetworkObjectId);
		}

		public override void Update()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0079: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_019a: 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_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_072c: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			Transform transform = ((Component)this).transform;
			Quaternion rotation = ((Component)this).transform.rotation;
			transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
			animator.speed = 1f;
			sizeCheckCooldown -= Time.deltaTime;
			if (sizeCheckCooldown < 0f)
			{
				if (((Component)this).transform.localScale.x > 1f || ((Component)this).transform.localScale.y > 1f || ((Component)this).transform.localScale.z > 1f)
				{
					((Component)this).transform.localScale = new Vector3(1f, 1f, 1f);
					maxStabDistance = 5f * ((Component)this).transform.localScale.x;
					maxLeapDistance = 20f * ((Component)this).transform.localScale.x;
					captureRange = 5.35f * ((Component)this).transform.localScale.x;
				}
				sizeCheckCooldown = 2f;
			}
			AnimatorStateInfo currentAnimatorStateInfo;
			if (!base.isEnemyDead && base.enemyHP <= 0 && !markDead)
			{
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
				stopAllSound();
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Death"))
				{
					currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
					if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Exit"))
					{
						animator.Play("Death", 0, 0f);
					}
				}
				base.isEnemyDead = true;
				base.enemyHP = 0;
				moaiSoundPlayClientRpc("creatureDeath");
				deadEventClientRpc();
				markDead = true;
				if (Plugin.disableColliderOnDeath.Value)
				{
					Collider[] components = ((Component)this).GetComponents<Collider>();
					foreach (Collider val in components)
					{
						val.enabled = false;
					}
				}
				else
				{
					BoxCollider component = ((Component)this).GetComponent<BoxCollider>();
					if ((Object)(object)component != (Object)null)
					{
						((Collider)component).enabled = false;
					}
				}
			}
			if (base.isEnemyDead)
			{
				if (Object.op_Implicit((Object)(object)stabbedPlayer))
				{
					stabbedPlayer = null;
				}
				if (Object.op_Implicit((Object)(object)capturedPlayer))
				{
					capturedPlayer = null;
				}
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Death"))
				{
					currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
					if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("StayDead"))
					{
						animator.Play("StayDead");
					}
				}
				return;
			}
			if (Object.op_Implicit((Object)(object)stabbedPlayer))
			{
				if (!stabbedPlayer.playerCollider.enabled || !stabbedPlayer.isPlayerDead)
				{
				}
				stabbedPlayer.fallValue = 0f;
				stabbedPlayer.fallValueUncapped = 0f;
				if (!stabbedPlayer.isPlayerDead)
				{
				}
			}
			if (Object.op_Implicit((Object)(object)capturedPlayer))
			{
				if (!capturedPlayer.playerCollider.enabled || !capturedPlayer.isPlayerDead)
				{
				}
				capturedPlayer.fallValue = 0f;
				capturedPlayer.fallValueUncapped = 0f;
				if (!capturedPlayer.isPlayerDead)
				{
				}
			}
			if (base.isEnemyDead)
			{
				if (!isDeadAnimationDone)
				{
					animator.speed = 1f;
					isDeadAnimationDone = true;
					stopAllSound();
					if ((Object)(object)base.creatureVoice != (Object)null && (Object)(object)base.dieSFX != (Object)null)
					{
						base.creatureVoice.PlayOneShot(base.dieSFX);
					}
				}
				return;
			}
			AnimatorStateInfo currentAnimatorStateInfo2 = animator.GetCurrentAnimatorStateInfo(0);
			if (((AnimatorStateInfo)(ref currentAnimatorStateInfo2)).IsName("Walk"))
			{
				float num = ((AnimatorStateInfo)(ref currentAnimatorStateInfo2)).normalizedTime - Mathf.Floor(((AnimatorStateInfo)(ref currentAnimatorStateInfo2)).normalizedTime);
				if (num < 0.1f)
				{
					stepSoundCycle1 = false;
					stepSoundCycle2 = false;
				}
				if (num > 0.15f && !stepSoundCycle1)
				{
					moaiSoundPlayClientRpc("step");
					stepSoundCycle1 = true;
				}
				if (num > 0.5f && !stepSoundCycle2)
				{
					moaiSoundPlayClientRpc("step");
					stepSoundCycle2 = true;
				}
			}
			else
			{
				stepSoundCycle1 = (stepSoundCycle2 = false);
			}
			if (alertLevel > sneakyAlertLevel - 5f && ((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				if (angerSoundTimer <= 0f && FitToAssertDominance())
				{
					angerSoundTimer = (float)(7.0 * enemyRandom.NextDouble() + 5.0);
					angerSoundTimer2 += 2.5f;
					moaiSoundPlayClientRpc("creatureAnger");
					DoAssertDominanceClientRpc();
				}
				else if (angerSoundTimer2 <= 0f && FitToExpressFrustration())
				{
					angerSoundTimer2 = (float)(7.0 * enemyRandom.NextDouble() + 5.0);
					angerSoundTimer += 2.5f;
					moaiSoundPlayClientRpc("creatureFrustrated");
					DoExpressFrustrationClientRpc();
				}
			}
			if (angerSoundTimer >= 0f)
			{
				angerSoundTimer -= Time.deltaTime;
			}
			if (angerSoundTimer2 >= 0f)
			{
				angerSoundTimer2 -= Time.deltaTime;
			}
			if ((Object)(object)base.targetPlayer != (Object)null && base.targetPlayer.isPlayerDead)
			{
				base.targetPlayer = null;
			}
			base.movingTowardsTargetPlayer = (Object)(object)base.targetPlayer != (Object)null && !usingCustomGoal;
			timeSinceHittingLocalPlayer += Time.deltaTime;
			timeSinceNewRandPos += Time.deltaTime;
			if ((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true))
			{
				Transform obj = turnCompass;
				if (obj != null)
				{
					obj.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
				}
			}
			if (base.stunNormalizedTimer > 0f && !((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
			}
		}

		private void LateUpdate()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (!base.isEnemyDead)
			{
				if (Object.op_Implicit((Object)(object)capturedPlayer))
				{
					((Component)capturedPlayer).transform.position = capturePoint.position;
				}
				if (Object.op_Implicit((Object)(object)stabbedPlayer))
				{
					((Component)stabbedPlayer).transform.position = stabPoint.position;
				}
				timeTillStab -= Time.deltaTime;
			}
		}

		public override void DoAIInterval()
		{
			//IL_0115: 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)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead)
			{
				return;
			}
			if (provokePoints > 0)
			{
				provokePoints--;
			}
			if (spottedCooldown > 0f)
			{
				spottedCooldown = Mathf.Max(0f, spottedCooldown - 1f);
			}
			if (entranceDelay > 0)
			{
				entranceDelay--;
			}
			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);
				nearestEntrance = entrancePack.tele;
				nearestEntranceNavPosition = entrancePack.navPosition;
				if (stamina < 120f)
				{
					stamina += 8f;
				}
				mostRecentPlayer = getNearestPlayer();
			}
			if ((Object)(object)base.targetPlayer != (Object)null)
			{
				mostRecentPlayer = base.targetPlayer;
			}
			AIInterval();
			if (alertLevel > 0f)
			{
				alertLevel = Mathf.Max(0f, alertLevel - alertDecay);
			}
			alertLevel = Mathf.Min(100f, alertLevel);
		}

		public void AIInterval()
		{
			if (Object.op_Implicit((Object)(object)capturedPlayer) && !stabbedCapturedPlayer && timeTillStab < 0f && base.currentBehaviourStateIndex != 5)
			{
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				((EnemyAI)this).SwitchToBehaviourClientRpc(5);
				isStabbing = false;
				doneStab = false;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				usingCustomGoal = false;
				baseSearchingForPlayer();
				break;
			case 1:
				usingCustomGoal = false;
				baseHeadingToEntrance();
				break;
			case 2:
				baseCrouching();
				break;
			case 4:
				baseClosingDistance();
				break;
			case 3:
				baseLeaping();
				break;
			case 5:
				baseStabbingCapturedPlayer();
				break;
			case 6:
				baseHeadingToNest();
				break;
			case 7:
				basePlantingStake();
				break;
			case 8:
				baseSneakyStab();
				break;
			default:
				LogDebug("This Behavior State doesn't exist!");
				break;
			}
		}

		public void baseSneakyStab()
		{
			//IL_004f: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			base.agent.speed = 0f;
			stabTimeout -= 0.2f;
			base.agent.updateRotation = false;
			if (Object.op_Implicit((Object)(object)getNearestPlayer()))
			{
				facePosition(((Component)getNearestPlayer()).transform.position);
			}
			if (base.isEnemyDead)
			{
				base.agent.updateRotation = true;
				isStabbing = false;
				doneStab = false;
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				Think("Switched to searching for player");
			}
			if (!isStabbing)
			{
				((MonoBehaviour)this).StartCoroutine(DoSneakyStab());
				stabTimeout = 6f;
				isStabbing = true;
			}
			else if (doneStab)
			{
				base.agent.updateRotation = true;
				isStabbing = false;
				doneStab = false;
				if (!Object.op_Implicit((Object)(object)stabbedPlayer))
				{
					stabbedPlayer = getNearestPlayer();
					if ((Object)(object)stabbedPlayer != (Object)null)
					{
						SetStabbedPlayerClientRpc(((NetworkBehaviour)stabbedPlayer).NetworkObject.NetworkObjectId);
					}
				}
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				Think("Switched to searching for player");
			}
			else
			{
				if (!(stabTimeout < 0f))
				{
					return;
				}
				base.agent.updateRotation = true;
				isStabbing = false;
				doneStab = false;
				if (!Object.op_Implicit((Object)(object)stabbedPlayer))
				{
					stabbedPlayer = getNearestPlayer();
					if ((Object)(object)stabbedPlayer != (Object)null)
					{
						SetStabbedPlayerClientRpc(((NetworkBehaviour)stabbedPlayer).NetworkObject.NetworkObjectId);
					}
				}
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				Think("Switched to searching for player");
			}
		}

		[ClientRpc]
		public void SetCapturedPlayerClientRpc(ulong playerid, bool reset = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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(2925436343u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerid);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref reset, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2925436343u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (reset)
			{
				capturedPlayer = null;
			}
			RoundManager instance = RoundManager.Instance;
			PlayerControllerB[] allPlayerScripts = instance.playersManager.allPlayerScripts;
			PlayerControllerB[] array = allPlayerScripts;
			foreach (PlayerControllerB val3 in array)
			{
				if (((NetworkBehaviour)val3).NetworkObject.NetworkObjectId == playerid)
				{
					capturedPlayer = val3;
				}
			}
		}

		[ClientRpc]
		public void SetStabbedPlayerClientRpc(ulong playerid, bool reset = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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(3110006365u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerid);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref reset, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3110006365u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (reset)
			{
				stabbedPlayer = null;
			}
			RoundManager instance = RoundManager.Instance;
			PlayerControllerB[] allPlayerScripts = instance.playersManager.allPlayerScripts;
			PlayerControllerB[] array = allPlayerScripts;
			foreach (PlayerControllerB val3 in array)
			{
				if (((NetworkBehaviour)val3).NetworkObject.NetworkObjectId == playerid)
				{
					stabbedPlayer = val3;
				}
			}
		}

		[ClientRpc]
		public void DmgPlayerClientRpc(ulong playerid, int amount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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_0126: 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(3897930302u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerid);
				BytePacker.WriteValueBitPacked(val2, amount);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3897930302u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			RoundManager instance = RoundManager.Instance;
			PlayerControllerB[] allPlayerScripts = instance.playersManager.allPlayerScripts;
			PlayerControllerB[] array = allPlayerScripts;
			foreach (PlayerControllerB val3 in array)
			{
				if (((NetworkBehaviour)val3).NetworkObject.NetworkObjectId == playerid)
				{
					val3.DamagePlayer(amount, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
				}
			}
		}

		public IEnumerator DoSneakyStab()
		{
			if (Object.op_Implicit((Object)(object)getNearestPlayer()))
			{
				Think("DoSneakyStab");
				DoAnimationClientRpc(7);
				AnimPlayClientRpc("SneakyStab");
				moaiSoundPlayClientRpc("creatureSneakyStab");
				yield return (object)new WaitForSeconds(0.4f);
				stabbedPlayer = getNearestPlayer();
				if ((Object)(object)stabbedPlayer != (Object)null)
				{
					SetStabbedPlayerClientRpc(((NetworkBehaviour)stabbedPlayer).NetworkObject.NetworkObjectId);
				}
				capturedPlayer = null;
				SetCapturedPlayerClientRpc(0uL, reset: true);
				stabbedCapturedPlayer = true;
				if ((Object)(object)stabbedPlayer != (Object)null)
				{
					DmgPlayerClientRpc(((NetworkBehaviour)stabbedPlayer).NetworkObject.NetworkObjectId, 20);
				}
				yield return (object)new WaitForSeconds(0.65f);
				doneStab = true;
				Think("Stab Done");
				yield break;
			}
			base.agent.updateRotation = true;
			isStabbing = false;
			doneStab = false;
			if (!Object.op_Implicit((Object)(object)stabbedPlayer))
			{
				stabbedPlayer = getNearestPlayer();
				if ((Object)(object)stabbedPlayer != (Object)null)
				{
					SetStabbedPlayerClientRpc(((NetworkBehaviour)stabbedPlayer).NetworkObject.NetworkObjectId);
				}
			}
			((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			Think("Switched to searching for player");
		}

		public void baseStabbingCapturedPlayer()
		{
			//IL_0047: 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 = 0f;
			if (base.isEnemyDead)
			{
				base.agent.updateRotation = true;
				isStabbing = false;
				doneStab = false;
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				Think("Switched to searching for player");
			}
			if (!isStabbing)
			{
				((MonoBehaviour)this).StartCoroutine(DoStab());
				isStabbing = true;
			}
			else
			{
				if (!doneStab)
				{
					return;
				}
				base.agent.updateRotation = true;
				isStabbing = false;
				doneStab = false;
				capturedPlayer = null;
				SetCapturedPlayerClientRpc(0uL, reset: true);
				if (!Object.op_Implicit((Object)(object)stabbedPlayer))
				{
					stabbedPlayer = getNearestPlayer();
					if ((Object)(object)stabbedPlayer != (Object)null)
					{
						SetStabbedPlayerClientRpc(((NetworkBehaviour)stabbedPlayer).NetworkObject.NetworkObjectId);
					}
				}
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				DoAnimationClientRpc(0);
				AnimPlayClientRpc("Idle");
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				Think("Switched to searching for player");
			}
		}

		public IEnumerator DoStab()
		{
			Think("DoStab");
			DoAnimationClientRpc(5);
			AnimPlayClientRpc("StabVictimHeld");
			moaiSoundPlayClientRpc("creatureStab");
			if (Object.op_Implicit((Object)(object)capturedPlayer))
			{
				SetColliderClientRpc(((NetworkBehaviour)capturedPlayer).NetworkObject.NetworkObjectId, value: false);
			}
			yield return (object)new WaitForSeconds(1.1f);
			stabbedPlayer = capturedPlayer;
			if ((Object)(object)stabbedPlayer != (Object)null)
			{
				SetStabbedPlayerClientRpc(((NetworkBehaviour)stabbedPlayer).NetworkObject.NetworkObjectId);
			}
			capturedPlayer = null;
			SetCapturedPlayerClientRpc(0uL);
			stabbedCapturedPlayer = true;
			DmgPlayerClientRpc(((NetworkBehaviour)stabbedPlayer).NetworkObject.NetworkObjectId, 30);
			yield return (object)new WaitForSeconds(1.3f);
			if (Object.op_Implicit((Object)(object)stabbedPlayer))
			{
				SetColliderClientRpc(((NetworkBehaviour)stabbedPlayer).NetworkObject.NetworkObjectId, value: false);
			}
			doneStab = true;
			Think("Stab Done");
		}

		public void baseLeaping()
		{
			//IL_0090: 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_00a9: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			base.agent.updateRotation = false;
			base.agent.speed = 0f;
			base.targetPlayer = getNearestPlayer();
			leapTimer -= 0.2f;
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				base.agent.updateRotation = true;
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				Think("Switched to searching for player");
			}
			facePosition(((Component)base.targetPlayer).transform.position);
			if (!isLeaping && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= maxLeapDistance)
			{
				DoGroundHopClientRpc(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position);
				isLeaping = true;
			}
			else if (doneLeap)
			{
				base.agent.updateRotation = true;
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				Think("Switched to searching for player");
			}
			else if (leapTimer < 0f)
			{
				base.agent.updateRotation = true;
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				Think("Switched to searching for player");
			}
		}

		public IEnumerator DoGroundHop(Vector3 targetPos, Vector3 shamblerStartPos)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Think("DoGroundHop");
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				AnimPlayClientRpc("Leap-Land");
				moaiSoundPlayClientRpc("creatureLeapLand");
			}
			((Component)this).transform.position = shamblerStartPos;
			float duration = leapAnimationLength + Vector3.Distance(((Component)this).transform.position, targetPos) / maxLeapDistance * 0.5f;
			float elapsed = 0f;
			float arcPeak = leapPeakHeight;
			while (elapsed < duration)
			{
				float t = elapsed / duration;
				float height = Mathf.Sin(t * MathF.PI) * arcPeak;
				((Component)this).transform.position = Vector3.Lerp(shamblerStartPos, targetPos, t) + Vector3.up * height;
				elapsed += Time.deltaTime;
				yield return null;
			}
			((Component)this).transform.position = targetPos;
			Think("Landing...");
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				AnimPlayClientRpc("Land-Capture");
				AttemptCapturePlayer();
				DoAnimationClientRpc(4);
				yield return (object)new WaitForSeconds(1.2f);
				doneLeap = true;
			}
			Think("Leap Done");
		}

		[ClientRpc]
		public void DoGroundHopClientRpc(Vector3 targetPos, Vector3 shamblerStartPos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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(2556090093u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetPos);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref shamblerStartPos);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2556090093u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(DoGroundHop(targetPos, shamblerStartPos));
				}
			}
		}

		public void ClaimHuman()
		{
		}

		public void StakeNotify(PlayerControllerB player)
		{
			if ((Object)(object)player != (Object)null)
			{
				EscapingEmployees.Add(((NetworkBehaviour)player).NetworkObject.NetworkObjectId);
			}
		}

		public void StakeUnNotify(PlayerControllerB player)
		{
			if ((Object)(object)player != (Object)null)
			{
				EscapingEmployees.Remove(((NetworkBehaviour)player).NetworkObject.NetworkObjectId);
			}
			else
			{
				EscapingEmployees.Clear();
			}
		}

		public void AttemptCapturePlayer()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			Think("Shambler: Attempt Capture Player");
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			PlayerControllerB[] array = allPlayerScripts;
			foreach (PlayerControllerB val in array)
			{
				if (Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < captureRange && (Object)(object)val != (Object)(object)capturedPlayer && (Object)(object)val != (Object)(object)stabbedPlayer)
				{
					Think("Shambler: I GOTCHA");
					capturedPlayer = val;
					stabbedCapturedPlayer = false;
					val.CancelSpecialTriggerAnimations();
					attachPlayerClientRpc(((NetworkBehaviour)capturedPlayer).NetworkObject.NetworkObjectId, lastHit: false, 50);
					timeTillStab = (float)(2.0 + 30.0 * enemyRandom.NextDouble() * enemyRandom.NextDouble() * enemyRandom.NextDouble());
					DmgPlayerClientRpc(((NetworkBehaviour)val).NetworkObject.NetworkObjectId, 20);
					return;
				}
			}
			Think("Shambler: OHHHH I MISSED!");
		}

		public void baseCrouching()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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)
			base.agent.speed = 0f;
			DoAnimationClientRpc(2);
			AnimPlayClientRpc("Crouching");
			Debug.Log((object)("Crouching... timer: " + crouchTimer));
			crouchTimeout -= 0.2f;
			PlayerControllerB val = (((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true)) ? base.targetPlayer : getNearestPlayer());
			if (Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) > maxLeapDistance)
			{
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				return;
			}
			if (Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) <= maxStabDistance)
			{
				doneStab = false;
				isStabbing = false;
				((EnemyAI)this).SwitchToBehaviourClientRpc(8);
				return;
			}
			crouchTimer -= 0.2f;
			if (crouchTimer <= 0f)
			{
				Think("Switched to leap mode");
				doneLeap = false;
				isLeaping = false;
				leapTimer = 9f;
				((EnemyAI)this).SwitchToBehaviourClientRpc(3);
			}
			else if (crouchTimeout <= 0f)
			{
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
		}

		private LayerMask BuildWorldMask()
		{
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			string[] array = new string[7] { "Default", "Room", "Colliders", "MiscLevelGeometry", "Terrain", "Railing", "DecalStickableSurface" };
			string[] array2 = new string[8] { "Player", "Enemy", "Enemies", "Players", "Ragdoll", "Trigger", "Ignore Raycast", "UI" };
			int num = 0;
			string[] array3 = array;
			foreach (string text in array3)
			{
				int num2 = LayerMask.NameToLayer(text);
				if (num2 >= 0)
				{
					num |= 1 << num2;
				}
				else
				{
					Debug.LogWarning((object)("[WorldMask] Include layer \"" + text + "\" not found."));
				}
			}
			string[] array4 = array2;
			foreach (string text2 in array4)
			{
				int num3 = LayerMask.NameToLayer(text2);
				if (num3 >= 0)
				{
					num &= ~(1 << num3);
				}
			}
			num &= ~(1 << ((Component)this).gameObject.layer);
			if (num == 0)
			{
				Debug.LogWarning((object)"[WorldMask] Mask resolved to 0; falling back to Physics.DefaultRaycastLayers.");
				num = -5 & ~(1 << ((Component)this).gameObject.layer);
			}
			Debug.Log((object)$"[WorldMask] Built mask={num} (self layer excluded: {LayerMask.LayerToName(((Component)this).gameObject.layer)})");
			return LayerMask.op_Implicit(num);
		}

		private float CoverScoreAllPlayers(Vector3 pos)
		{
			//IL_004c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_007c: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			int num = 0;
			float num2 = 0f;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead && !OccludedFromPlayer_Multi(pos, val))
				{
					num++;
					Vector3 val2 = pos - ((Component)val).transform.position;
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					float num3 = Mathf.Max(0f, Vector3.Dot(((Component)val).transform.forward, normalized));
					if (num3 > num2)
					{
						num2 = num3;
					}
				}
			}
			return (num == 0) ? 2f : (-0.9f * (float)num - 0.8f * num2);
		}

		private bool TryFindCoverAgainstPlayer(PlayerControllerB ply, Vector3 around, float searchRadius, float backoff, out Vector3 coverPos)
		{
			//IL_0003: 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_005c: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0062: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			coverPos = Vector3.zero;
			if ((Object)(object)ply == (Object)null)
			{
				return false;
			}
			Vector3 val = (((Object)(object)ply.playerEye != (Object)null) ? ((Component)ply.playerEye).transform.position : (((Component)ply).transform.position + Vector3.up * 1.6f));
			Vector3 val2 = around - val;
			float num = Mathf.Max(searchRadius, ((Vector3)(ref val2)).magnitude + searchRadius);
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(val, ((Vector3)(ref val2)).normalized, ref val3, num, LayerMask.op_Implicit(WorldMask), (QueryTriggerInteraction)1))
			{
				Vector3 pos = ((RaycastHit)(ref val3)).point + ((RaycastHit)(ref val3)).normal * backoff;
				if (TrySampleNavmesh(pos, 2.5f, out var hitPos) && OccludedFromPlayer_Multi(hitPos, ply))
				{
					coverPos = hitPos;
					return true;
				}
			}
			return false;
		}

		private bool TryFindGroupCover(Vector3 center, float minR, float maxR, int rings, int samplesPerRing, out Vector3 best)
		{
			//IL_0003: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0082: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			best = Vector3.zero;
			float num = float.NegativeInfinity;
			Vector3 val = default(Vector3);
			for (int i = 0; i < rings; i++)
			{
				float num2 = ((rings == 1) ? 1f : ((float)i / (float)(rings - 1)));
				float num3 = Mathf.Lerp(minR, maxR, num2);
				for (int j = 0; j < samplesPerRing; j++)
				{
					float num4 = (float)j / (float)samplesPerRing * MathF.PI * 2f;
					((Vector3)(ref val))..ctor(Mathf.Cos(num4), 0f, Mathf.Sin(num4));
					Vector3 pos = center + val * num3;
					if (!TrySampleNavmesh(pos, 2.5f, out var hitPos))
					{
						continue;
					}
					float num5 = CoverScoreAllPlayers(hitPos);
					if (!(num5 <= 0.1f))
					{
						float num6 = 9.5f;
						float num7 = Vector3.Distance(hitPos, center);
						float num8 = 1f - Mathf.Clamp01(Mathf.Abs(num7 - num6) / num6);
						float num9 = Vector3.Distance(((Component)this).transform.position, hitPos);
						float num10 = 1f - Mathf.Clamp01(num9 / 25f);
						float num11 = 1.4f * num5 + 0.8f * num8 + 0.3f * num10;
						if (num11 > num)
						{
							num = num11;
							best = hitPos;
						}
					}
				}
			}
			return num > float.NegativeInfinity;
		}

		private bool TryGetMostDangerousViewer(out PlayerControllerB danger, out float align)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0082: 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_0094: 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)
			danger = null;
			align = 0f;
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead && !OccludedFromPlayer_Multi(((Component)this).transform.position, val))
				{
					Vector3 val2 = ((Component)this).transform.position - ((Component)val).transform.position;
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					float num = Mathf.Max(0f, Vector3.Dot(((Component)val).transform.forward, normalized));
					if (num > align)
					{
						align = num;
						danger = val;
					}
				}
			}
			return (Object)(object)danger != (Object)null;
		}

		private bool ReachedGoal(Vector3 goal)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (goal == Vector3.zero)
			{
				return false;
			}
			return Vector3.Distance(((Component)this).transform.position, goal) <= goalArrivalTol;
		}

		private bool PathBadOrPartial()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			return (int)base.agent.pathStatus == 1 || (int)base.agent.pathStatus == 2;
		}

		private bool CooldownsAllowRepath()
		{
			if (Time.time - stickyPickedAt < goalMinLockSeconds)
			{
				return false;
			}
			if (Time.time - stickyPickedAt < goalRepathCooldown)
			{
				return false;
			}
			return true;
		}

		private void ApplyStickyDestination(Vector3 goal)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_0018: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (!(goal == Vector3.zero))
			{
				if (stickyGoal != goal)
				{
					base.agent.SetDestination(goal);
				}
				stickyGoal = goal;
				usingCustomGoal = true;
				base.movingTowardsTargetPlayer = false;
			}
		}

		public void DistanceBasedPace(PlayerControllerB ply)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (ply.isSprinting)
			{
				base.agent.speed = 8.2f * Plugin.moaiGlobalSpeed.Value * Math.Max(1f, 16f / Vector3.Distance(((Component)this).transform.position, ((Component)ply).transform.position) * 0.5f + 1f);
			}
			else
			{
				base.agent.speed = 6f * Plugin.moaiGlobalSpeed.Value * Math.Max(1f, 16f / Vector3.Distance(((Component)this).transform.position, ((Component)ply).transform.position) * 0.5f + 1f);
			}
		}

		public Vector3 chooseTravelGoal(out float outScore)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: 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)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: 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_01bc: 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_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_062d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_063e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_067f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0684: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_069a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_06af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
			outScore = float.NegativeInfinity;
			PlayerControllerB val = (((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true)) ? base.targetPlayer : getNearestPlayer());
			if ((Object)(object)val == (Object)null)
			{
				Think("chooseTravelGoal: no valid player — staying put.");
				return ((Component)this).transform.position;
			}
			DistanceBasedPace(val);
			if (alertLevel >= sneakyAlertLevel)
			{
				DistanceBasedPace(val);
				return ((Component)getNearestPlayer()).transform.position;
			}
			bool flag = alertLevel < sneakyAlertLevel;
			Vector3 position = ((Component)val).transform.position;
			Vector3 forward = ((Component)val).transform.forward;
			Vector3 right = ((Component)val).transform.right;
			if (flag && spottedCooldown <= 0f && TryGetMostDangerousViewer(out var danger, out var align))
			{
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)danger).transform.position);
				if (align >= 0.6f && num <= 20f)
				{
					Vector3 val2 = ((Component)this).transform.position - ((Component)danger).transform.position;
					val2.y = 0f;
					Vector3 val3 = ((Component)this).transform.position + ((Vector3)(ref val2)).normalized * 8f;
					if (TryFindCoverAgainstPlayer(danger, val3, 16f, 1.2f, out var coverPos))
					{
						spottedCooldown = 3f;
						outScore = 5f;
						return coverPos;
					}
					if (TryFindGroupCover(val3, 8f, 16f, 3, 16, out var best))
					{
						spottedCooldown = 3f;
						outScore = 4f;
						return best;
					}
					Vector3 pos = ((Component)this).transform.position + ((Vector3)(ref val2)).normalized * 6f;
					if (TrySampleNavmesh(pos, 3f, out var hitPos))
					{
						spottedCooldown = 2f;
						outScore = 2f;
						return hitPos;
					}
				}
			}
			if (flag && TryFindCoverAgainstPlayer(val, position, 18f, 1.1f, out var coverPos2))
			{
				outScore = 3.5f;
				DistanceBasedPace(val);
				return coverPos2;
			}
			if (flag && TryFindGroupCover(position, 1.1f, 14f, 3, 16, out var best2))
			{
				outScore = 3f;
				DistanceBasedPace(val);
				return best2;
			}
			float num2 = 7.5f;
			float num3 = 11f;
			float num4 = 9f;
			float num5 = 0f;
			float maxDist = 6f;
			List<Vector3> list = new List<Vector3>(8)
			{
				position - forward * num2,
				position - forward * num3,
				position - forward * num4 + right * (num4 * 0.75f),
				position - forward * num4 - right * (num4 * 0.75f),
				position + Quaternion.AngleAxis(35f, Vector3.up) * -forward * num5,
				position + Quaternion.AngleAxis(-35f, Vector3.up) * -forward * num5,
				position - forward * (num5 * 0.6f),
				position - forward * (num5 * 1.3f)
			};
			for (int i = 0; i < list.Count; i++)
			{
				List<Vector3> list2 = list;
				int index = i;
				list2[index] += new Vector3(Random.Range(-0.75f, 0.75f), 0f, Random.Range(-0.75f, 0.75f));
			}
			float num6 = float.NegativeInfinity;
			Vector3 hitPos2 = ((Component)this).transform.position;
			foreach (Vector3 item in list)
			{
				if (TrySampleNavmesh(item, maxDist, out var hitPos3))
				{
					Vector3 val4 = hitPos3 - position;
					Vector3 normalized = ((Vector3)(ref val4)).normalized;
					float num7 = Mathf.Clamp01(0f - Vector3.Dot(forward, normalized));
					float num8 = (flag ? 9.5f : 6.5f);
					float num9 = Vector3.Distance(hitPos3, position);
					float num10 = 1f - Mathf.Clamp01(Mathf.Abs(num9 - num8) / num8);
					float num11 = CoverScoreAllPlayers(hitPos3);
					float num12 = (flag ? num11 : Mathf.Max(num11, -0.4f));
					bool flag2 = num11 <= 0.1f;
					if (Time.time - lastSeenTime < seenGrace && flag2)
					{
						num12 -= 1.2f;
					}
					float num13 = Vector3.Distance(((Component)this).transform.position, hitPos3);
					float num14 = 1f - Mathf.Clamp01(num13 / 30f);
					float num15 = Mathf.Abs(Vector3.Dot(normalized, right));
					float num16 = (flag ? (0.15f * num15) : (0.35f * num15));
					float num17 = (flag ? 1f : 0.6f);
					float num18 = num17 * num7 + 1f * num10 + 1.2f * num12 + 0.3f * num14 + 0.4f * num16;
					if (num18 > num6)
					{
						num6 = num18;
						hitPos2 = hitPos3;
					}
				}
			}
			if (num6 == float.NegativeInfinity)
			{
				Vector3 val5 = position - ((Component)this).transform.position;
				val5.y = 0f;
				if (((Vector3)(ref val5)).sqrMagnitude > 0.01f)
				{
					val5 = Quaternion.AngleAxis(20f * ((Random.value > 0.5f) ? 1f : (-1f)), Vector3.up) * ((Vector3)(ref val5)).normalized * 4f;
					if (!TrySampleNavmesh(((Component)this).transform.position + val5, 6f, out hitPos2))
					{
						hitPos2 = ((Component)this).transform.position;
					}
				}
			}
			DistanceBasedPace(val);
			outScore = num6;
			return hitPos2;
		}

		private bool TrySampleNavmesh(Vector3 pos, float maxDist, out Vector3 hitPos, int areaMask = -1)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(pos, ref val, maxDist, areaMask))
			{
				hitPos = ((NavMeshHit)(ref val)).position;
				return true;
			}
			hitPos = Vector3.zero;
			return false;
		}

		private IEnumerable<PlayerControllerB> AllActivePlayers()
		{
			PlayerControllerB[] arr = RoundManager.Instance.playersManager.allPlayerScripts;
			foreach (PlayerControllerB p in arr)
			{
				if ((Object)(object)p != (Object)null && p.isPlayerControlled && !p.isPlayerDead)
				{
					yield return p;
				}
			}
		}

		private bool PlayerHasLOSTo(Vector3 candidatePos, PlayerControllerB ply, LayerMask mask, float raise = 1.4f)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (((Object)(object)ply.playerEye != (Object)null) ? ((Component)ply.playerEye).transform.position : (((Component)ply).transform.position + Vector3.up * 1.6f));
			Vector3 val2 = candidatePos + Vector3.up * raise;
			RaycastHit val3 = default(RaycastHit);
			return !Physics.Linecast(val, val2, ref val3, LayerMask.op_Implicit(mask), (QueryTriggerInteraction)1);
		}

		private bool IsVisibleToAnyPlayers(Vector3 pos)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead && !OccludedFromPlayer_Multi(pos, val))
				{
					return true;
				}
			}
			return false;
		}

		private bool IsOccludedFromAllPlayers(Vector3 pos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return !IsVisibleToAnyPlayers(pos);
		}

		private Vector3[] BuildPointsForCandidate(Vector3 candidatePos, PlayerControllerB ply)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: 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_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: 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_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (((Object)(object)ply != (Object)null && (Object)(object)ply.playerEye != (Object)null) ? ((Component)ply.playerEye).transform.position : (((Object)(object)ply != (Object)null) ? (((Component)ply).transform.position + Vector3.up * 1.6f) : (candidatePos + Vector3.up * 1.6f)));
			Vector3 val2 = candidatePos - val;
			Vector3 fwd = ((Vector3)(ref val2)).normalized;
			if (((Vector3)(ref fwd)).sqrMagnitude < 0.0001f)
			{
				fwd = Vector3.forward;
			}
			val2 = Vector3.Cross(Vector3.up, fwd);
			Vector3 right = ((Vector3)(ref val2)).normalized;
			val2 = Vector3.Cross(fwd, right);
			Vector3 up = ((Vector3)(ref val2)).normalized;
			Vector3 lp2 = (Vector3)(Object.op_Implicit((Object)(object)footLCol) ? footLCol.localPosition : new Vector3(-0.25f, 0.1f, 0f));
			Vector3 lp3 = (Vector3)(Object.op_Implicit((Object)(object)footRCol) ? footRCol.localPosition : new Vector3(0.25f, 0.1f, 0f));
			Vector3 lp4 = (Vector3)(Object.op_Implicit((Object)(object)armLCol) ? armLCol.localPosition : new Vector3(-0.45f, 1.2f, 0f));
			Vector3 lp5 = (Vector3)(Object.op_Implicit((Object)(object)armRCol) ? armRCol.localPosition : new Vector3(0.45f, 1.2f, 0f));
			Vector3 lp6 = (Vector3)(Object.op_Implicit((Object)(object)headCol) ? headCol.localPosition : new Vector3(0f, 1.7f, 0f));
			return (Vector3[])(object)new Vector3[5]
			{
				ToWorld(lp2),
				ToWorld(lp3),
				ToWorld(lp4),
				ToWorld(lp5),
				ToWorld(lp6)
			};
			Vector3 ToWorld(Vector3 lp)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: 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_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				return candidatePos + right * lp.x + up * lp.y + fwd * lp.z;
			}
		}

		private bool OccludedFromPlayer_Multi(Vector3 candidatePos, PlayerControllerB ply)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0055: 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_0067: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ply == (Object)null)
			{
				return true;
			}
			Vector3 val = (((Object)(object)ply.playerEye != (Object)null) ? ((Component)ply.playerEye).transform.position : (((Component)ply).transform.position + Vector3.up * 1.6f));
			Vector3[] array = BuildPointsForCandidate(candidatePos, ply);
			int num = 0;
			for (int i = 0; i < array.Length; i++)
			{
				if (Physics.Linecast(val, array[i], LayerMask.op_Implicit(WorldMask), (QueryTriggerInteraction)1))
				{
					num++;
				}
			}
			float num2 = (float)num / (float)array.Length;
			return num2 >= coverRequiredFraction;
		}

		public void baseClosingDistance()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: 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_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_053b: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			lookStep();
			base.agent.speed = 6f * Plugin.moaiGlobalSpeed.Value;
			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;
				SetParamClientRpc("WalkSpeed", ((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);
					}
					SetParamClientRpc("WalkSpeed", 1f);
				}
			}
			PlayerControllerB val = (((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true)) ? base.targetPlayer : getNearestPlayer());
			if ((Object)(object)val == (Object)null || (Object)(object)getNearestPlayer() == (Object)null)
			{
				Think("No valid player; switching to Search.");
				usingCustomGoal = false;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				return;
			}
			bool flag = IsVisibleToAnyPlayers(((Component)this).transform.position);
			if (flag)