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 IL.EntityStates.FalseSonBoss;
using IL.EntityStates.Interactables.MSObelisk;
using IL.EntityStates.ShrineRebirth;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Missions.BrotherEncounter;
using On.EntityStates.Missions.Goldshores;
using On.EntityStates.Missions.LunarScavengerEncounter;
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
}
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_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 Portal";
private const string Label_WinReward = "Completion Reward";
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, "Looping.cfg"), true);
StageConfig = new ConfigFile(Path.Combine(ConfigFolderPath, "Stages.cfg"), true);
Read_StageConfig();
Read_LoopConfig();
}
private static void Read_StageConfig()
{
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_MinStageCount = LoopConfig.Bind<int>("!Loop Definition", "Min Stage Clears", 5, "The minimun number of stage clears to even consider that we've looped.").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_EnableHonor = LoopConfig.Bind<bool>("Loop Effects", "Enable Honor", false, "Enables the Artifact of Honor 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_LoopConfig()
{
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 = StageConfig.Bind<ConfigPortalType>("Commencement", "Completion Portal", ConfigPortalType.NoPortal, "Portal 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 = StageConfig.Bind<ConfigPortalType>("Prime Meridian", "Completion Portal", ConfigPortalType.Destination, "Portal 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 even during Eclipse.").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 = StageConfig.Bind<ConfigPortalType>("Planetarium", "Completion Portal", ConfigPortalType.NoPortal, "Portal to spawn upon defeating Voidling.").Value;
Stages.VoidRaid_Reward = StageConfig.Bind<bool>("Planetarium", "Completion Reward", false, "Drop 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.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 = StageConfig.Bind<ConfigPortalType>("A Moment, Whole", "Completion Portal", ConfigPortalType.NoPortal, "Portal 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.Arena_VoidPortal = StageConfig.Bind<bool>("Void Fields", "Void Portal", true, "Allows the void portal to spawn upon completing the Void Fields.").Value;
}
}
[BepInPlugin("com.kking117.Railroad", "Railroad", "1.0.3")]
[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.0.3";
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 int Loop_MinStageCount = 5;
public static bool Loop_DejaVu = false;
internal static bool Loop_EnableHonor = false;
internal static bool Loop_LoopTeleporter = false;
internal static int Loop_OrderTeleporter = 0;
public static bool AreLooping = false;
private static ArtifactDef HonorDef = Addressables.LoadAssetAsync<ArtifactDef>((object)"RoR2/Base/EliteOnly/EliteOnly.asset").WaitForCompletion();
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();
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
Run.BeginStage += new hook_BeginStage(Run_BeginStage);
if (Loop_LoopTeleporter || Loop_OrderTeleporter > 0)
{
SceneDirector.onPrePopulateSceneServer += OnPrePopulateScene;
}
}
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);
if (Run.instance.stageClearCount < 1)
{
AreLooping = false;
}
SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && StageCountsForLoop(sceneDefForCurrentScene))
{
AreLooping = true;
}
if (Loop_EnableHonor && AreLooping)
{
RunArtifactManager.instance.SetArtifactEnabledServer(HonorDef, 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.stageClearCount >= Loop_MinStageCount;
}
return false;
}
return Run.instance.stageClearCount >= Loop_MinStageCount;
}
}
public class Stages
{
internal static bool Enable = false;
internal static bool Moon2_Eclipse = false;
internal static ConfigPortalType Moon2_Portal = ConfigPortalType.NoPortal;
internal static bool Moon2_Reward = false;
internal static bool Meridian_Eclipse = false;
internal static ConfigPortalType Meridian_Portal = ConfigPortalType.NoPortal;
internal static bool Meridian_Reward = true;
internal static bool Meridian_AllowRebirth = true;
internal static bool VoidRaid_Eclipse = false;
internal static ConfigPortalType VoidRaid_Portal = ConfigPortalType.NoPortal;
internal static bool VoidRaid_Reward = false;
internal static bool VoidRaid_VoidOutroPortal = true;
internal static bool MS_NeedBeads = true;
internal static bool Limbo_Eclipse = false;
internal static ConfigPortalType Limbo_Portal = ConfigPortalType.NoPortal;
internal static bool Limbo_Reward = true;
internal static bool Arena_VoidPortal = true;
internal static ConfigGoldPortal GoldShores_MeridianPortal = ConfigGoldPortal.Vanilla;
private static Vector3 Moon2_Pos = new Vector3(-89f, 491.5f, 1.15f);
private static Vector3 Limbo_Pos = new Vector3(-6.7f, -8.6f, 87f);
private InteractableSpawnCard Portal_Shop = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/PortalShop/iscShopPortal.asset").WaitForCompletion();
private InteractableSpawnCard Portal_MS = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/PortalMS/iscMSPortal.asset").WaitForCompletion();
private InteractableSpawnCard Portal_Arena = null;
private InteractableSpawnCard Portal_Void = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC1/PortalVoid/iscVoidPortal.asset").WaitForCompletion();
private InteractableSpawnCard Portal_DeepVoid = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC1/DeepVoidPortal/iscDeepVoidPortal.asset").WaitForCompletion();
private InteractableSpawnCard Portal_VoidOutro = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC1/VoidOutroPortal/iscVoidOutroPortal.asset").WaitForCompletion();
private InteractableSpawnCard Portal_Goldshores = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/PortalGoldshores/iscGoldshoresPortal.asset").WaitForCompletion();
private InteractableSpawnCard Portal_Colossus = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC2/iscColossusPortal.asset").WaitForCompletion();
private InteractableSpawnCard Portal_Destination = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC2/iscDestinationPortal.asset").WaitForCompletion();
private SceneDef Arena_SceneDef = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/Base/arena/arena.asset").WaitForCompletion();
private SceneDef Meridian_SceneDef = Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/meridian/meridian.asset").WaitForCompletion();
private ExpansionDef DLC1Def = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion();
private ExpansionDef DLC2Def = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC2/Common/DLC2.asset").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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
if (Enable)
{
ClampConfig();
CreateSpawnCards();
Hooks();
}
}
private void ClampConfig()
{
Moon2_Portal = (ConfigPortalType)Math.Min((int)Moon2_Portal, 8);
VoidRaid_Portal = (ConfigPortalType)Math.Min((int)VoidRaid_Portal, 8);
Limbo_Portal = (ConfigPortalType)Math.Min((int)Limbo_Portal, 8);
Meridian_Portal = (ConfigPortalType)Math.Min((int)Meridian_Portal, 8);
GoldShores_MeridianPortal = (ConfigGoldPortal)Math.Min((int)GoldShores_MeridianPortal, 2);
}
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)
Portal_Arena = ScriptableObject.CreateInstance<InteractableSpawnCard>();
((SpawnCard)Portal_Arena).prefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/PortalArena/PortalArena.prefab").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;
}
private void Hooks()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Expected O, but got Unknown
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Expected O, but got Unknown
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Expected O, but got Unknown
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: 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_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Expected O, but got Unknown
if (Moon2_Portal != ConfigPortalType.NoPortal || Moon2_Reward)
{
EncounterFinished.OnEnter += new hook_OnEnter(Moon2Complete);
}
if (VoidRaid_Portal != ConfigPortalType.NoPortal || VoidRaid_Reward)
{
VoidRaidGauntletController.SpawnOutroPortal += new hook_SpawnOutroPortal(VoidRaidOnPortal);
}
if (!Arena_VoidPortal)
{
PortalSpawner.AttemptSpawnPortalServer += new hook_AttemptSpawnPortalServer(PortalSpawner_SpawnPortal);
}
if (Meridian_Portal != ConfigPortalType.Destination)
{
ShrineRebirthController.Start += new hook_Start(ShrineRebirthController_Start);
}
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_Portal != ConfigPortalType.NoPortal || Limbo_Reward)
{
FadeOut.OnEnter += new hook_OnEnter(LimboComplete);
}
}
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())
{
self.helminthPortalISC = GetSpawnCardFromIndex(Meridian_Portal);
}
}
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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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)
orig.Invoke(self);
if (Limbo_Eclipse || !IsEclipse())
{
Vector3 location = Limbo_Pos;
GameObject val = TrySpawnPortal(Limbo_Portal, location, (PlacementMode)1);
if (Object.op_Implicit((Object)(object)val))
{
location = val.transform.position;
}
if (Limbo_Reward)
{
location.y += 1f;
TryDropItems(Run.instance.availableTier3DropList, location);
}
}
}
private void Moon2Complete(orig_OnEnter orig, EncounterFinished self)
{
//IL_0027: 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)
orig.Invoke(self);
if (Moon2_Eclipse || !IsEclipse())
{
TrySpawnPortal(Moon2_Portal, Moon2_Pos, (PlacementMode)0);
if (Moon2_Reward)
{
TryDropItems(Run.instance.availableTier3DropList, Moon2_Pos);
}
}
}
private void VoidRaidOnPortal(orig_SpawnOutroPortal orig, VoidRaidGauntletController self)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_007f: 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;
GameObject val = TrySpawnPortal(VoidRaid_Portal, position, (PlacementMode)0);
if (Object.op_Implicit((Object)(object)val))
{
position = val.transform.position;
}
if (VoidRaid_Reward)
{
position.y += 1f;
TryDropItems(Run.instance.availableTier3DropList, position);
}
}
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 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);
}
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,
_ => null,
});
}
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 TryDropItems(List<PickupIndex> dropList, Vector3 location)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_0075: 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_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)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
int participatingPlayerCount = Run.instance.participatingPlayerCount;
if (participatingPlayerCount <= 0)
{
return;
}
int count = dropList.Count;
if (count > 0)
{
PickupIndex val = 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);
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>)(() => (Meridian_Eclipse || IsEclipse()) ? (Meridian_AllowRebirth ? ((DifficultyIndex)(-1)) : ((DifficultyIndex)99)) : Run.instance.selectedDifficulty));
}
else
{
Debug.LogError((object)"Railroad: RevealRebirthShrine IL Hook failed");
}
}
}
}