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 Jinn v1.1.0
plugins/Reiko888.Jinn.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
#define DEBUG using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Dawn.Utils; using Dusk; using GameNetcodeStuff; using HarmonyLib; using Jinn; using Microsoft.CodeAnalysis; using Reiko888.Jinn.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UnityEngine.Video; [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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: AssemblyCompany("Reiko888.Jinn")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+21f27384cbde14d0a5504bf0f058a5a4484200e2")] [assembly: AssemblyProduct("Jinn")] [assembly: AssemblyTitle("Reiko888.Jinn")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class GramophoneProp : NetworkBehaviour { public InteractTrigger windingTrigger; public AudioSource windingAudioSource; public AudioSource whisperAudioSource; public AudioClip windingLoopSFX; public Animator gramophoneAnimator; private bool isDefeated = false; private int playerWinding; public void Start() { int value = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<int>("ConfigJinnGramoHintDist").Value; if ((Object)(object)whisperAudioSource != (Object)null) { whisperAudioSource.maxDistance = value; } } public void OnWindingStarted(PlayerControllerB playerWinding) { if (!isDefeated) { SetWindingStateServerRpc(isWinding: true); if ((Object)(object)playerWinding == (Object)null && (Object)(object)GameNetworkManager.Instance != (Object)null) { playerWinding = GameNetworkManager.Instance.localPlayerController; } JinnAI jinnAI = Object.FindObjectOfType<JinnAI>(); if ((Object)(object)jinnAI != (Object)null && (Object)(object)playerWinding != (Object)null) { jinnAI.HearGramophoneServerRpc((int)playerWinding.playerClientId); } } } public void OnWindingStopped() { if (!isDefeated) { SetWindingStateServerRpc(isWinding: false); } } public void OnWindingComplete(PlayerControllerB playerWhoWoundIt) { if (!isDefeated) { isDefeated = true; CompleteWindingServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void SetWindingStateServerRpc(bool isWinding) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3505332847u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isWinding, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3505332847u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SetWindingStateClientRpc(isWinding); } } } [ClientRpc] public void SetWindingStateClientRpc(bool isWinding) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1959246616u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isWinding, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1959246616u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (isDefeated) { return; } if (isWinding) { if ((Object)(object)windingAudioSource != (Object)null && (Object)(object)windingLoopSFX != (Object)null) { windingAudioSource.clip = windingLoopSFX; windingAudioSource.loop = true; if (!windingAudioSource.isPlaying) { windingAudioSource.Play(); } } if ((Object)(object)gramophoneAnimator != (Object)null) { gramophoneAnimator.SetBool("isWinding", true); } } else { if ((Object)(object)windingAudioSource != (Object)null && windingAudioSource.isPlaying) { windingAudioSource.Stop(); } if ((Object)(object)gramophoneAnimator != (Object)null) { gramophoneAnimator.SetBool("isWinding", false); } } } [ServerRpc(RequireOwnership = false)] public void CompleteWindingServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1629078729u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1629078729u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { return; } JinnAI jinnAI = Object.FindObjectOfType<JinnAI>(); if (((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<bool>("ConfigDropGramoOnDeath").Value) { Item val3 = null; foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (items.itemName == "Cursed Gramophone") { val3 = items; break; } } if ((Object)(object)val3 != (Object)null) { Vector3 val4 = ((Component)this).transform.position + Vector3.up * 1.5f; GameObject val5 = Object.Instantiate<GameObject>(val3.spawnPrefab, val4, ((Component)this).transform.rotation, StartOfRound.Instance.propsContainer); GrabbableObject component = val5.GetComponent<GrabbableObject>(); component.fallTime = 0f; component.targetFloorPosition = component.GetItemFloorPosition(val4); int value = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<int>("ConfigMinGramoScrapValue").Value; int value2 = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<int>("ConfigMaxGramoScrapValue").Value; int scrapValue = Random.Range(value, value2); component.SetScrapValue(scrapValue); NetworkObject component2 = val5.GetComponent<NetworkObject>(); component2.Spawn(false); if ((Object)(object)jinnAI != (Object)null) { jinnAI.SyncScrapValueClientRpc(NetworkObjectReference.op_Implicit(component2), scrapValue); } } } if ((Object)(object)jinnAI != (Object)null) { jinnAI.DefeatObakeServerRpc(); } ((NetworkBehaviour)this).NetworkObject.Despawn(true); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3505332847u, new RpcReceiveHandler(__rpc_handler_3505332847), "SetWindingStateServerRpc"); ((NetworkBehaviour)this).__registerRpc(1959246616u, new RpcReceiveHandler(__rpc_handler_1959246616), "SetWindingStateClientRpc"); ((NetworkBehaviour)this).__registerRpc(1629078729u, new RpcReceiveHandler(__rpc_handler_1629078729), "CompleteWindingServerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3505332847(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool windingStateServerRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref windingStateServerRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((GramophoneProp)(object)target).SetWindingStateServerRpc(windingStateServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1959246616(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool windingStateClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref windingStateClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((GramophoneProp)(object)target).SetWindingStateClientRpc(windingStateClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1629078729(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; ((GramophoneProp)(object)target).CompleteWindingServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GramophoneProp"; } } namespace Obake { public class RapierItem : GrabbableObject { public AudioSource rapierAudio; private List<RaycastHit> objectsHitByRapierList = new List<RaycastHit>(); public PlayerControllerB previousPlayerHeldBy; private RaycastHit[] objectsHitByRapier; public int rapierHitForce = 1; public AudioClip[] hitSFX; public AudioClip[] swingSFX; private int rapierMask = 1084754248; private float timeAtLastDamageDealt; public ParticleSystem bloodParticle; public RuntimeAnimatorController rapierLocalAnimator; public RuntimeAnimatorController rapierRemoteAnimator; private static readonly Dictionary<ulong, RuntimeAnimatorController> _SAVED_ANIMATORS = new Dictionary<ulong, RuntimeAnimatorController>(); private bool _animatorReplaced; private AnimatorStateInfo _savedState; private float _savedNormalizedTime; private bool _savedCrouching; private bool _savedWalking; private bool _savedJumping; private bool _savedSprinting; public override void EquipItem() { ((GrabbableObject)this).EquipItem(); previousPlayerHeldBy = base.playerHeldBy; if ((Object)(object)base.playerHeldBy != (Object)null) { previousPlayerHeldBy.equippedUsableItemQE = true; EnableRapierAnimator(); base.playerHeldBy.playerBodyAnimator.SetBool(base.itemProperties.grabAnim, true); } } public override void GrabItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { EnableRapierAnimator(); } ((GrabbableObject)this).GrabItem(); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); DisableRapierAnimator(); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); DisableRapierAnimator(); } private void EnableRapierAnimator() { Debug.Log((object)$"[RapierDebug] EnableRapierAnimator called. Current _animatorReplaced status: {_animatorReplaced}"); if (_animatorReplaced) { return; } if ((Object)(object)base.playerHeldBy == (Object)null) { Debug.LogWarning((object)"[RapierDebug] EnableRapierAnimator failed: playerHeldBy is null."); return; } Debug.Log((object)$"[RapierDebug] Rapier animators in Inspector - Local: {(Object)(object)rapierLocalAnimator != (Object)null}, Remote: {(Object)(object)rapierRemoteAnimator != (Object)null}"); if (!_SAVED_ANIMATORS.ContainsKey(base.playerHeldBy.playerClientId)) { Debug.Log((object)$"[RapierDebug] Saving original animator for client {base.playerHeldBy.playerClientId}: {((Object)base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController).name}"); _SAVED_ANIMATORS[base.playerHeldBy.playerClientId] = base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController; } SaveAnimatorState(base.playerHeldBy.playerBodyAnimator); if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { Debug.Log((object)"[RapierDebug] Applying LOCAL rapier animator."); base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController = rapierLocalAnimator; } else { Debug.Log((object)"[RapierDebug] Applying REMOTE rapier animator."); base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController = rapierRemoteAnimator; } Debug.Log((object)"[RapierDebug] Rebinding and Updating animator..."); base.playerHeldBy.playerBodyAnimator.Rebind(); base.playerHeldBy.playerBodyAnimator.Update(0f); RestoreAnimatorState(base.playerHeldBy.playerBodyAnimator, isEquipping: true); _animatorReplaced = true; Debug.Log((object)"[RapierDebug] EnableRapierAnimator finished successfully."); } private void DisableRapierAnimator() { Debug.Log((object)$"[RapierDebug] DisableRapierAnimator called. Current _animatorReplaced status: {_animatorReplaced}"); if (!_animatorReplaced) { return; } PlayerControllerB val = (PlayerControllerB)(((Object)(object)base.playerHeldBy != (Object)null) ? ((object)base.playerHeldBy) : ((object)previousPlayerHeldBy)); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"[RapierDebug] DisableRapierAnimator failed: Both playerHeldBy and previousPlayerHeldBy are null."); return; } SaveAnimatorState(val.playerBodyAnimator); if (_SAVED_ANIMATORS.TryGetValue(val.playerClientId, out RuntimeAnimatorController value)) { Debug.Log((object)$"[RapierDebug] Restoring original animator for client {val.playerClientId}: {((Object)value).name}"); val.playerBodyAnimator.runtimeAnimatorController = value; _SAVED_ANIMATORS.Remove(val.playerClientId); } else { Debug.LogError((object)$"[RapierDebug] FATAL: Could not find original animator in dictionary for client {val.playerClientId}!"); } Debug.Log((object)"[RapierDebug] Rebinding and Updating original animator..."); val.playerBodyAnimator.Rebind(); val.playerBodyAnimator.Update(0f); RestoreAnimatorState(val.playerBodyAnimator, isEquipping: false); _animatorReplaced = false; Debug.Log((object)"[RapierDebug] DisableRapierAnimator finished successfully."); } private void SaveAnimatorState(Animator anim) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) _savedState = anim.GetCurrentAnimatorStateInfo(0); _savedNormalizedTime = ((AnimatorStateInfo)(ref _savedState)).normalizedTime; _savedCrouching = anim.GetBool("crouching"); _savedWalking = anim.GetBool("Walking"); _savedJumping = anim.GetBool("Jumping"); _savedSprinting = anim.GetBool("Sprinting"); Debug.Log((object)$"[RapierDebug] Saved State -> Hash: {((AnimatorStateInfo)(ref _savedState)).fullPathHash}, Time: {_savedNormalizedTime}, Walk: {_savedWalking}, Crouch: {_savedCrouching}"); } private void RestoreAnimatorState(Animator anim, bool isEquipping) { Debug.Log((object)$"[RapierDebug] Restoring Animator State. isEquipping: {isEquipping}"); try { anim.Play(((AnimatorStateInfo)(ref _savedState)).fullPathHash, 0, _savedNormalizedTime); anim.SetBool("crouching", _savedCrouching); anim.SetBool("Walking", _savedWalking); anim.SetBool("Jumping", _savedJumping); anim.SetBool("Sprinting", _savedSprinting); if (isEquipping) { Debug.Log((object)"[RapierDebug] Forcing 'HoldRapier' on layer 2..."); anim.Play("HoldRapier", 2, 0f); } } catch (Exception ex) { Debug.LogError((object)("[RapierDebug] Exception during RestoreAnimatorState: " + ex.Message)); } } public override void ItemActivate(bool used, bool buttonDown = true) { Debug.Log((object)$"[RapierDebug-Attack] ItemActivate called. buttonDown: {buttonDown}, IsOwner: {((NetworkBehaviour)this).IsOwner}"); if ((Object)(object)rapierAudio != (Object)null && swingSFX != null && swingSFX.Length != 0) { int num = Random.Range(0, swingSFX.Length); rapierAudio.PlayOneShot(swingSFX[num], 1f); } if ((Object)(object)base.playerHeldBy != (Object)null) { previousPlayerHeldBy = base.playerHeldBy; if (((NetworkBehaviour)base.playerHeldBy).IsOwner) { Debug.Log((object)"[RapierDebug-Attack] Triggering 'SwingRapier' on player animator."); base.playerHeldBy.playerBodyAnimator.SetTrigger("SwingRapier"); ((MonoBehaviour)this).StartCoroutine(TraceAnimatorState(base.playerHeldBy.playerBodyAnimator, 2)); } } if (((NetworkBehaviour)this).IsOwner) { Debug.Log((object)"[RapierDebug-Attack] We are the owner. Calling HitRapier()..."); HitRapier(); } } private IEnumerator TraceAnimatorState(Animator anim, int layerIndex) { Debug.Log((object)$"[RapierDebug-Trace] --- STARTING 1-SECOND ANIMATION TRACE ON LAYER {layerIndex} ---"); for (int i = 0; i < 10; i++) { if ((Object)(object)anim == (Object)null) { break; } AnimatorStateInfo stateInfo = anim.GetCurrentAnimatorStateInfo(layerIndex); AnimatorClipInfo[] clipInfo = anim.GetCurrentAnimatorClipInfo(layerIndex); string clipName = ((clipInfo.Length != 0) ? ((Object)((AnimatorClipInfo)(ref clipInfo[0])).clip).name : "NO CLIP (Empty State)"); Debug.Log((object)$"[RapierDebug-Trace] +{(float)i * 0.1f}s | Clip: {clipName} | Normalized Time: {((AnimatorStateInfo)(ref stateInfo)).normalizedTime:F2} | Transitioning: {anim.IsInTransition(layerIndex)}"); yield return (object)new WaitForSeconds(0.1f); } Debug.Log((object)"[RapierDebug-Trace] --- TRACE FINISHED ---"); } public void HitRapier(bool cancel = false) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00cd: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)$"[RapierDebug-Attack] HitRapier started. cancel: {cancel}"); if ((Object)(object)previousPlayerHeldBy == (Object)null) { Debug.LogWarning((object)"[RapierDebug-Attack] HitRapier aborted: previousPlayerHeldBy is null."); return; } previousPlayerHeldBy.activatingItem = false; bool flag = false; bool flag2 = false; int num = -1; bool flag3 = false; float num2 = Time.realtimeSinceStartup - timeAtLastDamageDealt; if (!cancel && num2 > 0.43f) { Debug.Log((object)$"[RapierDebug-Attack] Swing valid. Cooldown cleared ({num2}s elapsed). Casting sphere..."); previousPlayerHeldBy.twoHanded = false; objectsHitByRapier = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * 0.1f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 3f, rapierMask, (QueryTriggerInteraction)2); objectsHitByRapierList = objectsHitByRapier.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList(); Debug.Log((object)$"[RapierDebug-Attack] SphereCast found {objectsHitByRapierList.Count} colliders."); List<EnemyAI> list = new List<EnemyAI>(); IHittable val2 = default(IHittable); for (int num3 = 0; num3 < objectsHitByRapierList.Count; num3++) { RaycastHit val = objectsHitByRapierList[num3]; GameObject gameObject = ((Component)((RaycastHit)(ref val)).collider).gameObject; if (gameObject.layer == 8 || gameObject.layer == 11) { val = objectsHitByRapierList[num3]; if (((RaycastHit)(ref val)).collider.isTrigger) { continue; } flag = true; Debug.Log((object)$"[RapierDebug-Attack] Hit surface: {((Object)gameObject).name} (Layer: {gameObject.layer})"); string tag = gameObject.tag; for (int num4 = 0; num4 < StartOfRound.Instance.footstepSurfaces.Length; num4++) { if (StartOfRound.Instance.footstepSurfaces[num4].surfaceTag == tag) { num = num4; break; } } continue; } Debug.Log((object)$"[RapierDebug-Attack] Hit potential entity: {((Object)gameObject).name} (Layer: {gameObject.layer})"); val = objectsHitByRapierList[num3]; if (((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2)) { val = objectsHitByRapierList[num3]; if (!((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)) { val = objectsHitByRapierList[num3]; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position; RaycastHit val3 = objectsHitByRapierList[num3]; if (Physics.Linecast(position, ((RaycastHit)(ref val3)).point, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { goto IL_0321; } } flag = true; Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward; try { val = objectsHitByRapierList[num3]; EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component != (Object)null) { if (!((Object)(object)component.mainScript == (Object)null) && !list.Contains(component.mainScript) && (!StartOfRound.Instance.hangarDoorsClosed || component.mainScript.isInsidePlayerShip == previousPlayerHeldBy.isInHangarShipRoom)) { Debug.Log((object)("[RapierDebug-Attack] Valid Enemy Hit: " + ((Object)((Component)component.mainScript).gameObject).name)); goto IL_0464; } Debug.Log((object)"[RapierDebug-Attack] Enemy hit rejected (Already hit this swing, or ship door blocked)."); continue; } val = objectsHitByRapierList[num3]; if (!((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>() != (Object)null)) { Debug.Log((object)"[RapierDebug-Attack] Valid Object Hit (Turret, Mine, etc)."); goto IL_0464; } if (!flag3) { flag3 = true; Debug.Log((object)"[RapierDebug-Attack] Valid Player Hit."); goto IL_0464; } goto end_IL_035c; IL_0464: bool flag4 = val2.Hit(rapierHitForce, forward, previousPlayerHeldBy, true, 5); if (flag4 && (Object)(object)component != (Object)null) { list.Add(component.mainScript); } if (!flag2 && flag4) { flag2 = true; timeAtLastDamageDealt = Time.realtimeSinceStartup; if ((Object)(object)bloodParticle != (Object)null) { bloodParticle.Play(true); } } end_IL_035c:; } catch (Exception) { } continue; } } goto IL_0321; IL_0321: Debug.Log((object)("[RapierDebug-Attack] Entity " + ((Object)gameObject).name + " rejected (No IHittable, is self, or blocked by wall).")); } } else if (cancel) { } if (!flag) { return; } if ((Object)(object)rapierAudio != (Object)null && hitSFX != null && hitSFX.Length != 0) { int num5 = Random.Range(0, hitSFX.Length); rapierAudio.PlayOneShot(hitSFX[num5], 1f); } if ((Object)(object)Object.FindObjectOfType<RoundManager>() != (Object)null) { Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0); } if (!flag2 && num != -1) { if ((Object)(object)rapierAudio != (Object)null) { rapierAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX); } if ((Object)(object)rapierAudio != (Object)null) { WalkieTalkie.TransmitOneShotAudio(rapierAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f); } } HitRapierServerRpc(num, flag2); } [ServerRpc] public void HitRapierServerRpc(int hitSurfaceID, bool hitFlesh) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Invalid comparison between Unknown and I4 //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3068963665u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, hitSurfaceID); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref hitFlesh, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3068963665u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; HitRapierClientRpc(hitSurfaceID, hitFlesh); } } [ClientRpc] public void HitRapierClientRpc(int hitSurfaceID, bool hitFlesh) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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) //IL_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3960355199u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, hitSurfaceID); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref hitFlesh, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3960355199u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsOwner) { if ((Object)(object)rapierAudio != (Object)null && hitSFX != null && hitSFX.Length != 0) { int num = Random.Range(0, hitSFX.Length); rapierAudio.PlayOneShot(hitSFX[num], 1f); } if (hitSurfaceID != -1 && (Object)(object)rapierAudio != (Object)null) { rapierAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(rapierAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f); } if (hitFlesh && (Object)(object)bloodParticle != (Object)null) { bloodParticle.Play(true); } } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3068963665u, new RpcReceiveHandler(__rpc_handler_3068963665), "HitRapierServerRpc"); ((NetworkBehaviour)this).__registerRpc(3960355199u, new RpcReceiveHandler(__rpc_handler_3960355199), "HitRapierClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_3068963665(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_0089: 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_009e: 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_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 hitSurfaceID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID); bool hitFlesh = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hitFlesh, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RapierItem)(object)target).HitRapierServerRpc(hitSurfaceID, hitFlesh); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3960355199(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int hitSurfaceID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID); bool hitFlesh = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hitFlesh, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((RapierItem)(object)target).HitRapierClientRpc(hitSurfaceID, hitFlesh); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "RapierItem"; } } } namespace Jinn { internal class JinnAI : EnemyAI { private Random enemyRandom = null; private int baseSpeed; private int attackCooldownSlow; private float minDistance; private float maxDistance; private bool canTeleport; private float teleportWarningDelay; private float maxDistanceAfterWarning; private float minDistanceAfterWarning; private bool canBeBurned; private bool burnLights; private int flashlightDrainPercentage; private int burnSlowdown; private int attackDamage; public SkinnedMeshRenderer skin; public Material[] thisMaterial; public GameObject BloodParticles; public GameObject TeleportSwirl; private GameObject currentNetworkSwirl; public GameObject GramophonePropPrefab; private GameObject spawnedGramophone; private bool hasHeardGramophone = false; private Vector3 lastPosition; private bool hasLOS; public float chaseTimer = 0f; private bool isPreparingTeleport = false; private float teleportWarningTimer = 0f; private Vector3 pendingTeleportPosition; private PlayerControllerB pendingTeleportTarget; private bool hasAttemptedLastDitchTp = false; private bool isManifesting = false; private bool isFlickeringLights = false; private bool wasBeingBurned = false; public bool isCurrentlyBurning = false; private bool isChasingPitch = false; private bool isCloseToTarget = false; private int rapierMinValue; private int rapierMaxValue; private float searchMusicDistance; public Renderer[] rapierRenderers; private float gramoDash; private float gramoDashMult; private float timeSinceLastAttack; private float timeSinceSeen; private float timesinceHearingGramophone; private float tpRollTimer; private float continuousChaseTimer = 0f; public float teleportCooldown = 15f; private float teleportCooldownTimer = 0f; private float flyingAudioCooldownTimer = 0f; private int playerWinding; private DoorLock[] cachedDoors; private Dictionary<DoorLock, float> doorSlamCooldowns = new Dictionary<DoorLock, float>(); public AudioSource movementAudio; public AudioSource flyingAudio; public AudioSource whooshAudio; public AudioClip whooshSFX; public AudioClip[] flyingClips; public AudioClip unsheathSFX; public AudioClip laughSFX; public AudioClip swingSFX; public AudioClip[] teleportSFX; public AudioClip chargeUpTPSFX; public AudioClip creaturePainSFX; public ParticleSystem mistParticles; public ParticleSystem decayingMatterParticles; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { if (Plugin.Logger != null) { Plugin.Logger.LogInfo((object)text); } else { Debug.Log((object)("[Jinn] " + text)); } } public override void Start() { ((EnemyAI)this).Start(); baseSpeed = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<int>("ConfigJinnBaseSpeed").Value; attackCooldownSlow = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<int>("ConfigJinnAttackCooldownSlow").Value; minDistance = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<float>("ConfigJinnMinVisibleDist").Value; maxDistance = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<float>("ConfigJinnMaxVisibleDist").Value; canTeleport = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<bool>("ConfigJinnCanTeleport").Value; teleportWarningDelay = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<float>("ConfigJinnTPWarnDelay").Value; maxDistanceAfterWarning = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<float>("ConfigJinnMaxDistAfterDelay").Value; minDistanceAfterWarning = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<float>("ConfigJinnMinnDistAfterDelay").Value; canBeBurned = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<bool>("ConfigJinnCanBeBurned").Value; burnLights = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<bool>("ConfigJinnBurnLights").Value; flashlightDrainPercentage = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<int>("ConfigJinnFlashlightConsumption").Value; burnSlowdown = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<int>("ConfigJinnBurnSlowdown").Value; attackDamage = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<int>("ConfigJinnAttackDamage").Value; gramoDashMult = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<float>("ConfigGramophoneSpeedMultiplier").Value; rapierMinValue = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<int>("ConfigMinRapierScrapValue").Value; rapierMaxValue = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<int>("ConfigMaxRapierScrapValue").Value; searchMusicDistance = ((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<float>("ConfigJinnSearchMusicDistance").Value; List<Material> list = new List<Material>(); if ((Object)(object)skin != (Object)null) { list.AddRange(((Renderer)skin).materials); } if (rapierRenderers != null) { Renderer[] array = rapierRenderers; foreach (Renderer val in array) { if ((Object)(object)val != (Object)null) { list.AddRange(val.materials); } } } thisMaterial = list.ToArray(); ((EnemyAI)this).GetAINodes(); cachedDoors = Object.FindObjectsOfType<DoorLock>(); enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.maxDistance = searchMusicDistance; base.creatureVoice.Play(); } LogIfDebugBuild("Jinn Spawned"); SpawnCursedGramophoneLocally(); } private void OnEnable() { JinnEventManager.OnShipLeft += HandleShipLeft; } private void OnDisable() { JinnEventManager.OnShipLeft -= HandleShipLeft; } private void HandleShipLeft() { Plugin.Logger.LogInfo((object)"Ship is leaving! Cleaning up"); if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); } if (((NetworkBehaviour)this).IsServer && (Object)(object)spawnedGramophone != (Object)null) { NetworkObject component = spawnedGramophone.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && component.IsSpawned) { component.Despawn(true); } } if (((NetworkBehaviour)this).IsServer && (Object)(object)currentNetworkSwirl != (Object)null) { NetworkObject component2 = currentNetworkSwirl.GetComponent<NetworkObject>(); if ((Object)(object)component2 != (Object)null && component2.IsSpawned) { component2.Despawn(true); } } ((EnemyAI)this).KillEnemy(true); } private Vector3 GetFloorPosition(Vector3 startPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) //IL_0047: Unknown result type (might be due to invalid IL or missing references) Vector3 val = startPos + Vector3.up * 0.5f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 10f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val2)).point; } return startPos; } public void SpawnCursedGramophoneLocally() { //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_0077: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || !((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<bool>("ConfigCanSpawnGramo").Value) { return; } if ((Object)(object)GramophonePropPrefab == (Object)null) { LogIfDebugBuild("GramophonePropPrefab is missing! Cannot spawn the prop."); return; } Vector3 startPos = ((Component)this).transform.position + Vector3.up * 1.5f; bool flag = false; RandomScrapSpawn[] array = Object.FindObjectsOfType<RandomScrapSpawn>(); if (array != null && array.Length != 0 && base.allAINodes != null && base.allAINodes.Length != 0) { for (int i = 0; i < 15; i++) { RandomScrapSpawn val = array[enemyRandom.Next(0, array.Length)]; bool flag2 = false; GameObject[] allAINodes = base.allAINodes; foreach (GameObject val2 in allAINodes) { if ((Object)(object)val2 != (Object)null && Vector3.Distance(((Component)val).transform.position, val2.transform.position) <= 15f) { flag2 = true; break; } } if (flag2) { Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)val).transform.position, RoundManager.Instance.navHit, 3f, -1); if (RoundManager.Instance.GotNavMeshPositionResult) { startPos = navMeshPosition; flag = true; break; } } } } if (!flag && base.allAINodes != null && base.allAINodes.Length != 0) { GameObject val3 = base.allAINodes[enemyRandom.Next(0, base.allAINodes.Length)]; if ((Object)(object)val3 != (Object)null) { startPos = val3.transform.position; LogIfDebugBuild("Failed to find valid scrap node. Falling back to an AI Node"); } } startPos = GetFloorPosition(startPos); spawnedGramophone = Object.Instantiate<GameObject>(GramophonePropPrefab, startPos, Quaternion.identity); spawnedGramophone.GetComponent<NetworkObject>().Spawn(false); LogIfDebugBuild("Dropped Gramophone at random node"); } public void SpawnRapierLocally() { //IL_00c0: 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_00cf: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0144: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || !((AssetBundleLoader<JinnContentHandler.JinnAssets>)(object)ContentHandler<JinnContentHandler>.Instance.jinnAssets).GetConfig<bool>("ConfigDropRapierOnDeath").Value) { return; } Item val = null; foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (items.itemName == "Rapier") { val = items; break; } } if ((Object)(object)val == (Object)null) { LogIfDebugBuild("Rapier item not found in allItemsList!"); return; } Vector3 val2 = ((Component)this).transform.position + Vector3.up * 1.5f; Vector3 val3 = RoundManager.Instance.GetNavMeshPosition(val2, RoundManager.Instance.navHit, 5f, -1); if (!RoundManager.Instance.GotNavMeshPositionResult) { val3 = val2; } GameObject val4 = Object.Instantiate<GameObject>(val.spawnPrefab, val3, Quaternion.identity, StartOfRound.Instance.propsContainer); GrabbableObject component = val4.GetComponent<GrabbableObject>(); component.fallTime = 0f; component.targetFloorPosition = component.GetItemFloorPosition(val3); int scrapValue = Random.Range(rapierMinValue, rapierMaxValue + 1); component.SetScrapValue(scrapValue); NetworkObject component2 = val4.GetComponent<NetworkObject>(); component2.Spawn(false); SyncScrapValueClientRpc(NetworkObjectReference.op_Implicit(component2), scrapValue); component.EnableItemMeshes(true); LogIfDebugBuild("Dropped Rapier item upon Jinn defeat"); } [ClientRpc] public void SyncScrapValueClientRpc(NetworkObjectReference netObjRef, int scrapValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3032411812u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, scrapValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3032411812u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)RoundManager.Instance != (Object)null) { ((MonoBehaviour)RoundManager.Instance).StartCoroutine(DelayedScrapValueSync(netObjRef, scrapValue)); } else { ((MonoBehaviour)this).StartCoroutine(DelayedScrapValueSync(netObjRef, scrapValue)); } } } private IEnumerator DelayedScrapValueSync(NetworkObjectReference netObjRef, int scrapValue) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(1f); NetworkObject netObj = default(NetworkObject); if (((NetworkObjectReference)(ref netObjRef)).TryGet(ref netObj, (NetworkManager)null)) { GrabbableObject grabObj = ((Component)netObj).GetComponent<GrabbableObject>(); if ((Object)(object)grabObj != (Object)null) { grabObj.SetScrapValue(scrapValue); } } } public override void Update() { //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (((NetworkBehaviour)this).IsServer) { UpdateJinnOwnership(); } if ((Object)(object)base.creatureAnimator != (Object)null) { base.creatureAnimator.SetBool("isFlying", hasHeardGramophone); } if (flyingAudioCooldownTimer > 0f) { flyingAudioCooldownTimer -= Time.deltaTime; } if ((Object)(object)flyingAudio != (Object)null && flyingClips != null && flyingClips.Length != 0) { if (hasHeardGramophone) { if (!flyingAudio.isPlaying && flyingAudioCooldownTimer <= 0f) { AudioClip val = flyingClips[enemyRandom.Next(0, flyingClips.Length)]; if ((Object)(object)val != (Object)null) { flyingAudio.clip = val; flyingAudio.Play(); flyingAudioCooldownTimer = 15f; } } } else if (!hasHeardGramophone && flyingAudio.isPlaying) { flyingAudio.Stop(); } } if ((Object)(object)whooshAudio != (Object)null && (Object)(object)whooshSFX != (Object)null) { if (hasHeardGramophone) { if (!whooshAudio.isPlaying) { whooshAudio.clip = whooshSFX; whooshAudio.Play(); } } else if (!hasHeardGramophone && whooshAudio.isPlaying) { whooshAudio.Stop(); } } timeSinceLastAttack += Time.deltaTime; if (isCurrentlyBurning) { base.stunNormalizedTimer = 1f; } SetVisibility(); DrainLocalFlashlightBattery(); if ((Object)(object)base.creatureVoice != (Object)null) { float num = (isChasingPitch ? 0.8f : 1f); base.creatureVoice.pitch = Mathf.Lerp(base.creatureVoice.pitch, num, Time.deltaTime * 0.8f); if (isCurrentlyBurning || hasHeardGramophone) { if (base.creatureVoice.isPlaying) { base.creatureVoice.Pause(); } } else if (!base.creatureVoice.isPlaying && !base.isEnemyDead) { base.creatureVoice.Play(); } } if (base.isEnemyDead) { base.agent.speed = 0f; return; } if (isCurrentlyBurning) { base.agent.speed = burnSlowdown; } else if (hasHeardGramophone) { base.agent.speed = gramoDash; if (((NetworkBehaviour)this).IsOwner && (isCloseToTarget || timesinceHearingGramophone > 35f)) { isCloseToTarget = false; CancelGramophoneServerRpc(); } } else if (timeSinceLastAttack < 2f) { base.agent.speed = attackCooldownSlow; } else { base.agent.speed = baseSpeed; } if (StartOfRound.Instance.allPlayersDead) { return; } if (!hasLOS && chaseTimer > 0f) { chaseTimer -= Time.deltaTime; } if (!((NetworkBehaviour)this).IsOwner) { return; } SlamNearbyDoorsCheck(); timeSinceSeen += Time.deltaTime; timesinceHearingGramophone += Time.deltaTime; if (IsBeingBurnedByFlashlight()) { if (!wasBeingBurned) { wasBeingBurned = true; SetBurningStateServerRpc(isBurning: true); } } else if (wasBeingBurned) { wasBeingBurned = false; SetBurningStateServerRpc(isBurning: false); } if (base.stunNormalizedTimer > 0f && !isFlickeringLights && !base.isEnemyDead) { ((MonoBehaviour)this).StartCoroutine(FlickerLightsDuringStun()); } if ((Object)(object)base.targetPlayer != (Object)null) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position); if (num2 <= maxDistance && !isManifesting) { isManifesting = true; SetManifestingStateServerRpc(manifesting: true); } else if (num2 > maxDistance + 5f && isManifesting) { isManifesting = false; } isCloseToTarget = num2 <= 10f; } else { isManifesting = false; } if (isPreparingTeleport) { teleportWarningTimer -= Time.deltaTime; if (teleportWarningTimer <= 0f) { ExecuteDelayedTeleport(); } } if (teleportCooldownTimer > 0f) { teleportCooldownTimer -= Time.deltaTime; } if ((Object)(object)base.targetPlayer != (Object)null) { continuousChaseTimer += Time.deltaTime; if (!(continuousChaseTimer >= 5f) || isPreparingTeleport || !(teleportCooldownTimer <= 0f)) { return; } tpRollTimer += Time.deltaTime; if (tpRollTimer >= 5f) { tpRollTimer = 0f; if (Random.value <= 0.8f) { LogIfDebugBuild("Teleport has been accepted"); TpNearestNode(base.targetPlayer); } else { LogIfDebugBuild("Teleport denied. Will try again in 5 seconds."); } } } else { continuousChaseTimer = 0f; tpRollTimer = 0f; } } public override void DoAIInterval() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } if ((Object)(object)base.targetPlayer != (Object)null && !hasHeardGramophone) { if (((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer.gameplayCamera).transform.position, 120f, 60, -1f, (Transform)null)) { hasLOS = true; if (!isChasingPitch) { SetPitchStateServerRpc(chasing: true); } timeSinceSeen = 0f; chaseTimer = 10f; lastPosition = ((Component)base.targetPlayer).transform.position; hasAttemptedLastDitchTp = false; if (base.currentSearch != null && base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); } else { hasLOS = false; if (chaseTimer <= 0f) { if (isChasingPitch) { SetPitchStateServerRpc(chasing: false); } CheckAndFireLastDitchTeleport(); SyncTargetServerRpc(-1); if (base.currentSearch == null || !base.currentSearch.inProgress) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } } else { ((EnemyAI)this).SetDestinationToPosition(lastPosition, false); if (Vector3.Distance(((Component)this).transform.position, lastPosition) <= 2f) { CheckAndFireLastDitchTeleport(); chaseTimer = 0f; } else if (chaseTimer <= 7f) { CheckAndFireLastDitchTeleport(); } } } } else if (hasHeardGramophone) { if ((Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isPlayerDead) { if (base.currentSearch != null && base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); } else { hasHeardGramophone = false; CancelGramophoneServerRpc(); } } else { hasLOS = false; if (((EnemyAI)this).TargetClosestPlayer(5f, true, 120f, false, false, true)) { hasLOS = true; if (!isChasingPitch) { SetPitchStateServerRpc(chasing: true); } timeSinceSeen = 0f; chaseTimer = 10f; lastPosition = ((Component)base.targetPlayer).transform.position; hasAttemptedLastDitchTp = false; if (base.currentSearch != null && base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); SyncTargetServerRpc((int)base.targetPlayer.playerClientId); } else if (base.currentSearch == null || !base.currentSearch.inProgress) { if (isChasingPitch) { SetPitchStateServerRpc(chasing: false); } ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } } if (((NetworkBehaviour)this).IsServer) { UpdateJinnOwnership(); } } public override void OnDestroy() { ((EnemyAI)this).OnDestroy(); ResetAllFlashlightInterference(); if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); } if (((NetworkBehaviour)this).IsServer) { if ((Object)(object)spawnedGramophone != (Object)null) { NetworkObject component = spawnedGramophone.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && component.IsSpawned) { component.Despawn(true); } } if ((Object)(object)currentNetworkSwirl != (Object)null) { NetworkObject component2 = currentNetworkSwirl.GetComponent<NetworkObject>(); if ((Object)(object)component2 != (Object)null && component2.IsSpawned) { component2.Despawn(true); } } } LogIfDebugBuild("OnDestroy successful."); } private void ResetAllFlashlightInterference() { if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController.pocketedFlashlight != (Object)null) { GrabbableObject pocketedFlashlight = localPlayerController.pocketedFlashlight; FlashlightItem val = (FlashlightItem)(object)((pocketedFlashlight is FlashlightItem) ? pocketedFlashlight : null); if (val != null) { val.flashlightInterferenceLevel = 0; } } if ((Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)null) { GrabbableObject currentlyHeldObjectServer = localPlayerController.currentlyHeldObjectServer; FlashlightItem val2 = (FlashlightItem)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null); if (val2 != null) { val2.flashlightInterferenceLevel = 0; } } } [ServerRpc(RequireOwnership = false)] public void SetPitchStateServerRpc(bool chasing) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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 val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(572835169u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref chasing, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 572835169u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetPitchStateClientRpc(chasing); } } } [ClientRpc] public void SetPitchStateClientRpc(bool chasing) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4086901024u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref chasing, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4086901024u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; isChasingPitch = chasing; } } } private void CheckAndFireLastDitchTeleport() { if (!hasHeardGramophone && !hasAttemptedLastDitchTp && !isPreparingTeleport && (Object)(object)base.targetPlayer != (Object)null && teleportCooldownTimer <= 0f) { hasAttemptedLastDitchTp = true; if (Random.value <= 0.75f) { LogIfDebugBuild("Lost target, attempting TP."); TpToCutoffNode(base.targetPlayer); } } } private void TpToCutoffNode(PlayerControllerB targetPlayer) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) if (hasHeardGramophone || !canTeleport || (Object)(object)targetPlayer == (Object)null || targetPlayer.isPlayerDead || base.allAINodes == null || base.allAINodes.Length == 0) { return; } Vector3 velocity = targetPlayer.thisController.velocity; if (((Vector3)(ref velocity)).sqrMagnitude < 1f) { LogIfDebugBuild("Player is standing still. Falling back to normal LDTp."); TpNearestNode(targetPlayer); return; } Vector3 val = ((Component)targetPlayer).transform.position + ((Vector3)(ref velocity)).normalized * 15f; List<GameObject> list = new List<GameObject>(); float num = 12f; GameObject[] allAINodes = base.allAINodes; foreach (GameObject val2 in allAINodes) { if (!((Object)(object)val2 == (Object)null) && Vector3.Distance(val2.transform.position, val) <= num) { list.Add(val2); } } if (list.Count > 0) { GameObject val3 = list[enemyRandom.Next(0, list.Count)]; pendingTeleportPosition = val3.transform.position; pendingTeleportTarget = targetPlayer; teleportWarningTimer = teleportWarningDelay; isPreparingTeleport = true; if ((Object)(object)movementAudio != (Object)null && (Object)(object)chargeUpTPSFX != (Object)null) { movementAudio.PlayOneShot(chargeUpTPSFX, 0.8f); } if (!((NetworkBehaviour)this).IsServer || !((Object)(object)TeleportSwirl != (Object)null)) { return; } Vector3 val4 = pendingTeleportPosition + Vector3.up * 1.5f; currentNetworkSwirl = Object.Instantiate<GameObject>(TeleportSwirl, val4, Quaternion.identity); if ((Object)(object)currentNetworkSwirl != (Object)null) { NetworkObject component = currentNetworkSwirl.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null) { component.Spawn(true); } } } else { LogIfDebugBuild("No nodes found ahead of the player. Falling back to normal LDTp."); TpNearestNode(targetPlayer); } } private bool IsBeingBurnedByFlashlight() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if (!canBeBurned) { return false; } PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)this).GetAllPlayersInLineOfSight(360f, 15, (Transform)null, -1f, -1); if (allPlayersInLineOfSight == null || allPlayersInLineOfSight.Length == 0) { return false; } PlayerControllerB[] array = allPlayersInLineOfSight; foreach (PlayerControllerB val in array) { Vector3 val2 = ((Component)this).transform.position - ((Component)val).transform.position; float num = Vector3.Angle(((Component)val).transform.forward, val2); if (Mathf.Abs(num) > 30f) { continue; } if ((Object)(object)val.pocketedFlashlight != (Object)null && val.pocketedFlashlight.isBeingUsed && val.pocketedFlashlight.insertedBattery != null && val.pocketedFlashlight.insertedBattery.charge > 0f) { return true; } GrabbableObject val3 = (((Object)(object)val.currentlyHeldObjectServer != (Object)null) ? val.currentlyHeldObjectServer : val.currentlyHeldObject); if (val.isHoldingObject && (Object)(object)val3 != (Object)null) { FlashlightItem val4 = (FlashlightItem)(object)((val3 is FlashlightItem) ? val3 : null); if (val4 != null && ((GrabbableObject)val4).isBeingUsed && ((GrabbableObject)val4).insertedBattery != null && ((GrabbableObject)val4).insertedBattery.charge > 0f) { return true; } } } return false; } [ServerRpc(RequireOwnership = false)] public void SyncTargetServerRpc(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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2258944123u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerClientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2258944123u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SyncTargetClientRpc(playerClientId); } } } [ClientRpc] public void SyncTargetClientRpc(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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3658603152u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3658603152u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (playerClientId < 0) { base.targetPlayer = null; } else { base.targetPlayer = StartOfRound.Instance.allPlayerScripts[playerClientId]; } } } [ServerRpc(RequireOwnership = false)] public void SetBurningStateServerRpc(bool isBurning) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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 val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3947697427u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isBurning, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3947697427u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetBurningStateClientRpc(isBurning); } } } [ClientRpc] public void SetBurningStateClientRpc(bool isBurning) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1937438416u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isBurning, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1937438416u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; isCurrentlyBurning = isBurning; base.creatureAnimator.SetBool("isBeingBurned", isBurning); if (isBurning) { LogIfDebugBuild("Jinn is being burned"); if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Pause(); } if ((Object)(object)base.creatureSFX != (Object)null && (Object)(object)creaturePainSFX != (Object)null) { base.creatureSFX.PlayOneShot(creaturePainSFX); } if (burnLights && !isFlickeringLights && !base.isEnemyDead) { ((MonoBehaviour)this).StartCoroutine(FlickerLightsDuringStun()); } } else { if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Play(); } ResetAllFlashlightInterference(); } } [ServerRpc(RequireOwnership = false)] public void SetManifestingStateServerRpc(bool manifesting) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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 val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3194650752u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref manifesting, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3194650752u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetManifestingStateClientRpc(manifesting); } } } [ClientRpc] public void SetManifestingStateClientRpc(bool manifesting) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1475831853u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref manifesting, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1475831853u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.creatureAnimator.SetTrigger("isManifesting"); base.creatureSFX.PlayOneShot(unsheathSFX); } } } private IEnumerator FlickerLightsDuringStun() { isFlickeringLights = true; List<FlashlightItem> flashlightsNearJinn = new List<FlashlightItem>(); FlashlightItem[] allFlashlights = Object.FindObjectsOfType<FlashlightItem>(); if (allFlashlights != null) { foreach (FlashlightItem fl in allFlashlights) { if ((Object)(object)fl != (Object)null && (Object)(object)((GrabbableObject)fl).playerHeldBy != (Object)null && Vector3.Distance(((Component)((GrabbableObject)fl).playerHeldBy).transform.position, ((Component)this).transform.position) <= 15f) { flashlightsNearJinn.Add(fl); } } } for (int j = 0; j < flashlightsNearJinn.Count; j++) { FlashlightItem fl2 = flashlightsNearJinn[j]; if ((Object)(object)fl2 != (Object)null) { if ((Object)(object)fl2.flashlightAudio != (Object)null && (Object)(object)fl2.flashlightFlicker != (Object)null) { fl2.flashlightAudio.PlayOneShot(fl2.flashlightFlicker); WalkieTalkie.TransmitOneShotAudio(fl2.flashlightAudio, fl2.flashlightFlicker, 0.8f); } if ((Object)(object)((GrabbableObject)fl2).playerHeldBy != (Object)null && ((GrabbableObject)fl2).playerHeldBy.isInsideFactory) { fl2.flashlightInterferenceLevel = 2; } } } List<Animator> lightsNearJinn = new List<Animator>(); if ((Object)(object)RoundManager.Instance != (Object)null && RoundManager.Instance.allPoweredLightsAnimators != null) { for (int k = 0; k < RoundManager.Instance.allPoweredLightsAnimators.Count; k++) { Animator animator = RoundManager.Instance.allPoweredLightsAnimators[k]; if ((Object)(object)animator != (Object)null && Vector3.Distance(((Component)animator).transform.position, ((Component)this).transform.position) <= 15f) { lightsNearJinn.Add(animator); } } } if (lightsNearJinn.Count > 0) { int loopCount = 0; int b = 4; while (b > 0 && b != 0) { int limit = lightsNearJinn.Count / b; for (int l = loopCount; l < limit; l++) { if (l < lightsNearJinn.Count && (Object)(object)lightsNearJinn[l] != (Object)null) { lightsNearJinn[l].SetTrigger("Flicker"); } loopCount++; } yield return (object)new WaitForSeconds(0.05f); b--; } } yield return (object)new WaitForSeconds(0.3f); for (int m = 0; m < flashlightsNearJinn.Count; m++) { FlashlightItem fl3 = flashlightsNearJinn[m]; if ((Object)(object)fl3 != (Object)null) { fl3.flashlightInterferenceLevel = 0; } } isFlickeringLights = false; } private void TpNearestNode(PlayerControllerB targetPlayer) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) if (hasHeardGramophone || !canTeleport || (Object)(object)targetPlayer == (Object)null || targetPlayer.isPlayerDead || base.allAINodes == null || base.allAINodes.Length == 0) { return;