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 AntoineDamiel v1.1.6
BepInEx/plugins/Hamunii.ExampleEnemy.dll
Decompiled a year ago#define DEBUG using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExampleEnemy.Configuration; using GameNetcodeStuff; using Hamunii.ExampleEnemy.NetcodePatcher; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Hamunii.ExampleEnemy")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8d1b8ff2e359c25f3d9a283b5e2b390a9eeb3d3a")] [assembly: AssemblyProduct("ExampleEnemy")] [assembly: AssemblyTitle("Hamunii.ExampleEnemy")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ExampleEnemy { public class CopyFlowermanAI : EnemyAI { private bool evadeModeStareDown; private bool stopTurningTowardsPlayers; public float evadeStealthTimer; private int stareDownChanceIncrease; public PlayerControllerB lookAtPlayer; private Transform localPlayerCamera; private RaycastHit rayHit; private Ray playerRay; public Transform turnCompass; private int roomAndEnemiesMask = 8915200; private Vector3 agentLocalVelocity; public Collider thisEnemyCollider; private Vector3 previousPosition; private float velX; private float velZ; [Header("Kill animation")] public bool inKillAnimation; private Coroutine killAnimationCoroutine; public bool carryingPlayerBody; public DeadBodyInfo bodyBeingCarried; public Transform rightHandGrip; public Transform animationContainer; private bool wasInEvadeMode; public List<Transform> ignoredNodes = new List<Transform>(); private Vector3 mainEntrancePosition; [Header("Anger phase")] public float angerMeter; public float angerCheckInterval; public bool isInAngerMode; public AudioSource creatureAngerVoice; public AudioSource crackNeckAudio; public AudioClip crackNeckSFX; public int timesThreatened; private Vector3 waitAroundEntrancePosition; private int timesFoundSneaking; private bool stunnedByPlayerLastFrame; private bool startingKillAnimationLocalClient; private float getPathToFavoriteNodeInterval; private bool gettingFarthestNodeFromPlayerAsync; private Transform farthestNodeFromTargetPlayer; [Space(5f)] public int maxAsync = 50; public override void Start() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); base.movingTowardsTargetPlayer = true; localPlayerCamera = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform; mainEntrancePosition = RoundManager.FindMainEntrancePosition(false, false); } public override void DoAIInterval() { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) if (StartOfRound.Instance.livingPlayers == 0) { ((EnemyAI)this).DoAIInterval(); return; } if (((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f)) { if (base.currentBehaviourStateIndex == 2) { ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); if (!inKillAnimation && (Object)(object)base.targetPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController) { ((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId); } ((EnemyAI)this).DoAIInterval(); return; } if (base.currentBehaviourStateIndex == 1) { if ((Object)(object)base.favoriteSpot != (Object)null && carryingPlayerBody) { if (base.mostOptimalDistance < 5f || ((EnemyAI)this).PathIsIntersectedByLineOfSight(base.favoriteSpot.position, false, true, false)) { AvoidClosestPlayer(); } else { base.targetNode = base.favoriteSpot; if (Time.realtimeSinceStartup - getPathToFavoriteNodeInterval > 1f) { ((EnemyAI)this).SetDestinationToPosition(base.favoriteSpot.position, true); getPathToFavoriteNodeInterval = Time.realtimeSinceStartup; } } } else { AvoidClosestPlayer(); } } else { ChooseClosestNodeToPlayer(); } } else { if (base.currentBehaviourStateIndex == 2) { ((EnemyAI)this).SetDestinationToPosition(waitAroundEntrancePosition, false); ((EnemyAI)this).DoAIInterval(); return; } Transform val = ((EnemyAI)this).ChooseFarthestNodeFromPosition(mainEntrancePosition, false, 0, false, 50, false); if ((Object)(object)base.favoriteSpot == (Object)null) { base.favoriteSpot = val; } base.targetNode = val; ((EnemyAI)this).SetDestinationToPosition(val.position, true); } ((EnemyAI)this).DoAIInterval(); } public void AvoidClosestPlayer() { //IL_0048: 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_0088: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)farthestNodeFromTargetPlayer == (Object)null) { gettingFarthestNodeFromPlayerAsync = true; return; } Transform val = farthestNodeFromTargetPlayer; farthestNodeFromTargetPlayer = null; if ((Object)(object)val != (Object)null && base.mostOptimalDistance > 5f && Physics.Linecast(((Component)val).transform.position, ((Component)base.targetPlayer.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { base.targetNode = val; ((EnemyAI)this).SetDestinationToPosition(base.targetNode.position, false); return; } if (carryingPlayerBody) { DropPlayerBody(); DropPlayerBodyServerRpc(); } AddToAngerMeter(base.AIIntervalTime); base.agent.speed = 0f; } public void AddToAngerMeter(float amountToAdd) { if (base.stunNormalizedTimer > 0f) { if ((Object)(object)base.stunnedByPlayer != (Object)null) { stunnedByPlayerLastFrame = true; angerMeter = 12f; } else { angerMeter = 2f; } return; } angerMeter += amountToAdd; if (angerMeter <= 0.4f) { return; } angerCheckInterval += amountToAdd; if (!(angerCheckInterval > 1f)) { return; } angerCheckInterval = 0f; float num = Mathf.Clamp(0.09f * angerMeter, 0f, 0.99f); if (Random.Range(0f, 1f) < num) { if (angerMeter < 2.5f) { timesThreatened++; } angerMeter += (float)timesThreatened / 1.75f; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); EnterAngerModeServerRpc(angerMeter); } } [ServerRpc] public void EnterAngerModeServerRpc(float angerTime) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2847883838u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref angerTime, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2847883838u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { EnterAngerModeClientRpc(angerTime); } } [ClientRpc] public void EnterAngerModeClientRpc(float angerTime) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2697060406u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref angerTime, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2697060406u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { angerMeter = angerTime; base.agent.speed = 9f; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); waitAroundEntrancePosition = RoundManager.Instance.GetRandomNavMeshPositionInRadius(mainEntrancePosition, 6f, default(NavMeshHit)); } } } public void ChooseClosestNodeToPlayer() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetNode == (Object)null) { base.targetNode = base.allAINodes[0].transform; } Transform val = ((EnemyAI)this).ChooseClosestNodeToPosition(((Component)base.targetPlayer).transform.position, true, 0); if ((Object)(object)val != (Object)null) { base.targetNode = val; } float num = Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position); if (num - base.mostOptimalDistance < 0.1f && (!((EnemyAI)this).PathIsIntersectedByLineOfSight(((Component)base.targetPlayer).transform.position, true, true, false) || num < 3f)) { if (base.pathDistance > 10f && !ignoredNodes.Contains(base.targetNode) && ignoredNodes.Count < 4) { ignoredNodes.Add(base.targetNode); } base.movingTowardsTargetPlayer = true; } else { ((EnemyAI)this).SetDestinationToPosition(base.targetNode.position, false); } } public override void Update() { //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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0770: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_07bc: Unknown result type (might be due to invalid IL or missing references) //IL_0647: Unknown result type (might be due to invalid IL or missing references) //IL_093d: Unknown result type (might be due to invalid IL or missing references) //IL_0942: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_09c8: Unknown result type (might be due to invalid IL or missing references) //IL_0963: Unknown result type (might be due to invalid IL or missing references) //IL_0a1d: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead || inKillAnimation || (Object)(object)GameNetworkManager.Instance == (Object)null) { return; } if (((NetworkBehaviour)this).IsOwner && gettingFarthestNodeFromPlayerAsync && (Object)(object)base.targetPlayer != (Object)null) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position); if (num < 16f) { maxAsync = 50; } else if (num < 40f) { maxAsync = 15; } else { maxAsync = 4; } Transform val = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)base.targetPlayer).transform.position, true, 0, true, maxAsync, true); if (!base.gotFarthestNodeAsync) { return; } farthestNodeFromTargetPlayer = val; gettingFarthestNodeFromPlayerAsync = false; } if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.5f, 30f, 60, -1f)) { if (base.currentBehaviourStateIndex == 0) { ((EnemyAI)this).SwitchToBehaviourState(1); if (!base.thisNetworkObject.IsOwner) { ((EnemyAI)this).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) < 5f) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.6f, true); } else { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.3f, true); } base.agent.speed = 0f; evadeStealthTimer = 0f; } else if (evadeStealthTimer > 0.5f) { int playerObj = (int)GameNetworkManager.Instance.localPlayerController.playerClientId; LookAtFlowermanTrigger(playerObj); ResetFlowermanStealthTimerServerRpc(playerObj); } } Vector3 val2; switch (base.currentBehaviourStateIndex) { case 1: { if (isInAngerMode) { isInAngerMode = false; base.creatureAnimator.SetBool("anger", false); } if (!wasInEvadeMode) { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7f, 0.8f, 0, false, 0); wasInEvadeMode = true; base.movingTowardsTargetPlayer = false; if ((Object)(object)base.favoriteSpot != (Object)null && !carryingPlayerBody && Vector3.Distance(((Component)this).transform.position, base.favoriteSpot.position) < 7f) { base.favoriteSpot = null; } } if (base.stunNormalizedTimer > 0f) { base.creatureAnimator.SetLayerWeight(2, 1f); } else { base.creatureAnimator.SetLayerWeight(2, 0f); } evadeStealthTimer += Time.deltaTime; if (base.thisNetworkObject.IsOwner) { float num2 = ((timesFoundSneaking % 3 != 0) ? 11f : 24f); if ((Object)(object)base.favoriteSpot != (Object)null && carryingPlayerBody) { num2 = ((!(Vector3.Distance(((Component)this).transform.position, base.favoriteSpot.position) > 8f)) ? 3f : 24f); } if (evadeStealthTimer > num2) { evadeStealthTimer = 0f; ((EnemyAI)this).SwitchToBehaviourState(0); } if (!carryingPlayerBody && evadeModeStareDown && evadeStealthTimer < 1.25f) { AddToAngerMeter(Time.deltaTime * 1.5f); base.agent.speed = 0f; } else { evadeModeStareDown = false; if (base.stunNormalizedTimer > 0f) { DropPlayerBody(); AddToAngerMeter(0f); base.agent.speed = 0f; } else { if (stunnedByPlayerLastFrame) { stunnedByPlayerLastFrame = false; AddToAngerMeter(0f); } if (carryingPlayerBody) { base.agent.speed = Mathf.Clamp(base.agent.speed + Time.deltaTime * 7.25f, 4f, 9f); } else { base.agent.speed = Mathf.Clamp(base.agent.speed + Time.deltaTime * 4.25f, 0f, 6f); } } } if (!carryingPlayerBody && base.ventAnimationFinished) { LookAtPlayerOfInterest(); } } if (!carryingPlayerBody) { CalculateAnimationDirection(); break; } Animator creatureAnimator2 = base.creatureAnimator; val2 = Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f); creatureAnimator2.SetFloat("speedMultiplier", ((Vector3)(ref val2)).sqrMagnitude / (Time.deltaTime * 2f)); previousPosition = ((Component)this).transform.position; break; } case 0: { if (isInAngerMode) { isInAngerMode = false; base.creatureAnimator.SetBool("anger", false); } if (wasInEvadeMode) { wasInEvadeMode = false; evadeStealthTimer = 0f; if (carryingPlayerBody) { DropPlayerBody(); ((Behaviour)base.agent).enabled = true; base.favoriteSpot = ((EnemyAI)this).ChooseClosestNodeToPosition(((Component)this).transform.position, true, 0); if (!((NetworkBehaviour)this).IsOwner) { ((Behaviour)base.agent).enabled = false; } Debug.Log((object)"Flowerman: Dropped player body"); } } Animator creatureAnimator = base.creatureAnimator; val2 = Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f); creatureAnimator.SetFloat("speedMultiplier", ((Vector3)(ref val2)).sqrMagnitude / (Time.deltaTime / 4f)); previousPosition = ((Component)this).transform.position; base.agent.speed = 6f; break; } case 2: { bool flag = false; if (!isInAngerMode) { isInAngerMode = true; DropPlayerBody(); creatureAngerVoice.Play(); creatureAngerVoice.pitch = Random.Range(0.9f, 1.3f); base.creatureAnimator.SetBool("anger", true); base.creatureAnimator.SetBool("sneak", false); if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 60f, 15, 2.5f)) { flag = true; GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.5f, true); } } if (!flag && GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 60f, 13, 4f)) { GameNetworkManager.Instance.localPlayerController.IncreaseFearLevelOverTime(0.8f, 1f); } CalculateAnimationDirection(3f); if (base.stunNormalizedTimer > 0f) { base.creatureAnimator.SetLayerWeight(2, 1f); base.agent.speed = 0f; angerMeter = 6f; } else { base.creatureAnimator.SetLayerWeight(2, 0f); base.agent.speed = Mathf.Clamp(base.agent.speed + Time.deltaTime * 1.2f, 3f, 12f); } angerMeter -= Time.deltaTime; if (((NetworkBehaviour)this).IsOwner && angerMeter <= 0f) { ((EnemyAI)this).SwitchToBehaviourState(1); } break; } } if (isInAngerMode) { creatureAngerVoice.volume = Mathf.Lerp(creatureAngerVoice.volume, 1f, 10f * Time.deltaTime); } else { creatureAngerVoice.volume = Mathf.Lerp(creatureAngerVoice.volume, 0f, 2f * Time.deltaTime); } Vector3 localEulerAngles = animationContainer.localEulerAngles; if (carryingPlayerBody) { base.agent.angularSpeed = 50f; localEulerAngles.z = Mathf.Lerp(localEulerAngles.z, 179f, 10f * Time.deltaTime); base.creatureAnimator.SetLayerWeight(1, Mathf.Lerp(base.creatureAnimator.GetLayerWeight(1), 1f, 10f * Time.deltaTime)); } else { base.agent.angularSpeed = 220f; localEulerAngles.z = Mathf.Lerp(localEulerAngles.z, 0f, 10f * Time.deltaTime); base.creatureAnimator.SetLayerWeight(1, Mathf.Lerp(base.creatureAnimator.GetLayerWeight(1), 0f, 10f * Time.deltaTime)); } animationContainer.localEulerAngles = localEulerAngles; } [ServerRpc] public void DropPlayerBodyServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1435950538u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1435950538u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { DropPlayerBodyClientRpc(); } } [ClientRpc] public void DropPlayerBodyClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(411995788u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 411995788u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { DropPlayerBody(); } } } private void DropPlayerBody() { if (carryingPlayerBody) { carryingPlayerBody = false; bodyBeingCarried.matchPositionExactly = false; bodyBeingCarried.attachedTo = null; bodyBeingCarried = null; base.creatureAnimator.SetBool("carryingBody", false); } } private void LookAtPlayerOfInterest() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (isInAngerMode) { lookAtPlayer = base.targetPlayer; } else { lookAtPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false); } if ((Object)(object)lookAtPlayer != (Object)null) { turnCompass.LookAt(((Component)lookAtPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 30f * Time.deltaTime); } } private void CalculateAnimationDirection(float maxSpeed = 1f) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) agentLocalVelocity = animationContainer.InverseTransformDirection(Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f) / (Time.deltaTime * 2f)); velX = Mathf.Lerp(velX, agentLocalVelocity.x, 10f * Time.deltaTime); base.creatureAnimator.SetFloat("VelocityX", Mathf.Clamp(velX, 0f - maxSpeed, maxSpeed)); velZ = Mathf.Lerp(velZ, 0f - agentLocalVelocity.y, 10f * Time.deltaTime); base.creatureAnimator.SetFloat("VelocityZ", Mathf.Clamp(velZ, 0f - maxSpeed, maxSpeed)); previousPosition = ((Component)this).transform.position; } public override void OnCollideWithPlayer(Collider other) { ((EnemyAI)this).OnCollideWithPlayer(other); PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, inKillAnimation || startingKillAnimationLocalClient || carryingPlayerBody, false); if ((Object)(object)val != (Object)null) { KillPlayerAnimationServerRpc((int)val.playerClientId); startingKillAnimationLocalClient = true; } } [ServerRpc(RequireOwnership = false)] public void KillPlayerAnimationServerRpc(int playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2905392997u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2905392997u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { if (!inKillAnimation && !carryingPlayerBody) { inKillAnimation = true; base.inSpecialAnimation = true; base.isClientCalculatingAI = false; base.inSpecialAnimationWithPlayer = StartOfRound.Instance.allPlayerScripts[playerObjectId]; base.inSpecialAnimationWithPlayer.inAnimationWithEnemy = (EnemyAI)(object)this; KillPlayerAnimationClientRpc(playerObjectId); } else { CancelKillAnimationClientRpc(playerObjectId); } } } [ClientRpc] public void CancelKillAnimationClientRpc(int playerObjectId) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(394818930u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 394818930u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (int)GameNetworkManager.Instance.localPlayerController.playerClientId == playerObjectId) { startingKillAnimationLocalClient = false; } } } [ClientRpc] public void KillPlayerAnimationClientRpc(int playerObjectId) { //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_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3527721356u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObjectId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3527721356u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.inSpecialAnimationWithPlayer = StartOfRound.Instance.allPlayerScripts[playerObjectId]; if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { startingKillAnimationLocalClient = false; } if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)null || base.inSpecialAnimationWithPlayer.isPlayerDead || !base.inSpecialAnimationWithPlayer.isInsideFactory) { FinishKillAnimation(carryingBody: false); } base.inSpecialAnimationWithPlayer.inAnimationWithEnemy = (EnemyAI)(object)this; inKillAnimation = true; base.inSpecialAnimation = true; base.creatureAnimator.SetBool("killing", true); ((Behaviour)base.agent).enabled = false; base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = true; base.inSpecialAnimationWithPlayer.snapToServerPosition = true; Vector3 val3 = ((!((NetworkBehaviour)base.inSpecialAnimationWithPlayer).IsOwner) ? ((Component)base.inSpecialAnimationWithPlayer).transform.parent.TransformPoint(base.inSpecialAnimationWithPlayer.serverPlayerPosition) : ((Component)base.inSpecialAnimationWithPlayer).transform.position); Vector3 position = ((Component)this).transform.position; position.y = ((Component)base.inSpecialAnimationWithPlayer).transform.position.y; playerRay = new Ray(val3, position - ((Component)base.inSpecialAnimationWithPlayer).transform.position); turnCompass.LookAt(val3); position = ((Component)this).transform.eulerAngles; position.y = turnCompass.eulerAngles.y; ((Component)this).transform.eulerAngles = position; if (killAnimationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(killAnimationCoroutine); } killAnimationCoroutine = ((MonoBehaviour)this).StartCoroutine(killAnimation()); } } private IEnumerator killAnimation() { WalkieTalkie.TransmitOneShotAudio(crackNeckAudio, crackNeckSFX, 1f); crackNeckAudio.PlayOneShot(crackNeckSFX); Vector3 endPosition = ((Ray)(ref playerRay)).GetPoint(1f); if (endPosition.y < -80f) { Vector3 startingPosition = ((Component)this).transform.position; for (int i = 0; i < 5; i++) { ((Component)this).transform.position = Vector3.Lerp(startingPosition, endPosition, (float)i / 5f); yield return null; } ((Component)this).transform.position = endPosition; } base.creatureAnimator.SetBool("killing", false); base.creatureAnimator.SetBool("carryingBody", true); yield return (object)new WaitForSeconds(0.65f); if ((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null) { base.inSpecialAnimationWithPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)4, 0, default(Vector3)); base.inSpecialAnimationWithPlayer.snapToServerPosition = false; float startTime = Time.timeSinceLevelLoad; yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)base.inSpecialAnimationWithPlayer.deadBody != (Object)null || Time.timeSinceLevelLoad - startTime > 2f)); } if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)null || (Object)(object)base.inSpecialAnimationWithPlayer.deadBody == (Object)null) { Debug.Log((object)"Flowerman: Player body was not spawned or found within 2 seconds."); FinishKillAnimation(carryingBody: false); } else { base.inSpecialAnimationWithPlayer.deadBody.bodyBleedingHeavily = true; FinishKillAnimation(); } } public void FinishKillAnimation(bool carryingBody = true) { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) if (killAnimationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(killAnimationCoroutine); } base.inSpecialAnimation = false; inKillAnimation = false; startingKillAnimationLocalClient = false; base.creatureAnimator.SetBool("killing", false); if ((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null) { base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = false; base.inSpecialAnimationWithPlayer.snapToServerPosition = false; base.inSpecialAnimationWithPlayer.inAnimationWithEnemy = null; if (carryingBody) { bodyBeingCarried = base.inSpecialAnimationWithPlayer.deadBody; bodyBeingCarried.attachedTo = rightHandGrip; bodyBeingCarried.attachedLimb = base.inSpecialAnimationWithPlayer.deadBody.bodyParts[0]; bodyBeingCarried.matchPositionExactly = true; carryingPlayerBody = true; } } evadeStealthTimer = 0f; base.movingTowardsTargetPlayer = false; ignoredNodes.Clear(); if (!carryingBody) { base.creatureAnimator.SetBool("carryingBody", false); } if (((NetworkBehaviour)this).IsOwner) { Vector3 position = ((Component)this).transform.position; position = RoundManager.Instance.GetNavMeshPosition(position, default(NavMeshHit), 10f, -1); if (!RoundManager.Instance.GotNavMeshPositionResult) { RaycastHit val = default(RaycastHit); position = ((!Physics.Raycast(((Component)this).transform.position, -Vector3.up, ref val, 50f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) ? base.allAINodes[Random.Range(0, base.allAINodes.Length)].transform.position : RoundManager.Instance.GetNavMeshPosition(((RaycastHit)(ref val)).point, default(NavMeshHit), 10f, -1)); } ((Component)this).transform.position = position; ((Behaviour)base.agent).enabled = true; base.isClientCalculatingAI = true; } ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); if (((NetworkBehaviour)this).IsServer) { ((EnemyAI)this).SwitchToBehaviourState(1); } } [ServerRpc(RequireOwnership = false)] public void ResetFlowermanStealthTimerServerRpc(int playerObj) { //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) 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(3278959226u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObj); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3278959226u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ResetFlowermanStealthClientRpc(playerObj); } } } [ClientRpc] public void ResetFlowermanStealthClientRpc(int playerObj) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2462061333u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerObj); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2462061333u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && playerObj != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { LookAtFlowermanTrigger(playerObj); } } } public void LookAtFlowermanTrigger(int playerObj) { //IL_0081: 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) if (!((NetworkBehaviour)this).IsOwner) { return; } if (!evadeModeStareDown) { if (Random.Range(0, 70) < stareDownChanceIncrease) { stareDownChanceIncrease = -6; evadeModeStareDown = true; } else { stareDownChanceIncrease++; } evadeStealthTimer = 0f; } if (carryingPlayerBody && (Object)(object)base.favoriteSpot != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.favoriteSpot).transform.position) < 5f) { DropPlayerBody(); } } public override void KillEnemy(bool destroy = false) { if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); } base.creatureSFX.Stop(); creatureAngerVoice.Stop(); base.creatureAnimator.SetLayerWeight(2, 0f); ((EnemyAI)this).KillEnemy(false); if (carryingPlayerBody) { carryingPlayerBody = false; if ((Object)(object)bodyBeingCarried != (Object)null) { bodyBeingCarried.matchPositionExactly = false; bodyBeingCarried.attachedTo = null; } } if (inKillAnimation) { FinishKillAnimation(carryingBody: false); } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (base.isEnemyDead) { return; } base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner) { if (base.enemyHP <= 0) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); return; } angerMeter = 11f; angerCheckInterval = 1f; AddToAngerMeter(0.1f); } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_CopyFlowermanAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2847883838u, new RpcReceiveHandler(__rpc_handler_2847883838)); NetworkManager.__rpc_func_table.Add(2697060406u, new RpcReceiveHandler(__rpc_handler_2697060406)); NetworkManager.__rpc_func_table.Add(1435950538u, new RpcReceiveHandler(__rpc_handler_1435950538)); NetworkManager.__rpc_func_table.Add(411995788u, new RpcReceiveHandler(__rpc_handler_411995788)); NetworkManager.__rpc_func_table.Add(2905392997u, new RpcReceiveHandler(__rpc_handler_2905392997)); NetworkManager.__rpc_func_table.Add(394818930u, new RpcReceiveHandler(__rpc_handler_394818930)); NetworkManager.__rpc_func_table.Add(3527721356u, new RpcReceiveHandler(__rpc_handler_3527721356)); NetworkManager.__rpc_func_table.Add(3278959226u, new RpcReceiveHandler(__rpc_handler_3278959226)); NetworkManager.__rpc_func_table.Add(2462061333u, new RpcReceiveHandler(__rpc_handler_2462061333)); } private static void __rpc_handler_2847883838(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { float angerTime = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref angerTime, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CopyFlowermanAI)(object)target).EnterAngerModeServerRpc(angerTime); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2697060406(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float angerTime = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref angerTime, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((CopyFlowermanAI)(object)target).EnterAngerModeClientRpc(angerTime); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1435950538(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((CopyFlowermanAI)(object)target).DropPlayerBodyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_411995788(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)2; ((CopyFlowermanAI)(object)target).DropPlayerBodyClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2905392997(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 playerObjectId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)1; ((CopyFlowermanAI)(object)target).KillPlayerAnimationServerRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_394818930(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 playerObjectId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)2; ((CopyFlowermanAI)(object)target).CancelKillAnimationClientRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3527721356(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 playerObjectId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)2; ((CopyFlowermanAI)(object)target).KillPlayerAnimationClientRpc(playerObjectId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3278959226(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 playerObj = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObj); target.__rpc_exec_stage = (__RpcExecStage)1; ((CopyFlowermanAI)(object)target).ResetFlowermanStealthTimerServerRpc(playerObj); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2462061333(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 playerObj = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObj); target.__rpc_exec_stage = (__RpcExecStage)2; ((CopyFlowermanAI)(object)target).ResetFlowermanStealthClientRpc(playerObj); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "CopyFlowermanAI"; } } internal class ExampleEnemyAI : EnemyAI { private enum State { SearchingForPlayer, StickingInFrontOfPlayer, HeadSwingAttackInProgress } public Transform turnCompass = null; public Transform attackArea = null; private float timeSinceHittingLocalPlayer; private float timeSinceNewRandPos; private Vector3 positionRandomness; private Vector3 StalkPos; private Random enemyRandom = null; private bool isDeadAnimationDone; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); LogIfDebugBuild("Example Enemy Spawned"); timeSinceHittingLocalPlayer = 0f; base.creatureAnimator.SetTrigger("startWalk"); timeSinceNewRandPos = 0f; positionRandomness = new Vector3(0f, 0f, 0f); enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); isDeadAnimationDone = false; base.currentBehaviourStateIndex = 0; ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } public override void Update() { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead) { if (!isDeadAnimationDone) { LogIfDebugBuild("Stopping enemy voice with janky code."); isDeadAnimationDone = true; base.creatureVoice.Stop(); base.creatureVoice.PlayOneShot(base.dieSFX); } return; } timeSinceHittingLocalPlayer += Time.deltaTime; timeSinceNewRandPos += Time.deltaTime; int currentBehaviourStateIndex = base.currentBehaviourStateIndex; if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 1 || currentBehaviourStateIndex == 2)) { 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 (base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; } } public override void DoAIInterval() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } switch (base.currentBehaviourStateIndex) { case 0: base.agent.speed = 3f; if (FoundClosestPlayerInRange(25f, 3f)) { LogIfDebugBuild("Start Target Player"); ((EnemyAI)this).StopSearch(base.currentSearch, true); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } break; case 1: base.agent.speed = 5f; if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 20f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null))) { LogIfDebugBuild("Stop Target Player"); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } else { StickingInFrontOfPlayer(); } break; case 2: break; default: LogIfDebugBuild("This Behavior State doesn't exist!"); break; } } private bool FoundClosestPlayerInRange(float range, float senseRange) { //IL_004e: 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) ((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f); if ((Object)(object)base.targetPlayer == (Object)null) { ((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f); range = senseRange; } return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range; } private bool TargetClosestPlayerInAnyCase() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) base.mostOptimalDistance = 2000f; base.targetPlayer = null; for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; 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]; } } if ((Object)(object)base.targetPlayer == (Object)null) { return false; } return true; } private void StickingInFrontOfPlayer() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner && timeSinceNewRandPos > 0.7f) { timeSinceNewRandPos = 0f; if (enemyRandom.Next(0, 5) == 0) { ((MonoBehaviour)this).StartCoroutine(SwingAttack()); } else { positionRandomness = new Vector3((float)enemyRandom.Next(-2, 2), 0f, (float)enemyRandom.Next(-2, 2)); StalkPos = ((Component)base.targetPlayer).transform.position - Vector3.Scale(new Vector3(-5f, 0f, -5f), ((Component)base.targetPlayer).transform.forward) + positionRandomness; } ((EnemyAI)this).SetDestinationToPosition(StalkPos, false); } } private IEnumerator SwingAttack() { ((EnemyAI)this).SwitchToBehaviourClientRpc(2); StalkPos = ((Component)base.targetPlayer).transform.position; ((EnemyAI)this).SetDestinationToPosition(StalkPos, false); yield return (object)new WaitForSeconds(0.5f); if (!base.isEnemyDead) { DoAnimationClientRpc("swingAttack"); yield return (object)new WaitForSeconds(0.35f); SwingAttackHitClientRpc(); if (base.currentBehaviourStateIndex == 2) { ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } } } public override void OnCollideWithPlayer(Collider other) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!(timeSinceHittingLocalPlayer < 1f)) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { LogIfDebugBuild("Example Enemy Collision with Player!"); timeSinceHittingLocalPlayer = 0f; val.DamagePlayer(20, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (!base.isEnemyDead) { base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead) { ((MonoBehaviour)this).StopCoroutine(SwingAttack()); ((MonoBehaviour)this).StopCoroutine(base.searchCoroutine); ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } } [ClientRpc] public void DoAnimationClientRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(249397563u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 249397563u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("Animation: " + animationName); base.creatureAnimator.SetTrigger(animationName); } } [ClientRpc] public void SwingAttackHitClientRpc() { //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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3378112882u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3378112882u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } LogIfDebugBuild("SwingAttackHitClientRPC"); int num = 8; Collider[] array = Physics.OverlapBox(attackArea.position, attackArea.localScale, Quaternion.identity, num); if (array.Length == 0) { return; } Collider[] array2 = array; foreach (Collider val3 in array2) { PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false); if ((Object)(object)val4 != (Object)null) { LogIfDebugBuild("Swing attack hit player!"); timeSinceHittingLocalPlayer = 0f; val4.DamagePlayer(40, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ExampleEnemyAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(249397563u, new RpcReceiveHandler(__rpc_handler_249397563)); NetworkManager.__rpc_func_table.Add(3378112882u, new RpcReceiveHandler(__rpc_handler_3378112882)); } private static void __rpc_handler_249397563(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((ExampleEnemyAI)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3378112882(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)2; ((ExampleEnemyAI)(object)target).SwingAttackHitClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ExampleEnemyAI"; } } [BepInPlugin("Hamunii.ExampleEnemy", "ExampleEnemy", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; public static AssetBundle? ModAssets; internal static PluginConfig BoundConfig { get; private set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config); InitializeNetworkBehaviours(); string path = "AntoineDamiel"; ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path)); if ((Object)(object)ModAssets == (Object)null) { Logger.LogError((object)"Failed to load custom assets."); return; } EnemyType val = ModAssets.LoadAsset<EnemyType>("AntoineDamieltest"); TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("AntoineDamielTN"); TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("AntoineDamielTK"); Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int> { { (LevelTypes)4, 30 }, { (LevelTypes)16, 300 }, { (LevelTypes)64, 70 }, { (LevelTypes)128, 60 }, { (LevelTypes)512, 45 }, { (LevelTypes)(-1), 30 } }; Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Enemies.RegisterEnemy(val, dictionary, dictionary2, val2, val3); Logger.LogInfo((object)"Plugin Hamunii.ExampleEnemy is loaded!"); } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } public static class PluginInfo { public const string PLUGIN_GUID = "Hamunii.ExampleEnemy"; public const string PLUGIN_NAME = "ExampleEnemy"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace ExampleEnemy.Configuration { public class PluginConfig { public ConfigEntry<int> SpawnWeight; public PluginConfig(ConfigFile cfg) { SpawnWeight = cfg.Bind<int>("General", "Spawn weight", 500, "The spawn chance weight for ExampleEnemy, relative to other existing enemies.\nGoes up from 0, lower is more rare, 100 and up is very common."); ClearUnusedEntries(cfg); } private void ClearUnusedEntries(ConfigFile cfg) { PropertyInfo property = ((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(cfg, null); dictionary.Clear(); cfg.Save(); } } } namespace Hamunii.ExampleEnemy.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }