using 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;
[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+6d7044d0c8d1cc0da63c1eacd3b028ad498f73bb")]
[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");
}
}
}
public class EnumCollection
{
public enum StageEnum
{
None,
TitanicPlains,
DistantRoost,
WetlandAspect,
AbandonedAqueduct,
RallypointDelta,
ScorchedAcres,
AbyssalDepths,
SirensCall,
GildedCoast,
MomentFractured,
Bazaar,
VoidFields,
MomentWhole,
SkyMeadow,
BullwarksAmbry,
Commencement,
SunderedGrove,
VoidLocus,
Planetarium,
AphelianSanctuary,
SimulacrumAbandonedAquaduct,
SimulacrumAbyssalDepths,
SimulacrumAphelianSanctuary,
SimulacrumCommencement,
SimulacrumRallypointDelta,
SimulacrumSkyMeadow,
SimulacrumTitanicPlains,
SiphonedForest,
SulfurPools
}
public static Dictionary<StageEnum, List<string>> SceneNames = new Dictionary<StageEnum, List<string>>
{
{
StageEnum.TitanicPlains,
new List<string> { "golemplains", "golemplains2", "golemplains trailer" }
},
{
StageEnum.DistantRoost,
new List<string> { "blackbeach", "blackbeach2", "blackbeachTest" }
},
{
StageEnum.WetlandAspect,
new List<string> { "foggyswamp" }
},
{
StageEnum.AbandonedAqueduct,
new List<string> { "goolake" }
},
{
StageEnum.RallypointDelta,
new List<string> { "frozenwall" }
},
{
StageEnum.ScorchedAcres,
new List<string> { "wispgraveyard" }
},
{
StageEnum.AbyssalDepths,
new List<string> { "dampcavesimple" }
},
{
StageEnum.SirensCall,
new List<string> { "shipgraveyard" }
},
{
StageEnum.GildedCoast,
new List<string> { "goldshores" }
},
{
StageEnum.MomentFractured,
new List<string> { "mysteryspace" }
},
{
StageEnum.Bazaar,
new List<string> { "bazaar" }
},
{
StageEnum.VoidFields,
new List<string> { "arena" }
},
{
StageEnum.MomentWhole,
new List<string> { "limbo" }
},
{
StageEnum.SkyMeadow,
new List<string> { "skymeadow" }
},
{
StageEnum.BullwarksAmbry,
new List<string> { "artifactworld" }
},
{
StageEnum.Commencement,
new List<string> { "moon", "moon2" }
},
{
StageEnum.SunderedGrove,
new List<string> { "rootjungle" }
},
{
StageEnum.VoidLocus,
new List<string> { "voidstage" }
},
{
StageEnum.Planetarium,
new List<string> { "voidraid" }
},
{
StageEnum.AphelianSanctuary,
new List<string> { "ancientloft" }
},
{
StageEnum.SimulacrumAbandonedAquaduct,
new List<string> { "itgoolake" }
},
{
StageEnum.SimulacrumAbyssalDepths,
new List<string> { "itdampcave" }
},
{
StageEnum.SimulacrumAphelianSanctuary,
new List<string> { "itancientloft" }
},
{
StageEnum.SimulacrumCommencement,
new List<string> { "itmoon" }
},
{
StageEnum.SimulacrumRallypointDelta,
new List<string> { "itfrozenwall" }
},
{
StageEnum.SimulacrumSkyMeadow,
new List<string> { "itskymeadow" }
},
{
StageEnum.SimulacrumTitanicPlains,
new List<string> { "itgolemplains" }
},
{
StageEnum.SiphonedForest,
new List<string> { "snowyforest" }
},
{
StageEnum.SulfurPools,
new List<string> { "sulfurpools" }
}
};
private static SceneEntry createSceneEntry(StageEnum stageEnum, float weight = 1f)
{
//IL_000d: 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)
return createSceneEntry(((IEnumerable<SceneDef>)(object)SceneCatalog.allStageSceneDefs).Where((SceneDef s) => s.cachedName == GetStageName(stageEnum)).First(), weight);
}
private static SceneEntry createSceneEntry(string stageName, float weight = 1f)
{
//IL_000d: 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)
return createSceneEntry(((IEnumerable<SceneDef>)(object)SceneCatalog.allStageSceneDefs).Where((SceneDef s) => s.cachedName == stageName).First(), weight);
}
private static SceneEntry createSceneEntry(SceneDef sceneDef, float weight = 1f)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
SceneEntry result = default(SceneEntry);
result.sceneDef = sceneDef;
((SceneEntry)(ref result)).weight = weight;
return result;
}
public static List<SceneEntry> GetNormalStagesList()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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_004f: 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_0071: 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_00a4: 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_00c7: 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_00eb: 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_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
return new List<SceneEntry>
{
createSceneEntry("golemplains", 0.5f),
createSceneEntry("golemplains2", 0.5f),
createSceneEntry("blackbeach", 0.5f),
createSceneEntry("blackbeach2", 0.5f),
createSceneEntry(StageEnum.WetlandAspect),
createSceneEntry(StageEnum.AbandonedAqueduct),
createSceneEntry(StageEnum.RallypointDelta),
createSceneEntry(StageEnum.ScorchedAcres),
createSceneEntry(StageEnum.AbyssalDepths),
createSceneEntry(StageEnum.SirensCall),
createSceneEntry(StageEnum.SkyMeadow),
createSceneEntry(StageEnum.SunderedGrove),
createSceneEntry(StageEnum.AphelianSanctuary),
createSceneEntry(StageEnum.SiphonedForest),
createSceneEntry(StageEnum.SulfurPools),
createSceneEntry("moon2")
};
}
public static bool IsSimulacrumStage(string name)
{
if (GetStageName(StageEnum.SimulacrumAbandonedAquaduct) == name)
{
return true;
}
if (GetStageName(StageEnum.SimulacrumAbyssalDepths) == name)
{
return true;
}
if (GetStageName(StageEnum.SimulacrumAphelianSanctuary) == name)
{
return true;
}
if (GetStageName(StageEnum.SimulacrumCommencement) == name)
{
return true;
}
if (GetStageName(StageEnum.SimulacrumRallypointDelta) == name)
{
return true;
}
if (GetStageName(StageEnum.SimulacrumSkyMeadow) == name)
{
return true;
}
if (GetStageName(StageEnum.SimulacrumTitanicPlains) == name)
{
return true;
}
return false;
}
public static string GetStageName(StageEnum stageEnum)
{
return SceneNames[stageEnum].First();
}
}
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.0.1")]
[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 const string PluginGUID = "Def.SimulacrumNormalStages";
public const string PluginAuthor = "Def";
public const string PluginName = "SimulacrumNormalStages";
public const string PluginVersion = "1.0.1";
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_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_0092: Expected O, but got Unknown
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Expected O, but got Unknown
//IL_00e7: 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_00f2: Expected O, but got Unknown
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Expected O, but got Unknown
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Expected O, but got Unknown
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Expected O, but got Unknown
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: 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_0192: 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);
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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Expected O, but got Unknown
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Expected O, but got Unknown
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Expected O, but got Unknown
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Expected O, but got Unknown
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Expected O, but got Unknown
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: 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);
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 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_00a8: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel val2 = val.DefineLabel();
val.GotoNext(new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<SceneDef>(x, "sceneType"),
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1)
});
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 void InfiniteTowerRun_OnPrePopulateSceneServer(ILContext il)
{
ReturnImmediately(il, delegate(InfiniteTowerRun self)
{
if (SceneCatalog.GetSceneDefForCurrentScene().baseSceneName == EnumCollection.GetStageName(EnumCollection.StageEnum.Bazaar))
{
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_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_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_01bd: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: 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)
{
float weight = 1f;
switch (val.cachedName)
{
case "blackbeach":
case "lakesnight":
case "blackbeach2":
case "golemplains":
case "habitatfall":
case "golemplains2":
case "villagenight":
case "habitat":
case "village":
case "lakes":
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)
{
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>();
DoDestinations();
shouldAttemptToSpawnShopPortal = false;
}
}
private static void DoReality(orig_Start orig, SceneDirector self)
{
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: 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);
}
}
}
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 (((object)Run.instance).GetType() == typeof(InfiniteTowerRun) && BepConfig.Enabled.Value && 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>()));
}
}
}