Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of SimulacrumNormalStages v1.1.0
SimulacrumNormalStages.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HG.Reflection; using IL.RoR2; using InLobbyConfig; using InLobbyConfig.Fields; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API.Utils; using RoR2; using RoR2.Hologram; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SimulacrumNormalStages")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ab2362f38026f6bfbfd09adf2fa304a33d3d0a20")] [assembly: AssemblyProduct("SimulacrumNormalStages")] [assembly: AssemblyTitle("SimulacrumNormalStages")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SimulacrumNormalStages { public class BepConfig { public static ConfigEntry<bool> PlaceVoidEradictors; public static ConfigEntry<bool> PlaceNewtAltars; public static ConfigEntry<bool> Enabled { get; set; } public static void Init() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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 ConfigFile config = ((BaseUnityPlugin)SimulacrumNormalStages.instance).Config; Enabled = config.Bind<bool>("Main", "Enabled", true, "Enable Mod"); PlaceVoidEradictors = config.Bind<bool>("Main", "Place Void Eradictors", false, new ConfigDescription("Places Void Eradictors - a shrine to erase items from the run.", (AcceptableValueBase)null, Array.Empty<object>())); PlaceNewtAltars = config.Bind<bool>("Main", "Place Newt Altars", false, new ConfigDescription("Places Newt Altars - in order to access the Bazaar between Times.", (AcceptableValueBase)null, Array.Empty<object>())); if (ModCompatibilityInLobbyConfig.enabled) { ModCompatibilityInLobbyConfig.CreateFromBepInExConfigFile(config, "Simulacrum Normal Stages"); } } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } public static class ModCompatibilityInLobbyConfig { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.InLobbyConfig"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void CreateFromBepInExConfigFile(ConfigFile config, string displayName) { ModConfigCatalog.Add(ConfigFieldUtilities.CreateFromBepInExConfigFile(config, displayName)); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Def.SimulacrumNormalStages", "SimulacrumNormalStages", "1.1.0")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class SimulacrumNormalStages : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static hook_OnPrePopulateSceneServer <0>__RemoveSpawnPointsAndMonsters; public static Action<SceneDirector, DirectorCardCategorySelection> <1>__AddAndRemoveInteractables; public static hook_IsAvailable <2>__Allow_Earlier_Spawns; public static hook_Start <3>__DoReality; public static hook_PickNextStageScene <4>__ChooseRealityStages; public static hook_Start <5>__Run_Start; public static hook_OnDisable <6>__Run_OnDisable; public static hook_OnStartServer <7>__ArenaMissionController_OnStartServer; public static hook_Start <8>__VoidStageMissionController_Start; public static Action<GameObject> <9>__Destroy; } public const string PluginGUID = "Def.SimulacrumNormalStages"; public const string PluginAuthor = "Def"; public const string PluginName = "SimulacrumNormalStages"; public const string PluginVersion = "1.1.0"; public static SimulacrumNormalStages instance; public static SceneCollection realityDestinations = ScriptableObject.CreateInstance<SceneCollection>(); public static List<SceneDef> visitedScenes; public static bool shouldAttemptToSpawnShopPortal = false; public AsyncOperationHandle<SpawnCard> iscShopPortal; public static Predicate<DirectorCard> trimmer = SimulacrumTrimmer; public static PluginInfo PInfo { get; private set; } public void Awake() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) PInfo = ((BaseUnityPlugin)this).Info; instance = this; Log.Init(((BaseUnityPlugin)this).Logger); BepConfig.Init(); iscShopPortal = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/PortalShop/iscShopPortal.asset"); } private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //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_00c5: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown ArenaMissionController.OnStartServer += new Manipulator(ArenaMissionController_OnStartServer); VoidStageMissionController.OnEnable += new Manipulator(VoidStageMissionController_OnEnable); VoidStageMissionController.Start += new Manipulator(VoidStageMissionController_Start); InfiniteTowerRun.OnPrePopulateSceneServer += new Manipulator(InfiniteTowerRun_OnPrePopulateSceneServer); Run.AdvanceStage += new Manipulator(Run_AdvanceStage); PortalStatueBehavior.GrantPortalEntry += new hook_GrantPortalEntry(PortalStatueBehavior_GrantPortalEntry); InfiniteTowerRun.OnWaveAllEnemiesDefeatedServer += new hook_OnWaveAllEnemiesDefeatedServer(InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer); AccessCodesMissionController.OnStartServer += new Manipulator(AccessCodesMissionController_OnStartServer); ConduitCanyonController.DisableSector2 += new Manipulator(ConduitCanyonController_DisableSector2); SceneDirector.PopulateScene += new hook_PopulateScene(SceneDirector_PopulateScene); object obj = <>O.<0>__RemoveSpawnPointsAndMonsters; if (obj == null) { hook_OnPrePopulateSceneServer val = RemoveSpawnPointsAndMonsters; <>O.<0>__RemoveSpawnPointsAndMonsters = val; obj = (object)val; } InfiniteTowerRun.OnPrePopulateSceneServer += (hook_OnPrePopulateSceneServer)obj; SceneDirector.onGenerateInteractableCardSelection += AddAndRemoveInteractables; object obj2 = <>O.<2>__Allow_Earlier_Spawns; if (obj2 == null) { hook_IsAvailable val2 = Allow_Earlier_Spawns; <>O.<2>__Allow_Earlier_Spawns = val2; obj2 = (object)val2; } DirectorCard.IsAvailable += (hook_IsAvailable)obj2; object obj3 = <>O.<3>__DoReality; if (obj3 == null) { hook_Start val3 = DoReality; <>O.<3>__DoReality = val3; obj3 = (object)val3; } SceneDirector.Start += (hook_Start)obj3; object obj4 = <>O.<4>__ChooseRealityStages; if (obj4 == null) { hook_PickNextStageScene val4 = ChooseRealityStages; <>O.<4>__ChooseRealityStages = val4; obj4 = (object)val4; } Run.PickNextStageScene += (hook_PickNextStageScene)obj4; object obj5 = <>O.<5>__Run_Start; if (obj5 == null) { hook_Start val5 = Run_Start; <>O.<5>__Run_Start = val5; obj5 = (object)val5; } Run.Start += (hook_Start)obj5; object obj6 = <>O.<6>__Run_OnDisable; if (obj6 == null) { hook_OnDisable val6 = Run_OnDisable; <>O.<6>__Run_OnDisable = val6; obj6 = (object)val6; } Run.OnDisable += (hook_OnDisable)obj6; object obj7 = <>O.<7>__ArenaMissionController_OnStartServer; if (obj7 == null) { hook_OnStartServer val7 = ArenaMissionController_OnStartServer; <>O.<7>__ArenaMissionController_OnStartServer = val7; obj7 = (object)val7; } ArenaMissionController.OnStartServer += (hook_OnStartServer)obj7; object obj8 = <>O.<8>__VoidStageMissionController_Start; if (obj8 == null) { hook_Start val8 = VoidStageMissionController_Start; <>O.<8>__VoidStageMissionController_Start = val8; obj8 = (object)val8; } VoidStageMissionController.Start += (hook_Start)obj8; Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/habitat/habitat.asset").WaitForCompletion().validForRandomSelection = true; Addressables.LoadAssetAsync<SceneDef>((object)"RoR2/DLC2/helminthroost/helminthroost.asset").WaitForCompletion().validForRandomSelection = true; } private void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00ec: 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_00f7: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //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_01b7: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown ArenaMissionController.OnStartServer -= new Manipulator(ArenaMissionController_OnStartServer); VoidStageMissionController.OnEnable -= new Manipulator(VoidStageMissionController_OnEnable); VoidStageMissionController.Start -= new Manipulator(VoidStageMissionController_Start); InfiniteTowerRun.OnPrePopulateSceneServer -= new Manipulator(InfiniteTowerRun_OnPrePopulateSceneServer); Run.AdvanceStage -= new Manipulator(Run_AdvanceStage); PortalStatueBehavior.GrantPortalEntry -= new hook_GrantPortalEntry(PortalStatueBehavior_GrantPortalEntry); InfiniteTowerRun.OnWaveAllEnemiesDefeatedServer -= new hook_OnWaveAllEnemiesDefeatedServer(InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer); AccessCodesMissionController.OnStartServer -= new Manipulator(AccessCodesMissionController_OnStartServer); ConduitCanyonController.DisableSector2 -= new Manipulator(ConduitCanyonController_DisableSector2); SceneDirector.PopulateScene -= new hook_PopulateScene(SceneDirector_PopulateScene); if (Object.op_Implicit((Object)(object)Run.instance)) { RuleDef val = RuleCatalog.FindRuleDef("Misc.StageOrder"); Run.instance.ruleBook.GetRuleChoice(val).extraData = (object)(StageOrder)0; } object obj = <>O.<0>__RemoveSpawnPointsAndMonsters; if (obj == null) { hook_OnPrePopulateSceneServer val2 = RemoveSpawnPointsAndMonsters; <>O.<0>__RemoveSpawnPointsAndMonsters = val2; obj = (object)val2; } InfiniteTowerRun.OnPrePopulateSceneServer -= (hook_OnPrePopulateSceneServer)obj; SceneDirector.onGenerateInteractableCardSelection -= AddAndRemoveInteractables; object obj2 = <>O.<2>__Allow_Earlier_Spawns; if (obj2 == null) { hook_IsAvailable val3 = Allow_Earlier_Spawns; <>O.<2>__Allow_Earlier_Spawns = val3; obj2 = (object)val3; } DirectorCard.IsAvailable -= (hook_IsAvailable)obj2; object obj3 = <>O.<3>__DoReality; if (obj3 == null) { hook_Start val4 = DoReality; <>O.<3>__DoReality = val4; obj3 = (object)val4; } SceneDirector.Start -= (hook_Start)obj3; object obj4 = <>O.<4>__ChooseRealityStages; if (obj4 == null) { hook_PickNextStageScene val5 = ChooseRealityStages; <>O.<4>__ChooseRealityStages = val5; obj4 = (object)val5; } Run.PickNextStageScene -= (hook_PickNextStageScene)obj4; object obj5 = <>O.<5>__Run_Start; if (obj5 == null) { hook_Start val6 = Run_Start; <>O.<5>__Run_Start = val6; obj5 = (object)val6; } Run.Start -= (hook_Start)obj5; object obj6 = <>O.<6>__Run_OnDisable; if (obj6 == null) { hook_OnDisable val7 = Run_OnDisable; <>O.<6>__Run_OnDisable = val7; obj6 = (object)val7; } Run.OnDisable -= (hook_OnDisable)obj6; object obj7 = <>O.<7>__ArenaMissionController_OnStartServer; if (obj7 == null) { hook_OnStartServer val8 = ArenaMissionController_OnStartServer; <>O.<7>__ArenaMissionController_OnStartServer = val8; obj7 = (object)val8; } ArenaMissionController.OnStartServer -= (hook_OnStartServer)obj7; object obj8 = <>O.<8>__VoidStageMissionController_Start; if (obj8 == null) { hook_Start val9 = VoidStageMissionController_Start; <>O.<8>__VoidStageMissionController_Start = val9; obj8 = (object)val9; } VoidStageMissionController.Start -= (hook_Start)obj8; } private void ConduitCanyonController_DisableSector2(ILContext il) { ReturnImmediately(il, delegate(AccessCodesMissionController self) { if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun)) { ((Behaviour)self).enabled = false; return true; } return false; }); } private void AccessCodesMissionController_OnStartServer(ILContext il) { ReturnImmediately(il, delegate(AccessCodesMissionController self) { if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun)) { ((Behaviour)self).enabled = false; return true; } return false; }); } private void SceneDirector_PopulateScene(orig_PopulateScene orig, SceneDirector self) { if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun)) { List<GameObject> list = new List<GameObject>(); foreach (ShrineCombatTroopBehavior instances in InstanceTracker.GetInstancesList<ShrineCombatTroopBehavior>()) { if ((Object)(object)instances != (Object)null && ((Object)((Component)instances).gameObject).name.StartsWith("ShrineCombatCollective")) { list.Add(((Component)instances).gameObject); } } list.ForEach((Action<GameObject>)Object.Destroy); } orig.Invoke(self); if (!(((object)Run.instance).GetType() == typeof(InfiniteTowerRun))) { return; } List<GameObject> list2 = new List<GameObject>(); foreach (GenericObjectiveProvider instances2 in InstanceTracker.GetInstancesList<GenericObjectiveProvider>()) { if ((Object)(object)instances2 != (Object)null) { list2.Add(((Component)instances2).gameObject); } } foreach (PowerPedestal instances3 in InstanceTracker.GetInstancesList<PowerPedestal>()) { if ((Object)(object)instances3 != (Object)null) { instances3.SetComplete(true); instances3.CallRpcInteractResult(true); } } foreach (TeleporterInteraction instances4 in InstanceTracker.GetInstancesList<TeleporterInteraction>()) { if ((Object)(object)instances4 != (Object)null) { list2.Add(((Component)instances4).gameObject); } } list2.ForEach((Action<GameObject>)Object.Destroy); } private void InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer(orig_OnWaveAllEnemiesDefeatedServer orig, InfiniteTowerRun self, InfiniteTowerWaveController wc) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0071: 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_0092: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown orig.Invoke(self, wc); if (self.IsStageTransitionWave() && shouldAttemptToSpawnShopPortal && (Object)(object)self.safeWardController != (Object)null && (Object)(object)DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(iscShopPortal.WaitForCompletion(), new DirectorPlacementRule { minDistance = 0f, maxDistance = 30f, placementMode = (PlacementMode)1, position = ((Component)self.safeWardController).transform.position, spawnOnTarget = ((Component)self.safeWardController).transform }, self.safeWardRng)) != (Object)null) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "PORTAL_SHOP_OPEN" }); } shouldAttemptToSpawnShopPortal = false; } private void PortalStatueBehavior_GrantPortalEntry(orig_GrantPortalEntry orig, PortalStatueBehavior self) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)self.portalType == 0) { shouldAttemptToSpawnShopPortal = true; } orig.Invoke(self); } private void Run_AdvanceStage(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel val2 = val.DefineLabel(); val.EmitDelegate<Func<bool>>((Func<bool>)(() => SceneCatalog.GetSceneDefForCurrentScene().baseSceneName == "arena" && ((object)Run.instance).GetType() == typeof(InfiniteTowerRun))); val.Emit(OpCodes.Brtrue, (object)val2); val.Index += 2; val.GotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<Run>(x, "stageClearCount") }); val.MarkLabel(val2); } private void ReturnImmediately<T>(ILContext il, Func<T, bool> funcWhetherToReturnImmediately) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) ILLabel val = il.DefineLabel(); ILCursor val2 = new ILCursor(il); val2.Emit(OpCodes.Ldarg_0); val2.EmitDelegate<Func<T, bool>>(funcWhetherToReturnImmediately); val2.Emit(OpCodes.Brfalse, (object)val); val2.Emit(OpCodes.Ret); val2.MarkLabel(val); } private void ArenaMissionController_OnStartServer(ILContext il) { ReturnImmediately(il, delegate(ArenaMissionController self) { if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun)) { GameObject val = GameObject.Find("PortalArena"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } GameObject[] nullWards = self.nullWards; for (int i = 0; i < nullWards.Length; i++) { Object.Destroy((Object)(object)nullWards[i]); } self.nullWards = (GameObject[])(object)new GameObject[0]; ((Behaviour)self).enabled = false; return true; } return false; }); } private void VoidStageMissionController_OnEnable(ILContext il) { ReturnImmediately(il, delegate(VoidStageMissionController self) { if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun)) { ((Behaviour)self).enabled = false; return true; } return false; }); } private void VoidStageMissionController_Start(ILContext il) { ReturnImmediately(il, delegate(VoidStageMissionController self) { if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun)) { if (Object.op_Implicit((Object)(object)self.deepVoidPortalObjectiveProvider)) { ((Behaviour)self.deepVoidPortalObjectiveProvider).enabled = false; } return true; } return false; }); } private bool IsCurrentMapInBazaar() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); return ((Scene)(ref activeScene)).name == "bazaar"; } private void InfiniteTowerRun_OnPrePopulateSceneServer(ILContext il) { ReturnImmediately(il, delegate(InfiniteTowerRun self) { if (IsCurrentMapInBazaar()) { self.PerformStageCleanUp(); return true; } return false; }); } private static void ArenaMissionController_OnStartServer(orig_OnStartServer orig, ArenaMissionController self) { if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun)) { ((Component)self).gameObject.SetActive(false); GameObject val = GameObject.Find("/PortalArena"); if (Object.op_Implicit((Object)(object)val)) { ((Component)val.transform.GetChild(0)).gameObject.SetActive(false); } } else { orig.Invoke(self); } } public unsafe static void DoDestinations() { //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) List<SceneEntry> list = new List<SceneEntry>(); for (int i = 0; i < SceneCatalog.allStageSceneDefs.Length; i++) { SceneDef val = (SceneDef)Unsafe.Read<object>((void*)SceneCatalog.allStageSceneDefs[i]); if ((val.validForRandomSelection && val.hasAnyDestinations) || val.cachedName == "conduitcanyon") { float weight = 1f; switch (val.cachedName) { case "blackbeach": case "lakesnight": case "blackbeach2": case "golemplains": case "habitatfall": case "golemplains2": case "ironalluvium": case "villagenight": case "habitat": case "village": case "lakes": case "ironalluvium2": weight = 0.5f; break; } SceneEntry val2 = default(SceneEntry); val2.sceneDef = val; ((SceneEntry)(ref val2)).weight = weight; SceneEntry item = val2; list.Add(item); } } realityDestinations._sceneEntries = list.ToArray(); } private static void Run_Start(orig_Start orig, Run self) { if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun) && BepConfig.Enabled.Value) { DoDestinations(); self.startingSceneGroup = realityDestinations; } orig.Invoke(self); if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun) && BepConfig.Enabled.Value) { RuleDef val = RuleCatalog.FindRuleDef("Misc.StageOrder"); self.ruleBook.GetRuleChoice(val).extraData = (object)(StageOrder)1; visitedScenes = new List<SceneDef>(); shouldAttemptToSpawnShopPortal = false; } } private static void DoReality(orig_Start orig, SceneDirector self) { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!BepConfig.Enabled.Value || ((object)Run.instance).GetType() != typeof(InfiniteTowerRun)) { return; } CombatDirector[] components = ((Component)self).gameObject.GetComponents<CombatDirector>(); for (int i = 0; i < components.Length; i++) { Debug.Log((object)components[i]); ((Behaviour)components[i]).enabled = false; } PortalStatueBehavior[] array = Object.FindObjectsOfType(typeof(PortalStatueBehavior)) as PortalStatueBehavior[]; if (array.Length != 0) { if (BepConfig.PlaceVoidEradictors.Value && !BepConfig.PlaceNewtAltars.Value) { GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/VoidSuppressor"); Transform parent = ((Component)array[0]).gameObject.transform.parent; for (int j = 0; j < parent.childCount; j++) { Transform child = parent.GetChild(j); if (Object.op_Implicit((Object)(object)((Component)child).GetComponent<PortalStatueBehavior>())) { Debug.Log((object)child); ((Component)child).gameObject.SetActive(true); if (NetworkServer.active) { GameObject obj = Object.Instantiate<GameObject>(val, child); obj.transform.localPosition = new Vector3(0f, -1.38f, 0f); PurchaseInteraction component = obj.GetComponent<PurchaseInteraction>(); component.costType = (CostTypeIndex)0; component.cost = 0; NetworkServer.Spawn(obj); ((Component)child.GetChild(0)).gameObject.SetActive(false); } Object.Destroy((Object)(object)((Component)child).GetComponent<PurchaseInteraction>()); Object.Destroy((Object)(object)((Component)child).GetComponent<HologramProjector>()); Object.Destroy((Object)(object)((Component)child).GetComponent<PortalStatueBehavior>()); } } } else if (!BepConfig.PlaceNewtAltars.Value) { Transform parent2 = ((Component)array[0]).gameObject.transform.parent; for (int k = 0; k < parent2.childCount; k++) { NetworkServer.Destroy(((Component)parent2.GetChild(k)).gameObject); } } } PortalDialerButtonController[] array2 = Object.FindObjectsOfType(typeof(PortalDialerButtonController)) as PortalDialerButtonController[]; for (int l = 0; l < array2.Length; l++) { NetworkServer.Destroy(((Component)array2[l]).gameObject); } PortalDialerController[] array3 = Object.FindObjectsOfType(typeof(PortalDialerController)) as PortalDialerController[]; for (int m = 0; m < array3.Length; m++) { NetworkServer.Destroy(((Component)array3[m]).gameObject); } if (NetworkServer.active) { Run.instance.PickNextStageScene((WeightedSelection<SceneDef>)null); } } private static void VoidStageMissionController_Start(orig_Start orig, VoidStageMissionController self) { if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun)) { self.batteryCount = 0; } orig.Invoke(self); } private static void Run_OnDisable(orig_OnDisable orig, Run self) { RuleDef val = RuleCatalog.FindRuleDef("Misc.StageOrder"); Run.instance.ruleBook.GetRuleChoice(val).extraData = (object)(StageOrder)0; orig.Invoke(self); } private static void ChooseRealityStages(orig_PickNextStageScene orig, Run self, WeightedSelection<SceneDef> choices) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun) && BepConfig.Enabled.Value && (int)self.ruleBook.stageOrder == 1) { if (visitedScenes.Count > 10) { visitedScenes.Clear(); DoDestinations(); } if (realityDestinations.sceneEntries.Length == 0) { DoDestinations(); } if (realityDestinations.sceneEntries.Length > 0) { WeightedSelection<SceneDef> val = new WeightedSelection<SceneDef>(24); realityDestinations.AddToWeightedSelection(val, (Func<SceneDef, bool>)self.CanPickStage); self.nextStageScene = val.Evaluate(self.nextStageRng.nextNormalizedFloat); visitedScenes.Add(self.nextStageScene); for (int i = 0; i < realityDestinations._sceneEntries.Length; i++) { if ((Object)(object)realityDestinations._sceneEntries[i].sceneDef == (Object)(object)self.nextStageScene) { ((SceneEntry)(ref realityDestinations._sceneEntries[i])).weight = 0f; } } } else { SceneDef[] array = ((IEnumerable<SceneDef>)(object)SceneCatalog.allStageSceneDefs).Where(RealityValidSceneDefs).ToArray(); self.nextStageScene = self.nextStageRng.NextElementUniform<SceneDef>(array); } } else { orig.Invoke(self, choices); } } private static bool RealityValidSceneDefs(SceneDef sceneDef) { if (visitedScenes.Contains(sceneDef)) { return false; } if (sceneDef.hasAnyDestinations) { return sceneDef.validForRandomSelection; } return false; } private static bool Allow_Earlier_Spawns(orig_IsAvailable orig, DirectorCard self) { if (BepConfig.Enabled.Value && ((object)Run.instance)?.GetType() == typeof(InfiniteTowerRun) && self.minimumStageCompletions > 2) { self.minimumStageCompletions = 2; } return orig.Invoke(self); } private static void RemoveSpawnPointsAndMonsters(orig_OnPrePopulateSceneServer orig, InfiniteTowerRun self, SceneDirector sceneDirector) { if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun) && BepConfig.Enabled.Value) { sceneDirector.teleporterSpawnCard = null; sceneDirector.monsterCredit = 0; sceneDirector.RemoveAllExistingSpawnPoints(); } orig.Invoke(self, sceneDirector); } private static void AddAndRemoveInteractables(SceneDirector arg1, DirectorCardCategorySelection dccs) { //IL_005a: 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_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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0080: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown if (!(((object)Run.instance).GetType() == typeof(InfiniteTowerRun)) || !BepConfig.Enabled.Value) { return; } int num = dccs.FindCategoryIndexByName("Void Stuff"); if (num != -1) { dccs.categories[num].selectionWeight *= 3f; DirectorCard val = new DirectorCard { spawnCard = Addressables.LoadAssetAsync<SpawnCard>((object)"5448ccdc4b91bd244a1631d60d24298d").WaitForCompletion(), selectionWeight = 1 }; DirectorCard val2 = new DirectorCard { spawnCard = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/VoidTriple/iscVoidTriple.asset").WaitForCompletion(), selectionWeight = 15 }; DirectorCard val3 = new DirectorCard { spawnCard = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/VoidSuppressor/iscVoidSuppressor.asset").WaitForCompletion(), selectionWeight = 15 }; DirectorCard val4 = new DirectorCard { spawnCard = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/DLC1/VoidCoinBarrel/iscVoidCoinBarrel.asset").WaitForCompletion(), selectionWeight = 6 }; dccs.AddCard(num, val4); dccs.AddCard(num, val); if (BepConfig.PlaceVoidEradictors.Value) { dccs.AddCard(num, val3); } dccs.AddCard(num, val2); } dccs.RemoveCardsThatFailFilter(trimmer); } public static bool SimulacrumTrimmer(DirectorCard card) { GameObject prefab = card.spawnCard.prefab; SpawnCard spawnCard = card.spawnCard; if (((InteractableSpawnCard)((spawnCard is InteractableSpawnCard) ? spawnCard : null)).skipSpawnWhenDevotionArtifactEnabled && !RunArtifactManager.instance.IsArtifactEnabled(Artifacts.Devotion)) { return false; } return !(Object.op_Implicit((Object)(object)prefab.GetComponent<ShrineCombatBehavior>()) | Object.op_Implicit((Object)(object)prefab.GetComponent<HalcyoniteShrineInteractable>()) | Object.op_Implicit((Object)(object)prefab.GetComponent<OutsideInteractableLocker>()) | Object.op_Implicit((Object)(object)prefab.GetComponent<ShrineBossBehavior>()) | Object.op_Implicit((Object)(object)prefab.GetComponent<SeerStationController>()) | Object.op_Implicit((Object)(object)prefab.GetComponent<PortalStatueBehavior>())); } } }