Please disclose if your mod was created primarily 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 Surfaced v1.7.0
plugins/LC-Surfaced/Surfaced.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Diagnostics; 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.Configuration; using BepInEx.Logging; using Dawn; using Dawn.Utils; using Dusk; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using On; using On.GameNetcodeStuff; using SolidLib.Components; using SolidLib.Components.Sound; using Surfaced; using Surfaced.Configuration; using Surfaced.NetcodePatcher; using Surfaced.Patches; using Unity.Mathematics; using Unity.Netcode; using Unity.Netcode.Components; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Surfaced")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Adds Aquatic themed content.")] [assembly: AssemblyFileVersion("1.7.0.0")] [assembly: AssemblyInformationalVersion("1.7.0+c4c3628dd9e3b6af300f1e4983af52802a00dbfb")] [assembly: AssemblyProduct("Surfaced")] [assembly: AssemblyTitle("Surfaced")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.7.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; } } } public class Bertha : NetworkBehaviour, IHittable { [CompilerGenerated] private sealed class <DetonateDelay>d__18 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Bertha <>4__this; public PlayerControllerB playerWhoCollided; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DetonateDelay>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown int num = <>1__state; Bertha bertha = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(Plugin.BoundConfig.BerthaTimer.Value); <>1__state = 1; return true; case 1: <>1__state = -1; bertha.Detonate(playerWhoCollided); bertha.BoomLight.SetActive(true); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; case 2: <>1__state = -1; ((Component)((Component)((Component)bertha).transform.parent).transform.Find("BigBertha")).gameObject.SetActive(false); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 3; return true; case 3: { <>1__state = -1; bertha.BoomLight.SetActive(false); Collider[] componentsInChildren = ((Component)bertha).GetComponentsInChildren<Collider>(); foreach (Collider val in componentsInChildren) { val.enabled = false; } <>2__current = (object)new WaitForSeconds(10f); <>1__state = 4; return true; } case 4: <>1__state = -1; if (((NetworkBehaviour)bertha).IsServer) { ((NetworkBehaviour)bertha).NetworkObject.Despawn(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 <StartIdleAnimation>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Bertha <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartIdleAnimation>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown int num = <>1__state; Bertha bertha = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; bertha.PingAudio.PlayOneShot(bertha.mineBeep, 0.1f); bertha.mineAudio.pitch = (float)bertha.random.NextDouble() * 0.2f + 0.9f; } else { <>1__state = -1; } <>2__current = (object)new WaitForSeconds((float)bertha.random.Next(20, 40)); <>1__state = 1; return true; } 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 bool hasExploded; public GameObject BoomLight; public ParticleSystem explosionParticle; public AudioSource mineAudio; public AudioSource FarAudio; public AudioSource PingAudio; public AudioClip mineDetonate; public AudioClip mineTrigger; public AudioClip mineBeep; public AudioClip BerthaBoom; private Random random; private void Start() { random = new Random(StartOfRound.Instance.randomMapSeed + 23); ((MonoBehaviour)this).StartCoroutine(StartIdleAnimation()); } [IteratorStateMachine(typeof(<StartIdleAnimation>d__12))] private IEnumerator StartIdleAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartIdleAnimation>d__12(0) { <>4__this = this }; } private void OnTriggerEnter(Collider other) { if (hasExploded) { return; } if (((Component)other).CompareTag("Player")) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && (Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController) { TriggerMineOnLocalClientByExiting(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, component)); } } else if ((((Component)other).tag.StartsWith("PlayerRagdoll") || ((Component)other).CompareTag("PhysicsProp")) && !((Object)(object)((Component)other).GetComponent<DeadBodyInfo>() == (Object)null) && !((Object)(object)((Component)other).GetComponent<DeadBodyInfo>().playerScript != (Object)(object)GameNetworkManager.Instance.localPlayerController) && !((Object)(object)((Component)other).GetComponent<GrabbableObject>() == (Object)null) && ((NetworkBehaviour)((Component)other).GetComponent<GrabbableObject>()).NetworkObject.IsOwner) { TriggerMineOnLocalClientByExiting(-1); } } private void TriggerMineOnLocalClientByExiting(int playerIndex) { if (!hasExploded) { hasExploded = true; ExplodeMineServerRpc(playerIndex); } } [ServerRpc(RequireOwnership = false)] public void ExplodeMineServerRpc(int playerIndex) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1478796614u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1478796614u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ExplodeMineClientRpc(playerIndex); } } } [ClientRpc] public void ExplodeMineClientRpc(int playerIndex) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(355455692u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 355455692u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; hasExploded = true; SetOffMineAnimation((playerIndex <= -1) ? null : StartOfRound.Instance.allPlayerScripts[playerIndex]); } } } public void SetOffMineAnimation(PlayerControllerB playerWhoCollided = null) { mineAudio.PlayOneShot(mineTrigger, 1f); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); ((MonoBehaviour)this).StartCoroutine(DetonateDelay(playerWhoCollided)); } [IteratorStateMachine(typeof(<DetonateDelay>d__18))] private IEnumerator DetonateDelay(PlayerControllerB playerWhoCollided) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DetonateDelay>d__18(0) { <>4__this = this, playerWhoCollided = playerWhoCollided }; } public void Detonate(PlayerControllerB playerWhoCollided = null) { //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_006b: Unknown result type (might be due to invalid IL or missing references) mineAudio.pitch = (float)random.NextDouble() * 0.14f + 0.93f; mineAudio.PlayOneShot(mineDetonate, 2f); FarAudio.PlayOneShot(BerthaBoom, 1f); HUDManager.Instance.ShakeCamera((ScreenShakeType)3); CreateExplosion(((Component)this).transform.position + Vector3.up, 33, 6, (CauseOfDeath)3, playerWhoCollided); } public void CreateExplosion(Vector3 explosionPosition, int damage = 20, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_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_012d: 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_013d: 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_027f: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) float value = Plugin.BoundConfig.Range1.Value; float value2 = Plugin.BoundConfig.Range2.Value; float value3 = Plugin.BoundConfig.Range3.Value; int num = 0; explosionParticle.Play(); num = ((!Plugin.BoundConfig.KillEnemies.Value) ? StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers : (StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers | LayerMask.GetMask(new string[1] { "Enemies" }))); Collider[] array = Physics.OverlapSphere(explosionPosition, value3, num, (QueryTriggerInteraction)2); List<PlayerControllerB> list = new List<PlayerControllerB>(); Collider[] array2 = array; foreach (Collider val in array2) { float num2 = Vector3.Distance(explosionPosition, ((Component)val).transform.position); Vector3 val2; if (((Component)val).gameObject.layer == 3) { PlayerControllerB component = ((Component)val).GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController) { list.Add(component); val2 = ((Component)component).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; if (num2 <= value) { normalized *= 500f; component.DamagePlayer(999, true, true, causeOfDeath, 6, false, normalized); HUDManager.Instance.ShakeCamera((ScreenShakeType)3); continue; } if (num2 <= value2 && MineHasLineOfSight(((Component)component.gameplayCamera).transform.position)) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); normalized *= 400f; component.DamagePlayer(999, true, true, causeOfDeath, 6, false, normalized); continue; } if (num2 <= value3 && MineHasLineOfSight(((Component)component.gameplayCamera).transform.position)) { normalized *= (float)Plugin.BoundConfig.Knockbackmultiplier.Value; HUDManager.Instance.ShakeCamera((ScreenShakeType)1); float num3 = 1f - Mathf.Clamp01(num2 / value3); component.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 6, false, normalized); if (!component.isPlayerDead) { component.externalForces += normalized; } continue; } } } if (((Component)val).gameObject.layer == 19) { EnemyAICollisionDetect componentInChildren = ((Component)val).GetComponentInChildren<EnemyAICollisionDetect>(); if ((Object)(object)componentInChildren != (Object)null && ((NetworkBehaviour)componentInChildren.mainScript).IsOwner && num2 <= value2 && MineHasLineOfSight(((Component)val).transform.position)) { EnemyAI mainScript = componentInChildren.mainScript; val2 = default(Vector3); mainScript.HitEnemyOnLocalClient(enemyHitForce, val2, attacker, false, -1); } } else if (((Component)val).gameObject.layer == 21) { Landmine componentInChildren2 = ((Component)val).GetComponentInChildren<Landmine>(); if ((Object)(object)componentInChildren2 != (Object)null && !componentInChildren2.hasExploded && num2 <= value3 && MineHasLineOfSight(((Component)val).transform.position)) { ((MonoBehaviour)componentInChildren2).StartCoroutine(componentInChildren2.TriggerOtherMineDelayed(componentInChildren2)); } } } Seamine[] array3 = Object.FindObjectsByType<Seamine>((FindObjectsSortMode)1); Seamine[] array4 = array3; foreach (Seamine seamine in array4) { float num4 = Vector3.Distance(explosionPosition, ((Component)seamine).transform.position); if (!seamine.hasExploded && num4 <= value2) { seamine.SetOffMineAnimation(); } } Collider[] array5 = Physics.OverlapSphere(explosionPosition, value3, StartOfRound.Instance.collidersAndRoomMaskAndDefault); Collider[] array6 = array5; foreach (Collider val3 in array6) { Rigidbody component2 = ((Component)val3).GetComponent<Rigidbody>(); if (component2 != null) { component2.AddExplosionForce(1000f, explosionPosition, value3); } } } public bool MineHasLineOfSight(Vector3 pos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); return !Physics.Linecast(((Component)this).transform.position, pos, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); } bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if ((Object)(object)playerWhoHit != (Object)(object)GameNetworkManager.Instance.localPlayerController) { return false; } ExplodeMineServerRpc(((Object)(object)playerWhoHit != (Object)null) ? Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerWhoHit) : (-1)); return true; } protected override void __initializeVariables() { ((NetworkBehaviour)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 ((NetworkBehaviour)this).__registerRpc(1478796614u, new RpcReceiveHandler(__rpc_handler_1478796614), "ExplodeMineServerRpc"); ((NetworkBehaviour)this).__registerRpc(355455692u, new RpcReceiveHandler(__rpc_handler_355455692), "ExplodeMineClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1478796614(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 playerIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((Bertha)(object)target).ExplodeMineServerRpc(playerIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_355455692(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 playerIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((Bertha)(object)target).ExplodeMineClientRpc(playerIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Bertha"; } } public class Seamine : NetworkBehaviour, IHittable { [CompilerGenerated] private sealed class <DetonateDelay>d__18 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Seamine <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DetonateDelay>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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 int num = <>1__state; Seamine seamine = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; seamine.Detonate(); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; case 2: <>1__state = -1; if (((NetworkBehaviour)seamine).IsServer) { Object.Destroy((Object)(object)((Component)((Component)seamine).transform.parent).gameObject); } 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 <StartIdleAnimation>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Seamine <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartIdleAnimation>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown int num = <>1__state; Seamine seamine = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; seamine.mineAudio.PlayOneShot(seamine.mineBeep, 0.1f); seamine.mineAudio.pitch = Random.Range(0.9f, 1.1f); } else { <>1__state = -1; } <>2__current = (object)new WaitForSeconds((float)Random.Range(Plugin.BoundConfig.SeamineSoundMin.Value, Plugin.BoundConfig.SeamineSoundMax.Value)); <>1__state = 1; return true; } 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 <TriggerOtherMineDelayed>d__19 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Landmine mine; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TriggerOtherMineDelayed>d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //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 (!mine.hasExploded) { mine.mineAudio.pitch = Random.Range(0.75f, 1.07f); mine.hasExploded = true; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; } break; case 1: <>1__state = -1; mine.SetOffMineAnimation(); break; } 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 bool mineActivated = true; public bool hasExploded; public ParticleSystem explosionParticle; public AudioSource mineAudio; public AudioSource mineFarAudio; public AudioClip mineDetonate; public AudioClip mineTrigger; public AudioClip mineBeep; public AudioClip mineDetonateFar; private bool sendingExplosionRPC; private RaycastHit hit; private void Start() { ((MonoBehaviour)this).StartCoroutine(StartIdleAnimation()); } [IteratorStateMachine(typeof(<StartIdleAnimation>d__12))] private IEnumerator StartIdleAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartIdleAnimation>d__12(0) { <>4__this = this }; } private void OnTriggerEnter(Collider other) { if (hasExploded || !mineActivated) { return; } if (((Component)other).CompareTag("Player")) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && !((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { TriggerMineOnLocalClientByExiting(); } } else { if (!((Component)other).tag.StartsWith("PlayerRagdoll") && !((Component)other).CompareTag("PhysicsProp")) { return; } if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<DeadBodyInfo>())) { if ((Object)(object)((Component)other).GetComponent<DeadBodyInfo>().playerScript != (Object)(object)GameNetworkManager.Instance.localPlayerController) { return; } } else if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<GrabbableObject>()) && !((NetworkBehaviour)((Component)other).GetComponent<GrabbableObject>()).NetworkObject.IsOwner) { return; } TriggerMineOnLocalClientByExiting(); } } private void TriggerMineOnLocalClientByExiting() { if (!hasExploded) { SetOffMineAnimation(); sendingExplosionRPC = true; ExplodeMineServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void ExplodeMineServerRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(711067059u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 711067059u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ExplodeMineClientRpc(); } } } [ClientRpc] public void ExplodeMineClientRpc() { //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) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3889305919u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3889305919u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (sendingExplosionRPC) { sendingExplosionRPC = false; } else { SetOffMineAnimation(); } } } public void SetOffMineAnimation() { hasExploded = true; mineAudio.PlayOneShot(mineTrigger, 1f); ((MonoBehaviour)this).StartCoroutine(DetonateDelay()); } [IteratorStateMachine(typeof(<DetonateDelay>d__18))] private IEnumerator DetonateDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DetonateDelay>d__18(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<TriggerOtherMineDelayed>d__19))] private IEnumerator TriggerOtherMineDelayed(Landmine mine) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TriggerOtherMineDelayed>d__19(0) { mine = mine }; } public void Detonate() { //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) mineAudio.pitch = Random.Range(0.93f, 1.07f); mineAudio.PlayOneShot(mineDetonate, 1f); CreateExplosion(((Component)this).transform.position + Vector3.up, spawnExplosionEffect: true, 100, 5.7f, 6f, 6, (CauseOfDeath)3); } public void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, int damage = 20, float minDamageRange = 0f, float maxDamageRange = 1f, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null) { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_0100: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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_02bc: 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) Transform val = null; if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null) { val = RoundManager.Instance.mapPropsContainer.transform; } if (spawnExplosionEffect) { Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true); } float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition); if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 25f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } Collider[] array = Physics.OverlapSphere(explosionPosition, maxDamageRange, 2621448, (QueryTriggerInteraction)2); PlayerControllerB val2 = null; for (int i = 0; i < array.Length; i++) { float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position); if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) { continue; } Vector3 val3; if (((Component)array[i]).gameObject.layer == 3) { val2 = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner) { float num3 = 1f - Mathf.Clamp01((num2 - minDamageRange) / (maxDamageRange - minDamageRange)); val3 = ((Component)val2).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; ((Component)val2).GetComponent<Rigidbody>().AddForce(normalized * 500f); Vector3 val4 = Vector3.Normalize((((Component)val2).transform.position + Vector3.up * 0.75f - ((Component)this).transform.position) * 100f) * 30f; val2.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 0, false, val4); } } else if (((Component)array[i]).gameObject.layer == 21) { Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>(); if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f) { ((MonoBehaviour)componentInChildren).StartCoroutine(componentInChildren.TriggerOtherMineDelayed(componentInChildren)); } } else if (((Component)array[i]).gameObject.layer == 19) { EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>(); if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f) { EnemyAI mainScript = componentInChildren2.mainScript; val3 = default(Vector3); mainScript.HitEnemyOnLocalClient(enemyHitForce, val3, attacker, false, -1); } } } int num4 = ~LayerMask.GetMask(new string[1] { "Room" }); num4 = ~LayerMask.GetMask(new string[1] { "Colliders" }); array = Physics.OverlapSphere(explosionPosition, 10f, num4); for (int j = 0; j < array.Length; j++) { Rigidbody component = ((Component)array[j]).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.AddExplosionForce(70f, explosionPosition, 10f); } } } public bool MineHasLineOfSight(Vector3 pos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return !Physics.Linecast(((Component)this).transform.position, pos, ref hit, 256); } bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { SetOffMineAnimation(); sendingExplosionRPC = true; ExplodeMineServerRpc(); return true; } protected override void __initializeVariables() { ((NetworkBehaviour)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 ((NetworkBehaviour)this).__registerRpc(711067059u, new RpcReceiveHandler(__rpc_handler_711067059), "ExplodeMineServerRpc"); ((NetworkBehaviour)this).__registerRpc(3889305919u, new RpcReceiveHandler(__rpc_handler_3889305919), "ExplodeMineClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_711067059(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; ((Seamine)(object)target).ExplodeMineServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3889305919(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; ((Seamine)(object)target).ExplodeMineClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Seamine"; } } namespace Scary { internal class ScaryAI : EnemyAI { private enum State { MovingToPlayer, Teleporting } [CompilerGenerated] private sealed class <PerformTeleportIfFacingPlayer>d__23 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ScaryAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PerformTeleportIfFacingPlayer>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_004a: 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_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_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown int num = <>1__state; ScaryAI scaryAI = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)((EnemyAI)scaryAI).targetPlayer != (Object)null) { Vector3 val = Vector3.Normalize(((Component)((EnemyAI)scaryAI).targetPlayer.gameplayCamera).transform.position - ((Component)scaryAI).transform.position); float num2 = Vector3.Distance(((Component)((EnemyAI)scaryAI).targetPlayer).transform.position, ((Component)scaryAI).transform.position); if (num2 < 5f && Vector3.Dot(val, ((Component)((EnemyAI)scaryAI).targetPlayer.gameplayCamera).transform.forward) < -0.9f) { scaryAI.inactivityTimer = 0f; Plugin.Logger.LogInfo((object)"JUMPSCARE"); scaryAI.jumpscaring = true; ((EnemyAI)scaryAI).creatureSFX.volume = 0.4f; ((EnemyAI)scaryAI).creatureSFX.pitch = 1f; ((EnemyAI)scaryAI).creatureSFX.maxDistance = 25f; scaryAI.NetworkAudioSource.PlayOneShot(scaryAI.ScareSoundClip); <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; return true; } } break; case 1: <>1__state = -1; ((EnemyAI)scaryAI).creatureSFX.volume = 0.4f; ((EnemyAI)scaryAI).creatureSFX.pitch = 1f; ((EnemyAI)scaryAI).creatureSFX.maxDistance = 25f; scaryAI.NetworkAudioSource.PlayOneShot(scaryAI.PoofSoundClip); scaryAI.EmitPSClientRpc(); <>2__current = (object)new WaitForSeconds(0.35f); <>1__state = 2; return true; case 2: <>1__state = -1; ((EnemyAI)scaryAI).SwitchToBehaviourClientRpc(1); scaryAI.jumpscaring = false; break; } scaryAI.PerformTeleportCoroutine = null; 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 Transform turnCompass; private float timeSinceHittingLocalPlayer; private float timeSinceLastProximitySound; private Random enemyRandom; private Coroutine? PerformTeleportCoroutine; private NavMeshAgent agent; public AudioClip PoofSoundClip; public AudioClip ScareSoundClip; public NetworkAudioSource NetworkAudioSource; public ParticleSystem Poofps; private bool jumpscaring; private Vector3 lastPosition; private float inactivityTimer; [Header("SoundSets")] [SerializeField] private SoundSet LureSoundSet; private UniqueRandomizer LureRandomizer; [SerializeField] private Transform movementSource; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown ((EnemyAI)this).Start(); Plugin.Logger.LogInfo((object)"IMPENDING DOOM APPROACHES..."); LureRandomizer = new UniqueRandomizer(LureSoundSet); timeSinceHittingLocalPlayer = 0f; timeSinceLastProximitySound = 0f; enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); base.currentBehaviourStateIndex = 0; agent = ((Component)this).GetComponent<NavMeshAgent>(); } public void PlayLureSound() { int nextStableRandomIndex = LureRandomizer.GetNextStableRandomIndex(); base.creatureSFX.volume = 0.6f; base.creatureSFX.pitch = 1f; base.creatureSFX.maxDistance = 25f; NetworkAudioSource.PlayOneShot(LureSoundSet.GetAudioClip(nextStableRandomIndex)); } public override void Update() { //IL_0060: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00d5: 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) ((EnemyAI)this).Update(); timeSinceHittingLocalPlayer += Time.deltaTime; if (!jumpscaring) { timeSinceLastProximitySound += Time.deltaTime; } int currentBehaviourStateIndex = base.currentBehaviourStateIndex; 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); } if (((NetworkBehaviour)this).IsHost && (Object)(object)base.targetPlayer != (Object)null) { float num = Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position); if (num > 5f && !jumpscaring) { CheckInactivity(); } } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead) { switch (base.currentBehaviourStateIndex) { case 0: agent.speed = (jumpscaring ? 0f : 9f); MoveToClosestPlayer(); break; case 1: agent.speed = 0f; TeleportToRandomNode(); break; } } } private void MoveToClosestPlayer() { //IL_009c: 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_0021: Unknown result type (might be due to invalid IL or missing references) if (TargetClosestPlayerInAnyCase() && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 3f) { if (timeSinceLastProximitySound >= (float)enemyRandom.Next(Plugin.BoundConfig.ScarySoundMin.Value, Plugin.BoundConfig.ScarySoundMax.Value)) { PlayLureSound(); timeSinceLastProximitySound = 0f; } if (PerformTeleportCoroutine == null) { PerformTeleportCoroutine = ((MonoBehaviour)this).StartCoroutine(PerformTeleportIfFacingPlayer()); } } else { ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); } } [IteratorStateMachine(typeof(<PerformTeleportIfFacingPlayer>d__23))] private IEnumerator PerformTeleportIfFacingPlayer() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PerformTeleportIfFacingPlayer>d__23(0) { <>4__this = this }; } private void TeleportToRandomNode() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Vector3 randomAINodePosition = GetRandomAINodePosition(); if (randomAINodePosition != Vector3.zero) { agent.Warp(randomAINodePosition); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } else { ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } } private Vector3 GetRandomAINodePosition() { //IL_0028: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) GameObject[] insideAINodes = RoundManager.Instance.insideAINodes; List<Vector3> list = new List<Vector3>(); GameObject[] array = insideAINodes; foreach (GameObject val in array) { list.Add(val.transform.position); } if (list.Count == 0) { return Vector3.zero; } Vector3 val2 = list[Random.Range(0, list.Count)]; return RoundManager.Instance.GetRandomNavMeshPositionInRadius(val2, 3f, default(NavMeshHit)); } private void CheckInactivity() { //IL_0006: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)this).transform.position, lastPosition) < 0.01f) { inactivityTimer += Time.deltaTime; if (inactivityTimer >= 3f) { TeleportToRandomNode(); inactivityTimer = 0f; } } else { inactivityTimer = 0f; lastPosition = ((Component)this).transform.position; } } private bool TargetClosestPlayerInAnyCase() { //IL_001d: 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) base.mostOptimalDistance = 2000f; base.targetPlayer = null; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position); if (base.tempDist < base.mostOptimalDistance) { base.mostOptimalDistance = base.tempDist; base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i]; } } return (Object)(object)base.targetPlayer != (Object)null; } [ClientRpc] public void EmitPSClientRpc() { //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(2066374292u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2066374292u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Poofps.Play(); } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2066374292u, new RpcReceiveHandler(__rpc_handler_2066374292), "EmitPSClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_2066374292(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; ((ScaryAI)(object)target).EmitPSClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ScaryAI"; } } } namespace Surfaced { public class SurfacedHandler : ContentHandler<SurfacedHandler> { public class BellCrabAssets : AssetBundleLoader<BellCrabAssets> { public BellCrabAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class BigBerthaAssets : AssetBundleLoader<BigBerthaAssets> { public BigBerthaAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class BruceAssets : AssetBundleLoader<BruceAssets> { public BruceAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class HorseAssets : AssetBundleLoader<HorseAssets> { public HorseAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class NemoAssets : AssetBundleLoader<NemoAssets> { public NemoAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class RodrigoAssets : AssetBundleLoader<RodrigoAssets> { public RodrigoAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class ScaryAssets : AssetBundleLoader<ScaryAssets> { public ScaryAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class SeamineAssets : AssetBundleLoader<SeamineAssets> { public SeamineAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class ShrimpAssets : AssetBundleLoader<ShrimpAssets> { public ShrimpAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class UrchinAssets : AssetBundleLoader<UrchinAssets> { public UrchinAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public BigBerthaAssets? BigBertha; public BruceAssets? Bruce; public HorseAssets? Horse; public NemoAssets? Nemo; public RodrigoAssets? Rodrigo; public ScaryAssets? Scary; public SeamineAssets? Seamine; public ShrimpAssets? Shrimp; public UrchinAssets? Urchin; public BellCrabAssets? BellCrab; public SurfacedHandler(DuskMod mod) : base(mod) { ((ContentHandler)this).RegisterContent<BellCrabAssets>("bellcrabassets", ref BellCrab, false); ((ContentHandler)this).RegisterContent<BigBerthaAssets>("berthaassets", ref BigBertha, false); ((ContentHandler)this).RegisterContent<BruceAssets>("bruceassets", ref Bruce, false); ((ContentHandler)this).RegisterContent<HorseAssets>("horseassets", ref Horse, false); ((ContentHandler)this).RegisterContent<NemoAssets>("nemoassets", ref Nemo, false); ((ContentHandler)this).RegisterContent<RodrigoAssets>("rodrigoassets", ref Rodrigo, false); ((ContentHandler)this).RegisterContent<ScaryAssets>("scaryassets", ref Scary, false); ((ContentHandler)this).RegisterContent<SeamineAssets>("seamineassets", ref Seamine, false); ((ContentHandler)this).RegisterContent<ShrimpAssets>("shrimpassets", ref Shrimp, false); ((ContentHandler)this).RegisterContent<UrchinAssets>("urchinassets", ref Urchin, false); } } internal class BellCrabAI : EnemyAI { private enum State { Idle, Running, Grabbed, Death } [CompilerGenerated] private sealed class <DoPeakingCoroutine>d__36 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BellCrabAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoPeakingCoroutine>d__36(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown int num = <>1__state; BellCrabAI bellCrabAI = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; if (((EnemyAI)bellCrabAI).currentBehaviourStateIndex == 0) { ((EnemyAI)bellCrabAI).creatureAnimator.SetTrigger("Peak"); } break; } if (!((EnemyAI)bellCrabAI).isEnemyDead) { <>2__current = (object)new WaitForSeconds((float)bellCrabAI.BellCrabRandom.NextDouble() * 10f + 10f); <>1__state = 1; 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 <DrawPath>d__57 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NavMeshAgent agent; public LineRenderer line; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DrawPath>d__57(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0053: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!((Behaviour)agent).enabled) { return false; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: { <>1__state = -1; line.SetPosition(0, ((Component)agent).transform.position); line.positionCount = agent.path.corners.Length; for (int i = 1; i < agent.path.corners.Length; i++) { line.SetPosition(i, agent.path.corners[i]); } 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 <DropCrabDelay>d__34 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int playerID; public BellCrabAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DropCrabDelay>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; BellCrabAI bellCrabAI = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; case 1: { <>1__state = -1; PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerID]; bellCrabAI.DropCrabOnLocalClient(player); 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 <PickupCrabDelay>d__30 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BellCrabAI <>4__this; public int playerID; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PickupCrabDelay>d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; BellCrabAI bellCrabAI = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.12f); <>1__state = 1; return true; case 1: { <>1__state = -1; if (bellCrabAI.recentlyDamaged) { return false; } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID]; if ((Object)(object)bellCrabAI.playerHoldingCrab != (Object)null) { bellCrabAI.playerHoldingCrab.twoHanded = false; bellCrabAI.playerHoldingCrab = null; bellCrabAI.playerHoldingCrab.isHoldingObject = false; } if ((Object)(object)val != (Object)null) { val.inAnimationWithEnemy = (EnemyAI)(object)bellCrabAI; bellCrabAI.isAttached = true; ((Behaviour)((EnemyAI)bellCrabAI).agent).enabled = false; ((EnemyAI)bellCrabAI).agent.speed = 0f; bellCrabAI.Interact_Script.interactable = false; bellCrabAI.SetScanNodeType(EnemyNodeType); HUDManager.Instance.AttemptScanNewCreature(bellCrabAI.creatureID); bellCrabAI.playerHoldingCrab = val; bellCrabAI.playerHoldingCrab.twoHanded = true; bellCrabAI.playerHoldingCrab.isGrabbingObjectAnimation = true; bellCrabAI.playerHoldingCrab.isHoldingObject = true; bellCrabAI.playerHoldingCrab.hoveringOverTrigger = null; bellCrabAI.playerHoldingCrab.DropAllHeldItems(true, false); ((EnemyAI)bellCrabAI).SwitchToBehaviourStateOnLocalClient(2); ((EnemyAI)bellCrabAI).creatureAnimator.SetInteger("State", 2); bellCrabAI.PlayGrabbedSFX(); } 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 <RecentlyDamagedCooldown>d__49 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BellCrabAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RecentlyDamagedCooldown>d__49(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown int num = <>1__state; BellCrabAI bellCrabAI = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; bellCrabAI.recentlyDamaged = true; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; bellCrabAI.recentlyDamaged = false; 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 <StopScuttleSound>d__42 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BellCrabAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StopScuttleSound>d__42(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown int num = <>1__state; BellCrabAI CS$<>8__locals0 = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)(() => ((EnemyAI)CS$<>8__locals0).currentBehaviourStateIndex == 0)); <>1__state = 1; return true; case 1: <>1__state = -1; ((EnemyAI)CS$<>8__locals0).creatureSFX.Stop(); 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 <delayDestroy>d__47 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BellCrabAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <delayDestroy>d__47(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; BellCrabAI bellCrabAI = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.8f); <>1__state = 1; return true; case 1: <>1__state = -1; ((NetworkBehaviour)bellCrabAI).NetworkObject.Despawn(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(); } } public InteractTrigger Interact_Script; [NonSerialized] public bool isAttached; [NonSerialized] public PlayerControllerB? playerHoldingCrab; public float BellCrabRunSpeed = 18f; private Random BellCrabRandom; private Random ScanNodeRandom; public AudioClip DeathSoundClip; public AudioClip BellLandSoundClip; public AudioClip[] SnipSoundClips; public AudioClip ScuttleSoundClip; public AudioClip PopInSoundClip; public AudioClip PopOutSoundClip; public AudioClip GrabbedSoundClip; public AudioClip PickupSoundClip; public ScanNodeProperties ScanNode; public NetworkTransform NetTransform; private Coroutine? recentlyDamagedCoroutine; private bool recentlyDamaged; private bool testBuild; private LineRenderer line; private int creatureID; private static int EnemyNodeType = 1; private static int ScrapNodeType = 2; public override void Start() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); creatureID = ScanNode.creatureScanID; ScanNode.creatureScanID = -1; isAttached = false; ((Behaviour)base.agent).enabled = true; FindNextWanderPoint(); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); base.creatureAnimator.SetInteger("State", 1); ((Component)this).transform.localScale = new Vector3(1f, 1f, 1f); ((UnityEvent<PlayerControllerB>)(object)Interact_Script.onInteract).AddListener((UnityAction<PlayerControllerB>)TriggerInteract); base.agent.speed = BellCrabRunSpeed; base.agent.acceleration = 100f; BellCrabRandom = new Random(StartOfRound.Instance.randomMapSeed); ScanNodeRandom = new Random(StartOfRound.Instance.randomMapSeed); ((MonoBehaviour)this).StartCoroutine(DoPeakingCoroutine()); SetScanNodeType(ScrapNodeType); Interact_Script.hoverTip = "Grab : [E]"; if (testBuild) { line = ((Component)this).gameObject.AddComponent<LineRenderer>(); line.widthMultiplier = 0.2f; } } public void SetScanNodeType(int type) { ScanNode.nodeType = type; if (type == ScrapNodeType) { ScanNode.headerText = "Brass bell"; ScanNode.scrapValue = ScanNodeRandom.Next((int)(120f * RoundManager.Instance.scrapValueMultiplier), (int)(200f * RoundManager.Instance.scrapValueMultiplier)); ScanNode.subText = "Value: " + ScanNode.scrapValue; } else { ScanNode.headerText = "Bell Crab"; ScanNode.subText = ""; } } private void FindNextWanderPoint() { //IL_0012: 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_0024: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_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) bool flag = false; for (int i = 0; i < 4; i++) { flag = ((EnemyAI)this).SetDestinationToPosition(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 30f, default(NavMeshHit)), true); if (flag) { break; } } if (!flag) { ((EnemyAI)this).SetDestinationToPosition(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((Component)this).transform.position, 30f, default(NavMeshHit)), false); } } public void TriggerInteract(PlayerControllerB player) { //IL_0014: 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) if (base.currentBehaviourStateIndex == 0 && Physics.Raycast(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward, player.grabDistance, player.interactableObjectsMask)) { player.SetHoverTipAndCurrentInteractTrigger(); Interact_Script.interactable = false; Interact_Script.hasTriggered = true; if (!isAttached && (Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController) { PickupCrabServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, player)); } } } [ServerRpc(RequireOwnership = false)] public void PickupCrabServerRpc(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(487414722u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 487414722u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PickupCrabClientRpc(playerID); } } } [ClientRpc] public void PickupCrabClientRpc(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(1614733662u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1614733662u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((MonoBehaviour)this).StartCoroutine(PickupCrabDelay(playerID)); } } } [IteratorStateMachine(typeof(<PickupCrabDelay>d__30))] public IEnumerator PickupCrabDelay(int playerID) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PickupCrabDelay>d__30(0) { <>4__this = this, playerID = playerID }; } [ServerRpc(RequireOwnership = false)] public void DropCrabServerRpc(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(510543919u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 510543919u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DropCrabClientRpc(playerID); FindNextWanderPoint(); } } } [ClientRpc] public void DropCrabClientRpc(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(887584623u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 887584623u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; StartOfRound.Instance.allPlayerScripts[playerID].inAnimationWithEnemy = null; ((MonoBehaviour)this).StartCoroutine(DropCrabDelay(playerID)); } } } public void DropCrabOnLocalClient(PlayerControllerB? player = null) { if ((Object)(object)player == (Object)null) { player = playerHoldingCrab; } if (isAttached || (Object)(object)player != (Object)null) { PlayDropBellSFX(); } if ((Object)(object)player != (Object)null) { player.SetHoverTipAndCurrentInteractTrigger(); } isAttached = false; ((Behaviour)base.agent).enabled = true; base.agent.speed = BellCrabRunSpeed; if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player) { HUDManager.Instance.ClearControlTips(); } if ((Object)(object)player != (Object)null) { player.twoHanded = false; player.inAnimationWithEnemy = null; player.isHoldingObject = false; player.isGrabbingObjectAnimation = false; } Interact_Script.interactable = false; playerHoldingCrab = null; if (base.enemyHP > 0) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); base.creatureAnimator.SetInteger("State", 1); return; } ((Behaviour)base.agent).enabled = false; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); base.creatureAnimator.SetTrigger("Death"); base.creatureAnimator.SetInteger("State", 3); } [IteratorStateMachine(typeof(<DropCrabDelay>d__34))] public IEnumerator DropCrabDelay(int playerID) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DropCrabDelay>d__34(0) { <>4__this = this, playerID = playerID }; } public void snipPlayer() { //IL_002b: 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) if ((Object)(object)playerHoldingCrab != (Object)null) { playerHoldingCrab.DamagePlayer(Plugin.BoundConfig.BellCrabDamageValue.Value, true, true, (CauseOfDeath)17, 0, false, default(Vector3)); playerHoldingCrab.DropAllHeldItems(true, false); PlayCreatureSound(SnipSoundClips[BellCrabRandom.Next(0, SnipSoundClips.Length)]); } } [IteratorStateMachine(typeof(<DoPeakingCoroutine>d__36))] public IEnumerator DoPeakingCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoPeakingCoroutine>d__36(0) { <>4__this = this }; } public void PlayPopInSFX() { PlayCreatureSound(PopInSoundClip); base.agent.speed = 0f; Interact_Script.hasTriggered = false; SetScanNodeType(ScrapNodeType); } public void PlayPopOutSFX() { PlayCreatureSound(PopOutSoundClip); SetScanNodeType(EnemyNodeType); } public void PlayDeathSFX() { base.creatureSFX.Stop(); base.creatureSFX.PlayOneShot(DeathSoundClip); } public void PlayDropBellSFX() { base.creatureSFX.PlayOneShot(BellLandSoundClip); } public void PlayFootstepSFX() { if ((Object)(object)base.creatureSFX.clip != (Object)(object)ScuttleSoundClip || !base.creatureSFX.isPlaying) { PlayCreatureSound(ScuttleSoundClip, loop: true); ((MonoBehaviour)this).StartCoroutine(StopScuttleSound()); } } [IteratorStateMachine(typeof(<StopScuttleSound>d__42))] public IEnumerator StopScuttleSound() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StopScuttleSound>d__42(0) { <>4__this = this }; } public void PlayGrabbedSFX() { base.creatureSFX.PlayOneShot(PickupSoundClip); base.creatureSFX.PlayOneShot(GrabbedSoundClip); } public void PlayCreatureSound(AudioClip clip, bool loop = false) { base.creatureSFX.loop = loop; base.creatureSFX.clip = clip; base.creatureSFX.Play(); } public void spawnCrabScrap() { if (base.enemyHP <= 0) { HideEnemyGameObject(); } if (((NetworkBehaviour)this).IsServer && base.enemyHP <= 0) { ((MonoBehaviour)this).StartCoroutine(delayDestroy()); } } public void HideEnemyGameObject() { ((Component)((Component)this).transform.Find("BellCrab")).gameObject.SetActive(false); } [IteratorStateMachine(typeof(<delayDestroy>d__47))] public IEnumerator delayDestroy() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <delayDestroy>d__47(0) { <>4__this = this }; } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { if (base.enemyHP > 1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, true, hitID); } else { ((EnemyAI)this).HitEnemy(force, playerWhoHit, false, hitID); } base.enemyHP -= force; Interact_Script.interactable = false; if ((Object)(object)playerWhoHit != (Object)null) { HUDManager.Instance.AttemptScanNewCreature(creatureID); } if (isAttached && (Object)(object)playerHoldingCrab != (Object)null && ((NetworkBehaviour)this).IsOwner) { DropCrabClientRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerHoldingCrab)); } if (base.enemyHP > 0) { if (base.currentBehaviourStateIndex == 0) { base.creatureAnimator.SetTrigger("PopOut"); } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); base.creatureAnimator.SetInteger("State", 1); if (recentlyDamagedCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(recentlyDamagedCoroutine); } recentlyDamagedCoroutine = ((MonoBehaviour)this).StartCoroutine(RecentlyDamagedCooldown()); } else if (base.currentBehaviourStateIndex == 2) { ((MonoBehaviour)this).StartCoroutine(DropCrabDelay(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerHoldingCrab))); } else { ((Behaviour)base.agent).enabled = false; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3); base.creatureAnimator.SetTrigger("Death"); base.creatureAnimator.SetInteger("State", 3); } } [IteratorStateMachine(typeof(<RecentlyDamagedCooldown>d__49))] public IEnumerator RecentlyDamagedCooldown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RecentlyDamagedCooldown>d__49(0) { <>4__this = this }; } private bool HasReachedDestination() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Vector3 velocity = base.agent.velocity; if ((double)((Vector3)(ref velocity)).magnitude <= 0.01) { return true; } return false; } [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public void AnimationEventCanRun() { base.agent.speed = BellCrabRunSpeed; } public override void Update() { //IL_015d: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.currentBehaviourStateIndex == 2 && (Object)(object)playerHoldingCrab == (Object)null) { playerHoldingCrab = (from x in StartOfRound.Instance.allPlayerScripts where ((NetworkBehaviour)x).IsSpawned && x.isPlayerControlled && !x.isPlayerDead select x into player select new { Player = player, Distance = Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position) } into x orderby x.Distance select x).FirstOrDefault().Player; } else if (base.currentBehaviourStateIndex == 2 && ((Object)(object)playerHoldingCrab.inAnimationWithEnemy != (Object)(object)this || !isAttached)) { playerHoldingCrab.inAnimationWithEnemy = (EnemyAI)(object)this; isAttached = true; } if (base.isEnemyDead) { return; } if ((Object)(object)playerHoldingCrab != (Object)null) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); base.creatureAnimator.SetInteger("State", 2); if (playerHoldingCrab.isPlayerDead && ((NetworkBehaviour)this).IsHost) { DropCrabServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerHoldingCrab)); } } if (!isAttached && base.currentBehaviourStateIndex == 1) { PlayerControllerB val = FindClosestPlayer(20f); if ((Object)(object)val != (Object)null) { ((Component)this).transform.rotation = Quaternion.LookRotation(Vector3.Normalize(((Component)this).transform.position - ((Component)val).transform.position), Vector3.up); } } if ((Object)(object)playerHoldingCrab != (Object)null && isAttached && playerHoldingCrab.health > 0) { playerHoldingCrab.playerBodyAnimator.SetLayerWeight(playerHoldingCrab.playerBodyAnimator.GetLayerIndex("HoldingItemsBothHands"), 1f); ((Component)this).transform.position = ((Component)playerHoldingCrab.bodyParts[5]).transform.position; Transform transform = ((Component)this).transform; transform.position += ((Component)this).transform.forward * 0.7f; ((Component)this).transform.rotation = ((Component)playerHoldingCrab).transform.rotation; } } [ServerRpc(RequireOwnership = false)] public void HandleGoingFromRunningToIdleServerRpc() { //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(789925258u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 789925258u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; HandleGoingFromRunningToIdleClientRpc(); } } } [ClientRpc] public void HandleGoingFromRunningToIdleClientRpc() { //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_00cc: 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(2496658613u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2496658613u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((Component)this).transform.rotation = Quaternion.identity; base.creatureAnimator.SetTrigger("PopIn"); Interact_Script.interactable = true; Interact_Script.hoverTip = "Grab : [E]"; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0); ScanNode.creatureScanID = -1; base.creatureAnimator.SetInteger("State", 0); FindNextWanderPoint(); } } } public override void DoAIInterval() { if (testBuild) { ((MonoBehaviour)this).StartCoroutine(DrawPath(line, base.agent)); } ((EnemyAI)this).DoAIInterval(); if (base.isEnemyDead || !((NetworkBehaviour)this).IsHost) { return; } switch (base.currentBehaviourStateIndex) { case 1: if (HasReachedDestination() && !recentlyDamaged) { HandleGoingFromRunningToIdleServerRpc(); } break; case 0: case 2: break; } } [IteratorStateMachine(typeof(<DrawPath>d__57))] public static IEnumerator DrawPath(LineRenderer line, NavMeshAgent agent) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DrawPath>d__57(0) { line = line, agent = agent }; } public PlayerControllerB FindClosestPlayer(float maxDistance = 10f) { //IL_001f: 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) PlayerControllerB result = null; float num = float.MaxValue; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (num2 < num && num2 <= maxDistance) { num = num2; result = val; } } return result; } [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 inv