using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using Gravity;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using ULTRAKILL.Cheats;
using ULTRAKILL.Portal;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using allroadsleadtofraud.Patches;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("allroadsleadtofraud")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3")]
[assembly: AssemblyProduct("All Roads Lead To Disintegration Loop")]
[assembly: AssemblyTitle("allroadsleadtofraud")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 allroadsleadtofraud
{
public enum DoorStyle
{
Unknown,
FirstRoom,
Prelude,
Limbo,
Lust,
Gluttony,
Greed,
Wrath,
Heresy,
Violence,
Fraud,
Treachery
}
public static class DoorStyleExt
{
public static string GetStyleName(this DoorStyle s)
{
switch (s)
{
case DoorStyle.FirstRoom:
return "FirstRoom";
case DoorStyle.Prelude:
return "PreludeStyle";
case DoorStyle.Limbo:
return "LimboStyle";
case DoorStyle.Lust:
return "LustStyle";
case DoorStyle.Gluttony:
return "GluttonyStyle";
case DoorStyle.Greed:
return "GreedStyle";
case DoorStyle.Wrath:
return "WrathStyle";
case DoorStyle.Heresy:
return "HeresyStyle";
case DoorStyle.Violence:
return "ViolenceStyle";
case DoorStyle.Fraud:
return "FraudStyle";
default:
Plugin.Logger.LogError((object)$"{s} is not a valid doorstyle");
return "PreludeStyle";
}
}
public static DoorStyle DoorStyleFromString(this string s)
{
s = s.ToLower();
s = s.Trim();
switch (s)
{
case "unknownstyle":
return DoorStyle.Unknown;
case "firstroom":
return DoorStyle.FirstRoom;
case "preludestyle":
return DoorStyle.Prelude;
case "limbostyle":
return DoorStyle.Limbo;
case "luststyle":
return DoorStyle.Lust;
case "gluttonystyle":
return DoorStyle.Gluttony;
case "greedstyle":
return DoorStyle.Greed;
case "wrathstyle":
return DoorStyle.Wrath;
case "heresystyle":
return DoorStyle.Heresy;
case "violencestyle":
return DoorStyle.Violence;
case "fraudstyle":
return DoorStyle.Fraud;
default:
Plugin.Logger.LogError((object)(s + " is not a valid doorstyle"));
return DoorStyle.Unknown;
}
}
}
public static class LevelDatabaseChecker
{
public class LevelDoorData
{
public DoorStyle style { get; internal set; }
public int subDoorId { get; internal set; }
}
private static Dictionary<string, LevelDoorData> _doorPathToData = new Dictionary<string, LevelDoorData>();
internal static void LoadDatabase()
{
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("allroadsleadtofraud.leveldatabase.txt");
if (stream == null)
{
Plugin.Logger.LogError((object)"Could not load LevelDataDoorDatabase due to missing stream!");
return;
}
using StreamReader streamReader = new StreamReader(stream);
string[] array = streamReader.ReadToEnd().Split('\n');
_doorPathToData.Clear();
try
{
string[] array2 = array;
foreach (string text in array2)
{
if (!string.IsNullOrWhiteSpace(text) && !text.StartsWith("//"))
{
string[] array3 = text.Split('Ω');
_doorPathToData.TryAdd(array3[0].TrimEnd(), new LevelDoorData
{
style = array3[1].DoorStyleFromString(),
subDoorId = int.Parse(array3[2].Trim())
});
}
}
}
catch (Exception ex)
{
Plugin.Logger.LogError((object)("Error while loading leveldoordatabase: " + ex.Message));
}
}
public static LevelDoorData? CheckDoor(GameObject door)
{
string key = SceneHelper.CurrentScene + "> " + Plugin.GetPath(door);
return _doorPathToData.GetValueOrDefault(key);
}
}
public class FogData
{
public bool UseFog;
public Color FogColor;
public float FogStart;
public float FogEnd;
public Material Skybox;
public Color AmbientLight;
public static FogData FromCurrent()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
return new FogData
{
UseFog = RenderSettings.fog,
FogColor = RenderSettings.fogColor,
FogStart = RenderSettings.fogStartDistance,
FogEnd = RenderSettings.fogEndDistance,
Skybox = RenderSettings.skybox,
AmbientLight = RenderSettings.ambientLight
};
}
public void Apply()
{
//IL_000c: 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)
RenderSettings.fog = UseFog;
RenderSettings.fogColor = FogColor;
RenderSettings.fogStartDistance = FogStart;
RenderSettings.fogEndDistance = FogEnd;
RenderSettings.skybox = Skybox;
RenderSettings.ambientLight = AmbientLight;
}
public void ApplyEnter(Portal p)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
p.enableOverrideFog = true;
p.useFogEnter = true;
p.overrideFogStartEnter = FogStart;
p.overrideFogEndEnter = FogEnd;
p.overrideFogColorEnter = FogColor;
p.overrideSkyboxEnter = Skybox;
}
public void ApplyExit(Portal p)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
p.enableOverrideFog = true;
p.useFogExit = true;
p.overrideFogStartExit = FogStart;
p.overrideFogEndExit = FogEnd;
p.overrideFogColorExit = FogColor;
p.overrideSkyboxExit = Skybox;
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.triggeredidiot.allroadsleadtofraud", "All Roads Lead To Disintegration Loop", "1.1.3")]
public class Plugin : BaseUnityPlugin
{
private class stupidfuckingthingihatethisfunction : MonoBehaviour
{
}
[CompilerGenerated]
private sealed class <RunCoroutine>d__100 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float delay;
public IEnumerator action;
public GameObject self;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RunCoroutine>d__100(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = action;
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
Object.Destroy((Object)(object)self);
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 <RunDelayCoroutine>d__99 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float delay;
public Action action;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RunDelayCoroutine>d__99(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
action();
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();
}
}
public const string DisintegrationLoopPath = "Assets/Mods/allroadsleadtofraud/disintegrationloop.unity";
public const string DisintegrationLoopMixerPath = "Assets/Mods/allroadsleadtofraud/MusicAudioFraud.mixer";
public const string DisintegrationLoopMusicCPath = "Assets/Music/8-3 Intro Clean.wav";
public const string DisintegrationLoopMusicBPath = "Assets/Music/8-3 Intro.wav";
internal static FogData _levelFogData = new FogData();
private static bool _levelHasFogUpdated = false;
internal static readonly FogData DisintegrationLoopFogData = new FogData
{
UseFog = true,
FogColor = new Color(0.282f, 0.549f, 0.898f, 1f),
FogStart = 0f,
FogEnd = 500f
};
public static bool ReplaceFinal = true;
public static bool ReplaceFirst = true;
public static bool ReplacePrelude = true;
public static bool ReplaceLimbo = true;
public static bool ReplaceLust = true;
public static bool ReplaceGluttony = true;
public static bool ReplaceGreed = true;
public static bool ReplaceWrath = true;
public static bool ReplaceHeresy = true;
public static bool ReplaceViolence = true;
public static bool ReplaceFraud = true;
public static bool ReplaceTreachery = false;
public static bool ReplacePortalDoors = true;
public static bool DisplayFakeLevelTitle = true;
public static bool StopTimerInLoop = false;
public static bool ReplaceSecretLevels = false;
public static bool ReplaceSpecialLevels = false;
public static bool ReplacePrimeLevels = true;
public static bool ReplaceEncoreLevels = true;
public static bool ReplaceCustomLevels = true;
public static bool AllowCrossPatching = true;
public static bool DisableFraudMusic = false;
public static bool ModCompatabilityMode = false;
public static float ReplaceChance = 5f;
private Action yesthisisbadbutimtoolazy;
internal static HashSet<Door> SkullDoors = new HashSet<Door>();
internal static PluginConfigurator config;
internal static bool debugDoor = false;
internal static ManualLogSource Logger { get; set; } = null;
public static string AddressablesPath { get; private set; } = string.Empty;
public static string AddressablesCatalogPath { get; private set; } = string.Empty;
public static bool IsReady { get; private set; } = false;
public static AudioMixer DisintegrationLoopMixer { get; private set; }
public static AudioMixerGroup DisintegrationLoopMixerOut { get; private set; }
public static AudioClip DisintegrationLoopMusicC { get; private set; }
public static AudioClip DisintegrationLoopMusicB { get; private set; }
public static SceneInstance? DisintegrationLoop { get; private set; } = null;
public static bool HasLoadedDisintegrationLoop
{
get
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if (DisintegrationLoop.HasValue)
{
SceneInstance value = DisintegrationLoop.Value;
Scene scene = ((SceneInstance)(ref value)).Scene;
return ((Scene)(ref scene)).isLoaded;
}
return false;
}
}
public static bool IsInDisintegrationLoop { get; internal set; } = false;
public static FogData LevelFogData => _levelFogData;
public static Queue<Action> RunAfterDisintegrationLoop { get; internal set; } = new Queue<Action>();
public static bool HasLimboSky { get; private set; } = false;
internal static void UpdateFogState()
{
if (!_levelHasFogUpdated)
{
ForceUpdateFogState();
}
}
internal static void ForceUpdateFogState()
{
_levelHasFogUpdated = true;
_levelFogData = FogData.FromCurrent();
if ((Object)(object)ApplyDisintegrationLoopPatch.portalEnter != (Object)null)
{
_levelFogData.ApplyExit(ApplyDisintegrationLoopPatch.portalEnter);
}
if ((Object)(object)ApplyDisintegrationLoopPatch.portalExit != (Object)null)
{
_levelFogData.ApplyEnter(ApplyDisintegrationLoopPatch.portalExit);
}
}
public static bool IsReplacing()
{
string currentScene = SceneHelper.CurrentScene;
if (currentScene == "Level 4-S")
{
return false;
}
if (!ReplaceSecretLevels && currentScene.EndsWith("-S"))
{
return false;
}
bool flag = !ReplaceSpecialLevels;
if (flag)
{
bool flag2;
switch (currentScene)
{
case "CreditsMuseum2":
case "Endless":
case "Tutorial":
case "uk_construct":
flag2 = true;
break;
default:
flag2 = false;
break;
}
flag = flag2;
}
if (flag)
{
return false;
}
if (!ReplaceEncoreLevels && currentScene.EndsWith("-E"))
{
return false;
}
if (!ReplacePrimeLevels && currentScene.StartsWith("Level P-"))
{
return false;
}
if (!ReplaceCustomLevels && SceneHelper.IsPlayingCustom)
{
return false;
}
return true;
}
public static bool IsReplacingStyle(DoorStyle style)
{
if (!IsReplacing())
{
return false;
}
string currentScene = SceneHelper.CurrentScene;
switch (style)
{
case DoorStyle.FirstRoom:
return ReplaceFirst;
case DoorStyle.Prelude:
if (ReplacePrelude)
{
if (AllowCrossPatching)
{
return true;
}
return currentScene.StartsWith("Level 0-");
}
return false;
case DoorStyle.Limbo:
if (ReplaceLimbo)
{
if (AllowCrossPatching)
{
return true;
}
return currentScene.StartsWith("Level 1-");
}
return false;
case DoorStyle.Lust:
if (ReplaceLust)
{
if (AllowCrossPatching)
{
return true;
}
return currentScene.StartsWith("Level 2-");
}
return false;
case DoorStyle.Gluttony:
if (ReplaceGluttony)
{
if (AllowCrossPatching)
{
return true;
}
return currentScene.StartsWith("Level 3-");
}
return false;
case DoorStyle.Greed:
if (ReplaceGreed)
{
if (AllowCrossPatching)
{
return true;
}
return currentScene.StartsWith("Level 4-");
}
return false;
case DoorStyle.Wrath:
if (ReplaceWrath)
{
if (AllowCrossPatching)
{
return true;
}
return currentScene.StartsWith("Level 5-");
}
return false;
case DoorStyle.Heresy:
if (ReplaceHeresy)
{
if (AllowCrossPatching)
{
return true;
}
return currentScene.StartsWith("Level 6-");
}
return false;
case DoorStyle.Violence:
if (ReplaceViolence)
{
if (AllowCrossPatching)
{
return true;
}
return currentScene.StartsWith("Level 7-");
}
return false;
case DoorStyle.Fraud:
if (ReplaceFraud)
{
if (AllowCrossPatching)
{
return true;
}
return currentScene.StartsWith("Level 8-");
}
return false;
case DoorStyle.Treachery:
if (ReplaceTreachery)
{
if (AllowCrossPatching)
{
return true;
}
return currentScene.StartsWith("Level 9-");
}
return false;
default:
return false;
}
}
private void Update()
{
yesthisisbadbutimtoolazy();
}
private void LateUpdate()
{
}
private void Awake()
{
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Expected O, but got Unknown
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Expected O, but got Unknown
//IL_030a: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Expected O, but got Unknown
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_033a: Expected O, but got Unknown
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Expected O, but got Unknown
//IL_0369: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Expected O, but got Unknown
//IL_037c: Unknown result type (might be due to invalid IL or missing references)
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
//IL_03a0: Expected O, but got Unknown
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
//IL_03be: Expected O, but got Unknown
//IL_03c7: 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_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_03f3: Expected O, but got Unknown
//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
//IL_03f5: Expected O, but got Unknown
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_0418: Expected O, but got Unknown
//IL_0431: Unknown result type (might be due to invalid IL or missing references)
//IL_043b: Expected O, but got Unknown
//IL_0454: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Expected O, but got Unknown
//IL_0477: Unknown result type (might be due to invalid IL or missing references)
//IL_0481: Expected O, but got Unknown
//IL_049a: Unknown result type (might be due to invalid IL or missing references)
//IL_04a4: Expected O, but got Unknown
//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
//IL_04c7: Expected O, but got Unknown
//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
//IL_04fe: Expected O, but got Unknown
//IL_0517: Unknown result type (might be due to invalid IL or missing references)
//IL_0521: Expected O, but got Unknown
//IL_0521: Unknown result type (might be due to invalid IL or missing references)
//IL_052e: Expected O, but got Unknown
//IL_0529: Unknown result type (might be due to invalid IL or missing references)
//IL_0530: Expected O, but got Unknown
//IL_0549: Unknown result type (might be due to invalid IL or missing references)
//IL_0553: Expected O, but got Unknown
//IL_0553: Unknown result type (might be due to invalid IL or missing references)
//IL_0560: Expected O, but got Unknown
//IL_055b: Unknown result type (might be due to invalid IL or missing references)
//IL_0562: Expected O, but got Unknown
//IL_057b: Unknown result type (might be due to invalid IL or missing references)
//IL_0585: Expected O, but got Unknown
//IL_059e: Unknown result type (might be due to invalid IL or missing references)
//IL_05a8: Expected O, but got Unknown
//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
//IL_05cb: Expected O, but got Unknown
//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
//IL_05d8: Expected O, but got Unknown
//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
//IL_05da: Expected O, but got Unknown
//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
//IL_05fd: Expected O, but got Unknown
//IL_0616: Unknown result type (might be due to invalid IL or missing references)
//IL_0620: Expected O, but got Unknown
//IL_0639: Unknown result type (might be due to invalid IL or missing references)
//IL_0643: Expected O, but got Unknown
//IL_064f: Expected O, but got Unknown
//IL_064a: Unknown result type (might be due to invalid IL or missing references)
//IL_0651: Expected O, but got Unknown
//IL_066a: Unknown result type (might be due to invalid IL or missing references)
//IL_0674: Expected O, but got Unknown
//IL_068d: Unknown result type (might be due to invalid IL or missing references)
//IL_0697: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)4;
Logger.LogInfo((object)"Checking addressable files");
AddressablesPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? Path.Combine(Paths.PluginPath, "allroadsleadtofraud"), "Addressables");
AddressablesCatalogPath = Path.Combine(AddressablesPath, "catalog.json");
string path = Path.Combine(AddressablesPath, "version.txt");
bool flag = true;
if (File.Exists(path))
{
if (File.ReadAllText(path) == "1.1.3")
{
flag = false;
}
else
{
Logger.LogWarning((object)"Existing addressable files have mis-matching version!");
flag = true;
}
}
else
{
flag = true;
}
if (!Directory.Exists(AddressablesPath))
{
Directory.CreateDirectory(AddressablesPath);
flag = true;
}
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if (flag)
{
Logger.LogInfo((object)"Extracting addressable files");
using Stream stream = executingAssembly.GetManifestResourceStream("allroadsleadtofraud.Addressables.zip");
if (stream == null)
{
Logger.LogError((object)"Could not load Addressables.zip due to missing stream!");
return;
}
using ZipArchive zipArchive = new ZipArchive(stream, ZipArchiveMode.Read);
foreach (ZipArchiveEntry entry in zipArchive.Entries)
{
string path2 = Path.Combine(AddressablesPath, entry.FullName);
if (string.IsNullOrEmpty(entry.Name))
{
continue;
}
using Stream stream2 = entry.Open();
using FileStream destination = File.Create(path2);
stream2.CopyTo(destination);
}
Logger.LogInfo((object)"Storing addressable version as 1.1.3");
File.WriteAllText(path, "1.1.3");
}
Logger.LogInfo((object)"Patching methods");
new Harmony("com.triggeredidiot.allroadsleadtofraud").PatchAll();
Logger.LogInfo((object)"Loading LevelDoorDatabase");
LevelDatabaseChecker.LoadDatabase();
Logger.LogInfo((object)"Setting up config");
config = PluginConfigurator.Create("All Roads Lead To Fraud", "com.triggeredidiot.allroadsleadtofraud");
using Stream stream3 = executingAssembly.GetManifestResourceStream("allroadsleadtofraud.thumb.png");
using (MemoryStream memoryStream = new MemoryStream())
{
stream3?.CopyTo(memoryStream);
Texture2D val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, memoryStream.ToArray());
config.icon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero);
}
new ConfigHeader(config.rootPanel, "Checkout other options if you're having issues", 24);
FloatSliderField jumpscareChance = new FloatSliderField(config.rootPanel, "Jumpscare Chance", "jumpscare_chance", new Tuple<float, float>(0f, 100f), 5f);
BoolField displayFakeLevelTitle = new BoolField(config.rootPanel, "Display Fake Level Title", "jumpscare_faketitle", DisplayFakeLevelTitle, true, true);
BoolField pauseTimer = new BoolField(config.rootPanel, "Pause the timer in [8-3]", "jumpscare_pausetimer", StopTimerInLoop, true, true);
ConfigPanel val2 = new ConfigPanel(config.rootPanel, "Other Options", "other_panel");
BoolField modCompat = new BoolField(val2, "Enable Mod Compatability Mode", "other_compat", ModCompatabilityMode, true, true);
new ConfigHeader(val2, "Tip: Use compatability mode if mod assets duplicate or break when the jumpscare is activated.", 24);
BoolField replaceMusic = new BoolField(val2, "Disable 8-3 music", "other_music", DisableFraudMusic, true, true);
BoolField allowCross = new BoolField(val2, "Allow cross door patching", "other_cross", AllowCrossPatching, true, true);
new ConfigHeader(val2, "(i.e if a prelude door appears in limbo)", 24);
ConfigPanel val3 = new ConfigPanel(config.rootPanel, "Jumpscare Options", "jumpscare_panel");
ConfigHeader val4 = new ConfigHeader(val3, "Target Doors", 24);
BoolField replaceSecret = new BoolField(((ConfigField)val4).parentPanel, "Allow jumpscares in secret levels", "jumpscare_secret", ReplaceSecretLevels, true, true);
BoolField replaceSpecial = new BoolField(((ConfigField)val4).parentPanel, "Allow jumpscares in special levels", "jumpscare_special", ReplaceSpecialLevels, true, true);
BoolField replacePrime = new BoolField(((ConfigField)val4).parentPanel, "Allow jumpscares in prime levels", "jumpscare_prime", ReplacePrimeLevels, true, true);
BoolField replaceEncore = new BoolField(((ConfigField)val4).parentPanel, "Allow jumpscares in encore levels", "jumpscare_encore", ReplaceEncoreLevels, true, true);
BoolField replaceCustom = new BoolField(((ConfigField)val4).parentPanel, "Allow jumpscares in custom levels", "jumpscare_custom", ReplaceCustomLevels, true, true);
BoolField replaceFraud2 = new BoolField(((ConfigField)val4).parentPanel, "Jumpscare Portal Doors", "jumpscare_fraud_portal_doors", ReplacePortalDoors, true, true);
new ConfigHeader(((ConfigField)val4).parentPanel, "Disable this if you are having issues with fraud doors", 24);
BoolField replaceFirstRoom = new BoolField(((ConfigField)val4).parentPanel, "Jumpscare FirstRoom", "jumpscare_firstroom", ReplaceFirst, true, true);
BoolField replaceFinalRoom = new BoolField(((ConfigField)val4).parentPanel, "Jumpscare FinalRoom", "jumpscare_finalroom", ReplaceFinal, true, true);
ConfigHeader val5 = new ConfigHeader(val3, "Prelude", 24);
BoolField replacePrelude = new BoolField(((ConfigField)val5).parentPanel, "Jumpscare Prelude", "jumpscare_prelude", ReplacePrelude, true, true);
ConfigHeader val6 = new ConfigHeader(val3, "Act 1", 24);
BoolField replaceLimbo = new BoolField(((ConfigField)val6).parentPanel, "Jumpscare Limbo", "jumpscare_limbo", ReplaceLimbo, true, true);
BoolField replaceLust = new BoolField(((ConfigField)val6).parentPanel, "Jumpscare Lust", "jumpscare_lust", ReplaceLust, true, true);
BoolField replaceGluttony = new BoolField(((ConfigField)val6).parentPanel, "Jumpscare Gluttony", "jumpscare_gluttony", ReplaceGluttony, true, true);
ConfigHeader val7 = new ConfigHeader(val3, "Act 2", 24);
BoolField replaceGreed = new BoolField(((ConfigField)val7).parentPanel, "Jumpscare Greed", "jumpscare_greed", ReplaceGreed, true, true);
BoolField replaceWrath = new BoolField(((ConfigField)val7).parentPanel, "Jumpscare Wrath", "jumpscare_wrath", ReplaceWrath, true, true);
BoolField replaceHeresy = new BoolField(((ConfigField)val7).parentPanel, "Jumpscare Heresy", "jumpscare_heresy", ReplaceHeresy, true, true);
ConfigHeader val8 = new ConfigHeader(val3, "Act 3", 24);
BoolField replaceViolence = new BoolField(((ConfigField)val8).parentPanel, "Jumpscare Violence", "jumpscare_violence", ReplaceViolence, true, true);
BoolField replaceFraud = new BoolField(((ConfigField)val8).parentPanel, "Jumpscare Fraud", "jumpscare_fraud", ReplaceFraud, true, true);
yesthisisbadbutimtoolazy = delegate
{
ModCompatabilityMode = modCompat.value;
AllowCrossPatching = allowCross.value;
DisableFraudMusic = replaceMusic.value;
ReplaceSpecialLevels = replaceSpecial.value;
ReplacePrimeLevels = replacePrime.value;
ReplaceEncoreLevels = replaceEncore.value;
ReplaceCustomLevels = replaceCustom.value;
ReplaceSecretLevels = replaceSecret.value;
ReplaceFirst = replaceFirstRoom.value;
ReplaceFinal = replaceFinalRoom.value;
ReplacePrelude = replacePrelude.value;
ReplaceLimbo = replaceLimbo.value;
ReplaceLust = replaceLust.value;
ReplaceGluttony = replaceGluttony.value;
ReplaceGreed = replaceGreed.value;
ReplaceWrath = replaceWrath.value;
ReplaceHeresy = replaceHeresy.value;
ReplaceViolence = replaceViolence.value;
ReplaceFraud = replaceFraud.value;
ReplaceTreachery = false;
StopTimerInLoop = pauseTimer.value;
DisplayFakeLevelTitle = displayFakeLevelTitle.value;
ReplacePortalDoors = replaceFraud2.value;
ReplaceChance = jumpscareChance.value;
};
Logger.LogInfo((object)"Hooking into SceneManager");
bool hasLoaded = false;
SceneManager.sceneLoaded += delegate(Scene lcm, LoadSceneMode s)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
//IL_011f: 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)
if ((int)s != 1)
{
NoCheatingPatches.WasActive = false;
_levelHasFogUpdated = false;
IsInDisintegrationLoop = false;
ApplyDisintegrationLoopPatch.HasPatchedFirstRoom = false;
ApplyDisintegrationLoopPatch.HasDisintegrated = false;
ApplyDisintegrationLoopPatch.LastDisintegrationTime = -1f;
ApplyDisintegrationLoopPatch.WasPlayingMusic = false;
ApplyDisintegrationLoopPatch.dontFuckingSwapDoorsGodIHateProgrammingThisFuckassMod = false;
ApplyDisintegrationLoopPatch._alreadyOpenedDoors.Clear();
TimeOfDayPatch.doneChangers.Clear();
LevelNamePopupPatch.DidReplace = false;
LevelNamePopupPatch.SafeToGrab = true;
SkullDoors.Clear();
ItemPlaceZone[] array = Object.FindObjectsByType<ItemPlaceZone>((FindObjectsInactive)1, (FindObjectsSortMode)0);
foreach (ItemPlaceZone val9 in array)
{
if (val9.doors != null)
{
SkullDoors.UnionWith(val9.doors);
SkullDoors.UnionWith(val9.reverseDoors);
}
}
HasLimboSky = Object.FindObjectsByType<LimboSkybox>((FindObjectsInactive)1, (FindObjectsSortMode)0).Length != 0;
if (!(SceneHelper.CurrentScene == "Bootstrap"))
{
if (hasLoaded)
{
switch (SceneHelper.CurrentScene)
{
default:
LoadDisintegrationLoop();
break;
case "Intro":
break;
case "Level 4-S":
break;
}
}
else
{
hasLoaded = true;
Logger.LogInfo((object)"Loading addressables catalog...");
AsyncOperationHandle<IResourceLocator> val10 = Addressables.LoadContentCatalogAsync(AddressablesCatalogPath, (string)null);
val10.Completed += delegate(AsyncOperationHandle<IResourceLocator> handle)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if ((int)handle.Status != 1)
{
Logger.LogError((object)$"Failed to load catalog at '{AddressablesCatalogPath}', got status '{handle.Status}'");
}
else
{
Logger.LogInfo((object)("Loaded catalog at '" + AddressablesCatalogPath + "'"));
IsReady = true;
Logger.LogInfo((object)"Loading music...");
RunDelay(delegate
{
//IL_0005: 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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
DisintegrationLoopMixer = Addressables.LoadAssetAsync<AudioMixer>((object)"Assets/Mods/allroadsleadtofraud/MusicAudioFraud.mixer").WaitForCompletion();
DisintegrationLoopMixerOut = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Mods/allroadsleadtofraud/IntroMusicIntro.prefab").WaitForCompletion().GetComponentInChildren<AudioSource>(true)
.outputAudioMixerGroup;
DisintegrationLoopMusicC = Addressables.LoadAssetAsync<AudioClip>((object)"Assets/Music/8-3 Intro Clean.wav").WaitForCompletion();
DisintegrationLoopMusicB = Addressables.LoadAssetAsync<AudioClip>((object)"Assets/Music/8-3 Intro.wav").WaitForCompletion();
Logger.LogInfo((object)"Music loaded!");
}, 0f);
}
};
}
}
}
};
Logger.LogInfo((object)"Plugin com.triggeredidiot.allroadsleadtofraud has awoken!");
}
public static void LoadDisintegrationLoop(Action? successCallback = null)
{
//IL_002d: 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)
Action successCallback2 = successCallback;
if (HasLoadedDisintegrationLoop)
{
Logger.LogWarning((object)"Tried to load disintegration loop but it is already loaded!");
return;
}
AsyncOperationHandle<SceneInstance> val = Addressables.LoadSceneAsync((object)"Assets/Mods/allroadsleadtofraud/disintegrationloop.unity", (LoadSceneMode)1, true, 100);
val.Completed += delegate(AsyncOperationHandle<SceneInstance> handle)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
if ((int)handle.Status != 1)
{
Logger.LogError((object)"Failed to load disintegration loop!");
}
else
{
DisintegrationLoop = handle.Result;
successCallback2?.Invoke();
}
};
}
public static void UnloadDisintegrationLoop(Action? successCallback = null)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
Action successCallback2 = successCallback;
if (!HasLoadedDisintegrationLoop)
{
Logger.LogWarning((object)"Tried to unload disintegration loop but it wasn't loaded to begin with!");
return;
}
IsInDisintegrationLoop = false;
ApplyDisintegrationLoopPatch.HasDisintegrated = false;
AsyncOperationHandle<SceneInstance> val = Addressables.UnloadSceneAsync(DisintegrationLoop.Value, (UnloadSceneOptions)0, true);
val.CompletedTypeless += delegate(AsyncOperationHandle handle)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
DisintegrationLoop = null;
if ((int)((AsyncOperationHandle)(ref handle)).Status != 1)
{
Logger.LogError((object)"Failed to unload disintegration loop!");
}
else
{
successCallback2?.Invoke();
}
};
}
public static void ReloadDisintegrationLoop(Action? successCallback = null)
{
Action successCallback2 = successCallback;
if (!HasLoadedDisintegrationLoop)
{
LoadDisintegrationLoop(successCallback2);
return;
}
UnloadDisintegrationLoop(delegate
{
LoadDisintegrationLoop(successCallback2);
});
}
internal static void RunDelay(Action action, float delay)
{
//IL_0005: 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_0029: Expected O, but got Unknown
GameObject val = new GameObject("run-delay-instance");
((MonoBehaviour)val.AddComponent<stupidfuckingthingihatethisfunction>()).StartCoroutine(RunDelayCoroutine(action, delay));
Object.Destroy((Object)val, delay + 0.1f);
}
internal static void RunCoro(IEnumerator action, float delay)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
GameObject val = new GameObject("run-delay-instance");
((MonoBehaviour)val.AddComponent<stupidfuckingthingihatethisfunction>()).StartCoroutine(RunCoroutine(action, delay, val));
}
[IteratorStateMachine(typeof(<RunDelayCoroutine>d__99))]
private static IEnumerator RunDelayCoroutine(Action action, float delay)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RunDelayCoroutine>d__99(0)
{
action = action,
delay = delay
};
}
[IteratorStateMachine(typeof(<RunCoroutine>d__100))]
private static IEnumerator RunCoroutine(IEnumerator action, float delay, GameObject self)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RunCoroutine>d__100(0)
{
action = action,
delay = delay,
self = self
};
}
internal static void ForceDoorOpen(Door door)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)door == (Object)null))
{
if (!door.open)
{
door.Open(false, false);
}
door.requests = 9999;
door.locked = false;
if ((Object)(object)door.noPass != (Object)null)
{
door.noPass.SetActive(false);
}
if (door.gotPos)
{
((Component)door).transform.localPosition = door.openPosRelative;
door.inPos = true;
}
}
}
internal static void ResetDoor(Door door, bool closeDoor = true)
{
if (!((Object)(object)door == (Object)null))
{
door.requests = 0;
door.locked = false;
if ((Object)(object)door.noPass != (Object)null)
{
door.noPass.SetActive(false);
}
door.inPos = false;
if (closeDoor)
{
door.Close(true);
}
else
{
door.Open(false, false);
}
}
}
internal static GameObject? FindObjectInDisintegrationLoop(string path)
{
//IL_002c: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
if (!HasLoadedDisintegrationLoop)
{
Logger.LogWarning((object)"Tried to access disintegration loop scene but its not loaded!");
return null;
}
SceneInstance? disintegrationLoop = DisintegrationLoop;
object obj;
if (!disintegrationLoop.HasValue)
{
obj = null;
}
else
{
SceneInstance valueOrDefault = disintegrationLoop.GetValueOrDefault();
Scene scene = ((SceneInstance)(ref valueOrDefault)).Scene;
obj = ((Scene)(ref scene)).GetRootGameObjects();
}
GameObject[] array = (GameObject[])obj;
string[] array2 = path.Split('/');
if (array != null)
{
GameObject[] array3 = array;
foreach (GameObject val in array3)
{
if (((Object)val).name == array2[0])
{
GameObject val2 = FindRecursive(val, array2, 0);
if ((Object)(object)val2 != (Object)null)
{
return val2;
}
}
}
}
return null;
}
internal static GameObject? FindRecursive(GameObject current, string[] steps, int stepIndex)
{
if (stepIndex == steps.Length - 1)
{
return current;
}
string text = steps[stepIndex + 1];
for (int i = 0; i < current.transform.childCount; i++)
{
GameObject gameObject = ((Component)current.transform.GetChild(i)).gameObject;
if (((Object)gameObject).name == text)
{
GameObject val = FindRecursive(gameObject, steps, stepIndex + 1);
if ((Object)(object)val != (Object)null)
{
return val;
}
}
}
return null;
}
internal static string GetPath(GameObject obj)
{
if ((Object)(object)obj == (Object)null)
{
return "";
}
string text = ((Object)obj).name;
Transform val = obj.transform;
while ((Object)(object)val.parent != (Object)null)
{
val = val.parent;
text = ((Object)val).name + "/" + text;
}
return text;
}
internal static string GetPath(Component c)
{
if ((Object)(object)c == (Object)null)
{
return "";
}
return GetPath(c.gameObject) + "<" + ((object)c).GetType().Name + ">";
}
[Conditional("DEBUG")]
internal static void Log(object msg)
{
}
[Conditional("DEBUG")]
internal static void LogWarn(object msg)
{
}
[Conditional("DEBUG")]
internal static void DebugRay(Vector3 from, Vector3 dir, Color c, float dur, bool dummy = false)
{
}
}
[HarmonyPatch]
public static class NoCheatingPatches
{
internal static bool WasActive;
private static int _previousKills;
private static int _previousStyle;
private static bool _lastState;
[HarmonyPatch(typeof(LeaderboardController), "SubmitLevelScore")]
[HarmonyPrefix]
private static bool Prefix_SubmitLevelScore()
{
if (WasActive)
{
return false;
}
return true;
}
[HarmonyPatch(typeof(StatsManager), "Start")]
[HarmonyPostfix]
private static void Postfix_Start()
{
_previousKills = MonoSingleton<StatsManager>.Instance.kills;
_previousStyle = MonoSingleton<StatsManager>.Instance.stylePoints;
}
[HarmonyPatch(typeof(StatsManager), "Update")]
[HarmonyPrefix]
private static void Prefix_Update()
{
if (Plugin.IsInDisintegrationLoop)
{
MonoSingleton<StatsManager>.Instance.kills = _previousKills;
MonoSingleton<StatsManager>.Instance.stylePoints = _previousStyle;
MonoSingleton<StatsManager>.Instance.timer = !Plugin.StopTimerInLoop;
}
else
{
_previousKills = MonoSingleton<StatsManager>.Instance.kills;
_previousStyle = MonoSingleton<StatsManager>.Instance.stylePoints;
}
if (Plugin.IsInDisintegrationLoop != _lastState)
{
_lastState = Plugin.IsInDisintegrationLoop;
if (_lastState)
{
MonoSingleton<StatsManager>.Instance.timer = !Plugin.StopTimerInLoop;
}
else
{
MonoSingleton<StatsManager>.Instance.timer = true;
}
}
}
}
internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.triggeredidiot.allroadsleadtofraud";
public const string PLUGIN_NAME = "All Roads Lead To Disintegration Loop";
public const string PLUGIN_VERSION = "1.1.3";
}
}
namespace allroadsleadtofraud.Patches
{
[HarmonyPatch(typeof(Door), "Open", new Type[]
{
typeof(bool),
typeof(bool)
})]
internal static class ApplyDisintegrationLoopPatch
{
internal class DoorStateCopy : MonoBehaviour
{
internal DoorController _copy;
internal DoorController _target;
private void Update()
{
if ((Object)(object)_copy == (Object)null || (Object)(object)_target == (Object)null)
{
Object.Destroy((Object)(object)this);
}
else
{
_target.playerIn = _copy.playerIn;
}
}
}
internal class StupidScriptBecauseImLazy : MonoBehaviour
{
internal Door _check;
internal Action _run;
private void Update()
{
if (!_check.isFullyClosed)
{
_run?.Invoke();
Object.Destroy((Object)(object)this);
}
}
}
[HarmonyPatch(typeof(FinalPit), "OnTriggerEnter")]
private class FinalPitPatch_OnTriggerEnter
{
private static void Prefix(FinalPit __instance, Collider other)
{
//IL_0015: 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_0027: 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)
if (Plugin.DisintegrationLoop.HasValue)
{
Scene scene = ((Component)__instance).gameObject.scene;
SceneInstance value = Plugin.DisintegrationLoop.Value;
if (scene == ((SceneInstance)(ref value)).Scene)
{
return;
}
}
if (Random.Range(0f, 100f) > Plugin.ReplaceChance || !((Object)(object)((Component)other).gameObject == (Object)(object)__instance.player) || !Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance) || MonoSingleton<NewMovement>.Instance.hp <= 0 || !Plugin.ReplaceFinal || Plugin.IsInDisintegrationLoop || _finalPitPatchYay)
{
return;
}
FinalRoom componentInParent = ((Component)__instance).GetComponentInParent<FinalRoom>();
if ((Object)(object)componentInParent == (Object)null)
{
return;
}
FinalPit[] componentsInChildren = ((Component)componentInParent).GetComponentsInChildren<FinalPit>();
bool flag = false;
FinalPit[] array = componentsInChildren;
foreach (FinalPit val in array)
{
flag |= Object.op_Implicit((Object)(object)val) && val.fakeEnd;
}
if (!flag)
{
if (HasDisintegrated)
{
PatchFinalDoor(((Component)componentInParent).GetComponentInChildren<Door>());
}
else
{
PatchFinalDoor(((Component)componentInParent).GetComponentInChildren<Door>());
}
}
}
}
public struct DoorPortalPositionInfo
{
public bool forward;
public Vector3 doorLocalPositionEntrance;
public Vector3 doorLocalPositionExit;
public Quaternion doorLocalRotationEntrance;
public Quaternion doorLocalRotationExit;
public DoorController? enteredDoorController;
public DoorController? exitedDoorController;
public GameObject parent;
public GameObject exitParent;
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__19_0;
public static Action <>9__25_0;
public static Action <>9__25_1;
public static Action <>9__25_2;
public static UnityAction <>9__26_2;
public static Action <>9__26_0;
public static Action <>9__26_1;
public static Func<Action, bool> <>9__41_0;
public static Func<BigDoor, Transform> <>9__62_0;
public static UnityAction <>9__62_2;
public static UnityAction <>9__63_2;
public static Action <>9__63_4;
public static Action <>9__63_1;
public static Action <>9__63_0;
public static UnityAction <>9__64_0;
public static UnityAction <>9__64_6;
public static Action <>9__64_5;
internal void <MusicFadeToFraud>b__19_0()
{
MonoSingleton<DisintegrationLoopMusicManager>.Instance.off = false;
}
internal void <_cleanupPortals>b__25_0()
{
doorPortalExit.SetActive(false);
}
internal void <_cleanupPortals>b__25_1()
{
doorPortalExitPortal.SetActive(false);
}
internal void <_cleanupPortals>b__25_2()
{
doorPortalEnter.SetActive(false);
}
internal void <LeaveDisintegrationLoop>b__26_2()
{
_currentFirstFinalDoor.Open();
}
internal void <LeaveDisintegrationLoop>b__26_0()
{
DoorStateCopy doorStateCopy = default(DoorStateCopy);
if (doorPortalExit.TryGetComponent<DoorStateCopy>(ref doorStateCopy))
{
Object.Destroy((Object)(object)doorStateCopy);
}
portalExitDoorController.playerIn = true;
}
internal void <LeaveDisintegrationLoop>b__26_1()
{
DoorStateCopy doorStateCopy = default(DoorStateCopy);
if (doorPortalExit.TryGetComponent<DoorStateCopy>(ref doorStateCopy))
{
Object.Destroy((Object)(object)doorStateCopy);
}
portalExitDoorController.playerIn = true;
}
internal bool <Postfix>b__41_0(Action s)
{
return (Delegate?)s != (Delegate?)_portalDoorFix;
}
internal Transform <PatchNormalDoor>b__62_0(BigDoor door)
{
return ((Component)door).transform;
}
internal void <PatchNormalDoor>b__62_2()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
portalEnter.passThroughNonTraversals = true;
portalEnter.entryTravelFlags = (PortalTravellerFlags)0;
portalEnter.exitTravelFlags = (PortalTravellerFlags)0;
}
internal void <OnEnterDisintegrationLoop_Specific>b__63_2()
{
firstRoomFirstFinalDoor.SetActive(true);
((Component)portalEnter).gameObject.SetActive(false);
}
internal void <OnEnterDisintegrationLoop_Specific>b__63_4()
{
_currentFirstFinalDoor.Open();
}
internal void <OnEnterDisintegrationLoop_Specific>b__63_1()
{
enteredDoorController.playerIn = true;
}
internal void <OnEnterDisintegrationLoop_Specific>b__63_0()
{
if (DisableEnemySpawns.DisableArenaTriggers)
{
return;
}
Door[] doors = Plugin.FindObjectInDisintegrationLoop("Pre-Space/Rooms/1 - Escher Entrance/1 Stuff/Trigger/Activator").GetComponent<ActivateArena>().doors;
foreach (Door val in doors)
{
if (Object.op_Implicit((Object)(object)val))
{
val.Lock();
}
}
}
internal void <OnEnterExitDisintegrationLoop_Specific>b__64_0()
{
}
internal void <OnEnterExitDisintegrationLoop_Specific>b__64_6()
{
_currentFirstFinalDoor.Open();
}
internal void <OnEnterExitDisintegrationLoop_Specific>b__64_5()
{
DoorStateCopy doorStateCopy = default(DoorStateCopy);
if (doorPortalExit.TryGetComponent<DoorStateCopy>(ref doorStateCopy))
{
Object.Destroy((Object)(object)doorStateCopy);
}
portalExitDoorController.playerIn = true;
}
}
[CompilerGenerated]
private sealed class <MusicFadeToFraud>d__19 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <MusicFadeToFraud>d__19(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
GameObject val = Plugin.FindObjectInDisintegrationLoop("Musics");
GameObject val2 = Plugin.FindObjectInDisintegrationLoop("IntroMusicIntro");
if (Plugin.DisableFraudMusic)
{
if (Object.op_Implicit((Object)(object)val))
{
Object.Destroy((Object)(object)val);
}
if (Object.op_Implicit((Object)(object)val2))
{
Object.Destroy((Object)(object)val2);
}
return false;
}
bool flag = !Object.op_Implicit((Object)(object)MonoSingleton<DisintegrationLoopMusicManager>.Instance);
if (Object.op_Implicit((Object)(object)MonoSingleton<DisintegrationLoopMusicManager>.Instance))
{
Plugin.Logger.LogWarning((object)"Possible music corruption detected?");
Object.Destroy((Object)(object)((Component)MonoSingleton<DisintegrationLoopMusicManager>.Instance).gameObject);
flag = true;
}
if (flag)
{
DisintegrationLoopMusicManager disintegrationLoopMusicManager = new GameObject("DisintegrationLoopMusicManager").AddComponent<DisintegrationLoopMusicManager>();
disintegrationLoopMusicManager.battleTheme.clip = Plugin.DisintegrationLoopMusicB;
disintegrationLoopMusicManager.bossTheme.clip = Plugin.DisintegrationLoopMusicB;
disintegrationLoopMusicManager.cleanTheme.clip = Plugin.DisintegrationLoopMusicC;
}
MonoSingleton<DisintegrationLoopMusicManager>.Instance.off = true;
if (Object.op_Implicit((Object)(object)val))
{
UnityEvent onActivate = val.GetComponentInChildren<ObjectActivator>(true).events.onActivate;
object obj = <>c.<>9__19_0;
if (obj == null)
{
UnityAction val3 = delegate
{
MonoSingleton<DisintegrationLoopMusicManager>.Instance.off = false;
};
<>c.<>9__19_0 = val3;
obj = (object)val3;
}
onActivate.AddListener((UnityAction)obj);
}
AudioMixerControllerPatch.MusicVolumeOverride = MonoSingleton<AudioMixerController>.Instance.optionsMusicVolume;
break;
}
case 1:
<>1__state = -1;
break;
}
if (AudioMixerControllerPatch.MusicVolumeOverride > 0f)
{
AudioMixerControllerPatch.MusicVolumeOverride -= Time.deltaTime / 2f;
<>2__current = null;
<>1__state = 1;
return true;
}
MonoSingleton<AudioMixerController>.Instance.SetMusicVolume(MonoSingleton<AudioMixerController>.Instance.musicVolume);
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 <MusicFadeToNormal>d__21 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
private float <goal>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <MusicFadeToNormal>d__21(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
}
else
{
<>1__state = -1;
if (Plugin.DisableFraudMusic && !Object.op_Implicit((Object)(object)MonoSingleton<DisintegrationLoopMusicManager>.Instance))
{
return false;
}
if (_isFading)
{
return false;
}
_isFading = true;
if (Object.op_Implicit((Object)(object)MonoSingleton<DisintegrationLoopMusicManager>.Instance))
{
MonoSingleton<DisintegrationLoopMusicManager>.Instance.off = true;
Object.Destroy((Object)(object)((Component)MonoSingleton<DisintegrationLoopMusicManager>.Instance).gameObject, 2.5f);
}
if (!Object.op_Implicit((Object)(object)MonoSingleton<AudioMixerController>.Instance) || !(AudioMixerControllerPatch.MusicVolumeOverride > -1f))
{
goto IL_00e5;
}
<goal>5__2 = MonoSingleton<AudioMixerController>.Instance.optionsMusicVolume;
}
if (AudioMixerControllerPatch.MusicVolumeOverride < <goal>5__2)
{
AudioMixerControllerPatch.MusicVolumeOverride += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
AudioMixerControllerPatch.MusicVolumeOverride = -1f;
MonoSingleton<AudioMixerController>.Instance.SetMusicVolume(MonoSingleton<AudioMixerController>.Instance.musicVolume);
goto IL_00e5;
IL_00e5:
_isFading = false;
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();
}
}
private static bool _isOk;
internal static AudioClip? _lastCalm;
internal static AudioClip? _lastBattle;
internal static AudioClip? _lastBoss;
private static List<Tuple<AudioSource, float>> altMusicObjects = new List<Tuple<AudioSource, float>>();
private static bool _isFading = false;
internal static bool HasPatchedFirstRoom = false;
internal static HashSet<Door> _alreadyOpenedDoors = new HashSet<Door>();
private static bool _finalPitPatchYay = false;
private static Action _portalDoorFix = null;
internal static bool dontFuckingSwapDoorsGodIHateProgrammingThisFuckassMod = false;
private static Door? _previousDoor = null;
private static DoorStyle _previousDoorStyle = DoorStyle.Unknown;
private static int _previousDoorId = 0;
private static GameObject? _previousPortalEntrance = null;
private static GameObject? _previousPortalExit = null;
private static FinalDoor _currentFinalDoor = null;
private static FinalDoor _currentFirstFinalDoor = null;
private static UnityEventPortalTravel oldPortalEntryTravel;
private static UnityEventPortalTravel oldPortalExitTravel;
private static GameObject firstRoomFirstFinalDoor;
private static GameObject firstRoomFinalDoorLeft;
internal static Portal portalEnter;
internal static Portal portalExit;
private static GameObject doorPortalEnter;
private static GameObject doorPortalExit;
private static GameObject doorPortalExitPortal;
private static DoorController portalEnterDoorController;
private static DoorController portalExitDoorController;
private static DoorController enteredDoorController;
internal static bool InteruptedLevelNamePopup = false;
public static bool HasDisintegrated { get; internal set; }
public static float LastDisintegrationTime { get; internal set; }
public static bool WasPlayingMusic { get; internal set; }
[IteratorStateMachine(typeof(<MusicFadeToFraud>d__19))]
private static IEnumerator MusicFadeToFraud()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <MusicFadeToFraud>d__19(0);
}
[IteratorStateMachine(typeof(<MusicFadeToNormal>d__21))]
private static IEnumerator MusicFadeToNormal()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <MusicFadeToNormal>d__21(0);
}
private static void OnEnterDisintegrationLoop(IPortalTraveller t, PortalTravelDetails _)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)t.travellerType == 1)
{
Plugin.IsInDisintegrationLoop = true;
dontFuckingSwapDoorsGodIHateProgrammingThisFuckassMod = true;
}
}
private static void OnExitDisintegrationLoop(IPortalTraveller t, PortalTravelDetails _)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
if ((int)t.travellerType == 1)
{
Plugin.IsInDisintegrationLoop = false;
RenderSettings.ambientLight = Plugin.LevelFogData.AmbientLight;
}
}
private static void OnExitDisintegrationLoopFinal(IPortalTraveller t, PortalTravelDetails _)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)t.travellerType == 1)
{
LeaveDisintegrationLoop();
}
}
private static void _cleanupPortals()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: 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)
if ((Object)(object)doorPortalExit != (Object)null)
{
doorPortalExit.transform.position = Vector3.one * 8192f;
doorPortalExit.transform.SetParent((Transform)null, true);
SceneManager.MoveGameObjectToScene(doorPortalExit, SceneManager.GetActiveScene());
Plugin.RunDelay(delegate
{
doorPortalExit.SetActive(false);
}, Time.deltaTime * 2f);
}
if ((Object)(object)doorPortalExitPortal != (Object)null)
{
doorPortalExitPortal.transform.position = Vector3.one * 8192f;
doorPortalExitPortal.transform.SetParent((Transform)null, true);
SceneManager.MoveGameObjectToScene(doorPortalExitPortal, SceneManager.GetActiveScene());
Plugin.RunDelay(delegate
{
doorPortalExitPortal.SetActive(false);
}, Time.deltaTime * 2f);
}
if ((Object)(object)doorPortalEnter != (Object)null)
{
doorPortalEnter.transform.position = Vector3.one * 8192f;
doorPortalEnter.transform.SetParent((Transform)null, true);
SceneManager.MoveGameObjectToScene(doorPortalEnter, SceneManager.GetActiveScene());
Plugin.RunDelay(delegate
{
doorPortalEnter.SetActive(false);
}, Time.deltaTime * 2f);
}
}
internal static void LeaveDisintegrationLoop(bool cleanupPortals = false, bool allowReload = true, bool didntTravelThroughPortal = false)
{
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.DisplayFakeLevelTitle && InteruptedLevelNamePopup)
{
LevelNamePopupPatch.DisplayDefault();
InteruptedLevelNamePopup = false;
}
if (Object.op_Implicit((Object)(object)MonoSingleton<HeatResistance>.Instance) && ((Behaviour)MonoSingleton<HeatResistance>.Instance).enabled)
{
MonoSingleton<HeatResistance>.Instance.SetRechargeMode(0f);
}
if (didntTravelThroughPortal)
{
switch (_previousDoorStyle)
{
case DoorStyle.FirstRoom:
{
if (!((Object)(object)_currentFirstFinalDoor != (Object)null))
{
break;
}
_currentFirstFinalDoor.Close();
object obj = <>c.<>9__26_2;
if (obj == null)
{
UnityAction val = delegate
{
_currentFirstFinalDoor.Open();
};
<>c.<>9__26_2 = val;
obj = (object)val;
}
UnityAction a1 = (UnityAction)obj;
_previousDoor.onFullyClosed.AddListener(a1);
_previousDoor.onFullyClosed.AddListener((UnityAction)delegate
{
_previousDoor.onFullyClosed.RemoveListener(a1);
});
break;
}
default:
Plugin.ResetDoor(_previousDoor);
break;
case DoorStyle.Violence:
Plugin.RunDelay(delegate
{
DoorStateCopy doorStateCopy = default(DoorStateCopy);
if (doorPortalExit.TryGetComponent<DoorStateCopy>(ref doorStateCopy))
{
Object.Destroy((Object)(object)doorStateCopy);
}
portalExitDoorController.playerIn = true;
}, 0.125f);
break;
case DoorStyle.Limbo:
case DoorStyle.Wrath:
case DoorStyle.Heresy:
Plugin.RunDelay(delegate
{
DoorStateCopy doorStateCopy2 = default(DoorStateCopy);
if (doorPortalExit.TryGetComponent<DoorStateCopy>(ref doorStateCopy2))
{
Object.Destroy((Object)(object)doorStateCopy2);
}
portalExitDoorController.playerIn = true;
}, 0.125f);
break;
}
Plugin._levelFogData.Apply();
}
if (cleanupPortals)
{
_cleanupPortals();
}
_finalPitPatchYay = false;
dontFuckingSwapDoorsGodIHateProgrammingThisFuckassMod = false;
HasDisintegrated = false;
_previousDoor = null;
Plugin.IsInDisintegrationLoop = false;
MusicManager instance = MonoSingleton<MusicManager>.Instance;
if (instance != null)
{
((MonoBehaviour)instance).StartCoroutine(MusicFadeToNormal());
}
LastDisintegrationTime = Time.timeSinceLevelLoad;
GameObject val2 = Plugin.FindObjectInDisintegrationLoop("Pre-Space/Rooms/1 - Escher Entrance/1 Nonstuff/CeilingSegment/ThatFuckassMirrorThatIHate");
if ((Object)(object)val2 != (Object)null)
{
val2.transform.position = Vector3.one * 8192f;
val2.transform.SetParent((Transform)null, true);
SceneManager.MoveGameObjectToScene(val2, SceneManager.GetActiveScene());
val2.SetActive(false);
}
Action result;
while (Plugin.RunAfterDisintegrationLoop.TryDequeue(out result))
{
try
{
result();
}
catch (Exception arg)
{
Plugin.Logger.LogError((object)$"Exception occured while executing RunAfterDisintegrationLoop:\n{arg}");
}
}
if (allowReload)
{
Plugin.ReloadDisintegrationLoop();
}
}
public static Tuple<DoorStyle, int> GetDoorStyle(Door door)
{
LevelDatabaseChecker.LevelDoorData levelDoorData = LevelDatabaseChecker.CheckDoor(((Component)door).gameObject);
if (levelDoorData != null)
{
return new Tuple<DoorStyle, int>(levelDoorData.style, levelDoorData.subDoorId);
}
string text = ((Object)((Component)door).gameObject).name.ToLower();
if (text.Contains("door") && (text.Contains("with controllers") || text.Contains("(large)")))
{
return new Tuple<DoorStyle, int>(DoorStyle.Prelude, 0);
}
if ((text.Contains("largedoor") || (text.Contains("limbo large door") && !text.Contains("smallest"))) && !text.Contains("largedoorsmaller"))
{
return new Tuple<DoorStyle, int>(DoorStyle.Limbo, 0);
}
if (text.Contains("doorlust"))
{
return new Tuple<DoorStyle, int>(DoorStyle.Lust, 0);
}
if (text.Contains("doormouth"))
{
return new Tuple<DoorStyle, int>(DoorStyle.Gluttony, 0);
}
if (text.Contains("doorgreed"))
{
return new Tuple<DoorStyle, int>(DoorStyle.Greed, 0);
}
if (text.Contains("ferrydoor"))
{
return new Tuple<DoorStyle, int>(DoorStyle.Wrath, 0);
}
if (text.Contains("gothicdoor"))
{
return new Tuple<DoorStyle, int>(DoorStyle.Heresy, 0);
}
if (text.Contains("violencehalldoor"))
{
return new Tuple<DoorStyle, int>(DoorStyle.Violence, 1);
}
if (text.Contains("doorfraud"))
{
return new Tuple<DoorStyle, int>(DoorStyle.Fraud, 0);
}
return new Tuple<DoorStyle, int>(DoorStyle.Unknown, 0);
}
public static Portal? FindDoorPortal(Door door)
{
Portal[] componentsInChildren = ((Component)door).GetComponentsInChildren<Portal>();
foreach (Portal val in componentsInChildren)
{
if (!(((Object)((Component)val).gameObject).name == "Entrance") || !Object.op_Implicit((Object)(object)((Component)val).transform.parent) || !((Object)((Component)val).transform.parent).name.StartsWith("DoorPortal") || (!((Object)((Component)val).transform.parent).name.EndsWith("Entrance") && !((Object)((Component)val).transform.parent).name.EndsWith("Exit")))
{
return val;
}
}
return null;
}
private static void Prefix(Door __instance)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
if (__instance.open)
{
_alreadyOpenedDoors.Add(__instance);
}
else
{
if (GetDoorStyle(__instance).Item1 != DoorStyle.Fraud)
{
return;
}
BigDoor[] bdoors = __instance.bdoors;
for (int i = 0; i < bdoors.Length; i++)
{
Quaternion localRotation = ((Component)bdoors[i]).transform.localRotation;
float num = ((Quaternion)(ref localRotation)).eulerAngles.y % 90f;
if (!(Mathf.Abs(num) < 1.5f) && !(Mathf.Abs(num - 90f) < 1.5f))
{
_alreadyOpenedDoors.Add(__instance);
}
}
}
}
private static void Postfix(Door __instance, bool enemy, bool skull)
{
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_03a7: 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_03e0: Unknown result type (might be due to invalid IL or missing references)
//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
if (_alreadyOpenedDoors.Contains(__instance))
{
_alreadyOpenedDoors.Remove(__instance);
}
else
{
if (enemy || !__instance.open || __instance.locked || !Plugin.HasLoadedDisintegrationLoop || Plugin.SkullDoors.Contains(__instance))
{
return;
}
if (HasDisintegrated)
{
Tuple<DoorStyle, int> doorStyle = GetDoorStyle(__instance);
if (dontFuckingSwapDoorsGodIHateProgrammingThisFuckassMod || Plugin.IsInDisintegrationLoop || !((Object)(object)_previousPortalEntrance != (Object)null) || !((Object)(object)_previousDoor != (Object)null) || doorStyle.Item1 == DoorStyle.Unknown || doorStyle.Item1 != _previousDoorStyle || (!_previousDoor.isFullyClosed && !((Object)(object)_previousDoor == (Object)(object)__instance) && _previousDoorStyle != DoorStyle.Violence) || !Plugin.DisintegrationLoop.HasValue)
{
return;
}
Scene scene = ((Component)__instance).gameObject.scene;
SceneInstance value = Plugin.DisintegrationLoop.Value;
if (!(scene != ((SceneInstance)(ref value)).Scene))
{
return;
}
DoorPortalPositionInfo portalPositionInfo = _previousDoorStyle.GetPortalPositionInfo(__instance, _previousDoorId);
bool forward = portalPositionInfo.forward;
Vector3 doorLocalPositionEntrance = portalPositionInfo.doorLocalPositionEntrance;
Vector3 doorLocalPositionExit = portalPositionInfo.doorLocalPositionExit;
Quaternion doorLocalRotationEntrance = portalPositionInfo.doorLocalRotationEntrance;
Quaternion doorLocalRotationExit = portalPositionInfo.doorLocalRotationExit;
if (_previousDoorStyle == DoorStyle.Fraud)
{
Portal instancePortal = FindDoorPortal(__instance);
if ((Object)(object)instancePortal != (Object)null && !Plugin.ReplacePortalDoors)
{
return;
}
string styleName = _previousDoorStyle.GetStyleName();
int item = doorStyle.Item2;
string text = ((item > 0) ? $"{item}/" : string.Empty);
GameObject val = FindObjectOrFail("Pre-Space/EntranceDoors/" + styleName + "/" + text + "DoorEnter");
if ((Object)(object)val == (Object)null)
{
return;
}
GameObject val2 = FindObjectOrFail("Pre-Space/EntranceDoors/" + styleName + "/" + text + "DoorExit");
if ((Object)(object)val2 == (Object)null)
{
return;
}
Door componentInChildren = val.GetComponentInChildren<Door>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
((Component)componentInChildren).transform.localScale = new Vector3(1f, 1f, 1f);
if (forward)
{
((Component)componentInChildren).transform.localScale = new Vector3(-1f, 1f, 1f);
}
}
componentInChildren = val2.GetComponentInChildren<Door>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
((Component)componentInChildren).transform.localScale = new Vector3(-1f, 1f, 1f);
if (forward)
{
((Component)componentInChildren).transform.localScale = new Vector3(1f, 1f, 1f);
}
}
if ((Object)(object)instancePortal != (Object)null)
{
((Behaviour)instancePortal).enabled = false;
Plugin.RunAfterDisintegrationLoop = new Queue<Action>(Plugin.RunAfterDisintegrationLoop.Where((Action s) => (Delegate?)s != (Delegate?)_portalDoorFix));
_portalDoorFix = delegate
{
if (Object.op_Implicit((Object)(object)instancePortal))
{
((Behaviour)instancePortal).enabled = true;
}
};
Plugin.RunAfterDisintegrationLoop.Enqueue(_portalDoorFix);
}
}
enteredDoorController = portalPositionInfo.enteredDoorController ?? enteredDoorController;
GameObject parent = portalPositionInfo.parent;
GameObject exitParent = portalPositionInfo.exitParent;
_previousDoorStyle.GetPortalPositionInfo(_previousDoor, _previousDoorId);
_previousPortalEntrance.transform.SetParent(parent.transform, false);
_previousPortalEntrance.transform.localPosition = doorLocalPositionEntrance;
_previousPortalEntrance.transform.localRotation = doorLocalRotationEntrance;
_previousPortalExit.transform.SetParent(exitParent.transform, false);
_previousPortalExit.transform.localPosition = doorLocalPositionExit;
_previousPortalExit.transform.localRotation = doorLocalRotationExit;
DoorStateCopy doorStateCopy = default(DoorStateCopy);
if (_previousPortalEntrance.TryGetComponent<DoorStateCopy>(ref doorStateCopy))
{
if ((Object)(object)enteredDoorController != (Object)null)
{
doorStateCopy._copy = enteredDoorController;
}
else
{
Object.Destroy((Object)(object)doorStateCopy);
}
}
_previousDoor = __instance;
_previousDoorStyle = doorStyle.Item1;
_previousDoorId = doorStyle.Item2;
}
else
{
if (Time.timeSinceLevelLoad - LastDisintegrationTime < 0.5f || Random.Range(0f, 100f) > Plugin.ReplaceChance)
{
return;
}
if ((Plugin.ReplaceFinal || Plugin.ReplaceFirst) && (Object)(object)((Component)__instance).GetComponentInParent<FinalDoor>() != (Object)null)
{
FinalRoom componentInParent = ((Component)__instance).GetComponentInParent<FinalRoom>();
if ((Object)(object)componentInParent == (Object)null)
{
FirstRoomPrefab componentInParent2 = ((Component)__instance).GetComponentInParent<FirstRoomPrefab>();
if (Plugin.ReplaceFirst && (Object)(object)componentInParent2 != (Object)null && !HasPatchedFirstRoom && Plugin.IsReplacingStyle(DoorStyle.FirstRoom))
{
HasPatchedFirstRoom = true;
PatchNormalDoor(__instance, DoorStyle.FirstRoom);
}
}
else if ((Object)(object)((Component)componentInParent).transform.parent != (Object)null)
{
_ = ((Object)((Component)componentInParent).transform.parent).name == "FinalRoomExit !! disloop";
}
}
else
{
Tuple<DoorStyle, int> doorStyle2 = GetDoorStyle(__instance);
if (Plugin.IsReplacingStyle(doorStyle2.Item1))
{
PatchNormalDoor(__instance, doorStyle2.Item1, doorStyle2.Item2);
}
}
}
}
}
private static GameObject? FindObjectOrFail(string path)
{
GameObject val = Plugin.FindObjectInDisintegrationLoop(path);
if ((Object)(object)val == (Object)null)
{
Plugin.Logger.LogError((object)(path + " is null"));
return null;
}
return val;
}
private static bool enableSceneObjects()
{
GameObject val = FindObjectOrFail("Pre-Space");
if ((Object)(object)val == (Object)null)
{
return false;
}
val.SetActive(true);
GameObject val2 = FindObjectOrFail("Navigation");
if ((Object)(object)val2 == (Object)null)
{
return false;
}
val2.SetActive(true);
return true;
}
private static void PatchFinalDoor(Door __instance)
{
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Expected O, but got Unknown
if ((Object)(object)_currentFinalDoor != (Object)null || !Plugin.IsReplacing())
{
return;
}
_currentFinalDoor = ((Component)__instance).GetComponentInParent<FinalDoor>();
_previousDoor = null;
Vector3 localPosition = default(Vector3);
((Vector3)(ref localPosition))..ctor(0.0716f, -39.95f, 46.9981f);
if (!enableSceneObjects())
{
return;
}
GameObject val = FindObjectOrFail("Pre-Space/EntranceDoors");
if ((Object)(object)val == (Object)null)
{
return;
}
for (int i = 0; i < val.transform.childCount; i++)
{
((Component)val.transform.GetChild(i)).gameObject.SetActive(false);
}
string text = "FinalRoom Pit Only";
GameObject val2 = FindObjectOrFail("Pre-Space/EntranceDoors/" + text);
if ((Object)(object)val2 == (Object)null)
{
return;
}
val2.SetActive(true);
GameObject val3 = FindObjectOrFail("Pre-Space/EntranceDoors/" + text + "/FakeFinalPitEnter");
if ((Object)(object)val3 == (Object)null)
{
return;
}
doorPortalEnter = val3;
GameObject val4 = FindObjectOrFail("Pre-Space/EntranceDoors/" + text + "/FinalRoomExit !! disloop");
if ((Object)(object)val4 == (Object)null)
{
return;
}
GameObject val5 = FindObjectOrFail("Pre-Space/EntranceDoors/" + text + "/FinalRoomExit !! disloop/FinalRoom");
if ((Object)(object)val5 == (Object)null)
{
return;
}
NoCheatingPatches.WasActive = true;
doorPortalEnter.transform.SetParent((Transform)null, false);
SceneManager.MoveGameObjectToScene(doorPortalEnter.gameObject, ((Component)__instance).gameObject.scene);
doorPortalEnter.transform.SetParent(((Component)__instance).transform.parent.parent, false);
doorPortalEnter.transform.localPosition = localPosition;
doorPortalEnter.transform.localRotation = Quaternion.Euler(0f, 0f, -90f);
((Component)__instance).transform.parent.parent.Find("Pit");
Portal componentInChildren = doorPortalEnter.GetComponentInChildren<Portal>();
((Component)componentInChildren).gameObject.SetActive(false);
Plugin.DisintegrationLoopFogData.ApplyEnter(componentInChildren);
Plugin.LevelFogData.ApplyExit(componentInChildren);
FinalRoom componentInParent = ((Component)__instance).GetComponentInParent<FinalRoom>();
string text2 = "";
if ((Object)(object)componentInParent != (Object)null)
{
string text3 = ((Object)((Component)componentInParent).gameObject).name.ToLower();
if (text3.Contains("prime"))
{
text2 = "Prime";
}
else if (text3.Contains("encore"))
{
text2 = "Encore";
}
else if (text3.Contains("secret"))
{
text2 = "Secret";
}
}
GameObject val6 = Plugin.FindObjectInDisintegrationLoop("Pre-Space/EntranceDoors/" + text + "/FinalRoomExit !! disloop/FinalRoom" + text2);
if ((Object)(object)val6 == (Object)null)
{
val6 = val5;
}
val6.SetActive(true);
FinalPit[] componentsInChildren = ((Component)componentInParent).GetComponentsInChildren<FinalPit>();
string targetLevelName = "";
FinalPit[] array = componentsInChildren;
foreach (FinalPit val7 in array)
{
if (!((Object)(object)val7 == (Object)null))
{
val7.fakeEnd = true;
if (!string.IsNullOrWhiteSpace(val7.targetLevelName))
{
targetLevelName = val7.targetLevelName;
}
bool activeSelf = ((Component)val7).gameObject.activeSelf;
((Component)val7).gameObject.SetActive(false);
ObjectActivator obj = ((Component)val7).gameObject.AddComponent<ObjectActivator>();
UltrakillEvent val8 = new UltrakillEvent();
val8.toActivateObjects = (GameObject[])(object)new GameObject[1] { ((Component)componentInChildren).gameObject };
obj.events = val8;
((Component)val7).gameObject.SetActive(activeSelf);
}
}
array = val4.GetComponentsInChildren<FinalPit>(true);
for (int j = 0; j < array.Length; j++)
{
array[j].targetLevelName = targetLevelName;
}
HasDisintegrated = true;
Plugin.IsInDisintegrationLoop = true;
dontFuckingSwapDoorsGodIHateProgrammingThisFuckassMod = true;
Plugin.UpdateFogState();
MusicManager instance = MonoSingleton<MusicManager>.Instance;
_lastCalm = ((instance != null) ? instance.cleanTheme.clip : null);
MusicManager instance2 = MonoSingleton<MusicManager>.Instance;
_lastBattle = ((instance2 != null) ? instance2.battleTheme.clip : null);
MusicManager instance3 = MonoSingleton<MusicManager>.Instance;
_lastBoss = ((instance3 != null) ? instance3.bossTheme.clip : null);
MusicManager instance4 = MonoSingleton<MusicManager>.Instance;
if (instance4 != null)
{
((MonoBehaviour)instance4).StartCoroutine(MusicFadeToFraud());
}
if (Plugin.DisplayFakeLevelTitle)
{
LevelNamePopupPatch.DisplayName("FRAUD /// THIRD", "DISINTEGRATION LOOP");
}
}
public static DoorPortalPositionInfo GetPortalPositionInfo(this DoorStyle doorStyle, Door door, int subDoorId = 0)
{
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: 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_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_04bb: 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_04ca: Unknown result type (might be due to invalid IL or missing references)
//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
//IL_04de: Unknown result type (might be due to invalid IL or missing references)
//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_0333: Unknown result type (might be due to invalid IL or missing references)
//IL_0338: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0442: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_0458: Unknown result type (might be due to invalid IL or missing references)
//IL_0462: Unknown result type (might be due to invalid IL or missing references)
//IL_0467: Unknown result type (might be due to invalid IL or missing references)
//IL_0405: Unknown result type (might be due to invalid IL or missing references)
//IL_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0429: Unknown result type (might be due to invalid IL or missing references)
//IL_0505: Unknown result type (might be due to invalid IL or missing references)
//IL_050a: 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_0519: Unknown result type (might be due to invalid IL or missing references)
//IL_051e: Unknown result type (might be due to invalid IL or missing references)
//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
//IL_05df: Unknown result type (might be due to invalid IL or missing references)
//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
//IL_058c: Unknown result type (might be due to invalid IL or missing references)
//IL_0597: Unknown result type (might be due to invalid IL or missing references)
//IL_059c: Unknown result type (might be due to invalid IL or missing references)
//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
//IL_06e6: Unknown result type (might be due to invalid IL or missing references)
//IL_06f0: Unknown result type (might be due to invalid IL or missing references)
//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0706: Unknown result type (might be due to invalid IL or missing references)
//IL_070b: Unknown result type (might be due to invalid IL or missing references)
//IL_069d: 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_06ad: Unknown result type (might be due to invalid IL or missing references)
//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
//IL_06b6: Unknown result type (might be due to invalid IL or missing references)
//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
//IL_07cb: Unknown result type (might be due to invalid IL or missing references)
//IL_07d5: Unknown result type (might be due to invalid IL or missing references)
//IL_07da: Unknown result type (might be due to invalid IL or missing references)
//IL_07e4: Unknown result type (might be due to invalid IL or missing references)
//IL_07e9: Unknown result type (might be due to invalid IL or missing references)
//IL_07ee: Unknown result type (might be due to invalid IL or missing references)
//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0804: Unknown result type (might be due to invalid IL or missing references)
//IL_080e: Unknown result type (might be due to invalid IL or missing references)
//IL_0813: Unknown result type (might be due to invalid IL or missing references)
//IL_0818: 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_0786: Unknown result type (might be due to invalid IL or missing references)
//IL_078b: Unknown result type (might be due to invalid IL or missing references)
//IL_0790: Unknown result type (might be due to invalid IL or missing references)
//IL_0794: Unknown result type (might be due to invalid IL or missing references)
//IL_079f: Unknown result type (might be due to invalid IL or missing references)
//IL_0888: Unknown result type (might be due to invalid IL or missing references)
//IL_0893: Unknown result type (might be due to invalid IL or missing references)
//IL_0898: Unknown result type (might be due to invalid IL or missing references)
//IL_089d: Unknown result type (might be due to invalid IL or missing references)
//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_097a: Unknown result type (might be due to invalid IL or missing references)
//IL_097f: Unknown result type (might be due to invalid IL or missing references)
//IL_0995: Unknown result type (might be due to invalid IL or missing references)
//IL_099a: Unknown result type (might be due to invalid IL or missing references)
//IL_0905: Unknown result type (might be due to invalid IL or missing references)
//IL_090a: Unknown result type (might be due to invalid IL or missing references)
//IL_0912: Unknown result type (might be due to invalid IL or missing references)
//IL_0925: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_0368: Unknown result type (might be due to invalid IL or missing references)
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//IL_0377: Unknown result type (might be due to invalid IL or missing references)
//IL_0381: Unknown result type (might be due to invalid IL or missing references)
//IL_038b: Unknown result type (might be due to invalid IL or missing references)
//IL_0390: Unknown result type (might be due to invalid IL or missing references)
//IL_0395: Unknown result type (might be due to invalid IL or missing references)
//IL_0486: Unknown result type (might be due to invalid IL or missing references)
//IL_048b: 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_0541: Unknown result type (might be due to invalid IL or missing references)
//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0603: Unknown result type (might be due to invalid IL or missing references)
//IL_060a: Unknown result type (might be due to invalid IL or missing references)
//IL_0614: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Unknown result type (might be due to invalid IL or missing references)
//IL_0623: Unknown result type (might be due to invalid IL or missing references)
//IL_0628: Unknown result type (might be due to invalid IL or missing references)
//IL_062d: Unknown result type (might be due to invalid IL or missing references)
//IL_072a: Unknown result type (might be due to invalid IL or missing references)
//IL_072f: Unknown result type (might be due to invalid IL or missing references)
//IL_0837: Unknown result type (might be due to invalid IL or missing references)
//IL_083c: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_09b9: Unknown result type (might be due to invalid IL or missing references)
//IL_09be: 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_03b9: Unknown result type (might be due to invalid IL or missing references)
//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
//IL_04af: Unknown result type (might be due to invalid IL or missing references)
//IL_055f: 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_064c: Unknown result type (might be due to invalid IL or missing references)
//IL_0651: Unknown result type (might be due to invalid IL or missing references)
//IL_074b: Unknown result type (might be due to invalid IL or missing references)
//IL_0750: Unknown result type (might be due to invalid IL or missing references)
//IL_0858: Unknown result type (might be due to invalid IL or missing references)
//IL_085d: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_09dd: Unknown result type (might be due to invalid IL or missing references)
//IL_09e2: Unknown result type (might be due to invalid IL or missing references)
//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0670: 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)
DoorPortalPositionInfo result = default(DoorPortalPositionInfo);
result.exitParent = null;
GameObject val = ((Component)door).gameObject;
DoorController[] componentsInChildren = ((Component)door).GetComponentsInChildren<DoorController>(!((Component)door).gameObject.activeInHierarchy);
if ((Object)(object)((Component)door).transform.parent != (Object)null && doorStyle != DoorStyle.Wrath)
{
val = ((Component)((Component)door).transform.parent).gameObject;
componentsInChildren = val.GetComponentsInChildren<DoorController>(!val.activeInHierarchy);
}
DoorController val2 = ((componentsInChildren.Length != 0) ? componentsInChildren[0] : null);
DoorController exitedDoorController = ((componentsInChildren.Length != 0) ? componentsInChildren.Last() : null);
DoorController[] array = componentsInChildren;
foreach (DoorController val3 in array)
{
if (!((Object)(object)val3 == (Object)null))
{
if (val3.playerIn)
{
val2 = val3;
}
else
{
exitedDoorController = val3;
}
}
}
float num = 1f;
Vector3 val4;
if ((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null)
{
val4 = ((Component)MonoSingleton<NewMovement>.Instance).transform.position - ((Component)door).transform.position;
num = Vector3.Dot(((Vector3)(ref val4)).normalized, ((Component)door).transform.right);
}
bool flag