#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 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 = ".NET Standard 2.1")] [assembly: AssemblyCompany("FrenchPlatypus.BrolyCulo")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FrenchPlatypus.BrolyCulo")] [assembly: AssemblyTitle("FrenchPlatypus.BrolyCulo")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 CustomEnnemies { internal class BrolyAI : EnemyAI { public Transform turnCompass = null; public Transform attackArea = null; public Transform assParent = null; public Transform playerParent = null; public AudioSource stepSound = null; private float timeSinceHittingLocalPlayer; private float timeSinceNewRandPos; private Vector3 positionRandomness; private Vector3 spawnPos; private Random enemyRandom = null; private bool isDeadAnimationDone; private bool attackingPlayer; private bool isInterrupted; private float fleaTimer; private Coroutine attackingPlayerCoroutine; private Ray playerRay; public bool carryingPlayerBody; private Vector3 targetLastPos; public DeadBodyInfo bodyBeingCarried; private FlowermanAI flowermanTarget = null; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_0065: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); LogIfDebugBuild("Broly Spawned"); LogIfDebugBuild("Is Host : " + ((NetworkBehaviour)this).IsServer); timeSinceHittingLocalPlayer = 0f; timeSinceNewRandPos = 0f; DoAnimationClientRpc("startWalk"); positionRandomness = new Vector3(0f, 0f, 0f); base.agent.acceleration = 15f; base.agent.angularSpeed = 1000f; spawnPos = ((Component)this).transform.position; enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); isDeadAnimationDone = false; MuteVoiceClientRpc(mute: true); MuteStepsClientRpc(mute: false); base.currentBehaviourStateIndex = 0; ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } public override void Update() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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; MuteVoiceClientRpc(mute: true); MuteStepsClientRpc(mute: true); DoAnimationClientRpc("killEnemy"); PlayDeathSoundClientRpc(); } return; } int currentBehaviourStateIndex = base.currentBehaviourStateIndex; if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex == 1) { ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); 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 (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 2f) { ((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position, 3f * Time.deltaTime); } } if (base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; } if (fleaTimer > 0f) { fleaTimer -= Time.deltaTime; } } public override void OnGainedOwnership() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnGainedOwnership(); if (((NetworkBehaviour)this).IsOwner) { LogIfDebugBuild("Get ownership"); if (base.currentBehaviourStateIndex == 0) { LogIfDebugBuild("restart search coroutine"); DoAnimationClientRpc("startWalk"); MuteVoiceClientRpc(mute: true); MuteStepsClientRpc(mute: false); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } if (base.currentBehaviourStateIndex == 1) { FoundClosestPlayerInRange(20f, 4f); } } } public override void DoAIInterval() { //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: 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_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0246: 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 = 2.5f; if (!((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsOwner) { LogIfDebugBuild("Set Ownership back to : " + StartOfRound.Instance.allPlayerScripts[0].playerUsername); ((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId); } else if (FoundBrackenInMap() && (Object)(object)flowermanTarget != (Object)null) { LogIfDebugBuild("found bracken"); DoAnimationClientRpc("chaseBracken"); ((EnemyAI)this).SwitchToBehaviourState(2); MuteStepsClientRpc(mute: true); MuteVoiceClientRpc(mute: true); } else if (FoundClosestPlayerInRange(20f, 4f) && (Object)(object)base.targetPlayer != (Object)null) { LogIfDebugBuild("chasing Player : " + base.targetPlayer.playerUsername); DoAnimationClientRpc("chasePlayer"); ((EnemyAI)this).SwitchToBehaviourState(1); MuteStepsClientRpc(mute: true); MuteVoiceClientRpc(mute: false); } break; case 1: base.agent.speed = 7f; if ((Object)(object)base.targetPlayer == (Object)null) { FoundClosestPlayerInRange(20f, 4f); } if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.targetPlayer != (Object)null && (Object)(object)base.targetPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController) { ((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId); } if ((Object)(object)base.targetPlayer == (Object)null || FoundBrackenInMap() || (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); DoAnimationClientRpc("startWalk"); ((EnemyAI)this).SwitchToBehaviourState(0); MuteStepsClientRpc(mute: false); MuteVoiceClientRpc(mute: true); } break; case 2: base.agent.speed = 15f; if ((Object)(object)flowermanTarget == (Object)null || ((EnemyAI)flowermanTarget).isEnemyDead) { LogIfDebugBuild("Stop Target Bracken"); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); DoAnimationClientRpc("startWalk"); ((EnemyAI)this).SwitchToBehaviourState(0); MuteVoiceClientRpc(mute: true); MuteStepsClientRpc(mute: false); } else { ((EnemyAI)this).SetDestinationToPosition(((Component)flowermanTarget).transform.position, false); } break; case 3: case 4: base.agent.speed = 2f; break; case 5: base.agent.speed = 15f; if (fleaTimer <= 0f || Vector3.Distance(((Component)this).transform.position, spawnPos) < 1f) { fleaTimer = 0f; LogIfDebugBuild("Stop fleeing"); if (carryingPlayerBody) { DropPlayerBody(); DropPlayerBodyServerRpc(); } ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); DoAnimationClientRpc("startWalk"); ((EnemyAI)this).SwitchToBehaviourState(0); MuteVoiceClientRpc(mute: true); MuteStepsClientRpc(mute: false); } break; } } private bool FoundBrackenInMap() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) flowermanTarget = null; base.mostOptimalDistance = 2000f; FlowermanAI[] array = Object.FindObjectsOfType(); if (array.Length != 0) { for (int i = 0; i < array.Length; i++) { if (!((EnemyAI)array[i]).isEnemyDead && Vector3.Distance(((Component)this).transform.position, ((Component)array[i]).transform.position) < base.mostOptimalDistance) { flowermanTarget = array[i]; base.mostOptimalDistance = Vector3.Distance(((Component)this).transform.position, ((Component)array[i]).transform.position); break; } } return (Object)(object)flowermanTarget != (Object)null; } return false; } private bool FoundClosestPlayerInRange(float range, float senseRange) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) base.targetPlayer = null; float num = float.MaxValue; if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { return false; } for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; if ((Object)(object)val == (Object)null || !val.isPlayerControlled || val.isPlayerDead) { continue; } float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (num2 < range && ((EnemyAI)this).CheckLineOfSightForPosition(((Component)val.gameplayCamera).transform.position, 70f, 60, -1f, (Transform)null)) { if (num2 < num) { num = num2; base.targetPlayer = val; } } else if (num2 < senseRange && num2 < num) { num = num2; base.targetPlayer = val; } } return (Object)(object)base.targetPlayer != (Object)null; } [ServerRpc(RequireOwnership = false)] public void DropPlayerBodyServerRpc() { DropPlayerBodyClientRpc(); } [ClientRpc] public void DropPlayerBodyClientRpc() { DropPlayerBody(); } private void DropPlayerBody() { if (carryingPlayerBody) { LogIfDebugBuild("Drop player body : " + bodyBeingCarried.playerScript.playerUsername); carryingPlayerBody = false; bodyBeingCarried.matchPositionExactly = false; bodyBeingCarried.attachedTo = null; bodyBeingCarried = null; } } private IEnumerator FleaPlayer(bool carryingBody = true) { LogIfDebugBuild("Flea player"); if (attackingPlayerCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(attackingPlayerCoroutine); } base.inSpecialAnimation = false; attackingPlayer = false; DoAnimationClientRpc("startWalk"); MuteVoiceClientRpc(mute: true); MuteStepsClientRpc(mute: true); fleaTimer = 8f; if ((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null) { LogIfDebugBuild("Release player : " + base.inSpecialAnimationWithPlayer.playerUsername); base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = false; base.inSpecialAnimationWithPlayer.snapToServerPosition = false; base.inSpecialAnimationWithPlayer.inAnimationWithEnemy = null; if (carryingBody && (Object)(object)base.inSpecialAnimationWithPlayer.deadBody != (Object)null) { bodyBeingCarried = base.inSpecialAnimationWithPlayer.deadBody; bodyBeingCarried.attachedTo = assParent; bodyBeingCarried.attachedLimb = base.inSpecialAnimationWithPlayer.deadBody.bodyParts[0]; bodyBeingCarried.matchPositionExactly = true; carryingPlayerBody = true; } } if (carryingBody) { yield return (object)new WaitForSeconds(1f); } if (((NetworkBehaviour)this).IsOwner) { ((Behaviour)base.agent).enabled = true; base.isClientCalculatingAI = true; } ((EnemyAI)this).SwitchToBehaviourState(5); ((EnemyAI)this).SetDestinationToPosition(spawnPos, false); } [ServerRpc(RequireOwnership = false)] private void AttackPlayerServerRpc(int playerObjectId) { //IL_0068: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if (!attackingPlayer && !carryingPlayerBody) { isInterrupted = false; attackingPlayer = true; base.inSpecialAnimation = true; base.isClientCalculatingAI = false; base.inSpecialAnimationWithPlayer = StartOfRound.Instance.allPlayerScripts[playerObjectId]; base.inSpecialAnimationWithPlayer.inAnimationWithEnemy = (EnemyAI)(object)this; ((Component)this).transform.position = new Vector3(((Component)base.inSpecialAnimationWithPlayer).transform.position.x, ((Component)base.inSpecialAnimationWithPlayer).transform.position.y + 0.5f, ((Component)base.inSpecialAnimationWithPlayer).transform.position.z); AttackPlayerClientRpc(playerObjectId); } } [ClientRpc] private void AttackPlayerClientRpc(int playerObjectId) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00b3: 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_00bc: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_0199: 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_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) LogIfDebugBuild("attack CLIENT rpc"); isInterrupted = false; LogIfDebugBuild("attack test"); base.inSpecialAnimationWithPlayer = StartOfRound.Instance.allPlayerScripts[playerObjectId]; base.inSpecialAnimationWithPlayer.inAnimationWithEnemy = (EnemyAI)(object)this; ((Component)this).transform.position = new Vector3(((Component)base.inSpecialAnimationWithPlayer).transform.position.x, ((Component)base.inSpecialAnimationWithPlayer).transform.position.y + 0.5f, ((Component)base.inSpecialAnimationWithPlayer).transform.position.z); ((EnemyAI)this).SyncPositionToClients(); base.inSpecialAnimationWithPlayer.SyncBodyPositionWithClients(); base.inSpecialAnimationWithPlayer.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); base.inSpecialAnimationWithPlayer.voiceMuffledByEnemy = true; attackingPlayer = true; base.inSpecialAnimation = true; ((Behaviour)base.agent).enabled = false; base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = true; base.inSpecialAnimationWithPlayer.snapToServerPosition = true; Vector3 val = ((!((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(val, position - ((Component)base.inSpecialAnimationWithPlayer).transform.position); turnCompass.LookAt(val); position = ((Component)this).transform.eulerAngles; position.y = turnCompass.eulerAngles.y; ((Component)this).transform.eulerAngles = position; if (attackingPlayerCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(attackingPlayerCoroutine); } attackingPlayerCoroutine = ((MonoBehaviour)this).StartCoroutine(AttackPlayer()); } private IEnumerator AttackPlayer() { Vector3 endPosition = ((Ray)(ref playerRay)).GetPoint(1f); if (endPosition.y < -80f) { for (int i = 0; i < 15; i++) { yield return null; } ((Component)this).transform.position = endPosition; } DoAnimationClientRpc("attack"); ((EnemyAI)this).SwitchToBehaviourState(3); MuteStepsClientRpc(mute: true); MuteVoiceClientRpc(mute: true); yield return (object)new WaitForSeconds(0.1f); InterruptClientRpc(interrupt: false); int hitCount = 0; if (!((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null)) { yield break; } while (hitCount < 10 || (Object)(object)base.inSpecialAnimationWithPlayer.deadBody == (Object)null || !isInterrupted) { yield return (object)new WaitForSeconds(0.5f); base.inSpecialAnimationWithPlayer.DamagePlayer(15, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); hitCount++; LogIfDebugBuild("attacking : " + base.inSpecialAnimationWithPlayer.playerUsername + " - Hp : " + base.inSpecialAnimationWithPlayer.health + " - HitCount : " + hitCount); if (hitCount >= 10 || (Object)(object)base.inSpecialAnimationWithPlayer.deadBody != (Object)null || isInterrupted) { break; } yield return null; } if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)null || (Object)(object)base.inSpecialAnimationWithPlayer.deadBody == (Object)null) { ((MonoBehaviour)this).StartCoroutine(FleaPlayer(carryingBody: false)); yield break; } base.inSpecialAnimationWithPlayer.snapToServerPosition = false; base.inSpecialAnimationWithPlayer.deadBody.causeOfDeath = (CauseOfDeath)5; base.inSpecialAnimationWithPlayer.deadBody.bodyBleedingHeavily = true; ((MonoBehaviour)this).StartCoroutine(FleaPlayer()); } [ServerRpc(RequireOwnership = false)] private void AttackBrackenServerRpc(int flowermanId) { AttackBrackenClientRpc(flowermanId); } [ClientRpc] private void AttackBrackenClientRpc(int flowermanId) { } private IEnumerator AttackBracken() { LogIfDebugBuild("Attack Bracken"); ((EnemyAI)this).SwitchToBehaviourClientRpc(4); MuteStepsClientRpc(mute: true); MuteVoiceClientRpc(mute: false); yield return (object)new WaitForSeconds(4f); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); DoAnimationClientRpc("attack"); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); MuteVoiceClientRpc(mute: true); MuteStepsClientRpc(mute: false); } public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy = null) { ((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy); FlowermanAI componentInParent = ((Component)other).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && !((EnemyAI)componentInParent).isEnemyDead) { LogIfDebugBuild("Broly Collision with Bracken!"); ((EnemyAI)componentInParent).KillEnemyOnOwnerClient(false); ((MonoBehaviour)this).StartCoroutine(AttackBracken()); } } public override void OnCollideWithPlayer(Collider other) { ((EnemyAI)this).OnCollideWithPlayer(other); PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, attackingPlayer || carryingPlayerBody || fleaTimer > 0f, false); if ((Object)(object)val != (Object)null) { LogIfDebugBuild("Broly Collision with Player!"); if (((NetworkBehaviour)this).IsOwner) { AttackPlayerServerRpc((int)val.playerClientId); } } } public override void KillEnemy(bool destroy = false) { if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); } base.creatureSFX.Stop(); stepSound.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 (attackingPlayer && (Object)(object)base.inSpecialAnimationWithPlayer != (Object)null) { base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = false; base.inSpecialAnimationWithPlayer.snapToServerPosition = false; base.inSpecialAnimationWithPlayer.voiceMuffledByEnemy = 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; } if (!isInterrupted) { LogIfDebugBuild("Interrupt enemy"); InterruptClientRpc(interrupt: true); } if (base.currentBehaviourStateIndex == 0 && (Object)(object)playerWhoHit != (Object)null) { LogIfDebugBuild("Chase " + ((object)playerWhoHit).ToString() + " after being hit"); base.targetPlayer = playerWhoHit; DoAnimationClientRpc("chasePlayer"); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); MuteVoiceClientRpc(mute: false); MuteStepsClientRpc(mute: true); } base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0) { ((MonoBehaviour)this).StopCoroutine(base.searchCoroutine); if (attackingPlayerCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(attackingPlayerCoroutine); } MuteVoiceClientRpc(mute: false); MuteStepsClientRpc(mute: true); ((EnemyAI)this).KillEnemyOnOwnerClient(false); } } [ClientRpc] public void InterruptClientRpc(bool interrupt) { isInterrupted = interrupt; } [ServerRpc(RequireOwnership = false)] public void StartSearchServerRpc(Vector3 pos) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) StartSearchClientRpc(pos); } [ClientRpc] public void StartSearchClientRpc(Vector3 pos) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).StartSearch(pos, (AISearchRoutine)null); } [ServerRpc(RequireOwnership = false)] public void SetTargetPlayerServerRpc(int playerObjectId) { SetTargetPlayerClientRpc(playerObjectId); } [ClientRpc] public void SetTargetPlayerClientRpc(int playerObjectId) { base.targetPlayer = StartOfRound.Instance.allPlayerScripts[playerObjectId]; } [ClientRpc] public void PlayDeathSoundClientRpc() { base.creatureSFX.PlayOneShot(base.dieSFX); } [ClientRpc] public void MuteVoiceClientRpc(bool mute) { LogIfDebugBuild("Mute Voice : " + mute); base.creatureVoice.mute = mute; } [ClientRpc] public void MuteStepsClientRpc(bool mute) { LogIfDebugBuild("Mute Steps : " + mute); stepSound.mute = mute; } [ClientRpc] public void DoAnimationClientRpc(string animationName) { LogIfDebugBuild("Animation: " + animationName); base.creatureAnimator.SetTrigger(animationName); } } [BepInPlugin("FrenchPlatypus.BrolyCulo", "BrolyCulo", "1.2.1")] [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_broly"; 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("BrolyCulo"); TerminalNode val2 = ModAssets.LoadAsset("BrolyCuloTN"); TerminalKeyword val3 = ModAssets.LoadAsset("BrolyCuloTK"); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, val2, val3); Logger.LogInfo((object)"Plugin FrenchPlatypus.BrolyCulo is loaded!"); Logger.LogInfo((object)"KAKAROOOOOOOT!"); } 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 = "FrenchPlatypus.BrolyCulo"; public const string PLUGIN_NAME = "BrolyCulo"; public const string PLUGIN_VERSION = "1.2.1"; } } namespace CustomEnnemies.Configuration { public class PluginConfig { public ConfigEntry SpawnWeight; public PluginConfig(ConfigFile cfg) { SpawnWeight = cfg.Bind("General", "Spawn weight", 200, "The spawn chance weight for Broly, 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); if (property != null) { ((Dictionary)property.GetValue(cfg, null))?.Clear(); cfg.Save(); } } } }