Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Shrine of Birth v1.0.0
plugins/ShrineOfBirth/ShrineOfBirth.dll
Decompiled 18 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using RoR2; using UnityEngine.Events; [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 = ".NET Standard 2.1")] [assembly: AssemblyCompany("ShrineOfBirth")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("RoR2 mod to prevent the run ending when using the shrine of rebirth")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShrineOfBirth")] [assembly: AssemblyTitle("ShrineOfBirth")] [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 ShrineOfBirth { [BepInPlugin("ShrineOfBirth", "ShrineOfBirth", "1.0.0")] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static hook_Start <0>__On_RebirthController_Start; public static Manipulator <1>__Modify_RebirthController_StoreRebirthItemChoice; } private static ManualLogSource _logger; private static ConfigEntry<bool> DisableItemRemoval { get; set; } private void Awake() { _logger = ((BaseUnityPlugin)this).Logger; DisableItemRemoval = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisableItemRemoval", false, "Prevents the shrine of rebirth from taking your given item"); } private void OnEnable() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: 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_004c: Expected O, but got Unknown object obj = <>O.<0>__On_RebirthController_Start; if (obj == null) { hook_Start val = On_RebirthController_Start; <>O.<0>__On_RebirthController_Start = val; obj = (object)val; } ShrineRebirthController.Start += (hook_Start)obj; if (DisableItemRemoval.Value) { object obj2 = <>O.<1>__Modify_RebirthController_StoreRebirthItemChoice; if (obj2 == null) { Manipulator val2 = Modify_RebirthController_StoreRebirthItemChoice; <>O.<1>__Modify_RebirthController_StoreRebirthItemChoice = val2; obj2 = (object)val2; } ShrineRebirthController.StoreRebirthItemChoice += (Manipulator)obj2; } } private void OnDisable() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown object obj = <>O.<0>__On_RebirthController_Start; if (obj == null) { hook_Start val = On_RebirthController_Start; <>O.<0>__On_RebirthController_Start = val; obj = (object)val; } ShrineRebirthController.Start -= (hook_Start)obj; object obj2 = <>O.<1>__Modify_RebirthController_StoreRebirthItemChoice; if (obj2 == null) { Manipulator val2 = Modify_RebirthController_StoreRebirthItemChoice; <>O.<1>__Modify_RebirthController_StoreRebirthItemChoice = val2; obj2 = (object)val2; } ShrineRebirthController.StoreRebirthItemChoice -= (Manipulator)obj2; } private static void On_RebirthController_Start(orig_Start orig, ShrineRebirthController self) { orig.Invoke(self); ((UnityEventBase)self.onRebirthChoiceFinished).m_PersistentCalls.m_Calls.RemoveAll((PersistentCall call) => (call.targetAssemblyTypeName == "RoR2.EventFunctions, RoR2" && call.methodName == "BeginEnding") || (call.targetAssemblyTypeName == "RoR2.SceneExitController, RoR2" && call.methodName == "Begin")); } private static void Modify_RebirthController_StoreRebirthItemChoice(ILContext il) { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown Func<Instruction, bool>[] array = new Func<Instruction, bool>[7] { (Instruction i) => ILPatternMatchingExt.MatchLdarg(i, 0), (Instruction i) => ILPatternMatchingExt.MatchLdfld<ShrineRebirthController>(i, "rebirthBody"), (Instruction i) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(i, "get_inventory"), (Instruction i) => ILPatternMatchingExt.MatchLdloc(i, 0), (Instruction i) => ILPatternMatchingExt.MatchLdfld<PickupDef>(i, "itemIndex"), (Instruction i) => ILPatternMatchingExt.MatchLdcI4(i, 1), (Instruction i) => ILPatternMatchingExt.MatchCallvirt<Inventory>(i, "RemoveItemPermanent") }; ILCursor val = new ILCursor(il); if (!val.TryGotoNext(array)) { _logger.LogError((object)"Failed to find IL to modify in ShrineRebirthController.StoreRebirthItemChoice!"); _logger.LogError((object)"Items given to the shrine of rebirth will be consumed."); } else { val.RemoveRange(array.Length); } } } public static class PluginInfo { public const string PLUGIN_GUID = "ShrineOfBirth"; public const string PLUGIN_NAME = "ShrineOfBirth"; public const string PLUGIN_VERSION = "1.0.0"; } }