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 ClassifiedArchives v1.0.0
Arrhythmia.dll
Decompiled 6 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Arrhythmia.NetcodePatcher; using BepInEx; using GameNetcodeStuff; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; [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("Arrhythmia")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Arrhythmia")] [assembly: AssemblyTitle("Arrhythmia")] [assembly: AssemblyVersion("1.0.0.0")] [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; } } } public class ArrhythmiaAI : EnemyAI { [CompilerGenerated] private sealed class <MoveThenProvoke>d__24 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NutcrackerEnemyAI nut; public Vector3 targetPosition; public int playerClientId; public ArrhythmiaAI <>4__this; private float <timeout>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MoveThenProvoke>d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_009e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)nut == (Object)null || ((EnemyAI)nut).isEnemyDead) { return false; } ((EnemyAI)nut).agent.SetDestination(targetPosition); ((EnemyAI)nut).agent.isStopped = false; <timeout>5__1 = 10f; break; case 1: <>1__state = -1; break; } if ((Object)(object)nut != (Object)null && !((EnemyAI)nut).isEnemyDead && Vector3.Distance(((Component)nut).transform.position, targetPosition) > 2f && <timeout>5__1 > 0f) { <timeout>5__1 -= 0.5f; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } if ((Object)(object)nut != (Object)null && !((EnemyAI)nut).isEnemyDead) { nut.SeeMovingThreatServerRpc(playerClientId, true); nut.SwitchTargetServerRpc(playerClientId); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Composants & Assets")] public Light eyeLight = null; public Transform heartContainer = null; public GameObject heartScrapPrefab = null; public AudioClip failureSound = null; [Header("Paramètres d'Équilibrage")] public float damageRequiredForHeart = 100f; public float effectRange = 15f; public float searchInterval = 4f; private float spawnProtectionTimer = 3f; private float totalDamageDealt = 0f; private GrabbableObject internalHeart = null; private PlayerControllerB? targetedPlayer; private bool heartIsExtractable = false; private int damageAccumulator = 1; private Volume customVolume = null; private Vignette vignette = null; private Exposure exposure = null; private ChromaticAberration chromatic = null; private float searchTimer = 0f; public override void Start() { ((EnemyAI)this).Start(); base.agent.speed = 0f; base.agent.angularSpeed = 0f; SetupCustomVolume(); if (((NetworkBehaviour)this).IsServer) { SpawnHeartInside(); } if ((Object)(object)eyeLight != (Object)null) { ((Behaviour)eyeLight).enabled = false; eyeLight.intensity = 500f; } base.enemyHP = 999; } private void SpawnHeartInside() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)heartScrapPrefab == (Object)null)) { GameObject val = Object.Instantiate<GameObject>(heartScrapPrefab, heartContainer.position, heartContainer.rotation, RoundManager.Instance.spawnedScrapContainer); NetworkObject component = val.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null) { component.Spawn(false); } internalHeart = val.GetComponent<GrabbableObject>(); if ((Object)(object)internalHeart != (Object)null) { internalHeart.SetScrapValue(120); internalHeart.itemProperties.isScrap = true; internalHeart.itemProperties.saveItemVariable = true; val.transform.SetParent(heartContainer); internalHeart.grabbable = false; internalHeart.isInFactory = true; } } } public override void Update() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_014f: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (base.isEnemyDead) { return; } if (spawnProtectionTimer > 0f) { spawnProtectionTimer -= Time.deltaTime; return; } CheckHeartStatus(); HandleGazeLogic(); if ((Object)(object)targetedPlayer != (Object)null) { Vector3 val = ((Component)targetedPlayer).transform.position - ((Component)this).transform.position; val.y = 0f; if (val != Vector3.zero) { ((Component)this).transform.rotation = Quaternion.LookRotation(val); } } PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false); if (!((Object)(object)closestPlayer != (Object)null)) { return; } bool flag = false; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (val2.isPlayerControlled && IsVisibleToAnyPlayer()) { flag = true; break; } } if (!flag) { Vector3 val3 = ((Component)closestPlayer).transform.position - ((Component)this).transform.position; val3.y = 0f; if (val3 != Vector3.zero) { ((Component)this).transform.rotation = Quaternion.LookRotation(val3); } } } private void HandleGazeLogic() { bool flag = false; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (base.isEnemyDead) { return; } if (localPlayerController.isPlayerControlled && !localPlayerController.isPlayerDead && IsLookingAtMe(localPlayerController)) { flag = true; targetedPlayer = localPlayerController; if (!((Behaviour)eyeLight).enabled) { ((Behaviour)eyeLight).enabled = true; } UpdatePlayerVisuals(localPlayerController); searchTimer = 0f; } if (!flag && (Object)(object)targetedPlayer == (Object)(object)localPlayerController) { ResetPlayerVisuals(localPlayerController); ((Behaviour)eyeLight).enabled = false; if (!IsVisibleToAnyPlayer()) { TeleportToShadows(); } targetedPlayer = null; } if (!((Object)(object)targetedPlayer == (Object)null)) { return; } searchTimer += Time.deltaTime; if (searchTimer >= searchInterval) { if (!IsVisibleToAnyPlayer()) { TeleportToShadows(); } searchTimer = 0f; } } private void CheckHeartStatus() { if (!base.isEnemyDead && ((Object)(object)internalHeart == (Object)null || (Object)(object)((Component)internalHeart).transform.parent != (Object)(object)heartContainer || internalHeart.isHeld)) { PlayerControllerB val = null; val = ((!((Object)(object)internalHeart != (Object)null) || !((Object)(object)internalHeart.playerHeldBy != (Object)null)) ? ((EnemyAI)this).GetClosestPlayer(false, false, false) : internalHeart.playerHeldBy); KillEnemyWithVisuals(); if ((Object)(object)val != (Object)null) { ProvokeAllNutcrackersServerRpc((int)val.playerClientId); } } } [ServerRpc] public void ProvokeAllNutcrackersServerRpc(int playerClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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 //IL_0134: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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) 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(1332609413u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerClientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1332609413u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } NutcrackerEnemyAI[] array = Object.FindObjectsOfType<NutcrackerEnemyAI>(); NutcrackerEnemyAI[] array2 = array; foreach (NutcrackerEnemyAI val3 in array2) { GameObject val4 = null; float num = float.PositiveInfinity; Vector3 position = ((Component)val3).transform.position; GameObject[] insideAINodes = RoundManager.Instance.insideAINodes; foreach (GameObject val5 in insideAINodes) { float num2 = Vector3.Distance(position, val5.transform.position); if (num2 < num) { num = num2; val4 = val5; } } if ((Object)(object)val4 != (Object)null) { ((MonoBehaviour)this).StartCoroutine(MoveThenProvoke(val3, val4.transform.position, playerClientId)); } } } [IteratorStateMachine(typeof(<MoveThenProvoke>d__24))] private IEnumerator MoveThenProvoke(NutcrackerEnemyAI nut, Vector3 targetPosition, int playerClientId) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MoveThenProvoke>d__24(0) { <>4__this = this, nut = nut, targetPosition = targetPosition, playerClientId = playerClientId }; } private void KillEnemyWithVisuals() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!base.isEnemyDead) { base.isEnemyDead = true; if ((Object)(object)base.dieSFX != (Object)null) { AudioSource.PlayClipAtPoint(base.dieSFX, ((Component)this).transform.position, 3f); } if ((Object)(object)eyeLight != (Object)null) { ((Behaviour)eyeLight).enabled = false; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null) { ResetPlayerVisuals(localPlayerController); } ((Behaviour)base.agent).enabled = false; ((EnemyAI)this).KillEnemyServerRpc(false); } } [ClientRpc] private void NotifyHeartReadyClientRpc() { //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(462041426u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 462041426u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { internalHeart.grabbable = true; } } } private void TeleportToShadows() { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_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_008e: 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) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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) if (base.isEnemyDead || !((NetworkBehaviour)this).IsServer) { return; } List<Vector3> list = new List<Vector3>(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; NavMeshHit val3 = default(NavMeshHit); foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerControlled || val.isPlayerDead || !val.isInsideFactory) { continue; } for (int j = 0; j < 5; j++) { Vector3 val2 = ((Component)val).transform.position + Random.insideUnitSphere * 15f; val2.y = ((Component)val).transform.position.y; if (NavMesh.SamplePosition(val2, ref val3, 10f, -1) && !IsPositionVisibleToAnyPlayer(((NavMeshHit)(ref val3)).position)) { list.Add(((NavMeshHit)(ref val3)).position); } } } if (list.Count > 0) { Vector3 val4 = list[Random.Range(0, list.Count)]; base.agent.Warp(val4); base.serverPosition = val4; } } private bool IsVisibleToAnyPlayer() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return IsPositionVisibleToAnyPlayer(((Component)this).transform.position + Vector3.up); } private bool IsPositionVisibleToAnyPlayer(Vector3 pos) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerControlled && !val.isPlayerDead) { Vector3 val2 = val.gameplayCamera.WorldToViewportPoint(pos); if (val2.z > 0f && val2.x > 0f && val2.x < 1f && val2.y > 0f && val2.y < 1f && !Physics.Linecast(((Component)val.gameplayCamera).transform.position, pos, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { return true; } } } return false; } private void UpdatePlayerVisuals(PlayerControllerB lp) { //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)lp != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { AudioLowPassFilter val = ((Component)lp.gameplayCamera).GetComponentInChildren<AudioLowPassFilter>(); if ((Object)(object)val == (Object)null) { val = ((Component)lp.gameplayCamera).gameObject.AddComponent<AudioLowPassFilter>(); } ((Behaviour)val).enabled = true; val.cutoffFrequency = Mathf.Lerp(2000f, 250f, 1f); if ((Object)(object)customVolume != (Object)null) { customVolume.weight = 1f; float num = Mathf.Clamp(1f, 0f, 1f); ((VolumeParameter<float>)(object)vignette.intensity).value = num * 0.6f; ((VolumeParameter<float>)(object)chromatic.intensity).value = num * 1.5f; ((VolumeParameter<float>)(object)exposure.fixedExposure).value = Mathf.Lerp(0f, -4f, num); } HUDManager.Instance.ShakeCamera((ScreenShakeType)3); lp.JumpToFearLevel(1f, true); lp.DamagePlayer(damageAccumulator, true, true, (CauseOfDeath)16, 0, false, default(Vector3)); totalDamageDealt += damageAccumulator; if (totalDamageDealt >= damageRequiredForHeart && !heartIsExtractable) { internalHeart.grabbable = true; NotifyHeartReadyClientRpc(); } } } private void ResetPlayerVisuals(PlayerControllerB lp) { if (!((Object)(object)lp != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { if ((Object)(object)customVolume != (Object)null) { customVolume.weight = 0f; } AudioLowPassFilter componentInChildren = ((Component)lp.gameplayCamera).GetComponentInChildren<AudioLowPassFilter>(); if ((Object)(object)componentInChildren != (Object)null) { ((Behaviour)componentInChildren).enabled = false; } lp.JumpToFearLevel(0f, true); TeleportToShadows(); } } [ServerRpc(RequireOwnership = false)] private void ExtractSuccessServerRpc() { //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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2906188016u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2906188016u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ExtractSuccessClientRpc(); } } } [ClientRpc] private void ExtractSuccessClientRpc() { //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(169941772u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 169941772u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { base.isEnemyDead = true; if ((Object)(object)eyeLight != (Object)null) { ((Behaviour)eyeLight).enabled = false; } ((Behaviour)base.agent).enabled = false; ((Behaviour)this).enabled = false; ((EnemyAI)this).KillEnemyServerRpc(false); } } private bool IsLookingAtMe(PlayerControllerB player) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_002e: 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_003f: 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_006e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)eyeLight).transform.position - ((Component)player.gameplayCamera).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Vector3.Dot(((Component)player.gameplayCamera).transform.forward, normalized); if (num > 0.98f) { RaycastHit val2 = default(RaycastHit); if (Physics.Linecast(((Component)player.gameplayCamera).transform.position, ((Component)eyeLight).transform.position, ref val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && (Object)(object)((Component)((RaycastHit)(ref val2)).collider).gameObject.transform.root != (Object)(object)((Component)this).transform.root) { return false; } return true; } return false; } private void SetupCustomVolume() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("Arrhythmia"); customVolume = val.AddComponent<Volume>(); customVolume.isGlobal = true; customVolume.priority = 999f; customVolume.profile = ScriptableObject.CreateInstance<VolumeProfile>(); vignette = customVolume.profile.Add<Vignette>(false); ((VolumeParameter)vignette.intensity).overrideState = true; chromatic = customVolume.profile.Add<ChromaticAberration>(false); ((VolumeParameter)chromatic.intensity).overrideState = true; exposure = customVolume.profile.Add<Exposure>(false); ((VolumeParameter)exposure.fixedExposure).overrideState = true; } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ArrhythmiaAI() { //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(1332609413u, (RpcReceiveHandler)new RpcReceiveHandler(__rpc_handler_1332609413)); NetworkManager.__rpc_func_table.Add(462041426u, (RpcReceiveHandler)new RpcReceiveHandler(__rpc_handler_462041426)); NetworkManager.__rpc_func_table.Add(2906188016u, (RpcReceiveHandler)new RpcReceiveHandler(__rpc_handler_2906188016)); NetworkManager.__rpc_func_table.Add(169941772u, (RpcReceiveHandler)new RpcReceiveHandler(__rpc_handler_169941772)); } private static void __rpc_handler_1332609413(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_0070: 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_009d: 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 { int playerClientId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((ArrhythmiaAI)(object)target).ProvokeAllNutcrackersServerRpc(playerClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_462041426(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; ((ArrhythmiaAI)(object)target).NotifyHeartReadyClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2906188016(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ArrhythmiaAI)(object)target).ExtractSuccessServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_169941772(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; ((ArrhythmiaAI)(object)target).ExtractSuccessClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ArrhythmiaAI"; } } [BepInPlugin("mrkixcat.ArrhythmiaEnemy", "The Arrhythmia", "1.0.0")] public class ArrhythmiaPlugin : BaseUnityPlugin { private const string GUID = "mrkixcat.ArrhythmiaEnemy"; private const string NAME = "The Arrhythmia"; private const string VERSION = "1.0.0"; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"The Arrhythmia is waking up..."); NetcodePatcher(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"The Arrhythmia initialized. LLL will handle asset loading."); } private void NetcodePatcher() { 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.GetParameters().Length == 0) { methodInfo.Invoke(null, null); } } } } } namespace Arrhythmia.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
JammerAI.dll
Decompiled 6 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using JammerAI.NetcodePatcher; using Microsoft.CodeAnalysis; 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("JammerAI")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("JammerAI")] [assembly: AssemblyTitle("JammerAI")] [assembly: AssemblyVersion("1.0.0.0")] [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; } } } public class JammerAI : EnemyAI { [Header("Paramètres du Jammer")] public float patrolSpeed = 20f; public float huntSpeed = 10f; public float effectRange = 6f; public float lightDisableRange = 20f; public float burnRange = 2f; private bool playerInZone = false; private float flickerTimer = 0f; private float doorCooldown = 0f; private bool lightsAreOff = false; private GameObject currentLightTarget = null; [Header("Progression")] public float damageBoostPerLight = 5f; private float currentDamageBonus = 0f; public override void Start() { ((EnemyAI)this).Start(); base.agent.speed = patrolSpeed; flickerTimer = Random.Range(4f, 6f); } public override void DoAIInterval() { //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) //IL_0110: 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) ((EnemyAI)this).DoAIInterval(); currentLightTarget = FindClosestLightSource(); if ((Object)(object)currentLightTarget != (Object)null) { base.agent.speed = huntSpeed; ((EnemyAI)this).SetDestinationToPosition(currentLightTarget.transform.position, false); if (Vector3.Distance(((Component)this).transform.position, currentLightTarget.transform.position) < 2f) { SabotageLightSource(currentLightTarget); } GrabbableObject component = currentLightTarget.GetComponent<GrabbableObject>(); if ((Object)(object)component != (Object)null && component.isHeld) { base.targetPlayer = component.playerHeldBy; } else { base.targetPlayer = null; } return; } base.targetPlayer = null; base.agent.speed = patrolSpeed; if (!base.agent.hasPath || base.agent.remainingDistance < 2f) { Transform val = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, false, 0, false, 50, false); if ((Object)(object)val != (Object)null) { ((EnemyAI)this).SetDestinationToPosition(val.position, false); } } } public override void Update() { ((EnemyAI)this).Update(); if (!base.isEnemyDead) { ManageProximityLights(); GlobalLightFlicker(); ApplyProximityEffects(); CheckAndManipulateDoors(); base.stunNormalizedTimer = 0f; } } private GameObject FindClosestLightSource() { //IL_0162: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) GameObject result = null; float num = float.MaxValue; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerControlled || val.isPlayerDead) { continue; } GrabbableObject currentlyHeldObjectServer = val.currentlyHeldObjectServer; if (!((Object)(object)currentlyHeldObjectServer != (Object)null) || currentlyHeldObjectServer is LungProp) { continue; } Light componentInChildren = ((Component)currentlyHeldObjectServer).gameObject.GetComponentInChildren<Light>(); if ((Object)(object)componentInChildren != (Object)null && ((Behaviour)componentInChildren).enabled && componentInChildren.intensity > 0.01f) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (num2 < num) { num = num2; result = ((Component)currentlyHeldObjectServer).gameObject; } } } GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); GrabbableObject[] array2 = array; foreach (GrabbableObject val2 in array2) { if (val2 is LungProp || val2.isHeld) { continue; } Light componentInChildren2 = ((Component)val2).gameObject.GetComponentInChildren<Light>(); if ((Object)(object)componentInChildren2 != (Object)null && ((Behaviour)componentInChildren2).enabled && componentInChildren2.intensity > 0.01f) { float num3 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num3 < num) { num = num3; result = ((Component)val2).gameObject; } } } return result; } private void SabotageLightSource(GameObject lightObj) { GrabbableObject component = lightObj.GetComponent<GrabbableObject>(); if ((Object)(object)component == (Object)null) { return; } if (component.itemProperties.requiresBattery && component.insertedBattery != null) { component.insertedBattery.charge = 0f; component.insertedBattery.empty = true; FlashlightItem val = (FlashlightItem)(object)((component is FlashlightItem) ? component : null); if (val != null) { val.SwitchFlashlight(false); } else { component.UseItemOnClient(false); } currentDamageBonus += 5f; } else if (!(component is LungProp)) { Light[] componentsInChildren = ((Component)component).gameObject.GetComponentsInChildren<Light>(); Light[] array = componentsInChildren; foreach (Light val2 in array) { ((Behaviour)val2).enabled = false; } currentDamageBonus += 5f; } doorCooldown = 1.2f; currentLightTarget = null; } private void ApplyProximityEffects() { //IL_002d: 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_0092: 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) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null || localPlayerController.isPlayerDead) { return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position); if (num < effectRange) { playerInZone = true; if (!(num < burnRange)) { return; } int num2 = Mathf.RoundToInt((30f + currentDamageBonus) * Time.deltaTime); localPlayerController.DamagePlayer(num2, true, true, (CauseOfDeath)13, 0, false, default(Vector3)); GrabbableObject[] itemSlots = localPlayerController.ItemSlots; foreach (GrabbableObject val in itemSlots) { if (!((Object)(object)val == (Object)null) && !(val is LungProp)) { Light componentInChildren = ((Component)val).gameObject.GetComponentInChildren<Light>(false); if ((Object)(object)componentInChildren != (Object)null && ((Behaviour)componentInChildren).enabled) { SabotageLightSource(((Component)val).gameObject); break; } } } } else if (playerInZone) { playerInZone = false; } } private void ManageProximityLights() { //IL_0026: 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) bool flag = false; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerControlled && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < lightDisableRange) { flag = true; break; } } if (flag && !lightsAreOff) { RoundManager.Instance.FlickerLights(false, true); lightsAreOff = true; } else if (!flag && lightsAreOff) { RoundManager.Instance.FlickerLights(true, false); lightsAreOff = false; } } private void CheckAndManipulateDoors() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (doorCooldown > 0f) { doorCooldown -= Time.deltaTime; } Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 5f); Collider[] array2 = array; foreach (Collider val in array2) { DoorLock componentInParent = ((Component)val).gameObject.GetComponentInParent<DoorLock>(); if ((Object)(object)componentInParent != (Object)null) { componentInParent.OpenDoorAsEnemyServerRpc(); } if (doorCooldown <= 0f) { TerminalAccessibleObject componentInParent2 = ((Component)val).gameObject.GetComponentInParent<TerminalAccessibleObject>(); if ((Object)(object)componentInParent2 != (Object)null) { componentInParent2.SetDoorOpenServerRpc(Random.value > 0.5f); doorCooldown = 3f; } } } } private void GlobalLightFlicker() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) flickerTimer -= Time.deltaTime; if (flickerTimer <= 0f) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position) < 40f) { RoundManager.Instance.FlickerLights(false, false); } flickerTimer = Random.Range(4f, 6f); } } public override void HitEnemy(int force = 1, PlayerControllerB p = null, bool sfx = false, int id = -1) { } public override void SetEnemyStunned(bool setToStunned, float setToStunTime = 1f, PlayerControllerB setStunnedByPlayer = null) { } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected internal override string __getTypeName() { return "JammerAI"; } } [BepInPlugin("mrkixcat.JammerEnemy", "The Jammer", "1.0.0")] public class JammerPlugin : BaseUnityPlugin { private const string GUID = "mrkixcat.JammerEnemy"; private const string NAME = "The Jammer"; private const string VERSION = "1.0.0"; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Jammer Plugin is waking up..."); NetcodePatcher(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Jammer Mod initialized. LLL will handle asset loading."); } private void NetcodePatcher() { 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); } } } } } namespace JammerAI.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }