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 JPOGRaptor v1.0.6
plugins/JPOGRaptor.dll
Decompiled 4 days ago#define DEBUG using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using JPOGRaptor.NetcodePatcher; using JPOGRaptor.src; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("JPOGRaptor")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.6.0")] [assembly: AssemblyInformationalVersion("1.0.6+779c0b81c25edaf5daa03212f1ef616e3aaf028d")] [assembly: AssemblyProduct("JPOGRaptor")] [assembly: AssemblyTitle("JPOGRaptor")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.6.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 JPOGRaptor { public class JPOGRaptorAI : EnemyAI { public enum State { SearchingForPlayer, StalkingPlayer, ChasingPlayer, RespondingToCall, AttackingPlayer } [CompilerGenerated] private sealed class <PlayBark>d__63 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool shortBark; public JPOGRaptorAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PlayBark>d__63(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (shortBark) { if (<>4__this.respondingToHelpCall) { <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } goto IL_0070; } <>4__this.DoAnimationClientRpc("shortBark"); <>2__current = (object)new WaitForSeconds(1.3f); <>1__state = 3; return true; case 1: <>1__state = -1; goto IL_0070; case 2: <>1__state = -1; <>4__this.inCallAnimation = false; break; case 3: { <>1__state = -1; break; } IL_0070: <>4__this.DoAnimationClientRpc("barkCall"); <>2__current = (object)new WaitForSeconds(3f); <>1__state = 2; return true; } 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(); } } [CompilerGenerated] private sealed class <ReachtToHelp>d__71 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public JPOGRaptorAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ReachtToHelp>d__71(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(1.5f); <>1__state = 1; return true; case 1: <>1__state = -1; ((EnemyAI)<>4__this).SwitchToBehaviourServerRpc(3); 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(); } } public static List<JPOGRaptorAI> AllRaptors = new List<JPOGRaptorAI>(); public Transform turnCompass = null; public Transform attackArea = null; public AudioSource RaptorcallVoice = null; public AudioSource RaptorStepsSFX = null; public Transform MouthBone = null; private State? previousState = null; private float timeSinceHittingLocalPlayer; private float timeSinceHittingOtherEnemy; private bool isDeadAnimationDone; private bool inCallAnimation = false; private bool isClimbing; public AudioClip FootstepClip1 = null; public AudioClip FootstepClip2 = null; private bool isNextStepClip1 = true; public NetworkVariable<float> CurrentSpeed = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private RaptorPounceHelper raptorPounceHelper = null; private RaptorTargetingHelper raptorTargetingHelper = null; public readonly float pouncePredictionTime = 1.5f; private bool respondingToHelpCall = false; private float lastHeardCallDistanceWhenHeard; private Vector3 noisePositionGuess; private float noiseApproximation = 14f; private bool wasOnOffMeshLink; public DeadBodyInfo? CarryingKilledPlayerBody { get; private set; } = null; public int raptorId { get; private set; } public RoundManager roundManager { get; private set; } = null; public Vector3 pounceDirection { get; private set; } public Vector3 TargetPlayerlastPosition { get; private set; } public Vector3 TargetPlayerVelocity { get; private set; } public string itemNameToDrop { get; private set; } = "Fancy lamp"; public int numberOfItemsToDrop { get; private set; } = 1; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); assignImportantValues(); LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Spawned"); timeSinceHittingLocalPlayer = 0f; timeSinceHittingOtherEnemy = 0f; base.currentBehaviourStateIndex = 0; ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } private void assignImportantValues() { AllRaptors.Add(this); raptorId = AllRaptors.Count - 1; roundManager = Object.FindObjectOfType<RoundManager>() ?? throw new Exception("JPOGRaptor: RoundManager not found!"); raptorPounceHelper = new RaptorPounceHelper(this); raptorTargetingHelper = new RaptorTargetingHelper(this); } public override void Update() { //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_0107: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0152: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead) { if (!isDeadAnimationDone) { LogIfDebugBuild("Stopping enemy voice with janky code."); isDeadAnimationDone = true; base.creatureVoice.Stop(); base.creatureVoice.PlayOneShot(base.dieSFX); DoAnimationClientRpc("stopBreath"); } return; } int currentBehaviourStateIndex = base.currentBehaviourStateIndex; CheckIfClimbing(); if (((NetworkBehaviour)this).IsOwner && !raptorPounceHelper.IsPouncing && !isClimbing) { NetworkVariable<float> currentSpeed = CurrentSpeed; Vector3 velocity = base.agent.velocity; currentSpeed.Value = ((Vector3)(ref velocity)).magnitude; } base.creatureAnimator.SetFloat("moveSpeed", CurrentSpeed.Value); if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex != 0) { turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime); } raptorPounceHelper.MoveRaptorDuringPounce(base.targetPlayer); if (base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; } timeSinceHittingLocalPlayer += Time.deltaTime; timeSinceHittingOtherEnemy += Time.deltaTime; raptorPounceHelper.UpdateTimeSincePounceAttack(); if (base.agent.speed < 0.1f && (Object)(object)base.targetPlayer != (Object)null && base.currentBehaviourStateIndex != 4) { LogIfDebugBuild($"[WARN] Raptor[{raptorId}] has target but speed is zero! Current state: {(State)base.currentBehaviourStateIndex}"); } } private void DropLoot() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00fb: 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) LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Dropping loot."); Item val = null; foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (items.itemName == itemNameToDrop) { val = items; break; } } if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)$"JPOGRaptor[{raptorId}]: Item to drop '{itemNameToDrop}' not found in allItemsList!"); return; } GrabbableObject val4 = default(GrabbableObject); for (int i = 0; i < numberOfItemsToDrop; i++) { Vector3 val2 = ((Component)this).transform.position + Random.insideUnitSphere * 1f; val2.y = ((Component)this).transform.position.y + 0.5f; GameObject val3 = Object.Instantiate<GameObject>(val.spawnPrefab, val2, Quaternion.identity); if (val3.TryGetComponent<GrabbableObject>(ref val4)) { val4.fallTime = 0.5f; ((NetworkBehaviour)val4).NetworkObject.Spawn(true); int scrapValue = Random.Range(20, 100); val4.scrapValue = scrapValue; Plugin.Logger.LogInfo((object)$"JPOGRaptor[{raptorId}]: Dropped '{((Object)val).name}' with NetworkObjectId: {((NetworkBehaviour)val4).NetworkObjectId}"); Plugin.Logger.LogInfo((object)$"JPOGRaptor[{raptorId}]: Set scrapValue to: {val4.scrapValue}"); continue; } Plugin.Logger.LogWarning((object)$"JPOGRaptor[{raptorId}]: Spawned item '{((Object)val).name}' does not have a GrabbableObject component!"); return; } LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Successfully dropped {numberOfItemsToDrop} of '{val.itemName}'."); } public override void DoAIInterval() { //IL_00a3: 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_026a: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } raptorTargetingHelper.HandleTargetUnreachability(); switch (base.currentBehaviourStateIndex) { case 0: if (base.previousBehaviourStateIndex != 0) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Entered Searching for player"); StateSwitchHelper(State.SearchingForPlayer); respondingToHelpCall = false; base.targetPlayer = null; ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } if (raptorTargetingHelper.FoundClosestPlayerInRange(25f, 5f)) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Start Target Player"); ((EnemyAI)this).StopSearch(base.currentSearch, true); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } break; case 1: if (base.previousBehaviourStateIndex != 1) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Entered Stalking Player"); CallForHelp(); StateSwitchHelper(State.StalkingPlayer); if ((Object)(object)base.targetPlayer != (Object)null) { ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); } if (!inCallAnimation) { inCallAnimation = true; ((MonoBehaviour)this).StartCoroutine(PlayBark(shortBark: true)); } } else if (!inCallAnimation) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Stalking Player > finished Call > switching to chasing player"); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } break; case 2: if (base.previousBehaviourStateIndex != 2) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Entered Chasing Player"); ((EnemyAI)this).StopSearch(base.currentSearch, true); StateSwitchHelper(State.ChasingPlayer); } if (!raptorTargetingHelper.EnsureTarget()) { LogIfDebugBuild($"Raptor[{raptorId}]: No target found, switching to SearchingForPlayer"); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); break; } ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); raptorTargetingHelper.UpdatePathTimeout(base.targetPlayer); if (!raptorTargetingHelper.CheckIfTargetPlayerIsReachable(base.targetPlayer)) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Cannot reach the target and timed out"); base.targetPlayer = null; ((EnemyAI)this).SwitchToBehaviourClientRpc(0); break; } CheckIfPlayersAreInPounceAreaServerRPC(); if (raptorPounceHelper.InRangeForPounceAttack) { ((EnemyAI)this).SwitchToBehaviourServerRpc(4); } else if (raptorTargetingHelper.IsTargetTooFar()) { LogIfDebugBuild($"Raptor[{raptorId}]: Target too far, switching to SearchingForPlayer"); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } break; case 3: if (base.previousBehaviourStateIndex != 3) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Entered Responding To Call"); StateSwitchHelper(State.RespondingToCall); } if ((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true)) { ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 15f) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Help response. Got close enough to the target player, switching to regular chase mode"); respondingToHelpCall = false; ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } } else { respondingToHelpCall = false; ((EnemyAI)this).SwitchToBehaviourServerRpc(0); } break; case 4: if (base.previousBehaviourStateIndex != 4) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Entered attacking Player"); StateSwitchHelper(State.AttackingPlayer); if (!raptorPounceHelper.IsPouncing) { raptorPounceHelper.StartPounce(); } } else if (raptorPounceHelper.PounceAttackComplete) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Pounce Completed. Checking if switching to chase or search"); if ((Object)(object)base.targetPlayer != (Object)null) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Pounce Completed. Target player != null, continue chasing player"); base.agent.speed = 8f; ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } else { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Pounce Completed. default, return to searching for player"); base.agent.speed = 5f; ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } } break; default: LogIfDebugBuild("This Behavior State doesn't exist!"); break; } } [IteratorStateMachine(typeof(<PlayBark>d__63))] private IEnumerator PlayBark(bool shortBark) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PlayBark>d__63(0) { <>4__this = this, shortBark = shortBark }; } private void StateSwitchHelper(State state) { if (previousState != state || !previousState.HasValue) { base.previousBehaviourStateIndex = (int)state; } SeMovementSpeedPerSate(state); } private void SeMovementSpeedPerSate(State state) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Adjusting speed for state [{state}]"); switch (state) { case State.SearchingForPlayer: base.agent.speed = 5f; break; case State.StalkingPlayer: base.agent.speed = 3f; break; case State.ChasingPlayer: base.agent.speed = 8f; break; case State.RespondingToCall: base.agent.speed = 10f; break; case State.AttackingPlayer: base.agent.speed = 0f; break; } } public override void OnCollideWithPlayer(Collider other) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (timeSinceHittingLocalPlayer < 1.5f || inCallAnimation || raptorPounceHelper.IsPouncing) { LogIfDebugBuild("JPOGRaptor Collision but last time since hitting is too short or in a calling animation. CANT DO DMG"); return; } PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { DoAnimationClientRpc("biteAttack"); LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Collision with Player!"); timeSinceHittingLocalPlayer = 0f; val.DamagePlayer(30, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); SpawnPlayerBloodOnClientRpc(((NetworkBehaviour)val).NetworkObjectId, Vector3.zero); } } public override void OnCollideWithEnemy(Collider other, EnemyAI? collidedEnemy = null) { if (!(timeSinceHittingOtherEnemy < 5f) && !((Object)(object)collidedEnemy == (Object)null) && !(collidedEnemy is JPOGRaptorAI) && !base.isEnemyDead && !collidedEnemy.isEnemyDead && collidedEnemy.enemyType.canDie) { LogIfDebugBuild("$JPOGRaptor[{raptorId}]: Collision with other valid enemy!"); ((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy); DoAnimationClientRpc("biteAttack"); collidedEnemy.HitEnemy(3, (PlayerControllerB)null, true, -1); timeSinceHittingOtherEnemy = 0f; } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (base.isEnemyDead) { return; } ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead) { raptorPounceHelper.CancelPounce(); if (base.searchCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(base.searchCoroutine); base.searchCoroutine = null; } ((EnemyAI)this).KillEnemyOnOwnerClient(false); } else if ((Object)(object)playerWhoHit != (Object)null) { raptorTargetingHelper.TargetPlayerWhoHit(playerWhoHit); } } public void CallForHelp() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Raptor calling for help!"); JPOGRaptorAI[] array = Object.FindObjectsOfType<JPOGRaptorAI>(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)(object)this && (Object)(object)base.targetPlayer != (Object)null) { array[i].ReactToHelpCall(base.targetPlayer, ((Component)this).transform.position, urgent: true); } } } public void ReactToHelpCall(PlayerControllerB playerToTarget, Vector3 needsHelpRaptorPosition, bool urgent) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00fe: 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_0104: 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) LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Raptor Reacting to help call!"); if (!respondingToHelpCall && base.currentBehaviourStateIndex == 0) { respondingToHelpCall = true; inCallAnimation = true; if (urgent && (Object)(object)base.targetPlayer != (Object)null) { ((MonoBehaviour)this).StartCoroutine(PlayBark(shortBark: false)); LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Help request was urgent, setting target player"); base.targetPlayer = playerToTarget; ((MonoBehaviour)this).StartCoroutine(ReachtToHelp()); } else { ((MonoBehaviour)this).StartCoroutine(PlayBark(shortBark: true)); LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Help request NOT urgent, moving towards call location"); lastHeardCallDistanceWhenHeard = Vector3.Distance(((Component)this).transform.position, needsHelpRaptorPosition); noisePositionGuess = roundManager.GetRandomNavMeshPositionInRadius(needsHelpRaptorPosition, lastHeardCallDistanceWhenHeard / noiseApproximation, default(NavMeshHit)); ((EnemyAI)this).SetDestinationToPosition(noisePositionGuess, false); } } } [IteratorStateMachine(typeof(<ReachtToHelp>d__71))] private IEnumerator ReachtToHelp() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ReachtToHelp>d__71(0) { <>4__this = this }; } public void CheckIfClimbing() { if (base.agent.isOnOffMeshLink && !wasOnOffMeshLink) { wasOnOffMeshLink = true; isClimbing = true; SetAnimationBoolClientRPC("isClimbing", isClimbing); LogIfDebugBuild($"Raptor[{raptorId}]: Started climbing."); } else if (!base.agent.isOnOffMeshLink && wasOnOffMeshLink) { wasOnOffMeshLink = false; isClimbing = false; SetAnimationBoolClientRPC("isClimbing", isClimbing); LogIfDebugBuild($"Raptor[{raptorId}]: Finished climbing."); } } [ClientRpc] public void DoAnimationClientRpc(string animationName) { //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(3138070205u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3138070205u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; LogIfDebugBuild("Animation: " + animationName); base.creatureAnimator.SetTrigger(animationName); } } [ClientRpc] public void SetAnimationWalkingSpeedClientRPC() { //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) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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(3608829678u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3608829678u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Vector3 velocity = base.agent.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; base.creatureAnimator.SetFloat("moveSpeed", magnitude, 0.1f, Time.deltaTime); } } } [ClientRpc] public void SetAnimationBoolClientRPC(string trigger, bool value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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) //IL_00d5: 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(1219365971u, val, (RpcDelivery)0); bool flag = trigger != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(trigger, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1219365971u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.creatureAnimator.SetBool(trigger, value); } } [ServerRpc] public void CheckIfPlayersAreInPounceAreaServerRPC() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_0107: 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_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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(489900578u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 489900578u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; LogIfDebugBuild($"JPOGRaptor[{raptorId}]: checking if raptor can pounce"); CheckIfPlayersAreInPounceAreaClientRPC(); } } [ClientRpc] public void CheckIfPlayersAreInPounceAreaClientRPC() { //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(3018007498u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3018007498u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; raptorPounceHelper.CheckIfPlayersAreInRangeForPounceAttack(); } } } public void PlayBarkClip(AudioClip audioClip) { RaptorcallVoice.PlayOneShot(audioClip); WalkieTalkie.TransmitOneShotAudio(RaptorcallVoice, audioClip, 1f); } public void PlayStepClip() { AudioClip val = ((!isNextStepClip1) ? FootstepClip2 : FootstepClip1); RaptorStepsSFX.PlayOneShot(val); isNextStepClip1 = !isNextStepClip1; } public void PlayVoiceClip(AudioClip audioClip) { base.creatureVoice.PlayOneShot(audioClip); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, audioClip, 1f); } [ServerRpc(RequireOwnership = false)] public void TakeBodyInMouthServerRpc(int killPlayerId) { //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(3217027902u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, killPlayerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3217027902u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TakeBodyInMouthClientRpc(killPlayerId); } } } [ClientRpc] public void TakeBodyInMouthClientRpc(int killPlayerId) { //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(2831086148u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, killPlayerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2831086148u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TakeBodyInMouth(killPlayerId); } } } private void TakeBodyInMouth(int playerId) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Taking boddy of player [{playerId}] in mouth"); DeadBodyInfo deadBody = StartOfRound.Instance.allPlayerScripts[playerId].deadBody; LogIfDebugBuild($"JPOGRaptor[{raptorId}]: deadbody of player cause of death: [{deadBody.causeOfDeath}]"); if ((Object)(object)deadBody != (Object)null) { CarryingKilledPlayerBody = deadBody; deadBody.canBeGrabbedBackByPlayers = false; deadBody.attachedTo = MouthBone; deadBody.attachedLimb = deadBody.bodyParts[5]; deadBody.matchPositionExactly = true; deadBody.MakeCorpseBloody(); } } [ServerRpc(RequireOwnership = false)] public void DropBodyInMouthServerRpc() { //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(1709379253u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1709379253u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DropBodyInMouthClientRpc(); } } } [ClientRpc] public void DropBodyInMouthClientRpc() { //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(1690123830u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1690123830u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DropBodyInMouth(); } } } private void DropBodyInMouth() { if ((Object)(object)CarryingKilledPlayerBody != (Object)null) { CarryingKilledPlayerBody.speedMultiplier = 3f; CarryingKilledPlayerBody.canBeGrabbedBackByPlayers = true; CarryingKilledPlayerBody.attachedTo = null; CarryingKilledPlayerBody.attachedLimb = null; CarryingKilledPlayerBody.matchPositionExactly = false; CarryingKilledPlayerBody = null; } } [ClientRpc] public void CheckRaptorPounceHitBoxesClientRPC() { //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(3223072178u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3223072178u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; raptorPounceHelper.CheckRaptorPounceHitBoxes(); } } } [ClientRpc] public void SpawnPlayerBloodOnClientRpc(ulong playerNetworkObjectId, Vector3 bloodDirection) { //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_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_0146: 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) 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(2632068254u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerNetworkObjectId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref bloodDirection); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2632068254u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val3 = default(PlayerControllerB); if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(playerNetworkObjectId, out var value)) { Plugin.Logger.LogWarning((object)$"JPOGRaptor[{raptorId}]: Could not find networked player object with ID {playerNetworkObjectId} to spawn blood."); } else if (((Component)value).TryGetComponent<PlayerControllerB>(ref val3)) { val3.DropBlood(bloodDirection, true, false); LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Triggered DropBlood for player {val3.playerUsername} at {((Component)val3).transform.position}."); } else { Plugin.Logger.LogWarning((object)$"JPOGRaptor[{raptorId}]: Found NetworkObject with ID {playerNetworkObjectId} but no PlayerControllerB component for blood."); } } } protected override void __initializeVariables() { if (CurrentSpeed == null) { throw new Exception("JPOGRaptorAI.CurrentSpeed cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)CurrentSpeed).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)CurrentSpeed, "CurrentSpeed"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)CurrentSpeed); ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3138070205u, new RpcReceiveHandler(__rpc_handler_3138070205), "DoAnimationClientRpc"); ((NetworkBehaviour)this).__registerRpc(3608829678u, new RpcReceiveHandler(__rpc_handler_3608829678), "SetAnimationWalkingSpeedClientRPC"); ((NetworkBehaviour)this).__registerRpc(1219365971u, new RpcReceiveHandler(__rpc_handler_1219365971), "SetAnimationBoolClientRPC"); ((NetworkBehaviour)this).__registerRpc(489900578u, new RpcReceiveHandler(__rpc_handler_489900578), "CheckIfPlayersAreInPounceAreaServerRPC"); ((NetworkBehaviour)this).__registerRpc(3018007498u, new RpcReceiveHandler(__rpc_handler_3018007498), "CheckIfPlayersAreInPounceAreaClientRPC"); ((NetworkBehaviour)this).__registerRpc(3217027902u, new RpcReceiveHandler(__rpc_handler_3217027902), "TakeBodyInMouthServerRpc"); ((NetworkBehaviour)this).__registerRpc(2831086148u, new RpcReceiveHandler(__rpc_handler_2831086148), "TakeBodyInMouthClientRpc"); ((NetworkBehaviour)this).__registerRpc(1709379253u, new RpcReceiveHandler(__rpc_handler_1709379253), "DropBodyInMouthServerRpc"); ((NetworkBehaviour)this).__registerRpc(1690123830u, new RpcReceiveHandler(__rpc_handler_1690123830), "DropBodyInMouthClientRpc"); ((NetworkBehaviour)this).__registerRpc(3223072178u, new RpcReceiveHandler(__rpc_handler_3223072178), "CheckRaptorPounceHitBoxesClientRPC"); ((NetworkBehaviour)this).__registerRpc(2632068254u, new RpcReceiveHandler(__rpc_handler_2632068254), "SpawnPlayerBloodOnClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_3138070205(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3608829678(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).SetAnimationWalkingSpeedClientRPC(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1219365971(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string trigger = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref trigger, false); } bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).SetAnimationBoolClientRPC(trigger, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_489900578(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).CheckIfPlayersAreInPounceAreaServerRPC(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3018007498(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).CheckIfPlayersAreInPounceAreaClientRPC(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3217027902(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int killPlayerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref killPlayerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).TakeBodyInMouthServerRpc(killPlayerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2831086148(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int killPlayerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref killPlayerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).TakeBodyInMouthClientRpc(killPlayerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1709379253(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).DropBodyInMouthServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1690123830(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).DropBodyInMouthClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3223072178(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).CheckRaptorPounceHitBoxesClientRPC(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2632068254(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerNetworkObjectId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerNetworkObjectId); Vector3 bloodDirection = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref bloodDirection); target.__rpc_exec_stage = (__RpcExecStage)1; ((JPOGRaptorAI)(object)target).SpawnPlayerBloodOnClientRpc(playerNetworkObjectId, bloodDirection); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "JPOGRaptorAI"; } } [BepInPlugin("JPOGRaptor", "JPOGRaptor", "1.0.6")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin JPOGRaptor is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "JPOGRaptor"; public const string PLUGIN_NAME = "JPOGRaptor"; public const string PLUGIN_VERSION = "1.0.6"; } } namespace JPOGRaptor.src { public class RaptorPounceHelper { [CompilerGenerated] private sealed class <pounceRoutine>d__44 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RaptorPounceHelper <>4__this; private Vector3 <predictedPosition>5__1; private float <timer>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <pounceRoutine>d__44(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_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_010b: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <>4__this.IsPouncing = true; <>4__this.PounceAttackDamage = true; <>4__this.PounceAttackComplete = false; <>4__this.TimeSincePounceAttack = Time.deltaTime; <predictedPosition>5__1 = (((Object)(object)((EnemyAI)<>4__this.jpogRaptorAI).targetPlayer != (Object)null) ? (((Component)((EnemyAI)<>4__this.jpogRaptorAI).targetPlayer).transform.position + <>4__this.pounceTargetPlayerVelocity * <>4__this.pouncePredictionTime) : (((Component)<>4__this.jpogRaptorAI).transform.forward * 5f)); RaptorPounceHelper raptorPounceHelper = <>4__this; Vector3 val = <predictedPosition>5__1 - ((Component)<>4__this.jpogRaptorAI).transform.position; raptorPounceHelper.pounceDirection = ((Vector3)(ref val)).normalized; <>4__this.jpogRaptorAI.DoAnimationClientRpc("pounceAttack"); <>4__this.LogIfDebugBuild($"Raptor[{<>4__this.raptorId}]: Pounce started toward {<predictedPosition>5__1}"); <>2__current = (object)new WaitForSeconds(<>4__this.pounceDamagePeriod); <>1__state = 1; return true; } case 1: <>1__state = -1; <>4__this.PounceAttackDamage = false; <timer>5__2 = 0f; break; case 2: <>1__state = -1; break; } if (<timer>5__2 < <>4__this.totalPounceTime - <>4__this.pounceDamagePeriod && ((EnemyAI)<>4__this.jpogRaptorAI).currentBehaviourStateIndex == 4) { <timer>5__2 += Time.deltaTime; <>2__current = null; <>1__state = 2; return true; } if (((EnemyAI)<>4__this.jpogRaptorAI).currentBehaviourStateIndex != 4) { <>4__this.LogIfDebugBuild($"Raptor[{<>4__this.raptorId}]: Pounce aborted because state changed"); <>4__this.ResetPounceFlags(); return false; } <>4__this.jpogRaptorAI.DropBodyInMouthServerRpc(); <>4__this.ResetPounceFlags(); 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(); } } private Coroutine? pounceCoroutine; private readonly JPOGRaptorAI jpogRaptorAI; private readonly float totalPounceTime = 4.5f; private readonly float pounceDamagePeriod = 2.5f; private readonly int raptorId; private Vector3 pounceDirection; private Vector3 pounceTargetPlayerVelocity; private Vector3 pounceTargetPlayerlastPosition; private readonly float pouncePredictionTime = 1.5f; public bool IsPouncing { get; private set; } = false; public bool PounceAttackDamage { get; private set; } = false; public float TimeSincePounceAttack { get; private set; } = 10f; public bool PounceAttackComplete { get; private set; } = false; public float PounceTimer { get; private set; } = 0f; public float PounceDuration { get; private set; } = 1f; public float PounceSpeed { get; private set; } = 15f; public bool InRangeForPounceAttack { get; private set; } = false; public RaptorPounceHelper(JPOGRaptorAI jPOGRaptorAI) { jpogRaptorAI = jPOGRaptorAI; raptorId = jPOGRaptorAI.raptorId; } [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public void StartPounce() { if (!IsPouncing) { pounceCoroutine = ((MonoBehaviour)jpogRaptorAI).StartCoroutine(pounceRoutine()); } } [IteratorStateMachine(typeof(<pounceRoutine>d__44))] private IEnumerator pounceRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <pounceRoutine>d__44(0) { <>4__this = this }; } private void ResetPounceFlags() { LogIfDebugBuild($"Raptor[{raptorId}]: resetting pounce flags"); IsPouncing = false; PounceAttackDamage = false; PounceAttackComplete = true; PounceTimer = 0f; TimeSincePounceAttack = 0f; InRangeForPounceAttack = false; LogIfDebugBuild($"Raptor[{raptorId}]: Pounce flags reset"); } public void CancelPounce() { if (pounceCoroutine != null) { ((MonoBehaviour)jpogRaptorAI).StopCoroutine(pounceCoroutine); pounceCoroutine = null; } IsPouncing = false; } private void PounceTargetting(PlayerControllerB? targetPlayer) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) if (!((Object)(object)targetPlayer == (Object)null)) { pounceTargetPlayerVelocity = (((Component)targetPlayer).transform.position - pounceTargetPlayerlastPosition) / Time.deltaTime; pounceTargetPlayerlastPosition = ((Component)targetPlayer).transform.position; } } private void UpdatePounceTimer() { PounceTimer += Time.deltaTime; } public void UpdateTimeSincePounceAttack() { if (!IsPouncing) { TimeSincePounceAttack += Time.deltaTime; } } public void MoveRaptorDuringPounce(PlayerControllerB? targetPlayer) { //IL_0035: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)targetPlayer == (Object)null) && IsPouncing) { jpogRaptorAI.turnCompass.LookAt(((Component)targetPlayer.gameplayCamera).transform.position); PounceTargetting(targetPlayer); if (PounceAttackDamage) { jpogRaptorAI.CheckRaptorPounceHitBoxesClientRPC(); } UpdatePounceTimer(); if (PounceTimer < PounceDuration) { Transform transform = ((Component)jpogRaptorAI).transform; transform.position += pounceDirection * PounceSpeed * Time.deltaTime; } } } public void CheckIfPlayersAreInRangeForPounceAttack() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((EnemyAI)jpogRaptorAI).targetPlayer != (Object)null) { float num = Vector3.Distance(((Component)jpogRaptorAI).transform.position, ((Component)((EnemyAI)jpogRaptorAI).targetPlayer).transform.position); if (num < 10f && HasClearLineToPlayer()) { if (TimeSincePounceAttack >= 10f) { InRangeForPounceAttack = true; LogIfDebugBuild($"Raptor[{raptorId}]: Player in range and line clear for pounce!"); } else { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: target player was in pounce range, but pounce is on cooldown"); } } } else { InRangeForPounceAttack = false; } } private bool HasClearLineToPlayer() { //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) //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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) PlayerControllerB targetPlayer = ((EnemyAI)jpogRaptorAI).targetPlayer; if ((Object)(object)targetPlayer == (Object)null) { return false; } Vector3 val = ((Component)jpogRaptorAI).transform.position + Vector3.up * 1f; Vector3 val2 = ((Component)targetPlayer).transform.position + Vector3.up * 1f; RaycastHit val3 = default(RaycastHit); bool flag = Physics.Linecast(val, val2, ref val3); if (flag) { if (((Component)((RaycastHit)(ref val3)).collider).transform.IsChildOf(((Component)jpogRaptorAI).transform)) { flag = false; } else { LogIfDebugBuild($"Raptor[{raptorId}]: Line to player blocked by [{((Object)((RaycastHit)(ref val3)).collider).name}]"); } } return !flag; } public void CheckRaptorPounceHitBoxes() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) int num = 8; Collider[] array = Physics.OverlapBox(jpogRaptorAI.attackArea.position, jpogRaptorAI.attackArea.localScale, Quaternion.identity, num); if (array.Length == 0) { return; } Collider[] array2 = array; foreach (Collider val in array2) { PlayerControllerB val2 = ((EnemyAI)jpogRaptorAI).MeetsStandardPlayerCollisionConditions(val, false, false); if ((Object)(object)val2 != (Object)null) { int num2 = ((!(Random.value < 0.9f)) ? 9 : 0); if ((Object)(object)jpogRaptorAI.CarryingKilledPlayerBody == (Object)null) { int num3 = (int)val2.playerClientId; LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Hit player [{num3}]"); val2.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, num2, default(Vector3), false); jpogRaptorAI.TakeBodyInMouthServerRpc(num3); } else { val2.DamagePlayer(40, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } } } } public class RaptorTargetingHelper { private readonly JPOGRaptorAI jPOGRaptorAI; private readonly int raptorId; private float lastTimeoutUpdate; public float MaxChaseDistance { get; private set; } = 30f; public float TimeWithoutPath { get; private set; } = 0f; public float MaxUnreachableTime { get; private set; } = 7f; public RaptorTargetingHelper(JPOGRaptorAI jPOGRaptorAI) { this.jPOGRaptorAI = jPOGRaptorAI; raptorId = jPOGRaptorAI.raptorId; } [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public bool FoundClosestPlayerInRange(float range, float senseRange) { //IL_0049: 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) TargetClosestPlayer(requireLOS: true); if ((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer == (Object)null) { TargetClosestPlayer(requireLOS: false); range = senseRange; } return (Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer != (Object)null && Vector3.Distance(((Component)jPOGRaptorAI).transform.position, ((Component)((EnemyAI)jPOGRaptorAI).targetPlayer).transform.position) < range; } public bool TargetClosestPlayer(bool requireLOS) { //IL_0040: 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_0078: Unknown result type (might be due to invalid IL or missing references) float num = float.MaxValue; PlayerControllerB val = null; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (!((Object)(object)val2 == (Object)null)) { float num2 = Vector3.Distance(((Component)jPOGRaptorAI).transform.position, ((Component)val2).transform.position); if (!(num2 >= num) && (!requireLOS || ((EnemyAI)jPOGRaptorAI).CheckLineOfSightForPosition(((Component)val2).transform.position, 45f, 60, -1f, (Transform)null)) && (CheckIfTargetCanBeReachedInsideShip(val2) || CheckTargetPathReachability(val2))) { val = val2; num = num2; } } } ((EnemyAI)jPOGRaptorAI).targetPlayer = val; if ((Object)(object)val != (Object)null) { ((EnemyAI)jPOGRaptorAI).targetPlayer = val; } return (Object)(object)val != (Object)null; } public bool CheckIfTargetPlayerIsReachable(PlayerControllerB playerToCheck) { bool flag = CheckTargetPathReachability(playerToCheck); bool flag2 = HasTimedOutUnreachable(); if (!flag && flag2) { LogIfDebugBuild($"Raptor[{raptorId}]: target reachability > reachable = [{flag}] time out = [{flag2}]"); TimeWithoutPath = 0f; return false; } return true; } public bool CheckTargetPathReachability(PlayerControllerB playerToCheck) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 NavMeshPath val = new NavMeshPath(); bool flag = NavMesh.CalculatePath(((Component)((EnemyAI)jPOGRaptorAI).agent).transform.position, ((Component)playerToCheck).transform.position, -1, val) && (int)val.status == 0; bool flag2 = CheckIfTargetCanBeReachedInsideShip(playerToCheck); return flag && flag2; } public void UpdatePathTimeout(PlayerControllerB player) { if (CheckTargetPathReachability(player)) { TimeWithoutPath = 0f; lastTimeoutUpdate = Time.time; } else if (Time.time - lastTimeoutUpdate >= 1f) { TimeWithoutPath += 1f; lastTimeoutUpdate = Time.time; LogIfDebugBuild($"JPOGRaptor[{raptorId}]: uppdated time out value = [{TimeWithoutPath}]"); } } private bool CheckIfTargetCanBeReachedInsideShip(PlayerControllerB playerToCheck) { if ((Object)(object)playerToCheck == (Object)null) { return false; } if (!playerToCheck.isInHangarShipRoom) { return true; } if (!StartOfRound.Instance.hangarDoorsClosed) { return true; } if (((EnemyAI)jPOGRaptorAI).isInsidePlayerShip) { return true; } return false; } public bool HasTimedOutUnreachable() { return TimeWithoutPath >= MaxUnreachableTime; } public bool PlayerHasHorizontalLOS(PlayerControllerB player) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)jPOGRaptorAI).transform.position - ((Component)player).transform.position; val.y = 0f; return Vector3.Angle(((Component)player).transform.forward, val) < 68f; } public bool IsTargetTooFar() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) return (Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer != (Object)null && Vector3.Distance(((Component)jPOGRaptorAI).transform.position, ((Component)((EnemyAI)jPOGRaptorAI).targetPlayer).transform.position) > MaxChaseDistance; } public bool EnsureTarget() { if ((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer == (Object)null) { TargetClosestPlayer(requireLOS: false); } return (Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer != (Object)null; } public void TargetPlayerWhoHit(PlayerControllerB playerWhoHit) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)jPOGRaptorAI).isEnemyDead && (Object)(object)playerWhoHit != (Object)null) { ((EnemyAI)jPOGRaptorAI).targetPlayer = playerWhoHit; if (((EnemyAI)jPOGRaptorAI).currentBehaviourStateIndex == 0) { ((EnemyAI)jPOGRaptorAI).SwitchToBehaviourServerRpc(2); } else if (((EnemyAI)jPOGRaptorAI).currentBehaviourStateIndex == 2) { ((EnemyAI)jPOGRaptorAI).SetDestinationToPosition(((Component)((EnemyAI)jPOGRaptorAI).targetPlayer).transform.position, false); } } } public void HandleTargetUnreachability() { //IL_0167: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer == (Object)null) && ((EnemyAI)jPOGRaptorAI).currentBehaviourStateIndex == 2 && (IsTargetTooFar() || !((EnemyAI)jPOGRaptorAI).targetPlayer.isPlayerControlled || !CheckIfTargetCanBeReachedInsideShip(((EnemyAI)jPOGRaptorAI).targetPlayer))) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Current target {((EnemyAI)jPOGRaptorAI).targetPlayer.playerUsername} is unreachable. Attempting to retarget."); PlayerControllerB targetPlayer = ((EnemyAI)jPOGRaptorAI).targetPlayer; ((EnemyAI)jPOGRaptorAI).targetPlayer = null; TargetClosestPlayer(requireLOS: true); if ((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer == (Object)null) { TargetClosestPlayer(requireLOS: false); } if ((Object)(object)((EnemyAI)jPOGRaptorAI).targetPlayer == (Object)null) { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: No new target found. Switching to SearchingForPlayer state."); ((EnemyAI)jPOGRaptorAI).SwitchToBehaviourServerRpc(0); } else { LogIfDebugBuild($"JPOGRaptor[{raptorId}]: Retargeted from {targetPlayer.playerUsername} to {((EnemyAI)jPOGRaptorAI).targetPlayer.playerUsername}."); ((EnemyAI)jPOGRaptorAI).SetDestinationToPosition(((Component)((EnemyAI)jPOGRaptorAI).targetPlayer).transform.position, false); } } } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); } } } namespace JPOGRaptor.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }