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 Spiner v2.0.0
SpinerVisual.dll
Decompiled 2 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using SpinerVisual.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; [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("SpinerVisual")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SpinerVisual")] [assembly: AssemblyTitle("SpinerVisual")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 Spiner { public class SpinerAI : EnemyAI, INoiseListener { public enum SpinerEvent { None, Kidnap, Death, Creep, Detection, Transport, Spin, Roam, Runaway } private enum State { Runaway, Patrol, Stalking, Kidnapping, Transport } [CompilerGenerated] private sealed class <ExitRunawayAfterDelay>d__130 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SpinerAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ExitRunawayAfterDelay>d__130(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.ChangeState(State.Patrol); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [SerializeField] private AudioSource walkAudioSource = null; [SerializeField] private AudioSource sfxAudioSource = null; [SerializeField] private AudioClip kidnappingSound = null; [SerializeField] private AudioClip moveSound = null; [SerializeField] private AudioClip creepSound = null; [SerializeField] private AudioClip transportSound = null; [SerializeField] private AudioClip runawaySound = null; [SerializeField] private AudioClip detectionSound = null; [SerializeField] private AudioClip deathSound = null; [SerializeField] private AudioClip roamingSound = null; [SerializeField] private AudioClip roamingSound2 = null; [SerializeField] private AudioClip roamingSound3 = null; [SerializeField] private AudioClip quackKidnappingSound = null; [SerializeField] private AudioClip quackMoveSound = null; [SerializeField] private AudioClip quackCreepSound = null; [SerializeField] private AudioClip quackTransportSound = null; [SerializeField] private AudioClip quackRunawaySound = null; [SerializeField] private AudioClip quackDetectionSound = null; [SerializeField] private AudioClip quackDeathSound = null; [SerializeField] private AudioClip quackRoamingSound = null; [SerializeField] private AudioClip quackRoamingSound2 = null; [SerializeField] private AudioClip quackRoamingSound3 = null; private AudioClip currentKidnappingSound = null; private AudioClip currentMoveSound = null; private AudioClip currentCreepSound = null; private AudioClip currentTransportSound = null; private AudioClip currentRunawaySound = null; private AudioClip currentDetectionSound = null; private AudioClip currentDeathSound = null; private AudioClip currentRoamingSound = null; private AudioClip currentRoamingSound2 = null; private AudioClip currentRoamingSound3 = null; public string animStalk = "Stalk"; public string animWalk = "Walk"; public string animAttack = "Attack"; public string animGrab = "Grab"; public string animHurt = "Hurt"; public string animHurt2 = "Hurt2"; public string animHurt3 = "Hurt3"; public string animDeath = "Death"; public string animDeath2 = "Death2"; public string animSpin = "Spin"; public string animSpinTest = "Spintest"; private int spinerBehaviourStateIndex; [SerializeField] public Transform kidnapCarryPoint = null; private Random randomGenerator = new Random(); private bool isRunawayActive = false; private bool isPatrolActive = false; private bool isStalkingActive = false; private bool isKidnappingActive = false; private bool isTransportActive = false; private State previousState = State.Patrol; public float[] playerStealthMeters = new float[4]; public PlayerControllerB chasingPlayer = null; private int stalkingTargetId = -1; private int kidnappingTargetId = -1; private int transportingTargetId = -1; private Vector3 lastLoggedDestination = Vector3.zero; private bool overrideSpeed = false; private bool enableRpcLogging = true; private float transportReleaseTimer = 0f; private const float transportReleaseDelay = 15f; private bool hasReceivedDamageRecently = false; private bool isAvoidingThreat = false; private Vector3 currentAvoidPoint; private int hurtAnimIndex = 0; private Transform transportTargetNode; private float getPathToTransportNodeInterval; private int _cfgMaxHP; private float _cfgRoamVolume; private bool _cfgDarkMode; private float _cfgDarkReviveDelay; private float _cfgDarkKillTime; private bool _cfgApplied; private bool _cfgSoundStyle; private bool _feignDeathActive; private float _feignDeathTimer; private bool _phase2Lethal; private bool _killTimerActive; private float _kidnapKillTimer; private float stalkingMeter = 0f; private float stalkingMeterMax = 15f; private float stalkingMeterIncrement = 1f; private float stalkingMeterDecrement = 0.5f; private const float losCorridorOffset1 = 0.25f; private const float losCorridorOffset2 = 0.5f; private const float losLogInterval = 0.5f; private float _nextLosLogTime_ISee = 0f; private AudioClip _lastClip = null; private float _lastTime; private const float Phase2Pitch = 0.5f; private const float Phase2VolMult = 1f; private Vector3 _stuckLastPos; private float _stuckTimer; private float _stuckSampleT; private bool _stuckInit; [SerializeField] private float stuckSampleInterval = 0.25f; [SerializeField] private float stuckMinMoveDist = 0.5f; [SerializeField] private float stuckTimeToTrigger = 5f; private float nextLosAvgTime = 0f; private int losSum = 0; private int losCount = 0; private int losScore = 5; private bool stalkingMovementActive = false; private Vector3 stalkingMoveTarget = Vector3.zero; private int stalkingMoveMode = 0; private float _stalkMoveStartTime = 0f; private float _nextStalkMoveDbgTime = 0f; private const float stalkingMeterAbortThreshold = -3f; private float lastLoggedStalkingSecond = -1f; private float kidnappingTimeout = 5f; private float kidnappingTimer = 0f; private string _currentAnimState = ""; private bool _phase2AudioTintApplied = false; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); _feignDeathActive = false; _killTimerActive = false; _phase2Lethal = false; _feignDeathTimer = 0f; _kidnapKillTimer = 0f; if (((NetworkBehaviour)this).IsServer) { string runtimeConfigJson = SpinerPlugin.GetRuntimeConfigJson(); ApplyRuntimeConfigClientRpc(runtimeConfigJson); _cfgMaxHP = SpinerPlugin.MaxHP.Value; _cfgRoamVolume = SpinerPlugin.RoamVolume.Value; _cfgDarkMode = SpinerPlugin.DarkMode.Value; _cfgDarkReviveDelay = SpinerPlugin.DarkReviveDelay.Value; _cfgDarkKillTime = SpinerPlugin.DarkKillTime.Value; _cfgSoundStyle = SpinerPlugin.SoundStyle.Value; _cfgApplied = true; ApplyLocalConfig(); } else { _cfgApplied = false; } } private void ApplyLocalConfig() { if (!_cfgApplied) { _cfgMaxHP = SpinerPlugin.MaxHP.Value; _cfgRoamVolume = SpinerPlugin.RoamVolume.Value; _cfgDarkMode = SpinerPlugin.DarkMode.Value; _cfgDarkReviveDelay = SpinerPlugin.DarkReviveDelay.Value; _cfgDarkKillTime = SpinerPlugin.DarkKillTime.Value; _cfgSoundStyle = SpinerPlugin.SoundStyle.Value; _cfgApplied = true; } base.enemyHP = _cfgMaxHP; ApplySoundStyle(); } public override void Start() { ((EnemyAI)this).Start(); if (!base.agent.isOnNavMesh) { LogCriticalReferences(); } if ((Object)(object)base.creatureAnimator == (Object)null) { base.creatureAnimator = ((Component)this).GetComponent<Animator>(); if (!((Object)(object)base.creatureAnimator == (Object)null)) { } } playerStealthMeters = new float[StartOfRound.Instance.allPlayerScripts.Length]; randomGenerator = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); spinerBehaviourStateIndex = 1; } public override void Update() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: 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) if (base.stunNormalizedTimer > 0f) { return; } if (base.agent.destination != lastLoggedDestination) { lastLoggedDestination = base.agent.destination; } ((EnemyAI)this).Update(); StuckSafeguardTick(); TickFeignDeath(); if (base.isEnemyDead) { return; } switch ((State)spinerBehaviourStateIndex) { case State.Runaway: if (previousState != 0) { previousState = State.Runaway; } break; case State.Patrol: { if (previousState != State.Patrol) { previousState = State.Patrol; } List<GameObject> allAlivePlayerObjects = GetAllAlivePlayerObjects(); GameObject val = ((EnemyAI)this).CheckLineOfSight(allAlivePlayerObjects, 45f, 50, 3f, base.eye, (int[])null); if (!((Object)(object)val != (Object)null)) { break; } PlayerControllerB component = val.GetComponent<PlayerControllerB>(); int num = Array.IndexOf(StartOfRound.Instance.allPlayerScripts, component); if (num >= 0) { if (((NetworkBehaviour)this).IsServer) { BeginSpinerStalkClientRpc(num); } else { BeginSpinerStalkServerRpc(num); } } break; } case State.Stalking: if (previousState != State.Stalking) { previousState = State.Stalking; } break; case State.Kidnapping: if (previousState != State.Kidnapping) { previousState = State.Kidnapping; } break; case State.Transport: if (previousState != State.Transport) { previousState = State.Transport; } break; } Vector3 velocity = base.agent.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; bool flag = magnitude > 0.5f; AnimatorStateInfo currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0); string text = (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("walk") ? "walk" : "other"); bool flag2 = base.creatureAnimator.IsInTransition(0); SetAnimation(flag ? "Walk" : "Idle"); if (flag) { if (!walkAudioSource.isPlaying) { walkAudioSource.volume = 0.75f; walkAudioSource.Play(); } } else if (walkAudioSource.isPlaying) { walkAudioSource.Stop(); } } private List<GameObject> GetAllAlivePlayerObjects(PlayerControllerB? exclude = null) { List<GameObject> list = new List<GameObject>(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && !val.isPlayerDead && (Object)(object)val != (Object)(object)exclude) { list.Add(((Component)val).gameObject); } } return list; } private List<GameObject> GetAllAliveEnemyObjects() { List<GameObject> list = new List<GameObject>(); EnemyAICollisionDetect[] array = Object.FindObjectsOfType<EnemyAICollisionDetect>(); foreach (EnemyAICollisionDetect val in array) { if ((Object)(object)val != (Object)null && (Object)(object)val.mainScript != (Object)null && (Object)(object)val.mainScript != (Object)(object)this && !val.mainScript.isEnemyDead) { list.Add(((Component)val).gameObject); } } return list; } private void ApplySoundStyle() { if (_cfgSoundStyle) { currentKidnappingSound = quackKidnappingSound; currentMoveSound = quackMoveSound; currentCreepSound = quackCreepSound; currentTransportSound = quackTransportSound; currentRunawaySound = quackRunawaySound; currentDetectionSound = quackDetectionSound; currentDeathSound = quackDeathSound; currentRoamingSound = quackRoamingSound; currentRoamingSound2 = quackRoamingSound2; currentRoamingSound3 = quackRoamingSound3; } else { currentKidnappingSound = kidnappingSound; currentMoveSound = moveSound; currentCreepSound = creepSound; currentTransportSound = transportSound; currentRunawaySound = runawaySound; currentDetectionSound = detectionSound; currentDeathSound = deathSound; currentRoamingSound = roamingSound; currentRoamingSound2 = roamingSound2; currentRoamingSound3 = roamingSound3; } } public override void DoAIInterval() { //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0410: 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_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: 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_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_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: 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_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Expected O, but got Unknown //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Invalid comparison between Unknown and I4 //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) if (base.stunNormalizedTimer > 0f || base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } if (((NetworkBehaviour)this).IsServer && StartOfRound.Instance.shipIsLeaving && spinerBehaviourStateIndex != 0) { BeginSpinerRunawayServerRpc(); return; } if (((NetworkBehaviour)this).IsServer && hasReceivedDamageRecently && spinerBehaviourStateIndex != 0) { hasReceivedDamageRecently = false; BeginSpinerRunawayServerRpc(); } ((EnemyAI)this).DoAIInterval(); switch ((State)spinerBehaviourStateIndex) { case State.Patrol: if (!isPatrolActive) { StartPatrol(); } break; case State.Runaway: if (!isRunawayActive) { StartRunaway(); } break; case State.Stalking: if (!isStalkingActive) { if (stalkingTargetId != -1) { StartStalking(stalkingTargetId); } else { ChangeState(State.Patrol); } } else { LookAtPlayer(); StalkingBehavior(); } break; case State.Kidnapping: if (!isKidnappingActive) { if (kidnappingTargetId != -1) { StartKidnapping(kidnappingTargetId); } else { ChangeState(State.Patrol); } } else { PerformKidnapping(); } break; case State.Transport: { if (!isTransportActive) { if (transportingTargetId != -1) { StartTransport(transportingTargetId); } else { ChangeState(State.Patrol); } break; } PerformTransport(); if (spinerBehaviourStateIndex != 4 || !isTransportActive) { break; } List<GameObject> list = new List<GameObject>(); list.AddRange(GetAllAlivePlayerObjects(base.inSpecialAnimationWithPlayer)); list.AddRange(GetAllAliveEnemyObjects()); if (!isAvoidingThreat) { GameObject val = ((EnemyAI)this).CheckLineOfSight(list, 45f, 12, 2f, base.eye, (int[])null); if ((Object)(object)val != (Object)null) { Vector3 position = ((Component)this).transform.position; Vector3 val2 = position - val.transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; normalized.y = 0f; if (((Vector3)(ref normalized)).sqrMagnitude > 0.01f) { bool flag = false; Vector3 val3 = Vector3.zero; float[] array = new float[5] { 5f, 7f, 9f, 11f, 13f }; float[] array2 = new float[9] { 0f, 20f, -20f, 40f, -40f, 60f, -60f, 90f, -90f }; float[] array3 = array; NavMeshHit val6 = default(NavMeshHit); foreach (float num in array3) { float[] array4 = array2; foreach (float num2 in array4) { Vector3 val4 = Quaternion.Euler(0f, num2, 0f) * normalized; Vector3 val5 = position + val4 * num; if (NavMesh.SamplePosition(val5, ref val6, 2.5f, -1)) { NavMeshPath val7 = new NavMeshPath(); if (NavMesh.CalculatePath(position, ((NavMeshHit)(ref val6)).position, -1, val7) && (int)val7.status == 0) { val3 = ((NavMeshHit)(ref val6)).position; flag = true; break; } } } if (flag) { break; } } if (flag) { currentAvoidPoint = val3; ((EnemyAI)this).SetDestinationToPosition(currentAvoidPoint, true); isAvoidingThreat = true; break; } } } if ((Object)(object)transportTargetNode == (Object)null || Vector3.Distance(((Component)this).transform.position, transportTargetNode.position) < 2f) { transportTargetNode = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, false, 0, false, 50, false); } if ((Object)(object)transportTargetNode != (Object)null && Time.realtimeSinceStartup - getPathToTransportNodeInterval > 1f) { base.targetNode = transportTargetNode; ((EnemyAI)this).SetDestinationToPosition(transportTargetNode.position, true); getPathToTransportNodeInterval = Time.realtimeSinceStartup; } } else if (Vector3.Distance(((Component)this).transform.position, currentAvoidPoint) < 2f) { isAvoidingThreat = false; currentAvoidPoint = Vector3.zero; if ((Object)(object)transportTargetNode == (Object)null || Vector3.Distance(((Component)this).transform.position, transportTargetNode.position) < 2f) { transportTargetNode = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, false, 0, false, 50, false); } if ((Object)(object)transportTargetNode != (Object)null) { base.targetNode = transportTargetNode; ((EnemyAI)this).SetDestinationToPosition(transportTargetNode.position, true); getPathToTransportNodeInterval = Time.realtimeSinceStartup; } } break; } } } private void ResetAllFlags() { //IL_002c: 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_0061: Unknown result type (might be due to invalid IL or missing references) isRunawayActive = false; isPatrolActive = false; isStalkingActive = false; isKidnappingActive = false; isTransportActive = false; stalkingMovementActive = false; stalkingMoveTarget = Vector3.zero; stalkingMoveMode = 0; _stalkMoveStartTime = 0f; overrideSpeed = false; base.agent.ResetPath(); base.agent.velocity = Vector3.zero; base.agent.isStopped = false; base.moveTowardsDestination = false; base.movingTowardsTargetPlayer = false; transportReleaseTimer = 0f; } private void UpdateSpeed() { if (!overrideSpeed) { switch ((State)spinerBehaviourStateIndex) { case State.Patrol: base.agent.speed = 1f; break; case State.Runaway: base.agent.speed = 6f; break; case State.Stalking: base.agent.speed = 2f; break; case State.Kidnapping: base.agent.speed = 6f; break; case State.Transport: base.agent.speed = 4f; break; } } } private void ChangeState(State newState, int playerId = -1) { if (spinerBehaviourStateIndex != (int)newState) { if (newState == State.Runaway && (Object)(object)base.inSpecialAnimationWithPlayer != (Object)null) { RequestReleaseTransportServer(); } switch ((State)spinerBehaviourStateIndex) { case State.Runaway: StopRunaway(); break; case State.Patrol: StopPatrol(); break; case State.Stalking: StopStalking(); break; case State.Kidnapping: StopKidnapping(); break; case State.Transport: StopTransport(); break; } ResetAllFlags(); spinerBehaviourStateIndex = (int)newState; UpdateSpeed(); switch (newState) { case State.Patrol: TriggerFx(SpinerEvent.Roam); StartPatrol(); break; case State.Stalking: TriggerFx(SpinerEvent.Creep); StartStalking(playerId); break; case State.Kidnapping: TriggerFx(SpinerEvent.Kidnap); StartKidnapping(playerId); break; case State.Transport: TriggerFx(SpinerEvent.Transport); StartTransport(playerId); break; case State.Runaway: TriggerFx(SpinerEvent.Runaway); StartRunaway(); break; } } } private void LogRPC(string direction, string rpcName) { if (enableRpcLogging) { string message = "[RPC] " + direction + " ▶ " + rpcName + " | " + $"OwnerClientId={((NetworkBehaviour)this).OwnerClientId} | " + $"IsHost={((NetworkBehaviour)this).IsHost}, IsServer={((NetworkBehaviour)this).IsServer}, IsClient={((NetworkBehaviour)this).IsClient}, IsOwner={((NetworkBehaviour)this).IsOwner} | " + $"CurrentState={(State)spinerBehaviourStateIndex}"; SpinerPlugin.LogInfo(message); } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (base.isEnemyDead) { return; } base.enemyHP -= force; if (base.enemyHP <= 0 && !base.isEnemyDead && ((NetworkBehaviour)this).IsOwner) { SpinerPlugin.LogInfo("[Combat] Enemy HP reached 0 → Killing enemy."); ((EnemyAI)this).KillEnemyOnOwnerClient(false); return; } if (!base.isEnemyDead) { string[] array = new string[3] { "Hurt", "Hurt2", "Hurt3" }; string animType = array[hurtAnimIndex]; SetAnimation(animType); hurtAnimIndex = (hurtAnimIndex + 1) % array.Length; } if (((NetworkBehaviour)this).IsServer) { hasReceivedDamageRecently = true; } } public override void KillEnemy(bool destroy = false) { ChangeState(State.Patrol); if (_cfgDarkMode && !_feignDeathActive && !_phase2Lethal && !destroy) { StartFeignDeath(); return; } RequestReleaseTransportServer(); ((EnemyAI)this).CancelSpecialAnimationWithPlayer(); ((EnemyAI)this).KillEnemy(false); SetAnimation("Death"); } private void StartFeignDeath() { base.isEnemyDead = true; _feignDeathActive = true; _feignDeathTimer = _cfgDarkReviveDelay; SetAnimation("Death"); TriggerFx(SpinerEvent.Death); ((Behaviour)base.agent).enabled = false; RequestReleaseTransportServer(); ((EnemyAI)this).CancelSpecialAnimationWithPlayer(); } private void TickFeignDeath() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) if (!_feignDeathActive) { return; } _feignDeathTimer -= Time.deltaTime; if (_feignDeathTimer > 0f) { return; } _feignDeathActive = false; _phase2Lethal = true; base.isEnemyDead = false; if ((Object)(object)base.agent != (Object)null) { ((Behaviour)base.agent).enabled = true; if (!base.agent.isOnNavMesh) { base.agent.Warp(((Component)this).transform.position); } } base.enemyHP = _cfgMaxHP; SetAnimation("Resurrect"); ChangeState(State.Runaway); Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (val.material.HasProperty("_Color")) { val.material.color = Color.Lerp(val.material.color, Color.black, 0.7f); } if (val.material.HasProperty("_EmissionColor")) { val.material.SetColor("_EmissionColor", val.material.GetColor("_EmissionColor") * 0.5f); } } } private void StuckSafeguardTick() { //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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0253: 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_024c: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || (Object)(object)base.agent == (Object)null || !((Behaviour)base.agent).enabled || base.isEnemyDead || _feignDeathActive || base.stunNormalizedTimer > 0f) { return; } State state = (State)spinerBehaviourStateIndex; if (state == State.Transport || state == State.Kidnapping) { return; } if (!_stuckInit) { _stuckInit = true; _stuckLastPos = ((Component)this).transform.position; _stuckTimer = 0f; _stuckSampleT = 0f; return; } _stuckSampleT += Time.deltaTime; if (_stuckSampleT < stuckSampleInterval) { return; } _stuckSampleT = 0f; if (base.agent.isStopped || base.agent.pathPending || !base.agent.hasPath || base.agent.remainingDistance <= base.agent.stoppingDistance + 0.1f) { return; } float num = Vector3.Distance(((Component)this).transform.position, _stuckLastPos); _stuckLastPos = ((Component)this).transform.position; if (num >= stuckMinMoveDist) { _stuckTimer = 0f; return; } _stuckTimer += stuckSampleInterval; if (!(_stuckTimer < stuckTimeToTrigger)) { _stuckTimer = 0f; Vector3 position = ((Component)this).transform.position; bool flag = false; Vector3 val = position; NavMeshHit val2 = default(NavMeshHit); NavMeshHit val3 = default(NavMeshHit); NavMeshHit val4 = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val2, 6f, -1)) { val = ((NavMeshHit)(ref val2)).position; flag = true; } else if (NavMesh.SamplePosition(position, ref val3, 12f, -1)) { val = ((NavMeshHit)(ref val3)).position; flag = true; } else if (NavMesh.SamplePosition(position, ref val4, 20f, -1)) { val = ((NavMeshHit)(ref val4)).position; flag = true; } if (flag) { base.agent.ResetPath(); base.agent.Warp(val); _stuckLastPos = ((Component)this).transform.position; ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } } } private void RequestReleaseTransportServer() { //IL_00ad: 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_00b2: 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_00b4: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00e9: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) SpinerPlugin.LogWarning("[RELEASE SERVER] RequestReleaseTransportServer called | " + $"IsServer={((NetworkBehaviour)this).IsServer} | playerId={transportingTargetId} | " + $"hasPlayer={(Object)(object)base.inSpecialAnimationWithPlayer != (Object)null}"); if (((NetworkBehaviour)this).IsServer && !((Object)(object)base.inSpecialAnimationWithPlayer == (Object)null) && transportingTargetId >= 0) { PlayerControllerB inSpecialAnimationWithPlayer = base.inSpecialAnimationWithPlayer; Vector3 val = (((Object)(object)kidnapCarryPoint != (Object)null) ? kidnapCarryPoint.position : ((Component)inSpecialAnimationWithPlayer).transform.position); Vector3 val2 = val; NavMeshHit val3 = default(NavMeshHit); NavMeshHit val4 = default(NavMeshHit); NavMeshHit val5 = default(NavMeshHit); NavMeshHit val6 = default(NavMeshHit); if (NavMesh.SamplePosition(val, ref val3, 4f, -1)) { val2 = ((NavMeshHit)(ref val3)).position; } else if (NavMesh.SamplePosition(val, ref val4, 8f, -1)) { val2 = ((NavMeshHit)(ref val4)).position; } else if (NavMesh.SamplePosition(val, ref val5, 16f, -1)) { val2 = ((NavMeshHit)(ref val5)).position; } else if (NavMesh.SamplePosition(((Component)this).transform.position, ref val6, 16f, -1)) { val2 = ((NavMeshHit)(ref val6)).position; } val2 += Vector3.up * 0.1f; SpinerPlugin.LogWarning($"[RELEASE SERVER] Safe position computed: {val2}"); int num = transportingTargetId; ApplyReleaseTransportLocal(num, val2); SpinerPlugin.LogWarning($"[RELEASE SERVER] Broadcasting release to clients for player {num}"); ForceReleaseTransportClientRpc(num, val2); } } private void ApplyReleaseTransportLocal(int playerId, Vector3 safePos) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) SpinerPlugin.LogWarning("[RELEASE APPLY] Applying local release | " + string.Format("Instance={0} | playerId={1}", ((NetworkBehaviour)this).IsServer ? "SERVER" : "CLIENT", playerId)); transportReleaseTimer = 0f; StopLethalTimer(); isTransportActive = false; transportingTargetId = -1; if (playerId < 0 || playerId >= StartOfRound.Instance.allPlayerScripts.Length) { base.inSpecialAnimationWithPlayer = null; kidnapCarryPoint = null; return; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId]; if ((Object)(object)val == (Object)null) { base.inSpecialAnimationWithPlayer = null; kidnapCarryPoint = null; return; } if ((Object)(object)((Component)val).transform.parent != (Object)null) { ((Component)val).transform.SetParent((Transform)null, true); } val.inSpecialInteractAnimation = false; val.inAnimationWithEnemy = null; val.snapToServerPosition = false; ((Component)val).transform.position = safePos; if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) { InputAction val2 = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false); if (val2 != null) { val2.Enable(); } } if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)(object)val) { base.inSpecialAnimationWithPlayer = null; } kidnapCarryPoint = null; } private void StartRunaway() { //IL_0041: 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_007b: 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_008a: 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_0098: 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_0060: Unknown result type (might be due to invalid IL or missing references) if (!isRunawayActive) { stalkingTargetId = -1; kidnappingTargetId = -1; transportingTargetId = -1; chasingPlayer = null; isRunawayActive = true; UpdateSpeed(); Transform val = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, false, 0, false, 50, false); if ((Object)(object)val != (Object)null) { ((EnemyAI)this).SetDestinationToPosition(val.position, true); } else { Vector3 val2 = ((Component)this).transform.position + Random.insideUnitSphere * 10f; val2.y = ((Component)this).transform.position.y; ((EnemyAI)this).SetDestinationToPosition(val2, true); } ((MonoBehaviour)this).StartCoroutine(ExitRunawayAfterDelay()); } } private void StopRunaway() { if (isRunawayActive) { isRunawayActive = false; } } public void StartPatrol() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (!isPatrolActive) { stalkingTargetId = -1; kidnappingTargetId = -1; transportingTargetId = -1; chasingPlayer = null; isPatrolActive = true; UpdateSpeed(); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } } public void StopPatrol() { if (isPatrolActive) { ((EnemyAI)this).StopSearch(base.currentSearch, true); isPatrolActive = false; } } private void StartStalking(int playerId) { stalkingTargetId = playerId; if (!isStalkingActive) { isStalkingActive = true; chasingPlayer = StartOfRound.Instance.allPlayerScripts[playerId]; LookAtPlayer(); UpdateSpeed(); StalkingBehavior(); } } private void StopStalking() { //IL_002d: 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) if (isStalkingActive) { isStalkingActive = false; stalkingTargetId = -1; stalkingMoveMode = 0; stalkingMovementActive = false; stalkingMoveTarget = Vector3.zero; ResetRotation(); } } private void StartKidnapping(int playerId) { kidnappingTargetId = playerId; if (!isKidnappingActive) { SpinerPlugin.LogInfo("[Kidnapping] \ud83d\udea8 Entering Kidnapping mode!"); isKidnappingActive = true; UpdateSpeed(); PerformKidnapping(); } } private void StopKidnapping() { if (isKidnappingActive) { isKidnappingActive = false; } } private void StartTransport(int playerId) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)null && playerId >= 0 && playerId < StartOfRound.Instance.allPlayerScripts.Length) { base.inSpecialAnimationWithPlayer = StartOfRound.Instance.allPlayerScripts[playerId]; } transportingTargetId = playerId; transportTargetNode = null; getPathToTransportNodeInterval = 0f; if (isTransportActive) { return; } isTransportActive = true; kidnapCarryPoint = ((Component)this).transform.Find("KidnapCarryPoint"); if ((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null && (Object)(object)kidnapCarryPoint != (Object)null) { ((Component)base.inSpecialAnimationWithPlayer).transform.SetParent(kidnapCarryPoint); ((Component)base.inSpecialAnimationWithPlayer).transform.localPosition = Vector3.zero; ((Component)base.inSpecialAnimationWithPlayer).transform.localRotation = Quaternion.identity; base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = true; base.inSpecialAnimationWithPlayer.inAnimationWithEnemy = (EnemyAI)(object)this; base.inSpecialAnimationWithPlayer.snapToServerPosition = true; if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { InputAction val = IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false); if (val != null) { val.Disable(); } } } UpdateSpeed(); } private void StopTransport() { //IL_0031: 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) if (isTransportActive) { isTransportActive = false; transportTargetNode = null; getPathToTransportNodeInterval = 0f; isAvoidingThreat = false; currentAvoidPoint = Vector3.zero; ((EnemyAI)this).StopSearch(base.currentSearch, true); } } [IteratorStateMachine(typeof(<ExitRunawayAfterDelay>d__130))] private IEnumerator ExitRunawayAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ExitRunawayAfterDelay>d__130(0) { <>4__this = this }; } private void StalkingBehavior() { //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_020c: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_035e: 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_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0321: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_034e: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer && isStalkingActive && stalkingTargetId >= 0 && stalkingTargetId < StartOfRound.Instance.allPlayerScripts.Length) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[stalkingTargetId]; if ((Object)(object)val == (Object)null || val.isPlayerDead || !((Component)val).gameObject.activeInHierarchy || !val.isInsideFactory) { BeginSpinerPatrolServerRpc(); return; } } int num = ISeeMyTarget(); bool flag = MyTargetSeesMe(); bool inLosThisFrame = num > 0; UpdateStalkingMeter(inLosThisFrame); losSum += num; losCount++; if (Time.time >= nextLosAvgTime) { nextLosAvgTime = Time.time + 0.5f; float num2 = ((losCount > 0) ? ((float)losSum / (float)losCount) : 0f); losScore = Mathf.Clamp(Mathf.RoundToInt(num2), 0, 5); losSum = 0; losCount = 0; } if (losScore == 0) { if (stalkingMovementActive && stalkingMoveMode == 2) { HandleStalkingMovement(wantMove: true, stalkingMoveTarget); return; } if (!stalkingMovementActive || stalkingMoveMode != 1) { Vector3 approachPos = GetApproachPos(); if (approachPos == Vector3.zero) { stalkingMoveMode = 0; HandleStalkingMovement(wantMove: false, Vector3.zero, stopNow: true); return; } stalkingMoveTarget = approachPos; stalkingMoveMode = 1; } HandleStalkingMovement(wantMove: true, stalkingMoveTarget); } else if (losScore == 1) { if (flag) { stalkingMoveMode = 0; HandleStalkingMovement(wantMove: false, Vector3.zero, stopNow: true); return; } if (stalkingMovementActive && stalkingMoveMode == 2) { HandleStalkingMovement(wantMove: true, stalkingMoveTarget); return; } if (!stalkingMovementActive || stalkingMoveMode != 1) { Vector3 approachPos2 = GetApproachPos(); if (approachPos2 == Vector3.zero) { stalkingMoveMode = 0; HandleStalkingMovement(wantMove: false, Vector3.zero, stopNow: true); return; } stalkingMoveTarget = approachPos2; stalkingMoveMode = 1; } HandleStalkingMovement(wantMove: true, stalkingMoveTarget); } else if (losScore == 2) { stalkingMoveMode = 0; HandleStalkingMovement(wantMove: false, Vector3.zero, stopNow: true); } else if (flag) { if (!stalkingMovementActive || stalkingMoveMode != 2) { Vector3 hidePos = GetHidePos(); if (hidePos == Vector3.zero) { stalkingMoveMode = 0; HandleStalkingMovement(wantMove: false, Vector3.zero, stopNow: true); return; } stalkingMoveTarget = hidePos; stalkingMoveMode = 2; } HandleStalkingMovement(wantMove: true, stalkingMoveTarget); } else { stalkingMoveMode = 0; HandleStalkingMovement(wantMove: false, Vector3.zero, stopNow: true); } } private void HandleStalkingMovement(bool wantMove, Vector3 wantedTarget, bool stopNow = false) { //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_0022: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_01de: 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_0204: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Invalid comparison between Unknown and I4 //IL_0261: 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_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) if (stopNow || !wantMove) { base.agent.ResetPath(); base.agent.velocity = Vector3.zero; base.agent.isStopped = false; base.moveTowardsDestination = false; base.movingTowardsTargetPlayer = false; stalkingMovementActive = false; stalkingMoveTarget = Vector3.zero; stalkingMoveMode = 0; _stalkMoveStartTime = 0f; } else { if (wantedTarget == Vector3.zero) { return; } if (!stalkingMovementActive) { base.agent.speed = 4f; NavMeshHit val = default(NavMeshHit); if (!NavMesh.SamplePosition(((Component)this).transform.position, ref val, 2f, -1)) { stalkingMoveTarget = Vector3.zero; return; } Vector3 position = ((NavMeshHit)(ref val)).position; NavMeshPath val2 = new NavMeshPath(); if (!NavMesh.CalculatePath(position, wantedTarget, -1, val2) || (int)val2.status > 0) { stalkingMoveTarget = Vector3.zero; return; } stalkingMoveTarget = wantedTarget; if (!((EnemyAI)this).SetDestinationToPosition(stalkingMoveTarget, true)) { stalkingMovementActive = false; stalkingMoveTarget = Vector3.zero; base.moveTowardsDestination = false; base.movingTowardsTargetPlayer = false; stalkingMoveMode = 0; _stalkMoveStartTime = 0f; } else { base.moveTowardsDestination = true; base.movingTowardsTargetPlayer = false; stalkingMovementActive = true; _stalkMoveStartTime = Time.time; } return; } float num = 1f; float num2 = Vector3.Distance(((Component)this).transform.position, stalkingMoveTarget); if (num2 <= num) { base.agent.ResetPath(); base.agent.velocity = Vector3.zero; base.moveTowardsDestination = false; base.movingTowardsTargetPlayer = false; stalkingMovementActive = false; stalkingMoveTarget = Vector3.zero; stalkingMoveMode = 0; _stalkMoveStartTime = 0f; return; } float num3 = 5f; if (_stalkMoveStartTime > 0f && Time.time - _stalkMoveStartTime >= num3) { base.agent.ResetPath(); base.agent.velocity = Vector3.zero; base.agent.isStopped = false; base.moveTowardsDestination = false; base.movingTowardsTargetPlayer = false; stalkingMovementActive = false; stalkingMoveTarget = Vector3.zero; stalkingMoveMode = 0; _stalkMoveStartTime = 0f; } } } private void LookAtPlayer() { //IL_001e: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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_0046: 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) if (!((Object)(object)chasingPlayer == (Object)null)) { Vector3 val = ((Component)chasingPlayer).transform.position - ((Component)this).transform.position; val.y = 0f; Quaternion rotation = Quaternion.LookRotation(val); ((Component)this).transform.rotation = rotation; } } private void ResetRotation() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.rotation = Quaternion.identity; } private void UpdateStalkingMeter(bool inLosThisFrame) { float num = stalkingMeter; if (inLosThisFrame) { stalkingMeter = Mathf.Min(stalkingMeter + stalkingMeterIncrement * Time.deltaTime, stalkingMeterMax); } else { stalkingMeter = Mathf.Max(stalkingMeter - stalkingMeterDecrement * Time.deltaTime, -3f); } float num2 = Mathf.Floor(stalkingMeter); if (num2 != lastLoggedStalkingSecond) { lastLoggedStalkingSecond = num2; SpinerPlugin.LogInfo(string.Format("[UpdateStalkingMeter] Meter: {0}s {1}", Mathf.RoundToInt(stalkingMeter), inLosThisFrame ? "(LOS)" : "(no LOS)")); } if (stalkingMeter <= 0f && num > 0f) { SpinerPlugin.LogInfo("[UpdateStalkingMeter] Meter reached 0."); lastLoggedStalkingSecond = -1f; } if (stalkingMeter >= stalkingMeterMax) { SpinerPlugin.LogInfo("[UpdateStalkingMeter] Meter full => switch to KIDNAPPING"); stalkingMeter = 0f; lastLoggedStalkingSecond = -1f; BeginSpinerKidnapServerRpc(stalkingTargetId); } if (stalkingMeter <= -3f) { SpinerPlugin.LogInfo("[UpdateStalkingMeter] Meter dropped too low => switch to PATROL"); stalkingMeter = 0f; lastLoggedStalkingSecond = -1f; BeginSpinerPatrolServerRpc(); } } private int ISeeMyTarget() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_004c: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_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_0077: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_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_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_00df: 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) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)chasingPlayer == (Object)null) { return 0; } Vector3 position = base.eye.position; Vector3 val = ((Component)chasingPlayer).transform.position + Vector3.up * 1f; float num = Vector3.Distance(position, val); if (num > 50f) { return 0; } Vector3 val2 = val - position; Vector3 normalized = ((Vector3)(ref val2)).normalized; float num2 = Vector3.Angle(base.eye.forward, normalized); if (num2 > 70f) { return 0; } val2 = Vector3.Cross(Vector3.up, normalized); Vector3 val3 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f) { val3 = base.eye.right; } Vector3 val4 = position; Vector3 val5 = position - val3 * 0.25f; Vector3 val6 = position - val3 * 0.5f; Vector3 val7 = position + val3 * 0.25f; Vector3 val8 = position + val3 * 0.5f; Vector3 val9 = val4 + normalized * num; Vector3 val10 = val5 + normalized * num; Vector3 val11 = val6 + normalized * num; Vector3 val12 = val7 + normalized * num; Vector3 val13 = val8 + normalized * num; int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault; bool flag = !Physics.Linecast(val4, val9, collidersAndRoomMaskAndDefault); bool flag2 = !Physics.Linecast(val5, val10, collidersAndRoomMaskAndDefault); bool flag3 = !Physics.Linecast(val6, val11, collidersAndRoomMaskAndDefault); bool flag4 = !Physics.Linecast(val7, val12, collidersAndRoomMaskAndDefault); bool flag5 = !Physics.Linecast(val8, val13, collidersAndRoomMaskAndDefault); int num3 = 0; if (flag) { num3++; } if (flag2) { num3++; } if (flag3) { num3++; } if (flag4) { num3++; } if (flag5) { num3++; } bool flag6 = num3 == 0; bool flag7 = !flag6; if (Time.time >= _nextLosLogTime_ISee) { _nextLosLogTime_ISee = Time.time + 0.5f; string arg = $"C:{(flag ? 1 : 0)} " + $"L:{(flag2 ? 1 : 0)}{(flag3 ? 1 : 0)} " + $"R:{(flag4 ? 1 : 0)}{(flag5 ? 1 : 0)}"; SpinerPlugin.LogInfo($"[ISeeMyTarget] LOS={flag7} | score={num3}/5 | {arg}"); } return num3; } private bool MyTargetSeesMe() { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)chasingPlayer == (Object)null) { return false; } Transform transform = ((Component)chasingPlayer.gameplayCamera).transform; Vector3 position = base.eye.position; Vector3 position2 = transform.position; float num = Vector3.Distance(position2, position); if (num > 50f) { return false; } Vector3 val = position - position2; Vector3 normalized = ((Vector3)(ref val)).normalized; float num2 = Vector3.Angle(transform.forward, normalized); if (num2 > 70f) { return false; } bool flag = Physics.Linecast(position2, position, StartOfRound.Instance.collidersAndRoomMaskAndDefault); return !flag; } private Vector3 GetApproachPos() { //IL_0025: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00c2: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)chasingPlayer == (Object)null) { return Vector3.zero; } Vector3 enemyPos = ((Component)this).transform.position; Transform p = ((Component)chasingPlayer).transform; float num = 2f; float radius = 2.5f; int samples = 15; float navSnap = 2.5f; Vector3 behindCenter = p.position - p.forward * num; NavMeshPath path = new NavMeshPath(); Vector3 val = TryCone(120f); if (val == Vector3.zero) { val = TryCone(180f); } if (val == Vector3.zero) { SpinerPlugin.LogInfo("[GetApproachPos] FAIL no pathComplete candidates (120->180)"); } return val; Vector3 TryCone(float angleDeg) { //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_0011: 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) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0067: 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_0070: 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_007d: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Invalid comparison between Unknown and I4 //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = -p.forward; Vector3 normalized = ((Vector3)(ref val2)).normalized; NavMeshHit val5 = default(NavMeshHit); for (int i = 0; i < samples; i++) { float num2 = ((samples == 1) ? 0.5f : ((float)i / (float)(samples - 1))); float num3 = Mathf.Lerp((0f - angleDeg) * 0.5f, angleDeg * 0.5f, num2); Vector3 val3 = Quaternion.Euler(0f, num3, 0f) * normalized; Vector3 val4 = behindCenter + val3 * radius; if (NavMesh.SamplePosition(val4, ref val5, navSnap, -1) && NavMesh.CalculatePath(enemyPos, ((NavMeshHit)(ref val5)).position, -1, path) && (int)path.status <= 0) { SpinerPlugin.LogInfo($"[GetApproachPos] PICK pos={((NavMeshHit)(ref val5)).position} | cone={angleDeg} | pathComplete"); return ((NavMeshHit)(ref val5)).position; } } return Vector3.zero; } } private Vector3 GetHidePos() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_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_005f: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //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_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_01f9: 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_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_018b: Invalid comparison between Unknown and I4 //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Invalid comparison between Unknown and I4 //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Invalid comparison between Unknown and I4 //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)chasingPlayer == (Object)null) { return Vector3.zero; } SpinerPlugin.LogInfo("[SubState] ENTER HIDE"); Vector3 enemyPos = ((Component)this).transform.position; Vector3 position = ((Component)chasingPlayer).transform.position; Vector3 val = position - enemyPos; Vector3 dirToPlayer = ((Vector3)(ref val)).normalized; List<Vector3> possibleNodes = new List<Vector3>(); AddNodes(-60f, 60f, 6f, 15); AddNodes(-90f, -60f, 8f, 6); AddNodes(60f, 90f, 8f, 6); AddNodes(-120f, -90f, 10f, 6); AddNodes(90f, 120f, 10f, 6); SpinerPlugin.LogInfo($"[GetHidePos] {possibleNodes.Count} candidate nodes generated."); NavMeshPath val2 = new NavMeshPath(); foreach (Vector3 item in possibleNodes) { float num = Vector3.Distance(item, position); val = position - item; if (!Physics.Raycast(item, ((Vector3)(ref val)).normalized, num, StartOfRound.Instance.collidersRoomDefaultAndFoliage) || !NavMesh.CalculatePath(enemyPos, item, -1, val2) || (int)val2.status != 0) { continue; } SpinerPlugin.LogInfo($"[GetHidePos] PICK node={item} | pathComplete"); return item; } SpinerPlugin.LogInfo("[GetHidePos] No valid hiding spot found! Searching for alternative escape..."); Vector3 val3 = -dirToPlayer; Vector3 val4 = enemyPos + val3 * 6f; NavMeshHit val5 = default(NavMeshHit); if (NavMesh.SamplePosition(val4, ref val5, 3f, -1) && NavMesh.CalculatePath(enemyPos, ((NavMeshHit)(ref val5)).position, -1, val2) && (int)val2.status == 0) { return ((NavMeshHit)(ref val5)).position; } Vector3 val6 = enemyPos - dirToPlayer * 5f; NavMeshHit val7 = default(NavMeshHit); if (NavMesh.SamplePosition(val6, ref val7, 3f, -1) && NavMesh.CalculatePath(enemyPos, ((NavMeshHit)(ref val7)).position, -1, val2) && (int)val2.status == 0) { return ((NavMeshHit)(ref val7)).position; } return Vector3.zero; void AddNodes(float angleMin, float angleMax, float radius, int samples) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0046: 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_0050: 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_005a: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ea: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val10 = default(NavMeshHit); for (int i = 0; i < samples; i++) { float num2 = ((samples == 1) ? 0.5f : ((float)i / (float)(samples - 1))); float num3 = Mathf.Lerp(angleMin, angleMax, num2); Vector3 val8 = Quaternion.Euler(0f, num3, 0f) * -dirToPlayer; Vector3 val9 = enemyPos + val8 * radius; if (NavMesh.SamplePosition(val9, ref val10, 2f, -1)) { bool flag = false; for (int j = 0; j < possibleNodes.Count; j++) { Vector3 val11 = possibleNodes[j] - ((NavMeshHit)(ref val10)).position; if (((Vector3)(ref val11)).sqrMagnitude < 0.25f) { flag = true; break; } } if (!flag) { possibleNodes.Add(((NavMeshHit)(ref val10)).position); } } } } } private void PerformKidnapping() { //IL_0031: 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_00ce: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)chasingPlayer == (Object)null) { SpinerPlugin.LogWarning("[Kidnapping] No chasingPlayer assigned. Switching to Runaway."); ChangeState(State.Runaway); return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)chasingPlayer).transform.position); if (num > 50f || !chasingPlayer.isPlayerControlled || chasingPlayer.isPlayerDead) { kidnappingTimer += Time.deltaTime; if (kidnappingTimer >= kidnappingTimeout) { kidnappingTimer = 0f; ChangeState(State.Runaway); return; } } else { kidnappingTimer = 0f; } ((EnemyAI)this).SetDestinationToPosition(((Component)chasingPlayer).transform.position, true); } public override void OnCollideWithPlayer(Collider other) { ((EnemyAI)this).OnCollideWithPlayer(other); if (!((NetworkBehaviour)this).IsServer || base.isEnemyDead) { return; } State state = (State)spinerBehaviourStateIndex; if ((state != State.Patrol && state != State.Stalking && state != State.Kidnapping) || state == State.Transport || isTransportActive || (Object)(object)base.inSpecialAnimationWithPlayer != (Object)null) { return; } PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val == (Object)null) { return; } int num = Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val); if (num >= 0) { base.inSpecialAnimationWithPlayer = val; kidnappingTargetId = num; transportingTargetId = num; chasingPlayer = val; stalkingTargetId = num; SetAnimation("Grab"); if (_phase2Lethal && !_killTimerActive) { _killTimerActive = true; _kidnapKillTimer = _cfgDarkKillTime; } BeginSpinerTransportClientRpc(kidnappingTargetId); } } private void PerformTransport() { //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead) { RequestReleaseTransportServer(); return; } if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)null || base.inSpecialAnimationWithPlayer.isPlayerDead || !((Component)base.inSpecialAnimationWithPlayer).gameObject.activeInHierarchy || (Object)(object)base.inSpecialAnimationWithPlayer.inAnimationWithEnemy != (Object)(object)this) { RequestReleaseTransportServer(); ChangeState(State.Runaway); return; } if (_phase2Lethal) { if (!((NetworkBehaviour)this).IsServer) { return; } if (_killTimerActive && (Object)(object)base.inSpecialAnimationWithPlayer != (Object)null) { _kidnapKillTimer -= Time.deltaTime; if (_kidnapKillTimer % 1f > (_kidnapKillTimer - Time.deltaTime) % 1f && _kidnapKillTimer <= 0f) { _killTimerActive = false; SetAnimation("Spin"); PlayerControllerB inSpecialAnimationWithPlayer = base.inSpecialAnimationWithPlayer; if ((Object)(object)inSpecialAnimationWithPlayer != (Object)null && !inSpecialAnimationWithPlayer.isPlayerDead) { RequestReleaseTransportServer(); if (((NetworkBehaviour)this).IsServer) { KillCapturedClientRpc(inSpecialAnimationWithPlayer.playerClientId, 17); } if (((NetworkBehaviour)inSpecialAnimationWithPlayer).IsOwner) { inSpecialAnimationWithPlayer.KillPlayer(Vector3.up * 14f, true, (CauseOfDeath)17, 7, Vector3.zero); } ChangeState(State.Patrol); } return; } } float num = Vector3.Distance(((Component)base.inSpecialAnimationWithPlayer).transform.position, kidnapCarryPoint.position); if (num > 4f) { RequestReleaseTransportServer(); ChangeState(State.Runaway); } return; } int num2 = StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled && !p.isPlayerDead && (Object)(object)p != (Object)(object)base.inSpecialAnimationWithPlayer); if (num2 <= 0) { transportReleaseTimer += Time.deltaTime; if (transportReleaseTimer >= 15f) { RequestReleaseTransportServer(); ChangeState(State.Runaway); return; } } else if (transportReleaseTimer > 0f) { transportReleaseTimer = 0f; } float num3 = Vector3.Distance(((Component)base.inSpecialAnimationWithPlayer).transform.position, kidnapCarryPoint.position); if (num3 > 2.5f) { RequestReleaseTransportServer(); ChangeState(State.Runaway); } } private void StopLethalTimer() { _killTimerActive = false; _kidnapKillTimer = 0f; } [ClientRpc] private void ApplyRuntimeConfigClientRpc(string json) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4228702990u, val, (RpcDelivery)0); bool flag = json != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(json, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4228702990u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SpinerPlugin.SpinerRuntimeConfig spinerRuntimeConfig = JsonUtility.FromJson<SpinerPlugin.SpinerRuntimeConfig>(json); _cfgMaxHP = spinerRuntimeConfig.maxHP; _cfgRoamVolume = spinerRuntimeConfig.roamVolume; _cfgDarkMode = spinerRuntimeConfig.darkMode; _cfgDarkReviveDelay = spinerRuntimeConfig.darkReviveDelay; _cfgDarkKillTime = spinerRuntimeConfig.darkKillTime; _cfgApplied = true; ApplyLocalConfig(); } } [ClientRpc] private void KillCapturedClientRpc(ulong targetId, int cause, ClientRpcParams rpcParams = default(ClientRpcParams)) { //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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1601466477u, rpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, targetId); BytePacker.WriteValueBitPacked(val, cause); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1601466477u, rpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null && localPlayerController.playerClientId == targetId && !localPlayerController.isPlayerDead) { localPlayerController.KillPlayer(Vector3.up * 14f, true, (CauseOfDeath)cause, 7, Vector3.zero); } } } [ServerRpc(RequireOwnership = false)] private void BeginSpinerPatrolServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4149237383u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4149237383u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; LogRPC("Server", "BeginSpinerPatrolServerRpc"); ChangeState(State.Patrol); BeginSpinerPatrolClientRpc(); } } } [ClientRpc] private void BeginSpinerPatrolClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1689745625u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1689745625u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; LogRPC("Client", "BeginSpinerPatrolClientRpc"); ChangeState(State.Patrol); } } } [ServerRpc(RequireOwnership = false)] private void BeginSpinerStalkServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1741744632u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1741744632u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; LogRPC("Server", "BeginSpinerStalkServerRpc"); ChangeState(State.Stalking, playerId); BeginSpinerStalkClientRpc(playerId); } } } [ClientRpc] private void BeginSpinerStalkClientRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3777187886u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3777187886u, val, (RpcDelivery)0);