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 Him v1.0.3
REPO.Him.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using UnityEngine; using UnityEngine.AI; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.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; } } } namespace REPO.Him { public static class CustomAudioLoader { public static AudioClip HeartbeatClip; public static AudioClip ScreamClip; public static IEnumerator LoadHeartbeatAudio(string fileName) { string audioPath = GetAudioPath(fileName); if (!File.Exists(audioPath)) { yield break; } HimPlugin.Logger.LogInfo("[AUDIO] Trovato file audio battito: " + audioPath + ", avvio caricamento..."); UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip("file://" + audioPath, (AudioType)0); try { yield return www.SendWebRequest(); if ((int)www.result == 1) { HeartbeatClip = DownloadHandlerAudioClip.GetContent(www); HimPlugin.Logger.LogInfo($"[AUDIO] File {fileName} caricato con successo! (Durata: {HeartbeatClip.length}s)"); } else { HimPlugin.Logger.LogError("[AUDIO] Errore caricamento " + fileName + ": " + www.error); } } finally { ((IDisposable)www)?.Dispose(); } } public static IEnumerator LoadScreamAudio(string baseFileNameWithoutExtension) { string[] array = new string[3] { ".ogg", ".wav", ".mp3" }; string text = null; string foundExt = null; string[] array2 = array; foreach (string text2 in array2) { string audioPath = GetAudioPath(baseFileNameWithoutExtension + text2); if (File.Exists(audioPath)) { text = audioPath; foundExt = text2; break; } } if (text != null) { HimPlugin.Logger.LogInfo("[AUDIO] Trovato file audio urlo: " + text + ", avvio caricamento..."); AudioType val = (AudioType)0; switch (foundExt) { case ".ogg": val = (AudioType)14; break; case ".wav": val = (AudioType)20; break; case ".mp3": val = (AudioType)13; break; } UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip("file://" + text, val); try { yield return www.SendWebRequest(); if ((int)www.result == 1) { ScreamClip = DownloadHandlerAudioClip.GetContent(www); HimPlugin.Logger.LogInfo($"[AUDIO] File {baseFileNameWithoutExtension}{foundExt} caricato con successo! (Durata: {ScreamClip.length}s)"); yield break; } HimPlugin.Logger.LogError("[AUDIO] Errore caricamento " + baseFileNameWithoutExtension + foundExt + ": " + www.error); } finally { ((IDisposable)www)?.Dispose(); } } else { string text3 = Path.Combine(Paths.PluginPath, baseFileNameWithoutExtension + ".mp3"); HimPlugin.Logger.LogWarning("[AUDIO] Nessun file audio '" + baseFileNameWithoutExtension + "' (.ogg, .wav o .mp3) trovato in " + text3 + " o vicino alla DLL."); } } private static string GetAudioPath(string fileName) { string text = Path.Combine(Paths.PluginPath, fileName); if (!File.Exists(text)) { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (directoryName != null) { text = Path.Combine(directoryName, fileName); } } return text; } } [HarmonyPatch] public static class GameHooks { [HarmonyPatch(typeof(MonoBehaviour), "Update")] public static class ValuableUpdatePatch { } private static bool _hasSpawnedInfectedClone; private static GameObject _infectedObject; [HarmonyPatch(typeof(PlayerAvatar), "Start")] [HarmonyPostfix] public static void PlayerStartPatch(PlayerAvatar __instance) { if ((Object)(object)((Component)__instance).GetComponent<ParanoiaManager>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<ParanoiaManager>(); HimPlugin.Logger.LogInfo("Attached ParanoiaManager to PlayerAvatar."); } } } public class ParanoiaManager : MonoBehaviour { public enum FlashlightState { Normal, BuildUp, FadeOut, Off, FadeIn, Panic, FadeRestore } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static PCMReaderCallback <>9__41_0; public static Func<Rigidbody, bool> <>9__56_0; public static Func<Component, bool> <>9__62_0; public static Func<Component, string> <>9__62_1; internal void <Start>b__41_0(float[] data) { for (int i = 0; i < data.Length; i++) { data[i] = (float)((double)Random.value * 2.0 - 1.0) * 0.15f; } } internal bool <IsInCart>b__56_0(Rigidbody r) { return ((Object)r).name.ToLower().Contains("cart"); } internal bool <DumpGameObject>b__62_0(Component c) { return (Object)(object)c != (Object)null; } internal string <DumpGameObject>b__62_1(Component c) { return ((object)c).GetType().Name; } } private PlayerAvatar _player; private Camera _playerCamera; private Text _staticTextNoise; private string[] _noiseFrames; private float _isolationRadius = 7f; private float _trackingRadius = 15f; private float _minHoldDist = 2.4f; public float _triggerLimit = 20f; private bool _isTimerRunning; public bool _hasParanoiaStarted; public bool _jumpscareTriggered; public bool _amITheTarget; public float _targetLockTimer; public float _spawnGraceTimer = 3f; public Transform _infectedItemTransform; public Vector3 _lastKnownItemPosition = Vector3.zero; public float _paranoiaTimer; private AudioSource _fakeFootstepsSource; private float _debugLogCooldown; private static Font _cachedSpookyFont; private EnemySetup _cachedScreamerSetup; public static FlashlightState currentFlashlightState = FlashlightState.Normal; public static bool IsFlashlightFlickeringActive = false; public static bool ForceFlashlightOff = false; public static bool IsFlashlightPanicModeActive = false; private static bool _localFlashlightStateOn = true; private static float _localFlashlightIntensityMultiplier = 1f; private static float _fFadeStartIntensity = 1f; private static float _fFadeEndIntensity = 1f; private static float _fFadeProgress = 0f; private static float _fFadeDuration = 1f; private static float _panicModeDuration = 60f; private static float _panicFlickerTimer = 0f; private static float _panicFlickerBurstTimer = 0f; private static bool _inPanicFlickerBurst = false; private static float _randomPerlinOffset = 0f; private bool _forceAmbientOverride; private float _overrideAmbientIntensity; private float _overrideReflectionIntensity; private Color _overrideAmbientColor = Color.black; public static bool LocalFlashlightStateOn => _localFlashlightStateOn; public static float LocalFlashlightIntensityMultiplier => _localFlashlightIntensityMultiplier; private void Start() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown _player = ((Component)this).GetComponent<PlayerAvatar>(); currentFlashlightState = FlashlightState.Normal; IsFlashlightFlickeringActive = false; IsFlashlightPanicModeActive = false; ForceFlashlightOff = false; _localFlashlightStateOn = true; _localFlashlightIntensityMultiplier = 1f; _randomPerlinOffset = Random.Range(0f, 10000f); if (!_player.isLocal) { HimPlugin.Logger.LogInfo("[Him] Ignorato PlayerAvatar remoto."); Object.Destroy((Object)(object)this); return; } ((MonoBehaviour)this).StartCoroutine(AutoInfectRoutine()); _playerCamera = ((Component)this).GetComponentInChildren<Camera>(); GameObject val = new GameObject("HorrorFakeFootsteps"); val.transform.SetParent(((Component)this).transform); _fakeFootstepsSource = val.AddComponent<AudioSource>(); _fakeFootstepsSource.spatialBlend = 1f; _fakeFootstepsSource.volume = 0.6f; _fakeFootstepsSource.rolloffMode = (AudioRolloffMode)1; _fakeFootstepsSource.minDistance = 0.5f; _fakeFootstepsSource.maxDistance = 8f; GameObject val2 = new GameObject("SpookyRumbleAmbient"); val2.transform.SetParent(((Component)this).transform); AudioSource val3 = val2.AddComponent<AudioSource>(); object obj = <>c.<>9__41_0; if (obj == null) { PCMReaderCallback val4 = delegate(float[] data) { for (int i = 0; i < data.Length; i++) { data[i] = (float)((double)Random.value * 2.0 - 1.0) * 0.15f; } }; <>c.<>9__41_0 = val4; obj = (object)val4; } val3.clip = AudioClip.Create("Spooky", 88200, 1, 44100, true, (PCMReaderCallback)obj); val3.loop = true; val3.volume = 0.5f; val3.spatialBlend = 0f; AudioLowPassFilter val5 = val2.AddComponent<AudioLowPassFilter>(); val5.cutoffFrequency = 350f; val3.Play(); HimPlugin.Logger.LogInfo("[Him] ParanoiaManager avviato sul player locale."); } public void SetAmbientOverride(float ambInt, float refInt, Color ambCol) { //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_0028: Unknown result type (might be due to invalid IL or missing references) _forceAmbientOverride = true; _overrideAmbientIntensity = ambInt; _overrideReflectionIntensity = refInt; _overrideAmbientColor = ambCol; RenderSettings.ambientIntensity = ambInt; RenderSettings.reflectionIntensity = refInt; RenderSettings.ambientLight = ambCol; } public void ClearAmbientOverride() { _forceAmbientOverride = false; } private void ApplyAmbientOverride() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (_forceAmbientOverride) { RenderSettings.ambientIntensity = _overrideAmbientIntensity; RenderSettings.reflectionIntensity = _overrideReflectionIntensity; RenderSettings.ambientLight = _overrideAmbientColor; } } private void Update() { HandleDebugHotkey(); HandleParanoiaLogic(); ApplyAmbientOverride(); UpdateFlashlightFlicker(); } public static void SetFlashlightState(FlashlightState newState) { currentFlashlightState = newState; } public static void TriggerFlashlightFadeOut(float duration) { currentFlashlightState = FlashlightState.FadeOut; _fFadeStartIntensity = _localFlashlightIntensityMultiplier; _fFadeEndIntensity = 0f; _fFadeProgress = 0f; _fFadeDuration = duration; } public static void TriggerFlashlightFadeIn(float duration, float targetIntensity) { currentFlashlightState = FlashlightState.FadeIn; _fFadeStartIntensity = 0f; _fFadeEndIntensity = targetIntensity; _fFadeProgress = 0f; _fFadeDuration = duration; } public static void TriggerFlashlightFadeRestore(float duration) { currentFlashlightState = FlashlightState.FadeRestore; _fFadeStartIntensity = _localFlashlightIntensityMultiplier; _fFadeEndIntensity = 1f; _fFadeProgress = 0f; _fFadeDuration = duration; } private void UpdateFlashlightFlicker() { IsFlashlightFlickeringActive = currentFlashlightState != FlashlightState.Normal; ForceFlashlightOff = currentFlashlightState == FlashlightState.Off; if (currentFlashlightState == FlashlightState.Normal) { _localFlashlightStateOn = true; _localFlashlightIntensityMultiplier = 1f; } else if (currentFlashlightState == FlashlightState.BuildUp) { _localFlashlightStateOn = true; float num = Mathf.PerlinNoise(_randomPerlinOffset, Time.time * 25f); _localFlashlightIntensityMultiplier = Mathf.Lerp(0.2f, 1.2f, num); if (Random.value > 0.95f) { _localFlashlightIntensityMultiplier = 0f; } } else if (currentFlashlightState == FlashlightState.FadeOut) { _localFlashlightStateOn = true; _fFadeProgress += Time.deltaTime; float num2 = Mathf.Clamp01(_fFadeProgress / _fFadeDuration); _localFlashlightIntensityMultiplier = Mathf.Lerp(_fFadeStartIntensity, _fFadeEndIntensity, num2); } else if (currentFlashlightState == FlashlightState.Off) { _localFlashlightStateOn = false; _localFlashlightIntensityMultiplier = 0f; } else if (currentFlashlightState == FlashlightState.FadeIn) { _localFlashlightStateOn = true; _fFadeProgress += Time.deltaTime; float num3 = Mathf.Clamp01(_fFadeProgress / _fFadeDuration); _localFlashlightIntensityMultiplier = Mathf.Lerp(_fFadeStartIntensity, _fFadeEndIntensity, num3); if (num3 >= 1f) { currentFlashlightState = FlashlightState.Panic; } } else if (currentFlashlightState == FlashlightState.Panic) { _panicModeDuration -= Time.deltaTime; if (_panicModeDuration <= 0f) { TriggerFlashlightFadeRestore(3f); return; } _localFlashlightStateOn = true; if (_inPanicFlickerBurst) { _panicFlickerBurstTimer -= Time.deltaTime; float num4 = Mathf.PerlinNoise(_randomPerlinOffset, Time.time * 15f); _localFlashlightIntensityMultiplier = Mathf.Lerp(0.1f, 0.7f, num4); if (Random.value > 0.85f) { _localFlashlightIntensityMultiplier = 0f; } if (_panicFlickerBurstTimer <= 0f) { _inPanicFlickerBurst = false; _panicFlickerTimer = Random.Range(3f, 8f); } } else { _panicFlickerTimer -= Time.deltaTime; _localFlashlightIntensityMultiplier = 0.45f; float num5 = Mathf.PerlinNoise(_randomPerlinOffset + 100f, Time.time * 2f); _localFlashlightIntensityMultiplier *= Mathf.Lerp(0.95f, 1.05f, num5); if (_panicFlickerTimer <= 0f) { _inPanicFlickerBurst = true; _panicFlickerBurstTimer = Random.Range(0.3f, 1.2f); } } } else if (currentFlashlightState == FlashlightState.FadeRestore) { _localFlashlightStateOn = true; _fFadeProgress += Time.deltaTime; float num6 = Mathf.Clamp01(_fFadeProgress / _fFadeDuration); _localFlashlightIntensityMultiplier = Mathf.Lerp(_fFadeStartIntensity, _fFadeEndIntensity, num6); if (num6 >= 1f) { currentFlashlightState = FlashlightState.Normal; } } } private void LateUpdate() { ApplyAmbientOverride(); } private bool IsInCart(Transform item) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Transform parent = item.parent; while ((Object)(object)parent != (Object)null) { if (((Object)parent).name.ToLower().Contains("cart")) { return true; } parent = parent.parent; } IEnumerable<Rigidbody> enumerable = from r in Object.FindObjectsOfType<Rigidbody>() where ((Object)r).name.ToLower().Contains("cart") select r; foreach (Rigidbody item2 in enumerable) { if (Vector3.Distance(item.position, ((Component)item2).transform.position) < 1.8f) { return true; } } return false; } private IEnumerator AutoInfectRoutine() { if (!SemiFunc.IsMasterClientOrSingleplayer()) { yield break; } while (true) { yield return (object)new WaitForSeconds(Random.Range(45f, 90f)); if ((Object)(object)_infectedItemTransform != (Object)null || _jumpscareTriggered) { continue; } ValuableObject[] source = Object.FindObjectsOfType<ValuableObject>(); List<ValuableObject> list = source.Where((ValuableObject v) => IsInCart(((Component)v).transform)).ToList(); List<ValuableObject> list2 = source.Where((ValuableObject v) => !IsInCart(((Component)v).transform)).ToList(); if (list.Count <= 0 || list2.Count <= 0) { continue; } ValuableObject val = list[Random.Range(0, list.Count)]; ValuableObject val2 = list2[Random.Range(0, list2.Count)]; PhotonView component = ((Component)val2).GetComponent<PhotonView>(); PhotonView component2 = ((Component)val).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null) { float num = Random.Range(15f, 60f); if (PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom) { object[] array = new object[3] { component.ViewID, component2.ViewID, num }; HimPlugin.InfectItemEvent.RaiseEvent((object)array, NetworkingEvents.RaiseAll, SendOptions.SendReliable); } else { ApplyLocalInfectionDirect(((Component)val2).transform, num); } } } } public static void ApplyLocalInfectionDirect(Transform itemTransform, float triggerLimit) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)itemTransform == (Object)null)) { ParanoiaManager[] array = Object.FindObjectsOfType<ParanoiaManager>(); ParanoiaManager[] array2 = array; foreach (ParanoiaManager paranoiaManager in array2) { paranoiaManager._infectedItemTransform = itemTransform; paranoiaManager._lastKnownItemPosition = (((Object)(object)itemTransform != (Object)null) ? itemTransform.position : Vector3.zero); paranoiaManager._triggerLimit = triggerLimit; paranoiaManager._paranoiaTimer = 0f; paranoiaManager._hasParanoiaStarted = true; paranoiaManager._jumpscareTriggered = false; paranoiaManager._amITheTarget = false; paranoiaManager._targetLockTimer = 0f; } } } public static void SetGlobalTarget(int targetPlayerId) { PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if (!((Object)(object)val != (Object)null)) { return; } ParanoiaManager component = ((Component)val).GetComponent<ParanoiaManager>(); if ((Object)(object)component != (Object)null) { int num = (((Object)(object)val.photonView != (Object)null) ? val.photonView.ViewID : 0); if (num != targetPlayerId) { component._jumpscareTriggered = true; component._infectedItemTransform = null; component._amITheTarget = false; component._hasParanoiaStarted = false; HimPlugin.Logger.LogWarning("[PARANOIA] Qualcun altro è il bersaglio. Disattivo il tracker per me."); } } } public static void ApplyLocalInfection(int hideViewID, int copyViewID, float triggerLimit) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) PhotonView photonView = PhotonNetwork.GetPhotonView(hideViewID); PhotonView photonView2 = PhotonNetwork.GetPhotonView(copyViewID); if ((Object)(object)photonView == (Object)null || (Object)(object)photonView2 == (Object)null) { return; } ValuableObject component = ((Component)photonView).GetComponent<ValuableObject>(); ValuableObject component2 = ((Component)photonView2).GetComponent<ValuableObject>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { return; } MeshFilter componentInChildren = ((Component)component).GetComponentInChildren<MeshFilter>(); MeshFilter componentInChildren2 = ((Component)component2).GetComponentInChildren<MeshFilter>(); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren2 != (Object)null) { componentInChildren.sharedMesh = componentInChildren2.sharedMesh; } MeshRenderer componentInChildren3 = ((Component)component).GetComponentInChildren<MeshRenderer>(); MeshRenderer componentInChildren4 = ((Component)component2).GetComponentInChildren<MeshRenderer>(); if ((Object)(object)componentInChildren3 != (Object)null && (Object)(object)componentInChildren4 != (Object)null) { ((Renderer)componentInChildren3).sharedMaterials = ((Renderer)componentInChildren4).sharedMaterials; } PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)val != (Object)null) { ParanoiaManager component3 = ((Component)val).GetComponent<ParanoiaManager>(); if ((Object)(object)component3 != (Object)null) { component3._infectedItemTransform = ((Component)component).transform; component3._lastKnownItemPosition = ((Component)component).transform.position; component3._paranoiaTimer = 0f; component3._triggerLimit = triggerLimit; component3._jumpscareTriggered = false; component3._spawnGraceTimer = 2f; component3._amITheTarget = false; component3._hasParanoiaStarted = false; HimPlugin.Logger.LogWarning("========================================================================="); HimPlugin.Logger.LogWarning("[PARANOIA] OGGETTO INFETTO SINCRONIZZATO IN MAPPA!"); HimPlugin.Logger.LogWarning("[PARANOIA] Il clone maledetto di '" + ((Object)component2).name + "' ha preso forma."); HimPlugin.Logger.LogWarning($"[PARANOIA] Si trova alle coordinate: {((Component)component).transform.position}"); HimPlugin.Logger.LogWarning("========================================================================="); } } } private void HandleDebugHotkey() { //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)269)) { HimPlugin.Logger.LogInfo("[DEBUG] Premuto - — Dump Hierarchy of Loom and Upscream..."); IReadOnlyList<EnemySetup> allEnemies = Enemies.AllEnemies; if (allEnemies != null) { string text = Path.Combine(Application.dataPath, "PrefabDump.txt"); using (StreamWriter streamWriter = new StreamWriter(text)) { foreach (EnemySetup item in allEnemies) { if (item.spawnObjects == null || item.spawnObjects.Count == 0 || (Object)(object)((PrefabRef<GameObject>)(object)item.spawnObjects[0]).Prefab == (Object)null) { continue; } EnemyParent componentInChildren = ((PrefabRef<GameObject>)(object)item.spawnObjects[0]).Prefab.GetComponentInChildren<EnemyParent>(); if ((Object)(object)componentInChildren != (Object)null) { string text2 = componentInChildren.enemyName.ToLower(); if (text2.Contains("loom") || text2.Contains("upscream")) { streamWriter.WriteLine("========================================"); streamWriter.WriteLine("ENEMY: " + componentInChildren.enemyName); streamWriter.WriteLine("========================================"); DumpGameObject(((PrefabRef<GameObject>)(object)item.spawnObjects[0]).Prefab, streamWriter, ""); } } } } HimPlugin.Logger.LogInfo("[DEBUG] Dump completo in: " + text); } if ((Object)(object)EnemyDirector.instance != (Object)null) { IEnumerable<EnemySetup> enumerable = EnemyDirector.instance.enemiesDifficulty1.Concat(EnemyDirector.instance.enemiesDifficulty2).Concat(EnemyDirector.instance.enemiesDifficulty3); HimPlugin.Logger.LogInfo("[DEBUG] Nemici disponibili nel gioco:"); foreach (EnemySetup item2 in enumerable) { List<PrefabRef> spawnObjects = item2.spawnObjects; object obj; if (spawnObjects == null || spawnObjects.Count <= 0) { obj = null; } else { GameObject prefab = ((PrefabRef<GameObject>)(object)item2.spawnObjects[0]).Prefab; obj = ((prefab != null) ? prefab.GetComponent<EnemyParent>() : null); } EnemyParent val = (EnemyParent)obj; string text3 = (((Object)(object)val != (Object)null) ? val.enemyName : "(EnemyParent non trovato)"); HimPlugin.Logger.LogInfo("[DEBUG] ENEMY -> EnemySetup.name='" + ((Object)item2).name + "' | EnemyParent.enemyName='" + text3 + "'"); } } } if (!Input.GetKeyDown((KeyCode)268)) { return; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { HimPlugin.Logger.LogWarning("[DEBUG] Solo l'host può usare il tasto * per forzare un oggetto!"); return; } ValuableObject[] array = Object.FindObjectsOfType<ValuableObject>(); HimPlugin.Logger.LogInfo($"[DEBUG] ValuableObject trovati in scena: {array.Length}"); if (array.Length == 0) { HimPlugin.Logger.LogWarning("[DEBUG] Nessun ValuableObject trovato! Sei in-game? Prova ad aspettare che la mappa sia caricata."); return; } ValuableObject val2 = array.OrderBy((ValuableObject v) => Vector3.Distance(((Component)this).transform.position, ((Component)v).transform.position)).First(); PhotonView component = ((Component)val2).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && (Object)(object)val2 != (Object)null) { float num = Random.Range(15f, 60f); if (PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom) { object[] array2 = new object[3] { component.ViewID, component.ViewID, num }; HimPlugin.InfectItemEvent.RaiseEvent((object)array2, NetworkingEvents.RaiseAll, SendOptions.SendReliable); } else { ApplyLocalInfectionDirect(((Component)val2).transform, num); } ((Component)val2).transform.position = ((Component)this).transform.position + ((Component)this).transform.forward * 1.5f + Vector3.up * 0.2f; Rigidbody component2 = ((Component)val2).GetComponent<Rigidbody>(); if ((Object)(object)component2 != (Object)null) { component2.velocity = Vector3.zero; component2.angularVelocity = Vector3.zero; } HimPlugin.Logger.LogInfo("[DEBUG] INFETTATO E TELETRASPORTATO: '" + ((Object)val2).name + "'. Raccoglilo e mettilo nel carrello."); } } private void DumpGameObject(GameObject go, StreamWriter writer, string indent) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown if ((Object)(object)go == (Object)null) { return; } string text = string.Join(", ", from c in go.GetComponents<Component>() where (Object)(object)c != (Object)null select ((object)c).GetType().Name); writer.WriteLine(indent + "- " + ((Object)go).name + " [" + text + "]"); foreach (Transform item in go.transform) { Transform val = item; DumpGameObject(((Component)val).gameObject, writer, indent + " "); } } private void HandleParanoiaLogic() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: 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_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) if (_jumpscareTriggered) { return; } if (_spawnGraceTimer > 0f) { _spawnGraceTimer -= Time.deltaTime; return; } if ((Object)(object)_infectedItemTransform == (Object)null) { if (_amITheTarget && (Object)(object)EnemyDirector.instance != (Object)null) { HimPlugin.Logger.LogWarning("[PARANOIA] Oggetto ROTTO/DISTRUTTO! Spawno alle ultime coordinate note!"); StartJumpscareSequence(_lastKnownItemPosition); } return; } _lastKnownItemPosition = _infectedItemTransform.position; _debugLogCooldown -= Time.deltaTime; bool flag = _debugLogCooldown <= 0f; if (flag) { _debugLogCooldown = 1f; } Vector3 position = _infectedItemTransform.position; float num = Vector3.Distance(((Component)this).transform.position, position); PhysGrabObject val = ((Component)_infectedItemTransform).GetComponent<PhysGrabObject>(); if ((Object)(object)val == (Object)null) { val = ((Component)_infectedItemTransform).GetComponentInParent<PhysGrabObject>(); } bool flag2 = (Object)(object)val != (Object)null && val.grabbedLocal; bool flag3 = (Object)(object)val != (Object)null && val.grabbed; if (flag2 && !_amITheTarget) { _amITheTarget = true; if ((Object)(object)_player != (Object)null && (Object)(object)_player.photonView != (Object)null && PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom) { HimPlugin.TargetChosenEvent.RaiseEvent((object)_player.photonView.ViewID, NetworkingEvents.RaiseAll, SendOptions.SendReliable); } else { int globalTarget = (((Object)(object)_player != (Object)null && (Object)(object)_player.photonView != (Object)null) ? _player.photonView.ViewID : 0); SetGlobalTarget(globalTarget); } string text = (((Object)(object)_player != (Object)null) ? ((Object)_player).name : "Un giocatore"); FieldInfo fieldInfo = ((object)_player)?.GetType().GetField("playerName", BindingFlags.Instance | BindingFlags.Public); if (fieldInfo != null && fieldInfo.FieldType == typeof(string)) { text = (string)fieldInfo.GetValue(_player); } HimPlugin.Logger.LogInfo("[PARANOIA] " + text + " ha afferrato l'oggetto e firmato la maledizione!"); } else if (!_amITheTarget) { _targetLockTimer = 0f; } if (!_amITheTarget) { if (currentFlashlightState == FlashlightState.BuildUp) { SetFlashlightState(FlashlightState.Normal); } return; } bool flag4 = true; PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val2 in array) { if (val2.isLocal || !((Component)val2).gameObject.activeInHierarchy) { continue; } float num2 = Vector3.Distance(((Component)_player).transform.position, ((Component)val2).transform.position); if (num2 < _isolationRadius) { flag4 = false; if (flag) { HimPlugin.Logger.LogWarning($"[PARANOIA] Altri giocatori troppo vicini al bersaglio: {((Object)val2).name} ({num2:F1}m < {_isolationRadius}m)"); } break; } } if (!_hasParanoiaStarted) { bool flag5 = num < _trackingRadius; if (flag5 && flag4) { _hasParanoiaStarted = true; HimPlugin.Logger.LogWarning("[PARANOIA] Condizioni iniziali soddisfatte! L'accumulo della paranoia è INIZIATO."); } } if (!_hasParanoiaStarted) { return; } bool flag6 = false; if ((Object)(object)_playerCamera == (Object)null) { _playerCamera = ((Component)this).GetComponentInChildren<Camera>(); if ((Object)(object)_playerCamera == (Object)null) { _playerCamera = Camera.main; } } if ((Object)(object)_playerCamera != (Object)null) { Vector3 val3 = position - ((Component)_playerCamera).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; flag6 = Vector3.Dot(((Component)_playerCamera).transform.forward, normalized) > 0.25f; } if (flag) { HimPlugin.Logger.LogInfo($"[STATE] itemPos={position:F1} | distToItem={num:F1}m | isIsolated={flag4} | isLooking={flag6} | timer={_paranoiaTimer:F1}/{_triggerLimit:F1}s"); } if (flag4 && !flag6) { _paranoiaTimer += Time.deltaTime; } if (!_fakeFootstepsSource.isPlaying) { ((Component)_fakeFootstepsSource).transform.position = ((Component)_player).transform.position - ((Component)_player).transform.forward * 2f; } if (_paranoiaTimer >= _triggerLimit) { StartJumpscareSequence(position); } } private void StartJumpscareSequence(Vector3 itemPosition) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) _jumpscareTriggered = true; _infectedItemTransform = null; HimPlugin.Logger.LogWarning("!!! INIZIO SEQUENZA JUMPSCARE !!!"); ((MonoBehaviour)this).StartCoroutine(JumpscareSequenceCoroutine(itemPosition)); } private IEnumerator JumpscareSequenceCoroutine(Vector3 itemPosition) { //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) float origAmbientInt = RenderSettings.ambientIntensity; float origReflectInt = RenderSettings.reflectionIntensity; Color origAmbientColor = RenderSettings.ambientLight; SetFlashlightState(FlashlightState.BuildUp); for (int i = 0; i < 12; i++) { SetAmbientOverride(0f, 0f, Color.black); yield return (object)new WaitForSeconds(Random.Range(0.04f, 0.09f)); SetAmbientOverride(origAmbientInt * 1.5f, origReflectInt * 1.5f, origAmbientColor * 1.5f); yield return (object)new WaitForSeconds(Random.Range(0.04f, 0.15f)); } Coroutine flickerCoroutine = ((MonoBehaviour)this).StartCoroutine(ContinuousAmbientFlicker(35f, origAmbientInt, origReflectInt, origAmbientColor)); yield return ((MonoBehaviour)this).StartCoroutine(ShowThreateningTextSequence(itemPosition, origAmbientInt, origReflectInt, origAmbientColor, flickerCoroutine)); } private IEnumerator ContinuousAmbientFlicker(float duration, float origAmbientInt, float origReflectInt, Color origAmbientColor) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) float elapsed = 0f; while (elapsed < duration) { float value = Random.value; if (value < 0.3f) { int count = Random.Range(3, 6); for (int i = 0; i < count; i++) { SetAmbientOverride(0f, 0f, Color.black); float num = Random.Range(0.03f, 0.07f); elapsed += num; yield return (object)new WaitForSeconds(num); float num2 = ((Random.value > 0.75f) ? 1.6f : 0.9f); SetAmbientOverride(origAmbientInt * num2, origReflectInt * num2, origAmbientColor * num2); float num3 = Random.Range(0.03f, 0.07f); elapsed += num3; yield return (object)new WaitForSeconds(num3); } } else if (value < 0.7f) { int count = Random.Range(2, 4); for (int i = 0; i < count; i++) { float num4 = ((Random.value > 0.6f) ? 0f : 0.02f); SetAmbientOverride(origAmbientInt * num4, origReflectInt * num4, Color.black); float num5 = Random.Range(0.15f, 0.38f); elapsed += num5; yield return (object)new WaitForSeconds(num5); float num6 = Random.Range(0.5f, 1.1f); SetAmbientOverride(origAmbientInt * num6, origReflectInt * num6, origAmbientColor * num6); float num7 = Random.Range(0.18f, 0.35f); elapsed += num7; yield return (object)new WaitForSeconds(num7); } } else { float dimMult = Random.Range(0.08f, 0.22f); SetAmbientOverride(origAmbientInt * dimMult, origReflectInt * dimMult, origAmbientColor * dimMult); float num8 = Random.Range(1f, 2.2f); float halfTime = num8 * 0.5f; elapsed += halfTime; yield return (object)new WaitForSeconds(halfTime); if (Random.value > 0.4f) { SetAmbientOverride(0f, 0f, Color.black); yield return (object)new WaitForSeconds(0.06f); elapsed += 0.06f; SetAmbientOverride(origAmbientInt * dimMult, origReflectInt * dimMult, origAmbientColor * dimMult); } elapsed += halfTime; yield return (object)new WaitForSeconds(halfTime); } float num9 = Random.Range(0.35f, 0.8f); SetAmbientOverride(0f, 0f, Color.black); elapsed += num9; yield return (object)new WaitForSeconds(num9); } SetAmbientOverride(origAmbientInt * 0.2f, origReflectInt * 0.2f, origAmbientColor * 0.2f); } private Vector3 GetRandomPositionAroundPlayer(float minDistance, float maxDistance) { //IL_0063: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_player == (Object)null) { return Vector3.zero; } float num = Random.Range(0f, 360f) * (MathF.PI / 180f); float num2 = Random.Range(minDistance, maxDistance); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Cos(num) * num2, Random.Range(-0.5f, 1.2f), Mathf.Sin(num) * num2); return ((Component)_player).transform.position + val; } private void PlaySpookySoundWithDelay(Vector3 position, float delay, bool useImpact, float volume, float pitch) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(PlaySpookySoundWithDelayCoroutine(position, delay, useImpact, volume, pitch)); } private IEnumerator PlaySpookySoundWithDelayCoroutine(Vector3 position, float delay, bool useImpact, float volume, float pitch) { //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(delay); PlaySpookySound(position, useImpact, volume, pitch); } private IEnumerator PlayScaryTextSoundSequence(Vector3 itemPos) { //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) float delay = Random.Range(0f, 2f); PlaySpookySoundWithDelay(itemPos, delay, useImpact: false, 1f, 0.7f); yield return (object)new WaitForSeconds(2.7f); float delay2 = Random.Range(0f, 3f); PlaySpookySoundWithDelay(itemPos, delay2, useImpact: true, 0.65f, 0.35f); yield return (object)new WaitForSeconds(3.7f); float delay3 = Random.Range(0f, 3f); PlaySpookySoundWithDelay(itemPos, delay3, useImpact: false, 1.1f, 0.6f); yield return (object)new WaitForSeconds(4.7f); float delay4 = Random.Range(0f, 0.7f); Vector3 randomPositionAroundPlayer = GetRandomPositionAroundPlayer(2.5f, 5f); PlaySpookySoundWithDelay(randomPositionAroundPlayer, delay4, useImpact: true, 1f, 0.48f); float delay5 = 3f + Random.Range(0f, 3f); PlaySpookySoundWithDelay(itemPos, delay5, useImpact: false, 1.1f, 1.25f); } private IEnumerator ShowThreateningTextSequence(Vector3 itemPosition, float origAmbientInt, float origReflectInt, Color origAmbientColor, Coroutine flickerCoroutine) { //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) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) GameObject canvasObj = new GameObject("HorrorTextCanvas"); Canvas val = canvasObj.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; val.sortingOrder = 10000; GameObject val2 = new GameObject("TVStaticGrain"); val2.transform.SetParent(canvasObj.transform, false); _staticTextNoise = val2.AddComponent<Text>(); _staticTextNoise.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); _staticTextNoise.fontSize = 24; ((Graphic)_staticTextNoise).color = new Color(0.7f, 0f, 0f, 0.045f); _staticTextNoise.alignment = (TextAnchor)4; _staticTextNoise.horizontalOverflow = (HorizontalWrapMode)1; _staticTextNoise.verticalOverflow = (VerticalWrapMode)1; RectTransform component = ((Component)_staticTextNoise).GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; _noiseFrames = new string[6]; char[] array = new char[12] { '░', '▒', '▓', '.', ':', '-', '=', '+', '*', ' ', ' ', ' ' }; for (int i = 0; i < _noiseFrames.Length; i++) { StringBuilder stringBuilder = new StringBuilder(); for (int j = 0; j < 18; j++) { for (int k = 0; k < 62; k++) { stringBuilder.Append(array[Random.Range(0, array.Length)]); } stringBuilder.Append("\n"); } _noiseFrames[i] = stringBuilder.ToString(); } GameObject val3 = new GameObject("HorrorText"); val3.transform.SetParent(canvasObj.transform, false); Text text = val3.AddComponent<Text>(); text.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); text.fontSize = 110; ((Graphic)text).color = new Color(0.8f, 0f, 0f, 0f); text.alignment = (TextAnchor)4; Outline val4 = val3.AddComponent<Outline>(); ((Shadow)val4).effectColor = new Color(0.1f, 0f, 0f, 1f); ((Shadow)val4).effectDistance = new Vector2(4f, -4f); Shadow val5 = val3.AddComponent<Shadow>(); val5.effectColor = new Color(0f, 0f, 0f, 0.8f); val5.effectDistance = new Vector2(8f, -8f); text.horizontalOverflow = (HorizontalWrapMode)1; text.verticalOverflow = (VerticalWrapMode)1; RectTransform component2 = ((Component)text).GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0.15f); component2.anchorMax = new Vector2(1f, 0.35f); component2.sizeDelta = Vector2.zero; ((MonoBehaviour)this).StartCoroutine(PlayScaryTextSoundSequence(itemPosition)); yield return ((MonoBehaviour)this).StartCoroutine(FlickerFadeText(text, "RUN.", 2.5f)); yield return (object)new WaitForSeconds(0.2f); yield return ((MonoBehaviour)this).StartCoroutine(FlickerFadeText(text, "CALL FOR HELP.", 3.5f)); yield return (object)new WaitForSeconds(0.2f); yield return ((MonoBehaviour)this).StartCoroutine(FlickerFadeText(text, "HE CAN HEAR YOU.", 4.5f)); yield return (object)new WaitForSeconds(0.2f); ((MonoBehaviour)this).StartCoroutine(FlickerFadeText(text, "RUN NOW.\nHE IS HERE.", 16f)); yield return (object)new WaitForSeconds(0.8f); if (flickerCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(flickerCoroutine); } TriggerFlashlightFadeOut(1.2f); float fadeElapsed = 0f; float fadeDuration = 1.2f; while (fadeElapsed < fadeDuration) { fadeElapsed += Time.deltaTime; float num = Mathf.Clamp01(fadeElapsed / fadeDuration); float ambInt = Mathf.Lerp(origAmbientInt, 0f, num); float refInt = Mathf.Lerp(origReflectInt, 0f, num); Color ambCol = Color.Lerp(origAmbientColor, Color.black, num); SetAmbientOverride(ambInt, refInt, ambCol); yield return null; } SetAmbientOverride(0f, 0f, Color.black); SetFlashlightState(FlashlightState.Off); yield return (object)new WaitForSeconds(0.2f); PlaySpookySound(itemPosition, useImpact: true, 1.4f, 0.5f); PlaySpookySound(itemPosition, useImpact: false, 1.3f, 0.7f); TriggerJumpscare(itemPosition, origAmbientInt, origReflectInt, origAmbientColor); yield return (object)new WaitForSeconds(3f); TriggerFlashlightFadeIn(2f, 0.45f); _panicModeDuration = 60f; _panicFlickerTimer = Random.Range(2f, 5f); _inPanicFlickerBurst = false; yield return (object)new WaitForSeconds(15f); Object.Destroy((Object)(object)canvasObj); _staticTextNoise = null; _noiseFrames = null; } public void PlaySpookySound(Vector3 position, bool useImpact, float volume = 1f, float pitch = 1f) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AudioScare.instance == (Object)null) { return; } AudioClip[] array = (useImpact ? AudioScare.instance.impactSounds : AudioScare.instance.softSounds); if (array != null && array.Length != 0) { int num = Random.Range(0, array.Length); AudioClip val = array[num]; if ((Object)(object)val != (Object)null) { GameObject val2 = new GameObject("SpookyTextSFX"); val2.transform.position = position; AudioSource val3 = val2.AddComponent<AudioSource>(); val3.clip = val; val3.volume = volume; val3.pitch = pitch; val3.spatialBlend = 1f; val3.rolloffMode = (AudioRolloffMode)0; val3.minDistance = 3f; val3.maxDistance = 150f; val3.Play(); Object.Destroy((Object)(object)val2, val.length / Mathf.Max(0.1f, pitch) + 0.5f); } } } private string GetCorruptedText(string original) { char[] array = original.ToCharArray(); char[] array2 = new char[9] { '░', '▒', '▓', '‡', '†', 'X', '?', '#', '%' }; for (int i = 0; i < array.Length; i++) { if (array[i] != ' ' && array[i] != '\n' && Random.value > 0.93f) { array[i] = array2[Random.Range(0, array2.Length)]; } } return new string(array); } private void ApplyTextGlitchJitter(Text textObj, Outline outline, Shadow shadow) { //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)textObj == (Object)null) { return; } if (Random.value > 0.12f) { float num = ((Random.value > 0.92f) ? 28f : 11f); float num2 = Random.Range(0f - num, num); float num3 = Random.Range(0f - num, num); ((Graphic)textObj).rectTransform.anchoredPosition = new Vector2(num2, num3); float num4 = Random.Range(-4f, 4f); ((Transform)((Graphic)textObj).rectTransform).localRotation = Quaternion.Euler(0f, 0f, num4); float num5 = 1f + Random.Range(-0.06f, 0.06f); float num6 = 1f + Random.Range(-0.06f, 0.06f); ((Transform)((Graphic)textObj).rectTransform).localScale = new Vector3(num5, num6, 1f); if ((Object)(object)outline != (Object)null) { ((Shadow)outline).effectDistance = new Vector2(Random.Range(3f, 6f), Random.Range(-6f, -3f)); } if ((Object)(object)shadow != (Object)null) { shadow.effectDistance = new Vector2(Random.Range(6f, 11f), Random.Range(-11f, -6f)); } } else { ((Graphic)textObj).rectTransform.anchoredPosition = Vector2.zero; ((Transform)((Graphic)textObj).rectTransform).localRotation = Quaternion.identity; ((Transform)((Graphic)textObj).rectTransform).localScale = Vector3.one; if ((Object)(object)outline != (Object)null) { ((Shadow)outline).effectDistance = new Vector2(4f, -4f); } if ((Object)(object)shadow != (Object)null) { shadow.effectDistance = new Vector2(8f, -8f); } } } private IEnumerator FlickerFadeText(Text textObj, string content, float displayTime) { if ((Object)(object)textObj == (Object)null) { yield break; } textObj.text = content; float flickerSpeed = 20f; Color _targetColor = new Color(0.8f, 0f, 0f, 1f); Outline outline = ((Component)textObj).GetComponent<Outline>(); Shadow shadow = ((Component)textObj).GetComponent<Shadow>(); float elapsed = 0f; while (elapsed < 0.5f) { if ((Object)(object)textObj == (Object)null) { yield break; } float num = Mathf.PingPong(Time.time * flickerSpeed, 1f); ((Graphic)textObj).color = new Color(_targetColor.r, _targetColor.g, _targetColor.b, num); if ((Object)(object)outline != (Object)null) { ((Shadow)outline).effectColor = new Color(0.1f, 0f, 0f, num); } if ((Object)(object)shadow != (Object)null) { shadow.effectColor = new Color(0f, 0f, 0f, num * 0.8f); } textObj.text = GetCorruptedText(content); ApplyTextGlitchJitter(textObj, outline, shadow); if ((Object)(object)_staticTextNoise != (Object)null && _noiseFrames != null && _noiseFrames.Length != 0) { _staticTextNoise.text = _noiseFrames[Random.Range(0, _noiseFrames.Length)]; ((Graphic)_staticTextNoise).rectTransform.anchoredPosition = new Vector2(Random.Range(-10f, 10f), Random.Range(-10f, 10f)); } elapsed += Time.deltaTime; yield return null; } if ((Object)(object)textObj == (Object)null) { yield break; } ((Graphic)textObj).color = _targetColor; if ((Object)(object)outline != (Object)null) { ((Shadow)outline).effectColor = new Color(0.1f, 0f, 0f, 1f); } if ((Object)(object)shadow != (Object)null) { shadow.effectColor = new Color(0f, 0f, 0f, 0.8f); } float displayElapsed = 0f; while (displayElapsed < displayTime) { if ((Object)(object)textObj == (Object)null) { yield break; } textObj.text = GetCorruptedText(content); ApplyTextGlitchJitter(textObj, outline, shadow); if ((Object)(object)_staticTextNoise != (Object)null && _noiseFrames != null && _noiseFrames.Length != 0) { _staticTextNoise.text = _noiseFrames[Random.Range(0, _noiseFrames.Length)]; ((Graphic)_staticTextNoise).rectTransform.anchoredPosition = new Vector2(Random.Range(-10f, 10f), Random.Range(-10f, 10f)); } displayElapsed += Time.deltaTime; yield return null; } elapsed = 0f; while (elapsed < 0.5f) { if ((Object)(object)textObj == (Object)null) { yield break; } float num2 = Mathf.PingPong(Time.time * flickerSpeed, 1f); ((Graphic)textObj).color = new Color(_targetColor.r, _targetColor.g, _targetColor.b, num2); if ((Object)(object)outline != (Object)null) { ((Shadow)outline).effectColor = new Color(0.1f, 0f, 0f, num2); } if ((Object)(object)shadow != (Object)null) { shadow.effectColor = new Color(0f, 0f, 0f, num2 * 0.8f); } textObj.text = GetCorruptedText(content); ApplyTextGlitchJitter(textObj, outline, shadow); if ((Object)(object)_staticTextNoise != (Object)null && _noiseFrames != null && _noiseFrames.Length != 0) { _staticTextNoise.text = _noiseFrames[Random.Range(0, _noiseFrames.Length)]; ((Graphic)_staticTextNoise).rectTransform.anchoredPosition = new Vector2(Random.Range(-10f, 10f), Random.Range(-10f, 10f)); } elapsed += Time.deltaTime; yield return null; } if (!((Object)(object)textObj == (Object)null)) { ((Graphic)textObj).color = Color.clear; ((Graphic)textObj).rectTransform.anchoredPosition = Vector2.zero; ((Transform)((Graphic)textObj).rectTransform).localRotation = Quaternion.identity; ((Transform)((Graphic)textObj).rectTransform).localScale = Vector3.one; if ((Object)(object)outline != (Object)null) { ((Shadow)outline).effectColor = Color.clear; } if ((Object)(object)shadow != (Object)null) { shadow.effectColor = Color.clear; } } } public void RestoreLightsWithFlicker(float origAmbientInt, float origReflectInt, Color origAmbientColor) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(RestoreLightsCoroutine(origAmbientInt, origReflectInt, origAmbientColor)); } private IEnumerator RestoreLightsCoroutine(float origAmbientInt, float origReflectInt, Color origAmbientColor) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) float duration = 4f; float elapsed = 0f; float startAmbient = RenderSettings.ambientIntensity; float startReflect = RenderSettings.reflectionIntensity; Color startColor = RenderSettings.ambientLight; while (elapsed < duration) { elapsed += Time.deltaTime; float num = Mathf.Clamp01(elapsed / duration); SetAmbientOverride(Mathf.Lerp(startAmbient, origAmbientInt, num), Mathf.Lerp(startReflect, origReflectInt, num), Color.Lerp(startColor, origAmbientColor, num)); yield return null; } RenderSettings.ambientIntensity = origAmbientInt; RenderSettings.reflectionIntensity = origReflectInt; RenderSettings.ambientLight = origAmbientColor; ClearAmbientOverride(); } private void TriggerJumpscare(Vector3 itemPosition, float origAmbientInt, float origReflectInt, Color origAmbientColor) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00eb: Unknown result type (might be due to invalid IL or missing references) HimPlugin.Logger.LogWarning("!!! SPAWN UPSCREAM !!! Cerco setup..."); EnemySetup val = FindScreamerSetup(); if ((Object)(object)val == (Object)null) { HimPlugin.Logger.LogError("[JUMPSCARE] Nessun EnemySetup trovato! Impossibile spawnare il mostro."); return; } Vector3 val2 = itemPosition; val2 += Vector3.up * 0.5f; Quaternion val3 = Quaternion.LookRotation(((Component)_player).transform.position - val2); HimPlugin.Logger.LogInfo($"[JUMPSCARE] Inizio procedura spawn per '{((Object)val).name}' a {val2}..."); if (!SemiFunc.IsMasterClientOrSingleplayer()) { HimPlugin.Logger.LogInfo("[JUMPSCARE] Sono un client. Richiedo lo spawn all'Host!"); int num = (((Object)(object)_player.photonView != (Object)null) ? _player.photonView.ViewID : (-1)); HimPlugin.SpawnScreamerEvent.RaiseEvent((object)new object[3] { val2, val3, num }, NetworkingEvents.RaiseMasterClient, SendOptions.SendReliable); } else { HostSpawnScreamer(val2, val3, ((Object)(object)_player.photonView != (Object)null) ? _player.photonView.ViewID : (-1)); } } public static void HostSpawnScreamer(Vector3 spawnPos, Quaternion spawnRot, int targetPhotonId) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) ParanoiaManager paranoiaManager = Object.FindObjectOfType<ParanoiaManager>(); EnemySetup val = paranoiaManager.FindScreamerSetup(); if (!((Object)(object)val == (Object)null)) { List<EnemyParent> list = Enemies.SpawnEnemy(val, spawnPos, spawnRot, false); if (list == null || list.Count == 0) { HimPlugin.Logger.LogError("[HOST] Enemies.SpawnEnemy() ha restituito null/vuoto. Spawn fallito."); return; } HimPlugin.Logger.LogInfo($"[HOST] Spawnati {list.Count} EnemyParent. Applico potenziamenti..."); ((MonoBehaviour)paranoiaManager).StartCoroutine(paranoiaManager.DelayedEnhanceScreamer(list, targetPhotonId)); } } private IEnumerator DelayedEnhanceScreamer(List<EnemyParent> spawned, int targetPhotonId) { yield return (object)new WaitForSeconds(1.5f); foreach (EnemyParent item in spawned) { if ((Object)(object)item == (Object)null) { continue; } PhotonView component = ((Component)item).GetComponent<PhotonView>(); int num = ((component != null) ? component.ViewID : 0); if (PhotonNetwork.IsConnectedAndReady && PhotonNetwork.InRoom) { if (num != 0) { HimPlugin.EnhanceScreamerEvent.RaiseEvent((object)new object[2] { num, targetPhotonId }, NetworkingEvents.RaiseAll, SendOptions.SendReliable); } } else { ApplyEnhancementToEnemy(item, targetPhotonId); } } } public static void ApplyLocalEnhancement(int enemyViewId, int targetPlayerId) { PhotonView val = PhotonView.Find(enemyViewId); if ((Object)(object)val == (Object)null) { HimPlugin.Logger.LogWarning($"[CLIENT] Nessun PhotonView trovato con ID {enemyViewId}."); return; } EnemyParent component = ((Component)val).GetComponent<EnemyParent>(); if (!((Object)(object)component == (Object)null)) { ApplyEnhancementToEnemy(component, targetPlayerId); } } public static void ApplyEnhancementToEnemy(EnemyParent ep, int targetPlayerId) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) if ((Object)(object)ep == (Object)null) { return; } if (SemiFunc.IsMasterClientOrSingleplayer()) { NavMeshAgent componentInChildren = ((Component)ep).GetComponentInChildren<NavMeshAgent>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.speed *= 6.5f; componentInChildren.acceleration *= 6.5f; } } Transform transform = ((Component)ep).transform; transform.localScale *= 1.35f; UpscreamEnhancer upscreamEnhancer = ((Component)ep).gameObject.AddComponent<UpscreamEnhancer>(); upscreamEnhancer.enemyScript = ep; if (targetPlayerId == 0) { upscreamEnhancer.targetPlayer = SemiFunc.PlayerAvatarLocal(); } else { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val in array) { if ((Object)(object)val.photonView != (Object)null && val.photonView.ViewID == targetPlayerId) { upscreamEnhancer.targetPlayer = val; break; } } } upscreamEnhancer.SetOriginalLights(RenderSettings.ambientIntensity, RenderSettings.reflectionIntensity, RenderSettings.ambientLight); } private EnemySetup FindScreamerSetup() { if ((Object)(object)_cachedScreamerSetup != (Object)null) { return _cachedScreamerSetup; } if ((Object)(object)EnemyDirector.instance == (Object)null) { HimPlugin.Logger.LogError("[FindScreamer] EnemyDirector.instance è null!"); return null; } IEnumerable<EnemySetup> enumerable = EnemyDirector.instance.enemiesDifficulty1.Concat(EnemyDirector.instance.enemiesDifficulty2).Concat(EnemyDirector.instance.enemiesDifficulty3); EnemySetup val = null; foreach (EnemySetup item in enumerable) { List<PrefabRef> spawnObjects = item.spawnObjects; object obj; if (spawnObjects == null || spawnObjects.Count <= 0) { obj = null; } else { GameObject prefab = ((PrefabRef<GameObject>)(object)item.spawnObjects[0]).Prefab; obj = ((prefab != null) ? prefab.GetComponent<EnemyParent>() : null); } EnemyParent val2 = (EnemyParent)obj; string text = (((Object)(object)val2 != (Object)null) ? val2.enemyName : ((Object)item).name); HimPlugin.Logger.LogInfo("[FindScreamer] Controllo: setup='" + ((Object)item).name + "' enemyName='" + text + "'"); string text2 = text.ToLowerInvariant(); if (text2.Contains("scream") || text2.Contains("shriek") || text2.Contains("howl")) { HimPlugin.Logger.LogInfo("[FindScreamer] TROVATO! '" + text + "'. (Cached)"); _cachedScreamerSetup = item; return item; } if ((Object)(object)val == (Object)null) { val = item; } } if ((Object)(object)val != (Object)null) { HimPlugin.Logger.LogWarning("[FindScreamer] 'scream' non trovato. Uso fallback: '" + ((Object)val).name + "'"); } _cachedScreamerSetup = val; return val; } } public class UpscreamEnhancer : MonoBehaviour { public PlayerAvatar targetPlayer; public EnemyParent enemyScript; private Material _blackMat; private Vector3 _originalScale; private float _origAmbientInt; private float _origReflectInt; private Color _origAmbientColor; private GameObject _darkCanvas; private bool _lightsRestored; private Transform _loomJawBone; private Quaternion _originalJawRot; private bool _enhancementApplied; private float _enhancementTimer; private List<AudioSource> _earrapeSources = new List<AudioSource>(); private int _customAttacks; private State _lastState; private float _escapeTimer; private Vector3 _escapeDestination = Vector3.zero; private bool _isEscaping; private Transform _loomHeadTrans; private GameObject _panicOverlay; private Image _panicImage; private float _escapeSoundTimer; private bool _escapeSoundPlayed; private float _stuckTimer; private AudioSource _customScreamSource; public void SetOriginalLights(float ambInt, float refInt, Color ambCol) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) _origAmbientInt = ambInt; _origReflectInt = refInt; _origAmbientColor = ambCol; } private void Start() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Expected O, but got Unknown //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetPlayer != (Object)null && targetPlayer.isLocal) { _darkCanvas = new GameObject("HorrorSoftDarkness"); Canvas val = _darkCanvas.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; val.sortingOrder = 9998; GameObject val2 = new GameObject("DarkImage"); val2.transform.SetParent(_darkCanvas.transform, false); RawImage val3 = val2.AddComponent<RawImage>(); ((Graphic)val3).color = new Color(0f, 0f, 0f, 0.45f); RectTransform component = ((Component)val3).GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; } if ((Object)(object)targetPlayer != (Object)null && targetPlayer.isLocal) { HimPlugin.Logger.LogWarning($"[AUDIO] Tentativo di riproduzione urlo custom. ScreamClip caricato: {(Object)(object)CustomAudioLoader.ScreamClip != (Object)null}"); if ((Object)(object)CustomAudioLoader.ScreamClip != (Object)null) { GameObject val4 = new GameObject("CustomScreamSound"); val4.transform.SetParent(((Component)this).transform, false); _customScreamSource = val4.AddComponent<AudioSource>(); _customScreamSource.clip = CustomAudioLoader.ScreamClip; _customScreamSource.spatialBlend = 1f; _customScreamSource.minDistance = 3f; _customScreamSource.maxDistance = 45f; _customScreamSource.rolloffMode = (AudioRolloffMode)1; _customScreamSource.loop = true; _customScreamSource.volume = 1f; _customScreamSource.pitch = 0.85f; _customScreamSource.Play(); HimPlugin.Logger.LogWarning("[AUDIO] Riproduzione custom scream avviata con successo per il bersaglio!"); } else { HimPlugin.Logger.LogError("[AUDIO] ERRORE: ScreamClip è NULL. Il file scream.mp3/wav/ogg non è stato caricato correttamente all'avvio."); } } if (SemiFunc.IsMasterClientOrSingleplayer()) { PhotonView component2 = ((Component)this).GetComponent<PhotonView>(); ((MonoBehaviour)this).StartCoroutine(DestroyOverNetworkAfterTime(60f, component2)); } _blackMat = new Material(Shader.Find("Standard")); Texture2D val5 = new Texture2D(64, 64, (TextureFormat)3, false); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num = Mathf.PerlinNoise((float)j * 0.2f, (float)i * 0.2f); float num2 = Mathf.PerlinNoise((float)i * 0.4f, (float)j * 0.4f); float num3 = Mathf.Max(num, num2); float num4 = ((num3 > 0.65f) ? 0f : Mathf.Lerp(0.01f, 0.18f, num3)); val5.SetPixel(j, i, new Color(num4, num4, num4, 1f)); } } val5.Apply(); _blackMat.color = Color.black; _blackMat.mainTexture = (Texture)(object)val5; _blackMat.SetFloat("_Glossiness", 0.05f); _blackMat.SetFloat("_Metallic", 0f); ((Object)_blackMat).name = "TexturedBlackMat"; Light[] componentsInChildren = ((Component)this).GetComponentsInChildren<Light>(); foreach (Light val6 in componentsInChildren) { ((Behaviour)val6).enabled = false; } _originalScale = ((Component)this).transform.localScale; Transform parent = ((Component)this).transform; Transform[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<Transform>(); foreach (Transform val7 in componentsInChildren2) { if (((Object)val7).name.ToLower().Contains("head")) { parent = val7; break; } } GameObject val8 = new GameObject("UpscreamFaceLight"); val8.transform.SetParent(parent); val8.transform.localPosition = new Vector3(0f, 0.2f, 0.3f); Light val9 = val8.AddComponent<Light>(); val9.type = (LightType)2; val9.range = 8f; val9.intensity = 0.6f; val9.color = new Color(0.8f, 0.9f, 1f); ReplaceHeadWithLoom(); TryForceAggro(); } private void ReplaceHeadWithLoom() { //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) IReadOnlyList<EnemySetup> allEnemies = Enemies.AllEnemies; EnemySetup val = null; if (allEnemies != null) { foreach (EnemySetup item in allEnemies) { if (item.spawnObjects != null && item.spawnObjects.Count > 0 && (Object)(object)((PrefabRef<GameObject>)(object)item.spawnObjects[0]).Prefab != (Object)null) { EnemyParent componentInChildren = ((PrefabRef<GameObject>)(object)item.spawnObjects[0]).Prefab.GetComponentInChildren<EnemyParent>(); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.enemyName != null && componentInChildren.enemyName.ToLower().Contains("loom")) { val = item; break; } } } } if ((Object)(object)val == (Object)null || val.spawnObjects == null || val.spawnObjects.Count == 0) { HimPlugin.Logger.LogWarning("[ENHANCE] Impossibile trovare il nemico Loom o i suoi spawnObjects."); return; } GameObject prefab = ((PrefabRef<GameObject>)(object)val.spawnObjects[0]).Prefab; if ((Object)(object)prefab == (Object)null) { return; } Transform val2 = ((Component)this).transform; HimPlugin.Logger.LogInfo("[PARANOIA-DEBUG] DUMPING UPSCREAM HIERARCHY:"); Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { HimPlugin.Logger.LogInfo("[PARANOIA-DEBUG] CHILD: " + ((Object)val3).name); } Transform[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform val4 in componentsInChildren2) { string text = ((Object)val4).name.ToLower(); if (text.Contains("head") || text.Contains("neck")) { val2 = val4; HimPlugin.Logger.LogInfo("[PARANOIA-DEBUG] Found potential head bone: " + ((Object)val4).name); break; } } Renderer[] componentsInChildren3 = ((Component)val2).GetComponentsInChildren<Renderer>(true); foreach (Renderer val5 in componentsInChildren3) { string text2 = ((Object)((Component)val5).gameObject).name.ToLower(); if (text2.Contains("upscream_head") || text2.Contains("eye_")) { val5.enabled = false; MeshFilter component = ((Component)val5).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null) { component.sharedMesh = null; } } } bool activeSelf = prefab.activeSelf; prefab.SetActive(false); GameObject val6 = Object.Instantiate<GameObject>(prefab); prefab.SetActive(activeSelf); ((Object)val6).name = "SpookyLoomHead"; val6.SetActive(false); Transform val7 = null; Transform val8 = null; Transform[] componentsInChildren4 = val6.GetComponentsInChildren<Transform>(true); foreach (Transform val9 in componentsInChildren4) { if (((Object)val9).name.Contains("Head ANIM")) { val7 = val9; } else if (((Object)val9).name == "Particles" && (Object)(object)val9.parent == (Object)(object)val6.transform) { val8 = val9; } } if ((Object)(object)val7 != (Object)null) { _loomHeadTrans = val7; HimPlugin.Logger.LogInfo("[PARANOIA-DEBUG] ========================================"); HimPlugin.Logger.LogInfo("[PARANOIA-DEBUG] INIZIO SOSTITUZIONE TESTA"); HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Upscream Parent Pos: {val2.parent.position}"); HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Upscream Head Pos (World): {val2.position} | Scale (Lossy): {val2.lossyScale}"); HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Loom Original Pos (World): {val6.transform.position}"); HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Loom HeadANIM Pos (World pre-parent): {val7.position} | Scale (Lossy): {val7.lossyScale}"); Vector3 lossyScale = val7.lossyScale; val7.SetParent(val2, true); val7.localPosition = Vector3.zero; val7.localRotation = Quaternion.identity; val7.localScale = new Vector3(lossyScale.x / val2.lossyScale.x, lossyScale.y / val2.lossyScale.y, lossyScale.z / val2.lossyScale.z) * 0.81f; HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Loom HeadANIM Pos (World post-parent): {val7.position}"); HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Loom HeadANIM Scale (Local): {val7.localScale} | Scale (Lossy post-parent): {val7.lossyScale}"); HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Loom HeadANIM ActiveSelf: {((Component)val7).gameObject.activeSelf} | ActiveInHierarchy: {((Component)val7).gameObject.activeInHierarchy}"); if ((Object)(object)val8 != (Object)null) { HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] TROVATI PARTICLES LOOM: {((Object)val8).name}. Pos: {val8.position}"); val8.SetParent(val2, true); val8.localPosition = Vector3.zero; val8.localRotation = Quaternion.identity; } Animator[] componentsInChildren5 = ((Component)val7).GetComponentsInChildren<Animator>(true); foreach (Animator val10 in componentsInChildren5) { Object.DestroyImmediate((Object)(object)val10); } int num = 0; Transform[] componentsInChildren6 = ((Component)val7).GetComponentsInChildren<Transform>(true); foreach (Transform val11 in componentsInChildren6) { Vector3 localScale = val11.localScale; if (((Vector3)(ref localScale)).sqrMagnitude < 0.01f) { val11.localScale = Vector3.one; } string text3 = ((Object)val11).name.ToLower(); if (text3.Contains("jaw") && !text3.Contains("particle") && ((Object)(object)_loomJawBone == (Object)null || (text3.Contains("anim") && !((Object)_loomJawBone).name.ToLower().Contains("anim")))) { _loomJawBone = val11; _originalJawRot = val11.localRotation; HimPlugin.Logger.LogInfo("[PARANOIA-DEBUG] Mascella agganciata a: '" + ((Object)val11).name + "'"); } Renderer component2 = ((Component)val11).GetComponent<Renderer>(); if ((Object)(object)component2 != (Object)null) { component2.enabled = true; num++; string text4 = (((Object)(object)component2.material != (Object)null) ? ((Object)component2.material).name : "NULL_MATERIAL"); HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Renderer attivato: '{((Object)val11).name}' | Layer: {((Component)val11).gameObject.layer} | Mat: {text4} | Pos World: {val11.position} | Scale Lossy: {val11.lossyScale} | ActiveInHier: {((Component)val11).gameObject.activeInHierarchy}"); } } HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Totale renderers abilitati nella testa: {num}"); ((Component)val7).gameObject.SetActive(true); if ((Object)(object)val8 != (Object)null) { ((Component)val8).gameObject.SetActive(true); } HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Dopo aver forzato SetActive(true) -> HeadANIM ActiveInHierarchy: {((Component)val7).gameObject.activeInHierarchy}"); int num2 = 0; ParticleSystem[] componentsInChildren7 = ((Component)val2).GetComponentsInChildren<ParticleSystem>(true); ParticleSystem[] array = componentsInChildren7; foreach (ParticleSystem val12 in array) { if (((Component)val12).transform.IsChildOf(val7) || (!((Object)(object)val8 == (Object)null) && ((Component)val12).transform.IsChildOf(val8))) { val12.Play(true); num2++; HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Play ParticleSystem: {((Object)((Component)val12).gameObject).name} | Pos: {((Component)val12).transform.position}"); } } HimPlugin.Logger.LogInfo($"[PARANOIA-DEBUG] Totale ParticleSystems avviati: {num2}"); HimPlugin.Logger.LogInfo("[PARANOIA-DEBUG] ========================================"); } else { HimPlugin.Logger.LogWarning("[PARANOIA-DEBUG] ATTENZIONE: 'Head ANIM' non trovata nel Loom!"); } HimPlugin.Logger.LogInfo("[PARANOIA-DEBUG] Distruggo il corpo originale del Loom..."); Object.Destroy((Object)(object)val6.gameObject); } private void DoubleHealthAndBuff() { //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemyScript == (Object)null) { return; } Enemy componentInChildren = ((Component)enemyScript).GetComponentInChildren<Enemy>(); if ((Object)(object)componentInChildren != (Object)null) { EnemyHealth health = componentInChildren.Health; if ((Object)(object)health != (Object)null) { health.health = 1500; health.healthCurrent = 1500; health.objectHurtStun = false; HimPlugin.Logger.LogWarning("[PARANOIA-DEBUG] Vita del mostro impostata con successo a 1500!"); } EnemyStateStunned stateStunned = componentInChildren.StateStunned; if ((Object)(object)stateStunned != (Object)null) { stateStunned.OverrideDisable(9999f); stateStunned.active = false; } } EnemyUpscream val = ((Component)enemyScript).GetComponent<EnemyUpscream>(); if ((Object)(object)val == (Object)null) { val = ((Component)enemyScript).GetComponentInChildren<EnemyUpscream>(); } if ((Object)(object)val != (Object)null && (Object)(object)val.upscreamAnim != (Object)null) { EnemyUpscreamAnim upscreamAnim = val.upscreamAnim; if (upscreamAnim.stepSound != null) { upscreamAnim.stepSound.Volume = 0.01f; upscreamAnim.stepSound.VolumeDefault = 0.01f; if ((Object)(object)upscreamAnim.stepSound.Source != (Object)null) { upscreamAnim.stepSound.Source.volume = 0.01f; } } Sound[] array = (Sound[])(object)new Sound[3] { upscreamAnim.sfxAttackGlobal, upscreamAnim.sfxAttackLocal, upscreamAnim.hurtSound }; Sound[] array2 = array; foreach (Sound val2 in array2) { if (val2 == null) { continue; } val2.Volume = 35f; val2.VolumeDefault = 35f; val2.Pitch = 0.78f; val2.PitchDefault = 0.78f; if ((Object)(object)val2.Source != (Object)null) { if (!_earrapeSources.Contains(val2.Source)) { _earrapeSources.Add(val2.Source); } val2.Source.volume = 1f; val2.Source.pitch = 0.78f; val2.Source.spatialBlend = 0f; if ((Object)(object)((Component)val2.Source).gameObject.GetComponent<AudioDistortionFilter>() == (Object)null) { AudioDistortionFilter val3 = ((Component)val2.Source).gameObject.AddComponent<AudioDistortionFilter>(); val3.distortionLevel = 0.85f; AudioReverbFilter val4 = ((Component)val2.Source).gameObject.AddComponent<AudioReverbFilter>(); val4.reverbPreset = (AudioReverbPreset)9; HimPlugin.Logger.LogInfo("[PARANOIA-DEBUG] Riverbero e distorsione aggiunti a " + ((Object)((Component)val2.Source).gameObject).name); } } } } Transform[] componentsInChildren = ((Component)enemyScript).GetComponentsInChildren<Transform>(); foreach (Transform val5 in componentsInChildren) { string text = ((Object)val5).name.ToLower(); if ((text.Contains("leg") || text.Contains("arm") || text.Contains("calf") || text.Contains("thigh") || text.Contains("foot") || text.Contains("toe") || text.Contains("knee")) && val5.localScale.y < 1.5f) { val5.localScale = new Vector3(val5.localScale.x, val5.localScale.y * 1.6f, val5.localScale.z); } } } private void TryForceAggro() { } private void ForcePlayerLookAtMonster() { //IL_0084: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetPlayer == (Object)null || !targetPlayer.isLocal) { return; } Transform val = ((Component)this).transform; if ((Object)(object)_loomHeadTrans != (Object)null) { val = _loomHeadTrans; } PlayerController val2 = null; PlayerController[] array = Object.FindObjectsOfType<PlayerController>(); foreach (PlayerController val3 in array) { if ((Object)(object)val3.playerAvatarScript == (Object)(object)targetPlayer) { val2 = val3; break; } } if ((Object)(object)val2 != (Object)null && (Object)(object)val2.cameraAim != (Object)null) { Vector3 val4 = val.position + Vector3.down * 0.08f; val2.cameraAim.AimTargetSet(val4, 0.5f, 40f, ((Component)this).gameObject, 100); val2.OverrideDisableTurn(0.6f, false); HimPlugin.Logger.LogWarning("[PARANOIA] Il mostro ti ha preso da vicino! Rotazione visuale forzata."); } } private void ForcePlayerLookContinuous(Vector3 targetPos) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetPlayer == (Object)null || !targetPlayer.isLocal) { return; } PlayerController val = null; PlayerController[] array = Object.FindObjectsOfType<PlayerController>(); foreach (PlayerController val2 in array) { if ((Object)(object)val2.playerAvatarScript == (Object)(object)targetPlayer) { val = val2; break; } } if ((Object)(object)val != (Object)null && (Object)(object)val.cameraAim != (Object)null) { val.cameraAim.AimTargetSet(targetPos, 0.1f, 45f, ((Component)this).gameObject, 100); val.OverrideDisableTurn(0.15f, false); } } private Vector3 FindEscapePoint(Vector3 fromPos, Vector3 playerPos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) //IL_0010: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_008b: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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) Vector3 val = fromPos - playerPos; Vector3 normalized = ((Vector3)(ref val)).normalized; if (normalized == Vector3.zero) { val = Random.insideUnitSphere; normalized = ((Vector3)(ref val)).normalized; } normalized.y = 0f; float[] array = new float[4] { 45f, 35f, 25f, 15f }; float[] array2 = new float[8] { 0f, 45f, -45f, 90f, -90f, 135f, -135f, 180f }; float[] array3 = array; NavMeshHit val4 = default(NavMeshHit); foreach (float num in array3) { float[] array4 = array2; foreach (float num2 in array4) { Vector3 val2 = Quaternion.Euler(0f, num2, 0f) * normalized; Vector3 val3 = fromPos + val2 * num; if (NavMesh.SamplePosition(val3, ref val4, 12f, -1)) { return ((NavMeshHit)(ref val4)).position; } } } return fromPos; } private IEnumerator DestroyOverNetworkAfterTime(float time, PhotonView pv) { yield return (object)new WaitForSeconds(time); if ((Object)(object)pv != (Object)null && PhotonNetwork.IsConnectedAndReady) { HimPlugin.Logger.LogInfo("[HOST] Distruggo Upscream via PhotonNetwork."); PhotonNetwork.Destroy(((Component)pv).gameObject); } else if ((Object)(object)((Component)this).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void Update() { UpscreamUpdate(); } private void UpscreamUpdate() { //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Invalid comparison between Unknown and I4 //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Invalid comparison between Unknown and I4 //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Invalid comparison between Unknown and I4 //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Invalid comparison between Unknown and I4 //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Invalid comparison between Unknown and I4 //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Invalid comparison between Unknown and I4 //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_07a8: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_0827: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_08c8: Unknown result type (might be due to invalid IL or missing references) //IL_08ce: Unknown result type (might be due to invalid IL or missing references) //IL_08e2: Unknown result type (might be due to invalid IL or missing references) //IL_08e7: Unknown result type (might be due to invalid IL or missing references) //IL_08f7: Unknown result type (might be due to invalid IL or missing references) //IL_0887: Unknown result type (might be due to invalid IL or missing references) //IL_088d: Unknown result type (might be due to invalid IL or missing references) //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_08a0: Unknown result type (might be due to invalid IL or missing references) //IL_08b0: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_092e: Unknown result type (might be due to invalid IL or missing references) //IL_093e: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_097b: Unknown result type (might be due to invalid IL or missing references) //IL_0985: Unknown result type (might be due to invalid IL or missing references) //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_0992: Unknown result type (might be due to invalid IL or missing references) //IL_09b0: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Expected O, but got Unknown //IL_09e0: Unknown result type (might be due to invalid IL or missing references) //IL_09e7: Expected O, but got Unknown //IL_0a26: Unknown result type (might be due to invalid IL or missing references) //IL_0a3f: Unknown result type (might be due to invalid IL or missing references) //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) //IL_0a57: Unknown result type (might be due to invalid IL or missing references) //IL_0a93: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetPlayer == (Object)null || (Object)(object)enemyScript == (Object)null) { return; } EnemyUpscream val = ((Component)enemyScript).GetComponent<EnemyUpscream>(); if ((Object)(object)val == (Object)null) { val = ((Component)enemyScript).GetComponentInChildren<EnemyUpscream>(); } if (!_enhancementApplied) { _enhancementTimer += Time.deltaTime; bool flag = false; if ((Object)(object)val != (Object)null && (Object)(object)val.upscreamAnim != (Object)null && val.upscreamAnim.sfxAttackGlobal != null && (Object)(object)val.upscreamAnim.sfxAttackGlobal.Source != (Object)null) { flag = true; } if (flag || _enhancementTimer > 2.5f) { DoubleHealthAndBuff(); _enhancementApplied = true; } } else if ((Object)(object)val != (Object)null && (Object)(object)val.upscreamAnim != (Object)null) { EnemyUpscreamAnim upscreamAnim = val.upscreamAnim; if (upscreamAnim.stepSound != null) { upscreamAnim.stepSound.Volume = 0.01f; if ((Object)(object)upscreamAnim.stepSound.Source != (Object)null) { upscreamAnim.stepSound.Source.volume = 0.01f; } } Sound[] array = (Sound[])(object)new Sound[3] { upscreamAnim.sfxAttackGlobal, upscreamAnim.sfxAttackLocal, upscreamAnim.hurtSound }; Sound[] array2 = array; foreach (Sound val2 in array2) { if (val2 != null) { val2.Volume = 35f; val2.Pitch = 0.78f; if ((Object)(object)val2.Source != (Object)null) { val2.Source.volume = 1f; val2.Source.pitch = 0.78f; val2.Source.spatialBlend = 0f; } } } } if ((Object)(object)val == (Object)null) { return; } val.targetPlayer = targetPlayer; if ((Object)(object)val.enemy != (Object)null) { val.enemy.TargetPlayerAvatar = targetPlayer; val.enemy.TargetPlayerViewID = (((Object)(object)targetPlayer.photonView != (Object)null) ? targetPlayer.photonView.ViewID : 0); } val.attacks = 0; if ((int)val.currentState == 6 && (int)_lastState != 6) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer).transform.position); if (num < 1.6f) { ForcePlayerLookAtMonster(); } _customAttacks++; HimPlugin.Logger.LogWarning($"[PARANOIA] Attacco registrato ({_customAttacks}/3)"); if (_customAttacks >= 3) { _isEscaping = true; _escapeTimer = 10f; _escapeSoundTimer = Random.Range(2.5f, 6f); _escapeSoundPlayed = false; _escapeDestination = FindEscapePoint(((Component)this).transform.position, ((Component)targetPlayer).transform.position); HimPlugin.Logger.LogWarning($"[PARANOIA] Fuga di 10 secondi iniziata verso: {_escapeDestination}"); } } _lastState = val.currentState; if (_isEscaping) { _escapeTimer -= Time.deltaTime; if (!_escapeSoundPlayed) { _escapeSoundTimer -= Time.deltaTime; if (_escapeSoundTimer <= 0f) { ParanoiaManager paranoiaManager = Object.FindObjectOfType<ParanoiaManager>(); if ((Object)(object)paranoiaManager != (Object)null) { paranoiaManager.PlaySpookySound(((Component)this).transform.position, useImpact: false, 0.85f, 0.72f); } _escapeSoundPlayed = true; HimPlugin.Logger.LogWarning("[PARANOIA] Suono ambientale di fuga riprodotto."); } } if (_escapeTimer <= 0f) { _isEscaping = false; _customAttacks = 0; HimPlugin.Logger.LogWarning("[PARANOIA] Fuga terminata. Il mostro ritorna a cacciare!"); } } NavMeshAgent componentInChildren = ((Component)enemyScript).GetComponentInChildren<NavMeshAgent>(); bool flag2 = false; bool flag3 = false; if (_isEscaping) { val.currentState = (State)7; flag2 = true; } else { if ((int)val.currentState == 6 || (int)val.currentState == 4) { flag3 = true; } if ((int)val.currentState == 7) { flag2 = true; } } if ((Object)(object)componentInChildren != (Object)null && ((Behaviour)componentInChildren).isActiveAndEnabled && !flag2) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer).transform.position); bool flag4 = (int)componentInChildren.pathStatus == 2; Vector3