Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Shambler Enemy v1.0.8
Shambler.dll
Decompiled 5 months ago
The result has been truncated due to the large size, download it to view full contents!
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+de30a7b4fd06f505c14721da353043ab3517b186")] [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 Transform findExitPoint(EntranceTeleport referenceDoor) { return referenceDoor.exitPoint; } public static void SendEnemyOutside(EnemyAI __instance, bool SpawnOnDoor = true) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) __instance.isOutside = true; __instance.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); EntranceTeleport tele = findNearestEntrance(__instance).tele; if (!Object.op_Implicit((Object)(object)tele)) { Debug.LogError((object)"MOAI EntranceTeleport: Failed to find entrance teleport."); } Transform entrancePoint = tele.entrancePoint; if (!Object.op_Implicit((Object)(object)entrancePoint)) { Debug.LogError((object)"MOAI EntranceTeleport: Failed to find best exit position."); } NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)entrancePoint).transform.position, ref val, 10f, -1)) { __instance.serverPosition = ((NavMeshHit)(ref val)).position; ((Component)__instance).transform.position = ((NavMeshHit)(ref val)).position; __instance.agent.Warp(__instance.serverPosition); __instance.SyncPositionToClients(); } else { Debug.LogError((object)"MOAI EntranceTeleport: Failed to find exit NavmeshHit position"); } } } internal class 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 = 0f; protected bool recovering = false; public int provokePoints = 0; public Transform turnCompass; protected float timeSinceHittingLocalPlayer; protected float timeSinceNewRandPos; protected Vector3 positionRandomness; protected Vector3 StalkPos; protected Random enemyRandom; protected bool isDeadAnimationDone; private bool markDead = false; public AudioSource creatureLeapLand; public AudioSource creatureAnger; private float angerSoundTimer = 0f; public AudioSource creatureLaugh; public AudioSource creaturePlant; public AudioSource creatureSneakyStab; public AudioSource creatureDeath; public AudioSource creatureTakeDmg; public AudioSource[] creatureSteps; 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 float lastGoalScore = 0f; 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 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 override void OnDestroy() { ((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() { } 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: 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); } 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); } } 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00e0: 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_016a: 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_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_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); 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) { animator.speed = 1f; ((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"); } } base.isEnemyDead = true; base.enemyHP = 0; moaiSoundPlayClientRpc("creatureDeath"); deadEventClientRpc(); markDead = true; ((Collider)((Component)this).GetComponent<BoxCollider>()).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(); 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 && ((NetworkBehaviour)RoundManager.Instance).IsHost && angerSoundTimer <= 0f) { angerSoundTimer = 5f; moaiSoundPlayClientRpc("creatureAnger"); } if (angerSoundTimer >= 0f) { angerSoundTimer -= 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)) { 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_005b: 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_016f: 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) base.agent.speed = 0f; stabTimeout -= 0.2f; setAnimationSpeedClientRpc(1f); 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_0121: 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) 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(30, true, true, (CauseOfDeath)0, 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; DmgPlayerClientRpc(((NetworkBehaviour)stabbedPlayer).NetworkObject.NetworkObjectId, 30); 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) base.agent.speed = 0f; setAnimationSpeedClientRpc(1f); 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) base.agent.updateRotation = false; base.agent.speed = 0f; setAnimationSpeedClientRpc(1f); 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) { if ((Object)(object)val != (Object)(object)capturedPlayer) { Think("Shambler: I GOTCHA"); capturedPlayer = val; stabbedCapturedPlayer = false; 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; } DmgPlayerClientRpc(((NetworkBehaviour)val).NetworkObject.NetworkObjectId, 70); } } Think("Shambler: OHHHH I MISSED!"); } public void baseCrouching() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) base.agent.speed = 0f; setAnimationSpeedClientRpc(1f); 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)) ? 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; } 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0284: 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) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: 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_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0305: 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_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0343: 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_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037c: 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_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: 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_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: 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_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: 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_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: 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_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04be: 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_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: 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)) ? 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_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_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_0171: 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_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_0300: 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_02b8: 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_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: 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_04b1: 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_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_058d: 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; setAnimationSpeedClientRpc(((Vector3)(ref velocity)).magnitude / walkAnimationCoefficient); } else { velocity = base.agent.velocity; if (((Vector3)(ref velocity)).magnitude <= base.agent.speed / 8f) { if (((NetworkBehaviour)RoundManager.Instance).IsServer) { DoAnimationClientRpc(0); } setAnimationSpeedClientRpc(1f); } } PlayerControllerB val = (((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false)) ? 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) { lastSeenTime = Time.time; } if (alertLevel >= 70f && (double)Vector3.Distance(((Component)getNearestPlayer()).transform.position, ((Component)this).transform.position) < (double)maxLeapDistance / 1.5) { ((EnemyAI)this).SwitchToBehaviourClientRpc(2); crouchTimer = (float)(0.5 + enemyRandom.NextDouble() * 1.5); crouchTimeout = 7f; return; } if (alertLevel <= 70f && Vector3.Distance(((Component)getNearestPlayer()).transform.position, ((Component)this).transform.position) < maxStabDistance) { doneStab = false; isStabbing = false; ((EnemyAI)this).SwitchToBehaviourClientRpc(8); return; } if (!flag && Time.time < coverLockUntil) { usingCustomGoal = true; base.movingTowardsTargetPlayer = false; if (stickyGoal != Vector3.zero && base.agent.destination != stickyGoal) { base.agent.SetDestination(stickyGoal); } return; } float num = ((stickyGoal == Vector3.zero) ? 9999f : Vector3.Distance(((Component)this).transform.position, stickyGoal)); velocity = base.agent.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; if (magnitude < stuckSpeedThresh && num > goalArrivalTol) { stuckTimer += Time.deltaTime; } else { stuckTimer = 0f; } bool flag2 = ReachedGoal(stickyGoal); bool flag3 = stuckTimer >= stuckSeconds; bool flag4 = flag2 || flag3 || PathBadOrPartial() || stickyGoal == Vector3.zero; if (flag4 || CooldownsAllowRepath()) { float outScore; Vector3 val2 = chooseTravelGoal(out outScore); bool flag5 = outScore > stickyScore + goalBetterBy; if (IsVisibleToAnyPlayers(val2) && Time.time - lastSeenTime < seenGrace) { flag5 = outScore > stickyScore + (goalBetterBy + 1f); } if (flag4 || flag5) { if (IsOccludedFromAllPlayers(val2)) { coverLockUntil = Time.time + coverDwellSeconds; } else { coverLockUntil = -999f; } stickyScore = outScore; stickyPickedAt = Time.time; ApplyStickyDestination(val2); } else { usingCustomGoal = true; base.movingTowardsTargetPlayer = false; } } else { usingCustomGoal = true; base.movingTowardsTargetPlayer = false; } if (stickyGoal != Vector3.zero && base.agent.destination != stickyGoal) { base.agent.SetDestination(stickyGoal); } lastGoalDist = num; if ((Object)(object)val == (Object)null || Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) > 62f || stamina <= 0f) { Think("Exiting sneak (reason=" + (((Object)(object)val == (Object)null) ? "no target" : ((stamina <= 0f) ? "tired" : "too far")) + ")"); base.targetPlayer = null; usingCustomGoal = false; stickyGoal = Vector3.zero; stickyScore = float.NegativeInfinity; ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } } public void lookStep() { //IL_0062: 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) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a1: 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_00bf: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts; float num = 0f; PlayerControllerB[] array = allPlayerScripts; foreach (PlayerControllerB val in array) { if (!((Object)(object)val == (Object)null) && !val.isPlaye