Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DropSourceForItems v1.0.0
patchers/AddDropSourcePatcher/AddDropSourcePatcher.dll
Decompiled 6 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Microsoft.CodeAnalysis; using Mono.Cecil; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AddDropSourcePatcher")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AddDropSourcePatcher")] [assembly: AssemblyTitle("AddDropSourcePatcher")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T> { object IEnumerator.Current => _item; T IEnumerator<T>.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => 1; T IReadOnlyList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection<T>.Count => 1; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer<T>.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer<T>.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return new Enumerator(_item); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return EqualityComparer<T>.Default.Equals(_item, item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { if (!EqualityComparer<T>.Default.Equals(_item, item)) { return -1; } return 0; } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 DropSourceForItems { internal static class AddDropSourcePatcher { public static IEnumerable<string> TargetDLLs { get; } = new <>z__ReadOnlySingleElementList<string>("RoR2.dll"); public static void Patch(AssemblyDefinition assembly) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown TypeDefinition type = assembly.MainModule.GetType("RoR2.GenericPickupController/CreatePickupInfo"); FieldDefinition val = new FieldDefinition("dsfi_dropSource", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(GameObject))); if (type != null) { type.Fields.Add(val); } FieldDefinition val2 = new FieldDefinition("dsfi_cachedDropSourceName", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(string))); if (type != null) { type.Fields.Add(val2); } TypeDefinition type2 = assembly.MainModule.GetType("RoR2.GenericPickupController"); FieldDefinition val3 = new FieldDefinition("dsfi_dropSource", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(GameObject))); if (type2 != null) { type2.Fields.Add(val3); } FieldDefinition val4 = new FieldDefinition("dsfi_cachedDropSourceName", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(string))); if (type2 != null) { type2.Fields.Add(val4); } TypeDefinition type3 = assembly.MainModule.GetType("RoR2.PickupPickerController"); FieldDefinition val5 = new FieldDefinition("dsfi_dropSource", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(GameObject))); if (type3 != null) { type3.Fields.Add(val5); } FieldDefinition val6 = new FieldDefinition("dsfi_cachedDropSourceName", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(string))); if (type3 != null) { type3.Fields.Add(val6); } } } }
plugins/DropSourceForItems.dll
Decompiled 6 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; 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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DropSourceForItems.Modded.ModSupport; using EnemiesReturns.Enemies.LynxTribe; using EntityStates; using EntityStates.DroneScrapper; using EntityStates.Scrapper; using Mdh.EnemiesReturns.Enemies.LynxTribe.LynxTribeShrine; using Mdh.EntityStates.DroneScrapper.DroneScrappingToIdle; using Mdh.EntityStates.Scrapper.ScrappingToIdle; using Mdh.RiskyTweaks.Tweaks.Interactables.ShrineCombatItems; using Mdh.RoR2.ArenaMissionController; using Mdh.RoR2.ChestBehavior; using Mdh.RoR2.GenericPickupController; using Mdh.RoR2.HalcyoniteShrineInteractable; using Mdh.RoR2.OptionChestBehavior; using Mdh.RoR2.PickupDistributorBehavior; using Mdh.RoR2.PickupDropletController; using Mdh.RoR2.PickupPickerController; using Mdh.RoR2.RouletteChestController; using Mdh.RoR2.ScavBackpackBehavior; using Mdh.RoR2.ShopTerminalBehavior; using Mdh.RoR2.ShrineChanceBehavior; using Microsoft.CodeAnalysis; using MiscFixes.Modules; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoDetour; using MonoDetour.Cil; using MonoDetour.DetourTypes; using MonoDetour.HookGen; using MonoMod.Cil; using On.RoR2; using RiskyTweaks.Tweaks.Interactables; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("EnemiesReturns")] [assembly: IgnoresAccessChecksTo("RiskyTweaks")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LordVGames.DropSourceForItems")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LordVGames.DropSourceForItems")] [assembly: AssemblyTitle("DropSourceForItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 Mdh.EntityStates.Scrapper.ScrappingToIdle { internal static class OnEnter { public delegate void PrefixSignature(ScrappingToIdle self); public delegate void PostfixSignature(ScrappingToIdle self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(ScrappingToIdle); MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("EntityStates.Scrapper.ScrappingToIdle", "OnEnter"); } return method; } } } namespace Mdh.EntityStates.DroneScrapper.DroneScrappingToIdle { internal static class DropPickup { public delegate void PrefixSignature(DroneScrappingToIdle self); public delegate void PostfixSignature(DroneScrappingToIdle self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(DroneScrappingToIdle); MethodInfo method = typeFromHandle.GetMethod("DropPickup", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("EntityStates.DroneScrapper.DroneScrappingToIdle", "DropPickup"); } return method; } } internal static class OnEnter { public delegate void PrefixSignature(DroneScrappingToIdle self); public delegate void PostfixSignature(DroneScrappingToIdle self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(DroneScrappingToIdle); MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("EntityStates.DroneScrapper.DroneScrappingToIdle", "OnEnter"); } return method; } } } namespace Mdh.RiskyTweaks.Tweaks.Interactables.ShrineCombatItems { internal static class ShrineCombatBehavior_OnDefeatedServer { public delegate void PrefixSignature(ShrineCombatItems self, ref orig_OnDefeatedServer orig, ref ShrineCombatBehavior self1); public delegate void PostfixSignature(ShrineCombatItems self, ref orig_OnDefeatedServer orig, ref ShrineCombatBehavior self1); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(ShrineCombatItems); MethodInfo method = typeFromHandle.GetMethod("ShrineCombatBehavior_OnDefeatedServer", (BindingFlags)(-1), null, new Type[2] { typeof(orig_OnDefeatedServer), typeof(ShrineCombatBehavior) }, null); if ((object)method == null) { throw new MissingMethodException("RiskyTweaks.Tweaks.Interactables.ShrineCombatItems", "ShrineCombatBehavior_OnDefeatedServer"); } return method; } } } namespace Mdh.EnemiesReturns.Enemies.LynxTribe.LynxTribeShrine { internal static class DropItems { public delegate void PrefixSignature(LynxTribeShrine self); public delegate void PostfixSignature(LynxTribeShrine self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(LynxTribeShrine); MethodInfo method = typeFromHandle.GetMethod("DropItems", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("EnemiesReturns.Enemies.LynxTribe.LynxTribeShrine", "DropItems"); } return method; } } internal static class AddShrineStack { public delegate void PrefixSignature(LynxTribeShrine self, ref Interactor activator); public delegate void PostfixSignature(LynxTribeShrine self, ref Interactor activator); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(LynxTribeShrine); MethodInfo method = typeFromHandle.GetMethod("AddShrineStack", (BindingFlags)(-1), null, new Type[1] { typeof(Interactor) }, null); if ((object)method == null) { throw new MissingMethodException("EnemiesReturns.Enemies.LynxTribe.LynxTribeShrine", "AddShrineStack"); } return method; } } } namespace Mdh.RoR2.PickupDistributorBehavior { internal static class Drop { public delegate void PrefixSignature(PickupDistributorBehavior self); public delegate void PostfixSignature(PickupDistributorBehavior self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(PickupDistributorBehavior); MethodInfo method = typeFromHandle.GetMethod("Drop", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.PickupDistributorBehavior", "Drop"); } return method; } } } namespace Mdh.RoR2.ArenaMissionController { internal static class MissionCompleted { internal static class OnEnter { public delegate void PrefixSignature(MissionCompleted self); public delegate void PostfixSignature(MissionCompleted self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(MissionCompleted); MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.ArenaMissionController+MissionCompleted", "OnEnter"); } return method; } } } internal static class EndRound { public delegate void PrefixSignature(ArenaMissionController self); public delegate void PostfixSignature(ArenaMissionController self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(ArenaMissionController); MethodInfo method = typeFromHandle.GetMethod("EndRound", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.ArenaMissionController", "EndRound"); } return method; } } } namespace Mdh.RoR2.OptionChestBehavior { internal static class ItemDrop { public delegate void PrefixSignature(OptionChestBehavior self); public delegate void PostfixSignature(OptionChestBehavior self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(OptionChestBehavior); MethodInfo method = typeFromHandle.GetMethod("ItemDrop", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.OptionChestBehavior", "ItemDrop"); } return method; } } } namespace Mdh.RoR2.ScavBackpackBehavior { internal static class ItemDrop { public delegate void PrefixSignature(ScavBackpackBehavior self); public delegate void PostfixSignature(ScavBackpackBehavior self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(ScavBackpackBehavior); MethodInfo method = typeFromHandle.GetMethod("ItemDrop", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.ScavBackpackBehavior", "ItemDrop"); } return method; } } } namespace Mdh.RoR2.PickupPickerController { internal static class CreatePickup_RoR2_UniquePickup { public delegate void PrefixSignature(PickupPickerController self, ref UniquePickup pickupState); public delegate void PostfixSignature(PickupPickerController self, ref UniquePickup pickupState); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(PickupPickerController); MethodInfo method = typeFromHandle.GetMethod("CreatePickup", (BindingFlags)(-1), null, new Type[1] { typeof(UniquePickup) }, null); if ((object)method == null) { throw new MissingMethodException("RoR2.PickupPickerController", "CreatePickup"); } return method; } } } namespace Mdh.RoR2.HalcyoniteShrineInteractable { internal static class DropRewards { public delegate void PrefixSignature(HalcyoniteShrineInteractable self); public delegate void PostfixSignature(HalcyoniteShrineInteractable self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(HalcyoniteShrineInteractable); MethodInfo method = typeFromHandle.GetMethod("DropRewards", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.HalcyoniteShrineInteractable", "DropRewards"); } return method; } } } namespace Mdh.RoR2.RouletteChestController { internal static class EjectPickupServer { public delegate void PrefixSignature(RouletteChestController self, ref UniquePickup pickup); public delegate void PostfixSignature(RouletteChestController self, ref UniquePickup pickup); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(RouletteChestController); MethodInfo method = typeFromHandle.GetMethod("EjectPickupServer", (BindingFlags)(-1), null, new Type[1] { typeof(UniquePickup) }, null); if ((object)method == null) { throw new MissingMethodException("RoR2.RouletteChestController", "EjectPickupServer"); } return method; } } internal static class RouletteChestControllerBaseState { internal static class OnEnter { public delegate void PrefixSignature(RouletteChestControllerBaseState self); public delegate void PostfixSignature(RouletteChestControllerBaseState self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(RouletteChestControllerBaseState); MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.RouletteChestController+RouletteChestControllerBaseState", "OnEnter"); } return method; } } } internal static class Idle { internal static class OnEnter { public delegate void PrefixSignature(Idle self); public delegate void PostfixSignature(Idle self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(Idle); MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.RouletteChestController+Idle", "OnEnter"); } return method; } } } internal static class Startup { internal static class OnEnter { public delegate void PrefixSignature(Startup self); public delegate void PostfixSignature(Startup self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(Startup); MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.RouletteChestController+Startup", "OnEnter"); } return method; } } } internal static class Cycling { internal static class OnEnter { public delegate void PrefixSignature(Cycling self); public delegate void PostfixSignature(Cycling self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(Cycling); MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.RouletteChestController+Cycling", "OnEnter"); } return method; } } } internal static class Opening { internal static class OnEnter { public delegate void PrefixSignature(Opening self); public delegate void PostfixSignature(Opening self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(Opening); MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.RouletteChestController+Opening", "OnEnter"); } return method; } } } internal static class Opened { internal static class OnEnter { public delegate void PrefixSignature(Opened self); public delegate void PostfixSignature(Opened self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(Opened); MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.RouletteChestController+Opened", "OnEnter"); } return method; } } } } namespace Mdh.RoR2.ShopTerminalBehavior { internal static class DropPickup { public delegate void PrefixSignature(ShopTerminalBehavior self); public delegate void PostfixSignature(ShopTerminalBehavior self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(ShopTerminalBehavior); MethodInfo method = typeFromHandle.GetMethod("DropPickup", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.ShopTerminalBehavior", "DropPickup"); } return method; } } internal static class DropPickup_System_Boolean { public delegate void PrefixSignature(ShopTerminalBehavior self, ref bool isDuplicated); public delegate void PostfixSignature(ShopTerminalBehavior self, ref bool isDuplicated); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(ShopTerminalBehavior); MethodInfo method = typeFromHandle.GetMethod("DropPickup", (BindingFlags)(-1), null, new Type[1] { typeof(bool) }, null); if ((object)method == null) { throw new MissingMethodException("RoR2.ShopTerminalBehavior", "DropPickup"); } return method; } } } namespace Mdh.RoR2.ChestBehavior { internal static class BaseItemDrop { public delegate void PrefixSignature(ChestBehavior self); public delegate void PostfixSignature(ChestBehavior self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(ChestBehavior); MethodInfo method = typeFromHandle.GetMethod("BaseItemDrop", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.ChestBehavior", "BaseItemDrop"); } return method; } } internal static class ItemDrop { public delegate void PrefixSignature(ChestBehavior self); public delegate void PostfixSignature(ChestBehavior self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(ChestBehavior); MethodInfo method = typeFromHandle.GetMethod("ItemDrop", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.ChestBehavior", "ItemDrop"); } return method; } } } namespace Mdh.RoR2.ShrineChanceBehavior { internal static class AddShrineStack { public delegate void PrefixSignature(ShrineChanceBehavior self, ref Interactor activator); public delegate void PostfixSignature(ShrineChanceBehavior self, ref Interactor activator); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(ShrineChanceBehavior); MethodInfo method = typeFromHandle.GetMethod("AddShrineStack", (BindingFlags)(-1), null, new Type[1] { typeof(Interactor) }, null); if ((object)method == null) { throw new MissingMethodException("RoR2.ShrineChanceBehavior", "AddShrineStack"); } return method; } } } namespace Mdh.RoR2.PickupDropletController { internal static class CreatePickup { public delegate void PrefixSignature(PickupDropletController self); public delegate void PostfixSignature(PickupDropletController self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(PickupDropletController); MethodInfo method = typeFromHandle.GetMethod("CreatePickup", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.PickupDropletController", "CreatePickup"); } return method; } } internal static class CreateCommandCube { public delegate void PrefixSignature(PickupDropletController self); public delegate void PostfixSignature(PickupDropletController self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(PickupDropletController); MethodInfo method = typeFromHandle.GetMethod("CreateCommandCube", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.PickupDropletController", "CreateCommandCube"); } return method; } } internal static class Init { public delegate void PrefixSignature(); public delegate void PostfixSignature(); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(PickupDropletController); MethodInfo method = typeFromHandle.GetMethod("Init", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.PickupDropletController", "Init"); } return method; } } } namespace Mdh.RoR2.GenericPickupController { internal static class CreatePickup { public delegate void PrefixSignature(ref CreatePickupInfo createPickupInfo); public delegate void PostfixSignature(ref CreatePickupInfo createPickupInfo, ref GenericPickupController returnValue); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(GenericPickupController); MethodInfo method = typeFromHandle.GetMethod("CreatePickup", (BindingFlags)(-1), null, new Type[1] { typeof(CreatePickupInfo).MakeByRefType() }, null); if ((object)method == null) { throw new MissingMethodException("RoR2.GenericPickupController", "CreatePickup"); } return method; } } internal static class Init { public delegate void PrefixSignature(); public delegate void PostfixSignature(); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(GenericPickupController); MethodInfo method = typeFromHandle.GetMethod("Init", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("RoR2.GenericPickupController", "Init"); } return method; } } } namespace MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute(Type? targetType = null) : Attribute(), IMonoDetourTargets { public Type? TargetType { get; } = targetType; public bool IncludeNestedTypes { get; set; } = true; public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Embedded] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace DropSourceForItems { public static class ConfigOptions { private const string _sectionName = "when the config has options"; internal static ConfigEntry<bool> ShowDebugLogging; internal static void BindConfigOptions(ConfigFile config) { ShowDebugLogging = Extensions.BindOption<bool>(config, "when the config has options", "Show debug logging", "does what it says", false, (ConfigFlags)0); } } internal static class ILHelpers { internal static void LogILInstructions(this ILWeaver w) { //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) Enumerator<Instruction> enumerator = w.Instructions.GetEnumerator(); try { while (enumerator.MoveNext()) { Instruction current = enumerator.Current; Log.Warning(current); } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { if (ConfigOptions.ShowDebugLogging.Value) { _logSource.LogDebug(data); } } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [MonoDetourTargets(typeof(GenericPickupController))] [MonoDetourTargets(typeof(PickupDropletController))] public static class Main { [CompilerGenerated] private static class <>O { public static Manipulator <0>__TransferDropSourceToPickup; public static Manipulator <1>__TransferDropSourceToCommandPickup; } [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown object obj = <>O.<0>__TransferDropSourceToPickup; if (obj == null) { Manipulator val = TransferDropSourceToPickup; <>O.<0>__TransferDropSourceToPickup = val; obj = (object)val; } Mdh.RoR2.GenericPickupController.CreatePickup.ILHook((Manipulator)obj); object obj2 = <>O.<1>__TransferDropSourceToCommandPickup; if (obj2 == null) { Manipulator val2 = TransferDropSourceToCommandPickup; <>O.<1>__TransferDropSourceToCommandPickup = val2; obj2 = (object)val2; } CreateCommandCube.ILHook((Manipulator)obj2); } private static void TransferDropSourceToCommandPickup(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00a1: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); VariableDefinition val = default(VariableDefinition); w.DeclareVariable(typeof(PickupPickerController), ref val); w.MatchRelaxed(new Predicate<Instruction>[3] { (Instruction x) => ILPatternMatchingExt.MatchDup(x), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GameObject>(x, "GetComponent") && w.SetCurrentTo(x), (Instruction x) => ILPatternMatchingExt.MatchDup(x) }).ThrowIfFailure().InsertAfterCurrent((IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[2] { w.Create(OpCodes.Stloc, val), w.Create(OpCodes.Ldloc, val) })); w.MatchRelaxed(new Predicate<Instruction>[2] { (Instruction x) => ILPatternMatchingExt.MatchStfld<PickupPickerController>(x, "chestGeneratedFrom") && w.SetCurrentTo(x), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<NetworkServer>(x, "Spawn") }).ThrowIfFailure().InsertBeforeCurrentStealLabels((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[3] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Action<PickupDropletController, PickupPickerController>>((Action<PickupDropletController, PickupPickerController>)delegate(PickupDropletController pdc, PickupPickerController ppc) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Log.Debug("AfterPickupMadeCommand"); if (!((Object)(object)pdc == (Object)null) && !((Object)(object)ppc == (Object)null)) { _ = pdc.pickupState; GameObject pickupDropSource = PatchedPickupInfoInterop.GetPickupDropSource(ref pdc.createPickupInfo); if ((Object)(object)pickupDropSource == (Object)null) { Log.Debug($"Drop source on createPickupInfo for {((CreatePickupInfo)(ref pdc.createPickupInfo)).pickup} was null!"); } else { Log.Debug($"Drop source on createPickupInfo for {((CreatePickupInfo)(ref pdc.createPickupInfo)).pickup} is {pickupDropSource}"); PatchedPickupInfoInterop.SetPickupDropSource(ppc, PatchedPickupInfoInterop.GetPickupDropSource(ref pdc.createPickupInfo)); } } })) })); } private static void TransferDropSourceToPickup(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0067: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); w.MatchRelaxed(new Predicate<Instruction>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0) && w.SetCurrentTo(x), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<NetworkServer>(x, "Spawn") }).ThrowIfFailure().InsertBeforeCurrentStealLabels((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[5] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldobj, typeof(CreatePickupInfo))), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc_1)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc_3)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Action<CreatePickupInfo, GenericPickupController, PickupPickerController>>((Action<CreatePickupInfo, GenericPickupController, PickupPickerController>)delegate(CreatePickupInfo createPickupInfo, GenericPickupController gpc, PickupPickerController ppc) { //IL_000c: 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_002a: Unknown result type (might be due to invalid IL or missing references) Log.Debug("AfterPickupMade"); _ = ((CreatePickupInfo)(ref createPickupInfo)).pickup; GameObject pickupDropSource = PatchedPickupInfoInterop.GetPickupDropSource(ref createPickupInfo); if ((Object)(object)pickupDropSource == (Object)null) { Log.Debug($"Drop source on createPickupInfo for {((CreatePickupInfo)(ref createPickupInfo)).pickup} was null!"); } else { Log.Debug($"Drop source on createPickupInfo for {((CreatePickupInfo)(ref createPickupInfo)).pickup} is {pickupDropSource}"); if ((Object)(object)gpc != (Object)null) { Log.Debug("Setting drop source on GenericPickupController"); PatchedPickupInfoInterop.SetPickupDropSource(gpc, pickupDropSource); } else if ((Object)(object)ppc != (Object)null) { Log.Debug("Setting drop source on PickupPickerController"); PatchedPickupInfoInterop.SetPickupDropSource(ppc, pickupDropSource); } else { Log.Error("Both GenericPickupController AND PickupPickerController were null when trying to transfer drop source???"); } } })) })); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("LordVGames.DropSourceForItems", "DropSourceForItems", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Id = "LordVGames.DropSourceForItems"; public static string Name => "DropSourceForItems"; public static string Version => "1.0.0"; public void Awake() { ConfigOptions.BindConfigOptions(((BaseUnityPlugin)this).Config); Log.Init(((BaseUnityPlugin)this).Logger); MonoDetourManager.InvokeHookInitializers(typeof(Plugin).Assembly, false); } } } namespace DropSourceForItems.Vanilla { [MonoDetourTargets(typeof(ShrineChanceBehavior))] internal static class ChanceShrine { [CompilerGenerated] private static class <>O { public static Manipulator <0>__AddShrineStack; } [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__AddShrineStack; if (obj == null) { Manipulator val = AddShrineStack; <>O.<0>__AddShrineStack = val; obj = (object)val; } Mdh.RoR2.ShrineChanceBehavior.AddShrineStack.ILHook((Manipulator)obj); } private static void AddShrineStack(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); VariableDefinition val = default(VariableDefinition); w.DeclareVariable(typeof(Vector3), ref val); VariableDefinition val2 = default(VariableDefinition); w.DeclareVariable(typeof(Vector3), ref val2); VariableDefinition val3 = default(VariableDefinition); w.DeclareVariable(typeof(UniquePickup), ref val3); w.MatchRelaxed(new Predicate<Instruction>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupDropletController>(x, "CreatePickupDroplet") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertBeforeCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[11] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Action<ShrineChanceBehavior, UniquePickup, Vector3, Vector3>>((Action<ShrineChanceBehavior, UniquePickup, Vector3, Vector3>)delegate(ShrineChanceBehavior chanceShrineBehavior, UniquePickup pickup, Vector3 position, Vector3 velocity) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) CreatePickupInfo val4 = new CreatePickupInfo { rotation = Quaternion.identity }; ((CreatePickupInfo)(ref val4)).pickup = pickup; val4.position = position; val4.duplicated = false; val4.recycled = false; CreatePickupInfo val5 = val4; PatchedPickupInfoInterop.SetPickupDropSource(ref val5, ((Component)chanceShrineBehavior).gameObject); PickupDropletController.CreatePickupDroplet(val5, position, velocity); })), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)) })) .InsertBranchOver(w.Instructions[w.Index - 3], w.Current); } } [MonoDetourTargets(typeof(ChestBehavior))] internal static class ChestBehaviorSources { [CompilerGenerated] private static class <>O { public static Manipulator <0>__ChestItemDrop; } private const int createPickupInfoVariableNumber = 4; [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__ChestItemDrop; if (obj == null) { Manipulator val = ChestItemDrop; <>O.<0>__ChestItemDrop = val; obj = (object)val; } BaseItemDrop.ILHook((Manipulator)obj); } private static void ChestItemDrop(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0089: 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_00ec: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); w.MatchRelaxed(new Predicate<Instruction>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, 4), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "RoR2.GenericPickupController/CreatePickupInfo", "chest") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertAfterCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[4] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, 4)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Func<CreatePickupInfo, ChestBehavior, CreatePickupInfo>>((Func<CreatePickupInfo, ChestBehavior, CreatePickupInfo>)delegate(CreatePickupInfo createPickupInfo, ChestBehavior chestBehavior) { //IL_0017: 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) if ((Object)(object)chestBehavior == (Object)null || (Object)(object)((Component)chestBehavior).gameObject == (Object)null) { return createPickupInfo; } PatchedPickupInfoInterop.SetPickupDropSource(ref createPickupInfo, ((Component)chestBehavior).gameObject); return createPickupInfo; })), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, 4)) })); } } [MonoDetourTargets(typeof(DroneScrappingToIdle))] internal static class DroneScrapper { [CompilerGenerated] private static class <>O { public static Manipulator <0>__DropPickup; } [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__DropPickup; if (obj == null) { Manipulator val = DropPickup; <>O.<0>__DropPickup = val; obj = (object)val; } Mdh.EntityStates.DroneScrapper.DroneScrappingToIdle.DropPickup.ILHook((Manipulator)obj); } private static void DropPickup(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00a6: 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_00d8: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: 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_020b: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); VariableDefinition val = default(VariableDefinition); w.DeclareVariable(typeof(bool), ref val); VariableDefinition val2 = default(VariableDefinition); w.DeclareVariable(typeof(Vector3), ref val2); VariableDefinition val3 = default(VariableDefinition); w.DeclareVariable(typeof(Vector3), ref val3); VariableDefinition val4 = default(VariableDefinition); w.DeclareVariable(typeof(UniquePickup), ref val4); w.MatchRelaxed(new Predicate<Instruction>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupDropletController>(x, "CreatePickupDroplet") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertBeforeCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[14] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val4)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val4)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Action<DroneScrappingToIdle, UniquePickup, Vector3, Vector3, bool>>((Action<DroneScrappingToIdle, UniquePickup, Vector3, Vector3, bool>)delegate(DroneScrappingToIdle droneScrappingToIdle, UniquePickup pickup, Vector3 position, Vector3 velocity, bool isDuplicated) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) CreatePickupInfo val5 = new CreatePickupInfo { rotation = Quaternion.identity }; ((CreatePickupInfo)(ref val5)).pickup = pickup; val5.position = position; val5.duplicated = isDuplicated; val5.recycled = false; CreatePickupInfo val6 = val5; PatchedPickupInfoInterop.SetPickupDropSource(ref val6, ((EntityState)droneScrappingToIdle).gameObject); PickupDropletController.CreatePickupDroplet(val6, position, velocity); })), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val4)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)) })) .InsertBranchOver(w.Instructions[w.Index - 4], w.Current); } } [MonoDetourTargets(typeof(RouletteChestController))] internal static class GambaChest { [CompilerGenerated] private static class <>O { public static Manipulator <0>__EjectPickupServer; } [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__EjectPickupServer; if (obj == null) { Manipulator val = EjectPickupServer; <>O.<0>__EjectPickupServer = val; obj = (object)val; } Mdh.RoR2.RouletteChestController.EjectPickupServer.ILHook((Manipulator)obj); } private static void EjectPickupServer(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); VariableDefinition val = default(VariableDefinition); w.DeclareVariable(typeof(Vector3), ref val); VariableDefinition val2 = default(VariableDefinition); w.DeclareVariable(typeof(Vector3), ref val2); VariableDefinition val3 = default(VariableDefinition); w.DeclareVariable(typeof(UniquePickup), ref val3); w.MatchRelaxed(new Predicate<Instruction>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupDropletController>(x, "CreatePickupDroplet") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertBeforeCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[11] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Action<RouletteChestController, UniquePickup, Vector3, Vector3>>((Action<RouletteChestController, UniquePickup, Vector3, Vector3>)delegate(RouletteChestController rouletteChestController, UniquePickup pickup, Vector3 position, Vector3 velocity) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) CreatePickupInfo val4 = new CreatePickupInfo { rotation = Quaternion.identity }; ((CreatePickupInfo)(ref val4)).pickup = pickup; val4.position = position; val4.duplicated = false; val4.recycled = false; CreatePickupInfo val5 = val4; PatchedPickupInfoInterop.SetPickupDropSource(ref val5, ((Component)rouletteChestController).gameObject); PickupDropletController.CreatePickupDroplet(val5, position, velocity); })), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)) })) .InsertBranchOver(w.Instructions[w.Index - 3], w.Current); } } [MonoDetourTargets(typeof(HalcyoniteShrineInteractable))] internal static class HalcyonShrine { [CompilerGenerated] private static class <>O { public static Manipulator <0>__DropRewards; } private const int createPickupInfoVariableNumber = 9; [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__DropRewards; if (obj == null) { Manipulator val = DropRewards; <>O.<0>__DropRewards = val; obj = (object)val; } Mdh.RoR2.HalcyoniteShrineInteractable.DropRewards.ILHook((Manipulator)obj); } private static void DropRewards(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ILWeaver w = new ILWeaver(info); w.MatchMultipleRelaxed((Action<ILWeaver>)delegate(ILWeaver val) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) val.InsertAfterCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[4] { InstructionOrEnumerable.op_Implicit(val.Create(OpCodes.Ldloc, 9)), InstructionOrEnumerable.op_Implicit(val.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(val.CreateDelegateCall<Func<CreatePickupInfo, HalcyoniteShrineInteractable, CreatePickupInfo>>((Func<CreatePickupInfo, HalcyoniteShrineInteractable, CreatePickupInfo>)delegate(CreatePickupInfo createPickupInfo, HalcyoniteShrineInteractable halcyoniteShrineInteractable) { //IL_0017: 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) if ((Object)(object)halcyoniteShrineInteractable == (Object)null || (Object)(object)((Component)halcyoniteShrineInteractable).gameObject == (Object)null) { return createPickupInfo; } PatchedPickupInfoInterop.SetPickupDropSource(ref createPickupInfo, ((Component)halcyoniteShrineInteractable).gameObject); return createPickupInfo; })), InstructionOrEnumerable.op_Implicit(val.Create(OpCodes.Stloc, 9)) })); }, new Predicate<Instruction>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, 9), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 4), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "RoR2.GenericPickupController/CreatePickupInfo", "position") && w.SetCurrentTo(x) }).ThrowIfFailure(); } } [MonoDetourTargets(typeof(PickupPickerController))] internal static class OptionsPickup { [CompilerGenerated] private static class <>O { public static Manipulator <0>__ILHookThing; } private const int createPickupInfoVariableNumber = 1; [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__ILHookThing; if (obj == null) { Manipulator val = ILHookThing; <>O.<0>__ILHookThing = val; obj = (object)val; } CreatePickup_RoR2_UniquePickup.ILHook((Manipulator)obj); } private static void ILHookThing(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); w.MatchRelaxed(new Predicate<Instruction>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PickupPickerController>(x, "chestGeneratedFrom"), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "RoR2.GenericPickupController/CreatePickupInfo", "chest") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertAfterCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[4] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, 1)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Func<CreatePickupInfo, PickupPickerController, CreatePickupInfo>>((Func<CreatePickupInfo, PickupPickerController, CreatePickupInfo>)delegate(CreatePickupInfo createPickupInfo, PickupPickerController pickupPickerController) { //IL_0017: 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) if ((Object)(object)pickupPickerController == (Object)null || (Object)(object)((Component)pickupPickerController).gameObject == (Object)null) { return createPickupInfo; } PatchedPickupInfoInterop.SetPickupDropSource(ref createPickupInfo, ((Component)pickupPickerController).gameObject); return createPickupInfo; })), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, 1)) })); } } [MonoDetourTargets(typeof(ScavBackpackBehavior))] internal static class ScavBackpack { [CompilerGenerated] private static class <>O { public static Manipulator <0>__ItemDrop; } [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__ItemDrop; if (obj == null) { Manipulator val = ItemDrop; <>O.<0>__ItemDrop = val; obj = (object)val; } Mdh.RoR2.ScavBackpackBehavior.ItemDrop.ILHook((Manipulator)obj); } private static void ItemDrop(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); VariableDefinition val = default(VariableDefinition); w.DeclareVariable(typeof(Vector3), ref val); VariableDefinition val2 = default(VariableDefinition); w.DeclareVariable(typeof(Vector3), ref val2); VariableDefinition val3 = default(VariableDefinition); w.DeclareVariable(typeof(PickupIndex), ref val3); w.MatchRelaxed(new Predicate<Instruction>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupDropletController>(x, "CreatePickupDroplet") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertBeforeCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[11] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Action<ShrineChanceBehavior, PickupIndex, Vector3, Vector3>>((Action<ShrineChanceBehavior, PickupIndex, Vector3, Vector3>)delegate(ShrineChanceBehavior chanceShrineBehavior, PickupIndex pickupIndex, Vector3 position, Vector3 velocity) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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) CreatePickupInfo val4 = new CreatePickupInfo { rotation = Quaternion.identity }; ((CreatePickupInfo)(ref val4)).pickup = new UniquePickup { pickupIndex = pickupIndex }; val4.position = position; val4.duplicated = false; val4.recycled = false; CreatePickupInfo val5 = val4; PatchedPickupInfoInterop.SetPickupDropSource(ref val5, ((Component)chanceShrineBehavior).gameObject); PickupDropletController.CreatePickupDroplet(val5, position, velocity); })), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)) })) .InsertBranchOver(w.Instructions[w.Index - 3], w.Current); } } [MonoDetourTargets(typeof(ScrappingToIdle))] internal static class Scrapper { [CompilerGenerated] private static class <>O { public static Manipulator <0>__DroppingScrap; } private const int createPickupInfoVariableNumber = 2; [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__DroppingScrap; if (obj == null) { Manipulator val = DroppingScrap; <>O.<0>__DroppingScrap = val; obj = (object)val; } Mdh.EntityStates.Scrapper.ScrappingToIdle.OnEnter.ILHook((Manipulator)obj); } private static void DroppingScrap(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0089: 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_00ec: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); w.MatchRelaxed(new Predicate<Instruction>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, 2), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "RoR2.GenericPickupController/CreatePickupInfo", "set_pickup") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertAfterCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[4] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, 2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Func<CreatePickupInfo, ScrappingToIdle, CreatePickupInfo>>((Func<CreatePickupInfo, ScrappingToIdle, CreatePickupInfo>)delegate(CreatePickupInfo createPickupInfo, ScrappingToIdle scrappingToIdle) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (scrappingToIdle == null || (Object)(object)((EntityState)scrappingToIdle).gameObject == (Object)null) { return createPickupInfo; } PatchedPickupInfoInterop.SetPickupDropSource(ref createPickupInfo, ((EntityState)scrappingToIdle).gameObject); return createPickupInfo; })), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, 2)) })); } } [MonoDetourTargets(typeof(ShopTerminalBehavior))] internal static class ShopTerminalBehaviorSources { [CompilerGenerated] private static class <>O { public static Manipulator <0>__ShopTerminalDrop; } [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__ShopTerminalDrop; if (obj == null) { Manipulator val = ShopTerminalDrop; <>O.<0>__ShopTerminalDrop = val; obj = (object)val; } DropPickup_System_Boolean.ILHook((Manipulator)obj); } private static void ShopTerminalDrop(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00a6: 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_00d8: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: 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_020b: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); VariableDefinition val = default(VariableDefinition); w.DeclareVariable(typeof(bool), ref val); VariableDefinition val2 = default(VariableDefinition); w.DeclareVariable(typeof(Vector3), ref val2); VariableDefinition val3 = default(VariableDefinition); w.DeclareVariable(typeof(Vector3), ref val3); VariableDefinition val4 = default(VariableDefinition); w.DeclareVariable(typeof(UniquePickup), ref val4); w.MatchRelaxed(new Predicate<Instruction>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupDropletController>(x, "CreatePickupDroplet") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertBeforeCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[14] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Stloc, val4)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val4)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Action<ShopTerminalBehavior, UniquePickup, Vector3, Vector3, bool>>((Action<ShopTerminalBehavior, UniquePickup, Vector3, Vector3, bool>)delegate(ShopTerminalBehavior shopTerminalBehavior, UniquePickup pickup, Vector3 position, Vector3 velocity, bool isDuplicated) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) CreatePickupInfo val5 = new CreatePickupInfo { rotation = Quaternion.identity }; ((CreatePickupInfo)(ref val5)).pickup = pickup; val5.position = position; val5.duplicated = isDuplicated; val5.recycled = false; CreatePickupInfo val6 = val5; PatchedPickupInfoInterop.SetPickupDropSource(ref val6, ((Component)shopTerminalBehavior).gameObject); PickupDropletController.CreatePickupDroplet(val6, position, velocity); })), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val4)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val3)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val2)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, val)) })) .InsertBranchOver(w.Instructions[w.Index - 4], w.Current); } } [MonoDetourTargets(typeof(PickupDistributorBehavior))] internal static class TempItemDistributor { [CompilerGenerated] private static class <>O { public static Manipulator <0>__TempItemDrop; } private const int createPickupInfoVariableNumber = 4; [MonoDetourHookInitialize] private static void Setup() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__TempItemDrop; if (obj == null) { Manipulator val = TempItemDrop; <>O.<0>__TempItemDrop = val; obj = (object)val; } Drop.ILHook((Manipulator)obj); } private static void TempItemDrop(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); w.MatchRelaxed(new Predicate<Instruction>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, 4), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Transform>(x, "get_position"), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "RoR2.GenericPickupController/CreatePickupInfo", "position") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertAfterCurrent((IEnumerable<InstructionOrEnumerable>)new <>z__ReadOnlyArray<InstructionOrEnumerable>((InstructionOrEnumerable[])(object)new InstructionOrEnumerable[4] { InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldloc, 4)), InstructionOrEnumerable.op_Implicit(w.Create(OpCodes.Ldarg_0)), InstructionOrEnumerable.op_Implicit(w.CreateDelegateCall<Func<CreatePickupInfo, PickupDistributorBehavior, CreatePickupInfo>>((Func<CreatePickupInfo, PickupDistributorBehavior, CreatePickupInfo>)delegate(CreatePickupInfo createPickupInfo, PickupDistributorBehavior pickupDistributorBehavior) { //IL_0017: 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) if ((Object)(object)pickupDistributorBehavior == (Object)null || (Object)(object)((Component)pickupDistributorBehavior).gameObject == (Object)null) { return createPickupInfo; } PatchedPickupInfoInterop.SetPickupDropSource(ref createPickupInfo, ((Component)pickup
plugins/DropSourcePatcherInterop.dll
Decompiled 6 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 Microsoft.CodeAnalysis; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DropSourcePatcherInterop")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DropSourcePatcherInterop")] [assembly: AssemblyTitle("DropSourcePatcherInterop")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 DropSourceForItems { public static class PatchedPickupInfoInterop { public static GameObject GetPickupDropSource(this ref CreatePickupInfo pickupInfo) { return pickupInfo.dsfi_dropSource; } public static void SetPickupDropSource(this ref CreatePickupInfo pickupInfo, GameObject value) { pickupInfo.dsfi_dropSource = value; pickupInfo.dsfi_cachedDropSourceName = ((Object)value).name; } public static string GetCachedPickupDropSourceName(this ref CreatePickupInfo pickupInfo) { return pickupInfo.dsfi_cachedDropSourceName; } [Obsolete("SetPickupDropSource will set this for you")] public static void SetCachedPickupDropSourceName(this ref CreatePickupInfo pickupInfo, string value) { pickupInfo.dsfi_cachedDropSourceName = value; } public static GameObject GetPickupDropSource(this GenericPickupController gpc) { return gpc.dsfi_dropSource; } public static void SetPickupDropSource(this GenericPickupController gpc, GameObject value) { gpc.dsfi_dropSource = value; gpc.dsfi_cachedDropSourceName = ((Object)value).name; } public static string GetCachedPickuDropSourceName(this GenericPickupController gpc) { return gpc.dsfi_cachedDropSourceName; } [Obsolete("SetPickupDropSource will set this for you")] public static void SetCachedPickupDropSourceName(this GenericPickupController gpc, string value) { gpc.dsfi_cachedDropSourceName = value; } public static GameObject GetPickupDropSource(this PickupPickerController ppc) { return ppc.dsfi_dropSource; } public static void SetPickupDropSource(this PickupPickerController ppc, GameObject value) { ppc.dsfi_dropSource = value; ppc.dsfi_cachedDropSourceName = ((Object)value).name; } public static string GetCachedPickupDropSourceName(this PickupPickerController ppc) { return ppc.dsfi_cachedDropSourceName; } [Obsolete("SetPickupDropSource will set this for you")] public static void SetCachedPickupDropSourceName(this PickupPickerController ppc, string value) { ppc.dsfi_cachedDropSourceName = value; } } }