Decompiled source of Railroad v1.2.0

plugin/Railroad.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Missions.BrotherEncounter;
using EntityStates.Missions.Goldshores;
using EntityStates.Missions.LunarScavengerEncounter;
using EntityStates.ShrineRebirth;
using IL.EntityStates.FalseSonBoss;
using IL.EntityStates.Interactables.MSObelisk;
using IL.EntityStates.ShrineRebirth;
using IL.EntityStates.SolusHeart.Death;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Missions.BrotherEncounter;
using On.EntityStates.Missions.Goldshores;
using On.EntityStates.Missions.LunarScavengerEncounter;
using On.EntityStates.ShrineRebirth;
using On.RoR2;
using R2API.Utils;
using Railroad.Changes;
using RoR2;
using RoR2.ExpansionManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Railroad")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Railroad")]
[assembly: AssemblyTitle("Railroad")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Railroad
{
	public enum ConfigRunType
	{
		Invalid = -1,
		Always,
		NoEclipse
	}
	public enum ConfigPortalType
	{
		NoPortal = -1,
		Shop,
		MS,
		Null,
		Void,
		DeepVoid,
		VoidOutro,
		Goldshores,
		Colossus,
		Destination,
		HardwareProg,
		HardwareProg_Haunt,
		SolusShop,
		SolusBackout,
		SolusWeb
	}
	public enum ConfigGoldPortal
	{
		Never,
		Vanilla,
		Meridian
	}
	public static class Configs
	{
		public static ConfigFile LoopConfig;

		public static ConfigFile StageConfig;

		private const string Section_Stage_VoidRaid = "Planetarium";

		private const string Section_Stage_Moon2 = "Commencement";

		private const string Section_Stage_Meridian = "Prime Meridian";

		private const string Section_Stage_Goldshores = "Gilded Coast";

		private const string Section_Stage_MS = "A Moment, Fractured";

		private const string Section_Stage_Limbo = "A Moment, Whole";

		private const string Section_Stage_SolusWeb = "Solus Web";

		private const string Section_Stage_Arena = "Void Fields";

		private const string Section_Loop_Definition = "!Loop Definition";

		private const string Section_Loop_Effects = "Loop Effects";

		private const string Section_Loop_Teleporter = "Teleporter";

		private const string Section_Enable = "!Enable Changes";

		private const string Label_Enable = "!Enable Changes";

		private const string Desc_Enable = "Allows this section to function.";

		private const string Desc_Enable_Config = "Allows all changes within this config to happen.";

		private const string Label_Eclipse = "Allow On Eclipse";

		private const string Desc_Eclipse = "Allow changes made in this section even during Eclipse.";

		private const string Label_WinPortal = "Completion Portals";

		private const string Label_WinReward = "Completion Reward";

		private static string PortalListHelp;

		public static string ConfigFolderPath => Path.Combine(Paths.ConfigPath, MainPlugin.pluginInfo.Metadata.GUID);

		public static void Setup()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			LoopConfig = new ConfigFile(Path.Combine(ConfigFolderPath, "Railroad_Looping.cfg"), true);
			StageConfig = new ConfigFile(Path.Combine(ConfigFolderPath, "Railroad_Stages.cfg"), true);
			Read_StageConfig();
			Read_LoopConfig();
		}

		private static void Read_LoopConfig()
		{
			Looping.Enable = LoopConfig.Bind<bool>("!Enable Changes", "!Enable Changes", false, "Allows all changes within this config to happen. Note that everything here affects this mod and has no actual effect on what the game considers as a loop.").Value;
			Looping.Loop_DejaVu = LoopConfig.Bind<bool>("!Loop Definition", "Deja Vu Requirement", false, "Counts as looping once you've cleared the minimum amount of stages and are on a stage 1. (The same requirements for the Deja Vu achievement.)").Value;
			Looping.Loop_ArtifactRaw = LoopConfig.Bind<string>("Loop Effects", "Loop Artifacts", "EliteOnly, WeakAssKnees", "Enables the specified Artifact by their internal name upon looping.").Value;
			Looping.Loop_LoopTeleporter = LoopConfig.Bind<bool>("Teleporter", "Loop Primordial Teleporter", false, "Replaces the regular Teleporter with the Primordial Teleporter while considered looping.").Value;
			Looping.Loop_OrderTeleporter = LoopConfig.Bind<int>("Teleporter", "Primordial Stage Order", 0, "Prevents the Primordial Teleporter from spawning if the Stage's order number is less than this. ('Loop Primordial Teleporter' has priority over this) (Set to 0 for vanilla behavior)").Value;
		}

		private static void Read_StageConfig()
		{
			PortalListHelp = StageConfig.Bind<string>("!Example", "Portal List", "NoPortal, Shop, MS, Null, Void, DeepVoid, VoidOutro, GoldShores, Colossus, Destination, HardwareProg, HardwareProg_Haunt, SolusShop, SolusBackout, SolusWeb", "List of all Portal types this mod uses, check its Thunderstore Page for more details.").Value;
			Stages.Enable = StageConfig.Bind<bool>("!Enable Changes", "!Enable Changes", false, "Allows all changes within this config to happen.").Value;
			Stages.Moon2_Eclipse = StageConfig.Bind<bool>("Commencement", "Allow On Eclipse", false, "Allow changes made in this section even during Eclipse.").Value;
			Stages.Moon2_Portal_Input = StageConfig.Bind<string>("Commencement", "Completion Portals", "", "Portals to spawn upon defeating Mithrix.").Value;
			Stages.Moon2_Reward = StageConfig.Bind<bool>("Commencement", "Completion Reward", false, "Drop Legendary items upon defeating Mithrix.").Value;
			Stages.Meridian_Eclipse = StageConfig.Bind<bool>("Prime Meridian", "Allow On Eclipse", false, "Allow changes made in this section even during Eclipse.").Value;
			Stages.Meridian_Portal_Input = StageConfig.Bind<string>("Prime Meridian", "Completion Portals", "Destination", "Portals to spawn upon defeating False Son.").Value;
			Stages.Meridian_Reward = StageConfig.Bind<bool>("Prime Meridian", "Completion Reward", true, "Drop Aurelionite Blessings upon defeating False Son.").Value;
			Stages.Meridian_AllowRebirth = StageConfig.Bind<bool>("Prime Meridian", "Allow Rebirth", true, "Allows the Rebirth Shrine to spawn.").Value;
			Stages.Meridian_ACPortal = StageConfig.Bind<bool>("Prime Meridian", "Virtual Portal", true, "Allows the extra Virtual Portal to spawn.").Value;
			Stages.VoidRaid_Eclipse = StageConfig.Bind<bool>("Planetarium", "Allow On Eclipse", false, "Allow changes made in this section even during Eclipse.").Value;
			Stages.VoidRaid_Portal_Input = StageConfig.Bind<string>("Planetarium", "Completion Portals", "", "Portal to spawn upon defeating Voidling.").Value;
			Stages.VoidRaid_Reward = StageConfig.Bind<bool>("Planetarium", "Completion Reward", false, "Drop Void Potentials that contain Legendary items upon defeating Voidling.").Value;
			Stages.VoidRaid_VoidOutroPortal = StageConfig.Bind<bool>("Planetarium", "Void Outro Portal", true, "Allows the Void Outro Portal to spawn upon defeating Voidling.").Value;
			Stages.VoidRaid_TimeFlows = StageConfig.Bind<bool>("Planetarium", "Time Flow", true, "Allows time to flow normally in the Planetarium.").Value;
			Stages.GoldShores_MeridianPortal = StageConfig.Bind<ConfigGoldPortal>("Gilded Coast", "Colossus Portal", ConfigGoldPortal.Vanilla, "Controls how the Colossus Portal spawns on Gilded Coast. (Meridian = Always spawns and takes you to Prime Meridian)").Value;
			Stages.MS_NeedBeads = StageConfig.Bind<bool>("A Moment, Fractured", "Beads Required", true, "Beads of Fealty are required to go to A Moment, Whole.").Value;
			Stages.Limbo_Eclipse = StageConfig.Bind<bool>("A Moment, Whole", "Allow On Eclipse", false, "Allow changes made in this section even during Eclipse.").Value;
			Stages.Limbo_Portal_Input = StageConfig.Bind<string>("A Moment, Whole", "Completion Portals", "", "Portals to spawn upon defeating the Twisted Scavenger.").Value;
			Stages.Limbo_Reward = StageConfig.Bind<bool>("A Moment, Whole", "Completion Reward", false, "Drop Legendary items upon defeating the Twisted Scavenger.").Value;
			Stages.SolusWeb_Eclipse = StageConfig.Bind<bool>("Solus Web", "Allow On Eclipse", false, "Allow changes made in this section even during Eclipse.").Value;
			Stages.SolusWeb_Portal_Input = StageConfig.Bind<string>("Solus Web", "Completion Portals", "SolusBackout, Void", "Portals to spawn upon defeating the Solus Heart.").Value;
			Stages.SolusWeb_Reward = StageConfig.Bind<bool>("Solus Web", "Completion Reward", true, "Drop Legendary Items that contain Legendary items upon purging Solus Heart.").Value;
			Stages.SolusWeb_AllowDecompile = StageConfig.Bind<bool>("Solus Web", "Allow Decompile", true, "Allows you to accept Solus Heart's offering and end the run.").Value;
			Stages.Arena_VoidPortal = StageConfig.Bind<bool>("Void Fields", "Void Portal", true, "Allows the Void Portal to spawn upon completing the Void Fields.").Value;
			Stages.Arena_TimeFlows = StageConfig.Bind<bool>("Void Fields", "Time Flow", true, "Allows time to flow normally in the Void Fields.").Value;
		}
	}
	[BepInPlugin("com.kking117.Railroad", "Railroad", "1.2.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class MainPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.kking117.Railroad";

		public const string MODNAME = "Railroad";

		public const string MODVERSION = "1.2.0";

		internal static ManualLogSource ModLogger;

		internal static PluginInfo pluginInfo;

		public void Awake()
		{
			ModLogger = ((BaseUnityPlugin)this).Logger;
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Configs.Setup();
			EnableChanges();
		}

		private void EnableChanges()
		{
			new Looping();
			new Stages();
		}
	}
}
namespace Railroad.Changes
{
	public class Looping
	{
		internal static bool Enable = false;

		public static bool Loop_DejaVu = false;

		internal static bool Loop_LoopTeleporter = false;

		internal static int Loop_OrderTeleporter = 0;

		public static bool AreLooping = false;

		private static InteractableSpawnCard BaseTeleporter = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Teleporters/iscTeleporter.asset").WaitForCompletion();

		private static InteractableSpawnCard LunarTeleporter = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Teleporters/iscLunarTeleporter.asset").WaitForCompletion();

		internal static string Loop_ArtifactRaw = "";

		internal static List<ArtifactDef> Loop_Artifacts = null;

		public Looping()
		{
			if (Enable)
			{
				Hooks();
			}
		}

		private void Hooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			Run.BeginStage += new hook_BeginStage(Run_BeginStage);
			if (Loop_LoopTeleporter || Loop_OrderTeleporter > 0)
			{
				SceneDirector.onPrePopulateSceneServer += OnPrePopulateScene;
			}
			if (Loop_ArtifactRaw.Length > 0)
			{
				ArtifactCatalog.Init += new hook_Init(ArtifactCatalog_Init);
			}
		}

		internal static ArtifactDef ConvertStringToArtifactDef(string artifactName)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Invalid comparison between Unknown and I4
			ArtifactDef val = null;
			val = ArtifactCatalog.FindArtifactDef(artifactName);
			if ((Object)(object)val == (Object)null)
			{
				for (int i = 0; i < ArtifactCatalog.artifactCount; i++)
				{
					if (Object.op_Implicit((Object)(object)ArtifactCatalog.artifactDefs[i]))
					{
						string text = Language.GetString(ArtifactCatalog.artifactDefs[i].nameToken, "en").Replace(" ", "");
						if (text == artifactName)
						{
							val = ArtifactCatalog.artifactDefs[i];
							break;
						}
					}
				}
			}
			if ((Object)(object)val == (Object)null || (int)val.artifactIndex <= -1)
			{
				return null;
			}
			return val;
		}

		internal static void ArtifactCatalog_Init(orig_Init orig)
		{
			orig.Invoke();
			Loop_Artifacts = new List<ArtifactDef>();
			string[] array = Loop_ArtifactRaw.Split(',');
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim();
				ArtifactDef val = ConvertStringToArtifactDef(text);
				if ((Object)(object)val != (Object)null)
				{
					if (!Loop_Artifacts.Contains(val))
					{
						Loop_Artifacts.Add(val);
					}
				}
				else
				{
					MainPlugin.ModLogger.LogWarning((object)("Could not find ArtifactDef: [" + text + "]"));
				}
			}
			if (Loop_Artifacts.Count < 1)
			{
				Loop_Artifacts = null;
			}
		}

		private void OnPrePopulateScene(SceneDirector self)
		{
			if (!Object.op_Implicit((Object)(object)self.teleporterSpawnCard))
			{
				return;
			}
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (AreLooping && Loop_LoopTeleporter)
			{
				self.teleporterSpawnCard = (SpawnCard)(object)LunarTeleporter;
			}
			else if (Loop_OrderTeleporter > 0)
			{
				if (sceneDefForCurrentScene.stageOrder < Loop_OrderTeleporter)
				{
					self.teleporterSpawnCard = (SpawnCard)(object)BaseTeleporter;
				}
				else
				{
					self.teleporterSpawnCard = (SpawnCard)(object)LunarTeleporter;
				}
			}
		}

		private void Run_BeginStage(orig_BeginStage orig, Run self)
		{
			orig.Invoke(self);
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (self.loopClearCount < 1)
			{
				AreLooping = false;
			}
			if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && StageCountsForLoop(sceneDefForCurrentScene))
			{
				AreLooping = true;
			}
			if (!AreLooping || Loop_Artifacts == null)
			{
				return;
			}
			for (int i = 0; i < Loop_Artifacts.Count; i++)
			{
				ExpansionDef requiredExpansion = Loop_Artifacts[i].requiredExpansion;
				if ((Object)(object)requiredExpansion == (Object)null || Run.instance.IsExpansionEnabled(requiredExpansion))
				{
					RunArtifactManager.instance.SetArtifactEnabledServer(Loop_Artifacts[i], true);
				}
			}
		}

		private bool StageCountsForLoop(SceneDef scene)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			if (Loop_DejaVu)
			{
				if ((int)scene.sceneType != 1)
				{
					return false;
				}
				if (scene.isFinalStage)
				{
					return false;
				}
				if (scene.stageOrder == 1)
				{
					return Run.instance.loopClearCount > 0;
				}
				return false;
			}
			return Run.instance.loopClearCount > 0;
		}
	}
	public class Stages
	{
		internal static bool Enable = false;

		internal static bool Moon2_Eclipse = false;

		internal static string Moon2_Portal_Input = "";

		internal static List<ConfigPortalType> Moon2_Portals;

		internal static bool Moon2_Reward = false;

		internal static bool Meridian_Eclipse = false;

		internal static string Meridian_Portal_Input = "";

		internal static List<ConfigPortalType> Meridian_Portals;

		internal static bool Meridian_Modify_Portal = false;

		internal static bool Meridian_Reward = true;

		internal static bool Meridian_AllowRebirth = true;

		internal static bool Meridian_ACPortal = true;

		internal static bool VoidRaid_Eclipse = false;

		internal static string VoidRaid_Portal_Input = "";

		internal static List<ConfigPortalType> VoidRaid_Portals;

		internal static bool VoidRaid_Reward = false;

		internal static bool VoidRaid_VoidOutroPortal = true;

		internal static bool VoidRaid_TimeFlows = true;

		internal static bool MS_NeedBeads = true;

		internal static bool Limbo_Eclipse = false;

		internal static string Limbo_Portal_Input = "";

		internal static List<ConfigPortalType> Limbo_Portals;

		internal static bool Limbo_Reward = true;

		internal static bool SolusWeb_Eclipse = false;

		internal static string SolusWeb_Portal_Input = "";

		internal static List<ConfigPortalType> SolusWeb_Portals;

		internal static bool SolusWeb_Reward = true;

		internal static bool SolusWeb_AllowDecompile = true;

		internal static bool Arena_VoidPortal = true;

		internal static bool Arena_TimeFlows = true;

		internal static ConfigGoldPortal GoldShores_MeridianPortal = ConfigGoldPortal.Vanilla;

		private static Vector3 Moon2_Pos = new Vector3(-89f, 493f, 1.15f);

		private static Vector3 Limbo_Pos = new Vector3(-6.7f, -8.6f, 87f);

		private static Vector3 Meridian_Pos = new Vector3(109.21f, 151.11f, -121.78f);

		private GameObject VoidPotential = Addressables.LoadAssetAsync<GameObject>((object)"f8e3413a378bd7c44aa09bed0020eaf5").WaitForCompletion();

		private BasicPickupDropTable Tier3PickupTable = Addressables.LoadAssetAsync<BasicPickupDropTable>((object)"abd505260a23e9b449202c055554b77b").WaitForCompletion();

		private SceneDef Scene_Arena = Addressables.LoadAssetAsync<SceneDef>((object)"a478a034d8da76244b2e1fb463ef1b81").WaitForCompletion();

		private SceneDef Scene_VoidRaid = Addressables.LoadAssetAsync<SceneDef>((object)"223a0f0a86052654a9e473d13f77cb41").WaitForCompletion();

		private InteractableSpawnCard Portal_Shop = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"b7909967e0f972543ab5f7367f45561b").WaitForCompletion();

		private InteractableSpawnCard Portal_MS = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"f6b2da500512ed5478412902e42605be").WaitForCompletion();

		private InteractableSpawnCard Portal_Arena = null;

		private InteractableSpawnCard Portal_Void = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"4f32e6a9f71d4e44dad18dec8eb07ef8").WaitForCompletion();

		private InteractableSpawnCard Portal_DeepVoid = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"19dc6bf0a4d213340980ead7d91df95c").WaitForCompletion();

		private InteractableSpawnCard Portal_VoidOutro = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"c3bd3e121f973f04599d514386333d47").WaitForCompletion();

		private InteractableSpawnCard Portal_Goldshores = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"824a39e11dff6d847996704ffe6be27f").WaitForCompletion();

		private InteractableSpawnCard Portal_Colossus = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"f5ecc008531950140a8137d2a3637395").WaitForCompletion();

		private InteractableSpawnCard Portal_Destination = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"644f245483eced544bf8885e0080023f").WaitForCompletion();

		private InteractableSpawnCard Portal_HardwareProg = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"c4e7a9ed6153edf488cf434d843311f5").WaitForCompletion();

		private InteractableSpawnCard Portal_HardwareProg_Haunt = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"7c01731f4ba8cb548af2a35bce9105d3").WaitForCompletion();

		private InteractableSpawnCard Portal_SolusShop = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"07fc379a8d5d3c44c9211730bf4e1572").WaitForCompletion();

		private InteractableSpawnCard Portal_SolusBackout = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"b95252d60a5a463488b6d8c4fcb4bd4d").WaitForCompletion();

		private InteractableSpawnCard Portal_SolusWeb = null;

		private SceneDef Arena_SceneDef = Addressables.LoadAssetAsync<SceneDef>((object)"a478a034d8da76244b2e1fb463ef1b81").WaitForCompletion();

		private SceneDef Meridian_SceneDef = Addressables.LoadAssetAsync<SceneDef>((object)"520b764e3ac5743459fd923204083395").WaitForCompletion();

		private ExpansionDef DLC1Def = Addressables.LoadAssetAsync<ExpansionDef>((object)"d4f30c23b971a9b428e2796dc04ae099").WaitForCompletion();

		private ExpansionDef DLC2Def = Addressables.LoadAssetAsync<ExpansionDef>((object)"851f234056d389b42822523d1be6a167").WaitForCompletion();

		private ExpansionDef DLC3Def = Addressables.LoadAssetAsync<ExpansionDef>((object)"234e83997deed274291470be69e7662e").WaitForCompletion();

		public Stages()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			if (Enable)
			{
				ClampConfig();
				BuildLists();
				CreateSpawnCards();
				UpdateSceneDefs();
				Hooks();
			}
		}

		private void BuildLists()
		{
			if (Moon2_Portal_Input.Length > 0)
			{
				Moon2_Portals = new List<ConfigPortalType>();
				string[] array = Moon2_Portal_Input.Split(',');
				for (int i = 0; i < array.Length; i++)
				{
					string text = array[i].Trim();
					ConfigPortalType result = ConfigPortalType.NoPortal;
					if (!Enum.TryParse<ConfigPortalType>(text, out result))
					{
						MainPlugin.ModLogger.LogWarning((object)("[Commencement] Could not find Portal Type: [" + text + "]"));
					}
					else if (!Moon2_Portals.Contains(result))
					{
						Moon2_Portals.Add(result);
					}
				}
				if (Moon2_Portals.Count < 1)
				{
					Moon2_Portals = null;
				}
			}
			if (Limbo_Portal_Input.Length > 0)
			{
				Limbo_Portals = new List<ConfigPortalType>();
				string[] array2 = Limbo_Portal_Input.Split(',');
				for (int j = 0; j < array2.Length; j++)
				{
					string text2 = array2[j].Trim();
					ConfigPortalType result2 = ConfigPortalType.NoPortal;
					if (!Enum.TryParse<ConfigPortalType>(text2, out result2))
					{
						MainPlugin.ModLogger.LogWarning((object)("[A Moment, Whole] Could not find Portal Type: [" + text2 + "]"));
					}
					else if (!Limbo_Portals.Contains(result2))
					{
						Limbo_Portals.Add(result2);
					}
				}
				if (Limbo_Portals.Count < 1)
				{
					Limbo_Portals = null;
				}
			}
			if (VoidRaid_Portal_Input.Length > 0)
			{
				VoidRaid_Portals = new List<ConfigPortalType>();
				string[] array3 = VoidRaid_Portal_Input.Split(',');
				for (int k = 0; k < array3.Length; k++)
				{
					string text3 = array3[k].Trim();
					ConfigPortalType result3 = ConfigPortalType.NoPortal;
					if (!Enum.TryParse<ConfigPortalType>(text3, out result3))
					{
						MainPlugin.ModLogger.LogWarning((object)("[Planetarium] Could not find Portal Type: [" + text3 + "]"));
					}
					else if (!VoidRaid_Portals.Contains(result3))
					{
						VoidRaid_Portals.Add(result3);
					}
				}
				if (VoidRaid_Portals.Count < 1)
				{
					VoidRaid_Portals = null;
				}
			}
			Meridian_Modify_Portal = true;
			if (Meridian_Portal_Input.Length > 0)
			{
				Meridian_Portals = new List<ConfigPortalType>();
				string[] array4 = Meridian_Portal_Input.Split(',');
				for (int l = 0; l < array4.Length; l++)
				{
					string text4 = array4[l].Trim();
					ConfigPortalType result4 = ConfigPortalType.NoPortal;
					if (!Enum.TryParse<ConfigPortalType>(text4, out result4))
					{
						MainPlugin.ModLogger.LogWarning((object)("[Prime Meridian] Could not find Portal Type: [" + text4 + "]"));
					}
					else if (!Meridian_Portals.Contains(result4))
					{
						Meridian_Portals.Add(result4);
					}
				}
				if (Meridian_Portals.Count < 1)
				{
					Meridian_Portals = null;
				}
				if (Meridian_Portals.Count == 1 && Meridian_Portals[0] == ConfigPortalType.Destination)
				{
					Meridian_Modify_Portal = false;
				}
			}
			if (SolusWeb_Portal_Input.Length <= 0)
			{
				return;
			}
			SolusWeb_Portals = new List<ConfigPortalType>();
			string[] array5 = SolusWeb_Portal_Input.Split(',');
			for (int m = 0; m < array5.Length; m++)
			{
				string text5 = array5[m].Trim();
				ConfigPortalType result5 = ConfigPortalType.NoPortal;
				if (!Enum.TryParse<ConfigPortalType>(text5, out result5))
				{
					MainPlugin.ModLogger.LogWarning((object)("[Solus Web] Could not find Portal Type: [" + text5 + "]"));
				}
				else if (!SolusWeb_Portals.Contains(result5))
				{
					SolusWeb_Portals.Add(result5);
				}
			}
			if (SolusWeb_Portals.Count < 1)
			{
				SolusWeb_Portals = null;
			}
		}

		private void ClampConfig()
		{
			GoldShores_MeridianPortal = (ConfigGoldPortal)Math.Min((int)GoldShores_MeridianPortal, 2);
		}

		private void UpdateSceneDefs()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Invalid comparison between Unknown and I4
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Invalid comparison between Unknown and I4
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Invalid comparison between Unknown and I4
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Scene_Arena) && !Arena_TimeFlows)
			{
				if ((int)Scene_Arena.sceneType == 4)
				{
					Scene_Arena.sceneType = (SceneType)2;
				}
				if ((int)Scene_Arena.sceneType == 1)
				{
					Scene_Arena.sceneType = (SceneType)5;
				}
			}
			if (Object.op_Implicit((Object)(object)Scene_VoidRaid) && !VoidRaid_TimeFlows)
			{
				if ((int)Scene_VoidRaid.sceneType == 4)
				{
					Scene_VoidRaid.sceneType = (SceneType)2;
				}
				if ((int)Scene_VoidRaid.sceneType == 1)
				{
					Scene_VoidRaid.sceneType = (SceneType)5;
				}
			}
		}

		private void CreateSpawnCards()
		{
			//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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			Portal_Arena = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			((SpawnCard)Portal_Arena).prefab = Addressables.LoadAssetAsync<GameObject>((object)"36b16aad972162e44a8ab73cca22e16e").WaitForCompletion();
			((Object)Portal_Arena).name = ((Object)((SpawnCard)Portal_Arena).prefab).name;
			((SpawnCard)Portal_Arena).sendOverNetwork = ((SpawnCard)Portal_Destination).sendOverNetwork;
			((SpawnCard)Portal_Arena).hullSize = ((SpawnCard)Portal_Destination).hullSize;
			((SpawnCard)Portal_Arena).nodeGraphType = ((SpawnCard)Portal_Destination).nodeGraphType;
			((SpawnCard)Portal_Arena).requiredFlags = ((SpawnCard)Portal_Destination).requiredFlags;
			((SpawnCard)Portal_Arena).forbiddenFlags = ((SpawnCard)Portal_Destination).forbiddenFlags;
			((SpawnCard)Portal_Arena).directorCreditCost = ((SpawnCard)Portal_Destination).directorCreditCost;
			((SpawnCard)Portal_Arena).occupyPosition = ((SpawnCard)Portal_Destination).occupyPosition;
			Portal_Arena.orientToFloor = Portal_Destination.orientToFloor;
			Portal_Arena.skipSpawnWhenDevotionArtifactEnabled = Portal_Destination.skipSpawnWhenDevotionArtifactEnabled;
			Portal_Arena.skipSpawnWhenSacrificeArtifactEnabled = Portal_Destination.skipSpawnWhenSacrificeArtifactEnabled;
			Portal_SolusWeb = ScriptableObject.CreateInstance<InteractableSpawnCard>();
			((SpawnCard)Portal_SolusWeb).prefab = Addressables.LoadAssetAsync<GameObject>((object)"9592265fcd09fc643b2495b5e4ebac8f").WaitForCompletion();
			((Object)Portal_SolusWeb).name = ((Object)((SpawnCard)Portal_SolusWeb).prefab).name;
			((SpawnCard)Portal_SolusWeb).sendOverNetwork = ((SpawnCard)Portal_Destination).sendOverNetwork;
			((SpawnCard)Portal_SolusWeb).hullSize = ((SpawnCard)Portal_Destination).hullSize;
			((SpawnCard)Portal_SolusWeb).nodeGraphType = ((SpawnCard)Portal_Destination).nodeGraphType;
			((SpawnCard)Portal_SolusWeb).requiredFlags = ((SpawnCard)Portal_Destination).requiredFlags;
			((SpawnCard)Portal_SolusWeb).forbiddenFlags = ((SpawnCard)Portal_Destination).forbiddenFlags;
			((SpawnCard)Portal_SolusWeb).directorCreditCost = ((SpawnCard)Portal_Destination).directorCreditCost;
			((SpawnCard)Portal_SolusWeb).occupyPosition = ((SpawnCard)Portal_Destination).occupyPosition;
			Portal_SolusWeb.orientToFloor = Portal_Destination.orientToFloor;
			Portal_SolusWeb.skipSpawnWhenDevotionArtifactEnabled = Portal_Destination.skipSpawnWhenDevotionArtifactEnabled;
			Portal_SolusWeb.skipSpawnWhenSacrificeArtifactEnabled = Portal_Destination.skipSpawnWhenSacrificeArtifactEnabled;
		}

		private void Hooks()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Expected O, but got Unknown
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Expected O, but got Unknown
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Expected O, but got Unknown
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			if (Moon2_Portals != null || Moon2_Reward)
			{
				EncounterFinished.OnEnter += new hook_OnEnter(Moon2Complete);
			}
			if (VoidRaid_Portals != null || VoidRaid_Reward)
			{
				VoidRaidGauntletController.SpawnOutroPortal += new hook_SpawnOutroPortal(VoidRaidOnPortal);
			}
			if (!Arena_VoidPortal)
			{
				PortalSpawner.AttemptSpawnPortalServer += new hook_AttemptSpawnPortalServer(PortalSpawner_SpawnPortal);
			}
			if (Meridian_Modify_Portal)
			{
				ShrineRebirthController.Start += new hook_Start(ShrineRebirthController_Start);
			}
			if (!Meridian_AllowRebirth || !Meridian_ACPortal)
			{
				RebirthOrPortalChoice.FixedUpdate += new hook_FixedUpdate(RebirthShrine_Update);
				RevealRebirthShriine.FixedUpdate += new hook_FixedUpdate(RebirthShrine_UpdateNoRebirth);
			}
			if (!Meridian_Reward)
			{
				SkyJumpDeathState.GiveColossusItem += new Manipulator(IL_FalseSonBossComplete);
			}
			RevealRebirthShriine.OnEnter += new Manipulator(IL_RevealRebirthShrine);
			if (!MS_NeedBeads)
			{
				EndingGame.DoFinalAction += new Manipulator(IL_OnObliteration);
			}
			if (GoldShores_MeridianPortal == ConfigGoldPortal.Meridian)
			{
				Exit.IsValidStormTier += new hook_IsValidStormTier(IsValidStormTier);
				Exit.OnEnter += new hook_OnEnter(Goldshores_Exit);
			}
			else if (GoldShores_MeridianPortal == ConfigGoldPortal.Never)
			{
				Exit.IsValidStormTier += new hook_IsValidStormTier(IsValidStormTier);
			}
			if (Limbo_Portals != null || Limbo_Reward)
			{
				FadeOut.OnEnter += new hook_OnEnter(LimboComplete);
			}
			SolusWebMissionController.SpawnExitPortal += new hook_SpawnExitPortal(SolusWeb_SpawnExitPortals);
			if (!SolusWeb_AllowDecompile)
			{
				Run.Start += new hook_Start(RunStart);
			}
			if (SolusWeb_Eclipse && SolusWeb_AllowDecompile)
			{
				EclipseRun.Start += new hook_Start(EclipseStart);
			}
			Death.OnEnter += new Manipulator(IL_SolusHeartDeath);
		}

		private void RunStart(orig_Start orig, Run self)
		{
			orig.Invoke(self);
			self.SetEventFlag("NoSolusHeartOffer");
		}

		private void EclipseStart(orig_Start orig, EclipseRun self)
		{
			orig.Invoke(self);
			((Run)self).ResetEventFlag("NoSolusHeartOffer");
		}

		private void SolusWeb_SpawnExitPortals(orig_SpawnExitPortal orig, SolusWebMissionController self)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			if (SolusWeb_Eclipse || !IsEclipse())
			{
				self.PortalPrefab = null;
				self.VoidPrefab = null;
				orig.Invoke(self);
				if (SolusWeb_Portals == null)
				{
					return;
				}
				Vector3 baselocation = ((Component)self.EscapePortalPos).transform.position;
				if (Object.op_Implicit((Object)(object)self.offeringMaster))
				{
					CharacterBody body = self.offeringMaster.GetBody();
					if (Object.op_Implicit((Object)(object)body))
					{
						baselocation = body.footPosition;
					}
				}
				baselocation.y += 1f;
				List<ConfigPortalType> validPortals = GetValidPortals(SolusWeb_Portals);
				TrySpawnPortalCircle(validPortals, baselocation, (PlacementMode)0);
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void RebirthShrine_Update(orig_FixedUpdate orig, RebirthOrPortalChoice self)
		{
			if (self.isACExpansionEnabled && Meridian_ACPortal)
			{
				self.timer -= ((EntityState)self).GetDeltaTime();
				if (self.timer <= 0f && !self.acPortalTriggered)
				{
					self.acPortalTriggered = true;
					((ShrineRebirthEntityStates)self).SpawnACPortal();
				}
			}
		}

		private void RebirthShrine_UpdateNoRebirth(orig_FixedUpdate orig, RevealRebirthShriine self)
		{
			if (self.isACExpansionEnabled && Meridian_ACPortal && (self.isEclipse || !Meridian_AllowRebirth))
			{
				self.timer -= ((EntityState)self).GetDeltaTime();
				if (self.timer <= 0f && !self.acPortalTriggered)
				{
					self.acPortalTriggered = true;
					((ShrineRebirthEntityStates)self).SpawnACPortal();
				}
			}
		}

		private bool PortalSpawner_SpawnPortal(orig_AttemptSpawnPortalServer orig, PortalSpawner self)
		{
			SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
			if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && (Object)(object)sceneDefForCurrentScene == (Object)(object)Arena_SceneDef)
			{
				return false;
			}
			return orig.Invoke(self);
		}

		private bool IsValidStormTier(orig_IsValidStormTier orig, Exit self)
		{
			return false;
		}

		private void Goldshores_Exit(orig_OnEnter orig, Exit self)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			orig.Invoke(self);
			GameObject val = TrySpawnPortal(ConfigPortalType.Colossus, ((EntityState)self).transform.position, (PlacementMode)1);
			if (Object.op_Implicit((Object)(object)val))
			{
				SceneExitController component = val.GetComponent<SceneExitController>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.destinationScene = Meridian_SceneDef;
					component.tier1AlternateDestinationScene = null;
					component.tier2AlternateDestinationScene = null;
					component.tier3AlternateDestinationScene = null;
					component.tier4AlternateDestinationScene = null;
					component.tier5AlternateDestinationScene = null;
				}
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "PORTAL_STORM_OPEN"
				});
			}
		}

		private void ShrineRebirthController_Start(orig_Start orig, ShrineRebirthController self)
		{
			orig.Invoke(self);
			if (!Meridian_Eclipse && IsEclipse())
			{
				return;
			}
			if (Meridian_Portals.Count == 1)
			{
				if (CanSpawnPortal(Meridian_Portals[0]))
				{
					self.helminthPortalISC = GetSpawnCardFromIndex(Meridian_Portals[0]);
				}
				else
				{
					self.helminthPortalISC = null;
				}
			}
			else
			{
				self.helminthPortalISC = null;
			}
		}

		private void LimboComplete(orig_OnEnter orig, FadeOut self)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (Limbo_Eclipse || !IsEclipse())
			{
				Vector3 limbo_Pos = Limbo_Pos;
				if (Limbo_Portals != null)
				{
					List<ConfigPortalType> validPortals = GetValidPortals(Limbo_Portals);
					TrySpawnPortalCircle(validPortals, limbo_Pos, (PlacementMode)1);
				}
				if (Limbo_Reward)
				{
					limbo_Pos.y += 1f;
					TryDropItems(Run.instance.availableTier3DropList, limbo_Pos);
				}
			}
		}

		private void Moon2Complete(orig_OnEnter orig, EncounterFinished self)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (Moon2_Eclipse || !IsEclipse())
			{
				Vector3 moon2_Pos = Moon2_Pos;
				if (Moon2_Portals != null)
				{
					List<ConfigPortalType> validPortals = GetValidPortals(Moon2_Portals);
					TrySpawnPortalCircle(validPortals, moon2_Pos, (PlacementMode)0);
				}
				if (Moon2_Reward)
				{
					TryDropItems(Run.instance.availableTier3DropList, Moon2_Pos);
				}
			}
		}

		private void VoidRaidOnPortal(orig_SpawnOutroPortal orig, VoidRaidGauntletController self)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			if (VoidRaid_Eclipse || !IsEclipse())
			{
				if (VoidRaid_VoidOutroPortal)
				{
					orig.Invoke(self);
				}
				Vector3 position = ((Component)self.currentDonut.returnPoint).transform.position;
				if (Moon2_Portals != null)
				{
					List<ConfigPortalType> validPortals = GetValidPortals(Moon2_Portals);
					TrySpawnPortalCircle(validPortals, position, (PlacementMode)0, 20f, groundPortals: true);
				}
				if (VoidRaid_Reward)
				{
					position.y += 1f;
					TryDropPotential((PickupDropTable)(object)Tier3PickupTable, position, 3);
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private bool IsEclipse()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			Run instance = Run.instance;
			if (Object.op_Implicit((Object)(object)instance))
			{
				return (int)instance.selectedDifficulty >= 3;
			}
			return false;
		}

		private List<ConfigPortalType> GetValidPortals(List<ConfigPortalType> PortalList)
		{
			List<ConfigPortalType> list = new List<ConfigPortalType>();
			for (int i = 0; i < PortalList.Count; i++)
			{
				if (CanSpawnPortal(PortalList[i]))
				{
					list.Add(PortalList[i]);
				}
			}
			return list;
		}

		private bool CanSpawnPortal(ConfigPortalType portalType)
		{
			switch (portalType)
			{
			case ConfigPortalType.NoPortal:
				return false;
			default:
				if (portalType != ConfigPortalType.VoidOutro)
				{
					if (portalType == ConfigPortalType.Colossus || portalType == ConfigPortalType.Destination)
					{
						return Run.instance.IsExpansionEnabled(DLC2Def);
					}
					if (portalType == ConfigPortalType.HardwareProg || portalType == ConfigPortalType.HardwareProg_Haunt || portalType == ConfigPortalType.SolusShop || portalType == ConfigPortalType.SolusBackout || portalType == ConfigPortalType.SolusWeb)
					{
						return Run.instance.IsExpansionEnabled(DLC3Def);
					}
					return true;
				}
				goto case ConfigPortalType.Void;
			case ConfigPortalType.Void:
			case ConfigPortalType.DeepVoid:
				return Run.instance.IsExpansionEnabled(DLC1Def);
			}
		}

		private InteractableSpawnCard GetSpawnCardFromIndex(ConfigPortalType portalType)
		{
			return (InteractableSpawnCard)(portalType switch
			{
				ConfigPortalType.Shop => Portal_Shop, 
				ConfigPortalType.MS => Portal_MS, 
				ConfigPortalType.Null => Portal_Arena, 
				ConfigPortalType.Void => Portal_Void, 
				ConfigPortalType.DeepVoid => Portal_DeepVoid, 
				ConfigPortalType.VoidOutro => Portal_VoidOutro, 
				ConfigPortalType.Goldshores => Portal_Goldshores, 
				ConfigPortalType.Colossus => Portal_Colossus, 
				ConfigPortalType.Destination => Portal_Destination, 
				ConfigPortalType.HardwareProg => Portal_HardwareProg, 
				ConfigPortalType.HardwareProg_Haunt => Portal_HardwareProg_Haunt, 
				ConfigPortalType.SolusShop => Portal_SolusShop, 
				ConfigPortalType.SolusBackout => Portal_SolusBackout, 
				ConfigPortalType.SolusWeb => Portal_SolusWeb, 
				_ => null, 
			});
		}

		private GameObject TrySpawnPortal_FindFloor(ConfigPortalType portalType, Vector3 location, PlacementMode placementMode = 1)
		{
			//IL_0026: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Expected O, but got Unknown
			if (CanSpawnPortal(portalType))
			{
				InteractableSpawnCard spawnCardFromIndex = GetSpawnCardFromIndex(portalType);
				if (Object.op_Implicit((Object)(object)spawnCardFromIndex))
				{
					RaycastHit val = default(RaycastHit);
					Physics.Raycast(location, Vector3.down, ref val, float.PositiveInfinity, LayerMask.GetMask(new string[1] { "World" }));
					if (((RaycastHit)(ref val)).point.y + 1f <= location.y)
					{
						location.y = ((RaycastHit)(ref val)).point.y + 1f;
					}
					else
					{
						location.y = ((RaycastHit)(ref val)).point.y;
					}
					return DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)spawnCardFromIndex, new DirectorPlacementRule
					{
						maxDistance = 30f,
						minDistance = 10f,
						placementMode = placementMode,
						position = location
					}, Run.instance.stageRng));
				}
			}
			return null;
		}

		private void TrySpawnPortalCircle(List<ConfigPortalType> portalList, Vector3 baselocation, PlacementMode placementMode = 1, float baseDistance = 20f, bool groundPortals = false)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: 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_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			int count = portalList.Count;
			if (count == 1)
			{
				if (groundPortals)
				{
					TrySpawnPortal_FindFloor(portalList[0], baselocation, placementMode);
				}
				else
				{
					TrySpawnPortal(portalList[0], baselocation, placementMode);
				}
			}
			else
			{
				if (count <= 0)
				{
					return;
				}
				float num = 360f / (float)count;
				Vector3 val = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * Vector3.forward;
				Quaternion val2 = Quaternion.AngleAxis(num, Vector3.up);
				int num2 = 0;
				RaycastHit val4 = default(RaycastHit);
				while (num2 < count)
				{
					InteractableSpawnCard spawnCardFromIndex = GetSpawnCardFromIndex(portalList[num2]);
					if (Object.op_Implicit((Object)(object)spawnCardFromIndex))
					{
						Vector3 val3 = baselocation + val * baseDistance;
						if (groundPortals)
						{
							Physics.Raycast(val3, Vector3.down, ref val4, float.PositiveInfinity, LayerMask.GetMask(new string[1] { "World" }));
							if (((RaycastHit)(ref val4)).point.y + 1f <= val3.y)
							{
								val3.y = ((RaycastHit)(ref val4)).point.y + 1f;
							}
							else
							{
								val3.y = ((RaycastHit)(ref val4)).point.y;
							}
						}
						GameObject val5 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)spawnCardFromIndex, new DirectorPlacementRule
						{
							maxDistance = 30f,
							minDistance = 10f,
							placementMode = placementMode,
							position = val3,
							rotation = Quaternion.identity
						}, Run.instance.stageRng));
					}
					num2++;
					val = val2 * val;
				}
			}
		}

		private GameObject TrySpawnPortal(ConfigPortalType portalType, Vector3 location, PlacementMode placementMode = 1)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0042: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			if (CanSpawnPortal(portalType))
			{
				InteractableSpawnCard spawnCardFromIndex = GetSpawnCardFromIndex(portalType);
				if (Object.op_Implicit((Object)(object)spawnCardFromIndex))
				{
					return DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)spawnCardFromIndex, new DirectorPlacementRule
					{
						maxDistance = 30f,
						minDistance = 10f,
						placementMode = placementMode,
						position = location
					}, Run.instance.stageRng));
				}
			}
			return null;
		}

		private void TryDropPotential(PickupDropTable dropTable, Vector3 location, int optionCount)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)dropTable == (Object)null)
			{
				return;
			}
			int participatingPlayerCount = Run.instance.participatingPlayerCount;
			if (participatingPlayerCount <= 0)
			{
				return;
			}
			List<UniquePickup> list = new List<UniquePickup>();
			dropTable.GenerateDistinctPickups(list, optionCount, Run.instance.treasureRng, true);
			if (list.Count > 0)
			{
				ItemTier itemTier = PickupCatalog.GetPickupDef(list[0].pickupIndex).itemTier;
				float num = 360f / (float)participatingPlayerCount;
				Vector3 val = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
				Quaternion val2 = Quaternion.AngleAxis(num, Vector3.up);
				int num2 = 0;
				while (num2 < participatingPlayerCount)
				{
					CreatePickupInfo val3 = default(CreatePickupInfo);
					val3.pickerOptions = PickupPickerController.GenerateOptionsFromList<List<UniquePickup>>(list);
					val3.prefabOverride = VoidPotential;
					val3.position = location;
					val3.rotation = Quaternion.identity;
					((CreatePickupInfo)(ref val3)).pickup = new UniquePickup(PickupCatalog.FindPickupIndex(itemTier));
					CreatePickupInfo val4 = val3;
					PickupDropletController.CreatePickupDroplet(val4, location, val);
					num2++;
					val = val2 * val;
				}
			}
		}

		private void TryDropItems(List<PickupIndex> dropList, Vector3 location)
		{
			//IL_002d: 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)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			int participatingPlayerCount = Run.instance.participatingPlayerCount;
			if (participatingPlayerCount <= 0)
			{
				return;
			}
			int count = dropList.Count;
			if (count > 0)
			{
				UniquePickup val = default(UniquePickup);
				val.pickupIndex = dropList[Random.Range(0, count - 1)];
				float num = 360f / (float)participatingPlayerCount;
				Vector3 val2 = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
				Quaternion val3 = Quaternion.AngleAxis(num, Vector3.up);
				int num2 = 0;
				while (num2 < participatingPlayerCount)
				{
					PickupDropletController.CreatePickupDroplet(val, location, val2, false);
					num2++;
					val2 = val3 * val2;
				}
			}
		}

		private void IL_OnObliteration(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0)
			}))
			{
				val.Remove();
				val.Emit(OpCodes.Ldc_I4_1);
			}
			else
			{
				Debug.LogError((object)"Railroad: OnObliteration IL Hook failed");
			}
		}

		private void IL_FalseSonBossComplete(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Run), "get_participatingPlayerCount")
			}))
			{
				val.Index += 1;
				val.Emit(OpCodes.Ldc_I4_0);
				val.Emit(OpCodes.Mul);
			}
			else
			{
				Debug.LogError((object)"Railroad: GiveColossusItem IL Hook failed");
			}
		}

		private void IL_RevealRebirthShrine(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Run), "get_selectedDifficulty")
			}))
			{
				val.Index -= 1;
				val.RemoveRange(2);
				val.EmitDelegate<Func<DifficultyIndex>>((Func<DifficultyIndex>)delegate
				{
					//IL_0024: Unknown result type (might be due to invalid IL or missing references)
					//IL_0029: Unknown result type (might be due to invalid IL or missing references)
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					//IL_0064: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					//IL_007f: Unknown result type (might be due to invalid IL or missing references)
					//IL_007a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0083: Unknown result type (might be due to invalid IL or missing references)
					if (Meridian_Modify_Portal && Meridian_Portals != null && Meridian_Portals.Count > 1)
					{
						Vector3 meridian_Pos = Meridian_Pos;
						List<ConfigPortalType> validPortals = GetValidPortals(Meridian_Portals);
						TrySpawnPortalCircle(validPortals, meridian_Pos, (PlacementMode)1, 30f);
					}
					if (IsEclipse() && !Meridian_Eclipse)
					{
						return Run.instance.selectedDifficulty;
					}
					return Meridian_AllowRebirth ? ((DifficultyIndex)1) : ((DifficultyIndex)3);
				});
			}
			else
			{
				Debug.LogError((object)"Railroad: RevealRebirthShrine IL Hook failed");
			}
		}

		private void IL_SolusHeartDeath(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Run), "get_participatingPlayerCount")
			}))
			{
				val.Index -= 1;
				val.RemoveRange(2);
				val.EmitDelegate<Func<int>>((Func<int>)(() => (SolusWeb_Reward || (!SolusWeb_Eclipse && IsEclipse())) ? Run.instance.participatingPlayerCount : 0));
			}
			else
			{
				Debug.LogError((object)"Railroad: SolusHeartDeath IL Hook failed");
			}
		}
	}
}