Decompiled source of Exit Door Manager v1.1.0

ExitDoorManager/ExitDoorManager.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using GameConsole;
using GameConsole.Commands;
using HarmonyLib;
using PluginConfig.API;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("ExitDoorManager")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Allows you to edit where exit doors lead.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("ExitDoorManager")]
[assembly: AssemblyTitle("ExitDoorManager")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
namespace ExitDoorManager
{
	public static class ConfigManager
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Predicate<ConfigField> <>9__58_0;

			public static OnClick <>9__59_0;

			public static OnClick <>9__59_1;

			public static Predicate<string> <>9__59_2;

			internal bool <GetExits>b__58_0(ConfigField field)
			{
				return field.guid.StartsWith("exit");
			}

			internal void <Initialize>b__59_0()
			{
				StringListField[] exits = GetExits();
				foreach (StringListField val in exits)
				{
					val.value = val.defaultValue;
				}
			}

			internal void <Initialize>b__59_1()
			{
				Randomizer.RandomizeExits();
			}

			internal bool <Initialize>b__59_2(string l)
			{
				return !l.StartsWith("Random");
			}
		}

		public static string[] Levels = new string[49]
		{
			"Random Scene", "Random Level", "Level 0-1", "Level 0-2", "Level 0-3", "Level 0-4", "Level 0-5", "Level 0-S", "Level 1-1", "Level 1-2",
			"Level 1-3", "Level 1-4", "Level 1-S", "Level 2-1", "Level 2-2", "Level 2-3", "Level 2-4", "Level 2-S", "Level 3-1", "Level 3-2",
			"Intermission1", "Level P-1", "Level 4-1", "Level 4-2", "Level 4-3", "Level 4-4", "Level 4-S", "Level 5-1", "Level 5-2", "Level 5-3",
			"Level 5-4", "Level 5-S", "Level 6-1", "Level 6-2", "Intermission2", "Level P-2", "Level 7-1", "Level 7-2", "Level 7-3", "Level 7-4",
			"Level 7-S", "Level 0-E", "Level 1-E", "Main Menu", "The Cyber Grind", "Sandbox", "Credits Museum", "EarlyAccessEnd", "Close Game"
		};

		public static StringListField exit01;

		public static StringListField exit02;

		public static StringListField exit02s;

		public static StringListField exit03;

		public static StringListField exit04;

		public static StringListField exit05;

		public static StringListField exit0S;

		public static StringListField exit11;

		public static StringListField exit11s;

		public static StringListField exit12;

		public static StringListField exit13;

		public static StringListField exit14;

		public static StringListField exit1S;

		public static StringListField exit21;

		public static StringListField exit22;

		public static StringListField exit23;

		public static StringListField exit23s;

		public static StringListField exit24;

		public static StringListField exit2S;

		public static StringListField exit31;

		public static StringListField exit31s;

		public static StringListField exit32;

		public static StringListField exitI1;

		public static StringListField exitP1;

		public static StringListField exit41;

		public static StringListField exit42;

		public static StringListField exit42s;

		public static StringListField exit43;

		public static StringListField exit44;

		public static StringListField exit4S;

		public static StringListField exit51;

		public static StringListField exit51s;

		public static StringListField exit52;

		public static StringListField exit53;

		public static StringListField exit54;

		public static StringListField exit5S;

		public static StringListField exit61;

		public static StringListField exit62;

		public static StringListField exit62s;

		public static StringListField exitI2;

		public static StringListField exitP2;

		public static StringListField exit71;

		public static StringListField exit72;

		public static StringListField exit73;

		public static StringListField exit73s;

		public static StringListField exit74;

		public static StringListField exit7s;

		public static StringListField exit0e;

		public static StringListField exit1e;

		public static PluginConfigurator config;

		public static ButtonField randomizeButton;

		public static ButtonField resetButton;

		public static ConfigPanel randoSettings;

		public static BoolField allowSecretLevels;

		public static BoolField allowEncoreLevels;

		public static BoolField allowPrimeSanctums;

		public static StringListField finalScene;

		public static StringListField[] GetExits()
		{
			ConfigField[] array = Array.FindAll(config.rootPanel.GetAllFields(), (ConfigField field) => field.guid.StartsWith("exit"));
			StringListField[] array2 = (StringListField[])(object)new StringListField[array.Length];
			for (int i = 0; i < array.Length; i++)
			{
				ref StringListField reference = ref array2[i];
				ConfigField obj = array[i];
				reference = (StringListField)(object)((obj is StringListField) ? obj : null);
			}
			return array2;
		}

		public static void Initialize()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Expected O, but got Unknown
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Expected O, but got Unknown
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Expected O, but got Unknown
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Expected O, but got Unknown
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Expected O, but got Unknown
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Expected O, but got Unknown
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Expected O, but got Unknown
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Expected O, but got Unknown
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Expected O, but got Unknown
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Expected O, but got Unknown
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Expected O, but got Unknown
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Expected O, but got Unknown
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Expected O, but got Unknown
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Expected O, but got Unknown
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Expected O, but got Unknown
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: Expected O, but got Unknown
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Expected O, but got Unknown
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Expected O, but got Unknown
			//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04eb: Expected O, but got Unknown
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Expected O, but got Unknown
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_053b: Expected O, but got Unknown
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_0563: Expected O, but got Unknown
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Expected O, but got Unknown
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Expected O, but got Unknown
			//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Expected O, but got Unknown
			//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Expected O, but got Unknown
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_062b: Expected O, but got Unknown
			//IL_0649: Unknown result type (might be due to invalid IL or missing references)
			//IL_0653: Expected O, but got Unknown
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Expected O, but got Unknown
			//IL_0699: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a3: Expected O, but got Unknown
			//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cb: Expected O, but got Unknown
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Expected O, but got Unknown
			//IL_0711: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Expected O, but got Unknown
			//IL_0739: Unknown result type (might be due to invalid IL or missing references)
			//IL_0743: Expected O, but got Unknown
			//IL_0761: Unknown result type (might be due to invalid IL or missing references)
			//IL_076b: Expected O, but got Unknown
			//IL_0789: Unknown result type (might be due to invalid IL or missing references)
			//IL_0793: Expected O, but got Unknown
			//IL_07b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bb: Expected O, but got Unknown
			//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e3: Expected O, but got Unknown
			//IL_0801: Unknown result type (might be due to invalid IL or missing references)
			//IL_080b: Expected O, but got Unknown
			//IL_0829: Unknown result type (might be due to invalid IL or missing references)
			//IL_0833: Expected O, but got Unknown
			//IL_0851: Unknown result type (might be due to invalid IL or missing references)
			//IL_085b: Expected O, but got Unknown
			//IL_0879: Unknown result type (might be due to invalid IL or missing references)
			//IL_0883: Expected O, but got Unknown
			//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ab: Expected O, but got Unknown
			//IL_08c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d3: Expected O, but got Unknown
			//IL_08f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fb: Expected O, but got Unknown
			//IL_0919: Unknown result type (might be due to invalid IL or missing references)
			//IL_0923: Expected O, but got Unknown
			config = PluginConfigurator.Create("Exit Door Manager", "com.earthlingOnFire.ExitDoorManager");
			string location = Assembly.GetExecutingAssembly().Location;
			string directoryName = Path.GetDirectoryName(location);
			config.SetIconWithURL(Path.Combine(directoryName, "icon.png"));
			resetButton = new ButtonField(config.rootPanel, "Reset All", "resetButton");
			ButtonField obj = resetButton;
			object obj2 = <>c.<>9__59_0;
			if (obj2 == null)
			{
				OnClick val = delegate
				{
					StringListField[] exits = GetExits();
					foreach (StringListField val3 in exits)
					{
						val3.value = val3.defaultValue;
					}
				};
				<>c.<>9__59_0 = val;
				obj2 = (object)val;
			}
			obj.onClick += (OnClick)obj2;
			randoSettings = new ConfigPanel(config.rootPanel, "Randomizer", "randoSettings");
			randomizeButton = new ButtonField(randoSettings, "Randomize", "randomizeButton");
			ButtonField obj3 = randomizeButton;
			object obj4 = <>c.<>9__59_1;
			if (obj4 == null)
			{
				OnClick val2 = delegate
				{
					Randomizer.RandomizeExits();
				};
				<>c.<>9__59_1 = val2;
				obj4 = (object)val2;
			}
			obj3.onClick += (OnClick)obj4;
			allowSecretLevels = new BoolField(randoSettings, "Allow Secret Levels", "randoAllowSecret", false);
			allowEncoreLevels = new BoolField(randoSettings, "Allow Encore Levels", "randoAllowEncore", false);
			allowPrimeSanctums = new BoolField(randoSettings, "Allow Prime Sanctums", "randoAllowPrime", false);
			finalScene = new StringListField(randoSettings, "Final Scene", "randoFinalScene", Array.FindAll(Levels, (string l) => !l.StartsWith("Random")), "EarlyAccessEnd");
			exit01 = new StringListField(config.rootPanel, "0-1 Exit", "exit01", Levels, "Level 0-2");
			exit02 = new StringListField(config.rootPanel, "0-2 Exit", "exit02", Levels, "Level 0-3");
			exit02s = new StringListField(config.rootPanel, "0-2 Secret Exit", "exit02s", Levels, "Level 0-S");
			exit03 = new StringListField(config.rootPanel, "0-3 Exit", "exit03", Levels, "Level 0-4");
			exit04 = new StringListField(config.rootPanel, "0-4 Exit", "exit04", Levels, "Level 0-5");
			exit05 = new StringListField(config.rootPanel, "0-5 Exit", "exit05", Levels, "Level 1-1");
			exit0S = new StringListField(config.rootPanel, "0-S Exit", "exit0S", Levels, "Level 0-3");
			exit11 = new StringListField(config.rootPanel, "1-1 Exit", "exit11", Levels, "Level 1-2");
			exit11s = new StringListField(config.rootPanel, "1-1 Secret Exit", "exit11s", Levels, "Level 1-S");
			exit12 = new StringListField(config.rootPanel, "1-2 Exit", "exit12", Levels, "Level 1-3");
			exit13 = new StringListField(config.rootPanel, "1-3 Exit", "exit13", Levels, "Level 1-4");
			exit14 = new StringListField(config.rootPanel, "1-4 Exit", "exit14", Levels, "Level 2-1");
			exit1S = new StringListField(config.rootPanel, "1-S Exit", "exit1S", Levels, "Level 1-1");
			exit21 = new StringListField(config.rootPanel, "2-1 Exit", "exit21", Levels, "Level 2-2");
			exit22 = new StringListField(config.rootPanel, "2-2 Exit", "exit22", Levels, "Level 2-3");
			exit23 = new StringListField(config.rootPanel, "2-3 Exit", "exit23", Levels, "Level 2-4");
			exit23s = new StringListField(config.rootPanel, "2-3 Secret Exit", "exit23s", Levels, "Level 2-S");
			exit24 = new StringListField(config.rootPanel, "2-4 Exit", "exit24", Levels, "Level 3-1");
			exit2S = new StringListField(config.rootPanel, "2-S Exit", "exit2S", Levels, "Level 2-4");
			exit31 = new StringListField(config.rootPanel, "3-1 Exit", "exit31", Levels, "Level 3-2");
			exit31s = new StringListField(config.rootPanel, "3-1 Secret Exit", "exit31s", Levels, "Level P-1");
			exit32 = new StringListField(config.rootPanel, "3-2 Exit", "exit32", Levels, "Intermission1");
			exitI1 = new StringListField(config.rootPanel, "Intermission 1 Exit", "exitI1", Levels, "Level 4-1");
			exitP1 = new StringListField(config.rootPanel, "P-1 Exit", "exitP1", Levels, "Level 3-2");
			exit41 = new StringListField(config.rootPanel, "4-1 Exit", "exit41", Levels, "Level 4-2");
			exit42 = new StringListField(config.rootPanel, "4-2 Exit", "exit42", Levels, "Level 4-3");
			exit42s = new StringListField(config.rootPanel, "4-2 Secret Exit", "exit42s", Levels, "Level 4-S");
			exit43 = new StringListField(config.rootPanel, "4-3 Exit", "exit43", Levels, "Level 4-4");
			exit44 = new StringListField(config.rootPanel, "4-4 Exit", "exit44", Levels, "Level 5-1");
			exit4S = new StringListField(config.rootPanel, "4-S Exit", "exit4S", Levels, "Level 4-3");
			exit51 = new StringListField(config.rootPanel, "5-1 Exit", "exit51", Levels, "Level 5-2");
			exit51s = new StringListField(config.rootPanel, "5-1 Secret Exit", "exit51s", Levels, "Level 5-S");
			exit52 = new StringListField(config.rootPanel, "5-2 Exit", "exit52", Levels, "Level 5-3");
			exit53 = new StringListField(config.rootPanel, "5-3 Exit", "exit53", Levels, "Level 5-4");
			exit54 = new StringListField(config.rootPanel, "5-4 Exit", "exit54", Levels, "Level 6-1");
			exit5S = new StringListField(config.rootPanel, "5-S Exit", "exit5S", Levels, "Level 5-2");
			exit61 = new StringListField(config.rootPanel, "6-1 Exit", "exit61", Levels, "Level 6-2");
			exit62 = new StringListField(config.rootPanel, "6-2 Exit", "exit", Levels, "Intermission2");
			exit62s = new StringListField(config.rootPanel, "6-2 Secret Exit", "exit62s", Levels, "Level P-2");
			exitI2 = new StringListField(config.rootPanel, "Intermission 2 Exit", "exitI2", Levels, "Level 7-1");
			exitP2 = new StringListField(config.rootPanel, "P-2 Exit", "exitP2", Levels, "Level 6-2");
			exit71 = new StringListField(config.rootPanel, "7-1 Exit", "exit71", Levels, "Level 7-2");
			exit72 = new StringListField(config.rootPanel, "7-2 Exit", "exit72", Levels, "Level 7-3");
			exit73 = new StringListField(config.rootPanel, "7-3 Exit", "exit73", Levels, "Level 7-4");
			exit73s = new StringListField(config.rootPanel, "7-3 Secret Exit", "exit73s", Levels, "Level 7-S");
			exit74 = new StringListField(config.rootPanel, "7-4 Exit", "exit74", Levels, "EarlyAccessEnd");
			exit7s = new StringListField(config.rootPanel, "7-S Exit", "exit7s", Levels, "Level 7-4");
			exit0e = new StringListField(config.rootPanel, "0-E Exit", "exit0e", Levels, "Level 1-E");
			exit1e = new StringListField(config.rootPanel, "1-E Exit", "exit1e", Levels, "Main Menu");
		}
	}
	[HarmonyPatch]
	public static class Patches
	{
		private class Exit
		{
			public string from { get; }

			public string to { get; }

			public Exit(string fromLevel, string toLevel)
			{
				from = fromLevel;
				to = toLevel;
			}
		}

		private static Random rand = new Random();

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SceneHelper), "LoadScene")]
		private static bool SceneHelper_LoadScene_Prefix(string sceneName, bool noBlocker)
		{
			Exit exit = new Exit(SceneHelper.CurrentScene, sceneName);
			string text = GetNextScene(exit);
			if (text == null || text == sceneName)
			{
				return true;
			}
			if (SceneHelper.CurrentScene == "Level 1-E" && (Object)(object)GameObject.Find("Canvas/PauseMenu") != (Object)null)
			{
				return true;
			}
			switch (text)
			{
			case "Random Scene":
			{
				string[] array2 = Array.FindAll(ConfigManager.Levels, (string lvl) => !lvl.StartsWith("Random") && !lvl.StartsWith("Close"));
				int num2 = rand.Next(0, array2.Length);
				text = array2[num2];
				break;
			}
			case "Random Level":
			{
				string[] array = Array.FindAll(ConfigManager.Levels, (string lvl) => lvl.StartsWith("Level"));
				int num = rand.Next(0, array.Length);
				text = array[num];
				break;
			}
			case "The Cyber Grind":
				text = "Endless";
				break;
			case "Sandbox":
				text = "uk_construct";
				break;
			case "Credits Museum":
				text = "CreditsMuseum2";
				break;
			case "Close Game":
				Application.Quit();
				return false;
			}
			((MonoBehaviour)MonoSingleton<SceneHelper>.Instance).StartCoroutine(MonoSingleton<SceneHelper>.Instance.LoadSceneAsync(text, noBlocker));
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Scene), "Execute")]
		private static bool Scene_Execute_Prefix(Console con, string[] args)
		{
			if (con.CheatBlocker() || args.Length == 0)
			{
				return true;
			}
			string text = string.Join(" ", args);
			if (!Debug.isDebugBuild && MonoSingleton<SceneHelper>.Instance.IsSceneSpecial(text))
			{
				return true;
			}
			((MonoBehaviour)MonoSingleton<SceneHelper>.Instance).StartCoroutine(MonoSingleton<SceneHelper>.Instance.LoadSceneAsync(text, false));
			return false;
		}

		private static string GetNextScene(Exit exit)
		{
			if (1 == 0)
			{
			}
			string result;
			string to;
			if (exit != null)
			{
				switch (exit.from)
				{
				case "Level 0-1":
					break;
				case "Level 0-2":
					goto IL_0657;
				case "Level 0-3":
					goto IL_0683;
				case "Level 0-4":
					goto IL_069f;
				case "Level 0-5":
					goto IL_06bb;
				case "Level 0-S":
					goto IL_06d7;
				case "Level 1-1":
					goto IL_06f3;
				case "Level 1-2":
					goto IL_071f;
				case "Level 1-3":
					goto IL_073b;
				case "Level 1-4":
					goto IL_0757;
				case "Level 1-S":
					goto IL_0773;
				case "Level 2-1":
					goto IL_078f;
				case "Level 2-2":
					goto IL_07ab;
				case "Level 2-3":
					goto IL_07c7;
				case "Level 2-4":
					goto IL_07f3;
				case "Level 2-S":
					goto IL_080f;
				case "Level 3-1":
					goto IL_082b;
				case "Level 3-2":
					goto IL_0857;
				case "Intermission1":
					goto IL_0873;
				case "Level P-1":
					goto IL_088f;
				case "Level 4-1":
					goto IL_08ab;
				case "Level 4-2":
					goto IL_08c7;
				case "Level 4-3":
					goto IL_08f3;
				case "Level 4-4":
					goto IL_090f;
				case "Level 4-S":
					goto IL_092b;
				case "Level 5-1":
					goto IL_0947;
				case "Level 5-2":
					goto IL_0973;
				case "Level 5-3":
					goto IL_098f;
				case "Level 5-4":
					goto IL_09ab;
				case "Level 5-S":
					goto IL_09c7;
				case "Level 6-1":
					goto IL_09e3;
				case "Level 6-2":
					goto IL_09ff;
				case "Intermission2":
					goto IL_0a2b;
				case "Level P-2":
					goto IL_0a47;
				case "Level 7-1":
					goto IL_0a63;
				case "Level 7-2":
					goto IL_0a7f;
				case "Level 7-3":
					goto IL_0a9b;
				case "Level 7-4":
					goto IL_0ac7;
				case "Level 7-S":
					goto IL_0ae3;
				case "Level 0-E":
					goto IL_0aff;
				case "Level 1-E":
					goto IL_0b1b;
				default:
					goto IL_0e29;
				}
				to = exit.to;
				if (to == "Level 0-2")
				{
					result = ConfigManager.exit01.value;
					goto IL_0e2d;
				}
			}
			goto IL_0e29;
			IL_090f:
			to = exit.to;
			if (!(to == "Level 5-1"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit44.value;
			goto IL_0e2d;
			IL_0657:
			to = exit.to;
			if (!(to == "Level 0-3"))
			{
				if (!(to == "Level 0-S"))
				{
					goto IL_0e29;
				}
				result = ConfigManager.exit02s.value;
			}
			else
			{
				result = ConfigManager.exit02.value;
			}
			goto IL_0e2d;
			IL_0b1b:
			to = exit.to;
			if (!(to == "Main Menu"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit1e.value;
			goto IL_0e2d;
			IL_08c7:
			to = exit.to;
			if (!(to == "Level 4-3"))
			{
				if (!(to == "Level 4-S"))
				{
					goto IL_0e29;
				}
				result = ConfigManager.exit42s.value;
			}
			else
			{
				result = ConfigManager.exit42.value;
			}
			goto IL_0e2d;
			IL_0aff:
			to = exit.to;
			if (!(to == "Level 1-E"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit0e.value;
			goto IL_0e2d;
			IL_06d7:
			to = exit.to;
			if (!(to == "Level 0-3"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit0S.value;
			goto IL_0e2d;
			IL_0ae3:
			to = exit.to;
			if (!(to == "Level 7-4"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit7s.value;
			goto IL_0e2d;
			IL_07ab:
			to = exit.to;
			if (!(to == "Level 2-3"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit22.value;
			goto IL_0e2d;
			IL_0ac7:
			to = exit.to;
			if (!(to == "EarlyAccessEnd"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit74.value;
			goto IL_0e2d;
			IL_078f:
			to = exit.to;
			if (!(to == "Level 2-2"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit21.value;
			goto IL_0e2d;
			IL_0a9b:
			to = exit.to;
			if (!(to == "Level 7-4"))
			{
				if (!(to == "Level 7-S"))
				{
					goto IL_0e29;
				}
				result = ConfigManager.exit73s.value;
			}
			else
			{
				result = ConfigManager.exit73.value;
			}
			goto IL_0e2d;
			IL_08ab:
			to = exit.to;
			if (!(to == "Level 4-2"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit41.value;
			goto IL_0e2d;
			IL_088f:
			to = exit.to;
			if (!(to == "Level 3-2"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exitP1.value;
			goto IL_0e2d;
			IL_0773:
			to = exit.to;
			if (!(to == "Level 1-1"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit1S.value;
			goto IL_0e2d;
			IL_0a7f:
			to = exit.to;
			if (!(to == "Level 7-3"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit72.value;
			goto IL_0e2d;
			IL_06bb:
			to = exit.to;
			if (!(to == "Level 1-1"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit05.value;
			goto IL_0e2d;
			IL_0a63:
			to = exit.to;
			if (!(to == "Level 7-2"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit71.value;
			goto IL_0e2d;
			IL_0873:
			to = exit.to;
			if (!(to == "Level 4-1"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exitI1.value;
			goto IL_0e2d;
			IL_0a47:
			to = exit.to;
			if (!(to == "Level 6-2"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exitP2.value;
			goto IL_0e2d;
			IL_0757:
			to = exit.to;
			if (!(to == "Level 2-1"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit14.value;
			goto IL_0e2d;
			IL_0a2b:
			to = exit.to;
			if (!(to == "Level 7-1"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exitI2.value;
			goto IL_0e2d;
			IL_0857:
			to = exit.to;
			if (!(to == "Intermission1"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit32.value;
			goto IL_0e2d;
			IL_09ff:
			to = exit.to;
			if (!(to == "Intermission2"))
			{
				if (!(to == "Level P-2"))
				{
					goto IL_0e29;
				}
				result = ConfigManager.exit62s.value;
			}
			else
			{
				result = ConfigManager.exit62.value;
			}
			goto IL_0e2d;
			IL_0e2d:
			if (1 == 0)
			{
			}
			return result;
			IL_073b:
			to = exit.to;
			if (!(to == "Level 1-4"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit13.value;
			goto IL_0e2d;
			IL_082b:
			to = exit.to;
			if (!(to == "Level 3-2"))
			{
				if (!(to == "Level P-1"))
				{
					goto IL_0e29;
				}
				result = ConfigManager.exit31s.value;
			}
			else
			{
				result = ConfigManager.exit31.value;
			}
			goto IL_0e2d;
			IL_09e3:
			to = exit.to;
			if (!(to == "Level 6-2"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit61.value;
			goto IL_0e2d;
			IL_071f:
			to = exit.to;
			if (!(to == "Level 1-3"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit12.value;
			goto IL_0e2d;
			IL_09c7:
			to = exit.to;
			if (!(to == "Level 5-2"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit5S.value;
			goto IL_0e2d;
			IL_069f:
			to = exit.to;
			if (!(to == "Level 0-5"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit04.value;
			goto IL_0e2d;
			IL_09ab:
			to = exit.to;
			if (!(to == "Level 6-1"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit54.value;
			goto IL_0e2d;
			IL_080f:
			to = exit.to;
			if (!(to == "Level 2-4"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit2S.value;
			goto IL_0e2d;
			IL_098f:
			to = exit.to;
			if (!(to == "Level 5-4"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit53.value;
			goto IL_0e2d;
			IL_0e29:
			result = null;
			goto IL_0e2d;
			IL_0973:
			to = exit.to;
			if (!(to == "Level 5-3"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit52.value;
			goto IL_0e2d;
			IL_07f3:
			to = exit.to;
			if (!(to == "Level 3-1"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit24.value;
			goto IL_0e2d;
			IL_0947:
			to = exit.to;
			if (!(to == "Level 5-2"))
			{
				if (!(to == "Level 5-S"))
				{
					goto IL_0e29;
				}
				result = ConfigManager.exit51s.value;
			}
			else
			{
				result = ConfigManager.exit51.value;
			}
			goto IL_0e2d;
			IL_06f3:
			to = exit.to;
			if (!(to == "Level 1-2"))
			{
				if (!(to == "Level 1-S"))
				{
					goto IL_0e29;
				}
				result = ConfigManager.exit11s.value;
			}
			else
			{
				result = ConfigManager.exit11.value;
			}
			goto IL_0e2d;
			IL_0683:
			to = exit.to;
			if (!(to == "Level 0-4"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit03.value;
			goto IL_0e2d;
			IL_07c7:
			to = exit.to;
			if (!(to == "Level 2-4"))
			{
				if (!(to == "Level 2-S"))
				{
					goto IL_0e29;
				}
				result = ConfigManager.exit23s.value;
			}
			else
			{
				result = ConfigManager.exit23.value;
			}
			goto IL_0e2d;
			IL_092b:
			to = exit.to;
			if (!(to == "Level 4-3"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit4S.value;
			goto IL_0e2d;
			IL_08f3:
			to = exit.to;
			if (!(to == "Level 4-4"))
			{
				goto IL_0e29;
			}
			result = ConfigManager.exit43.value;
			goto IL_0e2d;
		}
	}
	[BepInPlugin("com.earthlingOnFire.ExitDoorManager", "Exit Door Manager", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "com.earthlingOnFire.ExitDoorManager";

		public const string PLUGIN_NAME = "Exit Door Manager";

		public const string PLUGIN_VERSION = "1.1.0";

		private void Start()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			new Harmony("com.earthlingOnFire.ExitDoorManager").PatchAll();
		}

		private void Awake()
		{
			ConfigManager.Initialize();
		}
	}
	public static class Randomizer
	{
		private static T[] Shuffle<T>(T[] array)
		{
			Random random = new Random();
			for (int i = 0; i < array.Length - 1; i++)
			{
				int num = random.Next(0, array.Length);
				if (num != i)
				{
					T val = array[i];
					array[i] = array[num];
					array[num] = val;
				}
			}
			return array;
		}

		private static string[] GetShuffledLevels()
		{
			string[] levels = ConfigManager.Levels;
			string endingLevel = ConfigManager.finalScene.value;
			bool enableSecret = ConfigManager.allowSecretLevels.value;
			bool enablePrime = ConfigManager.allowPrimeSanctums.value;
			bool enableEncore = ConfigManager.allowEncoreLevels.value;
			Random random = new Random();
			return Shuffle(Array.FindAll(levels, (string l) => l.StartsWith("Level") && !l.Equals("Level 0-1") && !l.Equals(endingLevel) && (enableSecret || !l.EndsWith("S")) && (enablePrime || !l.StartsWith("Level P-")) && (enableEncore || !l.EndsWith("E"))));
		}

		private static StringListField GetLevelExit(string level)
		{
			string levelNumber = level.Substring(6);
			StringListField[] exits = ConfigManager.GetExits();
			return Array.Find(exits, (StringListField e) => ((ConfigField)e).displayName.Contains(levelNumber) && !((ConfigField)e).displayName.Contains("Secret"));
		}

		private static StringListField GetLevelSecretExit(string level)
		{
			string levelNumber = level.Substring(6);
			StringListField[] exits = ConfigManager.GetExits();
			return Array.Find(exits, (StringListField e) => ((ConfigField)e).displayName.Contains(levelNumber) && ((ConfigField)e).displayName.Contains("Secret"));
		}

		public static void RandomizeExits()
		{
			string[] shuffledLevels = GetShuffledLevels();
			string value = ConfigManager.finalScene.value;
			int i = 0;
			string level = "Level 0-1";
			for (; i < shuffledLevels.Length; i++)
			{
				string text = shuffledLevels[i];
				GetLevelExit(level).value = text;
				if (GetLevelSecretExit(level) != null)
				{
					GetLevelSecretExit(level).value = text;
				}
				level = text;
			}
			GetLevelExit(level).value = value;
			if (value.StartsWith("Level"))
			{
				GetLevelExit(value).value = "Main Menu";
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ExitDoorManager";

		public const string PLUGIN_NAME = "ExitDoorManager";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}