Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of LimitedInteractables v1.3.1
LimitedInteractables.dll
Decompiled 4 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BubbetsItems; using EntityStates; using EntityStates.DroneAssemblyStation; using EntityStates.DroneCombiner; using EntityStates.DroneScrapper; using EntityStates.Duplicator; using EntityStates.MealPrep; using EntityStates.Scrapper; using HarmonyLib; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.DroneAssemblyStation; using On.EntityStates.DroneCombiner; using On.EntityStates.DroneScrapper; using On.EntityStates.Duplicator; using On.EntityStates.MealPrep; using On.EntityStates.Scrapper; using On.RoR2; using R2API; using RoR2; using ShrineOfRepair.Behaviours; using ShrineOfRepair.Modules; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LimitedInteractables")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5c5354fbd558b225db284cbad0fe0113c85a74fe")] [assembly: AssemblyProduct("LimitedInteractables")] [assembly: AssemblyTitle("LimitedInteractables")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LimitedInteractables { public class CleansingPool { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<SceneDirector, DirectorCardCategorySelection> <>9__0_0; public static Action <>9__0_1; public static hook_Start <>9__0_2; public static hook_OnInteractionBegin <>9__0_3; public static hook_DropPickup <>9__0_4; internal void <Patch>b__0_0(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscShrineCleanse", "RoR2/Base/ShrineCleanse/iscShrineCleanse.asset", Main.CleansingPoolFrequency.Value, Main.CleansingPoolCost.Value); } internal void <Patch>b__0_1() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (!Main.CleansingPoolTakesEquipments.Value) { ShrineCleanseBehavior.cleansableEquipments = Array.Empty<EquipmentIndex>(); LunarItemOrEquipmentCostTypeHelper.lunarEquipmentIndices = Array.Empty<EquipmentIndex>(); } else { if (!Main.CleansingPoolVoidLunar.Value || !Chainloader.PluginInfos.ContainsKey("bubbet.bubbetsitems")) { return; } List<ItemIndex> list = new List<ItemIndex>(ShrineCleanseBehavior.cleansableItems); ItemIndex val = (ItemIndex)0; for (ItemIndex val2 = (ItemIndex)ItemCatalog.itemCount; val < val2; val = (ItemIndex)(val + 1)) { ItemDef itemDef = ItemCatalog.GetItemDef(val); if (isVoidLunar(itemDef.tier)) { list.Add(val); } } ShrineCleanseBehavior.cleansableItems = list.ToArray(); List<ItemIndex> list2 = new List<ItemIndex>(); list2.AddRange(ItemCatalog.lunarItemList); ItemIndex val3 = (ItemIndex)0; for (ItemIndex val4 = (ItemIndex)ItemCatalog.itemCount; val3 < val4; val3 = (ItemIndex)(val3 + 1)) { ItemDef itemDef2 = ItemCatalog.GetItemDef(val3); if (isVoidLunar(itemDef2.tier)) { list2.Add(itemDef2.itemIndex); } } LunarItemOrEquipmentCostTypeHelper.lunarItemIndices = list2.ToArray(); } } internal void <Patch>b__0_2(orig_Start orig, ShopTerminalBehavior self) { if (((Object)((Component)self).gameObject).name.Contains("ShrineCleanse")) { Main.InitUses(((Component)self).gameObject, Main.CleansingPoolUses.Value); } orig.Invoke(self); } internal void <Patch>b__0_3(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (((Object)((Component)self).gameObject).name.Contains("ShrineCleanse") && Main.uses.ContainsKey(((Component)self).gameObject)) { Main.uses[((Component)self).gameObject]--; if (Main.uses[((Component)self).gameObject] <= 0) { ((Behaviour)((Component)self).GetComponent<PurchaseInteraction>()).enabled = false; } } orig.Invoke(self, activator); } internal void <Patch>b__0_4(orig_DropPickup orig, ShopTerminalBehavior self) { if (((Object)((Component)self).gameObject).name.Contains("ShrineCleanse") && Run.instance.runRNG.RangeFloat(0f, 1f) > Main.CleansingPoolChance.Value) { self.SetHasBeenPurchased(true); } else { orig.Invoke(self); } } } public static void Patch() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown Main.onGenerateInteractableCardSelection += delegate(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscShrineCleanse", "RoR2/Base/ShrineCleanse/iscShrineCleanse.asset", Main.CleansingPoolFrequency.Value, Main.CleansingPoolCost.Value); }; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (!Main.CleansingPoolTakesEquipments.Value) { ShrineCleanseBehavior.cleansableEquipments = Array.Empty<EquipmentIndex>(); LunarItemOrEquipmentCostTypeHelper.lunarEquipmentIndices = Array.Empty<EquipmentIndex>(); } else if (Main.CleansingPoolVoidLunar.Value && Chainloader.PluginInfos.ContainsKey("bubbet.bubbetsitems")) { List<ItemIndex> list = new List<ItemIndex>(ShrineCleanseBehavior.cleansableItems); ItemIndex val4 = (ItemIndex)0; for (ItemIndex val5 = (ItemIndex)ItemCatalog.itemCount; val4 < val5; val4 = (ItemIndex)(val4 + 1)) { ItemDef itemDef = ItemCatalog.GetItemDef(val4); if (isVoidLunar(itemDef.tier)) { list.Add(val4); } } ShrineCleanseBehavior.cleansableItems = list.ToArray(); List<ItemIndex> list2 = new List<ItemIndex>(); list2.AddRange(ItemCatalog.lunarItemList); ItemIndex val6 = (ItemIndex)0; for (ItemIndex val7 = (ItemIndex)ItemCatalog.itemCount; val6 < val7; val6 = (ItemIndex)(val6 + 1)) { ItemDef itemDef2 = ItemCatalog.GetItemDef(val6); if (isVoidLunar(itemDef2.tier)) { list2.Add(itemDef2.itemIndex); } } LunarItemOrEquipmentCostTypeHelper.lunarItemIndices = list2.ToArray(); } }); object obj = <>c.<>9__0_2; if (obj == null) { hook_Start val = delegate(orig_Start orig, ShopTerminalBehavior self) { if (((Object)((Component)self).gameObject).name.Contains("ShrineCleanse")) { Main.InitUses(((Component)self).gameObject, Main.CleansingPoolUses.Value); } orig.Invoke(self); }; <>c.<>9__0_2 = val; obj = (object)val; } ShopTerminalBehavior.Start += (hook_Start)obj; object obj2 = <>c.<>9__0_3; if (obj2 == null) { hook_OnInteractionBegin val2 = delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (((Object)((Component)self).gameObject).name.Contains("ShrineCleanse") && Main.uses.ContainsKey(((Component)self).gameObject)) { Main.uses[((Component)self).gameObject]--; if (Main.uses[((Component)self).gameObject] <= 0) { ((Behaviour)((Component)self).GetComponent<PurchaseInteraction>()).enabled = false; } } orig.Invoke(self, activator); }; <>c.<>9__0_3 = val2; obj2 = (object)val2; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj2; object obj3 = <>c.<>9__0_4; if (obj3 == null) { hook_DropPickup val3 = delegate(orig_DropPickup orig, ShopTerminalBehavior self) { if (((Object)((Component)self).gameObject).name.Contains("ShrineCleanse") && Run.instance.runRNG.RangeFloat(0f, 1f) > Main.CleansingPoolChance.Value) { self.SetHasBeenPurchased(true); } else { orig.Invoke(self); } }; <>c.<>9__0_4 = val3; obj3 = (object)val3; } ShopTerminalBehavior.DropPickup += (hook_DropPickup)obj3; } public static bool isVoidLunar(ItemTier tier) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return tier == BubbetsItemsPlugin.VoidLunarTier.tier; } } public class DroneAssembly { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Converter<string, string> <>9__0_3; public static hook_Awake <>9__0_0; public static hook_OnInteractionBegin <>9__0_1; public static hook_TransferItem <>9__0_2; internal string <Patch>b__0_3(string x) { return x.Trim(); } internal void <Patch>b__0_0(orig_Awake orig, PurchaseInteraction self) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (NetworkServer.active && ((Object)self).name.Contains("DroneAssemblyStation")) { Main.InitUses(((Component)self).gameObject, Main.DroneAssemblyMaxUses.Value); GameObject gameObject = ((Component)((Component)self).GetComponent<ModelLocator>().modelTransform).gameObject; gameObject.transform.localPosition = gameObject.transform.localPosition + Vector3.up * 0.5f; gameObject.transform.eulerAngles = gameObject.transform.eulerAngles + new Vector3(0f, 0f, 90f); } } internal void <Patch>b__0_1(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (self.CanBeAffordedByInteractor(activator) && ((Object)self).name.Contains("DroneAssemblyStation")) { Main.uses[((Component)self).gameObject]--; } orig.Invoke(self, activator); } internal void <Patch>b__0_2(orig_TransferItem orig, AssemblingDroneState self) { orig.Invoke(self); if (Main.uses.ContainsKey(((EntityState)self).gameObject) && Main.uses[((EntityState)self).gameObject] == 0) { ((Component)((EntityState)self).outer).GetComponent<PurchaseInteraction>().SetAvailable(false); } } } public static void Patch() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Invalid comparison between Unknown and I8 //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: 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_01dd: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) InteractableSpawnCard val = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC3/DroneAssemblyStation/iscDroneAssemblyStation.asset").WaitForCompletion(); ((SpawnCard)val).directorCreditCost = (int)Main.DroneAssemblyCost.Value; val.maxSpawnsPerStage = Main.DroneAssemblyMaxSpawns.Value; DirectorCard card = new DirectorCard { spawnCard = (SpawnCard)(object)val, selectionWeight = (int)Main.DroneAssemblyFrequency.Value }; DirectorCardHolder val2 = new DirectorCardHolder { Card = card, InteractableCategory = (InteractableCategory)8 }; foreach (string item in Main.DroneAssemblyStages.Value.Split(',').ToList().ConvertAll((string x) => x.Trim())) { bool flag = false; foreach (object value in Enum.GetValues(typeof(Stage))) { Stage val3 = (Stage)value; if ((long)val3 == 1 || !(item == DirectorAPI.ToInternalStageName(val3))) { continue; } Helpers.AddNewInteractableToStage(val2, val3, ""); flag = true; break; } if (!flag) { Helpers.AddNewInteractableToStage(val2, (Stage)1, item); } } object obj = <>c.<>9__0_0; if (obj == null) { hook_Awake val4 = delegate(orig_Awake orig, PurchaseInteraction self) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (NetworkServer.active && ((Object)self).name.Contains("DroneAssemblyStation")) { Main.InitUses(((Component)self).gameObject, Main.DroneAssemblyMaxUses.Value); GameObject gameObject = ((Component)((Component)self).GetComponent<ModelLocator>().modelTransform).gameObject; gameObject.transform.localPosition = gameObject.transform.localPosition + Vector3.up * 0.5f; gameObject.transform.eulerAngles = gameObject.transform.eulerAngles + new Vector3(0f, 0f, 90f); } }; <>c.<>9__0_0 = val4; obj = (object)val4; } PurchaseInteraction.Awake += (hook_Awake)obj; object obj2 = <>c.<>9__0_1; if (obj2 == null) { hook_OnInteractionBegin val5 = delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (self.CanBeAffordedByInteractor(activator) && ((Object)self).name.Contains("DroneAssemblyStation")) { Main.uses[((Component)self).gameObject]--; } orig.Invoke(self, activator); }; <>c.<>9__0_1 = val5; obj2 = (object)val5; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj2; object obj3 = <>c.<>9__0_2; if (obj3 == null) { hook_TransferItem val6 = delegate(orig_TransferItem orig, AssemblingDroneState self) { orig.Invoke(self); if (Main.uses.ContainsKey(((EntityState)self).gameObject) && Main.uses[((EntityState)self).gameObject] == 0) { ((Component)((EntityState)self).outer).GetComponent<PurchaseInteraction>().SetAvailable(false); } }; <>c.<>9__0_2 = val6; obj3 = (object)val6; } AssemblingDroneState.TransferItem += (hook_TransferItem)obj3; } } public class DroneCombiner { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<SceneDirector, DirectorCardCategorySelection> <>9__0_0; public static hook_Awake <>9__0_1; public static hook_OnInteractionBegin <>9__0_2; public static hook_OnEnter <>9__0_3; internal void <Patch>b__0_0(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDroneCombinerStation", "RoR2/DLC3/DroneCombinerStation/iscDroneCombinerStation.asset", Main.DroneCombinerFrequency.Value, Main.DroneCombinerCost.Value, Main.DroneAssemblyMaxSpawns.Value); } internal void <Patch>b__0_1(orig_Awake orig, PurchaseInteraction self) { orig.Invoke(self); if (NetworkServer.active && ((Object)self).name.Contains("DroneCombinerStation")) { Main.InitUses(((Component)self).gameObject, Main.DroneCombinerMaxUses.Value); } } internal void <Patch>b__0_2(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (self.CanBeAffordedByInteractor(activator) && ((Object)self).name.Contains("DroneCombinerStation")) { Main.uses[((Component)self).gameObject]--; } orig.Invoke(self, activator); } internal void <Patch>b__0_3(orig_OnEnter orig, DroneCombinerCombining self) { orig.Invoke(self); if (Main.uses.ContainsKey(((EntityState)self).gameObject) && Main.uses[((EntityState)self).gameObject] == 0) { ((Component)((EntityState)self).outer).GetComponent<PurchaseInteraction>().SetAvailable(false); } } } public static void Patch() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_005f: 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_006a: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown Main.onGenerateInteractableCardSelection += delegate(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDroneCombinerStation", "RoR2/DLC3/DroneCombinerStation/iscDroneCombinerStation.asset", Main.DroneCombinerFrequency.Value, Main.DroneCombinerCost.Value, Main.DroneAssemblyMaxSpawns.Value); }; object obj = <>c.<>9__0_1; if (obj == null) { hook_Awake val = delegate(orig_Awake orig, PurchaseInteraction self) { orig.Invoke(self); if (NetworkServer.active && ((Object)self).name.Contains("DroneCombinerStation")) { Main.InitUses(((Component)self).gameObject, Main.DroneCombinerMaxUses.Value); } }; <>c.<>9__0_1 = val; obj = (object)val; } PurchaseInteraction.Awake += (hook_Awake)obj; object obj2 = <>c.<>9__0_2; if (obj2 == null) { hook_OnInteractionBegin val2 = delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (self.CanBeAffordedByInteractor(activator) && ((Object)self).name.Contains("DroneCombinerStation")) { Main.uses[((Component)self).gameObject]--; } orig.Invoke(self, activator); }; <>c.<>9__0_2 = val2; obj2 = (object)val2; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj2; object obj3 = <>c.<>9__0_3; if (obj3 == null) { hook_OnEnter val3 = delegate(orig_OnEnter orig, DroneCombinerCombining self) { orig.Invoke(self); if (Main.uses.ContainsKey(((EntityState)self).gameObject) && Main.uses[((EntityState)self).gameObject] == 0) { ((Component)((EntityState)self).outer).GetComponent<PurchaseInteraction>().SetAvailable(false); } }; <>c.<>9__0_3 = val3; obj3 = (object)val3; } DroneCombinerCombining.OnEnter += (hook_OnEnter)obj3; } } public class DroneScrapper { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<SceneDirector, DirectorCardCategorySelection> <>9__0_0; public static hook_OnEnter <>9__0_1; public static hook_OnEnter <>9__0_2; internal void <Patch>b__0_0(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDroneScrapper", "RoR2/DLC3/DroneScrapper/iscDroneScrapper.asset", Main.DroneScrapperFrequency.Value, Main.DroneScrapperCost.Value); } internal void <Patch>b__0_1(orig_OnEnter orig, DroneScrapperBaseState self) { GameObject gameObject = ((Component)((EntityState)self).outer).gameObject; if (!Main.uses.ContainsKey(gameObject)) { Main.uses.Add(gameObject, Main.DroneScrapperMaxUses.Value); } orig.Invoke(self); if (Main.uses[gameObject] <= 0) { ((Component)((EntityState)self).outer).GetComponent<DroneScrapperPickerController>().SetAvailable(false); } } internal void <Patch>b__0_2(orig_OnEnter orig, DroneScrapping self) { GameObject gameObject = ((Component)((EntityState)self).outer).gameObject; if ((Object)(object)gameObject != (Object)null && Main.uses.ContainsKey(gameObject)) { Main.uses[gameObject]--; } orig.Invoke(self); } } public static void Patch() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_005f: 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_006a: Expected O, but got Unknown Main.onGenerateInteractableCardSelection += delegate(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDroneScrapper", "RoR2/DLC3/DroneScrapper/iscDroneScrapper.asset", Main.DroneScrapperFrequency.Value, Main.DroneScrapperCost.Value); }; object obj = <>c.<>9__0_1; if (obj == null) { hook_OnEnter val = delegate(orig_OnEnter orig, DroneScrapperBaseState self) { GameObject gameObject2 = ((Component)((EntityState)self).outer).gameObject; if (!Main.uses.ContainsKey(gameObject2)) { Main.uses.Add(gameObject2, Main.DroneScrapperMaxUses.Value); } orig.Invoke(self); if (Main.uses[gameObject2] <= 0) { ((Component)((EntityState)self).outer).GetComponent<DroneScrapperPickerController>().SetAvailable(false); } }; <>c.<>9__0_1 = val; obj = (object)val; } DroneScrapperBaseState.OnEnter += (hook_OnEnter)obj; object obj2 = <>c.<>9__0_2; if (obj2 == null) { hook_OnEnter val2 = delegate(orig_OnEnter orig, DroneScrapping self) { GameObject gameObject = ((Component)((EntityState)self).outer).gameObject; if ((Object)(object)gameObject != (Object)null && Main.uses.ContainsKey(gameObject)) { Main.uses[gameObject]--; } orig.Invoke(self); }; <>c.<>9__0_2 = val2; obj2 = (object)val2; } DroneScrapping.OnEnter += (hook_OnEnter)obj2; } } public class Duplicator { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<SceneDirector, DirectorCardCategorySelection> <>9__0_0; public static Action<SceneDirector, DirectorCardCategorySelection> <>9__0_1; public static Action<SceneDirector, DirectorCardCategorySelection> <>9__0_2; public static Action<SceneDirector, DirectorCardCategorySelection> <>9__0_3; public static hook_Awake <>9__0_4; public static hook_OnInteractionBegin <>9__0_5; public static hook_DropDroplet <>9__0_6; internal void <Patch>b__0_0(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDuplicator", "RoR2/Base/Duplicator/iscDuplicator.asset", Main.DuplicatorFrequencyWhite.Value, Main.DuplicatorCostWhite.Value); } internal void <Patch>b__0_1(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDuplicatorLarge", "RoR2/Base/DuplicatorLarge/iscDuplicatorLarge.asset", Main.DuplicatorFrequencyGreen.Value, Main.DuplicatorCostGreen.Value); } internal void <Patch>b__0_2(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDuplicatorMilitary", "RoR2/Base/DuplicatorMilitary/iscDuplicatorMilitary.asset", Main.DuplicatorFrequencyRed.Value, Main.DuplicatorCostRed.Value); } internal void <Patch>b__0_3(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDuplicatorWild", "RoR2/Base/DuplicatorWild/iscDuplicatorWild.asset", Main.DuplicatorFrequencyYellow.Value, Main.DuplicatorCostYellow.Value); } internal void <Patch>b__0_4(orig_Awake orig, PurchaseInteraction self) { orig.Invoke(self); if (NetworkServer.active) { if (((Object)self).name.Contains("DuplicatorWild")) { Main.InitUses(((Component)self).gameObject, Main.DuplicatorUsesYellow.Value); } else if (((Object)self).name.Contains("DuplicatorMilitary")) { Main.InitUses(((Component)self).gameObject, Main.DuplicatorUsesRed.Value); } else if (((Object)self).name.Contains("DuplicatorLarge")) { Main.InitUses(((Component)self).gameObject, Main.DuplicatorUsesGreen.Value); } else if (((Object)self).name.Contains("Duplicator")) { Main.InitUses(((Component)self).gameObject, Main.DuplicatorUsesWhite.Value); } } } internal void <Patch>b__0_5(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (self.CanBeAffordedByInteractor(activator) && ((Object)self).name.Contains("Duplicator")) { Main.uses[((Component)self).gameObject]--; } orig.Invoke(self, activator); } internal void <Patch>b__0_6(orig_DropDroplet orig, Duplicating self) { orig.Invoke(self); if (Main.uses.ContainsKey(((EntityState)self).gameObject) && Main.uses[((EntityState)self).gameObject] == 0) { ((Component)((EntityState)self).outer).GetComponent<ShopTerminalBehavior>().SetHasBeenPurchased(true); ((Component)((EntityState)self).outer).GetComponent<ShopTerminalBehavior>().SetNoPickup(); ((Component)((EntityState)self).outer).GetComponent<PurchaseInteraction>().Networkavailable = false; } } } public static void Patch() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown Main.onGenerateInteractableCardSelection += delegate(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDuplicator", "RoR2/Base/Duplicator/iscDuplicator.asset", Main.DuplicatorFrequencyWhite.Value, Main.DuplicatorCostWhite.Value); }; Main.onGenerateInteractableCardSelection += delegate(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDuplicatorLarge", "RoR2/Base/DuplicatorLarge/iscDuplicatorLarge.asset", Main.DuplicatorFrequencyGreen.Value, Main.DuplicatorCostGreen.Value); }; Main.onGenerateInteractableCardSelection += delegate(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDuplicatorMilitary", "RoR2/Base/DuplicatorMilitary/iscDuplicatorMilitary.asset", Main.DuplicatorFrequencyRed.Value, Main.DuplicatorCostRed.Value); }; Main.onGenerateInteractableCardSelection += delegate(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscDuplicatorWild", "RoR2/Base/DuplicatorWild/iscDuplicatorWild.asset", Main.DuplicatorFrequencyYellow.Value, Main.DuplicatorCostYellow.Value); }; object obj = <>c.<>9__0_4; if (obj == null) { hook_Awake val = delegate(orig_Awake orig, PurchaseInteraction self) { orig.Invoke(self); if (NetworkServer.active) { if (((Object)self).name.Contains("DuplicatorWild")) { Main.InitUses(((Component)self).gameObject, Main.DuplicatorUsesYellow.Value); } else if (((Object)self).name.Contains("DuplicatorMilitary")) { Main.InitUses(((Component)self).gameObject, Main.DuplicatorUsesRed.Value); } else if (((Object)self).name.Contains("DuplicatorLarge")) { Main.InitUses(((Component)self).gameObject, Main.DuplicatorUsesGreen.Value); } else if (((Object)self).name.Contains("Duplicator")) { Main.InitUses(((Component)self).gameObject, Main.DuplicatorUsesWhite.Value); } } }; <>c.<>9__0_4 = val; obj = (object)val; } PurchaseInteraction.Awake += (hook_Awake)obj; object obj2 = <>c.<>9__0_5; if (obj2 == null) { hook_OnInteractionBegin val2 = delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (self.CanBeAffordedByInteractor(activator) && ((Object)self).name.Contains("Duplicator")) { Main.uses[((Component)self).gameObject]--; } orig.Invoke(self, activator); }; <>c.<>9__0_5 = val2; obj2 = (object)val2; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj2; object obj3 = <>c.<>9__0_6; if (obj3 == null) { hook_DropDroplet val3 = delegate(orig_DropDroplet orig, Duplicating self) { orig.Invoke(self); if (Main.uses.ContainsKey(((EntityState)self).gameObject) && Main.uses[((EntityState)self).gameObject] == 0) { ((Component)((EntityState)self).outer).GetComponent<ShopTerminalBehavior>().SetHasBeenPurchased(true); ((Component)((EntityState)self).outer).GetComponent<ShopTerminalBehavior>().SetNoPickup(); ((Component)((EntityState)self).outer).GetComponent<PurchaseInteraction>().Networkavailable = false; } }; <>c.<>9__0_6 = val3; obj3 = (object)val3; } Duplicating.DropDroplet += (hook_DropDroplet)obj3; } } public class LunarTablet { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<Stage> <>9__2_0; public static hook_OnInteractionBegin <>9__2_1; internal void <Patch>b__2_0(Stage self) { if (self.sceneDef.cachedName != "bazaar") { return; } GameObject obj = GameObject.Find("HOLDER: Store"); object obj2; if (obj == null) { obj2 = null; } else { Transform transform = obj.transform; if (transform == null) { obj2 = null; } else { Transform obj3 = transform.Find("LunarShop"); if (obj3 == null) { obj2 = null; } else { Transform obj4 = obj3.Find("LunarRecycler"); obj2 = ((obj4 != null) ? ((Component)obj4).GetComponent<PurchaseInteraction>() : null); } } } PurchaseInteraction val = (PurchaseInteraction)obj2; if ((Object)(object)val != (Object)null) { if (Main.LunarTabletCost.Value == 0) { ((Component)val).gameObject.SetActive(false); return; } slab = ((Component)val).gameObject; val.cost = Main.LunarTabletCost.Value; uses = Main.LunarTabletUses.Value; } } internal void <Patch>b__2_1(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { bool flag = self.CanBeAffordedByInteractor(activator); orig.Invoke(self, activator); if ((Object)(object)((Component)self).gameObject == (Object)(object)slab && flag) { uses--; if (uses == 0) { ((Behaviour)self).enabled = false; } } } } public static GameObject slab; public static int uses; public static void Patch() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown Stage.onStageStartGlobal += delegate(Stage self) { if (!(self.sceneDef.cachedName != "bazaar")) { GameObject obj2 = GameObject.Find("HOLDER: Store"); object obj3; if (obj2 == null) { obj3 = null; } else { Transform transform = obj2.transform; if (transform == null) { obj3 = null; } else { Transform obj4 = transform.Find("LunarShop"); if (obj4 == null) { obj3 = null; } else { Transform obj5 = obj4.Find("LunarRecycler"); obj3 = ((obj5 != null) ? ((Component)obj5).GetComponent<PurchaseInteraction>() : null); } } } PurchaseInteraction val2 = (PurchaseInteraction)obj3; if ((Object)(object)val2 != (Object)null) { if (Main.LunarTabletCost.Value == 0) { ((Component)val2).gameObject.SetActive(false); } else { slab = ((Component)val2).gameObject; val2.cost = Main.LunarTabletCost.Value; uses = Main.LunarTabletUses.Value; } } } }; object obj = <>c.<>9__2_1; if (obj == null) { hook_OnInteractionBegin val = delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { bool flag = self.CanBeAffordedByInteractor(activator); orig.Invoke(self, activator); if ((Object)(object)((Component)self).gameObject == (Object)(object)slab && flag) { uses--; if (uses == 0) { ((Behaviour)self).enabled = false; } } }; <>c.<>9__2_1 = val; obj = (object)val; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj; } } [BepInPlugin("prodzpod.LimitedInteractables", "LimitedInteractables", "1.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Main : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<Stage> <>9__54_0; public static Action<SceneDirector, DirectorCardCategorySelection> <>9__54_1; public static hook_GetContextString <>9__54_2; public static hook_GetContextString <>9__54_3; public static hook_GetContextString <>9__54_4; public static hook_GetContextString <>9__54_5; public static hook_GetDisplayName <>9__54_6; internal void <Awake>b__54_0(Stage stage) { uses.Clear(); } internal void <Awake>b__54_1(SceneDirector director, DirectorCardCategorySelection selection) { if (NetworkServer.active && Main.onGenerateInteractableCardSelection != null) { Main.onGenerateInteractableCardSelection(director, selection); } } internal string <Awake>b__54_2(orig_GetContextString orig, PurchaseInteraction self, Interactor activator) { return orig.Invoke(self, activator) + GetUsesString(((Component)self).gameObject); } internal string <Awake>b__54_3(orig_GetContextString orig, ShrineCleanseBehavior self, Interactor activator) { return orig.Invoke(self, activator) + GetUsesString(((Component)self).gameObject); } internal string <Awake>b__54_4(orig_GetContextString orig, PickupPickerController self, Interactor activator) { return orig.Invoke(self, activator) + GetUsesString(((Component)self).gameObject); } internal string <Awake>b__54_5(orig_GetContextString orig, DroneScrapperPickerController self, Interactor activator) { return orig.Invoke(self, activator) + GetUsesString(((Component)self).gameObject); } internal string <Awake>b__54_6(orig_GetDisplayName orig, PurchaseInteraction self) { return orig.Invoke(self) + GetUsesString(((Component)self).gameObject); } } public const string PluginGUID = "prodzpod.LimitedInteractables"; public const string PluginAuthor = "prodzpod"; public const string PluginName = "LimitedInteractables"; public const string PluginVersion = "1.3.0"; public static ManualLogSource Log; public static Harmony Harmony; public static PluginInfo pluginInfo; public static ConfigFile Config; public static ConfigEntry<int> ScrapperStackAtOnce; public static ConfigEntry<float> ScrapperFrequency; public static ConfigEntry<float> ScrapperCost; public static ConfigEntry<int> ScrapperMaxUses; public static ConfigEntry<float> ScrapperChance; public static ConfigEntry<float> DroneScrapperFrequency; public static ConfigEntry<float> DroneScrapperCost; public static ConfigEntry<int> DroneScrapperMaxUses; public static ConfigEntry<string> DroneAssemblyStages; public static ConfigEntry<float> DroneAssemblyFrequency; public static ConfigEntry<float> DroneAssemblyCost; public static ConfigEntry<int> DroneAssemblyMaxUses; public static ConfigEntry<int> DroneAssemblyMaxSpawns; public static ConfigEntry<float> DroneCombinerFrequency; public static ConfigEntry<float> DroneCombinerCost; public static ConfigEntry<int> DroneCombinerMaxUses; public static ConfigEntry<int> DroneCombinerMaxSpawns; public static ConfigEntry<float> DuplicatorFrequencyWhite; public static ConfigEntry<float> DuplicatorFrequencyGreen; public static ConfigEntry<float> DuplicatorFrequencyRed; public static ConfigEntry<float> DuplicatorFrequencyYellow; public static ConfigEntry<float> DuplicatorCostWhite; public static ConfigEntry<float> DuplicatorCostGreen; public static ConfigEntry<float> DuplicatorCostRed; public static ConfigEntry<float> DuplicatorCostYellow; public static ConfigEntry<int> DuplicatorUsesWhite; public static ConfigEntry<int> DuplicatorUsesGreen; public static ConfigEntry<int> DuplicatorUsesRed; public static ConfigEntry<int> DuplicatorUsesYellow; public static ConfigEntry<string> RepairRepairList; public static ConfigEntry<int> RepairStackAtOnce; public static ConfigEntry<int> LunarTabletCost; public static ConfigEntry<int> LunarTabletUses; public static ConfigEntry<bool> CleansingPoolTakesEquipments; public static ConfigEntry<bool> CleansingPoolVoidLunar; public static ConfigEntry<float> CleansingPoolFrequency; public static ConfigEntry<float> CleansingPoolCost; public static ConfigEntry<int> CleansingPoolUses; public static ConfigEntry<float> CleansingPoolChance; public static ConfigEntry<int> CHEFMaxUses; public static ConfigEntry<float> CHEFChance; public static ConfigEntry<int> RecyclerMaxUses; public static Dictionary<GameObject, int> uses; public static event Action<SceneDirector, DirectorCardCategorySelection> onGenerateInteractableCardSelection; public void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Expected O, but got Unknown //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Expected O, but got Unknown //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Expected O, but got Unknown //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Expected O, but got Unknown //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Expected O, but got Unknown pluginInfo = ((BaseUnityPlugin)this).Info; Harmony = new Harmony("prodzpod.LimitedInteractables"); Log = ((BaseUnityPlugin)this).Logger; Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.LimitedInteractables.cfg"), true); uses = new Dictionary<GameObject, int>(); Stage.onServerStageComplete += delegate { uses.Clear(); }; DuplicatorFrequencyWhite = Config.Bind<float>("3D Printer Tweaks", "Common Printer Frequency", 1f, "Multiplier for Scrapper spawn frequency."); DuplicatorFrequencyGreen = Config.Bind<float>("3D Printer Tweaks", "Uncommon Printer Frequency", 1f, "Multiplier for Scrapper spawn frequency."); DuplicatorFrequencyRed = Config.Bind<float>("3D Printer Tweaks", "Legendary Printer Frequency", 1f, "Multiplier for Scrapper spawn frequency."); DuplicatorFrequencyYellow = Config.Bind<float>("3D Printer Tweaks", "Boss Printer Frequency", 1f, "Multiplier for Scrapper spawn frequency."); DuplicatorCostWhite = Config.Bind<float>("3D Printer Tweaks", "Common Printer Cost", 1f, "Multiplier for Scrapper spawn cost."); DuplicatorCostGreen = Config.Bind<float>("3D Printer Tweaks", "Uncommon Printer Cost", 1f, "Multiplier for Scrapper spawn cost."); DuplicatorCostRed = Config.Bind<float>("3D Printer Tweaks", "Legendary Printer Cost", 1f, "Multiplier for Scrapper spawn cost."); DuplicatorCostYellow = Config.Bind<float>("3D Printer Tweaks", "Boss Printer Cost", 0.8f, "Multiplier for Scrapper spawn cost."); DuplicatorUsesWhite = Config.Bind<int>("3D Printer Tweaks", "Common Printer Max Uses", 0, "Max number of items to duplicate. Set to 0 to disable."); DuplicatorUsesGreen = Config.Bind<int>("3D Printer Tweaks", "Uncommon Printer Max Uses", 0, "Max number of items to duplicate. Set to 0 to disable."); DuplicatorUsesRed = Config.Bind<int>("3D Printer Tweaks", "Legendary Printer Max Uses", 0, "Max number of items to duplicate. Set to 0 to disable."); DuplicatorUsesYellow = Config.Bind<int>("3D Printer Tweaks", "Boss Printer Max Uses", 1, "Max number of items to duplicate. Set to 0 to disable."); Duplicator.Patch(); ScrapperStackAtOnce = Config.Bind<int>("Scrapper Tweaks", "Scrapper Stacks at Once", 1, "Max number of items to scrap at once. Set to 0 to disable."); ScrapperFrequency = Config.Bind<float>("Scrapper Tweaks", "Scrapper Frequency", 1f, "Multiplier for Scrapper spawn frequency."); ScrapperCost = Config.Bind<float>("Scrapper Tweaks", "Scrapper Cost", 1f, "Multiplier for Scrapper spawn cost."); ScrapperMaxUses = Config.Bind<int>("Scrapper Tweaks", "Scrapper Max Uses", 3, "Max number of items to scrap per scrapper. Set to 0 to disable."); ScrapperChance = Config.Bind<float>("Scrapper Tweaks", "Scrapper Chance", 1f, "Chance for scrapper to give you scrap."); Scrapper.Patch(); DroneScrapperFrequency = Config.Bind<float>("Drone Scrapper Tweaks", "Scrapper Frequency", 1f, "Multiplier for Drone Scrapper spawn frequency."); DroneScrapperCost = Config.Bind<float>("Drone Scrapper Tweaks", "Scrapper Cost", 1f, "Multiplier for Drone Scrapper spawn cost."); DroneScrapperMaxUses = Config.Bind<int>("Drone Scrapper Tweaks", "Scrapper Max Uses", 3, "Max number of drones to scrap per drone scrapper. Set to 0 to disable."); DroneScrapper.Patch(); DroneAssemblyStages = Config.Bind<string>("Drone Assembly Station Tweaks", "Drone Assembly Station Stages", "", "Stages to spawn the unused station (separated by comma)"); DroneAssemblyMaxSpawns = Config.Bind<int>("Drone Assembly Station Tweaks", "Drone Assembly Station Max Spawns per Stage", -1, "Max number of stations per stage. Set to -1 to uncap."); DroneAssemblyFrequency = Config.Bind<float>("Drone Assembly Station Tweaks", "Drone Assembly Station Frequency", 1f, "Drone Assembly Station spawn frequency."); DroneAssemblyCost = Config.Bind<float>("Drone Assembly Station Tweaks", "Drone Assembly Station Cost", 15f, "Drone Assembly Station spawn cost. default is equal to combiner."); DroneAssemblyMaxUses = Config.Bind<int>("Drone Assembly Station Tweaks", "Drone Assembly Station Max Uses", 1, "Max number of items to upgrade drones. Set to 0 to disable."); DroneAssembly.Patch(); DroneCombinerMaxSpawns = Config.Bind<int>("Drone Combiner Station Tweaks", "Drone Combiner Station Max Spawns per Stage", 1, "Max number of stations per stage. Set to -1 to uncap."); DroneCombinerFrequency = Config.Bind<float>("Drone Combiner Station Tweaks", "Drone Combiner Station Frequency", 1f, "Multiplier for Drone Combiner Station spawn frequency."); DroneCombinerCost = Config.Bind<float>("Drone Combiner Station Tweaks", "Drone Combiner Station Cost", 1f, "Multiplier for Drone Combiner Station spawn cost."); DroneCombinerMaxUses = Config.Bind<int>("Drone Combiner Station Tweaks", "Drone Combiner Station Max Uses", 3, "Max number of items to combine drones. Set to 0 to disable."); DroneCombiner.Patch(); RepairRepairList = Config.Bind<string>("Shrine of Repair Tweaks", "Shrine of Repair True Repair List", "ExtraLifeConsumed, ExtraLifeVoidConsumed, FragileDamageBonusConsumed, HealingPotionConsumed, RegeneratingScrapConsumed, BossHunterConsumed", "List of repairs to count in the following configs."); RepairStackAtOnce = Config.Bind<int>("Shrine of Repair Tweaks", "Shrine of Repair Stacks at Once", 0, "Max number of items to repair at once. ONLY AFFECTS ONES ON TRUE REPAIR LIST. Set to 0 to disable."); if (Chainloader.PluginInfos.ContainsKey("com.Viliger.ShrineOfRepair") && RepairStackAtOnce.Value > 0) { ShrineRepair.Patch(); } LunarTabletCost = Config.Bind<int>("Lunar Tablet Tweaks", "Lunar Tablet Start Cost", 5, "Set to 0 to remove it completely"); LunarTabletUses = Config.Bind<int>("Lunar Tablet Tweaks", "Lunar Tablet Max Uses", 0, "Set to 0 for vanilla behaviour"); LunarTablet.Patch(); CleansingPoolTakesEquipments = Config.Bind<bool>("Cleansing Pool Tweaks", "Cleansing Pool Accepts Lunar Equipments", true, "yeah"); CleansingPoolVoidLunar = Config.Bind<bool>("Cleansing Pool Tweaks", "Cleansing Pool Accepts Void Lunar", true, "Set to false to not accept void lunar at in Cleansing Pools."); CleansingPoolFrequency = Config.Bind<float>("Cleansing Pool Tweaks", "Cleansing Pool Frequency", 1f, "Multiplier for Cleansing Pool spawn frequency."); CleansingPoolCost = Config.Bind<float>("Cleansing Pool Tweaks", "Cleansing Pool Cost", 1f, "Multiplier for Cleansing Pool spawn cost."); CleansingPoolUses = Config.Bind<int>("Cleansing Pool Tweaks", "Cleansing Pool Max Uses", 0, "Set to 0 for vanilla behaviour"); CleansingPoolChance = Config.Bind<float>("Cleansing Pool Tweaks", "Cleansing Pool Chance", 1f, "Chance for Cleansing Pool to give you scrap."); CleansingPool.Patch(); CHEFMaxUses = Config.Bind<int>("CHEF Tweaks", "CHEF Max Uses", 3, "Max number of items to craft per chef. Set to 0 to disable."); CHEFChance = Config.Bind<float>("CHEF Tweaks", "CHEF Chance", 1f, "Chance for chef to actually give you the item."); MealPrep.Patch(); RecyclerMaxUses = Config.Bind<int>("Recycler Tweaks", "Recycler Max Uses", 1, "Vanilla: 1, set to 0 to disable."); Recycler.Patch(); SceneDirector.onGenerateInteractableCardSelection += delegate(SceneDirector director, DirectorCardCategorySelection selection) { if (NetworkServer.active && Main.onGenerateInteractableCardSelection != null) { Main.onGenerateInteractableCardSelection(director, selection); } }; object obj = <>c.<>9__54_2; if (obj == null) { hook_GetContextString val = (orig_GetContextString orig, PurchaseInteraction self, Interactor activator) => orig.Invoke(self, activator) + GetUsesString(((Component)self).gameObject); <>c.<>9__54_2 = val; obj = (object)val; } PurchaseInteraction.GetContextString += (hook_GetContextString)obj; object obj2 = <>c.<>9__54_3; if (obj2 == null) { hook_GetContextString val2 = (orig_GetContextString orig, ShrineCleanseBehavior self, Interactor activator) => orig.Invoke(self, activator) + GetUsesString(((Component)self).gameObject); <>c.<>9__54_3 = val2; obj2 = (object)val2; } ShrineCleanseBehavior.GetContextString += (hook_GetContextString)obj2; object obj3 = <>c.<>9__54_4; if (obj3 == null) { hook_GetContextString val3 = (orig_GetContextString orig, PickupPickerController self, Interactor activator) => orig.Invoke(self, activator) + GetUsesString(((Component)self).gameObject); <>c.<>9__54_4 = val3; obj3 = (object)val3; } PickupPickerController.GetContextString += (hook_GetContextString)obj3; object obj4 = <>c.<>9__54_5; if (obj4 == null) { hook_GetContextString val4 = (orig_GetContextString orig, DroneScrapperPickerController self, Interactor activator) => orig.Invoke(self, activator) + GetUsesString(((Component)self).gameObject); <>c.<>9__54_5 = val4; obj4 = (object)val4; } DroneScrapperPickerController.GetContextString += (hook_GetContextString)obj4; object obj5 = <>c.<>9__54_6; if (obj5 == null) { hook_GetDisplayName val5 = (orig_GetDisplayName orig, PurchaseInteraction self) => orig.Invoke(self) + GetUsesString(((Component)self).gameObject); <>c.<>9__54_6 = val5; obj5 = (object)val5; } PurchaseInteraction.GetDisplayName += (hook_GetDisplayName)obj5; } public static string GetUsesString(GameObject obj) { int usesInt = GetUsesInt(obj); if (usesInt == -1) { return ""; } return string.Format(" ({0} use{1})", usesInt, (usesInt > 1) ? "s" : ""); } public static int GetUsesInt(GameObject obj) { if (uses.ContainsKey(obj) && uses[obj] > 0) { return uses[obj]; } if ((Object)(object)obj == (Object)(object)LunarTablet.slab && LunarTablet.uses > 0) { return LunarTablet.uses; } if (Chainloader.PluginInfos.ContainsKey("com.Viliger.ShrineOfRepair")) { return GetRepairUses(obj); } return -1; } public static int GetRepairUses(GameObject obj) { ShrineOfRepairPickerManager component = obj.GetComponent<ShrineOfRepairPickerManager>(); if ((Object)(object)component != (Object)null && component.uses < ShrineOfRepairConfigManager.MaxUses.Value) { return ShrineOfRepairConfigManager.MaxUses.Value - component.uses; } return -1; } public static void InitUses(GameObject self, int use) { if (NetworkServer.active) { if (!uses.ContainsKey(self)) { uses.Add(self, use); } else { uses[self] = use; } } } public static void TweakFrequencyAndCost(DirectorCardCategorySelection dccs, string name, string cscName, float frequency, float cost, int max = -2) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) int categoryIndex = GetCategoryIndex(dccs, name); if (categoryIndex < 0) { return; } DirectorCard card = GetCard(dccs, categoryIndex, name); if (card == null) { return; } List<DirectorCard> list = dccs.categories[categoryIndex].cards.ToList(); list.Remove(card); dccs.categories[categoryIndex].cards = list.ToArray(); if (!((float)card.selectionWeight * frequency <= 0f)) { SpawnCard val = Addressables.LoadAssetAsync<SpawnCard>((object)cscName).WaitForCompletion(); val.directorCreditCost = Mathf.Max(1, (int)((float)val.directorCreditCost * cost)); if (max != -2) { ((InteractableSpawnCard)val).maxSpawnsPerStage = max; } DirectorCard val2 = new DirectorCard { spawnCard = val, selectionWeight = Mathf.Max(0, (int)((float)card.selectionWeight * frequency)) }; dccs.AddCard(categoryIndex, val2); } } public static int GetCategoryIndex(DirectorCardCategorySelection dccs, string name) { for (int i = 0; i < dccs.categories.Length; i++) { DirectorCard[] cards = dccs.categories[i].cards; foreach (DirectorCard val in cards) { if (((Object)val.spawnCard).name.StartsWith(name)) { return i; } } } return -1; } public static DirectorCard GetCard(DirectorCardCategorySelection dccs, int category, string name) { DirectorCard[] cards = dccs.categories[category].cards; foreach (DirectorCard val in cards) { if (((Object)val.spawnCard).name.StartsWith(name)) { return val; } } return null; } } public class MealPrep { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnEnter <>9__0_0; public static hook_OnEnter <>9__0_1; internal void <Patch>b__0_0(orig_OnEnter orig, MealPrepBaseState self) { GameObject gameObject = ((Component)((EntityState)self).outer).gameObject; if (!Main.uses.ContainsKey(gameObject)) { Main.uses.Add(gameObject, Main.CHEFMaxUses.Value); } orig.Invoke(self); if (Main.uses[gameObject] <= 0) { ((PickupPickerController)((Component)((EntityState)self).outer).GetComponent<CraftingController>()).SetAvailable(false); } } internal void <Patch>b__0_1(orig_OnEnter orig, Cooking self) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)((EntityState)self).outer).gameObject; if ((Object)(object)gameObject != (Object)null && Main.uses.ContainsKey(gameObject)) { Main.uses[gameObject]--; } if (Run.instance.runRNG.RangeFloat(0f, 1f) > Main.CHEFChance.Value) { ((MealPrepBaseState)self).pickupToDrop = PickupIndex.none; } orig.Invoke(self); } } public static void Patch() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown object obj = <>c.<>9__0_0; if (obj == null) { hook_OnEnter val = delegate(orig_OnEnter orig, MealPrepBaseState self) { GameObject gameObject2 = ((Component)((EntityState)self).outer).gameObject; if (!Main.uses.ContainsKey(gameObject2)) { Main.uses.Add(gameObject2, Main.CHEFMaxUses.Value); } orig.Invoke(self); if (Main.uses[gameObject2] <= 0) { ((PickupPickerController)((Component)((EntityState)self).outer).GetComponent<CraftingController>()).SetAvailable(false); } }; <>c.<>9__0_0 = val; obj = (object)val; } MealPrepBaseState.OnEnter += (hook_OnEnter)obj; object obj2 = <>c.<>9__0_1; if (obj2 == null) { hook_OnEnter val2 = delegate(orig_OnEnter orig, Cooking self) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)((EntityState)self).outer).gameObject; if ((Object)(object)gameObject != (Object)null && Main.uses.ContainsKey(gameObject)) { Main.uses[gameObject]--; } if (Run.instance.runRNG.RangeFloat(0f, 1f) > Main.CHEFChance.Value) { ((MealPrepBaseState)self).pickupToDrop = PickupIndex.none; } orig.Invoke(self); }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } Cooking.OnEnter += (hook_OnEnter)obj2; } } public class Recycler { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<Stage> <>9__1_0; public static hook_Start <>9__1_1; public static Func<Instruction, bool> <>9__1_4; public static Func<Instruction, bool> <>9__1_5; public static Func<GenericPickupController, bool> <>9__1_6; public static Manipulator <>9__1_2; public static hook_GetLocalizedStringByToken <>9__1_3; internal void <Patch>b__1_0(Stage stage) { uses.Clear(); } internal void <Patch>b__1_1(orig_Start orig, GenericPickupController self) { if (!uses.ContainsKey(self)) { uses.Add(self, Main.RecyclerMaxUses.Value); } else { uses[self] = Main.RecyclerMaxUses.Value; } orig.Invoke(self); } internal void <Patch>b__1_2(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GenericPickupController>(x, "set_NetworkRecycled") }); val.Remove(); val.Emit(OpCodes.Ldloc_0); val.EmitDelegate<Func<GenericPickupController, bool>>((Func<GenericPickupController, bool>)delegate(GenericPickupController self) { uses[self]--; return (uses[self] == 0) ? true : false; }); } internal bool <Patch>b__1_4(Instruction x) { return ILPatternMatchingExt.MatchLdcI4(x, 1); } internal bool <Patch>b__1_5(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<GenericPickupController>(x, "set_NetworkRecycled"); } internal bool <Patch>b__1_6(GenericPickupController self) { uses[self]--; if (uses[self] == 0) { return true; } return false; } internal string <Patch>b__1_3(orig_GetLocalizedStringByToken orig, Language self, string token) { if (token == "EQUIPMENT_RECYCLER_PICKUP") { string text = "Transform an Item or Equipment into a different one."; if (Main.RecyclerMaxUses.Value > 0) { text = text + " Can only recycle up to " + Main.RecyclerMaxUses.Value + " times."; } return text; } if (token == "EQUIPMENT_RECYCLER_DESC") { string text2 = "<style=cIsUtility>Transform</style> an Item or Equipment into a different one."; if (Main.RecyclerMaxUses.Value > 0) { text2 = text2 + " <style=cIsUtility>Can only be converted into the same tier " + Main.RecyclerMaxUses.Value + " times</style>."; } return text2; } return orig.Invoke(self, token); } } public static Dictionary<GenericPickupController, int> uses; public static void Patch() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown uses = new Dictionary<GenericPickupController, int>(); Stage.onServerStageComplete += delegate { uses.Clear(); }; object obj = <>c.<>9__1_1; if (obj == null) { hook_Start val = delegate(orig_Start orig, GenericPickupController self) { if (!uses.ContainsKey(self)) { uses.Add(self, Main.RecyclerMaxUses.Value); } else { uses[self] = Main.RecyclerMaxUses.Value; } orig.Invoke(self); }; <>c.<>9__1_1 = val; obj = (object)val; } GenericPickupController.Start += (hook_Start)obj; object obj2 = <>c.<>9__1_2; if (obj2 == null) { Manipulator val2 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) ILCursor val4 = new ILCursor(il); val4.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GenericPickupController>(x, "set_NetworkRecycled") }); val4.Remove(); val4.Emit(OpCodes.Ldloc_0); val4.EmitDelegate<Func<GenericPickupController, bool>>((Func<GenericPickupController, bool>)delegate(GenericPickupController self) { uses[self]--; return (uses[self] == 0) ? true : false; }); }; <>c.<>9__1_2 = val2; obj2 = (object)val2; } EquipmentSlot.FireRecycle += (Manipulator)obj2; object obj3 = <>c.<>9__1_3; if (obj3 == null) { hook_GetLocalizedStringByToken val3 = delegate(orig_GetLocalizedStringByToken orig, Language self, string token) { if (token == "EQUIPMENT_RECYCLER_PICKUP") { string text = "Transform an Item or Equipment into a different one."; if (Main.RecyclerMaxUses.Value > 0) { text = text + " Can only recycle up to " + Main.RecyclerMaxUses.Value + " times."; } return text; } if (token == "EQUIPMENT_RECYCLER_DESC") { string text2 = "<style=cIsUtility>Transform</style> an Item or Equipment into a different one."; if (Main.RecyclerMaxUses.Value > 0) { text2 = text2 + " <style=cIsUtility>Can only be converted into the same tier " + Main.RecyclerMaxUses.Value + " times</style>."; } return text2; } return orig.Invoke(self, token); }; <>c.<>9__1_3 = val3; obj3 = (object)val3; } Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj3; } } public class Scrapper { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<SceneDirector, DirectorCardCategorySelection> <>9__0_0; public static hook_PreStartClient <>9__0_1; public static hook_OnEnter <>9__0_2; public static hook_OnEnter <>9__0_3; internal void <Patch>b__0_0(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscScrapper", "RoR2/Base/Scrapper/iscScrapper.asset", Main.ScrapperFrequency.Value, Main.ScrapperCost.Value); } internal void <Patch>b__0_1(orig_PreStartClient orig, ScrapperController self) { self.maxItemsToScrapAtATime = Main.ScrapperStackAtOnce.Value; orig.Invoke(self); } internal void <Patch>b__0_2(orig_OnEnter orig, ScrapperBaseState self) { GameObject gameObject = ((Component)((EntityState)self).outer).gameObject; if (!Main.uses.ContainsKey(gameObject)) { Main.uses.Add(gameObject, Main.ScrapperMaxUses.Value); } orig.Invoke(self); if (Main.uses[gameObject] <= 0) { ((Component)((EntityState)self).outer).GetComponent<PickupPickerController>().SetAvailable(false); } } internal void <Patch>b__0_3(orig_OnEnter orig, Scrapping self) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)((EntityState)self).outer).gameObject; if ((Object)(object)gameObject != (Object)null && Main.uses.ContainsKey(gameObject)) { Main.uses[gameObject]--; } if (Run.instance.runRNG.RangeFloat(0f, 1f) > Main.ScrapperChance.Value) { ((ScrapperBaseState)self).scrapperController.pickupPrintQueue[0] = UniquePickup.none; } orig.Invoke(self); } } public static void Patch() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown Main.onGenerateInteractableCardSelection += delegate(SceneDirector dir, DirectorCardCategorySelection sel) { Main.TweakFrequencyAndCost(sel, "iscScrapper", "RoR2/Base/Scrapper/iscScrapper.asset", Main.ScrapperFrequency.Value, Main.ScrapperCost.Value); }; if (Main.ScrapperStackAtOnce.Value > 0) { object obj = <>c.<>9__0_1; if (obj == null) { hook_PreStartClient val = delegate(orig_PreStartClient orig, ScrapperController self) { self.maxItemsToScrapAtATime = Main.ScrapperStackAtOnce.Value; orig.Invoke(self); }; <>c.<>9__0_1 = val; obj = (object)val; } ScrapperController.PreStartClient += (hook_PreStartClient)obj; } object obj2 = <>c.<>9__0_2; if (obj2 == null) { hook_OnEnter val2 = delegate(orig_OnEnter orig, ScrapperBaseState self) { GameObject gameObject2 = ((Component)((EntityState)self).outer).gameObject; if (!Main.uses.ContainsKey(gameObject2)) { Main.uses.Add(gameObject2, Main.ScrapperMaxUses.Value); } orig.Invoke(self); if (Main.uses[gameObject2] <= 0) { ((Component)((EntityState)self).outer).GetComponent<PickupPickerController>().SetAvailable(false); } }; <>c.<>9__0_2 = val2; obj2 = (object)val2; } ScrapperBaseState.OnEnter += (hook_OnEnter)obj2; object obj3 = <>c.<>9__0_3; if (obj3 == null) { hook_OnEnter val3 = delegate(orig_OnEnter orig, Scrapping self) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)((EntityState)self).outer).gameObject; if ((Object)(object)gameObject != (Object)null && Main.uses.ContainsKey(gameObject)) { Main.uses[gameObject]--; } if (Run.instance.runRNG.RangeFloat(0f, 1f) > Main.ScrapperChance.Value) { ((ScrapperBaseState)self).scrapperController.pickupPrintQueue[0] = UniquePickup.none; } orig.Invoke(self); }; <>c.<>9__0_3 = val3; obj3 = (object)val3; } Scrapping.OnEnter += (hook_OnEnter)obj3; } } public class ShrineRepair { [HarmonyPatch(typeof(ShrineOfRepairPickerManager), "HandleSelection", new Type[] { typeof(int) })] public class PatchSelection { public static void ILManipulator(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 3) }); val.Emit(OpCodes.Ldloc_0); val.EmitDelegate<Func<int, PickupDef, int>>((Func<int, PickupDef, int>)delegate(int count, PickupDef pickupDef) { //IL_0008: 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) if (((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex)) == -1) { return count; } return repairList.Contains(((Object)ItemCatalog.GetItemDef(pickupDef.itemIndex)).name) ? Mathf.Min(count, Main.RepairStackAtOnce.Value) : count; }); } } [HarmonyPatch(typeof(ShrineOfRepairPickerManager), "HandleInteraction", new Type[] { typeof(Interactor) })] public class PatchInteraction { public static void ILManipulator(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 6) }); val.Emit(OpCodes.Ldloc, 5); val.EmitDelegate<Func<int, KeyValuePair<ItemIndex, ItemIndex>, int>>((Func<int, KeyValuePair<ItemIndex, ItemIndex>, int>)((int count, KeyValuePair<ItemIndex, ItemIndex> repairItems) => repairList.Contains(((Object)ItemCatalog.GetItemDef(repairItems.Key)).name) ? Mathf.Min(count, Main.RepairStackAtOnce.Value) : count)); } } public static List<string> repairList = new List<string>(); public static void Patch() { string[] array = Main.RepairRepairList.Value.Split(','); foreach (string text in array) { repairList.Add(text.Trim()); } Main.Log.LogDebug((object)("Repair Repair List: " + GeneralExtensions.Join<string>((IEnumerable<string>)repairList, (Func<string, string>)null, ", "))); Main.Harmony.PatchAll(typeof(PatchSelection)); Main.Harmony.PatchAll(typeof(PatchInteraction)); } } }