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.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Pix.Paranoia.Creatures;
using Pix.Paranoia.Hallucinations;
using Pix.Paranoia.Infection;
using Pix.Paranoia.Nausea;
using Pix.Paranoia.Relics;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace Pix.Paranoia
{
[BepInPlugin("Pix.Paranoia", "Paranoia", "0.8.9")]
public sealed class ParanoiaPlugin : BaseUnityPlugin
{
private sealed class CreatureSfxIndex
{
public readonly List<string> Foreshadow = new List<string>();
public readonly List<string> Displacement = new List<string>();
public readonly List<string> Violation = new List<string>();
}
public const string PluginGuid = "Pix.Paranoia";
public const string PluginName = "Paranoia";
public const string PluginVersion = "0.8.9";
private const string RpcParanoidinDamage = "PX_ParanoidinDamage";
private Harmony _harmony;
private Harmony _criticalHarmony;
private static ParanoiaPlugin _self;
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<bool> DebugLogging;
internal static ConfigEntry<bool> UseSleepDeprivation;
internal static ConfigEntry<int> DaysWithoutSleepThreshold;
internal static ConfigEntry<float> TickIntervalSeconds;
internal static ConfigEntry<float> BaseEventChancePerTick;
internal static ConfigEntry<float> NightChanceMultiplier;
internal static ConfigEntry<float> GlobalCooldownSeconds;
internal static ConfigEntry<float> ForeshadowCooldownSeconds;
internal static ConfigEntry<float> DisplacementCooldownSeconds;
internal static ConfigEntry<float> ViolationCooldownSeconds;
internal static ConfigEntry<float> ViolationForeignBiomeChance;
internal static ConfigEntry<float> SameSoundRepeatBlockSeconds;
internal static ConfigEntry<bool> EnableEatTrigger;
internal static ConfigEntry<float> EatTriggerChance;
internal static ConfigEntry<float> DisplacementMinDistance;
internal static ConfigEntry<float> DisplacementMaxDistance;
internal static ConfigEntry<float> ForeshadowDistance;
internal static ConfigEntry<float> ViolationDistance;
internal static ConfigEntry<bool> DisableDuringActiveEvent;
internal static ConfigEntry<bool> ForcePlayAudioSources;
internal static ConfigEntry<float> ForcedNearSpawnDistance;
internal static ConfigEntry<float> SleepTest_DaySeconds;
internal static ConfigEntry<string> Meadows_Foreshadow;
internal static ConfigEntry<string> Meadows_Displacement;
internal static ConfigEntry<string> Meadows_Violation;
internal static ConfigEntry<string> BlackForest_Foreshadow;
internal static ConfigEntry<string> BlackForest_Displacement;
internal static ConfigEntry<string> BlackForest_Violation;
internal static ConfigEntry<string> Swamp_Foreshadow;
internal static ConfigEntry<string> Swamp_Displacement;
internal static ConfigEntry<string> Swamp_Violation;
internal static ConfigEntry<string> Mountains_Foreshadow;
internal static ConfigEntry<string> Mountains_Displacement;
internal static ConfigEntry<string> Mountains_Violation;
internal static ConfigEntry<string> Plains_Foreshadow;
internal static ConfigEntry<string> Plains_Displacement;
internal static ConfigEntry<string> Plains_Violation;
internal static ConfigEntry<string> Mistlands_Foreshadow;
internal static ConfigEntry<string> Mistlands_Displacement;
internal static ConfigEntry<string> Mistlands_Violation;
internal static ConfigEntry<string> Ocean_Foreshadow;
internal static ConfigEntry<string> Ocean_Displacement;
internal static ConfigEntry<string> Ocean_Violation;
internal static ConfigEntry<string> AshLands_Foreshadow;
internal static ConfigEntry<string> AshLands_Displacement;
internal static ConfigEntry<string> AshLands_Violation;
internal static ConfigEntry<bool> EnableParanoidin;
internal static ConfigEntry<float> ParanoidinChancePerTickSevere;
internal static ConfigEntry<float> ParanoidinCooldownSeconds;
internal static ConfigEntry<bool> ParanoidinEnvironmentEnabled;
internal static ConfigEntry<bool> DisableParanoiaTickDuringRespawnLockout;
internal static ConfigEntry<float> RespawnLockoutSeconds;
internal static ConfigEntry<float> ParanoidinChancePerTickModerate;
internal static ConfigEntry<float> ParanoidinChancePerTickMild;
internal static ConfigEntry<string> ParanoidinMinTier;
internal static ConfigEntry<string> ParanoidinPrefabNames;
internal static ConfigEntry<bool> ParanoidinUseSafeVisuals = null;
internal static ConfigEntry<bool> ParanoidinSpawnVisualGhost = null;
internal static ConfigEntry<float> ParanoidinFarShowDistance;
internal static ConfigEntry<float> ParanoidinFarShowSeconds;
internal static ConfigEntry<float> ParanoidinStartDistance;
internal static ConfigEntry<float> ParanoidinMinDistance;
internal static ConfigEntry<float> ParanoidinTeleportStep;
internal static ConfigEntry<float> ParanoidinTeleportCooldown;
internal static ConfigEntry<float> ParanoidinDespawnDistance;
internal static ConfigEntry<float> ParanoidinHoldSeconds;
internal static ConfigEntry<float> ParanoidinAttackRange;
internal static ConfigEntry<float> ParanoidinAttackWindupSeconds;
internal static ConfigEntry<float> ParanoidinAttackDamage;
internal static ConfigEntry<bool> ParanoidinDamageRequiresServer;
internal static ConfigEntry<bool> ParanoidinDebugAllowClientDamage;
internal static ConfigEntry<string> ParanoidinWarningSfx;
internal static ConfigEntry<string> ParanoidinStepSfx;
internal static ConfigEntry<string> ParanoidinAttackSfx;
internal static ConfigEntry<string> ParanoidinHauntSfx;
internal static ConfigEntry<bool> CfgHallucinationEnabled;
internal static ConfigEntry<float> CfgHallucinationWarningTimeSeconds;
internal static ConfigEntry<float> CfgHallucinationTriggerTimeSeconds;
internal static ConfigEntry<float> CfgHallucinationDurationSeconds;
internal static ConfigEntry<float> CfgHallucinationGlobalCooldownSeconds;
internal static ConfigEntry<string> CfgHallucinationWarningMessage;
internal static ConfigEntry<string> CfgHallucinationTriggerMessage;
internal static ConfigEntry<bool> CfgHallucinationRainbowEnabled;
internal static ConfigEntry<float> CfgHallucinationRainbowDistance;
internal static ConfigEntry<int> CfgHallucinationMaxFakeCreatures;
internal static ConfigEntry<float> CfgHallucinationFakeCreatureSpawnInterval;
internal static ConfigEntry<float> CfgHallucinationFakeCreatureMinDistance;
internal static ConfigEntry<float> CfgHallucinationFakeCreatureMaxDistance;
internal static ConfigEntry<bool> CfgHallucinationFakeCreatureBiomeOnly;
internal static ConfigEntry<bool> CfgHallucinationFakeCreatureChaotic;
internal static ConfigEntry<float> CfgHallucinationBlurStrength;
internal static ConfigEntry<int> CfgHallucinationBlurIterations;
internal static ConfigEntry<int> CfgHallucinationBlurDownsample;
internal static ConfigEntry<float> CfgHallucinationEdgeWidth;
internal static ConfigEntry<float> CfgHallucinationEdgeSoftness;
internal static ConfigEntry<float> CfgHallucinationPulseSpeed;
internal static ConfigEntry<float> CfgHallucinationPulseAmplitude;
internal static ConfigEntry<float> CfgHallucinationOnsetBurialChambers;
internal static ConfigEntry<float> CfgHallucinationOnsetTrollCave;
internal static ConfigEntry<float> CfgHallucinationOnsetSunkenCrypt;
internal static ConfigEntry<float> CfgHallucinationOnsetFrostCave;
internal static ConfigEntry<float> CfgHallucinationOnsetSealedTower;
internal static ConfigEntry<float> CfgHallucinationOnsetInfestedMine;
internal static ConfigEntry<float> CfgHallucinationOnsetPutridHole;
internal static ConfigEntry<float> CfgHallucinationOnsetSmoulderingTomb;
internal static ConfigEntry<bool> CfgWhisperingGreydwarfEnabled;
internal static ConfigEntry<float> CfgWhisperingGreydwarfChance;
private static bool _sfxIndexBuilt;
private static readonly object _sfxIndexLock = new object();
private static readonly HashSet<string> _availableSfxNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
private static readonly Dictionary<string, CreatureSfxIndex> _sfxByCreatureKey = new Dictionary<string, CreatureSfxIndex>(StringComparer.OrdinalIgnoreCase);
private static readonly Dictionary<Biome, string[]> _creaturesByBiome = new Dictionary<Biome, string[]>
{
{
(Biome)1,
new string[5] { "deer", "boar", "neck", "greyling", "seagal" }
},
{
(Biome)8,
new string[6] { "greydwarf", "troll", "skeleton", "ghost", "rancidremains", "crow" }
},
{
(Biome)256,
new string[3] { "serpent", "seagal", "leviathan" }
},
{
(Biome)2,
new string[7] { "draugr", "blob", "blobelite", "leech", "wraith", "abomination", "surtling" }
},
{
(Biome)4,
new string[6] { "wolf", "hatchling", "fenring", "stonegolem", "ulv", "bat" }
},
{
(Biome)16,
new string[6] { "goblin", "goblinbrute", "goblinshaman", "lox", "deathsquito", "blobtar" }
},
{
(Biome)512,
new string[8] { "seeker", "seekerbrute", "seekerbrood", "gjall", "tick", "dverger", "dvergermage", "hare" }
},
{
(Biome)32,
new string[6] { "charred", "volture", "asksvin", "bloblava", "bonemawserpent", "fallenvalkyrie" }
}
};
private static bool _paranoidinRpcRegistered;
private static void EnsureSfxIndexBuilt()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
if (_sfxIndexBuilt)
{
return;
}
lock (_sfxIndexLock)
{
if (_sfxIndexBuilt)
{
return;
}
_availableSfxNames.Clear();
_sfxByCreatureKey.Clear();
try
{
if ((Object)ZNetScene.instance != (Object)null && ZNetScene.instance.m_prefabs != null)
{
foreach (GameObject prefab in ZNetScene.instance.m_prefabs)
{
if ((Object)prefab == (Object)null)
{
continue;
}
string name = ((Object)prefab).name;
if (string.IsNullOrEmpty(name) || !name.StartsWith("sfx_", StringComparison.OrdinalIgnoreCase))
{
continue;
}
_availableSfxNames.Add(name);
string text = ExtractCreatureKey(name);
if (!string.IsNullOrEmpty(text))
{
if (!_sfxByCreatureKey.TryGetValue(text, out var value))
{
value = new CreatureSfxIndex();
_sfxByCreatureKey[text] = value;
}
ClassifyAndAdd(value, name);
}
}
}
}
catch (Exception ex)
{
LogWarn("SFX AUTO indexing failed (will fall back to config-only pools): " + ex.Message);
}
_sfxIndexBuilt = true;
if (DebugLogging.Value)
{
LogInfo($"SFX AUTO index built: {_availableSfxNames.Count} sfx prefabs, {_sfxByCreatureKey.Count} creature keys.");
}
}
}
private static string ExtractCreatureKey(string sfxPrefabName)
{
if (string.IsNullOrEmpty(sfxPrefabName))
{
return null;
}
string text = sfxPrefabName;
if (text.StartsWith("sfx_", StringComparison.OrdinalIgnoreCase))
{
text = text.Substring(4);
}
string[] array = text.Split(new char[3] { '_', ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
if (array.Length == 0)
{
return null;
}
return array[0].Trim().ToLowerInvariant();
}
private static void ClassifyAndAdd(CreatureSfxIndex idx, string sfxPrefabName)
{
if (idx != null && !string.IsNullOrEmpty(sfxPrefabName))
{
string text = sfxPrefabName.ToLowerInvariant();
bool flag = text.Contains("_idle") || text.Contains("_footstep") || text.Contains("_random") || text.Contains("_creak") || text.Contains("_greet") || text.Contains("_laugh") || text.Contains("_yea");
bool flag2 = text.Contains("_alert") || text.Contains("_alerted") || text.Contains("_scream") || text.Contains("_howl") || text.Contains("_taunt") || text.Contains("_roar") || text.Contains("_shout");
bool flag3 = text.Contains("_death") || text.Contains("_hurt") || text.Contains("_hit") || text.Contains("_attack") || text.Contains("_bite") || text.Contains("_slam") || text.Contains("_claw") || text.Contains("_spit");
if (!flag && !flag2 && !flag3)
{
flag = true;
}
if (flag)
{
idx.Foreshadow.Add(sfxPrefabName);
}
if (flag2)
{
idx.Displacement.Add(sfxPrefabName);
}
if (flag3)
{
idx.Violation.Add(sfxPrefabName);
}
}
}
internal static List<string> GetAutoPool(Biome biome, ParanoiaCategory cat)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
EnsureSfxIndexBuilt();
if (!_sfxIndexBuilt || _availableSfxNames.Count == 0)
{
return new List<string>();
}
if (!_creaturesByBiome.TryGetValue(biome, out var value) || value == null || value.Length == 0)
{
value = null;
}
List<string> list = new List<string>(64);
if (value != null)
{
foreach (string text in value)
{
if (!string.IsNullOrEmpty(text) && _sfxByCreatureKey.TryGetValue(text, out var value2))
{
switch (cat)
{
case ParanoiaCategory.Foreshadow:
list.AddRange(value2.Foreshadow);
break;
case ParanoiaCategory.Displacement:
list.AddRange(value2.Displacement);
break;
case ParanoiaCategory.Violation:
list.AddRange(value2.Violation);
break;
}
}
}
}
if (list.Count == 0)
{
foreach (KeyValuePair<string, CreatureSfxIndex> item in _sfxByCreatureKey)
{
CreatureSfxIndex value3 = item.Value;
if (value3 != null)
{
switch (cat)
{
case ParanoiaCategory.Foreshadow:
list.AddRange(value3.Foreshadow);
break;
case ParanoiaCategory.Displacement:
list.AddRange(value3.Displacement);
break;
case ParanoiaCategory.Violation:
list.AddRange(value3.Violation);
break;
}
}
}
}
if (list.Count > 1)
{
HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
List<string> list2 = new List<string>(list.Count);
for (int j = 0; j < list.Count; j++)
{
string text2 = list[j];
if (!string.IsNullOrEmpty(text2) && hashSet.Add(text2))
{
list2.Add(text2);
}
}
list = list2;
}
return list;
}
internal static bool IsSfxAvailable(string sfxPrefabName)
{
if (string.IsNullOrEmpty(sfxPrefabName))
{
return false;
}
EnsureSfxIndexBuilt();
if (_availableSfxNames.Count == 0)
{
return true;
}
return _availableSfxNames.Contains(sfxPrefabName);
}
private void Awake()
{
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
_self = this;
BindConfig();
ParanoiaRelics.Init(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
TryExtractEmbeddedResources();
TryRegisterParanoidinRpc();
if ((Object)(object)ParanoiaEngine.Instance == (Object)null)
{
((Component)this).gameObject.AddComponent<ParanoiaEngine>();
}
if ((Object)(object)HallucinationManager.Instance == (Object)null)
{
((Component)this).gameObject.AddComponent<HallucinationManager>();
}
ParanoiaConsole.TryRegister();
_harmony = new Harmony("Pix.Paranoia");
try
{
_harmony.PatchAll(typeof(ParanoiaPlugin).Assembly);
}
catch (Exception arg)
{
Debug.LogError((object)$"[Paranoia] PatchAll failed: {arg}");
}
_criticalHarmony = new Harmony("Pix.Paranoia.critical");
ParanoiaRelics.ApplyPatches(_criticalHarmony);
ParanoiaSerpent.Init(_criticalHarmony, ((BaseUnityPlugin)this).Logger);
ParanoiaGreydwarfs.Init(_harmony);
ParanoiaNausea.Init(_harmony, ((BaseUnityPlugin)this).Config);
ParanoiaInfection.Init(_criticalHarmony, ((BaseUnityPlugin)this).Logger, ((BaseUnityPlugin)this).Config);
}
private void OnDestroy()
{
try
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
catch
{
}
try
{
Harmony criticalHarmony = _criticalHarmony;
if (criticalHarmony != null)
{
criticalHarmony.UnpatchSelf();
}
}
catch
{
}
}
private void BindConfig()
{
//IL_0a87: Unknown result type (might be due to invalid IL or missing references)
//IL_0a91: Expected O, but got Unknown
//IL_0ac4: Unknown result type (might be due to invalid IL or missing references)
//IL_0ace: Expected O, but got Unknown
//IL_0b01: Unknown result type (might be due to invalid IL or missing references)
//IL_0b0b: Expected O, but got Unknown
//IL_0b3e: Unknown result type (might be due to invalid IL or missing references)
//IL_0b48: Expected O, but got Unknown
//IL_0be3: Unknown result type (might be due to invalid IL or missing references)
//IL_0bed: Expected O, but got Unknown
//IL_0c15: Unknown result type (might be due to invalid IL or missing references)
//IL_0c1f: Expected O, but got Unknown
//IL_0c52: Unknown result type (might be due to invalid IL or missing references)
//IL_0c5c: Expected O, but got Unknown
//IL_0c8f: Unknown result type (might be due to invalid IL or missing references)
//IL_0c99: Expected O, but got Unknown
//IL_0ccc: Unknown result type (might be due to invalid IL or missing references)
//IL_0cd6: Expected O, but got Unknown
//IL_0d49: Unknown result type (might be due to invalid IL or missing references)
//IL_0d53: Expected O, but got Unknown
//IL_0d7a: Unknown result type (might be due to invalid IL or missing references)
//IL_0d84: Expected O, but got Unknown
//IL_0dab: Unknown result type (might be due to invalid IL or missing references)
//IL_0db5: Expected O, but got Unknown
//IL_0de8: Unknown result type (might be due to invalid IL or missing references)
//IL_0df2: Expected O, but got Unknown
//IL_0e25: Unknown result type (might be due to invalid IL or missing references)
//IL_0e2f: Expected O, but got Unknown
//IL_0e62: Unknown result type (might be due to invalid IL or missing references)
//IL_0e6c: Expected O, but got Unknown
//IL_0e9f: Unknown result type (might be due to invalid IL or missing references)
//IL_0ea9: Expected O, but got Unknown
//IL_0edc: Unknown result type (might be due to invalid IL or missing references)
//IL_0ee6: Expected O, but got Unknown
//IL_0f19: Unknown result type (might be due to invalid IL or missing references)
//IL_0f23: Expected O, but got Unknown
//IL_0f56: Unknown result type (might be due to invalid IL or missing references)
//IL_0f60: Expected O, but got Unknown
//IL_0f93: Unknown result type (might be due to invalid IL or missing references)
//IL_0f9d: Expected O, but got Unknown
//IL_0fd0: Unknown result type (might be due to invalid IL or missing references)
//IL_0fda: Expected O, but got Unknown
//IL_100d: Unknown result type (might be due to invalid IL or missing references)
//IL_1017: Expected O, but got Unknown
//IL_104a: Unknown result type (might be due to invalid IL or missing references)
//IL_1054: Expected O, but got Unknown
//IL_1087: Unknown result type (might be due to invalid IL or missing references)
//IL_1091: Expected O, but got Unknown
//IL_10e4: Unknown result type (might be due to invalid IL or missing references)
//IL_10ee: Expected O, but got Unknown
Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable/disable Pix.Paranoia.");
DebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DebugLogging", false, "Enable debug logs.");
UseSleepDeprivation = ((BaseUnityPlugin)this).Config.Bind<bool>("Sleep", "UseSleepDeprivation", true, "If true, paranoia ramps based on days without sleep.");
DaysWithoutSleepThreshold = ((BaseUnityPlugin)this).Config.Bind<int>("Sleep", "DaysWithoutSleepThreshold", 1, "Days without sleep before paranoia begins (Default: 1).");
TickIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Balance", "TickIntervalSeconds", 1.25f, "How often the engine checks to fire a paranoia event.");
BaseEventChancePerTick = ((BaseUnityPlugin)this).Config.Bind<float>("Balance", "BaseEventChancePerTick", 0.035f, "Base chance per tick to attempt an event (tiers multiply).");
NightChanceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Bias", "NightChanceMultiplier", 1.6f, "Multiplier to event chance at night.");
GlobalCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Cooldowns", "GlobalCooldownSeconds", 120f, "Global cooldown after any paranoia event.");
ForeshadowCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Cooldowns", "ForeshadowCooldownSeconds", 45f, "Cooldown for Foreshadowing events.");
DisplacementCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Cooldowns", "DisplacementCooldownSeconds", 90f, "Cooldown for Displacement events.");
ViolationCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Cooldowns", "ViolationCooldownSeconds", 220f, "Cooldown for Violation events.");
ViolationForeignBiomeChance = ((BaseUnityPlugin)this).Config.Bind<float>("Biome", "ViolationForeignBiomeChance", 0.08f, "When a VIOLATION event fires, chance (0-1) to pick the pool from a DIFFERENT biome (rare cross-biome \"wrong sound\" moments). This does not change how often Violation events occur; it only affects which biome pool is used once a Violation is chosen. Set to 0 for biome-pure.");
SameSoundRepeatBlockSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Cooldowns", "SameSoundRepeatBlockSeconds", 300f, "Block repeating the exact same sound for this many seconds.");
EnableEatTrigger = ((BaseUnityPlugin)this).Config.Bind<bool>("Triggers", "EnableEatTrigger", true, "If true, eating can (rarely) trigger a paranoia sound.");
EatTriggerChance = ((BaseUnityPlugin)this).Config.Bind<float>("Triggers", "EatTriggerChance", 0.06f, "Chance for an eat-triggered paranoia attempt (still respects cooldowns/safety).");
DisplacementMinDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Spatial", "DisplacementMinDistance", 18f, "Min distance for displacement sounds (distant).");
DisplacementMaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Spatial", "DisplacementMaxDistance", 45f, "Max distance for displacement sounds (distant).");
ForeshadowDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Spatial", "ForeshadowDistance", 7f, "Distance for foreshadow sounds (near).");
ViolationDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Spatial", "ViolationDistance", 5f, "Distance for violation sounds (very near).");
DisableDuringActiveEvent = ((BaseUnityPlugin)this).Config.Bind<bool>("Safety", "DisableDuringActiveEvent", true, "If true, paranoia won't fire during raids/random events.");
ForcePlayAudioSources = ((BaseUnityPlugin)this).Config.Bind<bool>("Testing", "ForcePlayAudioSources", true, "If true, spawned sfx will force-play any AudioSource components found (helps testing).");
ForcedNearSpawnDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Testing", "ForcedNearSpawnDistance", 2.5f, "Distance used when pn_fire spawns an explicit prefab name (keeps it close).");
SleepTest_DaySeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Testing", "SleepTest_DaySeconds", 1800f, "Seconds per 'day' for Paranoia sleep-deprivation.");
Meadows_Foreshadow = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Meadows", "Foreshadow", "AUTO", "CSV list of sfx prefab names.");
Meadows_Displacement = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Meadows", "Displacement", "AUTO", "CSV list of sfx prefab names.");
Meadows_Violation = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Meadows", "Violation", "AUTO", "CSV list of sfx prefab names.");
BlackForest_Foreshadow = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - BlackForest", "Foreshadow", "AUTO", "CSV list.");
BlackForest_Displacement = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - BlackForest", "Displacement", "AUTO", "CSV list.");
BlackForest_Violation = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - BlackForest", "Violation", "AUTO", "CSV list.");
Swamp_Foreshadow = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Swamp", "Foreshadow", "AUTO", "CSV list.");
Swamp_Displacement = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Swamp", "Displacement", "AUTO", "CSV list.");
Swamp_Violation = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Swamp", "Violation", "AUTO", "CSV list.");
Mountains_Foreshadow = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Mountains", "Foreshadow", "AUTO", "CSV list.");
Mountains_Displacement = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Mountains", "Displacement", "AUTO", "CSV list.");
Mountains_Violation = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Mountains", "Violation", "AUTO", "CSV list.");
Plains_Foreshadow = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Plains", "Foreshadow", "AUTO", "CSV list.");
Plains_Displacement = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Plains", "Displacement", "AUTO", "CSV list.");
Plains_Violation = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Plains", "Violation", "AUTO", "CSV list.");
Mistlands_Foreshadow = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Mistlands", "Foreshadow", "AUTO", "CSV list.");
Mistlands_Displacement = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Mistlands", "Displacement", "AUTO", "CSV list.");
Mistlands_Violation = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Mistlands", "Violation", "AUTO", "CSV list.");
Ocean_Foreshadow = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Ocean", "Foreshadow", "AUTO", "CSV list.");
Ocean_Displacement = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Ocean", "Displacement", "AUTO", "CSV list.");
Ocean_Violation = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - Ocean", "Violation", "AUTO", "CSV list.");
AshLands_Foreshadow = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - AshLands", "Foreshadow", "AUTO", "CSV list.");
AshLands_Displacement = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - AshLands", "Displacement", "AUTO", "CSV list.");
AshLands_Violation = ((BaseUnityPlugin)this).Config.Bind<string>("Pools - AshLands", "Violation", "AUTO", "CSV list.");
EnableParanoidin = ((BaseUnityPlugin)this).Config.Bind<bool>("Paranoidin", "EnableParanoidin", true, "Enable/disable the Paranoidin sequence (Phase 2).");
ParanoidinChancePerTickSevere = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "ChancePerTickSevere", 0.01f, "Chance per tick (Tier >= MinTier) to start a Paranoidin sequence. This is *in addition* to audio events.");
ParanoidinChancePerTickModerate = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "ChancePerTickModerate", 0.0045f, "Chance per tick when Tier=Moderate to start a Paranoidin sequence.");
ParanoidinChancePerTickMild = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "ChancePerTickMild", 0.0015f, "Chance per tick when Tier=Mild to start a Paranoidin sequence.");
ParanoidinMinTier = ((BaseUnityPlugin)this).Config.Bind<string>("Paranoidin", "MinTier", "Moderate", "Minimum paranoia tier required for Paranoidin to naturally start: None, Mild, Moderate, Severe.");
ParanoidinCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "CooldownSeconds", 180f, "Cooldown after a Paranoidin sequence starts (seconds).");
ParanoidinEnvironmentEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Paranoidin", "EnvironmentEnabled", true, "If false, Paranoidin will not force any environment/overlay changes.");
DisableParanoiaTickDuringRespawnLockout = ((BaseUnityPlugin)this).Config.Bind<bool>("Safety", "DisableParanoiaTickDuringRespawnLockout", true, "If true, ParanoiaEngine tick logic is suppressed for a short window during death/respawn transitions to avoid engine edge cases.");
RespawnLockoutSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Safety", "RespawnLockoutSeconds", 20f, "Seconds to suppress ParanoiaEngine + Paranoidin logic during death/respawn transitions.");
ParanoidinPrefabNames = ((BaseUnityPlugin)this).Config.Bind<string>("Paranoidin", "PrefabNames", "Odin", "CSV list of prefabs to try for Paranoidin visuals (first found is used). Default tries 'Odin'.");
ParanoidinFarShowDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "FarShowDistance", 35f, "Distance for the initial far Odin sighting (tease).");
ParanoidinFarShowSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "FarShowSeconds", 2f, "How long the far Odin stays before vanishing.");
ParanoidinStartDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "StartDistance", 18f, "Initial Paranoidin spawn distance (closer than the far tease).");
ParanoidinMinDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "MinDistance", 7f, "Minimum distance Paranoidin will teleport to.");
ParanoidinTeleportStep = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "TeleportStep", 3.5f, "How much closer Paranoidin moves when you break line of sight.");
ParanoidinTeleportCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "TeleportCooldown", 0.85f, "Minimum seconds between Paranoidin teleports.");
ParanoidinDespawnDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "DespawnDistance", 60f, "If player gets farther than this, Paranoidin despawns.");
ParanoidinHoldSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "HoldSeconds", 3f, "Attack only if LOS + proximity is maintained for this many seconds.");
ParanoidinAttackRange = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "AttackRange", 10f, "Attack range (meters).");
ParanoidinAttackWindupSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "AttackWindupSeconds", 1.15f, "Wind-up seconds before the hit lands (gives a chance to block).");
ParanoidinAttackDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Paranoidin", "AttackDamage", 50f, "Damage dealt by Paranoidin hit (blunt).");
ParanoidinDamageRequiresServer = ((BaseUnityPlugin)this).Config.Bind<bool>("Paranoidin", "DamageRequiresServer", true, "If true, damage only applies when running as server/host (avoids MP client desync).");
ParanoidinDebugAllowClientDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("Paranoidin", "DebugAllowClientDamage", false, "Testing only. If true, allows damage even when not server/host.");
ParanoidinWarningSfx = ((BaseUnityPlugin)this).Config.Bind<string>("Paranoidin", "WarningSfx", "", "CSV list of sfx_ prefabs to play during warnings (optional).");
ParanoidinStepSfx = ((BaseUnityPlugin)this).Config.Bind<string>("Paranoidin", "StepSfx", "", "CSV list of sfx_ prefabs to play when Paranoidin teleports closer (optional).");
ParanoidinAttackSfx = ((BaseUnityPlugin)this).Config.Bind<string>("Paranoidin", "AttackSfx", "", "CSV list of sfx_ prefabs to play right before the hit (optional).");
ParanoidinHauntSfx = ((BaseUnityPlugin)this).Config.Bind<string>("Paranoidin", "HauntSfx", "sfx_wraith_idle,sfx_ghost_idle", "CSV list of ambient haunting SFX played when Paranoidin stalking begins.");
CfgHallucinationEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Hallucination", "Enabled", true, "Enable/disable the Hallucination dungeon feature.");
CfgHallucinationWarningTimeSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination", "WarningTimeSeconds", 5f, new ConfigDescription("Seconds after entering dungeon before warning message appears.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>()));
CfgHallucinationTriggerTimeSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination", "TriggerTimeSeconds", 60f, new ConfigDescription("Seconds after entering dungeon before hallucination effect triggers.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), Array.Empty<object>()));
CfgHallucinationDurationSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination", "DurationSeconds", 300f, new ConfigDescription("How long the hallucination status effect lasts (seconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(60f, 600f), Array.Empty<object>()));
CfgHallucinationGlobalCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination", "GlobalCooldownSeconds", 600f, new ConfigDescription("Global cooldown before hallucination can trigger again (seconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(300f, 3600f), Array.Empty<object>()));
CfgHallucinationWarningMessage = ((BaseUnityPlugin)this).Config.Bind<string>("Hallucination", "WarningMessage", "Be quick, the air is thick.", "Warning message shown when entering dungeon.");
CfgHallucinationTriggerMessage = ((BaseUnityPlugin)this).Config.Bind<string>("Hallucination", "TriggerMessage", "Your mind begins to warp", "Message shown when hallucination effect is applied.");
CfgHallucinationRainbowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Hallucination.Visuals", "RainbowEnabled", true, "Enable rainbow color cycling on objects (acid trip effect).");
CfgHallucinationRainbowDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Visuals", "RainbowDistance", 30f, new ConfigDescription("Maximum distance for rainbow effect on objects.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 100f), Array.Empty<object>()));
CfgHallucinationMaxFakeCreatures = ((BaseUnityPlugin)this).Config.Bind<int>("Hallucination.FakeCreatures", "MaxFakeCreatures", 3, new ConfigDescription("Maximum number of fake creatures that can exist at once.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
CfgHallucinationFakeCreatureSpawnInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.FakeCreatures", "SpawnInterval", 15f, new ConfigDescription("Seconds between fake creature spawns.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 60f), Array.Empty<object>()));
CfgHallucinationFakeCreatureMinDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.FakeCreatures", "MinDistance", 10f, new ConfigDescription("Minimum spawn distance from player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 50f), Array.Empty<object>()));
CfgHallucinationFakeCreatureMaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.FakeCreatures", "MaxDistance", 25f, new ConfigDescription("Maximum spawn distance from player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 100f), Array.Empty<object>()));
CfgHallucinationFakeCreatureBiomeOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Hallucination.FakeCreatures", "BiomeOnly", true, "If true, fake creatures will only spawn from the player's current biome pool.");
CfgHallucinationFakeCreatureChaotic = ((BaseUnityPlugin)this).Config.Bind<bool>("Hallucination.FakeCreatures", "Chaotic", false, "Overrides BiomeOnly. Spawns fully random creatures including bosses and rare monsters for maximum chaos.");
CfgHallucinationBlurStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Blur", "BlurStrength", 0.8f, new ConfigDescription("Overall blur intensity multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
CfgHallucinationBlurIterations = ((BaseUnityPlugin)this).Config.Bind<int>("Hallucination.Blur", "BlurIterations", 3, new ConfigDescription("Number of blur downsample passes. Higher = blurrier but costs more.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 6), Array.Empty<object>()));
CfgHallucinationBlurDownsample = ((BaseUnityPlugin)this).Config.Bind<int>("Hallucination.Blur", "Downsample", 1, new ConfigDescription("Downsample factor per iteration (power of 2). 1 = half res, 2 = quarter res.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 3), Array.Empty<object>()));
CfgHallucinationEdgeWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Blur", "EdgeWidth", 0.4f, new ConfigDescription("How far the edge vignette extends inward (0 = none, 1 = full screen).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
CfgHallucinationEdgeSoftness = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Blur", "EdgeSoftness", 0.3f, new ConfigDescription("Softness of the vignette edge transition.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>()));
CfgHallucinationPulseSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Blur", "PulseSpeed", 1.5f, new ConfigDescription("Speed of the pulsing effect (cycles per second).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
CfgHallucinationPulseAmplitude = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Blur", "PulseAmplitude", 0.3f, new ConfigDescription("Strength of the pulse (0 = no pulse, 1 = double intensity at peak).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
CfgHallucinationOnsetBurialChambers = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Onset", "BurialChambersSeconds", 30f, new ConfigDescription("Seconds before hallucination onset in Burial Chambers (DG_ForestCrypt).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), Array.Empty<object>()));
CfgHallucinationOnsetTrollCave = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Onset", "TrollCaveSeconds", 45f, new ConfigDescription("Seconds before hallucination onset in Troll Caves (DG_TrollCave).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), Array.Empty<object>()));
CfgHallucinationOnsetSunkenCrypt = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Onset", "SunkenCryptSeconds", 60f, new ConfigDescription("Seconds before hallucination onset in Sunken Crypts (DG_SunkenCrypt).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), Array.Empty<object>()));
CfgHallucinationOnsetFrostCave = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Onset", "FrostCaveSeconds", 75f, new ConfigDescription("Seconds before hallucination onset in Frost Caves (DG_FrostCave).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), Array.Empty<object>()));
CfgHallucinationOnsetSealedTower = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Onset", "SealedTowerSeconds", 90f, new ConfigDescription("Seconds before hallucination onset in Sealed Towers (DG_SealedTower).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 600f), Array.Empty<object>()));
CfgHallucinationOnsetInfestedMine = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Onset", "InfestedMineSeconds", 105f, new ConfigDescription("Seconds before hallucination onset in Infested Mines (DG_DvergrMine).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 600f), Array.Empty<object>()));
CfgHallucinationOnsetPutridHole = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Onset", "PutridHoleSeconds", 120f, new ConfigDescription("Seconds before hallucination onset in Putrid Holes (DG_PutridHole).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 600f), Array.Empty<object>()));
CfgHallucinationOnsetSmoulderingTomb = ((BaseUnityPlugin)this).Config.Bind<float>("Hallucination.Onset", "SmoulderingTombSeconds", 150f, new ConfigDescription("Seconds before hallucination onset in Smouldering Tombs (DG_SmoulderingTomb).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 600f), Array.Empty<object>()));
CfgWhisperingGreydwarfEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("WhisperingGreydwarfs", "Enabled", true, "Enable/disable Whispering Greydwarfs (emit DemonicWhisperLoop instead of normal sounds).");
CfgWhisperingGreydwarfChance = ((BaseUnityPlugin)this).Config.Bind<float>("WhisperingGreydwarfs", "SpawnChance", 0.15f, new ConfigDescription("Chance (0-1) that a spawned greydwarf becomes a whispering variant.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
}
internal static void TryExtractEmbeddedResources()
{
try
{
string text = null;
try
{
text = Path.GetDirectoryName(typeof(ParanoiaPlugin).Assembly.Location);
}
catch
{
text = null;
}
if (string.IsNullOrEmpty(text))
{
try
{
text = Paths.PluginPath;
}
catch
{
text = null;
}
}
if (!string.IsNullOrEmpty(text))
{
TryExtractOne("ParanoiaSE.png", Path.Combine(text, "ParanoiaSE.png"));
TryExtractOne("HallucinateSE.png", Path.Combine(text, "HallucinateSE.png"));
TryExtractOne("NauseaSE.png", Path.Combine(text, "NauseaSE.png"));
string path = Path.Combine(text, "Assets");
TryExtractOne("px_paranoia_haunts", Path.Combine(path, "px_paranoia_haunts"));
TryExtractOne("px_relics", Path.Combine(path, "px_relics"));
TryExtractOne("px_paranoia_haunts", Path.Combine(text, "px_paranoia_haunts"));
TryExtractOne("px_relics", Path.Combine(text, "px_relics"));
}
}
catch
{
}
}
private static void TryExtractOne(string embeddedSuffix, string outputPath)
{
try
{
if (string.IsNullOrEmpty(embeddedSuffix) || string.IsNullOrEmpty(outputPath) || File.Exists(outputPath))
{
return;
}
byte[] array = null;
try
{
array = ResourcesEmbedded.ReadAllBytesBySuffix(embeddedSuffix);
}
catch
{
array = null;
}
if (array != null && array.Length != 0)
{
string directoryName = Path.GetDirectoryName(outputPath);
if (!string.IsNullOrEmpty(directoryName))
{
Directory.CreateDirectory(directoryName);
}
File.WriteAllBytes(outputPath, array);
}
}
catch
{
}
}
internal static void LogInfo(string msg)
{
ParanoiaPlugin self = _self;
if (self != null)
{
ManualLogSource logger = ((BaseUnityPlugin)self).Logger;
if (logger != null)
{
logger.LogInfo((object)msg);
}
}
}
internal static void LogWarning(string msg)
{
ParanoiaPlugin self = _self;
if (self != null)
{
ManualLogSource logger = ((BaseUnityPlugin)self).Logger;
if (logger != null)
{
logger.LogWarning((object)msg);
}
}
}
internal static void LogDebug(string msg)
{
if (DebugLogging == null || !DebugLogging.Value)
{
return;
}
ParanoiaPlugin self = _self;
if (self != null)
{
ManualLogSource logger = ((BaseUnityPlugin)self).Logger;
if (logger != null)
{
logger.LogInfo((object)("[DEBUG] " + msg));
}
}
}
internal static void LogWarn(string msg)
{
ParanoiaPlugin self = _self;
if (self != null)
{
ManualLogSource logger = ((BaseUnityPlugin)self).Logger;
if (logger != null)
{
logger.LogWarning((object)msg);
}
}
}
internal static void TryRegisterParanoidinRpc()
{
try
{
if (!_paranoidinRpcRegistered && ZRoutedRpc.instance != null)
{
_paranoidinRpcRegistered = true;
ZRoutedRpc.instance.Register<ZPackage>("PX_ParanoidinDamage", (Action<long, ZPackage>)RPC_ParanoidinDamage);
}
}
catch
{
}
}
private static void RPC_ParanoidinDamage(long sender, ZPackage pkg)
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer() || (Object)(object)ZNetScene.instance == (Object)null)
{
return;
}
ZDOID val = pkg.ReadZDOID();
float bluntDamage = pkg.ReadSingle();
Vector3 point = pkg.ReadVector3();
Vector3 dir = pkg.ReadVector3();
float pushForce = pkg.ReadSingle();
GameObject val2 = ZNetScene.instance.FindInstance(val);
if (Object.op_Implicit((Object)(object)val2))
{
Player component = val2.GetComponent<Player>();
if (Object.op_Implicit((Object)(object)component) && !((Character)component).IsDead())
{
ApplyParanoidinDamageLocal(component, bluntDamage, point, dir, pushForce);
}
}
}
catch
{
}
}
internal static void ApplyParanoidinDamageAuthoritative(Player player, float bluntDamage, Vector3 point, Vector3 dir, float pushForce)
{
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
//IL_0088: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)player == (Object)null || ((Character)player).IsDead())
{
return;
}
bool flag = true;
try
{
flag = ParanoidinDamageRequiresServer == null || ParanoidinDamageRequiresServer.Value;
}
catch
{
flag = true;
}
if (flag && (Object)(object)ZNet.instance != (Object)null && !ZNet.instance.IsServer())
{
TryRegisterParanoidinRpc();
if (ZRoutedRpc.instance == null)
{
return;
}
ZPackage val = new ZPackage();
val.Write(((Character)player).GetZDOID());
val.Write(bluntDamage);
val.Write(point);
val.Write(dir);
val.Write(pushForce);
long num = 0L;
try
{
ZNetPeer val2 = (((Object)(object)ZNet.instance != (Object)null) ? ZNet.instance.GetServerPeer() : null);
if (val2 != null)
{
num = val2.m_uid;
}
}
catch
{
}
ZRoutedRpc.instance.InvokeRoutedRPC(num, "PX_ParanoidinDamage", new object[1] { val });
}
else
{
ApplyParanoidinDamageLocal(player, bluntDamage, point, dir, pushForce);
}
}
catch
{
}
}
private static void ApplyParanoidinDamageLocal(Player player, float bluntDamage, Vector3 point, Vector3 dir, float pushForce)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!((Object)(object)player == (Object)null) && !((Character)player).IsDead())
{
HitData val = new HitData();
val.m_damage.m_blunt = bluntDamage;
val.m_point = point;
val.m_dir = dir;
val.m_pushForce = pushForce;
((Character)player).Damage(val);
}
}
catch
{
}
}
}
internal enum ParanoiaCategory
{
Foreshadow,
Displacement,
Violation
}
internal enum ParanoiaTier
{
None,
Mild,
Moderate,
Severe
}
internal sealed class ParanoiaEngine : MonoBehaviour
{
internal enum FireResult
{
Fired,
NotReady,
NoLocalPlayer,
PrefabNotFound,
GateBlocked,
RepeatBlocked,
CooldownBlocked,
SpawnFailed
}
private sealed class FalseEventProfile
{
public string Id;
public string DisplayName;
public int DeckWeight = 1;
public float DurationSeconds = 60f;
public float StartDelaySeconds = 0f;
public float PulseIntervalSeconds = 12f;
public string StartMessage;
public string PulseMessage;
public string EndMessage;
public bool DoPuke;
public float StaminaDrainOnStart;
public bool FakeHitOnStart;
public bool TimeDistortion;
public string StartOneShotOgg;
public float StartOneShotVolume = 1f;
public string StartAmbienceOgg;
public float StartAmbienceVolume = 0.7f;
public string PulseOneShotOgg;
public float PulseOneShotVolume = 1f;
public bool PulsePreferVanillaSfx;
public string[] PulseVanillaSfxPrefabs;
public bool PulseBehindPlayer = true;
public float PulseBehindMeters = 3f;
public float OneShotCooldownSeconds = 6f;
}
[CompilerGenerated]
private sealed class <FalseEvent_AutoLoop>d__114 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ParanoiaEngine <>4__this;
private Player <lp>5__1;
private float <idleSeconds>5__2;
private FalseEventProfile <next>5__3;
private float <dur>5__4;
private float <roll>5__5;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FalseEvent_AutoLoop>d__114(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<lp>5__1 = null;
<next>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
case 2:
<>1__state = -1;
break;
case 3:
<>1__state = -1;
if (<>4__this._falseEventActive)
{
break;
}
<next>5__3 = null;
try
{
<next>5__3 = <>4__this.PickNextFalseEventFromDeck();
}
catch
{
<next>5__3 = null;
}
if (<next>5__3 != null && !string.IsNullOrEmpty(<next>5__3.Id))
{
try
{
<dur>5__4 = Mathf.Max(1f, <next>5__3.DurationSeconds);
}
catch
{
<dur>5__4 = 8f;
}
try
{
<>4__this.StartFalseEvent_Local(<next>5__3.Id, <dur>5__4);
}
catch
{
}
<lp>5__1 = null;
<next>5__3 = null;
}
break;
}
<lp>5__1 = Player.m_localPlayer;
if ((Object)(object)<lp>5__1 == (Object)null)
{
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
if (<>4__this._falseEventActive)
{
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 2;
return true;
}
try
{
<roll>5__5 = Random.value;
if (<roll>5__5 < 0.7f)
{
<idleSeconds>5__2 = Random.Range(3600f, 7200f);
}
else if (<roll>5__5 < 0.9f)
{
<idleSeconds>5__2 = Random.Range(7200f, 10800f);
}
else
{
<idleSeconds>5__2 = Random.Range(10800f, 14400f);
}
}
catch
{
<idleSeconds>5__2 = 5400f;
}
<>2__current = (object)new WaitForSeconds(<idleSeconds>5__2);
<>1__state = 3;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <FalseEvent_MainLoop>d__110 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ParanoiaEngine <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FalseEvent_MainLoop>d__110(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if (<>4__this._falseEventActive && !(Time.time >= <>4__this._falseEventEndsAt))
{
<>2__current = null;
<>1__state = 1;
return true;
}
<>4__this.StopFalseEvent_Local();
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <FalseEvent_PulseLoop>d__111 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ParanoiaEngine <>4__this;
private FalseEventProfile <p>5__1;
private float <every>5__2;
private Vector3 <pos>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FalseEvent_PulseLoop>d__111(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<p>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Expected O, but got Unknown
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: 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_0095: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
<p>5__1 = null;
break;
}
if (<>4__this._falseEventActive)
{
<p>5__1 = <>4__this._activeFalseEvent;
if (<p>5__1 != null)
{
<every>5__2 = Mathf.Max(0.25f, <p>5__1.PulseIntervalSeconds);
<pos>5__3 = Vector3.zero;
try
{
<pos>5__3 = <>4__this.GetPulsePosition(<p>5__1.PulseBehindPlayer, <p>5__1.PulseBehindMeters);
}
catch
{
<pos>5__3 = Vector3.zero;
}
try
{
if (!string.IsNullOrEmpty(<p>5__1.PulseOneShotOgg))
{
<>4__this.TryPlayFalseEventOneShot(<p>5__1.PulseOneShotOgg, <p>5__1.PulseOneShotVolume, <p>5__1.PulseBehindPlayer);
}
}
catch
{
}
try
{
if (<p>5__1.PulsePreferVanillaSfx && <p>5__1.PulseVanillaSfxPrefabs != null && <p>5__1.PulseVanillaSfxPrefabs.Length != 0)
{
<>4__this.TryPlayVanillaSfxAt(<pos>5__3, <p>5__1.PulseVanillaSfxPrefabs);
}
else if (!string.IsNullOrEmpty(<p>5__1.PulseOneShotOgg))
{
<>4__this.TryPlayFalseEventOneShot(<p>5__1.PulseOneShotOgg, <p>5__1.PulseOneShotVolume, <p>5__1.PulseBehindPlayer);
}
}
catch
{
}
<>2__current = (object)new WaitForSeconds(<every>5__2);
<>1__state = 1;
return true;
}
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <Haunt2_ShooAway>d__193 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Player player;
public ParanoiaEngine <>4__this;
private float <endAt>5__1;
private Vector3 <p>5__2;
private Vector3 <dir>5__3;
private Vector3 <look>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Haunt2_ShooAway>d__193(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0086: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: 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_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<endAt>5__1 = Time.time + 2f;
break;
case 1:
<>1__state = -1;
break;
}
if (<>4__this._paranoidinActive && Time.time < <endAt>5__1 && !((Object)(object)player == (Object)null) && !((Character)player).IsDead())
{
try
{
if ((Object)(object)<>4__this._paranoidinGo != (Object)null)
{
<p>5__2 = ((Component)player).transform.position;
<dir>5__3 = <>4__this._paranoidinGo.transform.position - <p>5__2;
<dir>5__3.y = 0f;
if (((Vector3)(ref <dir>5__3)).sqrMagnitude < 0.001f)
{
<dir>5__3 = ((Component)player).transform.forward;
}
((Vector3)(ref <dir>5__3)).Normalize();
<>4__this._paranoidinPos += <dir>5__3 * 11f * Time.deltaTime;
<>4__this.ClampToGroundStable(ref <>4__this._paranoidinPos);
<>4__this._paranoidinGo.transform.position = <>4__this._paranoidinPos;
<look>5__4 = <p>5__2 - <>4__this._paranoidinPos;
<look>5__4.y = 0f;
if (((Vector3)(ref <look>5__4)).sqrMagnitude > 0.01f)
{
<>4__this._paranoidinGo.transform.rotation = Quaternion.LookRotation(((Vector3)(ref <look>5__4)).normalized);
}
}
}
catch
{
}
<>2__current = null;
<>1__state = 1;
return true;
}
try
{
<>4__this.ForceTerminateParanoidin();
}
catch
{
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <Haunt3_PunishToOneHp_ThenEnd>d__198 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Player player;
public ParanoiaEngine <>4__this;
private float <snapEndAt>5__1;
private Vector3 <p>5__2;
private Vector3 <look>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Haunt3_PunishToOneHp_ThenEnd>d__198(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0086: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<snapEndAt>5__1 = Time.time + 0.35f;
break;
case 1:
<>1__state = -1;
break;
}
if (<>4__this._paranoidinActive && Time.time < <snapEndAt>5__1 && !((Object)(object)player == (Object)null) && !((Character)player).IsDead())
{
try
{
if ((Object)(object)<>4__this._paranoidinGo != (Object)null)
{
<p>5__2 = ((Component)player).transform.position;
<look>5__3 = <p>5__2 - <>4__this._paranoidinGo.transform.position;
<look>5__3.y = 0f;
if (((Vector3)(ref <look>5__3)).sqrMagnitude > 0.01f)
{
<>4__this._paranoidinGo.transform.rotation = Quaternion.LookRotation(((Vector3)(ref <look>5__3)).normalized);
}
}
}
catch
{
}
<>2__current = null;
<>1__state = 1;
return true;
}
try
{
<>4__this.Haunt3_DropPlayerToOneHpAuthoritative(player);
}
catch
{
}
try
{
<>4__this.ForceTerminateParanoidin();
}
catch
{
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <Haunt3_ShooAway>d__197 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Player player;
public ParanoiaEngine <>4__this;
private float <endAt>5__1;
private Vector3 <p>5__2;
private Vector3 <dir>5__3;
private Vector3 <look>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Haunt3_ShooAway>d__197(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0086: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: 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_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<endAt>5__1 = Time.time + 1.75f;
break;
case 1:
<>1__state = -1;
break;
}
if (<>4__this._paranoidinActive && Time.time < <endAt>5__1 && !((Object)(object)player == (Object)null) && !((Character)player).IsDead())
{
try
{
if ((Object)(object)<>4__this._paranoidinGo != (Object)null)
{
<p>5__2 = ((Component)player).transform.position;
<dir>5__3 = <>4__this._paranoidinGo.transform.position - <p>5__2;
<dir>5__3.y = 0f;
if (((Vector3)(ref <dir>5__3)).sqrMagnitude < 0.001f)
{
<dir>5__3 = ((Component)player).transform.forward;
}
((Vector3)(ref <dir>5__3)).Normalize();
<>4__this._paranoidinPos += <dir>5__3 * 12.5f * Time.deltaTime;
<>4__this.ClampToGroundStable(ref <>4__this._paranoidinPos);
<>4__this._paranoidinGo.transform.position = <>4__this._paranoidinPos;
<look>5__4 = <p>5__2 - <>4__this._paranoidinPos;
<look>5__4.y = 0f;
if (((Vector3)(ref <look>5__4)).sqrMagnitude > 0.01f)
{
<>4__this._paranoidinGo.transform.rotation = Quaternion.LookRotation(((Vector3)(ref <look>5__4)).normalized);
}
}
}
catch
{
}
<>2__current = null;
<>1__state = 1;
return true;
}
try
{
<>4__this.ForceTerminateParanoidin();
}
catch
{
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <Haunt4_ShooAway>d__203 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Player player;
public ParanoiaEngine <>4__this;
private float <endAt>5__1;
private Vector3 <p>5__2;
private Vector3 <dir>5__3;
private Vector3 <look>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Haunt4_ShooAway>d__203(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0086: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: 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_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<endAt>5__1 = Time.time + 2.2f;
break;
case 1:
<>1__state = -1;
break;
}
if (<>4__this._paranoidinActive && Time.time < <endAt>5__1 && !((Object)(object)player == (Object)null) && !((Character)player).IsDead())
{
try
{
if ((Object)(object)<>4__this._paranoidinGo != (Object)null)
{
<p>5__2 = ((Component)player).transform.position;
<dir>5__3 = <>4__this._paranoidinGo.transform.position - <p>5__2;
<dir>5__3.y = 0f;
if (((Vector3)(ref <dir>5__3)).sqrMagnitude < 0.001f)
{
<dir>5__3 = ((Component)player).transform.forward;
}
((Vector3)(ref <dir>5__3)).Normalize();
<>4__this._paranoidinPos += <dir>5__3 * 12f * Time.deltaTime;
<>4__this.ClampToGroundStable(ref <>4__this._paranoidinPos);
<>4__this._paranoidinGo.transform.position = <>4__this._paranoidinPos;
<look>5__4 = <p>5__2 - <>4__this._paranoidinPos;
<look>5__4.y = 0f;
if (((Vector3)(ref <look>5__4)).sqrMagnitude > 0.01f)
{
<>4__this._paranoidinGo.transform.rotation = Quaternion.LookRotation(((Vector3)(ref <look>5__4)).normalized);
}
}
}
catch
{
}
<>2__current = null;
<>1__state = 1;
return true;
}
try
{
<>4__this.ForceTerminateParanoidin();
}
catch
{
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <ParanoidinRoutineDispatch>d__126 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Player player;
public bool force;
public bool ignoreCooldowns;
public ParanoiaEngine <>4__this;
private int <idx>5__1;
private IEnumerator <inner>5__2;
private int <>s__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ParanoidinRoutineDispatch>d__126(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<inner>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
<idx>5__1 = <>4__this.PickHauntIndex();
int num = <idx>5__1;
<>s__3 = num;
switch (<>s__3)
{
case 2:
<inner>5__2 = <>4__this.ParanoidinRoutine_Haunt2(player, force, ignoreCooldowns);
break;
case 3:
<inner>5__2 = <>4__this.ParanoidinRoutine_Haunt3(player, force, ignoreCooldowns);
break;
case 4:
<inner>5__2 = <>4__this.ParanoidinRoutine_Haunt4(player, force, ignoreCooldowns);
break;
case 5:
<inner>5__2 = <>4__this.ParanoidinRoutine_Haunt5(player, force, ignoreCooldowns);
break;
default:
<inner>5__2 = <>4__this.ParanoidinRoutine_Haunt1(player, force, ignoreCooldowns);
break;
}
<>2__current = <inner>5__2;
<>1__state = 1;
return true;
}
case 1:
<>1__state = -1;
if (!ignoreCooldowns)
{
try
{
<>4__this._nextAllowed_Paranoidin = Time.time + Mathf.Max(2f, ParanoiaPlugin.ParanoidinCooldownSeconds.Value);
}
catch
{
<>4__this._nextAllowed_Paranoidin = Time.time + 60f;
}
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <ParanoidinRoutine_Haunt1>d__185 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Player player;
public bool force;
public bool ignoreCooldowns;
public ParanoiaEngine <>4__this;
private bool <willAttack>5__1;
private float <hauntEndAt>5__2;
private float <attackEarliestAt>5__3;
private GameObject <farOdin>5__4;
private Vector3 <farPos>5__5;
private float <showFor>5__6;
private float <tShow>5__7;
private float <beat>5__8;
private float <tBeat>5__9;
private Vector3 <startPos>5__10;
private Vector3 <ppos>5__11;
private float <dist>5__12;
private bool <hasLos>5__13;
private bool <preferFrontAnchor>5__14;
private float <attackRange>5__15;
private float <cd>5__16;
private float <wind>5__17;
private float <tWind>5__18;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ParanoidinRoutine_Haunt1>d__185(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || (uint)(num - 1) <= 3u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<farOdin>5__4 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0538: Unknown result type (might be due to invalid IL or missing references)
//IL_0564: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
//IL_03fb: 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_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: 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_04a9: Unknown result type (might be due to invalid IL or missing references)
//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
//IL_068c: Unknown result type (might be due to invalid IL or missing references)
//IL_0675: Unknown result type (might be due to invalid IL or missing references)
//IL_0691: Unknown result type (might be due to invalid IL or missing references)
//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
//IL_077b: Unknown result type (might be due to invalid IL or missing references)
//IL_079c: Unknown result type (might be due to invalid IL or missing references)
//IL_07a2: Unknown result type (might be due to invalid IL or missing references)
//IL_092b: Unknown result type (might be due to invalid IL or missing references)
//IL_0914: Unknown result type (might be due to invalid IL or missing references)
//IL_0930: Unknown result type (might be due to invalid IL or missing references)
//IL_093c: Unknown result type (might be due to invalid IL or missing references)
bool result;
try
{
switch (<>1__state)
{
default:
result = false;
goto end_IL_0000;
case 0:
<>1__state = -1;
<>4__this._paranoidinActive = true;
<>4__this._paranoidinAttacking = false;
<>4__this._paranoidinLosHold = 0f;
<>4__this._paranoidinNearHold = 0f;
<>4__this._paranoidinLastTeleportAt = 0f;
<>4__this._paranoidinGroundInit = false;
<>4__this._paranoidinNextGroundSampleAt = 0f;
<>4__this._paranoidinLastGroundSampleXZ = Vector3.zero;
<>4__this._paranoidinPlayerInit = false;
<>4__this._paranoidinNextPlayerSampleAt = 0f;
<>4__this._paranoidinLastPlayerSpeed = 0f;
<>4__this._paranoidinHasAnchor = false;
<>4__this._paranoidinNextRetargetAt = 0f;
<>4__this.TryApplyParanoidinEnvironment(enable: true);
if (!ignoreCooldowns)
{
try
{
<>4__this._nextAllowed_Paranoidin = Time.time + Mathf.Max(2f, ParanoiaPlugin.ParanoidinCooldownSeconds.Value);
}
catch
{
<>4__this._nextAllowed_Paranoidin = Time.time + 30f;
}
}
<willAttack>5__1 = Random.value < 0.6f;
<hauntEndAt>5__2 = Time.time + Random.Range(25f, 55f);
<attackEarliestAt>5__3 = Time.time + Random.Range(6f, 16f);
<farOdin>5__4 = null;
<>1__state = -3;
if (!((Object)(object)player == (Object)null) && !((Character)player).IsDead() && !((Object)(object)Player.m_localPlayer != (Object)(object)player))
{
<farPos>5__5 = <>4__this.GetParanoidinSpawnPos(player, Mathf.Max(8f, ParanoiaPlugin.ParanoidinFarShowDistance.Value), preferFront: false);
<farOdin>5__4 = <>4__this.SpawnGhostOdin(<farPos>5__5);
<showFor>5__6 = Mathf.Clamp(ParanoiaPlugin.ParanoidinFarShowSeconds.Value, 0.6f, 6f);
<tShow>5__7 = 0f;
goto IL_02d8;
}
<>4__this.ForceTerminateParanoidin();
result = false;
<>m__Finally1();
goto end_IL_0000;
case 1:
<>1__state = -3;
goto IL_02d8;
case 2:
<>1__state = -3;
goto IL_03ad;
case 3:
<>1__state = -3;
goto IL_0a57;
case 4:
{
<>1__state = -3;
goto IL_0adb;
}
IL_02d8:
if (!<>4__this._paranoidinActive || !(<tShow>5__7 < <showFor>5__6) || (Object)(object)player == (Object)null || ((Character)player).IsDead() || (Object)(object)Player.m_localPlayer != (Object)(object)player)
{
if ((Object)(object)<farOdin>5__4 != (Object)null)
{
Object.Destroy((Object)(object)<farOdin>5__4);
}
<farOdin>5__4 = null;
<beat>5__8 = Random.Range(0.7f, 1.5f);
<tBeat>5__9 = 0f;
goto IL_03ad;
}
<tShow>5__7 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
result = true;
goto end_IL_0000;
IL_03ad:
if (!<>4__this._paranoidinActive || !(<tBeat>5__9 < <beat>5__8) || (Object)(object)player == (Object)null || ((Character)player).IsDead() || (Object)(object)Player.m_localPlayer != (Object)(object)player)
{
<startPos>5__10 = <>4__this.GetParanoidinSpawnPos(player, Mathf.Max(6f, ParanoiaPlugin.ParanoidinStartDistance.Value), preferFront: true);
<>4__this._paranoidinGo = <>4__this.SpawnGhostOdin(<startPos>5__10);
<>4__this._paranoidinPos = (((Object)(object)<>4__this._paranoidinGo != (Object)null) ? <>4__this._paranoidinGo.transform.position : <startPos>5__10);
<>4__this._paranoidinGroundY = <>4__this._paranoidinPos.y;
<>4__this._paranoidinGroundInit = true;
<>4__this._paranoidinLastGroundSampleXZ = new Vector3(<>4__this._paranoidinPos.x, 0f, <>4__this._paranoidinPos.z);
<>4__this._paranoidinNextGroundSampleAt = 0f;
try
{
((Character)player).Message((MessageType)2, "You feel watched...", 0, (Sprite)null);
if ((Object)(object)GameCamera.instance != (Object)null)
{
GameCamera.instance.AddShake(((Component)player).transform.position, 15f, 0.3f, false);
}
}
catch
{
}
if (!_pxSuppressHaunt1Sfx)
{
((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.PxPlayEmbeddedOggAt(<>4__this._paranoidinPos, "HorrerAmbience2.ogg", 0.7f));
((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.PxPlayEmbeddedOggAt(<>4__this._paranoidinPos, "Haunt1Voice.ogg", 1f));
}
<>4__this.UpdatePlayerSpeedEstimate(player);
<>4__this._paranoidinStalkAnchor = <>4__this.PickAnchorAroundPlayer(player, preferFront: true);
<>4__this._paranoidinHasAnchor = true;
<>4__this._paranoidinNextRetargetAt = Time.time + Random.Range(1f, 1.6f);
goto IL_0adb;
}
<tBeat>5__9 += Time.deltaTime;
<>2__current = null;
<>1__state = 2;
result = true;
goto end_IL_0000;
IL_0a57:
if (!<>4__this._paranoidinActive || !(<tWind>5__18 < <wind>5__17) || (Object)(object)player == (Object)null || ((Character)player).IsDead() || (Object)(object)Player.m_localPlayer != (Object)(object)player)
{
<>4__this.TryApplyParanoidinDamage(player);
if ((Object)(object)<>4__this._paranoidinGo != (Object)null)
{
<>4__this.EndOdinClamp(<>4__this._paranoidinGo);
}
break;
}
<tWind>5__18 += Time.deltaTime;
if ((Object)(object)<>4__this._paranoidinGo != (Object)null && <>4__this._odinClamped)
{
<>4__this.UpdateOdinClampAnchor(player);
}
<>2__current = null;
<>1__state = 3;
result = true;
goto end_IL_0000;
IL_0adb:
if (!<>4__this._paranoidinActive || !(Time.time < <hauntEndAt>5__2) || (Object)(object)player == (Object)null || ((Character)player).IsDead() || (Object)(object)Player.m_localPlayer != (Object)(object)player || (!force && !<>4__this.IsSafeToFire(player)))
{
break;
}
<>4__this.UpdatePlayerSpeedEstimate(player);
<ppos>5__11 = (((Object)(object)<>4__this._paranoidinGo != (Object)null) ? <>4__this._paranoidinGo.transform.position : <>4__this._paranoidinPos);
<dist>5__12 = Vector3.Distance(((Component)player).transform.position, <ppos>5__11);
if (<dist>5__12 > Mathf.Max(18f, ParanoiaPlugin.ParanoidinDespawnDistance.Value))
{
break;
}
<hasLos>5__13 = <>4__this.HasLineOfSightSimple(player, <ppos>5__11);
if (!<hasLos>5__13)
{
<cd>5__16 = Mathf.Max(0.1f, ParanoiaPlugin.ParanoidinTeleportCooldown.Value);
if (Time.time - <>4__this._paranoidinLastTeleportAt >= <cd>5__16)
{
<>4__this._paranoidinLastTeleportAt = Time.time;
<>4__this.TeleBlink(player, ref <ppos>5__11, preferFront: false);
<>4__this.TryPlayConfiguredSfxAt(<ppos>5__11, ParanoiaPlugin.ParanoidinStepSfx.Value);
<dist>5__12 = Vector3.Distance(((Component)player).transform.position, <ppos>5__11);
}
}
<preferFrontAnchor>5__14 = Time.time < <attackEarliestAt>5__3;
<>4__this.DriveChase(player, ref <ppos>5__11, <dist>5__12, <hasLos>5__13, Time.deltaTime, <preferFrontAnchor>5__14);
if (<hasLos>5__13)
{
<>4__this._paranoidinLosHold += Time.deltaTime;
}
else
{
<>4__this._paranoidinLosHold = 0f;
}
<attackRange>5__15 = Mathf.Max(1f, ParanoiaPlugin.ParanoidinAttackRange.Value);
if (<dist>5__12 <= <attackRange>5__15)
{
<>4__this._paranoidinNearHold += Time.deltaTime;
}
else
{
<>4__this._paranoidinNearHold = 0f;
}
if (<willAttack>5__1 && !<>4__this._paranoidinAttacking && Time.time >= <attackEarliestAt>5__3 && (force || <>4__this.GetCurrentTier(player) == ParanoiaTier.Severe))
{
<>4__this._paranoidinAttacking = true;
<>4__this.ForceCloseForAttack(player);
<ppos>5__11 = (((Object)(object)<>4__this._paranoidinGo != (Object)null) ? <>4__this._paranoidinGo.transform.position : <>4__this._paranoidinPos);
<>4__this.TryPlayConfiguredSfxAt(<ppos>5__11, ParanoiaPlugin.ParanoidinAttackSfx.Value);
if ((Object)(object)<>4__this._paranoidinGo != (Object)null)
{
<>4__this.BeginOdinClamp(<>4__this._paranoidinGo, player);
}
<wind>5__17 = Mathf.Clamp(ParanoiaPlugin.ParanoidinAttackWindupSeconds.Value, 0.35f, 3f);
<tWind>5__18 = 0f;
goto IL_0a57;
}
<>2__current = null;
<>1__state = 4;
result = true;
goto end_IL_0000;
}
<>m__Finally1();
result = false;
end_IL_0000:;
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
return result;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
try
{
PxStopAllHauntSfx();
}
catch
{
}
try
{
if ((Object)(object)<>4__this._paranoidinGo != (Object)null)
{
<>4__this.EndOdinClamp(<>4__this._paranoidinGo);
Object.Destroy((Object)(object)<>4__this._paranoidinGo);
}
}
catch
{
}
try
{
if ((Object)(object)<farOdin>5__4 != (Object)null)
{
Object.Destroy((Object)(object)<farOdin>5__4);
}
}
catch
{
}
<>4__this.TryApplyParanoidinEnvironment(enable: false);
<>4__this._paranoidinGo = null;
<>4__this._paranoidinActive = false;
<>4__this._paranoidinAttacking = false;
<>4__this._paranoidinLosHold = 0f;
<>4__this._paranoidinNearHold = 0f;
<>4__this._odinPrevParent = null;
<>4__this._odinClamped = false;
<>4__this.DestroyOdinClampAnchor();
try
{
<>4__this.SoftReboot_PreserveSleepState("paranoidin_end");
}
catch
{
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <ParanoidinRoutine_Haunt2>d__191 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Player player;
public bool force;
public bool ignoreCooldowns;
public ParanoiaEngine <>4__this;
private GameObject <prevPxPrefab>5__1;
private IEnumerator <inner>5__2;
private float <nextCheckAt>5__3;
private GameObject <h2>5__4;
private Player <lp0>5__5;
private Player <p0>5__6;
private Vector3 <pos0>5__7;
private object <cur>5__8;
private Player <lp>5__9;
private Player <p>5__10;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ParanoidinRoutine_Haunt2>d__191(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || (uint)(num - 1) <= 1u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<prevPxPrefab>5__1 = null;
<inner>5__2 = null;
<h2>5__4 = null;
<lp0>5__5 = null;
<p0>5__6 = null;
<cur>5__8 = null;
<lp>5__9 = null;
<p>5__10 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<prevPxPrefab>5__1 = <>4__this._pxHaunt1Prefab;
try
{
<h2>5__4 = <>4__this.TryGetPxHauntPrefabByName("PX_Haunt_Haunt2");
if ((Object)(object)<h2>5__4 != (Object)null)
{
<>4__this._pxHaunt1Prefab = <h2>5__4;
}
<h2>5__4 = null;
}
catch
{
}
try
{
<lp0>5__5 = Player.m_localPlayer;
<p0>5__6 = (((Object)(object)player != (Object)null) ? player : <lp0>5__5);
<pos0>5__7 = (((Object)(object)<p0>5__6 != (Object)null) ? ((Component)<p0>5__6).transform.position : Vector3.zero);
if ((Object)(object)Game.instance != (Object)null)
{
((MonoBehaviour)Game.instance).StartCoroutine(<>4__this.PxPlayEmbeddedOggAt(<pos0>5__7, "HorrorAmbience1.ogg", 0.7f));
}
if ((Object)(object)Game.instance != (Object)null)
{
((MonoBehaviour)Game.instance).StartCoroutine(<>4__this.PxPlayEmbeddedOggAt(<pos0>5__7, "WhisperBehindYou.ogg", 1f));
}
<lp0>5__5 = null;
<p0>5__6 = null;
}
catch
{
}
<inner>5__2 = null;
_pxSuppressHaunt1Sfx = true;
try
{
<inner>5__2 = <>4__this.ParanoidinRoutine_Haunt1(player, force, ignoreCooldowns);
}
catch
{
try
{
<>4__this.ForceTerminateParanoidin();
}
catch
{
}
<inner>5__2 = null;
}
<nextCheckAt>5__3 = Time.time;
<>1__state = -3;
if (<inner>5__2 == null)
{
break;
}
goto IL_0327;
case 1:
<>1__state = -3;
break;
case 2:
{
<>1__state = -3;
<cur>5__8 = null;
goto IL_0327;
}
IL_0327:
try
{
if (!<inner>5__2.MoveNext())
{
break;
}
<cur>5__8 = <inner>5__2.Current;
goto IL_0221;
}
catch
{
}
break;
IL_0221:
if (<>4__this._paranoidinActive && (Object)(object)<>4__this._paranoidinGo != (Object)null && Time.time >= <nextCheckAt>5__3)
{
<nextCheckAt>5__3 = Time.time + 0.15f;
<lp>5__9 = Player.m_localPlayer;
<p>5__10 = (((Object)(object)player != (Object)null) ? player : <lp>5__9);
if ((Object)(object)<p>5__10 != (Object)null && <>4__this.Haunt2_IsRepelledByWater(<p>5__10))
{
<>2__current = <>4__this.Haunt2_ShooAway(<p>5__10);
<>1__state = 1;
return true;
}
<lp>5__9 = null;
<p>5__10 = null;
}
<>2__current = <cur>5__8;
<>1__state = 2;
return true;
}
<>m__Finally1();
return false;
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
try
{
PxStopAllHauntSfx();
}
catch
{
}
try
{
_pxSuppressHaunt1Sfx = false;
}
catch
{
}
try
{
<>4__this.ForceTerminateParanoidin();
}
catch
{
}
try
{
<>4__this._pxHaunt1Prefab = <prevPxPrefab>5__1;
}
catch
{
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <ParanoidinRoutine_Haunt3>d__196 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Player player;
public bool force;
public bool ignoreCooldowns;
public ParanoiaEngine <>4__this;
private GameObject <prevPxPrefab>5__1;
private IEnumerator <inner>5__2;
private float <nextCheckAt>5__3;
private Vector3 <lastPos>5__4;
private float <lastPosAt>5__5;
private float <quietHeld>5__6;
private float <noisyHeld>5__7;
private GameObject <h3>5__8;
private Player <lp0>5__9;
private Vector3 <pos0>5__10;
private Player <lp>5__11;
private Player <pInit>5__12;
private object <cur>5__13;
private float <now>5__14;
private Player <lp>5__15;
private Player <p>5__16;
private float <speed>5__17;
private float <dtHeld>5__18;
private Vector3 <pos>5__19;
private float <dt>5__20;
private float <dx>5__21;
private float <dz>5__22;
private float <distXZ>5__23;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ParanoidinRoutine_Haunt3>d__196(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || (uint)(num - 1) <= 2u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<prevPxPrefab>5__1 = null;
<inner>5__2 = null;
<h3>5__8 = null;
<lp0>5__9 = null;
<lp>5__11 = null;
<pInit>5__12 = null;
<cur>5__13 = null;
<lp>5__15 = null;
<p>5__16 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0394: 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_0448: Unknown result type (might be due to invalid IL or missing references)
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<prevPxPrefab>5__1 = <>4__this._pxHaunt1Prefab;
try
{
<h3>5__8 = <>4__this.TryGetPxHauntPrefabByName("PX_Haunt_Haunt3");
if ((Object)(object)<h3>5__8 != (Object)null)
{
<>4__this._pxHaunt1Prefab = <h3>5__8;
}
<h3>5__8 = null;
}
catch
{
}
<inner>5__2 = null;
try
{
<lp0>5__9 = (((Object)(object)player != (Object)null) ? player : Player.m_localPlayer);
<pos0>5__10 = (((Object)(object)<lp0>5__9 != (Object)null) ? ((Component)<lp0>5__9).transform.position : Vector3.zero);
if ((Object)(object)Game.instance != (Object)null)
{
((MonoBehaviour)Game.instance).StartCoroutine(<>4__this.PxPlayEmbeddedOggAt(<pos0>5__10, "HorrorAmbience1.ogg", 0.7f));
}
if ((Object)(object)Game.instance != (Object)null)
{
((MonoBehaviour)Game.instance).StartCoroutine(<>4__this.PxPlayEmbeddedOggAt(<pos0>5__10, "HorrorRiser3.ogg", 1f));
}
<lp0>5__9 = null;
}
catch
{
}
try
{
_pxSuppressHaunt1Sfx = true;
<inner>5__2 = <>4__this.ParanoidinRoutine_Haunt1(player, force, ignoreCooldowns);
}
catch
{
try
{
_pxSuppressHaunt1Sfx = false;
}
catch
{
}
try
{
<>4__this.ForceTerminateParanoidin();
}
catch
{
}
<inner>5__2 = null;
}
<nextCheckAt>5__3 = Time.time;
<lastPos>5__4 = Vector3.zero;
<lastPosAt>5__5 = -1f;
<quietHeld>5__6 = 0f;
<noisyHeld>5__7 = 0f;
try
{
<lp>5__11 = Player.m_localPlayer;
<pInit>5__12 = (((Object)(object)player != (Object)null) ? player : <lp>5__11);
if ((Object)(object)<pInit>5__12 != (Object)null)
{
<lastPos>5__4 = ((Component)<pInit>5__12).transform.position;
<lastPosAt>5__5 = Time.time;
}
<lp>5__11 = null;
<pInit>5__12 = null;
}
catch
{
}
<>1__state = -3;
if (<inner>5__2 == null)
{
break;
}
goto IL_0636;
case 1:
<>1__state = -3;
break;
case 2:
<>1__state = -3;
break;
case 3:
{
<>1__state = -3;
<cur>5__13 = null;
goto IL_0636;
}
IL_0636:
try
{
if (!<inner>5__2.MoveNext())
{
break;
}
<cur>5__13 = <inner>5__2.Current;
goto IL_02cc;
}
catch
{
}
break;
IL_02cc:
if (<>4__this._paranoidinActive && (Object)(object)<>4__this._paranoidinGo != (Object)null && Time.time >= <nextCheckAt>5__3)
{
<now>5__14 = Time.time;
<nextCheckAt>5__3 = <now>5__14 + 0.12f;
<lp>5__15 = Player.m_localPlayer;
<p>5__16 = (((Object)(object)player != (Object)null) ? player :