Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of CustomEnemies v0.0.2
FrenchPlatypus.CustomEnnemies.dll
Decompiled 2 years 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 CustomEnnemies.Configuration; using FrenchPlatypus.CustomEnnemies.NetcodePatcher; using GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [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 = "")] [assembly: AssemblyCompany("FrenchPlatypus.CustomEnnemies")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CustomEnnemies")] [assembly: AssemblyTitle("FrenchPlatypus.CustomEnnemies")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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; } } } namespace CustomEnnemies { internal class BrolyAI : EnemyAI { private enum State { SearchingForPlayer, ChasePlayer, ChaseBracken, AttackPlayer, AttackBracken, Flea } public Transform turnCompass = null; public Transform attackArea = null; public Transform assParent = null; public AudioSource stepSound = null; private float timeSinceHittingLocalPlayer; private float timeSinceNewRandPos; private Vector3 positionRandomness; private Vector3 StalkPos; private Vector3 spawnPos; private Random enemyRandom = null; private bool isDeadAnimationDone; private bool isInterrupted; private float fleaTimer; private Transform playerParent; private PlayerControllerB attackedPlayer; private FlowermanAI flowermanTarget = null; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0093: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); LogIfDebugBuild("Broly Spawned"); timeSinceHittingLocalPlayer = 0f; base.creatureVoice.mute = false; timeSinceNewRandPos = 0f; positionRandomness = new Vector3(0f, 0f, 0f); spawnPos = ((Component)this).transform.position; 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_00b7: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) ((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; } if (fleaTimer > 0f) { fleaTimer -= Time.deltaTime; } } public override void DoAIInterval() { //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0347: 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.creatureVoice.mute = true; stepSound.mute = false; if (FoundBrackenInMap() && (Object)(object)flowermanTarget != (Object)null) { LogIfDebugBuild("found bracken"); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } else if (FoundClosestPlayerInRange(4f) && (Object)(object)base.targetPlayer != (Object)null) { ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } break; case 1: base.agent.speed = 7f; base.agent.angularSpeed = 80f; base.creatureVoice.mute = false; stepSound.mute = true; if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 12f && !((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 { ChasePlayer(); } break; case 2: base.agent.speed = 15f; base.agent.angularSpeed = 200f; base.creatureVoice.mute = true; stepSound.mute = false; if ((Object)(object)flowermanTarget == (Object)null) { LogIfDebugBuild("Stop Target Bracken"); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); base.creatureVoice.mute = false; base.creatureAnimator.SetTrigger("startWalk"); } else { ChaseBracken(); } break; case 3: case 4: base.agent.speed = 2f; base.creatureVoice.mute = true; stepSound.mute = true; break; case 5: base.agent.speed = 15f; base.agent.angularSpeed = 200f; base.creatureVoice.mute = true; stepSound.mute = false; if ((Object)(object)attackedPlayer != (Object)null) { attackedPlayer.deadBody.SetRagdollPositionSafely(assParent.position, false); } if (fleaTimer <= 0f || Vector3.Distance(((Component)this).transform.position, spawnPos) < 1f) { if ((Object)(object)attackedPlayer != (Object)null) { DropPlayerClientRpc(); attackedPlayer = null; } ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } break; default: LogIfDebugBuild("This Behavior State doesn't exist!"); break; } } private bool FoundBrackenInMap() { flowermanTarget = null; if (Object.FindObjectsOfType<FlowermanAI>().Length != 0) { for (int i = 0; i < Object.FindObjectsOfType<FlowermanAI>().Length; i++) { if (!((EnemyAI)Object.FindObjectsOfType<FlowermanAI>()[i]).isEnemyDead) { flowermanTarget = Object.FindObjectsOfType<FlowermanAI>()[i]; break; } } return (Object)(object)flowermanTarget != (Object)null; } return false; } private bool FoundClosestPlayerInRange(float range) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) base.mostOptimalDistance = range; base.targetPlayer = null; PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(180f, 60, base.eye, -1f, -1); if (allPlayersInLineOfSight != null) { int num = 0; if (num < allPlayersInLineOfSight.Length) { base.targetPlayer = allPlayersInLineOfSight[num]; } } base.agent.speed = 4f; base.agent.angularSpeed = 200f; if ((Object)(object)base.targetPlayer == (Object)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 && !StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f)) { base.mostOptimalDistance = base.tempDist; base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i]; } } } return (Object)(object)base.targetPlayer != (Object)null; } 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 ChasePlayer() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner) { StalkPos = ((Component)base.targetPlayer).transform.position; ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 2f) { ((MonoBehaviour)this).StartCoroutine(AttackPlayer()); } } } private void ChaseBracken() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { StalkPos = ((Component)flowermanTarget).transform.position; ((EnemyAI)this).SetDestinationToPosition(StalkPos, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)flowermanTarget).transform.position) < 2f) { ((MonoBehaviour)this).StartCoroutine(AttackBracken()); } } } private void FleaPlayer() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) LogIfDebugBuild("Flea player"); ((EnemyAI)this).SwitchToBehaviourClientRpc(5); ((EnemyAI)this).SetDestinationToPosition(spawnPos, false); fleaTimer = 8f; } private IEnumerator AttackPlayer() { ((EnemyAI)this).SwitchToBehaviourClientRpc(3); StalkPos = ((Component)base.targetPlayer).transform.position; ((EnemyAI)this).SetDestinationToPosition(StalkPos, false); if (base.isEnemyDead) { yield break; } StopPlayerClientRpc(); isInterrupted = false; int hitCount = 0; attackedPlayer = base.targetPlayer; while (!isInterrupted) { hitCount++; LogIfDebugBuild("PlayerHealth : " + base.targetPlayer.health + " hit count : " + hitCount); PlayerHitClientRpc(); if (hitCount == 12 || attackedPlayer.isPlayerDead || isInterrupted) { break; } yield return (object)new WaitForSeconds(0.5f); yield return null; } LogIfDebugBuild("Release player"); ReleasePlayerClientRpc(); if (!isInterrupted) { attackedPlayer.causeOfDeath = (CauseOfDeath)5; DragPlayerClientRpc(); } ((EnemyAI)this).SwitchToBehaviourClientRpc(5); FleaPlayer(); } private IEnumerator AttackBracken() { LogIfDebugBuild("Attack Bracken"); ((EnemyAI)this).SwitchToBehaviourClientRpc(4); ((EnemyAI)flowermanTarget).KillEnemyOnOwnerClient(false); yield return (object)new WaitForSeconds(2f); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } public override void OnCollideWithPlayer(Collider other) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (!(timeSinceHittingLocalPlayer < 1f)) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)base.targetPlayer) { LogIfDebugBuild("Example Enemy Collision with Player!"); timeSinceHittingLocalPlayer = 0f; val.DamagePlayer(35, 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) { return; } base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner) { if (!isInterrupted) { isInterrupted = true; } if (base.enemyHP <= 0 && !base.isEnemyDead) { ((MonoBehaviour)this).StopCoroutine(AttackPlayer()); ((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(2465087548u, 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, 2465087548u, 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 PlayerHitClientRpc() { //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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) 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(3940003198u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3940003198u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("HitClientRPC"); PlayerControllerB targetPlayer = base.targetPlayer; if ((Object)(object)targetPlayer != (Object)null) { LogIfDebugBuild("hit player!"); timeSinceHittingLocalPlayer = 0f; targetPlayer.DamagePlayer(10, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } } [ClientRpc] public void StopPlayerClientRpc() { //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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2339122007u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2339122007u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("StopPlayerClientRpc"); PlayerControllerB targetPlayer = base.targetPlayer; if ((Object)(object)targetPlayer != (Object)null) { targetPlayer.disableInteract = true; targetPlayer.disableMoveInput = true; targetPlayer.voiceMuffledByEnemy = true; targetPlayer.DropAllHeldItems(true, false); } } } [ClientRpc] public void ReleasePlayerClientRpc() { //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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(764387371u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 764387371u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("ReleasePlayerClientRpc"); PlayerControllerB targetPlayer = base.targetPlayer; if ((Object)(object)targetPlayer != (Object)null) { targetPlayer.disableInteract = false; targetPlayer.disableMoveInput = false; targetPlayer.voiceMuffledByEnemy = false; targetPlayer.redirectToEnemy = null; } } } [ClientRpc] public void DragPlayerClientRpc() { //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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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(2824170838u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2824170838u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("DragPlayerClientRpc"); PlayerControllerB val3 = attackedPlayer; if (!val3.isPlayerDead) { val3.SpawnDeadBody(((Object)val3).GetInstanceID(), Vector3.zero, 5, val3, 0, (Transform)null, default(Vector3)); } if ((Object)(object)val3.deadBody != (Object)null) { playerParent = ((Component)val3.deadBody).transform.parent; val3.deadBody.speedMultiplier = 0f; val3.deadBody.physicsParent = assParent; val3.deadBody.maxVelocity = 0f; ((Component)val3.deadBody).transform.SetParent(assParent); val3.deadBody.canBeGrabbedBackByPlayers = false; } } } [ClientRpc] public void DropPlayerClientRpc() { //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) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2048597459u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2048597459u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB val3 = attackedPlayer; if ((Object)(object)val3.deadBody != (Object)null) { ((Component)val3.deadBody).transform.SetParent(playerParent); val3.deadBody.canBeGrabbedBackByPlayers = true; val3.playerRigidbody.mass = 1f; } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_BrolyAI() { //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 NetworkManager.__rpc_func_table.Add(2465087548u, new RpcReceiveHandler(__rpc_handler_2465087548)); NetworkManager.__rpc_func_table.Add(3940003198u, new RpcReceiveHandler(__rpc_handler_3940003198)); NetworkManager.__rpc_func_table.Add(2339122007u, new RpcReceiveHandler(__rpc_handler_2339122007)); NetworkManager.__rpc_func_table.Add(764387371u, new RpcReceiveHandler(__rpc_handler_764387371)); NetworkManager.__rpc_func_table.Add(2824170838u, new RpcReceiveHandler(__rpc_handler_2824170838)); NetworkManager.__rpc_func_table.Add(2048597459u, new RpcReceiveHandler(__rpc_handler_2048597459)); } private static void __rpc_handler_2465087548(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; ((BrolyAI)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3940003198(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; ((BrolyAI)(object)target).PlayerHitClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2339122007(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; ((BrolyAI)(object)target).StopPlayerClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_764387371(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; ((BrolyAI)(object)target).ReleasePlayerClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2824170838(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; ((BrolyAI)(object)target).DragPlayerClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2048597459(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; ((BrolyAI)(object)target).DropPlayerClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "BrolyAI"; } } [BepInPlugin("FrenchPlatypus.CustomEnnemies", "CustomEnnemies", "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 = "modassets"; 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>("RandyOrton"); TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("RandyOrtonTN"); TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("RandyOrtonTK"); EnemyType val4 = ModAssets.LoadAsset<EnemyType>("Broly"); TerminalNode val5 = ModAssets.LoadAsset<TerminalNode>("BrolyTN"); TerminalKeyword val6 = ModAssets.LoadAsset<TerminalKeyword>("BrolyTK"); Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int> { { (LevelTypes)(-1), 150 }, { (LevelTypes)1024, 150 } }; Dictionary<LevelTypes, int> dictionary2 = new Dictionary<LevelTypes, int> { { (LevelTypes)(-1), 150 }, { (LevelTypes)1024, 150 } }; NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); NetworkPrefabs.RegisterNetworkPrefab(val4.enemyPrefab); Enemies.RegisterEnemy(val, dictionary, (Dictionary<string, int>)null, val2, val3); Enemies.RegisterEnemy(val4, dictionary2, (Dictionary<string, int>)null, val5, val6); Logger.LogInfo((object)"Plugin FrenchPlatypus.CustomEnnemies 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); } } } } } internal class RandyOrtonAI : EnemyAI { private enum State { SearchingForPlayer, ChasePlayerRko, ChasePlayerPuntKick, RkoInProgress, PuntKickInProgress, PuntKickNoSound, Pin } 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; private bool isAgressive; private float puntKickTimer; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_0058: 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_0093: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); LogIfDebugBuild("Example Enemy Spawned"); timeSinceHittingLocalPlayer = 0f; base.creatureVoice.mute = false; 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_00b7: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) ((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; } if (puntKickTimer > 0f) { puntKickTimer -= Time.deltaTime; } } public override void DoAIInterval() { //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0328: 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_0380: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0269: 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) ((EnemyAI)this).DoAIInterval(); if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } switch (base.currentBehaviourStateIndex) { case 0: if (FoundClosestPlayerInRange(15f) && (Object)(object)base.targetPlayer != (Object)null) { if (base.targetPlayer.health <= 90 || isAgressive) { LogIfDebugBuild("Start Target Player For PuntKick"); ((EnemyAI)this).StopSearch(base.currentSearch, true); base.creatureVoice.mute = true; ((EnemyAI)this).SwitchToBehaviourClientRpc(2); base.creatureAnimator.SetTrigger("puntKickChase"); } else if (!base.targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f)) { LogIfDebugBuild("Start Target Player For Rko"); ((EnemyAI)this).StopSearch(base.currentSearch, true); base.creatureVoice.mute = true; ((EnemyAI)this).SwitchToBehaviourClientRpc(1); base.creatureAnimator.SetTrigger("rkoChase"); } } break; case 1: base.agent.speed = 10f; if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 25f && !((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); base.creatureVoice.mute = false; base.creatureAnimator.SetTrigger("startWalk"); } else if (base.targetPlayer.health <= 90 || isAgressive) { LogIfDebugBuild("Player is down under 50 hp"); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); base.creatureAnimator.SetTrigger("puntKickChase"); } else if (base.targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f)) { LogIfDebugBuild("Player target has sight on Randy"); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); base.creatureVoice.mute = false; base.creatureAnimator.SetTrigger("startWalk"); } else { ChasePlayerRko(); } break; case 2: base.agent.speed = 15f; if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 25f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)) || (base.targetPlayer.health > 90 && !isAgressive)) { LogIfDebugBuild("Stop Target Player"); isAgressive = false; ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); base.creatureVoice.mute = false; base.creatureAnimator.SetTrigger("startWalk"); } else { ChasePlayerPuntKick(); } break; case 3: base.agent.speed = 0f; break; case 4: case 5: base.agent.speed = 2f; break; case 6: base.agent.speed = 0f; break; default: LogIfDebugBuild("This Behavior State doesn't exist!"); break; } } private bool FoundClosestPlayerInRange(float range) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) base.mostOptimalDistance = range; base.targetPlayer = null; PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(45f, 60, base.eye, -1f, -1); if (allPlayersInLineOfSight != null) { for (int i = 0; i < allPlayersInLineOfSight.Length; i++) { if (!allPlayersInLineOfSight[i].HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f) || allPlayersInLineOfSight[i].health <= 90 || isAgressive) { base.targetPlayer = allPlayersInLineOfSight[i]; break; } } } base.agent.speed = 6f; for (int j = 0; j < StartOfRound.Instance.connectedPlayersAmount + 1; j++) { if (StartOfRound.Instance.allPlayerScripts[j].HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f)) { base.agent.speed = 2.5f; } } return (Object)(object)base.targetPlayer != (Object)null; } 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 ChasePlayerRko() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner) { StalkPos = ((Component)base.targetPlayer).transform.position; ((EnemyAI)this).SetDestinationToPosition(StalkPos, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 3.5f) { ((MonoBehaviour)this).StartCoroutine(RkoAttack()); } } } private void ChasePlayerPuntKick() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) LogIfDebugBuild("TEST V1"); if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner) { StalkPos = ((Component)base.targetPlayer).transform.position; ((EnemyAI)this).SetDestinationToPosition(StalkPos, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 4.5f) { ((MonoBehaviour)this).StartCoroutine(PuntKick()); } } } private IEnumerator RkoAttack() { ((EnemyAI)this).SwitchToBehaviourClientRpc(3); StalkPos = ((Component)base.targetPlayer).transform.position; ((EnemyAI)this).SetDestinationToPosition(StalkPos, false); if (!base.isEnemyDead) { DoAnimationClientRpc("rko"); StopPlayerClientRpc(); yield return (object)new WaitForSeconds(0.5f); RkoAttackHitClientRpc(); yield return (object)new WaitForSeconds(1.2f); DoAnimationClientRpc("pin"); ((EnemyAI)this).SwitchToBehaviourClientRpc(6); yield return (object)new WaitForSeconds(3f); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); base.creatureVoice.mute = false; base.creatureAnimator.SetTrigger("startWalk"); } } private IEnumerator PuntKick() { if (puntKickTimer <= 0f) { ((EnemyAI)this).SwitchToBehaviourClientRpc(4); puntKickTimer = 7f; } else { ((EnemyAI)this).SwitchToBehaviourClientRpc(5); } StalkPos = ((Component)base.targetPlayer).transform.position; ((EnemyAI)this).SetDestinationToPosition(StalkPos, false); if (!base.isEnemyDead) { DoAnimationClientRpc("puntKick"); yield return (object)new WaitForSeconds(0.2f); if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 3f) { PuntKickHitClientRpc(); yield return (object)new WaitForSeconds(1.2f); DoAnimationClientRpc("pin"); ((EnemyAI)this).SwitchToBehaviourClientRpc(6); yield return (object)new WaitForSeconds(3f); } else { yield return (object)new WaitForSeconds(2f); } ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); base.creatureVoice.mute = false; base.creatureAnimator.SetTrigger("startWalk"); } } public override void OnCollideWithPlayer(Collider other) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (!(timeSinceHittingLocalPlayer < 1f)) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)base.targetPlayer) { LogIfDebugBuild("Example Enemy Collision with Player!"); timeSinceHittingLocalPlayer = 0f; val.DamagePlayer(100, 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) { return; } base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner) { if (!isAgressive) { isAgressive = true; ((EnemyAI)this).StopSearch(base.currentSearch, true); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); base.creatureAnimator.SetTrigger("puntKickChase"); } if (base.enemyHP <= 0 && !base.isEnemyDead) { isAgressive = false; ((MonoBehaviour)this).StopCoroutine(RkoAttack()); ((MonoBehaviour)this).StopCoroutine(PuntKick()); ((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(1990886759u, 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, 1990886759u, 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 RkoAttackHitClientRpc() { //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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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) 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(3306650752u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3306650752u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("RkoAttackHitClientRPC"); PlayerControllerB targetPlayer = base.targetPlayer; if ((Object)(object)targetPlayer != (Object)null) { LogIfDebugBuild("Rko hit player!"); timeSinceHittingLocalPlayer = 0f; targetPlayer.causeOfDeath = (CauseOfDeath)4; targetPlayer.DamagePlayer(400, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); targetPlayer.disableMoveInput = false; targetPlayer.voiceMuffledByEnemy = false; targetPlayer.disableLookInput = false; targetPlayer.redirectToEnemy = null; } } } [ClientRpc] public void PuntKickHitClientRpc() { //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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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(958143706u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 958143706u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("PuntKickHitClientRPC"); PlayerControllerB targetPlayer = base.targetPlayer; if ((Object)(object)targetPlayer != (Object)null) { LogIfDebugBuild("punt kick hit player!"); timeSinceHittingLocalPlayer = 0f; targetPlayer.causeOfDeath = (CauseOfDeath)12; targetPlayer.DamagePlayer(400, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); isAgressive = false; } } } [ClientRpc] public void StopPlayerClientRpc() { //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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) 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(2906416028u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2906416028u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("StopPlayerClientRpc"); PlayerControllerB targetPlayer = base.targetPlayer; if ((Object)(object)targetPlayer != (Object)null) { Vector3 val3 = ((Component)this).transform.position - ((Component)targetPlayer).transform.position; Quaternion val4 = Quaternion.LookRotation(val3, Vector3.up); targetPlayer.redirectToEnemy = (EnemyAI)(object)this; targetPlayer.syncFullCameraRotation = ((Quaternion)(ref val4)).eulerAngles; targetPlayer.ForceTurnTowardsTarget(); targetPlayer.disableMoveInput = true; targetPlayer.voiceMuffledByEnemy = true; targetPlayer.disableLookInput = true; } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_RandyOrtonAI() { //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 NetworkManager.__rpc_func_table.Add(1990886759u, new RpcReceiveHandler(__rpc_handler_1990886759)); NetworkManager.__rpc_func_table.Add(3306650752u, new RpcReceiveHandler(__rpc_handler_3306650752)); NetworkManager.__rpc_func_table.Add(958143706u, new RpcReceiveHandler(__rpc_handler_958143706)); NetworkManager.__rpc_func_table.Add(2906416028u, new RpcReceiveHandler(__rpc_handler_2906416028)); } private static void __rpc_handler_1990886759(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; ((RandyOrtonAI)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3306650752(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; ((RandyOrtonAI)(object)target).RkoAttackHitClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_958143706(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; ((RandyOrtonAI)(object)target).PuntKickHitClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2906416028(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; ((RandyOrtonAI)(object)target).StopPlayerClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "RandyOrtonAI"; } } public static class PluginInfo { public const string PLUGIN_GUID = "FrenchPlatypus.CustomEnnemies"; public const string PLUGIN_NAME = "CustomEnnemies"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace CustomEnnemies.Configuration { public class PluginConfig { public ConfigEntry<int> SpawnWeight; public PluginConfig(ConfigFile cfg) { SpawnWeight = cfg.Bind<int>("General", "Spawn weight", 150, "The spawn chance weight for RandyOrton, 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 FrenchPlatypus.CustomEnnemies.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }